/* Al Ayyubi staff portal, in the family of the Al Ayyubi Academy decks.
   Same brand and the same voice as the decks: Figtree in three weights, Charcoal panels with Cream
   or Saffron type, Cream as the page, Saffron as a fill behind the words that matter (always with
   Charcoal text), numbered Saffron nodes, Charcoal pill tags, white rows on Cream. Adapted for an app:
   a Charcoal rail on desktop, a Charcoal top bar and a white tab bar on phones.
   No shadows, gradients, decorative shapes or side-stripe borders. Base unit 4px.
   Contrast (from the decks' verified table): charcoal/cream 14.8, charcoal/saffron 9.2,
   saffron/charcoal 9.2, cream/charcoal 14.8, grey #5A5A5A/cream 6.0. White text on Saffron is forbidden. */

@font-face { font-family: "Figtree"; src: url("../fonts/Figtree-400.6cd7caa972f6.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../fonts/Figtree-600.92a7ce589391.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../fonts/Figtree-800.bd43c94541a1.ttf") format("truetype"); font-weight: 800; font-display: swap; }

:root {
  /* the locked brand (brand-identity-v1) */
  --saffron: #F4B400;
  --saffron-dark: #B78832;
  --charcoal: #1C1C1C;
  --charcoal-2: #2A2A2A;      /* a step up on the Charcoal rail, for the hover row */
  --cream: #F0EFE9;
  --white: #FFFFFF;

  /* text on Cream and white */
  --ink: #1C1C1C;
  --ink-soft: #3A3A3A;
  --ink-muted: #5A5A5A;       /* 6.0:1 on cream */
  /* text on Charcoal */
  --on-dark: #F0EFE9;
  --on-dark-muted: #B9B6AC;

  /* lines */
  --line: #DEDBD1;
  --line-strong: #C9C5B9;

  /* the decks' Gate colour: refusals and prohibitions only, always with an icon and a word */
  --gate: #8C1218;
  --gate-pale: #FDF3D8;
  --done: #2F6B43;            /* approved / saved, always with an icon and a word */
  --done-pale: #E7F1EA;

  --focus: 0 0 0 3px rgba(244, 180, 0, .55);
  --r-sm: 6px; --r-md: 10px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --rail: 248px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "Figtree", system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
h1, h2, h3 { text-wrap: balance; }

/* ---------- frame ---------- */
.frame { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: var(--s5) var(--s4); background: var(--charcoal); color: var(--on-dark); }
.brand { display: flex; gap: var(--s3); align-items: center; padding: 0 var(--s2) var(--s5); text-decoration: none; }
.brand img { width: 44px; height: 44px; }
.brand b { display: block; font-weight: 800; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; color: var(--saffron); line-height: 1.15; }
.brand span { font-size: 13px; color: var(--on-dark-muted); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--on-dark); font-weight: 600; font-size: 15px; transition: background .15s var(--ease); }
.nav a svg { width: 20px; height: 20px; flex: none; stroke: currentColor; }
.nav a:hover { background: var(--charcoal-2); }
.nav a.on { background: var(--saffron); color: var(--charcoal); font-weight: 800; }
.nav-label { margin: var(--s5) var(--s3) var(--s2); font-size: 12px; font-weight: 600; color: var(--on-dark-muted); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) var(--s2) 0; border-top: 1px solid var(--charcoal-2); }
.rail-foot .nav a { font-size: 13px; padding: 6px var(--s3); }
.who { display: flex; align-items: center; gap: var(--s3); }
.avatar { width: 36px; height: 36px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none; background: var(--saffron); color: var(--charcoal); font-size: 13px; font-weight: 800; text-decoration: none; }
.rail .avatar { color: var(--charcoal); }
.who b { display: block; font-size: 15px; font-weight: 600; line-height: 1.2; }
.who span { font-size: 13px; color: var(--on-dark-muted); }
.signout { font: inherit; font-size: 13px; border: 0; background: none; color: var(--on-dark-muted); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.topbar, .tabbar, .hide-desktop { display: none; }

.page { padding: var(--s6) var(--s7) var(--s7); max-width: 1160px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.kicker { font-size: 14px; font-weight: 600; color: var(--ink-muted); margin: 0 0 var(--s1); }
h1 { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 800; margin: 0 0 var(--s3); }
.lede { color: var(--ink-soft); margin: var(--s2) 0 0; max-width: 62ch; font-size: 17px; }

/* ---------- panels: white rows on cream, charcoal statements, saffron takeaways ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s5); }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; }
.statement { background: var(--charcoal); color: var(--on-dark); border-radius: var(--r-md); padding: var(--s6) var(--s6) var(--s5); }
.statement .kicker { color: var(--saffron); }
.statement h1 { color: var(--on-dark); font-size: 38px; }
.statement h1 .hl { color: var(--saffron); }
.statement p { color: var(--on-dark-muted); margin: var(--s3) 0 0; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--s4); align-items: start; }
.statement + .grid-2 { margin-top: var(--s4); }

/* ---------- numbered nodes (the decks' steps) ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--saffron); color: var(--charcoal); font-weight: 800; font-size: 14px; }
.steps a { font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.empty { padding: var(--s5); color: var(--ink-muted); display: flex; gap: var(--s3); align-items: center; }
.empty svg { width: 22px; height: 22px; stroke: var(--ink-muted); flex: none; }

/* ---------- the day strip ---------- */
.day-track { position: relative; height: 48px; border-radius: var(--r-sm); background: var(--cream) repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), var(--line-strong) calc(25% - 1px), var(--line-strong) 25%); overflow: hidden; }
.day-hours { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-top: var(--s1); }
.day-now { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--charcoal); }
.day-after { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 600; color: var(--ink-muted); }
.day-note { font-size: 14px; color: var(--ink-muted); margin: var(--s3) 0 0; }

