/* Wiqaya admin. Same tokens as the public site (site/assets/site.css), denser layout for work. */
:root {
  color-scheme: light;
  --ink:#13211F; --muted:#55625E; --rule:#C9D1CB;
  --gypsum:#EEF1EC; --white:#FFFFFF;
  --brand:#0F5B4A; --brand-hover:#0B4A3C; --wash:#DCEBE3; --mint:#9FD3C1;
  --exposed:#B42318; --developing:#9A5B00; --prepared:#36648F; --ready:var(--brand);
  --crit-bg:#FBEAE8;
  --font:"IBM Plex Sans",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --font-display:"IBM Plex Sans Condensed","IBM Plex Sans",system-ui,sans-serif;
  --font-ar:"IBM Plex Sans Arabic","IBM Plex Sans",system-ui,sans-serif;
  --mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--gypsum); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[lang="ar"], [dir="rtl"] { font-family: var(--font-ar); }
.skip-link { position: absolute; left: 12px; top: -100px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 10; }
.skip-link:focus { top: 12px; }

h1, h2 { font-family: var(--font-display); font-weight: 600; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.2; }
.lede { color: var(--muted); max-width: 70ch; margin: 0 0 24px; }
.muted { color: var(--muted); }
.num { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.num--big { font-size: 40px; line-height: 1; }

/* Top bar and client shell */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; height: 60px;
  background: var(--white); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 18px; }
.brand [lang="ar"] { font-size: 17px; }
.brand__tag { font-size: 13px; font-weight: 500; color: var(--muted); border-left: 1px solid var(--rule); padding-left: 10px; margin-left: 2px; }
.top__nav { display: flex; align-items: center; gap: 20px; }
.top__nav a, .linkish { color: var(--ink); font: 500 15px var(--font); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.top__nav a:hover, .linkish:hover { color: var(--brand); text-decoration: underline; }
.top__nav form { margin: 0; }

.page { max-width: 1100px; margin: 0 auto; padding: 32px 24px 80px; }
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.side { background: var(--white); border-right: 1px solid var(--rule); padding: 20px 16px; position: sticky; top: 60px; align-self: start;
  max-height: calc(100vh - 60px); overflow: auto; }
.side ul { list-style: none; margin: 0 0 16px; padding: 0; }
.side li a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 15px; }
.side li a:hover { background: var(--gypsum); }
.side li a[aria-current="page"] { background: var(--wash); color: var(--brand); font-weight: 600; }
.side__client { font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.2; margin: 0 0 16px; }
.side__client a { color: var(--ink); text-decoration: none; }
.side__head { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 4px 10px; }
.page--client { max-width: 980px; margin: 0; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head form { margin: 0; }
.narrow { max-width: 440px; margin: 40px auto; background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 28px; }
.stack { display: grid; gap: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 18px; border-radius: 8px;
  border: 2px solid transparent; font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); }
