/* Ustaz console.
 *
 * Tokens are Stitch's "Digital Sanctuary" system, pinned here rather
 * than imported from the public style.css: the two are meant to look
 * related, not identical, and the public sheet is 16 KB of things a
 * working queue does not need.
 *
 * Amber is RESERVED for corpus matches. Anywhere else it dilutes the one
 * signal an ustaz should be able to read without stopping to think.
 */
:root {
  /* Shared palette: the same values as ui.css (the reader site), so the
     console and the public pages read as one product. The console keeps
     its own component sheet because a working queue is denser than a
     reading page; only the tokens are shared. */
  --paper:   #F4F6F5; --paper2: #F8FAF9; --paper3: #EEF3F1; --panel: #FFFFFF;
  --ink:     #13201D; --ink2:   #44524E; --muted: #5E6D69;
  --line:    #E1E7E4; --hair:   #E1E7E4; --line2: #CFDAD6;
  --verdigris: #1F6B61; --verdigris-2: #E3F0ED; --verdigris-3: #1A5A52;
  --rubric:  #A33520; --rubric-2: #F6E6E2;
  --ochre:   #7A4F0E; --ochre-2:  #FBEFD9;
  --amber:   #FFF6DC; --amber-line: #E4D7A6;
  --on-accent: #FFFFFF; --focus: #1F6B61;
  --side: #0F1F1C; --side-2: #18302B; --side-3: #24413B; --side-on: #1F3D37; --side-ink: #DCE7E4; --side-mute: #9FB8B2;
  --display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --body:    "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ar:      "Amiri", "Scheherazade New", "Traditional Arabic", "Noto Naskh Arabic", serif;

  /* The console's own names, now aliases of the shared palette. Amber is
     still RESERVED for corpus matches. */
  --primary:           var(--verdigris);
  --primary-deep:      var(--ink);
  --primary-container: var(--verdigris-2);
  --on-primary:        var(--on-accent);
  --surface:           var(--paper);
  --card:              var(--panel);
  --sunken:            var(--paper2);
  --locked:            var(--paper2);
  --ink-muted:         var(--ink2);
  --match:             var(--amber);
  --match-line:        var(--amber-line);
  --match-ink:         var(--ochre);
  --line-strong:       var(--line2);
  --error:             var(--rubric);
  --error-bg:          var(--rubric-2);
  --tint:              var(--verdigris-2);

  --r:      10px;
  --r-lg:   14px;
  --font:   var(--body);
  --serif:  var(--display);
  --arabic: var(--ar);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper:#151A1C; --paper2:#1B2123; --panel:#1F2628; --ink:#E9ECEA; --ink2:#C4CCC9; --muted:#8E9B98;
  --line:#3B4548; --hair:#2B3437; --verdigris:#7FD1C1; --verdigris-2:#1D3632; --verdigris-3:#A6E2D6; --paper3:#1A2022;
  --rubric:#E08874; --rubric-2:#3A2320; --ochre:#D2B36A; --ochre-2:#332C1C; --amber:#332C1C; --amber-line:#5A4D2A;
  --on-accent:#0F1A18; --focus:#7FBDB4; color-scheme: dark } }
:root[data-theme="dark"] {
  --paper:#151A1C; --paper2:#1B2123; --panel:#1F2628; --ink:#E9ECEA; --ink2:#C4CCC9; --muted:#8E9B98;
  --line:#3B4548; --hair:#2B3437; --verdigris:#7FD1C1; --verdigris-2:#1D3632; --verdigris-3:#A6E2D6; --paper3:#1A2022;
  --rubric:#E08874; --rubric-2:#3A2320; --ochre:#D2B36A; --ochre-2:#332C1C; --amber:#332C1C; --amber-line:#5A4D2A;
  --on-accent:#0F1A18; --focus:#7FBDB4; color-scheme: dark }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink);
       font-family: var(--font); min-height: 100vh; }

/* ----------------------------------------------------------- shell */
/* Same shell as the reader site: a dark sidebar with the queues grouped by
   what you do in them, a white top bar, the page below. Below 1000px the
   sidebar slides in from the menu button. */
body { display: flex; }
.side { position: sticky; top: 0; height: 100vh; flex: 0 0 272px; width: 272px; background: var(--side); color: var(--side-ink);
        display: flex; flex-direction: column; gap: 14px; padding: 20px 14px 16px; overflow-y: auto; z-index: 45;
        scrollbar-width: thin; scrollbar-color: var(--side-3) transparent; }
.side a { color: var(--side-ink); text-decoration: none; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; color: #FFFFFF !important; }
.side-brand b { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.2; }
.side-brand small { display: block; font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--side-mute); margin-top: 3px; }
.side-logo { width: 40px; height: 40px; flex: none; }
.side-logo rect { fill: #1F6B61; } .side-logo path { stroke: #FFFFFF; stroke-width: 3; stroke-linecap: round; fill: none; }
.side-logo circle { fill: #E9C46A; }
.side-search { display: flex; align-items: center; gap: 8px; background: var(--side-2); border-radius: 12px; padding: 0 10px 0 12px; min-height: 44px; }
.side-search svg { width: 18px; height: 18px; stroke: var(--side-mute); fill: none; stroke-width: 2; stroke-linecap: round; flex: none; }
.side-search input { all: unset; flex: 1; min-width: 0; font-size: 14px; color: #FFFFFF; }
.side-search input::placeholder { color: var(--side-mute); }
.side-search:focus-within { box-shadow: 0 0 0 2px #7FD1C1; }
.side-search kbd { font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: #C9D8D4; background: var(--side-3); border-radius: 6px; padding: 3px 6px; }
.side-nav { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8FA6A0; padding: 0 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; font-weight: 600; }
.side-nav a:hover { background: var(--side-2); color: #FFFFFF; }
.side-nav a.on { background: var(--side-on); color: #FFFFFF; box-shadow: inset 3px 0 0 #7FD1C1; }
[dir="rtl"] .side-nav a.on { box-shadow: inset -3px 0 0 #7FD1C1; }
.side-nav svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav a > span { flex: 1; }
.side-nav .nb { font-style: normal; font-size: 11.5px; font-weight: 800; color: #FFFFFF; background: #2E5A52; border-radius: 999px; padding: 1px 8px; }
.side-nav .nb:empty { display: none; }
.side-foot { border-top: 1px solid var(--side-3); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.side .who { font-size: 12.5px; color: var(--side-mute); padding: 4px 8px; }
.side .who b { display: block; color: #FFFFFF; font-weight: 700; font-size: 14px; }
.side .who a { color: #7FD1C1; }
.side .lang-ctl { margin: 6px 8px 0; align-self: flex-start; background: var(--side-2); color: var(--side-ink); border-color: var(--side-3); }
.side :focus-visible { outline: 2px solid #7FD1C1; outline-offset: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #3FB58F; display: inline-block; margin-right: 6px; }
.dot.off { background: var(--side-mute); }

.shell-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 36px;
          background: var(--panel); border-bottom: 1px solid var(--hair); }
.topbar-dates { display: flex; gap: 8px; min-width: 0; overflow: hidden; max-height: 40px; flex-wrap: wrap; }
.datechip { display: inline-flex; align-items: center; gap: 8px; background: var(--paper3); border-radius: 10px; padding: 7px 12px;
            font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.topbar .tools { margin-inline-start: auto; display: flex; align-items: center; gap: 16px; }
.topbar-link { font-size: 14px; font-weight: 700; color: var(--verdigris); text-decoration: none; white-space: nowrap; }
.topbar-user { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--verdigris-2); color: var(--verdigris-3);
          display: inline-grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.iconbtn { all: unset; box-sizing: border-box; width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 10px; cursor: pointer; color: var(--ink2); }
.iconbtn:hover { background: var(--paper3); }
.iconbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.menubtn { display: none; }
.side-scrim { position: fixed; inset: 0; background: rgba(8,16,14,.45); z-index: 44; }
@media (max-width: 1000px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-105%); transition: transform .2s ease-out; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  [dir="rtl"] .side { transform: translateX(105%); }
  body.side-open .side { transform: none; }
  .menubtn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .topbar-dates, .topbar-link { display: none; }
}

/* ------------------------------------------------------------- main */
/* Reading width, not screen width: the queue is text an ustaz reads
   carefully, so it is capped where a book would cap it. */
main { padding: 28px 36px 80px; max-width: 1200px; width: 100%; }
@media (max-width: 640px) { main { padding: 20px 16px 64px; } }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--ink2); }
.crumbs a { color: var(--verdigris); text-decoration: none; }
.crumbs i { font-style: normal; color: #8A9893; }
main:focus { outline: none; }
h1 { margin: 0 0 6px; font: 800 32px/1.2 var(--display); letter-spacing: -.02em; }
.subtitle { margin: 0 0 28px; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }
.spinner { display: inline-block; width: 12px; height: 12px;
           border: 2px solid var(--line-strong); border-top-color: var(--primary);
           border-radius: 50%; animation: spin .7s linear infinite;
           vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

.err { background: var(--error-bg); color: var(--rubric); padding: 12px 16px;
       border-radius: var(--r); margin-bottom: 16px; font-size: 14px; }
.empty { padding: 60px; text-align: center; color: var(--muted); }

button { font: 500 14px/1 var(--font); padding: 10px 16px; cursor: pointer;
         border-radius: var(--r); border: 1px solid var(--line-strong);
         background: var(--card); color: var(--ink); }
button:hover:not(:disabled) { border-color: var(--primary); }
button.primary { background: var(--primary); border-color: var(--primary);
                 color: var(--on-accent); }
button.danger { color: var(--error); border-color: var(--error-bg); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; }

select, input[type=text], input[type=password], input[type=search], input[type=email] {
  padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r); font: 400 14px/1 var(--font);
  background: var(--card); color: var(--ink); }
select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
  border-color: var(--primary); }
textarea { width: 100%; padding: 12px; border: 1px solid var(--line-strong);
           border-radius: var(--r); font: 400 16px/1.6 var(--font);
           resize: vertical; background: var(--card); color: var(--ink); }
label > span:first-child { display: block; margin-bottom: 6px; }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 20px;
           flex-wrap: wrap; }
.pill { font: 400 14px/1 var(--font); padding: 9px 14px; cursor: pointer;
        border: 1px solid var(--line); border-radius: var(--r);
        background: var(--card); color: var(--ink); }
.pill.on { background: var(--primary); color: var(--on-accent); border-color: var(--primary); }
.count { margin-left: auto; font-size: 13px; color: var(--muted); }

/* Hairline borders, no shadows. Depth here comes from tone, which is
   what keeps a long queue calm rather than busy. */
.card { background: var(--card); border: 1px solid var(--line);
        border-radius: var(--r-lg); margin-bottom: 20px; }
.card > .band { padding: 18px 20px; }
.card > .band + .band { border-top: 1px solid var(--line); }
.row { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }

.label { font: 600 12px/1 var(--font); letter-spacing: .05em;
         text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
         display: flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 4px 9px; border-radius: 999px;
        background: var(--tint); color: var(--verdigris); }
.chip.warn { background: var(--error-bg); color: var(--rubric); }
.badge { display: inline-block; font-size: 11px; padding: 3px 8px;
         border-radius: 999px; background: var(--locked); color: var(--ink-muted);
         margin-right: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* -------------------------------------------------------- sign in */
.signin { max-width: 460px; background: var(--card); border: 1px solid var(--line);
          border-radius: var(--r-lg); padding: 24px; }
.signin h2 { margin: 0 0 6px; font: 500 18px/1.4 var(--font); }
.signin p { margin: 0 0 16px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.signin input { width: 100%; font-family: var(--mono); }
.signin .row { margin-top: 12px; justify-content: flex-start; }

/* ------------------------------------------------------ consult */
.ask { font: 400 23px/1.45 var(--serif); margin-bottom: 10px;
        color: var(--ink); }
.meta { font-size: 13px; color: var(--muted); margin-bottom: 18px; }

.match { background: var(--match); border: 1px solid var(--match-line);
         border-radius: var(--r); padding: 14px; margin-bottom: 16px; }
.match .label { color: var(--match-ink); }
.match .q { font-size: 16px; margin-bottom: 6px; }
.match .r { font-size: 13px; color: var(--ink-muted); }
.nomatch { font-size: 13px; color: var(--muted); margin-bottom: 16px;
           padding: 12px 14px; background: var(--sunken); border-radius: var(--r); }
.teach { margin-top: 12px; padding-top: 12px; font-size: 13px; line-height: 1.6;
         border-top: 1px solid var(--match-line); color: var(--match-ink); }
.teach button { margin-top: 10px; font-size: 13px; padding: 8px 12px; }
.teach.weak { color: var(--muted); }

.answered { background: var(--primary-container); border-radius: var(--r);
            padding: 14px; font-size: 15px; line-height: 1.6; }
.byline { font-size: 12px; color: var(--muted); margin-top: 8px; }
.promote { margin-top: 16px; padding: 14px; background: var(--sunken);
           border-radius: var(--r); }
.promote .fields { display: grid; grid-template-columns: 1fr 180px; gap: 10px; }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ------------------------------------------------------- review */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
         gap: 12px; margin-bottom: 32px; }
.stat { background: var(--card); border: 1px solid var(--line);
        border-radius: var(--r-lg); padding: 16px; }
.stat .dom { font: 600 12px/1 var(--font); letter-spacing: .05em;
             text-transform: uppercase; color: var(--muted); }
.stat .n { font: 600 28px/1.2 var(--font); margin: 8px 0 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.bar { height: 3px; background: var(--locked); border-radius: 2px;
       margin-top: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* The point of the review screen: which text is the source's and which
   is ours must be legible at a glance. Locked = flat grey, padlock, no
   input element anywhere near it. Editable = white, bordered, a field. */
.locked { background: var(--locked); border-radius: var(--r); padding: 14px; }
.ar { font-family: var(--arabic); font-size: 22px; line-height: 2.0;
      direction: rtl; text-align: right; }
.editable textarea { min-height: 108px; font-size: 15px; line-height: 1.6; }
.mt { margin-top: 8px; font-size: 12px; font-style: italic; color: var(--match-ink); }
.cite { font: 400 12px/1.5 var(--mono); color: var(--muted); }
.keyline { padding: 10px 20px; background: var(--sunken); font-size: 12px;
           color: var(--muted); border-top: 1px solid var(--line); }

/* ------------------------------------------------ review workspaces */
.page-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto;
              align-items: end; gap: 24px; margin-bottom: 26px; }
.page-intro .subtitle { margin-bottom: 0; max-width: 72ch; line-height: 1.65; }
.metric { min-width: 150px; padding: 14px 16px; border-left: 2px solid var(--primary);
          background: var(--sunken); }
.metric strong { display: block; font: 600 26px/1.1 var(--font); }
.metric span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.card-head { padding: 18px 20px; border-bottom: 1px solid var(--line);
             display: flex; justify-content: space-between; align-items: flex-start;
             gap: 18px; }
.card-head h2 { margin: 0; font: 500 20px/1.45 var(--serif); }
.card-head .chips { margin-top: 9px; }
.card-actions { padding: 18px 20px; border-top: 1px solid var(--line); }
.action-status { min-height: 20px; margin-top: 10px; font-size: 13px;
                 color: var(--muted); }
.action-status.ok { color: var(--primary); }
.action-status.bad { color: var(--error); }

.pair-grid { display: grid; grid-template-columns: 1fr 1fr; }
.question-side { padding: 20px; min-width: 0; }
.question-side + .question-side { border-left: 1px solid var(--line); }
.question-side h3 { margin: 5px 0 8px; font: 500 20px/1.45 var(--serif); }
.question-side .english { color: var(--ink-muted); font-size: 13px;
                          line-height: 1.55; margin-bottom: 14px; }
.question-side .rulings { margin-top: 14px; }
.question-side .corpus-ruling { border-color: var(--line); }

fieldset.relationship { margin: 0; padding: 18px 20px; border: 0;
                        border-top: 1px solid var(--line); }
fieldset.relationship legend { padding: 18px 0 0; font: 600 12px/1 var(--font);
                                letter-spacing: .05em; text-transform: uppercase;
                                color: var(--muted); }
.choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
               margin: 12px 0 14px; }
.choice { display: block; border: 1px solid var(--line); border-radius: var(--r);
          padding: 11px; cursor: pointer; }
.choice:hover { border-color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--tint); }
.choice input { margin: 0 7px 0 0; accent-color: var(--primary); }
.choice b { font-size: 13px; }
.choice small { display: block; margin: 6px 0 0 21px; color: var(--muted);
                font-size: 11px; line-height: 1.45; }
.relationship textarea { min-height: 76px; font-size: 14px; }

.route-form { padding: 20px; }
.route-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.route-grid label, .frame-grid label { color: var(--muted); font-size: 12px; }
.route-grid select, .route-grid input, .frame-grid select, .frame-grid input,
.frame-grid textarea { width: 100%; color: var(--ink); }
.route-grid .wide, .frame-grid .wide { grid-column: 1 / -1; }
.frame-editor { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.frame-editor summary { cursor: pointer; color: var(--primary); font-size: 13px;
                        font-weight: 600; }
.frame-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
              margin-top: 14px; }
.frame-grid textarea { min-height: 74px; font-size: 14px; }

.coverage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
                 gap: 10px; margin-bottom: 24px; }
.coverage-item { border-top: 2px solid var(--line-strong); padding: 12px 2px 0; }
.coverage-item .coverage-name { font-size: 12px; color: var(--muted);
                                text-transform: capitalize; }
.coverage-item strong { display: block; font-size: 20px; margin: 5px 0 2px; }
.coverage-item .bar { margin-top: 8px; }
.evidence-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto;
                    gap: 18px; align-items: start; }
.evidence-summary .ar { margin-top: 12px; }
.evidence-search { margin-top: 16px; padding: 16px; background: var(--sunken);
                   border-top: 1px solid var(--line); }
.search-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto;
              gap: 9px; }
.evidence-results { margin-top: 14px; }
.evidence-option { display: grid; grid-template-columns: auto minmax(0, 1fr);
                   gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.evidence-option:first-child { border-top: 0; }
.evidence-option input { margin-top: 5px; accent-color: var(--primary); }
.evidence-option .ar { font-size: 18px; line-height: 1.8; margin: 7px 0; }
.evidence-option .cite { border: 0; margin: 6px 0 0; padding: 0; }
.rationale { margin-top: 14px; }
.rationale textarea { min-height: 84px; font-size: 14px; }

/* A candidate comparison keeps the three claims visually separate:
   sourced ruling, the quote inside it, and the independently stored
   scripture page. None gets the green accepted treatment before review. */
.candidate-compare { display: grid; grid-template-columns: 1fr 1fr;
                     border-bottom: 1px solid var(--line); }
.candidate-compare > section { padding: 20px; min-width: 0; }
.candidate-compare > section + section { border-left: 1px solid var(--line); }
.candidate-compare .verdict { margin: 0 0 10px; font: 400 18px/1.6 var(--serif); }
.candidate-compare .locked { margin: 12px 0; }
.quote-formula { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.candidate-quote { padding: 15px; background: var(--match);
                   border: 1px solid var(--match-line); border-radius: var(--r); }
.candidate-source { background: var(--sunken); }
.candidate-source .ar { padding: 12px 0; }
.candidate-warning { margin: 12px 0 0; padding-top: 10px;
                     border-top: 1px solid var(--line-strong);
                     color: var(--match-ink); font-size: 12px; line-height: 1.55; }
.translation-primary { margin: 10px 0 14px; padding: 14px 16px;
                       background: var(--card); border-left: 3px solid var(--primary);
                       border-radius: var(--r); }
.translation-primary .note { margin-top: 7px; color: var(--ink); font-size: 15px;
                             line-height: 1.7; }
.translation-secondary, .translation-notes { margin: 9px 0; }
.translation-secondary > summary, .translation-notes > summary {
  cursor: pointer; color: var(--primary); font-size: 12px; font-weight: 650;
}
.translation-secondary[open] { padding: 12px 14px; border: 1px solid var(--line);
                               border-radius: var(--r); background: var(--card); }
.translation-secondary[open] > summary { margin-bottom: 10px; }
.translation-notes .note { margin-top: 7px; font-size: 12px; }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.decision-grid textarea { min-height: 88px; font-size: 14px; }

.skeleton { height: 118px; border: 1px solid var(--line); border-radius: var(--r-lg);
            margin-bottom: 12px; background: linear-gradient(90deg,
            var(--sunken) 25%, var(--card) 50%, var(--sunken) 75%);
            background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .skeleton { animation: none; }
}

/* What the corpus already says, shown inside the match panel. On white
   rather than amber: the amber is the "there is a match" signal, and the
   rulings sitting on it would make the whole block one undifferentiated
   colour. */
.rulings { margin-top: 12px; }
.corpus-ruling { background: var(--card); border: 1px solid var(--match-line);
                 border-radius: var(--r); padding: 14px; margin-bottom: 8px; }
.corpus-ruling .verdict { margin: 10px 0; font: 400 17px/1.65 var(--serif);
                          color: var(--ink); }
.corpus-ruling .ar { margin: 10px 0; font-size: 19px; line-height: 1.9; }
.corpus-ruling .tr { font-size: 14px; line-height: 1.6; color: var(--ink-muted);
                     margin-bottom: 8px; }
.corpus-ruling .cite { margin-top: 8px; }

/* The teach block reads as prose, so its paragraph and its button must
   not share a line -- the button was flowing inline, mid-sentence. */
.teach p { margin: 0 0 4px; }
.teach .row { justify-content: flex-start; }

/* Closing a referral as corpus-answered is a heavier act than teaching a
   phrase -- it takes a person's question out of the queue -- so it does
   not read as another quiet inline link beside Undo. */
.close-corpus { border-color: var(--primary); color: var(--primary);
                font-weight: 600; }

/* A resolved card stays on screen rather than vanishing, so the ustaz
   can see what they just did and undo the phrase if they misjudged it.
   Dimmed, so it reads as finished. */
.card.done { opacity: .55; }

@media (max-width: 920px) {
  .pair-grid, .route-grid { grid-template-columns: 1fr; }
  .candidate-compare { grid-template-columns: 1fr; }
  .candidate-compare > section + section { border-left: 0; border-top: 1px solid var(--line); }
  .question-side + .question-side { border-left: 0; border-top: 1px solid var(--line); }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .frame-grid { grid-template-columns: 1fr 1fr; }
}

/* ===================================================================
   MOBILE
   Scholar decisions need full-width tap targets and the five workflows
   remain a horizontally scrollable map directly below the identity.
   =================================================================== */
@media (max-width: 760px) {

  main { padding: 24px 16px calc(52px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  .ask { font-size: 20px; }
  .page-intro { grid-template-columns: 1fr; gap: 14px; }
  .metric { min-width: 0; }

  /* Full-width tap targets. A 40px button beside another 40px button is
     a mis-tap on a phone, and one of these publishes to the corpus. */
  .card .row { flex-direction: column; align-items: stretch; }
  .card .row button { width: 100%; padding: 13px 16px; }
  .filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px;
             -webkit-overflow-scrolling: touch; }
  .filters .pill { flex: 0 0 auto; }
  .count { display: none; }

  .split { grid-template-columns: 1fr; }
  .promote .fields { grid-template-columns: 1fr; }
  .signin { max-width: none; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
  .choice-grid, .frame-grid { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .decision-grid { grid-template-columns: 1fr; }
  .search-row button { width: 100%; }
  .evidence-summary { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------ dashboard (3e) */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
a.card.dash-q { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; margin: 0;
                color: var(--ink); text-decoration: none; transition: border-color .15s; }
a.card.dash-q:hover { border-color: var(--primary); }
a.card.dash-q.empty-q { opacity: .62; }
.dash-n { font: 600 30px/1.1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.dash-t { font-weight: 650; font-size: 15px; }
.dash-w { font-size: 13px; color: var(--ink-muted); line-height: 1.5; flex: 1; }
.dash-o { font: 400 11px/1.4 var(--mono); color: var(--muted); letter-spacing: .02em; margin-top: 6px; }
.dash-h { font: 600 22px/1.2 var(--serif); margin: 34px 0 12px; }
.dash-corpus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dash-corpus .card { margin: 0; }
.band-pad { padding: 18px 20px; }
.dash-corpus .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.dash-corpus .bar > i { display: block; height: 100%; background: var(--primary); }
.dash-asof { font-size: 12px; margin-top: 14px; }
@media (max-width: 760px) { .dash-corpus { grid-template-columns: 1fr; } }

/* The same frame on every queue */
.queue-frame { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px;
               padding: 10px 14px; margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--r);
               background: var(--sunken); font-size: 13px; color: var(--ink-muted); }
.queue-frame b { color: var(--ink); }
.kbd { font: 400 11px/1 var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px;
       border-radius: 4px; padding: 1px 5px; color: var(--muted); background: var(--card); }
.card.kb-on { outline: 2px solid var(--focus); outline-offset: 2px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th, .dash-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table th { font: 600 11px/1 var(--font); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table .barcell { width: 30%; }
.dash-table .bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.dash-table .bar > i { display: block; height: 100%; background: var(--primary); }
.dash-table-wrap { overflow-x: auto; }
@media (max-width: 640px) {
  main { padding: 24px 16px 60px; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  a.card.dash-q { padding: 14px; }
  .dash-n { font-size: 24px; }
  .dash-w { display: none; }
  .dash-table .barcell, .dash-table .hide-sm { display: none; }
}

/* ------------------------------------------------------ Pro layout (2026-10) */
/* Wide screens: the places become a left sidebar, the work area takes the
   rest. Narrow screens keep the top bar with a scrolling row of places. */
.dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
a.card.dash-q { border-radius: 8px; }
.dash-n { font-family: var(--mono); font-weight: 600; font-size: 28px; }
.card { border-radius: 8px; }
/* Interface language: Indonesian / English / Arabic (2026-10-15) */
.lang-ctl { margin-inline-start: auto; align-self: center; font: inherit; font-size: 12px; padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent; color: inherit; }
:root[lang="ar"] { --body: "IBM Plex Sans Arabic", "Plus Jakarta Sans", -apple-system, "Segoe UI", system-ui, sans-serif; }
:root[lang="ar"] body { font-family: var(--body); }
:root[lang="ar"] .badge, :root[lang="ar"] .label, :root[lang="ar"] .chip { letter-spacing: 0; text-transform: none; }
[dir="rtl"] .who { text-align: left; }
[dir="rtl"] .dot, [dir="rtl"] .badge { margin-right: 0; margin-left: 6px; }
[dir="rtl"] .count { margin-left: 0; margin-right: auto; }
[dir="rtl"] .metric { border-left: 0; border-right: 2px solid var(--primary); }
[dir="rtl"] .question-side + .question-side, [dir="rtl"] .candidate-compare > section + section { border-left: 0; border-right: 1px solid var(--line); }
[dir="rtl"] .translation-primary { border-left: 0; border-right: 3px solid var(--primary); }
[dir="rtl"] .dash-table th, [dir="rtl"] .dash-table td { text-align: right; }
[dir="rtl"] .dash-table .num { text-align: left; }
@media (max-width: 760px) {
  [dir="rtl"] .question-side + .question-side, [dir="rtl"] .candidate-compare > section + section { border-right: 0; }
}

/* ------------------------------------------------ sign-in, account, admin */
.small { font-size: 13px; }
.field { display: block; margin: 0 0 12px; border: 0; padding: 0; }
.field input { width: 100%; }
fieldset.field legend { font-size: 14px; margin-bottom: 6px; padding: 0; }
.signin .field input { font-family: var(--font); }
.lg-legacy { margin: 14px 0 0; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 14px; }
.admin-tabs a.pill { text-decoration: none; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.admin-stats .card { margin: 0; }
.admin-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-two .card { margin: 0 0 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; }
.chart { position: relative; margin: 14px 0 6px; }
.chart svg { display: block; width: 100%; height: 160px; }
.chart svg rect { fill: var(--verdigris); }
.chart svg rect:hover { fill: var(--ink); }
.chart-max { position: absolute; top: -18px; left: 0; font-size: 12px; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.otp { border-color: var(--amber-line); background: var(--amber); }
.otp-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.otp code { font: 600 20px/1.3 var(--mono); letter-spacing: .04em; user-select: all; }
.admin-create summary { cursor: pointer; }
.admin-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; margin-top: 14px; }
.admin-form .wide { grid-column: 1 / -1; }
.admin-table td { vertical-align: top; }
.admin-table .acts { white-space: nowrap; text-align: right; }
.admin-table .acts button { padding: 7px 10px; font-size: 13px; margin: 0 0 4px 4px; }
.admin-table .acts .action-status { white-space: normal; }
.edit-row td { background: var(--sunken); }
@media (max-width: 760px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-two, .admin-form { grid-template-columns: 1fr; }
  .admin-table .acts { white-space: normal; }
}

/* ------------------------------------------------ new look (Nov 2026) */
.card { border-radius: 14px; }
a.card.dash-q { border-radius: 14px; }
.dash-n { font-family: var(--display); font-weight: 800; }
button { border-radius: 12px; font-weight: 700; }
.pill { border-radius: 10px; font-weight: 700; }
.subtitle { color: var(--ink2); font-size: 15.5px; line-height: 1.6; max-width: 780px; }
.queue-frame { border-radius: 12px; }
.onboard { background: var(--panel); border: 1px solid var(--hair); border-radius: 16px; padding: 18px 20px; margin: 0 0 22px; }
.onboard-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.onboard-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.onboard-bar { flex: 0 1 260px; height: 8px; border-radius: 999px; background: var(--paper3); overflow: hidden; }
.onboard-bar i { display: block; height: 8px; background: var(--verdigris); border-radius: 999px; }
.onboard-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.onboard-step { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 12px; border: 1px solid var(--hair); text-decoration: none; color: var(--ink); }
.onboard-step:hover { border-color: var(--verdigris); }
.onboard-step.done { background: var(--verdigris-2); border-color: transparent; }
.onboard-step b { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.onboard-step .mk { width: 22px; height: 22px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--paper3); color: var(--ink2); }
.onboard-step.done .mk { background: var(--verdigris); color: var(--on-accent); }
.onboard-step span { font-size: 13px; line-height: 1.5; color: var(--muted); }
@media (max-width: 900px) { .onboard-steps { grid-template-columns: 1fr 1fr; } }
.guide-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .guide-list { grid-template-columns: 1fr; } }
.guide-item { background: var(--panel); border: 1px solid var(--hair); border-radius: 14px; padding: 16px 18px; }
.guide-item h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 800; }
.guide-item p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink2); }
.guide-item a { font-weight: 700; font-size: 13.5px; }
.decide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
@media (max-width: 760px) { .decide { grid-template-columns: 1fr; } }
.decide div { border-radius: 14px; padding: 16px; background: var(--paper3); }
.decide b { display: block; margin-bottom: 4px; }
.decide p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink2); }
[hidden] { display: none !important; }
.side .side-search input, .side .side-search input:focus { all: unset; flex: 1; min-width: 0; font-size: 14px; color: #FFFFFF; background: transparent; border: 0; box-shadow: none; }
.lg-legacy a { color: var(--verdigris); font-weight: 700; }
/* Signed out: no sidebar, the sign-in card centred. */
body.auth .side, body.auth .menubtn, body.auth .side-scrim { display: none !important; }
body.auth main { max-width: 520px; margin: 0 auto; padding-top: 56px; }
body.auth .signin { max-width: none; padding: 28px; }
body.auth h1 { text-align: center; }
main a { color: var(--verdigris); }
.guide-item a { text-decoration: none; }

/* Brand mark (Nov 2026) */
.wordmark { font-weight: 800; letter-spacing: .02em; font-style: normal; }
.wordmark i { font-style: normal; color: #D4AA4F; }
.side-brand .wordmark { font-size: 1.25rem; color: #FFFFFF; }
.side-logo { width: 46px; height: 46px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.auth-brand img { width: 72px; height: 72px; }
.auth-brand .wordmark { font-size: 1.6rem; color: var(--verdigris); }
.auth-brand .wordmark i { color: #B8892E; }
.auth-brand small { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.side-logo { width: 46px; height: 46px; }
.side-brand small { letter-spacing: .08em; }
