/* Hidden Gems candidate page. Tessary tokens ("Triad on Black"), from docs/design.html.
   admin.html also links this file: keep tokens on :root and primitives unscoped. */
:root {
  --color-bg: #121212; --color-surface: #1B1B1B; --color-raised: #242424; --color-overlay: #2E2E2E;
  --color-fg: #F0F0F0; --color-fg-secondary: #C8C8C8; --color-muted: #A0A0A0; --color-subtle: #6E6E6E;
  --color-border: #3C3C3C;
  --color-accent: #F0F0F0; --color-accent-hover: #C8C8C8; --color-accent-text-on: #121212;
  --color-accent-subtle: rgba(240,240,240,0.12); --color-accent-edge: #6E6E6E;
  --color-link: #70B6FD;
  --color-hover: #242424; --color-selected: #242424;
  --color-success: #7FD146; --color-success-subtle: rgba(127,209,70,0.12);
  --color-info: #70B6FD; --color-info-subtle: rgba(112,182,253,0.12);
  --color-error: #FF6D87; --color-error-subtle: rgba(255,109,135,0.12);
  --font-sans: 'Geist', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-brand: 'Space Grotesk', system-ui, sans-serif;
  --radius-micro: 3px; --radius-control: 6px; --radius-card: 10px; --radius-modal: 16px; --radius-pill: 9999px;
  --focus-ring: 0 0 0 3px rgba(112,182,253,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body { background: var(--color-bg); color: var(--color-fg); font: 400 0.875rem/1.65 var(--font-sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-control); }
/* Headings get focus from script on each screen change (for screen readers). No ring on them. */
[tabindex="-1"]:focus-visible { box-shadow: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* type */
.h1 { font-size: 1.75rem; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
.h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 600; }
.h3 { font-size: 1rem; line-height: 1.5; font-weight: 500; }
.small { font-size: 0.75rem; line-height: 1.5; color: var(--color-fg-secondary); }
.muted { color: var(--color-muted); }
.subtle { color: var(--color-subtle); }
.sec { color: var(--color-fg-secondary); }
.label { font-size: 0.6875rem; line-height: 1.5; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
.mono { font-family: var(--font-mono); }
.id { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.metric { font-family: var(--font-mono); font-size: 2.25rem; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.link { color: var(--color-link); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(112,182,253,0.4); }
.wordmark { font-family: var(--font-brand); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; line-height: 1.2; color: #FFFFFF; }
.t-info { color: var(--color-info); }
.t-bad { color: var(--color-error); }

/* primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-control); font: 500 0.875rem/1 var(--font-sans); border: 1px solid transparent; cursor: pointer; white-space: nowrap; background: transparent; color: var(--color-fg); }
.btn.primary { background: var(--color-accent); color: var(--color-accent-text-on); }
.btn.primary:hover { background: var(--color-accent-hover); }
.btn.ghost { background: transparent; color: var(--color-fg); border-color: var(--color-border); }
.btn.ghost:hover { background: var(--color-hover); }
.btn.lg { height: 42px; padding: 0 18px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 0.75rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.primary:disabled:hover { background: var(--color-accent); }
.btn .kbd { font-family: var(--font-mono); font-size: 0.6875rem; padding: 1px 5px; border-radius: var(--radius-micro); background: rgba(18,18,18,0.12); }
.g { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(#121212 0 25%, #3C3C3C 0 50%, #121212 0 75%, #6E6E6E 0); flex: none; }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); }
.input { background: var(--color-raised); border: 1px solid var(--color-border); border-radius: var(--radius-control); height: 36px; padding: 0 12px; display: flex; align-items: center; gap: 8px; color: var(--color-fg); }
.input:focus-within { box-shadow: var(--focus-ring); border-color: transparent; }
.input input { flex: 1; min-width: 0; background: transparent; border: 0; height: 100%; font-family: var(--font-mono); font-size: 0.8125rem; }
.input input:focus-visible { box-shadow: none; }
.input input::placeholder { color: var(--color-subtle); }
.input.invalid { border-color: var(--color-error); }
.input.invalid:focus-within { box-shadow: 0 0 0 3px rgba(255,109,135,0.5); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-control); font-size: 0.75rem; font-weight: 500; color: var(--color-fg-secondary); background: var(--color-accent-subtle); white-space: nowrap; }
.badge.ok { background: var(--color-success-subtle); }
.badge.bad { background: var(--color-error-subtle); }
.badge.info { background: var(--color-info-subtle); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-subtle); flex: none; }
.dot.ok { background: var(--color-success); } .dot.bad { background: var(--color-error); } .dot.info { background: var(--color-info); }
.ico { width: 14px; height: 14px; flex: none; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-control); background: var(--color-info-subtle); color: var(--color-fg-secondary); font-size: 0.8125rem; }
.callout.bad { background: var(--color-error-subtle); }
.callout .ico { margin-top: 3px; }
.err { font-size: 0.75rem; color: var(--color-error); }

/* shell */
.top { height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--color-border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .sep { width: 1px; height: 16px; background: var(--color-border); }
.brand .prod { font-weight: 500; color: var(--color-fg-secondary); white-space: nowrap; }
.who { display: flex; align-items: center; gap: 10px; font-size: 0.75rem; color: var(--color-muted); min-width: 0; }
.who .wname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--color-overlay); display: grid; place-items: center; font-size: 0.6875rem; font-weight: 500; color: var(--color-fg-secondary); flex: none; }
.page { padding: 40px 40px 44px; display: flex; flex-direction: column; gap: 24px; min-height: 560px; width: 100%; max-width: 640px; margin: 0 auto; }
.stepper { display: flex; align-items: center; gap: 8px; list-style: none; }
.stepper .s { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--color-subtle); }
.stepper .s b { font-family: var(--font-mono); font-weight: 500; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--color-border); font-size: 0.6875rem; }
.stepper .s.done { color: var(--color-muted); } .stepper .s.done b { background: var(--color-accent-subtle); border-color: transparent; color: var(--color-fg-secondary); }
.stepper .s.on { color: var(--color-fg); font-weight: 500; } .stepper .s.on b { background: var(--color-accent); color: var(--color-accent-text-on); border-color: transparent; }
.stepper .bar { width: 28px; height: 1px; background: var(--color-border); }
.foot { display: flex; justify-content: flex-end; align-items: center; gap: 16px; }
.page > .foot { margin-top: auto; }

/* landing */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; padding: 56px 40px 40px; max-width: 1200px; margin: 0 auto; width: 100%; }
.hero .h1 { font-size: 2.25rem; letter-spacing: -0.02em; line-height: 1.15; }
.hero .cta { margin-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.console { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; }
.console-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--color-border); }
.console-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; font-family: var(--font-mono); font-size: 0.75rem; }
.kvrow { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-control); background: var(--color-raised); }
.kvrow .k { color: var(--color-muted); } .kvrow .v { color: var(--color-fg-secondary); }
.redact { display: inline-block; height: 9px; border-radius: 2px; background: var(--color-overlay); vertical-align: middle; }
.howto { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--color-border); list-style: none; }
.howto li { padding: 18px 20px 22px; border-right: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 4px; }
.howto li:last-child { border-right: 0; }
.howto .id { margin-bottom: 4px; }
.howto b { font-weight: 500; }

