/* Rider Ops — shares the Parcel identity: navy #09273D, amber #FED12C. */

:root {
  --brand-navy: #09273D;
  --brand-amber: #FED12C;

  --paper: #EFF2F6;
  --card: #FFFFFF;
  --sunk: #F4F7FA;
  --ink: #09273D;
  --muted: #55677A;
  --faint: #8695A5;
  --line: #DCE3EA;
  --line-strong: #BFCAD6;
  --accent: #09273D;
  --accent-soft: #E2EAF2;
  --on-accent: #FFFFFF;

  --good: #12694A;  --good-bg: #DFEFE7;
  --warn: #8A5510;  --warn-bg: #F7EAD6;
  --bad:  #A62A20;  --bad-bg:  #F8E4E1;

  --shadow: 0 1px 2px rgba(9,39,61,.06), 0 1px 3px rgba(9,39,61,.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #061722; --card: #0B2436; --sunk: #102C40;
    --ink: #E3EBF3; --muted: #90A4B6; --faint: #5E7186;
    --line: #163348; --line-strong: #24455A;
    --accent: #FED12C; --accent-soft: #16324A; --on-accent: #09273D;
    --good: #4FBE8C; --good-bg: #0E3122;
    --warn: #D89A5C; --warn-bg: #33220F;
    --bad:  #EF7E74; --bad-bg:  #37191A;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --paper: #061722; --card: #0B2436; --sunk: #102C40;
  --ink: #E3EBF3; --muted: #90A4B6; --faint: #5E7186;
  --line: #163348; --line-strong: #24455A;
  --accent: #FED12C; --accent-soft: #16324A; --on-accent: #09273D;
  --good: #4FBE8C; --good-bg: #0E3122;
  --warn: #D89A5C; --warn-bg: #33220F;
  --bad: #EF7E74; --bad-bg: #37191A;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
/* Author rules like `display:flex` outrank the browser's own [hidden] rule,
   so this puts the attribute back in charge everywhere. */
[hidden] { display: none !important; }

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.6;
}
.mono, .num { font-family: "IBM Plex Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

/* ── top bar ───────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 13px 24px;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--brand-amber);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }
.sub { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meta { font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--faint); }

.btn {
  font-family: inherit; font-size: 13px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 14px; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn.small { font-size: 12px; padding: 4px 10px; }

/* ── layout ────────────────────────────────────────────── */
.page { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  font: inherit; font-size: 13px; background: none; border: none;
  border-bottom: 2px solid transparent; color: var(--muted);
  padding: 9px 14px; cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.panel-intro { font-size: 13px; color: var(--muted); margin: 0 0 14px; max-width: 80ch; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; }
.field input, .field select {
  font: inherit; font-size: 13px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 10px;
}
.field input:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
.help { font-size: 11.5px; color: var(--muted); margin: 0; }

/* ── cards, tables ─────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h3 { font-size: 14px; margin: 0 0 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: 16px; }
.kpi { padding: 14px 16px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: none; }
.kpi small { display: block; font-size: 11.5px; color: var(--muted); }
.kpi b { display: block; margin-top: 3px; font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 600; }
.kpi.pos b { color: var(--good); } .kpi.neg b { color: var(--bad); }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
table.grid th {
  text-align: left; padding: 10px 14px; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); background: var(--sunk);
  border-bottom: 1px solid var(--line-strong); position: sticky; top: 0;
}
table.grid th.n, table.grid td.n { text-align: right; }
table.grid td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: var(--sunk); }
table.grid td.n { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.name { font-weight: 600; }
.sub-line { display: block; font-size: 11px; color: var(--faint); font-family: "IBM Plex Mono", monospace; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.empty { padding: 26px 16px; text-align: center; color: var(--faint); font-size: 13px; }

.pill { display: inline-block; font-size: 10.5px; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.pill.pending  { background: var(--warn-bg); color: var(--warn); }
.pill.approved { background: var(--good-bg); color: var(--good); }
.pill.held     { background: var(--warn-bg); color: var(--warn); }
.pill.rejected { background: var(--bad-bg);  color: var(--bad); }
.pill.info     { background: var(--accent-soft); color: var(--accent); }

.msg { font-size: 12.5px; margin: 8px 0 0; min-height: 1.2em; }
.msg-ok { color: var(--good); } .msg-bad { color: var(--bad); } .msg-warn { color: var(--warn); }

.callout {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 8px; padding: 12px 15px; font-size: 12.5px;
  line-height: 1.6; margin-bottom: 14px;
}
.callout.warn { background: var(--warn-bg); border-color: var(--warn); }
.callout b { color: var(--accent); }
.callout.warn b { color: var(--warn); }

/* ── loading ───────────────────────────────────────────── */
#progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; overflow: hidden; }
#progress i { display: block; height: 100%; width: 40%; background: var(--brand-amber);
  animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%);} 100% { transform: translateX(350%);} }
