/* Fina's look, shared by every page: colours (night and day), font, the top
   bar with the brand orb, buttons, and the building blocks of the
   secondary pages (review desk, profile, legal pages, admin). The chat page
   imports this from styles.css; every other page links it directly with
   theme.js. Change a colour here and every page follows. */

:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #171b24;
  --border: #232838;
  --text: #e8eaf0;
  --text-soft: #c9cfda;
  --text-dim: #9aa2b1;
  --accent: #6ea8ff;
  --accent-2: #7ee7c7;
  --danger: #ff8a80;
  --warn: #e6b45a;
  /* Chart marks: a mint step validated for charts (OKLCH lightness band and
     3:1 against the panel) - the brand mint itself is too light for a mark. */
  --chart-1: #33a585;
  --user-bubble: #23324a;
  --assistant-bubble: #171b24;
  /* The two zones. The conversation is Fina's: near-black with a mint edge.
     The board is the offers': blue-grey with a blue edge, its cards lighter
     than anything in the chat. Nothing from one ever sits inside the other. */
  --chat-bg: #0e1117;
  --chat-edge: #7ee7c7;
  --board-bg: #151b28;
  --board-card: #1c2333;
  --board-card-lead: #202a3d;
  --board-line: #2b3448;
  --board-edge: #6ea8ff;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* Day mode: the same layout in light colours. A page starts in the
   device's own setting; the sun/moon button in the top bar overrides it and
   is remembered per browser (localStorage "fina-theme"). */
:root { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --border: #d9dfe9;
  --text: #141824;
  --text-soft: #2f3747;
  --text-dim: #5d6678;
  --accent: #2563d6;
  --accent-2: #0f9d7a;
  --danger: #c62828;
  --warn: #9a5c00;
  --chart-1: #0f9d7a;
  --user-bubble: #dbe7fb;
  --assistant-bubble: #f1f4f9;
  --chat-bg: #ffffff;
  --chat-edge: #0f9d7a;
  --board-bg: #edf1f8;
  --board-card: #ffffff;
  --board-card-lead: #f4f8ff;
  --board-line: #d3dbe8;
  --board-edge: #2563d6;
}
.theme-btn { padding: 5px 10px; font-size: 14px; line-height: 1; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
button { font-family: inherit; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; flex: none;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand-tag { font-weight: 400; font-size: 12px; color: var(--text-dim); }
.meta { display: flex; align-items: center; gap: 10px; }
.status { font-size: 12px; color: var(--text-dim); }
.ghost-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--text); }

.orb {
  border-radius: 50%; flex: none; display: inline-block;
  background: radial-gradient(circle at 35% 35%, #9df0da, #7ee7c7 45%, #2f6f63 100%);
}
.orb-xs { width: 12px; height: 12px; }
.orb-sm { width: 22px; height: 22px; }
.orb-md { width: 26px; height: 26px; }
.orb-lg { width: 64px; height: 64px; box-shadow: 0 0 0 10px rgba(126, 231, 199, 0.08); }

/* ---------- secondary pages ---------- */
.fp-body { min-height: 100%; display: flex; flex-direction: column; }
.fp-body a { color: var(--accent); }
.fp-body .topbar a.brand { color: var(--text); text-decoration: none; }
.fp-page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 24px 56px; }
.fp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin: 4px 0 18px; }
.fp-head h1 { font-size: 22px; line-height: 1.25; margin: 0; }
.fp-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }
.fp-section-title { font-size: 15px; margin: 26px 0 10px; }
.fp-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--text-soft);
}
.fp-card.is-dim { opacity: 0.65; }
.fp-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin: 10px 0 2px; }
.fp-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.fp-muted { color: var(--text-dim); font-size: 12.5px; }
.fp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fp-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.fp-stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--text-dim); }
.fp-stat b { display: block; font-size: 17px; color: var(--text); }
.fp-badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px;
  border: 1px solid currentColor; color: var(--text-dim);
}
.fp-badge.is-ok { color: var(--accent-2); }
.fp-badge.is-warn { color: var(--warn); }
.fp-badge.is-bad { color: var(--danger); }
.fp-note { border-left: 3px solid var(--warn); padding: 4px 10px; margin-top: 10px; }
.fp-note.is-ok { border-color: var(--accent-2); }
.fp-btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 7px 14px;
  border: 1px solid var(--border); background: transparent; color: var(--text-soft);
}
.fp-btn:hover { border-color: var(--accent); color: var(--text); }
.fp-btn.is-on { border-color: var(--accent-2); color: var(--accent-2); }
.fp-btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: #0b0d12; }
.fp-btn-primary:hover { color: #0b0d12; opacity: 0.92; }
.fp-btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.fp-input, .fp-select, .fp-textarea {
  font: inherit; font-size: 13.5px; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.fp-input:focus, .fp-select:focus, .fp-textarea:focus { outline: none; border-color: var(--accent); }
.fp-textarea { flex: 1 1 260px; min-height: 38px; resize: vertical; }
.fp-empty { color: var(--text-dim); padding: 24px 0; }
.fp-login { max-width: 420px; margin: 48px auto; }
.fp-login .fp-input { width: 100%; margin: 10px 0; }
.fp-list { margin: 4px 0 0; padding-left: 18px; color: var(--text-dim); }
.fp-prose { max-width: 760px; color: var(--text-soft); font-size: 14.5px; line-height: 1.65; }
.fp-prose h2 { font-size: 16px; color: var(--text); margin: 24px 0 6px; }

/* Tables and the one-series bar list used by the admin pages. */
.fp-table-wrap { overflow-x: auto; }
.fp-code-block { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; overflow-x: auto; white-space: pre; }
.fp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fp-table th { text-align: left; font-weight: 600; color: var(--text-dim); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fp-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-soft); white-space: nowrap; }
.fp-table td.num, .fp-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.fp-bars { display: grid; grid-template-columns: minmax(110px, max-content) 1fr minmax(84px, max-content); gap: 8px 12px; align-items: center; font-size: 13px; }
.fp-bar-track { height: 14px; position: relative; }
.fp-bar { height: 14px; border-radius: 0 4px 4px 0; background: var(--chart-1); min-width: 2px; }
.fp-bar-track:hover .fp-bar, .fp-bar-track:focus .fp-bar { filter: brightness(1.12); }
.fp-bar-track:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.fp-bars .fp-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.fp-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.fp-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }

