/*
 * The app's palette, ported. Same warm paper ground and soft brown-black ink, so
 * opening the dashboard feels like the other half of the same object rather than
 * an admin panel that happens to hold her messages.
 *
 * No external fonts on purpose — the CSP forbids loading anything off-box, which
 * for a page holding private messages is worth more than a typeface.
 */

:root {
  --canvas: #faf5f0;
  --canvas-dim: #f2eae3;
  --surface: #ffffff;
  --surface-alt: #fffbf7;
  --hairline: #ede2d9;
  --ink: #1e1917;
  --ink-secondary: #6c5f57;
  --ink-muted: #a3948a;
  --accent: #e86a4e;
  --accent-soft: #fce8e1;
  --success: #4e9e6e;
  --shadow: rgba(30, 25, 23, 0.08);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #141110;
    --canvas-dim: #0d0b0a;
    --surface: #1e1918;
    --surface-alt: #272120;
    --hairline: #2f2827;
    --ink: #f6efea;
    --ink-secondary: #b3a49b;
    --ink-muted: #7b6d66;
    --accent: #ff8367;
    --accent-soft: #3a211b;
    --success: #6fbe8d;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 22px 96px;
}

/* ——— Header */

header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.eyebrow.live { color: var(--accent); }

h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -0.6px;
  margin: 6px 0 0;
  font-weight: 600;
}

.spacer { flex: 1; }

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
}

button,
.button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-secondary);
  padding: 9px 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

button:hover,
.button:hover { background: var(--canvas-dim); color: var(--ink); }
button:active { transform: scale(0.97); }
button[disabled] { opacity: 0.45; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff7f4;
}
button.primary:hover { background: var(--accent); filter: brightness(1.05); color: #fff7f4; }

/* ——— Messages */

.feed { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 18px 20px;
  position: relative;
}

.card.unread {
  background: var(--accent-soft);
  border-color: transparent;
}

.card .body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.card .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.photos:last-child { margin-bottom: 0; }

.photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  cursor: zoom-in;
  background: var(--canvas-dim);
  display: block;
}

.day {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 20px 2px 2px;
}
.day:first-child { margin-top: 0; }

/* ——— Empty + status */

.empty {
  text-align: center;
  padding: 72px 20px;
  color: var(--ink-muted);
}
.empty h2 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  font-size: 21px;
  margin: 0 0 6px;
}
.empty p { margin: 0; font-size: 14px; }

.status {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 6px 24px var(--shadow);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--ink-secondary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.status.show { opacity: 1; }

/* ——— Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 16, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  z-index: 10;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
}

/* ——— Login */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login form {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: 30px;
}
.login h1 { font-size: 27px; margin-bottom: 20px; }
.login input {
  width: 100%;
  font: inherit;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--canvas-dim);
  color: var(--ink);
  margin-bottom: 12px;
}
.login input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login button { width: 100%; padding: 13px; font-size: 15px; }
.login .bad { color: var(--accent); font-size: 13px; margin: 0 0 12px; }

/* ——— Tabs */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--canvas-dim);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 22px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 10px 12px;
  color: var(--ink-muted);
}
.tab:hover { background: transparent; color: var(--ink-secondary); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px var(--shadow);
}

.panel[hidden] { display: none; }

.toolbar { display: flex; align-items: center; margin: 22px 2px 8px; }
.toolbar .day { margin: 0; }

/* ——— Forms */

.composer {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

textarea,
input[type="text"],
input[type="time"],
input[type="number"],
select {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--canvas-dim);
  color: var(--ink);
  resize: vertical;
}
textarea { min-height: 68px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.composer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 130px; }

.labelled { display: flex; flex-direction: column; gap: 5px; }
.labelled span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.check input { width: auto; accent-color: var(--accent); }

.hint { font-size: 12px; color: var(--ink-muted); }

.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button {
  padding: 7px 11px;
  font-size: 12px;
  min-width: 44px;
}
.days button.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

/* ——— Her day */

.grid {
  display: grid;
  /* Fixed 2x2 rather than auto-fit. There are exactly four stats: auto-fit either
     orphans one on a three-wide row, or stacks all four on a phone and turns a
     glance into a scroll. Two columns reads at every width. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 16px 18px;
}
.stat .k {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.stat .v {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.15;
  margin-top: 4px;
  letter-spacing: -0.5px;
}
.stat .sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--canvas-dim);
  overflow: hidden;
  margin-top: 10px;
}
.meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.needs { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.need { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.need span { width: 74px; color: var(--ink-secondary); flex: none; }
.need .meter { flex: 1; margin: 0; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pill {
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
}
.pill.ate { background: rgba(78, 158, 110, 0.14); border-color: transparent; color: var(--success); }
.pill.skipped { background: var(--canvas-dim); border-color: transparent; }
.pill.later { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.strip { display: flex; gap: 4px; margin-top: 12px; }
.strip i {
  flex: 1;
  height: 30px;
  border-radius: 6px;
  background: var(--canvas-dim);
}
.strip i[data-level="1"] { background: rgba(232, 106, 78, 0.25); }
.strip i[data-level="2"] { background: rgba(232, 106, 78, 0.55); }
.strip i[data-level="3"] { background: var(--accent); }

/* ——— Reminders + queue rows */

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 13px 16px;
  margin-bottom: 8px;
}
.row .grow { flex: 1; min-width: 0; }
.row .when { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; color: var(--accent); }
.row .when.off { color: var(--ink-muted); }
.row .what { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.row .meta { font-size: 12px; color: var(--ink-muted); }
.row.done { opacity: 0.55; }
.row button { padding: 7px 12px; font-size: 12px; }