/* ---------- facts (key-value) ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0; margin: 0; }
.facts dt, .facts dd { padding: 10px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-muted); font-size: 14px; font-weight: 600; padding-right: var(--s5); }
.facts dd { margin: 0; font-weight: 600; }
.facts dt:first-of-type, .facts dd:first-of-type { border-top: 0; }
.withheld { color: var(--ink-muted); font-weight: 400; display: inline-flex; gap: 6px; align-items: center; }
.withheld svg { width: 15px; height: 15px; stroke: currentColor; }

/* ---------- tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; background: var(--charcoal); color: var(--cream); white-space: nowrap; }
.tag svg { width: 13px; height: 13px; stroke: currentColor; }
.tag.saffron { background: var(--saffron); color: var(--charcoal); font-weight: 800; }
.tag.light { background: var(--cream); color: var(--ink-soft); border: 1px solid var(--line); }
.tag.done { background: var(--done-pale); color: var(--done); }
.tag.gate { background: var(--gate-pale); color: var(--gate); }

/* ---------- decision badge (approvals: icon + word + colour) ---------- */
.verdict { display: inline-flex; align-items: center; gap: var(--s2); padding: 8px 14px; border-radius: var(--r-sm); font-weight: 800; font-size: 14px; }
.verdict svg { width: 18px; height: 18px; stroke: currentColor; flex: none; }
.verdict small { display: block; font-weight: 600; font-size: 12px; }
.verdict.done { background: var(--done-pale); color: var(--done); }
.verdict.gate { background: var(--gate-pale); color: var(--gate); }
.verdict.waiting { background: var(--saffron); color: var(--charcoal); }