/* Forms: a label above each field, the problem under it in the danger
   colour. Used by the passenger form, sign-in, the profile and the demo bank. */
.fp-form { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.fp-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fp-field > span { font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.fp-field .fp-input, .fp-field .fp-select { width: 100%; }
.fp-field.has-error .fp-input, .fp-field.has-error .fp-select { border-color: var(--danger); }
.fp-err { color: var(--danger); font-size: 12px; line-height: 1.35; }
.fp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.fp-check input { accent-color: var(--accent-2); width: 16px; height: 16px; }
.fp-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 10px; }
.fp-fieldset legend { font-size: 12.5px; font-weight: 700; color: var(--text); padding: 0 6px; }
.fp-choice { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; margin: 0 0 8px; font-size: 13.5px; color: var(--text-soft); }
.fp-choice:has(input:checked) { border-color: var(--accent-2); color: var(--text); }
.fp-choice input { accent-color: var(--accent-2); }

/* A dialog over the page (sign-in) and the bank window over the chat. */
.fp-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(5, 7, 12, 0.62); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fp-dialog { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--text-soft); font-size: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.fp-dialog h2 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.fp-dialog .fp-input { width: 100%; margin: 8px 0; }
.fp-dialog-close { float: right; }
.fp-paywin { width: 100%; max-width: 460px; height: min(640px, calc(100vh - 32px)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; position: relative; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.fp-paywin iframe { border: 0; width: 100%; height: 100%; display: block; background: var(--panel); }
.fp-paywin .fp-dialog-close { position: absolute; top: 10px; right: 10px; z-index: 2; }

/* Test data is never mistaken for the real thing. */
.fp-demo { background: rgba(230, 180, 90, 0.14); border: 1px dashed var(--warn); color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.fp-demo b { color: var(--warn); }
.fp-code { font-size: 22px; font-weight: 700; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.fp-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.fp-timer.is-low { color: var(--danger); }

/* A phone: every field at 16px, or iOS zooms the page in when one is
   tapped and leaves it zoomed (the sign-in dialog then touched the screen's
   edges and the home page no longer fitted after signing in). The dialog
   keeps a 24px margin and room for the keyboard. */
@media (max-width: 600px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 600px) {
  .fp-backdrop { padding: 24px; align-items: flex-start; padding-top: max(56px, 12vh); }
  .fp-dialog { padding: 20px 20px 22px; max-height: calc(100dvh - 80px); }
  .fp-dialog h2 { font-size: 19px; margin-bottom: 8px; }
  .fp-dialog .fp-input { padding: 12px 14px; margin: 12px 0; }
  .fp-dialog .fp-btn-primary { width: 100%; min-height: 46px; font-size: 15px; }
  .fp-dialog-close { width: 40px; height: 40px; padding: 0; margin: -8px -8px 0 0; }
  .fp-dialog .fp-btn { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; }
  /* Header buttons on every page: 40px to tap, as on the home page. */
  .topbar .ghost-btn { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .fp-body .topbar { padding: 0 16px; }
  .fp-body .brand-tag { display: none; }
  .fp-page { padding: 16px 16px 40px; }
}