/* profile */
.field { display: flex; flex-direction: column; gap: 8px; border: 0; }
.field > .lbl { font-weight: 500; padding: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { position: relative; border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; background: var(--color-surface); cursor: pointer; }
.tile:hover { background: var(--color-hover); }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tile .radio { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--color-accent-edge); flex: none; }
.tile:has(input:checked) { background: var(--color-accent-subtle); border-color: var(--color-accent-edge); }
.tile:has(input:checked) .radio { border: 4px solid var(--color-accent); }
.tile:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* rules */
.rules { display: flex; flex-direction: column; list-style: none; }
.rules li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); color: var(--color-fg-secondary); }
.rules li:last-child { border-bottom: 0; }
.rules .id { padding-top: 2px; }
.rules b { color: var(--color-fg); font-weight: 500; }
.check { display: flex; gap: 10px; align-items: center; color: var(--color-fg-secondary); cursor: pointer; width: fit-content; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.box { width: 16px; height: 16px; border-radius: var(--radius-micro); border: 1px solid var(--color-accent-edge); position: relative; flex: none; }
.check input:checked + .box { background: var(--color-accent); border-color: var(--color-accent); }
.check input:checked + .box::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--color-accent-text-on); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.check input:focus-visible + .box { box-shadow: var(--focus-ring); }