/* ---------- people ---------- */
.toolbar { display: flex; gap: var(--s3); align-items: center; margin-bottom: var(--s4); }
.search { flex: 1; position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--ink-muted); }
.search input[type=search] { padding-left: 44px; }
.people { list-style: none; margin: 0; padding: 0; }
.person { display: grid; grid-template-columns: 44px 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); text-decoration: none; min-height: 64px; }
.people li:first-child .person { border-top: 0; }
a.person:hover { background: #FBFAF7; }
.person .avatar { width: 44px; height: 44px; font-size: 14px; }
.person b { display: block; font-weight: 800; line-height: 1.25; }
.person span { font-size: 14px; color: var(--ink-muted); }
.person .meta { text-align: right; font-size: 13px; color: var(--ink-muted); }

/* ---------- profile and history ---------- */
.profile { display: flex; gap: var(--s4); align-items: center; }
.profile .avatar { width: 64px; height: 64px; font-size: 22px; }
.statement .profile .lede { color: var(--on-dark-muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s5) 34px; }
.timeline li::before { content: ""; position: absolute; left: 9px; top: 22px; bottom: 0; width: 2px; background: var(--line-strong); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 3px; width: 16px; height: 16px; border-radius: var(--r-pill); background: var(--white); border: 3px solid var(--charcoal); }
.timeline li:first-child::after { background: var(--saffron); }
.timeline time { font-size: 13px; font-weight: 800; color: var(--ink-muted); }
.timeline b { display: block; font-weight: 800; }
.timeline span { font-size: 14px; color: var(--ink-muted); }

/* ---------- org chart ---------- */
.org { list-style: none; margin: 0; padding: 0; }
.org ul { list-style: none; margin: 0 0 0 26px; padding: 0 0 0 22px; border-left: 2px solid var(--line-strong); }
.org li { position: relative; padding-top: var(--s3); }
.org ul > li::before { content: ""; position: absolute; left: -22px; top: 38px; width: 20px; border-top: 2px solid var(--line-strong); }
.org .node { display: inline-flex; gap: var(--s3); align-items: center; padding: var(--s2) var(--s4) var(--s2) var(--s2); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); }
.org > li > .node { background: var(--charcoal); border-color: var(--charcoal); color: var(--on-dark); }
.org > li > .node span { color: var(--on-dark-muted); }
.org .node .avatar { width: 40px; height: 40px; font-size: 13px; }
.org .node b { display: block; font-weight: 800; line-height: 1.2; }
.org .node span { font-size: 13px; color: var(--ink-muted); }
.org .count { font-size: 13px; font-weight: 600; color: var(--ink-muted); margin-left: var(--s2); }

/* ---------- tables: saffron header band, as in the decks' Facts layout ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 800; color: var(--charcoal); background: var(--saffron); padding: 10px var(--s5); }
.table td { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); vertical-align: top; background: var(--white); }
.table tr:first-child td { border-top: 0; }
.table td b { font-weight: 800; }
.issue { display: flex; gap: 6px; align-items: flex-start; font-size: 14px; }
.issue svg { width: 15px; height: 15px; flex: none; margin-top: 3px; stroke: currentColor; }
.issue.err { color: var(--gate); } .issue.warn { color: #7A5300; } .issue.ok { color: var(--done); }
.summary { display: flex; gap: var(--s6); flex-wrap: wrap; margin: 0; }
.summary div { display: flex; flex-direction: column; }
.summary dt { font-size: 14px; font-weight: 600; color: var(--ink-muted); }
.summary dd { margin: 0; font-size: 34px; font-weight: 800; line-height: 1.1; }
.summary dd.err { color: var(--gate); } .summary dd.warn { color: #7A5300; }

/* ---------- notices ---------- */
.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-sm); margin-bottom: var(--s4); font-weight: 600; }
.notice svg { width: 20px; height: 20px; flex: none; stroke: currentColor; }
.notice.info { background: var(--saffron); color: var(--charcoal); }
.notice.ok { background: var(--done-pale); color: var(--done); }
.notice.bad { background: var(--gate-pale); color: var(--gate); }