.btn--secondary { background: var(--white); border-color: var(--ink); color: var(--ink); }
.btn--secondary:hover { background: var(--ink); color: #fff; }
.btn--sm { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Panels and tables */
.panel { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 22px 24px; margin-bottom: 20px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel__head h2 { margin: 0; }
.panel__head form { margin: 0; }
.score-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 15px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: 14px; }
.page > .table { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.band { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 14px; font-weight: 600; color: #fff; }
.band.Exposed { background: var(--exposed); } .band.Developing { background: var(--developing); }
.band.Prepared { background: var(--prepared); } .band.Ready { background: var(--ready); }
.gaps { margin: 0; padding-left: 20px; } .gaps li { margin-bottom: 4px; }
.empty { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 32px; text-align: center; }

/* Messages */
.flash { background: var(--wash); border-left: 4px solid var(--brand); padding: 10px 16px; margin-bottom: 20px; }
.flash p { margin: 4px 0; }
.alert { background: var(--crit-bg); border-left: 4px solid var(--exposed); padding: 10px 16px; margin: 0 0 16px; }
.alert ul { margin: 4px 0; }
.log, .code { font: 13px/1.5 var(--mono); background: var(--white); border: 1px solid var(--rule); border-radius: 6px; padding: 12px; overflow: auto; white-space: pre-wrap; }

/* Forms */
.f-row { margin: 0 0 14px; }
.f-label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.f-hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.f-static { margin: 0; padding: 8px 0; font-weight: 500; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 10px; min-height: 40px; }
input[readonly] { background: var(--gypsum); color: var(--muted); }
textarea { resize: vertical; line-height: 1.5; }
textarea.code { min-height: 60vh; }
.f-num { max-width: 160px; }
.f-code { max-width: 180px; letter-spacing: .15em; font-variant-numeric: tabular-nums; }
.f-object { border: 1px solid var(--rule); border-radius: 8px; background: var(--white); padding: 16px 18px 4px; margin: 0 0 18px; }
.f-object > legend { font-weight: 600; padding: 0 6px; }
.f-object .f-object { background: var(--gypsum); }
.f-group { margin-top: 28px; }
.f-records { margin: 0 0 18px; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; margin: 0 14px 6px 0; cursor: pointer; }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }
.chk--danger { color: var(--exposed); font-size: 14px; }
.chk-group { display: flex; flex-wrap: wrap; padding: 6px 0 0; }
.f-bool { margin-top: -4px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }

.rec { background: var(--white); border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 10px; }
.rec > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style-position: inside; }
.rec[open] > summary { border-bottom: 1px solid var(--rule); }
.rec__body { padding: 16px 18px 6px; }
.rec--inner { background: var(--gypsum); }
.rec--inner .f-object { background: var(--white); }
.crit-id { font-family: var(--font-display); color: var(--brand); margin-right: 6px; }
.lvl { float: right; font-size: 13px; font-weight: 600; background: var(--wash); color: var(--brand); padding: 1px 8px; border-radius: 4px; }
.lvl--empty { background: var(--gypsum); color: var(--muted); }
.q { font-weight: 500; margin: 0 0 12px; }
.levels { border: 0; padding: 0; margin: 0 0 14px; }
.level { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 6px; cursor: pointer; font-size: 15px; }
.level input { margin-top: 4px; accent-color: var(--brand); }
.level:has(input:checked) { border-color: var(--brand); background: var(--wash); }
.ev { display: grid; grid-template-columns: 140px minmax(0, 1fr) 160px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.ev .chk { margin: 0; }

.savebar { position: sticky; bottom: 0; background: var(--gypsum); border-top: 1px solid var(--rule); padding: 12px 0; margin-top: 16px; z-index: 2; }

/* Scorecard markdown */
.md { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: 24px 28px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 12px 0 20px; }
.md th, .md td { border-bottom: 1px solid var(--rule); padding: 6px 8px; text-align: left; vertical-align: top; }
.md code { font: 13px var(--mono); }
.md h1 { font-size: 30px; } .md h2 { margin-top: 24px; }
.hist { font: 14px var(--mono); }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--rule); }
  .side ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .ev { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 24px 16px 64px; }
  .brand__tag { display: none; }
}

/* Onboarding form */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.steps { list-style: none; margin: 0 0 14px; padding: 0; }
.side .steps a { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 15px; }
.steps a:hover { background: var(--gypsum); }
.steps a[aria-current="page"] { background: var(--wash); color: var(--brand); font-weight: 600; }
.tick { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--rule); }
.tick--on { background: var(--brand); border-color: var(--brand); }
.step-count { margin: 0 0 4px; font-size: 14px; }
.intro-card { background: var(--white); border: 1px solid var(--rule); border-top: 6px solid var(--brand); border-radius: 4px 4px 10px 10px; padding: 28px; margin-bottom: 28px; }
.facts-list { padding-left: 20px; margin: 0 0 20px; } .facts-list li { margin-bottom: 6px; }
.step-list { columns: 2; padding-left: 22px; } .step-list li { margin-bottom: 4px; break-inside: avoid; }
.review { list-style: none; padding: 0; margin: 0 0 16px; }
.review li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.review .muted { margin-left: auto; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .btn-row form { margin: 0; }
.link-box { margin-top: 6px; font: 14px var(--mono); }
.ro-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--gypsum); font-size: 15px; }
.ro-label { color: var(--muted); }
.ro-head { font-weight: 600; margin: 14px 0 4px; }
.ro-group { margin-bottom: 8px; }
.ro-item { border-left: 3px solid var(--wash); padding-left: 12px; margin: 6px 0 10px; }
.steps-link { display: none; }
@media (max-width: 860px) { .side--steps { display: none; } .steps-link { display: inline; } .step-list { columns: 1; } .ro-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }

/* Email the onboarding form */
.email-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; align-items: start; }
.email-preview { width: 100%; height: 760px; border: 1px solid var(--rule); border-radius: 8px; background: var(--white); }
@media (max-width: 1100px) { .email-grid { grid-template-columns: minmax(0, 1fr); } }
