/* trap. Ideas — iPad-first kiosk styling. Dark, warm, touch-friendly.
   Targets: min 44px touch targets (most are 56px+), landscape primary,
   portrait still usable. No external fonts (works offline). */

:root {
  --bg: #0c0b10;
  --bg-raised: #16141d;
  --bg-card: #1c1a25;
  --bg-input: #211f2c;
  --line: #322e40;
  --line-soft: #272433;
  --text: #f3f0f7;
  --text-dim: #a6a0b8;
  --text-faint: #6f6a80;
  --accent: #e0a44a;      /* warm amber — cocktail gold */
  --accent-deep: #c98729;
  --accent-soft: rgba(224, 164, 74, 0.14);
  --strong: #5fcf8e;
  --good: #7bb8ff;
  --mid: #e0c14a;
  --weak: #c89a6a;
  --bad: #ef6b6b;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --tap: 56px;
  font-size: 17px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(224, 164, 74, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(123, 184, 255, 0.06), transparent 60%),
    var(--bg);
}

.app-root {
  min-height: 100%;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.boot { padding: 40px; color: var(--text-dim); text-align: center; }

/* --- Layout ---------------------------------------------------------------- */
.screen { max-width: 1100px; margin: 0 auto; }
.screen-wide { max-width: 1300px; margin: 0 auto; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px;
}
.topbar .spacer { flex: 1; }
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 1.4rem; }
.brand .dot { color: var(--accent); }
.crumb { color: var(--text-dim); font-size: 0.95rem; }

.week-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; color: var(--text-dim);
}
.status-pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 650; letter-spacing: 0.01em;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(224,164,74,0.3);
}

h1.page-title { font-size: 1.9rem; margin: 0 0 6px; letter-spacing: -0.02em; }
.page-sub { color: var(--text-dim); margin: 0 0 24px; }

/* --- Cards & grids --------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 20px;
}
.card-hd { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-hd h3 { margin: 0; font-size: 1.1rem; }

.tile {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 26px; text-align: left;
  display: flex; flex-direction: column; gap: 8px; min-height: 120px;
  cursor: pointer; transition: transform .08s ease, border-color .15s ease;
  color: var(--text); width: 100%; font: inherit;
}
.tile:active { transform: scale(0.985); }
.tile:enabled:hover { border-color: var(--line); }
.tile .tile-icon { font-size: 1.8rem; }
.tile .tile-title { font-size: 1.25rem; font-weight: 650; }
.tile .tile-sub { color: var(--text-dim); font-size: 0.95rem; }
.tile:disabled { opacity: 0.4; cursor: default; }

/* --- Buttons --------------------------------------------------------------- */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 14px;
  min-height: var(--tap); padding: 0 22px; font-size: 1.02rem; font-weight: 600;
  cursor: pointer; color: var(--text); background: var(--bg-input);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .12s ease, transform .06s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: #221802; border-color: var(--accent-deep); }
