/* FNP panel - look and feel (FS-11: purpose like CNP, design its own). Teal + amber on calm surfaces, ridge-line motif. */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f8fafc; --ink: #111827; --muted: #5b6475; --line: #e2e7ef;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #e6f4f2; --accent: #d97706; --accent-soft: #fff4e2;
  --danger: #c2410c; --danger-soft: #fdecec; --ok: #15803d; --ok-soft: #e8f6ec; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
  --radius: 14px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b1220; --surface: #121b2e; --surface-2: #0f1727; --ink: #e8edf6; --muted: #9aa6bd; --line: #24314b;
  --brand: #2bb3a3; --brand-ink: #04211e; --brand-soft: #12312f; --accent: #f0a63a; --accent-soft: #33260f;
  --danger: #f08a6a; --danger-soft: #3a1d17; --ok: #54c47a; --ok-soft: #13301f; --shadow: none; } }
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #121b2e; --surface-2: #0f1727; --ink: #e8edf6; --muted: #9aa6bd; --line: #24314b;
  --brand: #2bb3a3; --brand-ink: #04211e; --brand-soft: #12312f; --accent: #f0a63a; --accent-soft: #33260f;
  --danger: #f08a6a; --danger-soft: #3a1d17; --ok: #54c47a; --ok-soft: #13301f; --shadow: none; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .center { text-align: center; }
.hidden { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .3px; margin: 2px 6px 18px; }
.brand svg { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: 0; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--muted); font-weight: 600; }
.nav button svg { width: 19px; height: 19px; flex: none; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button.on { background: var(--brand-soft); color: var(--brand); }
.main { min-width: 0; padding: 22px clamp(14px, 3vw, 34px) 90px; max-width: 1180px; width: 100%; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top .who { display: flex; gap: 8px; align-items: center; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 20; }
  .side .brand, .side .nav-extra { display: none; }
  .nav { display: flex; justify-content: space-around; }
  .nav button { flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 4px; width: auto; flex: 1; text-align: center; align-items: center; }
  .nav button.more-only { display: none; }
}

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tile { position: relative; overflow: hidden; }
.tile .big { font-size: 1.6rem; font-weight: 800; }
.tile .lbl { color: var(--muted); font-size: .85rem; font-weight: 600; }
.tile::after { content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 6px, var(--brand-soft) 6px 8px); opacity: .9; pointer-events: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); padding: 9px 15px; border-radius: 10px; cursor: pointer; font-weight: 650; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1b1203; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
label.f { display: block; font-weight: 600; font-size: .88rem; }
label.f > span { display: block; margin-bottom: 4px; }
.in, select.in, textarea.in { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none; }
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 40px; height: 22px; appearance: none; background: var(--line); border-radius: 22px; position: relative; cursor: pointer; transition: .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked { background: var(--brand); } .switch input:checked::after { left: 21px; }

/* tables and lists */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 650; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.list-person { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-person:last-child { border-bottom: 0; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* split view (admin owners) */
.split { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 18px; background:
  radial-gradient(1200px 600px at 110% -10%, var(--brand-soft), transparent 60%), radial-gradient(800px 500px at -10% 110%, var(--accent-soft), transparent 60%), var(--bg); }
.auth .card { width: min(420px, 100%); padding: 26px; }
.auth .brand { justify-content: center; margin-bottom: 8px; }

/* overlays */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 600; max-width: 92vw; box-shadow: var(--shadow); }
.toast.bad { background: var(--danger); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(8,12,24,.5); display: grid; place-items: center; z-index: 50; padding: 14px; }
.modal { width: min(560px, 100%); max-height: 92vh; overflow: auto; }
.busy { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8,12,24,.25); z-index: 70; }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: s 1s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
.banner { padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.banner.warn { background: var(--accent-soft); color: var(--accent); }
.banner.bad { background: var(--danger-soft); color: var(--danger); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.ver { margin-top: 26px; color: var(--muted); font-size: .72rem; text-align: center; }

/* phones: tables become cards */
@media (max-width: 700px) {
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr:first-child { display: none; }
  .tbl.cards tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl.cards td { border: 0; padding: 3px 0; }
  .tbl.cards td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .8rem; }
  .top h1 { font-size: 1.2rem; }
}