/* test */
.test { display: flex; flex-direction: column; min-height: 100vh; }
.tbar { position: sticky; top: 0; z-index: 5; height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--color-border); background: var(--color-bg); }
.clock { display: flex; flex-direction: column; align-items: center; }
.clock .metric { font-size: 1.75rem; }
.clock .id { margin-top: -2px; white-space: nowrap; }
.tbar .right { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.saved { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.track { height: 2px; background: var(--color-border); }
.track i { display: block; height: 100%; width: 0; background: var(--color-accent); }
.track.info i { background: var(--color-info); }
.track.bad i { background: var(--color-error); }
.ws { flex: 1; display: grid; grid-template-columns: 420px 1fr; min-height: 0; }
.brief { border-right: 1px solid var(--color-border); background: var(--color-surface); padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.brief .head { display: flex; gap: 8px; align-items: center; }
.brief .body { display: flex; flex-direction: column; gap: 10px; }
.brief .body p { color: var(--color-fg-secondary); white-space: pre-wrap; }
.zip { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--color-raised); border: 1px solid var(--color-border); border-radius: var(--radius-card); }
.editor { display: flex; flex-direction: column; background: var(--color-bg); min-width: 0; }
.ed-tools { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--color-border); }
.ed-body { flex: 1; display: flex; }
.ed-body textarea { flex: 1; width: 100%; min-height: 420px; resize: none; background: transparent; border: 0; padding: 24px 28px; color: var(--color-fg); font-size: 0.9375rem; line-height: 1.75; }
.ed-body textarea:focus-visible { box-shadow: none; }
.editor:focus-within .ed-tools .label { color: var(--color-fg); }
.editor:focus-within .ed-tools { box-shadow: inset 0 -1px 0 var(--color-info); }
.ed-body textarea::placeholder { color: var(--color-subtle); }
.ed-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.attach { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chipfile { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border-radius: var(--radius-control); background: var(--color-raised); font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-fg-secondary); max-width: 100%; }
.chipfile .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipfile button { display: grid; place-items: center; border: 0; background: transparent; color: var(--color-muted); cursor: pointer; border-radius: var(--radius-micro); }
.chipfile button:hover { color: var(--color-fg); }
.filepick { position: absolute; opacity: 0; width: 1px; height: 1px; }
.filepick:focus-visible + .btn { box-shadow: var(--focus-ring); }
.test-msg { padding: 0 20px; position: sticky; top: 64px; z-index: 4; background: var(--color-bg); }
.test-msg:not(:empty) { padding: 10px 20px; border-bottom: 1px solid var(--color-border); }

/* done */
.done { align-items: center; text-align: center; justify-content: center; }
.seal { width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-subtle); display: grid; place-items: center; }
.seal.off { background: var(--color-accent-subtle); }
.seal .ico { width: 22px; height: 22px; color: var(--color-muted); }
.seal .ico.t-ok { color: var(--color-success); }
.receipt { width: 100%; max-width: 440px; text-align: left; }
.receipt .r { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--color-border); align-items: center; }
.receipt .r:first-child { border-top: 0; }
.receipt .r > span:first-child { color: var(--color-muted); font-size: 0.8125rem; }
.receipt .r > span:last-child { overflow-wrap: anywhere; }

/* confirm dialog */
.modal { margin: auto; border: 1px solid var(--color-border); border-radius: var(--radius-modal); background: var(--color-surface); color: var(--color-fg); width: min(400px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0,0,0,0.6); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.modal-body .foot { margin-top: 12px; }

/* loading */
.center { display: grid; place-items: center; min-height: calc(100vh - 56px); padding: 24px; text-align: center; }
.center > div { display: flex; flex-direction: column; align-items: center; gap: 14px; }

@media (max-width: 1100px) {
  .hero, .ws { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr 1fr; }
  .howto li:nth-child(2) { border-right: 0; }
  .howto li:nth-child(-n+2) { border-bottom: 1px solid var(--color-border); }
  .brief { border-right: 0; border-bottom: 1px solid var(--color-border); }
}
@media (max-width: 640px) {
  .top { padding: 0 16px; }
  .brand .sep, .brand .prod { display: none; }
  .page { padding: 28px 16px 32px; }
  .hero { padding: 36px 16px 28px; gap: 28px; }
  .hero .h1 { font-size: 1.875rem; }
  .tiles { grid-template-columns: 1fr; }
  .howto { grid-template-columns: 1fr; }
  .howto li { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .howto li:last-child { border-bottom: 0; }
  .tbar { padding: 0 12px; gap: 8px; grid-template-columns: auto 1fr auto; }
  .tbar .brand .wordmark { font-size: 16px; }
  .clock .metric { font-size: 1.375rem; }
  .clock .id { font-size: 0.6875rem; }
  .tbar .right { gap: 8px; }
  .tbar .saved:not(.warn) .stxt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tbar .saved.warn .dot { display: none; }
  .brief { padding: 18px 16px; }
  .ed-tools, .ed-foot { padding: 10px 16px; }
  .ed-body textarea { padding: 18px 16px; min-height: 320px; }
  .receipt .r { grid-template-columns: 96px 1fr; }
}
