/* Daybook visual identity. Same label-card family as Cadence (2px ink borders,
   hard offset shadows) but its own look: warm paper cream ground, ink text, a
   deep plum accent. Phone first, generous 44px touch targets. */

:root {
  --paper: #f4ecd6;
  --paper-2: #efe4c6;
  --card: #fbf6e9;
  --ink: #26201b;
  --ink-soft: #5c5146;
  --accent: #5e2750;
  --accent-ink: #fbf6e9;
  --accent-soft: #efd9e6;
  --good: #2f6f4f;
  --line: #26201b;
  --radius: 10px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.2;
}

button {
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.05s ease;
}

button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}

textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

label {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 12px;
}

.masthead .brand {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand .dot {
  color: var(--accent);
}

/* Login */
.login-wrap {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 16px;
}

.msg {
  margin-top: 12px;
  min-height: 1.4em;
  font-size: 0.95rem;
}

.msg.error {
  color: var(--accent);
  font-weight: 600;
}

.msg.ok {
  color: var(--good);
  font-weight: 600;
}

/* Nav tabs, one row */
nav.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

nav.tabs button {
  flex: 1 0 auto;
  min-width: 88px;
  box-shadow: var(--shadow-sm);
}

nav.tabs button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Date header */
.dateline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dateline .today-link {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--accent);
  text-decoration: underline;
  min-height: auto;
  padding: 4px;
}

.dateline .nav-arrow {
  min-width: 48px;
}

.date-title {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
}

/* Habit checklist on Today */
.habit-row,
.note-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--paper-2);
}

.habit-row:first-child,
.note-row:first-child {
  border-top: none;
}

.check {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding: 0;
  min-height: 30px;
}

.check.on {
  background: var(--accent);
  color: var(--accent-ink);
}

.grow {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.note-row.done .grow {
  text-decoration: line-through;
  color: var(--ink-soft);
}

.icon-btn {
  min-width: 44px;
  padding: 0 10px;
}

.add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.add-row input {
  flex: 1;
}

.saved-flash {
  font-size: 0.85rem;
  color: var(--good);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.saved-flash.show {
  opacity: 1;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.pill {
  display: inline-block;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  background: var(--accent-soft);
  margin-right: 6px;
}

.badge {
  display: inline-block;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent);
  color: var(--accent-ink);
  margin-right: 8px;
}

/* Calendar grid */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dow {
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.cal-cell {
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  min-height: 62px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: var(--shadow-sm);
}

.cal-cell.empty {
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.cal-cell .daynum {
  font-weight: 700;
}

.cal-markers {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  flex-wrap: wrap;
}

.mk-diary {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.mk-notes {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.mk-habits {
  font-size: 0.72rem;
  font-weight: 700;
}

/* Habit management */
.habit-card {
  border-top: 1px solid var(--paper-2);
  padding-top: 14px;
  margin-top: 14px;
}

.habit-card:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.habit-card.archived {
  opacity: 0.55;
}

.habit-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.habit-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.chips {
  margin: 8px 0;
}

.grid70 {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin-top: 8px;
  max-width: 340px;
}

.gcell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--paper-2);
  border: 1px solid rgba(38, 32, 27, 0.15);
}

.gcell.on {
  background: var(--accent);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Search */
.result {
  border-top: 1px solid var(--paper-2);
  padding: 12px 0;
}

.result:first-child {
  border-top: none;
}

.result .date-link {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--accent);
  text-decoration: underline;
  padding: 0;
  min-height: auto;
  font-weight: 700;
}

.result .snippet {
  color: var(--ink-soft);
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}
