/* FYLINT OS shared styles. Every page and module uses these tokens. */
:root {
  --bg: #eef1f4; --panel: #ffffff; --paper: #fdfdfb; --fg: #1a1f28; --muted: #5d6573; --faint: #8a919c;
  --line: #d5dae1; --accent: #1f5f8b; --accent-fg: #ffffff; --note-bg: #fff6e0; --note-fg: #6b4e00;
  --ok: #1f7a4d; --err: #a5281b; --err-bg: #fdecea; --side: #16202c; --side-fg: #d8dee7; --side-muted: #8b96a5;
  --tip-bg: #1a1f28; --tip-fg: #f3f5f8;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-doc: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --panel: #1a2029; --paper: #1e242e; --fg: #e5e9ef; --muted: #9aa3b1; --faint: #75808f;
    --line: #2e3744; --accent: #6fb0e0; --accent-fg: #0d1520; --note-bg: #2f2710; --note-fg: #f0d58a;
    --ok: #6ccf9a; --err: #ff8f80; --err-bg: #3a1a17; --side: #0d1117; --tip-bg: #e5e9ef; --tip-fg: #12161c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --panel: #1a2029; --paper: #1e242e; --fg: #e5e9ef; --muted: #9aa3b1; --faint: #75808f;
  --line: #2e3744; --accent: #6fb0e0; --accent-fg: #0d1520; --note-bg: #2f2710; --note-fg: #f0d58a;
  --ok: #6ccf9a; --err: #ff8f80; --err-bg: #3a1a17; --side: #0d1117; --tip-bg: #e5e9ef; --tip-fg: #12161c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-ui); }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- shell: sidebar + main ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-fg); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { font-weight: 600; font-size: 17px; letter-spacing: .02em; padding: 0 8px 14px; }
.side .brand small { display: block; font: 11px var(--font-mono); color: var(--side-muted); letter-spacing: .06em; text-transform: uppercase; }
.side a { display: flex; align-items: center; gap: 10px; color: var(--side-fg); text-decoration: none; padding: 8px; border-radius: 6px; font-size: 14px; }
.side a:hover { background: rgba(255,255,255,.06); }
.side a[aria-current="page"] { background: rgba(255,255,255,.12); }
.side .ico { font: 600 10px var(--font-mono); width: 26px; height: 22px; display: grid; place-items: center; border: 1px solid var(--side-muted); border-radius: 4px; flex: none; }
.side .grow { flex: 1; }
.side .who { font-size: 12px; color: var(--side-muted); padding: 8px; overflow-wrap: anywhere; }
.side .broken { color: #ffb4a8; font-size: 11px; }
.side button.linkish { background: none; border: 0; color: var(--side-fg); padding: 8px; text-align: left; font: inherit; font-size: 14px; cursor: pointer; border-radius: 6px; }
.side button.linkish:hover { background: rgba(255,255,255,.06); }
main { padding: 24px max(16px, 3vw) 48px; min-width: 0; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; }
  .side .brand { padding: 0 8px 0 0; } .side .brand small, .side .who, .side .grow { display: none; }
  main { padding: 18px 16px 40px; }
}

/* ---------- page parts ---------- */
.page-head { display: grid; gap: 4px; margin-bottom: 20px; }
.eyebrow { font: 12px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: 26px; font-weight: 600; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 70ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; min-width: 0; }
.stack { display: grid; gap: 20px; }
.fine { font-size: 12px; color: var(--muted); margin: 0; }
.status { font-size: 14px; margin: 0; min-height: 1.5em; }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }
.notice { background: var(--note-bg); color: var(--note-fg); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.notice.err { background: var(--err-bg); color: var(--err); }

button, .btn { font: inherit; font-weight: 500; border-radius: 6px; padding: 10px 14px; cursor: pointer; border: 1px solid var(--accent); text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-fg); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shared field component (label + ? + e.g.) ---------- */
.fy-form { display: grid; gap: 22px; }
.fy-form fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 14px; min-width: 0; }
.fy-form legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 4px; }
.fy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.fy-grid > .field:not(.half) { grid-column: 1 / -1; }
@media (max-width: 520px) { .fy-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 4px; min-width: 0; }
.field-head { display: flex; align-items: center; gap: 6px; position: relative; }
.field-head label { font-size: 13px; font-weight: 500; color: var(--fg); }
.field .req { color: var(--err); margin-left: 2px; }
.field .help {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1px solid var(--faint); background: transparent;
  color: var(--muted); font: 600 11px/1 var(--font-ui); display: inline-grid; place-items: center; cursor: help; flex: none;
}
.field .tip {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; max-width: min(320px, 85vw);
  background: var(--tip-bg); color: var(--tip-fg); font-size: 13px; line-height: 1.45; padding: 8px 10px; border-radius: 6px;
  box-shadow: 0 6px 20px -8px rgba(0,0,0,.45);
}
.field .help:hover + .tip, .field .help:focus-visible + .tip, .field .tip.open { display: block; }
.field input:not([type=checkbox]), .field select, .field textarea {
  font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; width: 100%; min-width: 0;
}
.field textarea { min-height: 72px; resize: vertical; }
.field .eg { font-size: 12px; color: var(--faint); }
.field .err-msg { font-size: 12px; color: var(--err); }
.field.bad input, .field.bad select, .field.bad textarea { border-color: var(--err); }
.field.check .field-head label { font-size: 15px; font-weight: 400; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.fy-group-note { font-size: 12px; color: var(--muted); margin: -4px 0 0; }
