/* Smart Bookkeeper Control Centre. NSwise suite look: navy side bar, teal brand, light/dark tokens (theme.js),
   logical properties so Arabic (dir="rtl") mirrors the layout. House rule: no italic text anywhere. */
:root {
  --bg: #f4f7f9; --panel: #ffffff; --ink: #0f1d2e; --muted: #5b6b7c; --line: #dfe6ec;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #e6f4f1;
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --ok: #15803d; --ok-soft: #dcfce7;
  --side: #0b1f3a; --side-ink: #c9d6e3; --side-active: #16345c; --accent: #2dd4bf;
  --radius: 10px; --shadow: 0 1px 2px rgba(11,31,58,.05), 0 2px 8px rgba(11,31,58,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1220; --panel: #111c2e; --ink: #e6edf5; --muted: #93a4b8; --line: #22324a;
    --brand: #2dd4bf; --brand-ink: #062a26; --brand-soft: #0f2f2d;
    --warn: #fbbf24; --warn-soft: #3a2e0f; --bad: #f87171; --bad-soft: #3b1414; --ok: #4ade80; --ok-soft: #12321e;
    --side: #07111f; --side-ink: #b4c3d4; --side-active: #13284a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1220; --panel: #111c2e; --ink: #e6edf5; --muted: #93a4b8; --line: #22324a;
  --brand: #2dd4bf; --brand-ink: #062a26; --brand-soft: #0f2f2d;
  --warn: #fbbf24; --warn-soft: #3a2e0f; --bad: #f87171; --bad-soft: #3b1414; --ok: #4ade80; --ok-soft: #12321e;
  --side: #07111f; --side-ink: #b4c3d4; --side-active: #13284a; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif; }
em, i, cite, address, dfn, var { font-style: normal; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 16px; margin: 0 0 12px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.mono, .ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.skip { position: absolute; inset-inline-start: -999px; } .skip:focus { inset-inline-start: 8px; top: 8px; z-index: 50; background: var(--panel); padding: 8px; }

.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; font-size: 16px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.22); }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--accent); letter-spacing: .02em; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .6; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--side-ink); padding: 8px 10px; border-radius: 8px; }
.nav a:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 var(--accent); }
.nav .soon { font-size: 10px; background: rgba(255,255,255,.08); padding: 1px 7px; border-radius: 99px; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.top .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }
.content { padding: 24px; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid > .card, .grid > div > .card:last-child { margin-bottom: 0; }
.grid > div { display: grid; gap: 16px; align-content: start; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.card .page-head { margin-bottom: 10px; } .card .page-head h2 { margin: 0; }
.issue { color: var(--bad); } .issue-list { margin: 0; padding-inline-start: 18px; } .gap-top { margin-top: 14px; }
.keybox { word-break: break-all; user-select: all; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.stat .label { color: var(--muted); font-size: 12px; } .stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 14px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; }
.btn:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--brand-soft); }
.table-wrap { overflow-x: auto; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.grey { background: var(--line); color: var(--muted); }

label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 3px; }
input, select, textarea { display: block; width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.error-box { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.note { background: var(--brand-soft); border-radius: 8px; padding: 10px 14px; }

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #0b1f3a 0%, #0f3b4f 60%, #0f766e 100%); }
.signin .card { width: 100%; max-width: 400px; padding: 28px; }
.signin .brand { color: var(--ink); padding: 0 0 16px; }
.signin-top { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 8px; }

.nsw-lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.nsw-lang button { border: 0; background: var(--panel); color: var(--ink); padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.nsw-lang button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.theme-switch svg { width: 15px; height: 15px; }

.modal-back { position: fixed; inset: 0; background: rgba(5,12,24,.55); display: grid; place-items: center; padding: 16px; z-index: 40; }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; padding: 22px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#toast-root { position: fixed; inset-block-end: 16px; inset-inline-end: 16px; z-index: 60; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast.bad { background: var(--bad); color: #fff; }
.empty { text-align: center; padding: 34px 12px; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 30; transform: translateX(-105%); transition: transform .2s; }
  [dir="rtl"] .side { transform: translateX(105%); }
  .layout.menu-open .side { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g2, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; } .top { padding: 10px 16px; }
}
@media (max-width: 480px) { .g4, .g5 { grid-template-columns: repeat(2, minmax(0,1fr)); } .btn-word, .who .muted { display: none; } .stat .value { font-size: 22px; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
label.btn { cursor: pointer; } label.btn:focus-within { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; } .toolbar select { width: auto; }
tr.muted td { opacity: .6; }
.mailtext { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 320px; overflow: auto; font-size: 13px; margin: 0 0 10px; }
textarea.mail { min-height: 220px; font-size: 13px; } .q-item { border-top: 1px solid var(--line); padding: 10px 0; } .q-item:first-child { border-top: 0; }
label.inline { display: flex; gap: 8px; align-items: center; } label.inline input { width: auto; display: inline-block; }

/* ---------- API docs page (/docs), same as Smart Voice ---------- */
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 12px; }
body.docs { margin: 0; }
.docs-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 20px; background: var(--side); color: var(--side-ink); }
.docs-top a { color: var(--side-ink); } .docs-top .muted { color: var(--side-ink); opacity: .75; }
.docs-brand { font-weight: 700; font-size: 16px; color: #fff !important; }
.docs-links { margin-inline-start: auto; font-size: 13px; }
.docs-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; max-width: 1180px; margin: 0 auto; padding: 20px; }
.docs-nav { position: sticky; top: 16px; align-self: start; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 32px); overflow-y: auto; }
.docs-nav a { padding: 5px 10px; border-radius: 6px; color: var(--ink); }
.docs-nav a:hover { background: var(--brand-soft); text-decoration: none; }
.docs-nav a.sub { padding-inline-start: 22px; font-size: 13px; color: var(--muted); }
.docs-main { min-width: 0; }
.docs-main code { font-size: 12.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; overflow-wrap: anywhere; }
.docs-main pre code { border: 0; padding: 0; background: none; }
.docs-main h4 { font-size: 13px; margin: 12px 0 6px; }
.docs-table td, .docs-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.docs-tabbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.docs-copy { margin-inline-start: auto; }
.docs-purposes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.docs-purpose { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.docs-purpose p { margin: 6px 0; }
.docs-tag { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.docs-op { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.docs-op summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.docs-m { display: inline-block; min-width: 58px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 6px; background: var(--brand-soft); color: var(--brand); }
.docs-m-post { background: var(--ok-soft); color: var(--ok); } .docs-m-put { background: var(--warn-soft); color: var(--warn); } .docs-m-delete { background: var(--bad-soft); color: var(--bad); }
.docs-m-patch { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 820px) {
  .docs-wrap { grid-template-columns: 1fr; padding: 12px; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .docs-nav a.sub { display: none; }
  .docs-links { margin-inline-start: 0; width: 100%; }
}
/* Developers page (Phase 7) */
fieldset.field { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; } fieldset.field legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
fieldset.field label.inline { font-weight: 400; margin: 6px 0; align-items: baseline; flex-wrap: wrap; }
.row-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; } .row-form .field { margin-bottom: 0; }

/* 0.10.0: upload progress */
.upload-list { list-style: none; margin: 8px 0 0; padding: 0; }
.upload-list li { padding: 6px 0; border-top: 1px solid var(--line, #e5e7eb); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; overflow-wrap: anywhere; }