/* ---------- controls ---------- */
input[type=text], input[type=password], input[type=search], input:not([type]) { font: inherit; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-strong); background: var(--white); color: var(--ink); width: 100%; min-height: 48px; }
input::placeholder { color: var(--ink-muted); }
input:focus { outline: none; border-color: var(--charcoal); box-shadow: var(--focus); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); font: inherit; font-weight: 800; font-size: 15px; min-height: 48px; padding: 0 20px; border-radius: var(--r-sm); border: 2px solid var(--charcoal); background: var(--charcoal); color: var(--cream); cursor: pointer; text-decoration: none; transition: transform .1s var(--ease), background .15s var(--ease); }
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: var(--charcoal); }
.btn.primary:hover { background: #FFC21A; }
.btn.quiet { background: transparent; color: var(--charcoal); }
.btn.quiet:hover { background: rgba(28, 28, 28, .06); }
.btn svg { width: 18px; height: 18px; stroke: currentColor; }
.file-pick { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; padding: var(--s5); border: 2px dashed var(--line-strong); border-radius: var(--r-md); background: var(--white); }
.file-pick > svg { width: 24px; height: 24px; stroke: var(--charcoal); }
.lang { display: flex; gap: 2px; padding: 3px; background: var(--charcoal-2); border-radius: var(--r-pill); width: max-content; }
.lang button { font: inherit; font-size: 13px; font-weight: 800; border: 0; background: transparent; color: var(--on-dark-muted); padding: 5px 12px; border-radius: var(--r-pill); cursor: pointer; min-height: 32px; }
.lang button.on { background: var(--saffron); color: var(--charcoal); }
.lang.on-light { background: var(--white); border: 1px solid var(--line); }
.lang.on-light button { color: var(--ink-muted); }
.lang.on-light button.on { background: var(--charcoal); color: var(--cream); }

/* ---------- sign in: a Charcoal statement beside the form ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.signin-art { background: var(--charcoal); color: var(--on-dark); padding: var(--s7); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s6); }
.letterhead { display: flex; gap: var(--s3); align-items: center; }
.letterhead img { width: 64px; height: 64px; }
.letterhead b { display: block; font-weight: 800; color: var(--saffron); letter-spacing: .02em; text-transform: uppercase; }
.letterhead span { font-size: 13px; color: var(--on-dark-muted); line-height: 1.4; display: block; }
.signin-art h1 { font-size: 46px; color: var(--on-dark); max-width: 14ch; line-height: 1.05; }
.signin-art h1 .hl { color: var(--saffron); }
.signin-art p { color: var(--on-dark-muted); max-width: 40ch; margin: var(--s4) 0 0; font-size: 17px; }
.signin-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s6); gap: var(--s5); }
.signin-form > form:not(.lang) { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--s4); }
.signin-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }

/* ---------- phones ---------- */
@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .rail { display: none; }
  .hide-desktop { display: block; }
  .topbar { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s4); background: var(--charcoal); color: var(--on-dark); position: sticky; top: 0; z-index: 10; }
  .topbar img { width: 34px; height: 34px; }
  .topbar b { font-weight: 800; color: var(--saffron); letter-spacing: .02em; text-transform: uppercase; font-size: 15px; }
  .topbar .avatar { margin-left: auto; width: 34px; height: 34px; font-size: 12px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--white); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); gap: 4px; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--ink-muted); text-decoration: none; border-radius: var(--r-sm); min-height: 52px; justify-content: center; }
  .tabbar a svg { width: 22px; height: 22px; stroke: currentColor; }
  .tabbar a.on { background: var(--saffron); color: var(--charcoal); font-weight: 800; }
  .page { padding: var(--s4) var(--s4) 104px; }
  h1 { font-size: 27px; }
  .statement { padding: var(--s5) var(--s4); }
  .statement h1 { font-size: 28px; }
  .grid-2 { grid-template-columns: 1fr; }
  .panel { padding: var(--s4); }
  .panel-head, .steps li, .person, .table th, .table td { padding-left: var(--s4); padding-right: var(--s4); }
  .person { grid-template-columns: 44px 1fr; }
  .person .meta, .hide-phone { display: none; }
  .table { font-size: 14px; }
  .signin { grid-template-columns: 1fr; }
  .signin-art { padding: var(--s5) var(--s4); gap: var(--s5); }
  .signin-art h1 { font-size: 32px; }
  .signin-form { padding: var(--s5) var(--s4) var(--s6); justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
