/* FamBoard portal pages. Colors follow the Secure AI Consulting Services site
   (navy ink, paper, one blue accent, gold kept to the mark). */
@font-face {
  font-family: "Inter";
  src: url("board/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("board/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --ink-900: #0c1a2e;
  --paper: #f4f6f9;
  --surface: #fcfdfe;
  --tint: #e9eef5;
  --text: #142235;
  --text-2: #3d4d63;
  --muted: #56657a;
  --line: #d6dee8;
  --line-strong: #b9c5d3;
  --accent: #2563b0;
  --accent-hover: #1d5197;
  --accent-active: #184680;
  --accent-soft: #e6eef8;
  --on-ink: #f4f6f9;
  --on-accent: #fcfdfe;
  --gold: #f2d77e;
  --ok: #2b7a4b;
  --danger: #b3261e;
  --danger-soft: #fbeaea;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius: 10px;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Plus Jakarta Sans", var(--body);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c1a2e;
    --surface: #13263f;
    --tint: #1d3454;
    --text: #e9eef5;
    --text-2: #c3cedb;
    --muted: #a9b6c6;
    --line: rgba(233, 238, 245, 0.14);
    --line-strong: rgba(233, 238, 245, 0.28);
    --accent: #6ea8e8;
    --accent-hover: #8dbbee;
    --accent-active: #a9cbf2;
    --accent-soft: rgba(110, 168, 232, 0.14);
    --on-accent: #0c1a2e;
    --ok: #6fcf97;
    --danger: #f2a7a1;
    --danger-soft: rgba(242, 167, 161, 0.12);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--body);
  line-height: 1.55;
  overflow-x: clip;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0 0 var(--s3); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.5vw, 2.5rem); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 var(--s4); color: var(--text-2); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar-right { display: flex; align-items: center; gap: var(--s4); }
.topbar-link { font: 600 0.875rem var(--body); text-decoration: none; }
.help-link { display: inline-flex; align-items: center; gap: var(--s1); }
.help-icon { flex: none; }
.team-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s3) 0 0; font-size: 0.875rem; }
.team-suggest-label { color: var(--text-2); }
.team-suggest img { width: 20px; height: 20px; object-fit: contain; }
.team-suggest button { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; padding: 0 var(--s3); border-radius: 999px; }
.privacy-note { margin: 0 0 var(--s5); color: var(--text-2); font-size: 0.875rem; }
.wordmark {
  display: inline-flex; align-items: center; gap: var(--s2);
  font: 800 1.125rem var(--display); color: var(--text); text-decoration: none;
}
.wordmark .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--gold); box-shadow: 0 0 0 3px var(--ink-900); }

.narrow { max-width: 720px; margin: 0 auto; padding: var(--s7) var(--s4); }
.wide { max-width: 880px; margin: 0 auto; padding: var(--s6) var(--s4) 120px; }

.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4);
  border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: var(--on-accent);
  font: 600 0.9375rem var(--body); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover, button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.button:active, button:active { background: var(--accent-active); border-color: var(--accent-active); }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); color: var(--accent); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.danger:hover { background: var(--danger-soft); color: var(--danger); }
button.link { background: none; border: 0; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; }
button:disabled, button:disabled:hover { background: var(--tint); border-color: var(--line); color: var(--muted); cursor: not-allowed; }

.card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  margin-bottom: var(--s5);
}
.card > h2 { margin-bottom: var(--s1); }
.card > .hint:first-of-type { margin-bottom: var(--s4); }
.hint { font-size: 0.875rem; color: var(--muted); margin: 0 0 var(--s3); }

label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: var(--s1); color: var(--text); }
input[type="text"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], select {
  width: 100%; min-height: 40px; padding: var(--s2) var(--s3);
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--paper); color: var(--text); font: inherit; font-size: max(1rem, 1em);
}
input:focus-visible, select:focus-visible { border-color: var(--accent); outline: 3px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: var(--s4); }
.row { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; }
.row > .grow { flex: 1 1 220px; }
.row.top { align-items: flex-start; }