.spinner { width: 15px; height: 15px; display: inline-block; vertical-align: -3px;
  border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { #progress i, .spinner { animation: none; } }

/* ── per-page help ─────────────────────────────────────── */
.help-btn {
  width: 30px; padding: 6px 0; font-weight: 700; font-size: 15px; line-height: 1;
  border-color: var(--accent); color: var(--accent);
}
.help-btn:hover { background: var(--accent); color: var(--on-accent); }

.backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(9,13,20,.5);
  display: flex; justify-content: flex-end;
}
.drawer {
  width: 100%; max-width: 520px; height: 100%;
  background: var(--card); border-left: 1px solid var(--line-strong);
  box-shadow: -12px 0 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  /* The amber rule is the one brand mark on this panel. */
  box-shadow: inset 0 3px 0 var(--brand-amber);
}
.drawer-eyebrow {
  display: block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-family: "IBM Plex Mono", monospace;
}
.drawer-head h2 { font-size: 19px; margin: 3px 0 0; font-weight: 700; }
.drawer-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.icon-btn {
  font: inherit; font-size: 15px; line-height: 1; background: none;
  border: 1px solid transparent; border-radius: 6px; color: var(--muted);
  padding: 5px 9px; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.langs { display: flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.lang {
  font: inherit; font-size: 12px; background: var(--card); color: var(--muted);
  border: none; padding: 5px 11px; cursor: pointer;
}
.lang + .lang { border-left: 1px solid var(--line-strong); }
.lang[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 12px 22px; border-top: 1px solid var(--line);
  background: var(--sunk); font-size: 11.5px;
}

.help-purpose { font-size: 14px; line-height: 1.65; margin: 0 0 20px; color: var(--ink); }
.help-h {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
  display: flex; align-items: center; gap: 9px;
}
.help-h::after { content: ""; flex: 1; height: 1px; background: var(--line); }

ol.help-steps { margin: 0 0 22px; padding: 0; list-style: none; counter-reset: hs; }
ol.help-steps li {
  position: relative; padding: 0 0 12px 34px; font-size: 13.5px; line-height: 1.6;
}
ol.help-steps li::before {
  counter-increment: hs; content: counter(hs);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

ul.help-watch { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
ul.help-watch li {
  background: var(--warn-bg); border: 1px solid var(--warn);
  border-radius: 8px; padding: 11px 14px;
  font-size: 12.5px; line-height: 1.6; color: var(--ink);
}
ul.help-watch b, .help-purpose b, ol.help-steps b { font-weight: 700; }

/* Arabic renders right-to-left with a face that has proper Arabic coverage. */
.drawer[dir="rtl"] { border-left: none; border-right: 1px solid var(--line-strong); }
.drawer[dir="rtl"] .drawer-body,
.drawer[dir="rtl"] .drawer-head h2,
.drawer[dir="rtl"] .help-purpose { text-align: right; }
.drawer[dir="rtl"] ol.help-steps li { padding: 0 34px 12px 0; }
.drawer[dir="rtl"] ol.help-steps li::before { left: auto; right: 0; }
.drawer[dir="rtl"] .help-purpose,
.drawer[dir="rtl"] ol.help-steps,
.drawer[dir="rtl"] ul.help-watch,
.drawer[dir="rtl"] .drawer-head h2 {
  font-family: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif;
}
.drawer[dir="rtl"] ol.help-steps li,
.drawer[dir="rtl"] ul.help-watch li { line-height: 1.85; }

@media (max-width: 560px) { .drawer { max-width: 100%; } }

/* ── sign-in ───────────────────────────────────────────── */
.signin-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.signin { width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-top: 3px solid var(--brand-amber);
  border-radius: 12px; box-shadow: var(--shadow); padding: 30px; }
.signin h1 { font-size: 17px; margin: 0 0 5px; }
.signin .sub { margin: 0 0 20px; font-size: 13px; color: var(--muted); line-height: 1.55; }
.signin label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.signin input { font: inherit; font-size: 14px; width: 100%; background: var(--paper);
  color: var(--ink); border: 1px solid var(--line-strong); border-radius: 7px; padding: 10px 12px; }
.signin input:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.signin input.bad { border-color: var(--bad); }
.signin button { font: inherit; font-size: 14px; font-weight: 600; width: 100%; margin-top: 16px;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
  border-radius: 7px; padding: 10px; cursor: pointer; }
.signin button:hover { filter: brightness(1.08); }
.foot-note { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--faint); line-height: 1.55; }

@media (max-width: 640px) { .kpi { border-left: none; border-top: 1px solid var(--line); } }

/* ── Settings drawer ─────────────────────────────────────────────────────── */

.set-section { margin: 0 0 26px; }
.set-h3 {
  font-size: 15px; font-weight: 700; margin: 0 0 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.set-h4 {
  font-size: 13px; font-weight: 700; margin: 20px 0 8px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.set-table { width: 100%; border-collapse: collapse; margin: 10px 0 4px; }
.set-table th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 5px 10px 5px 0; vertical-align: top; white-space: nowrap; font-size: 13px;
}
.set-table td {
  padding: 5px 0; font-variant-numeric: tabular-nums;
  word-break: break-word; font-size: 13px;
}
.set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }

/* Outcome of dialling a database: stated plainly, in words, not just colour. */
.set-status {
  margin: 8px 0 0; padding: 8px 11px; border-radius: 7px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.set-ok  { background: var(--good-bg); color: var(--good); }
.set-bad { background: var(--bad-bg);  color: var(--bad); }

.set-check-out:empty, .set-save-out:empty, .set-unlock-out:empty { display: none; }
