/* theme.css — Nook shell design system.
   Minimalist / editorial: light warm-neutral canvas, generous whitespace,
   large tight headings, a monospace uppercase eyebrow, one restrained indigo
   accent, hairline borders, soft (not heavy) surfaces. Refined dark variant
   via prefers-color-scheme so OLED / dark-mode phones still get dark.
   Styles the SHELL only — imported apps bring their own look. */

:root {
  --bg: #f7f6f3;            /* warm off-white canvas */
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --line: #e7e4dc;          /* warm hairline */
  --line-2: #dcd8ce;
  --text: #16171b;          /* near-black ink */
  --muted: #6b7280;
  --accent: #4f46e5;        /* indigo */
  --accent-ink: #ffffff;
  --accent-soft: #ecebff;
  --accent-2: #12a150;      /* success/active green */
  --wa: #25d366;            /* WhatsApp green */
  --danger: #dc2626;
  --warn: #b45309;
  --r: 14px;                /* card radius */
  --r-sm: 10px;
  --tap: 46px;              /* min touch target */
  --tap-lg: 54px;           /* primary CTA */
  --gap: 14px;
  --shadow: 0 1px 2px rgba(16,17,27,.04), 0 8px 24px rgba(16,17,27,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12; --surface: #16181f; --surface-2: #1d2028; --line: #262a33; --line-2: #313640;
    --text: #f4f5f7; --muted: #9aa1ad; --accent: #8b83ff; --accent-soft: #211f3a; --shadow: 0 8px 30px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  max-width: 640px; margin-inline: auto;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

h1 { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0; line-height: 1.1; }
h2 { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 30px 0 12px; }
a { color: var(--accent); text-decoration: none; }
.muted, .me { color: var(--muted); font-size: 14px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* Buttons — flat, tight radius, quiet */
button, .btn {
  font: inherit; font-weight: 600; font-size: 15px;
  min-height: var(--tap); padding: 0 18px;
  border: 0; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  transition: filter .15s ease, transform .05s ease;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.secondary, .btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); }
button.wa, .btn.wa { background: var(--wa); color: #04310f; }
.cta { min-height: var(--tap-lg); font-size: 16px; width: 100%; }

/* Inputs */
input, textarea, select {
  font: inherit; width: 100%; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 12px 14px; min-height: var(--tap);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 6px; }
textarea { font-family: var(--font-mono); line-height: 1.5; font-size: 13px; }

/* Cards / tiles */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.panel { margin-top: 10px; }

.app {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin: 10px 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: inherit; min-height: var(--tap-lg);
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.app:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.app:active { transform: translateY(1px); }
.app.dashed { border-style: dashed; justify-content: center; color: var(--accent); font-weight: 600; box-shadow: none; background: transparent; }
.app-wrap { position: relative; }
.app-wrap .app { padding-right: 92px; }
.mini-share {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%); z-index: 2;
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; min-height: 0;
  border-radius: 999px; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line); cursor: pointer;
}
.mini-share:hover { color: var(--text); border-color: var(--line-2); }
.ico { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 20px; flex: none; }
.name { font-weight: 600; }
.desc { color: var(--muted); font-size: 13px; }

/* Chips (space picker) */
.chip { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; font-weight: 500; }
.chip.sel { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Avatars (member initials) */
.avatars { display: flex; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--surface-2); border: 2px solid var(--surface); margin-left: -8px; }
.avatar:first-child { margin-left: 0; }

/* App runner top bar */
.appbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.appbar #title { font-weight: 600; }
iframe#app { width: 100%; border: 0; background: #fff; }

/* Status messages */
.ok { background: rgba(18,161,80,.08); border: 1px solid rgba(18,161,80,.28); color: var(--accent-2); border-radius: var(--r-sm); padding: 12px 14px; margin: 8px 0; font-size: 14px; }
.warn { background: rgba(180,83,9,.08); border: 1px solid rgba(180,83,9,.28); color: var(--warn); border-radius: var(--r-sm); padding: 12px 14px; margin: 8px 0; font-size: 14px; }
.err { color: var(--danger); font-size: 14px; }
.how { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; font-size: 14px; color: var(--muted); }
.how strong, .how b { color: var(--text); }
.how ol { margin: 6px 0 0; padding-left: 18px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .9em; font-family: var(--font-mono); }
.link { font-size: 12px; color: var(--accent); word-break: break-all; margin-top: 8px; }
footer { margin-top: 40px; color: var(--muted); font-size: 12px; }

/* Add-to-home-screen banner */
.a2hs { border-color: var(--line-2); }
.a2hs summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; padding: 4px 0; user-select: none; }
.a2hs summary::-webkit-details-marker { display: none; }
.a2hs summary::before { content: "▸"; display: inline-block; margin-right: 6px; }
.a2hs details[open] summary::before { content: "▾"; }
.a2hs .how strong { display: inline-block; }
.a2hs .dismiss { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); font-weight: 500; cursor: pointer; }
.a2hs input[type=checkbox] { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.a2hs .x { color: var(--muted); font-size: 18px; line-height: 1; text-decoration: none; }

/* Brand lockup */
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; margin-bottom: 14px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand .word { font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.appbar .brand { margin: 0; }