.checks { display: flex; flex-wrap: wrap; gap: var(--s2); }
.checks label {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-weight: 500; margin: 0; padding: var(--s1) var(--s3);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--paper);
}
.checks input { accent-color: var(--accent); }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0 0; padding: 0; list-style: none; }
.chips li {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: var(--s1) var(--s1) var(--s1) var(--s3);
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 0.875rem;
}
.chips img { width: 20px; height: 20px; object-fit: contain; }
.chips button {
  min-height: 26px; width: 26px; padding: 0; border-radius: 999px;
  background: transparent; border-color: transparent; color: var(--muted); font-size: 1rem;
}
.chips button:hover { background: var(--tint); color: var(--text); border-color: transparent; }

.date-rows { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.date-row { display: grid; grid-template-columns: 1fr 130px 80px 40px; gap: var(--s2); align-items: center; }
.date-row button { min-height: 40px; padding: 0; background: transparent; color: var(--muted); border-color: var(--line); }
.date-row button:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }

.todo-row { display: grid; grid-template-columns: 2fr 1fr 160px 40px; gap: var(--s2); align-items: center; }
.todo-row button { min-height: 40px; padding: 0; background: transparent; color: var(--muted); border-color: var(--line); }
.todo-row button:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }

.board-link {
  display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center;
  padding: var(--s3); background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 8px;
}
.board-link code { flex: 1 1 260px; overflow-wrap: anywhere; font-size: 0.875rem; }

.secret-state { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; font-size: 0.875rem; color: var(--text-2); margin-bottom: var(--s2); }
#provider-panel { margin-bottom: var(--s3); }
#provider-panel .provider-line { margin: 0 0 var(--s2); font-size: 0.875rem; color: var(--text-2); }
#provider-panel .provider-actions, .folder-browser .folder-nav { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-bottom: var(--s2); }
.folder-browser { border: 1px solid var(--line); border-radius: 8px; padding: var(--s3); margin-top: var(--s2); }
.folder-browser .folder-path { font-size: 0.875rem; color: var(--muted); }
.folder-browser ul { list-style: none; margin: 0 0 var(--s2); padding: 0; display: flex; flex-direction: column; gap: var(--s1, 4px); max-height: 240px; overflow-y: auto; }
.secret-state .badge { padding: 2px var(--s2); border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.places { list-style: none; margin: var(--s2) 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.places:empty { display: none; }
.places button {
  width: 100%; justify-content: flex-start; border: 0; border-radius: 0;
  background: var(--surface); color: var(--text); font-weight: 500; text-align: left;
}
.places li + li button { border-top: 1px solid var(--line); }
.places button:hover { background: var(--accent-soft); color: var(--text); }
.places small { color: var(--muted); font-weight: 400; }

.preview {
  margin-top: var(--s2); padding: var(--s3) var(--s4); border-radius: 8px;
  background: var(--ink-900); color: var(--on-ink); font-size: 1.75rem; line-height: 1.2; overflow: hidden; white-space: nowrap;
}
.preview.text { font-size: 1.0625rem; white-space: normal; }

.board-preview {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px; background: #000;
}
.board-preview iframe {
  position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; border: 0;
  transform-origin: 0 0; pointer-events: none;
}

.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s2); margin-bottom: var(--s4); }
.palette-option {
  position: relative; display: flex; flex-direction: column; gap: var(--s2); font-weight: 500; margin: 0; cursor: pointer;
  padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.palette-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.palette-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.palette-option input { position: absolute; opacity: 0; pointer-events: none; }
.palette-option .swatches { display: flex; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line-strong); }
.palette-option .swatches span { flex: 1; }
.custom-colors { display: flex; flex-wrap: wrap; gap: var(--s3); }
.color-field { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; margin: 0; }
.color-field input { width: 44px; height: 32px; padding: 0; cursor: pointer; }