.btn-primary:hover:enabled { filter: brightness(1.05); }
.btn-strong { background: var(--strong); color: #062013; }
.btn-good { background: var(--good); color: #04162e; }
.btn-mid { background: var(--mid); color: #241f04; }
.btn-bad { background: var(--bad); color: #2a0606; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-block { width: 100%; }
.btn-lg { min-height: 64px; font-size: 1.12rem; }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* --- Forms ----------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 0.98rem; }
.field .req { color: var(--accent); margin-left: 3px; }
.field .hint { color: var(--text-faint); font-size: 0.85rem; margin-top: 5px; }

/* Randomised "what this means + example" guidance under a field/category. */
.guidance {
  margin-top: 8px; padding: 10px 12px;
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  border-radius: 12px; font-size: 0.85rem; line-height: 1.45;
}
.guidance .g-line { display: flex; gap: 8px; align-items: baseline; }
.guidance .g-line + .g-line { margin-top: 5px; }
.guidance .g-tag {
  flex: none; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); min-width: 56px; text-align: center;
}
.guidance .g-tag-eg { background: rgba(123, 184, 255, 0.14); color: var(--good); }
.guidance .g-text { color: var(--text-dim); }
.score-row .guidance { margin-bottom: 12px; }

/* LLM cleanup preview (old -> new per field). */
.llm-preview { max-height: 52vh; overflow-y: auto; margin-bottom: 4px; }
.llm-old { color: var(--text-faint); text-decoration: line-through; font-size: 0.88rem; line-height: 1.4; }
.llm-new { color: var(--text); border-left: 3px solid var(--accent); padding-left: 10px; margin-top: 4px; line-height: 1.45; }

input[type="text"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 12px; color: var(--text); font: inherit; padding: 14px 15px;
  min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 20px) 24px, calc(100% - 14px) 24px; background-size: 6px 6px; background-repeat: no-repeat; }
.field-invalid input, .field-invalid textarea, .field-invalid select { border-color: var(--bad); }

/* segmented chips for scoring + type pickers */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-width: 52px; min-height: 52px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-input); color: var(--text-dim);
  font-size: 1.05rem; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip.selected { background: var(--accent); color: #221802; border-color: var(--accent-deep); }
.chip-wide { padding: 0 18px; font-size: 0.98rem; }
.chip-pen.selected { background: var(--weak); color: #241804; border-color: #a37b48; }

/* --- Scorecard rows -------------------------------------------------------- */
.score-row { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.score-row:last-child { border-bottom: none; }
.score-row .sr-label { font-weight: 650; }
.score-row .sr-q { color: var(--text-dim); font-size: 0.9rem; margin: 2px 0 10px; }
.scale-legend { display: flex; justify-content: space-between; color: var(--text-faint); font-size: 0.8rem; margin-top: 6px; }

/* --- Lists & meeting ------------------------------------------------------- */
.idea-row {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  margin-bottom: 12px; cursor: pointer;
}
.idea-row .rank { font-size: 1.5rem; font-weight: 800; color: var(--text-faint); width: 44px; text-align: center; }
.idea-row .meta { flex: 1; min-width: 0; }
.idea-row .meta .t { font-weight: 650; font-size: 1.08rem; }
.idea-row .meta .s { color: var(--text-dim); font-size: 0.88rem; margin-top: 3px; }
.idea-row .score-big { text-align: right; }
.idea-row .score-big .n { font-size: 1.7rem; font-weight: 800; }
.idea-row .score-big .l { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }

.score-strong { color: var(--strong); }
.score-good { color: var(--good); }
.score-mid { color: var(--mid); }
.score-weak { color: var(--weak); }
.score-bad { color: var(--bad); }

.tag {
  display: inline-block; padding: 3px 10px; border-radius: 8px; font-size: 0.78rem;
  background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--line-soft);
}
.tag-type { background: rgba(123,184,255,0.12); color: var(--good); border-color: rgba(123,184,255,0.25); }

.decision-badge { font-weight: 700; padding: 5px 13px; border-radius: 999px; font-size: 0.82rem; }
.dec-park { background: rgba(224,193,74,0.16); color: var(--mid); }
.dec-test { background: rgba(123,184,255,0.16); color: var(--good); }
.dec-commit { background: rgba(95,207,142,0.16); color: var(--strong); }
.dec-kill { background: rgba(239,107,107,0.16); color: var(--bad); }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .chip.selected { background: var(--accent-soft); color: var(--accent); border-color: rgba(224,164,74,0.4); }

/* stat row */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px 18px; min-width: 120px; }
.stat .n { font-size: 1.6rem; font-weight: 800; }
.stat .l { color: var(--text-dim); font-size: 0.85rem; }

.comment {
  background: var(--bg-raised); border-left: 3px solid var(--accent);
  padding: 12px 16px; border-radius: 0 12px 12px 0; margin-bottom: 10px; line-height: 1.5;
}
.empty { text-align: center; color: var(--text-dim); padding: 50px 20px; }

dl.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; margin: 0; }
dl.kv dt { color: var(--text-dim); }
dl.kv dd { margin: 0; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 10px; } }

/* --- Welcome --------------------------------------------------------------- */
.welcome { min-height: 78vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.welcome .logo { font-size: 4rem; font-weight: 800; letter-spacing: -0.03em; }
.welcome .logo .dot { color: var(--accent); }
.welcome .tagline { color: var(--text-dim); max-width: 460px; margin: 4px 0 28px; line-height: 1.5; }
.welcome .actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.welcome .week-line { margin-top: 26px; color: var(--text-faint); }

/* --- Keypad ---------------------------------------------------------------- */
.pin-pad { max-width: 360px; margin: 0 auto; text-align: center; }
.pin-title { margin: 0 0 4px; }
.pin-subtitle { color: var(--text-dim); margin: 0 0 18px; }
.pin-dots { display: flex; gap: 12px; justify-content: center; min-height: 22px; margin-bottom: 8px; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.pin-error { color: var(--bad); min-height: 22px; font-size: 0.9rem; margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  min-height: 72px; font-size: 1.6rem; font-weight: 600; border-radius: 16px;
  background: var(--bg-card); border: 1px solid var(--line-soft); color: var(--text); cursor: pointer;
}
.key:active { background: var(--bg-input); }
.key-muted { color: var(--text-dim); }
.key-go { background: var(--accent); color: #221802; border-color: var(--accent-deep); }
.pin-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

/* --- Banner / reminders ---------------------------------------------------- */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px;
  margin-bottom: 18px; font-size: 0.96rem; line-height: 1.4;
}
.banner-warn { background: rgba(239,107,107,0.12); border: 1px solid rgba(239,107,107,0.3); color: #f3b3b3; }
.banner-info { background: var(--accent-soft); border: 1px solid rgba(224,164,74,0.3); color: var(--accent); }
.banner .b-actions { margin-left: auto; }

/* --- Modal & toast --------------------------------------------------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 5, 9, 0.66); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; box-shadow: var(--shadow);
}
.modal-title { margin: 0 0 10px; font-size: 1.3rem; }
.modal-text { color: var(--text-dim); line-height: 1.5; margin: 0 0 22px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }

#toast-host { position: fixed; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; justify-content: center; pointer-events: none; z-index: 80; }
.toast { background: #2a2735; border: 1px solid var(--line); color: var(--text); padding: 14px 22px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; }
.toast-success { border-color: rgba(95,207,142,0.5); }
.toast-error { border-color: rgba(239,107,107,0.5); }

/* --- Progress -------------------------------------------------------------- */
.progress { height: 10px; background: var(--bg-input); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.muted { color: var(--text-dim); }
.section-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 26px 0 12px; }
.divider { height: 1px; background: var(--line-soft); margin: 22px 0; }

/* tables (meeting/archive only) */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
table.tbl th { color: var(--text-dim); font-size: 0.85rem; font-weight: 600; }
