/* Nova — one stylesheet, mobile first. */

:root {
  --bg:      #0d1117;
  --surface: #161b22;
  --raised:  #1c2430;
  --line:    #273040;
  --text:    #e6edf3;
  --muted:   #8b98a8;
  --accent:  #5aa9ff;
  --accent-soft: rgba(90,169,255,.14);
  --good:    #3fb950;
  --warn:    #d29922;
  --bad:     #f85149;
  --radius:  14px;
  --tab-h:   58px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:#f6f7f9; --surface:#fff; --raised:#f0f2f5; --line:#dfe3e8;
    --text:#141a21; --muted:#5d6b7a; --accent-soft: rgba(20,110,220,.10); --accent:#0b6bcb;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 .8em; }
code { background: var(--raised); padding: .1em .35em; border-radius: 5px; font-size: .9em; }

/* ── chrome ─────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; font-weight: 650; margin: 0; }
.topbar-links { display: flex; gap: 14px; font-size: 14px; }
.topbar-links a { color: var(--muted); }
.topbar-links a.on { color: var(--text); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; letter-spacing: .01em;
}
.tabbar a.on { color: var(--accent); }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.page { padding: 16px; max-width: 760px; margin: 0 auto; }

.flashes { position: sticky; top: 0; z-index: 40; padding: 8px 16px 0; max-width: 760px; margin: 0 auto; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; border: 1px solid; }
.flash-ok    { background: rgba(63,185,80,.12);  border-color: rgba(63,185,80,.35);  }
.flash-warn  { background: rgba(210,153,34,.12); border-color: rgba(210,153,34,.35); }
.flash-error { background: rgba(248,81,73,.12);  border-color: rgba(248,81,73,.35);  }

/* ── building blocks ────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; padding-bottom: 0; }
.item-title { font-weight: 550; }
.item-meta { font-size: 13px; color: var(--muted); }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  background: var(--raised); color: var(--muted); border: 1px solid var(--line);
}
.pill-1 { color: var(--bad);  border-color: rgba(248,81,73,.4);  }
.pill-2 { color: var(--warn); border-color: rgba(210,153,34,.4); }
.pill-ok { color: var(--good); border-color: rgba(63,185,80,.4); }

/* ── forms ──────────────────────────────────────────────── */

input, textarea, select, button { font: inherit; color: inherit; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], textarea, select {
  width: 100%;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 12px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 16px; font-weight: 600; cursor: pointer;
}
button:active, .btn:active { transform: translateY(1px); }
button[disabled] { opacity: .5; cursor: default; }
.btn-quiet { background: var(--raised); color: var(--text); border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid rgba(248,81,73,.35); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  background: var(--raised); border: 1px solid var(--line); color: var(--muted);
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ── chat ───────────────────────────────────────────────── */

.thread { display: flex; flex-direction: column; gap: 14px; padding-bottom: 96px; }

.bubble { max-width: 88%; padding: 12px 14px; border-radius: 16px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul { margin: .4em 0; padding-left: 1.2em; }
.bubble.me {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 5px;
}
.bubble.nova {
  align-self: flex-start; background: var(--surface);
  border: 1px solid var(--line); border-bottom-left-radius: 5px;
}
.bubble-steps { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.bubble-steps span { display: block; }
.bubble-sources { margin-top: 6px; font-size: 12px; }
.bubble-sources a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  z-index: 25;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.composer-inner { display: flex; gap: 8px; align-items: flex-end; max-width: 760px; margin: 0 auto; }
.composer textarea {
  min-height: 44px; max-height: 140px; border-radius: 22px; padding: 11px 16px; resize: none;
}
.composer button { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex: none; }
.mic.listening { background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.typing { display: flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.4s infinite both;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* Horizontal scroll rows: swipeable, but no scrollbar eating a row of pixels. */
.suggestions, .day-list, .chips { scrollbar-width: none; }
.suggestions::-webkit-scrollbar, .day-list::-webkit-scrollbar { display: none; }

.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.suggestions button {
  flex: none; background: var(--raised); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 500;
}

/* ── auth ───────────────────────────────────────────────── */

body.centred { display: grid; place-items: center; min-height: 100vh; padding: 20px; padding-bottom: 20px; }
.panel { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
         border-radius: 18px; padding: 26px; }
.panel h1 { font-size: 22px; }
.panel .lede { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

/* ── misc ───────────────────────────────────────────────── */

.brief-body { font-size: 16px; }
.brief-body ul { padding-left: 1.1em; }

.day-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; }
.day-list a { flex: none; padding: 7px 12px; border-radius: 10px; background: var(--raised);
              border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.day-list a.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check.done .check-label { text-decoration: line-through; color: var(--muted); }
.check button { background: transparent; border: 1.5px solid var(--line); width: 22px; height: 22px;
                border-radius: 6px; padding: 0; flex: none; color: var(--good); font-size: 14px; line-height: 1; }
.check.done button { border-color: var(--good); }

/* Nightly kitchen check — the buttons have to be thumb-sized. */
.check-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.check-block:last-child { border-bottom: 0; padding-bottom: 0; }
.check-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check-actions form { display: contents; }
.check-actions button { width: 100%; padding: 13px 8px; font-size: 14px; }

input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 20px; height: 20px; }
details summary { cursor: pointer; }
details summary::marker { color: var(--muted); }

.mail-body { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; line-height: 1.6; }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
       color: var(--muted); white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto; }

.status-list { display: grid; gap: 8px; }
.status-list div { display: flex; justify-content: space-between; font-size: 14px; }

@media (min-width: 640px) {
  .page { padding: 24px 16px; }
  .bubble { max-width: 76%; }
}