.parts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.parts li {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.parts li label { flex: 1; display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; margin: 0; cursor: pointer; }
.parts li input { accent-color: var(--accent); }
.parts li.off label { color: var(--muted); }
.parts button { min-height: 36px; padding: 0 var(--s3); }

.savebar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: var(--s3); align-items: center;
  padding: var(--s3) var(--s4);
  background: var(--surface); border-top: 1px solid var(--line);
}
.status { font-size: 0.875rem; color: var(--muted); min-width: 0; }
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }
.errors { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: var(--s3) var(--s4); margin-bottom: var(--s4); }
.errors:empty { display: none; }
.errors ul { margin: 0; padding-left: var(--s5); }

.hero { display: grid; gap: var(--s6); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 53.75em) { .hero { grid-template-columns: 1.1fr 1fr; } }
.hero ul { padding-left: var(--s5); color: var(--text-2); margin: 0 0 var(--s4); }
.hero li { margin-bottom: var(--s1); }
#sign-in { min-height: 420px; }

.footer { text-align: center; font-size: 0.875rem; color: var(--muted); padding: var(--s5) var(--s4); }
.prose h2 { margin-top: var(--s6); }
.prose li { color: var(--text-2); margin-bottom: var(--s2); }

@media (max-width: 35em) {
  .date-row { grid-template-columns: 1fr 1fr; }
  .date-row input[type="text"] { grid-column: 1 / -1; }
  .todo-row { grid-template-columns: 1fr 1fr; }
  .todo-row input[type="text"]:first-child { grid-column: 1 / -1; }
  .card { padding: var(--s4); }
}

[hidden] { display: none !important; }
.walkthrough { margin: 0 0 var(--s4); padding-left: var(--s5); color: var(--text-2); }
.walkthrough li + li { margin-top: var(--s1); }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s4) 0; }
.steps { margin: 0 0 var(--s4); padding-left: var(--s5); color: var(--text-2); }

/* Help page */
.toc { columns: 2 220px; padding-left: var(--s5); margin: 0 0 var(--s5); }
.toc li { margin-bottom: var(--s1); }
.prose h2 { scroll-margin-top: var(--s5); }
.prose h3 { font-size: 1rem; margin: var(--s4) 0 var(--s2); }
.help-form textarea {
  width: 100%; min-height: 140px; padding: var(--s2) var(--s3);
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--paper); color: var(--text); font: inherit; font-size: max(1rem, 1em); resize: vertical;
}
.help-form .count { text-align: right; font-size: 0.8125rem; color: var(--muted); }
.help-form .actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }

/* Admin status page */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s3); }
.stat { padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat b { display: block; font: 700 1.5rem/1.2 var(--display); color: var(--text); }
.stat span { color: var(--muted); font-size: 0.875rem; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.bad td { color: var(--danger); }
td.wrap { white-space: normal; }

/* Grouped controls: a fieldset with its legend styled like a field label. */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: 0.875rem; margin-bottom: var(--s1); color: var(--text); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.card h3.spaced { margin-top: var(--s5); }
.hint.tight { margin: 0 0 var(--s2); }
.gap-above { margin-top: var(--s2); }

/* Touch screens get 48px targets. */
@media (pointer: coarse) {
  .button, button, select,
  input[type="text"], input[type="url"], input[type="password"], input[type="search"], input[type="number"] { min-height: 48px; }
  .chips button { min-height: 40px; width: 40px; }
  .date-row button, .todo-row button { min-height: 48px; }
  .checks label { min-height: 40px; }
  button.link { min-height: 0; }
}

/* Confirm dialog */
dialog.confirm {
  max-width: min(28rem, calc(100vw - 2 * var(--s4)));
  padding: var(--s5); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
dialog.confirm:modal { overscroll-behavior: contain; }
dialog.confirm::backdrop { background: rgba(12, 26, 46, 0.55); overflow: hidden; overscroll-behavior: contain; }
dialog.confirm h2 { font-size: 1.125rem; }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s3); }
