/* Research OS: design tokens, light and dark, LTR and RTL */
:root {
  --bg: #f4f6fb; --bg2: #eef1f8; --surface: #ffffff; --surface2: #f8f9fd; --ink: #1b2336; --ink2: #3b4560; --muted: #6b7489; --line: #e3e7f0;
  --primary: #5b4bdb; --primary-ink: #ffffff; --primary-soft: #ecebff; --accent: #0ea5a4; --accent-soft: #dcf5f4;
  --ok: #16a34a; --ok-soft: #dcfce7; --run: #2563eb; --run-soft: #dbeafe; --warn: #d97706; --warn-soft: #fef3c7; --warn-ink: #b45309; --bad: #e11d48; --bad-soft: #ffe4e6;
  --stale: #7c3aed; --stale-soft: #ede9fe; --ok-ink: #15803d; --run-ink: #1d4ed8; --bad-ink: #be123c; --stale-ink: #6d28d9; --idle: #94a3b8; --idle-soft: #f1f5f9;
  --shadow: 0 1px 2px rgba(20, 28, 50, .06), 0 4px 16px rgba(20, 28, 50, .06); --shadow-lg: 0 10px 40px rgba(20, 28, 50, .16);
  --r: 14px; --r-sm: 9px; --side: 250px;
  --font: "Inter", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", Consolas, monospace;
  --paper: "Times New Roman", "Tinos", "Liberation Serif", serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0f1320; --bg2: #141a2b; --surface: #171e31; --surface2: #1c2439; --ink: #e8ecf6; --ink2: #c3cbe0; --muted: #8e98b3; --line: #29324b;
  --primary: #8b7cff; --primary-soft: #2a2552; --accent: #2dd4bf; --accent-soft: #123a38; --ok-soft: #0f3321; --run-soft: #13254d; --warn-soft: #3a2a0c; --warn-ink: #fbbf24; --ok-ink: #4ade80; --run-ink: #60a5fa; --bad-ink: #fb7185; --stale-ink: #a78bfa; --bad-soft: #3d1320; --stale-soft: #2a1d4a; --idle-soft: #1e2638;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); } }
:root[data-theme="dark"] { --bg: #0f1320; --bg2: #141a2b; --surface: #171e31; --surface2: #1c2439; --ink: #e8ecf6; --ink2: #c3cbe0; --muted: #8e98b3; --line: #29324b;
  --primary: #8b7cff; --primary-soft: #2a2552; --accent: #2dd4bf; --accent-soft: #123a38; --ok-soft: #0f3321; --run-soft: #13254d; --warn-soft: #3a2a0c; --warn-ink: #fbbf24; --ok-ink: #4ade80; --run-ink: #60a5fa; --bad-ink: #fb7185; --stale-ink: #a78bfa; --bad-soft: #3d1320; --stale-soft: #2a1d4a; --idle-soft: #1e2638;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); }
[dir="rtl"] { --font: "Vazirmatn", "Inter", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.hide { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: conic-gradient(from 200deg, #5b4bdb, #0ea5a4, #f59e0b, #5b4bdb); display: grid; place-items: center; color: #fff; font-weight: 800; box-shadow: 0 4px 14px rgba(91,75,219,.35); }
.brand b { font-size: 15.5px; }
.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
[dir="rtl"] .nav-group { letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0; border-radius: 10px; color: var(--ink2); font-weight: 520; }
.nav a:hover { background: var(--bg2); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav a .ico { width: 20px; text-align: center; opacity: .9; }
.nav a .count { margin-inline-start: auto; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.nav .sub a { padding-inline-start: 38px; font-size: 13.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; gap: 12px; align-items: center; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
[dir="rtl"] .search input { padding: 9px 36px 9px 14px; }
.search .s-ico { position: absolute; inset-inline-start: 13px; top: 9px; color: var(--muted); }
.search .results { position: absolute; top: 44px; inset-inline: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; }
.search .results a { display: block; padding: 9px 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.search .results a:hover { background: var(--bg2); }
.content { padding: 22px 26px 60px; max-width: 1500px; width: 100%; }
.page-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.purpose { color: var(--muted); margin-top: 4px; max-width: 860px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; transition: transform .06s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled], .btn.busy { opacity: .65; cursor: progress; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
.btn-err { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; }
.icon-btn .dot { position: absolute; top: -4px; inset-inline-end: -4px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 10.5px; padding: 0 5px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-weight: 600; font-size: 13.5px; }
.field .req { color: var(--bad); margin-inline-start: 3px; }
.field .hint { color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { border: 1px solid var(--line); background: var(--surface); padding: 9px 12px; border-radius: 10px; width: 100%; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--idle); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 18px; height: 18px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span:before { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + span:before { transform: translateX(-18px); }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; }
.card h2 + .muted { margin-top: 2px; }
.card-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--idle-soft); color: var(--ink2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); } .pill.run { background: var(--run-soft); color: var(--run-ink); } .pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); } .pill.stale { background: var(--stale-soft); color: var(--stale-ink); } .pill.pri { background: var(--primary-soft); color: var(--primary); }
.sev-FATAL { background: var(--bad); color: #fff; } .sev-MAJOR { background: var(--bad-soft); color: var(--bad-ink); } .sev-MINOR { background: var(--warn-soft); color: var(--warn-ink); } .sev-NOTE { background: var(--idle-soft); color: var(--muted); }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 22px; }
.bar { height: 8px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
.stepper { display: flex; gap: 0; align-items: center; flex-wrap: wrap; }
.stepper .st { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stepper .st i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; background: var(--bg2); color: var(--muted); }
.stepper .st.done i { background: var(--ok); color: #fff; } .stepper .st.now i { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); } .stepper .st.now { color: var(--ink); font-weight: 650; }
.stepper .sep { width: 26px; height: 2px; background: var(--line); margin: 0 6px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 120px; height: 90px; margin-bottom: 8px; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--bg2), var(--surface2), var(--bg2)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; height: 14px; margin: 8px 0; }
@keyframes sh { to { background-position: -200% 0; } }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 18px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a .n { background: var(--bg2); border-radius: 99px; padding: 0 6px; font-size: 11px; margin-inline-start: 4px; }

/* tooltip */
.tip { position: fixed; z-index: 1000; max-width: 320px; background: #1b2336; color: #f4f6fb; padding: 8px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.45; pointer-events: none; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .12s; }
.tip.on { opacity: 1; }

/* toast */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--primary); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 11px 14px; max-width: 380px; animation: up .2s ease; }
.toast.bad { border-inline-start-color: var(--bad); } .toast.ok { border-inline-start-color: var(--ok); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 20, 35, .28); z-index: 60; animation: fade .15s; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(560px, 96vw); background: var(--surface); z-index: 61; box-shadow: var(--shadow-lg); overflow-y: auto; padding: 22px; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } }
[dir="rtl"] .drawer { animation-name: slider; } @keyframes slider { from { transform: translateX(-30px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer .sec { margin-top: 18px; }
.drawer .sec h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
[dir="rtl"] .drawer .sec h3 { letter-spacing: 0; }
details.tech summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-top: 18px; }
pre.code { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow: auto; font-family: var(--mono); font-size: 12px; max-height: 420px; direction: ltr; text-align: left; }

/* graphs */
.graph-wrap { position: relative; background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px, var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.graph-wrap svg { display: block; }
.graph-wrap { direction: ltr; }
.gnode text { unicode-bidi: plaintext; }
.gnode { cursor: pointer; }
.gnode rect.box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; rx: 12; transition: stroke .2s; filter: drop-shadow(0 2px 4px rgba(20,28,50,.08)); }
.gnode:hover rect.box { stroke: var(--primary); }
.gnode text { fill: var(--ink); font-size: 12.5px; font-family: var(--font); }
.gnode text.sub { fill: var(--muted); font-size: 11px; }
.gnode.s-done rect.box { stroke: var(--ok); } .gnode.s-running rect.box, .gnode.s-queued rect.box { stroke: var(--run); stroke-width: 2.5; }
.gnode.s-repairing rect.box { stroke: var(--warn); stroke-width: 2.5; } .gnode.s-needs_you rect.box { stroke: var(--bad); stroke-width: 2.5; }
.gnode.s-stale rect.box { stroke: var(--stale); stroke-dasharray: 5 3; } .gnode.s-blocked rect.box { stroke: var(--idle); stroke-dasharray: 3 3; } .gnode.s-skipped { opacity: .55; }
.gnode.s-running rect.box, .gnode.s-repairing rect.box { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { stroke-opacity: .35; } }
.gnode .badge { font-size: 11px; font-weight: 700; }
.gedge { fill: none; stroke: #b8c0d4; stroke-width: 1.6; }
.gedge.k-evidence { stroke: #0ea5a4; } .gedge.k-decision { stroke: #d97706; } .gedge.k-feedback { stroke: #e11d48; stroke-dasharray: 5 4; } .gedge.k-data { stroke: #2563eb; } .gedge.k-artifact { stroke: #7c3aed; } .gedge.k-branch { stroke: #16a34a; stroke-dasharray: 2 4; }
.gedge.shared { stroke-dasharray: 6 5; stroke: var(--primary); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 2px solid; }

/* paper tables */
.paper { font-family: var(--paper); color: var(--ink); background: var(--surface); padding: 6px 2px; overflow-x: auto; direction: ltr; }
.paper .cap { text-align: center; font-size: 15px; margin: 4px 0 10px; }
.paper table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.paper th, .paper td { padding: 1px 5px; text-align: center; white-space: nowrap; }
.paper thead tr:first-child th { border-top: 1.6px solid var(--ink); padding-top: 5px; }
.paper thead tr:last-child th { border-bottom: 1px solid var(--ink); padding-bottom: 5px; font-weight: 500; }
.paper tbody tr.panel td { text-align: left; font-style: italic; padding-top: 8px; }
.paper tbody tr.se td { color: var(--ink2); padding-bottom: 3px; }
.paper tbody tr:last-child td { border-bottom: 1.6px solid var(--ink); }
.paper td.lab { text-align: left; font-weight: 600; }
.paper td.diff { color: var(--bad); }
.paper td.na { }
.paper td.same { color: var(--ok); }
.paper td.changed { background: rgba(245, 158, 11, .2); }
.paper tr.hdr th { font-weight: 500; padding: 2px 5px; }
.paper tbody tr.hdr th { border-bottom: 1px solid var(--line); }
.paper th.lab { text-align: left; }
.paper td.close { color: var(--warn, #b45309); }
.paper td.missing .nb { font-size: 10px; color: var(--muted, #6b7280); font-style: italic; font-family: var(--font); }
.paper tbody tr td.diff { color: var(--bad); } .paper tbody tr td.close { color: var(--warn, #b45309); } .paper tbody tr td.same { color: var(--ok); }
.paper td .pv { font-size: 10px; line-height: 1.1; color: var(--muted, #6b7280); }
.paper tbody tr.stat td { padding-top: 1px; }
.paper .notes { font-size: 11.5px; margin-top: 6px; text-align: left; color: var(--ink2); }
.paper sup { font-size: 9px; }
.paper.plain table { font-family: var(--font); }
.orig-box { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 8px; opacity: .92; }
.orig-head { font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: 4px; }
.check-line { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; }

/* verdict */
.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; }
.verdict.worked { background: var(--ok-soft); } .verdict.partial { background: var(--warn-soft); } .verdict.failed { background: var(--bad-soft); }
.verdict .big { font-size: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv > div:nth-child(odd) { color: var(--muted); font-weight: 600; }
ul.clean { margin: 0; padding-inline-start: 18px; }
ul.clean li { margin: 4px 0; }
.timeline { position: relative; }
.timeline .ev { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.timeline .ev .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--bg2); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: start; font-size: 12px; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.list td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:hover td { background: var(--surface2); }
.figure img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.figure figcaption { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.gap-table td.done-no { color: var(--bad); font-weight: 700; } .gap-table td.done-partly { color: var(--warn); font-weight: 700; } .gap-table td.done-yes { color: var(--ok); font-weight: 700; }
.radar { display: flex; gap: 8px; }
.radar span { padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.radar .s { background: var(--ok-soft); color: var(--ok-ink); } .radar .m { background: var(--warn-soft); color: var(--warn-ink); } .radar .c { background: var(--bad-soft); color: var(--bad-ink); }
.hero { background: linear-gradient(120deg, var(--primary-soft), var(--accent-soft)); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; position: relative; overflow: hidden; }
.hero:after { content: ""; position: absolute; width: 220px; height: 220px; inset-inline-end: -60px; top: -80px; background: radial-gradient(circle, rgba(255,255,255,.55), transparent 70%); }
.proj-card { cursor: pointer; transition: transform .12s, box-shadow .15s; }
.proj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--idle); }
.live-dot.done { background: var(--ok); } .live-dot.running { background: var(--run); animation: pulse2 1.2s infinite; } .live-dot.needs_you { background: var(--bad); } .live-dot.waiting { background: var(--idle); } .live-dot.idle { background: var(--idle); }
@keyframes pulse2 { 50% { opacity: .35; } }
.code-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1000px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .code-split { grid-template-columns: 1fr; } .content { padding: 16px; } }
.gedge.k-soft { stroke: #0ea5a4; stroke-dasharray: 3 4; }
.row.wrap { flex-wrap: wrap; }
.kv { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 16px; }
.kv-null { background: #fde2e1; color: #b42318; }
.kv-special { background: #fbe8ff; color: #86198f; }
.kv-empty { background: #e0f2fe; color: #075985; }
.kv-blank { background: #fef3c7; color: #92400e; letter-spacing: 1px; }
.kv-num { color: #1d4ed8; }
.kv-date { color: #047857; }
.kv-text { color: inherit; }
.kv-word { background: #fff7ed; outline: 1px dashed #f59e0b; padding: 0 3px; }
.kv-tag { font-size: 9px; color: #b45309; margin-inline-start: 2px; }

/* request in progress: a moving bar across the top and a small label, shown only for what the person asked for */
.topbusy { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .15s; }
.topbusy.on { opacity: 1; }
.topbusy-run { height: 3px; width: 35%; background: var(--pri, #5b4bdb); border-radius: 2px; animation: topbusy 1.1s ease-in-out infinite; }
@keyframes topbusy { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
[dir="rtl"] .topbusy-run { animation-name: topbusyr; } @keyframes topbusyr { 0% { transform: translateX(100%); } 100% { transform: translateX(-300%); } }
.topbusy-label { position: fixed; top: 8px; inset-inline-end: 12px; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--card, #fff); color: var(--muted, #666); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.topbusy-label::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-inline-end: 6px; vertical-align: -1px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .8s linear infinite; }
html.waiting, html.waiting * { cursor: progress !important; }

.gedge-hit { fill: none; stroke: transparent; stroke-width: 12px; pointer-events: stroke; }

/* raw program output folded under technical details (UI.rich) */
.rich details.tech { margin-top: 6px; }
.rich details.tech pre { white-space: pre-wrap; direction: ltr; text-align: left; max-height: 320px; overflow: auto; background: var(--soft, rgba(0,0,0,.04)); padding: 8px; border-radius: 8px; }
sub, sup { font-size: 75%; line-height: 0; }

/* assistant panel */
.assist { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(440px, 100vw); background: var(--card, #fff); border-inline-start: 1px solid var(--line, #ddd);
  box-shadow: -8px 0 24px rgba(0,0,0,.08); padding: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.assist-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.assist-q { align-self: flex-end; background: var(--soft, rgba(80,120,255,.08)); border-radius: 12px; padding: 8px 10px; max-width: 90%; white-space: pre-wrap; }
.assist-a { align-self: flex-start; border: 1px solid var(--line, #ddd); border-radius: 12px; padding: 8px 10px; max-width: 95%; }
.md p { margin: 4px 0; } .md h2, .md h3, .md h4 { margin: 10px 0 4px; }
.icon-btn.ai-btn { width: auto; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 600; }
.ctx-head { gap: 8px; margin-bottom: 4px; }
.ctx-codes { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 8px; padding: 6px 8px; border-radius: 8px; background: var(--soft, rgba(80,120,255,.06)); }
.ctx-code b { font-family: var(--mono, monospace); }
.paper-note { border-inline-start: 3px solid var(--pri, #4a6cf7); background: var(--soft, rgba(80,120,255,.05)); padding: 8px 12px; border-radius: 6px; margin: 0 0 12px; direction: ltr; text-align: left; }
.paper-note.ours { border-color: var(--warn, #c98a00); }
.paper-note p { margin: 4px 0 0; line-height: 1.5; }

/* data check */
.list tr.bad td { color: var(--bad); }
.list tr.on-row td { background: var(--surface2); box-shadow: inset 3px 0 0 var(--pri, #5b4bdb); }
.bad-list li { color: var(--bad); }
.ok-line { color: var(--ok); font-size: 13px; }

/* feedback ✎ on every part of the app */
.fb-btn { position: absolute; top: 2px; inset-inline-end: 2px; z-index: 5; width: 18px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink2); font-size: 10px; line-height: 16px; cursor: pointer; opacity: 0; transition: opacity .15s; }
/* hidden until the pointer is over its part, so it never gets in the way */
:hover > .fb-btn, .fb-btn:focus { opacity: .85; }
.fb-bg { display: flex; align-items: center; justify-content: center; z-index: 60; }
.fb-box { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 16px; width: min(560px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.fb-where { font-size: 12.5px; color: var(--ink2); margin: 6px 0 10px; line-height: 1.6; }

/* Results: version switch and the two groups of a version (printed tables and figures, results behind them) */
.ver-bar { padding: 8px 12px; border: 1px solid var(--line, #ddd); border-radius: 8px; gap: 8px; }
.sec-head { margin: 10px 0 0; font-size: 1.05rem; }

/* the journal loop under the project's stages */
.pub-line { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line, #ddd); color: inherit; text-decoration: none; }

/* a stage opens its tab */
.stepper a.st.link { text-decoration: none; cursor: pointer; border-radius: 12px; padding: 2px 6px 2px 2px; }
.stepper a.st.link:hover { background: var(--bg2); color: var(--ink); }

/* the menu in folding groups */
.nav-block { margin-top: 4px; }
/* group headers (Milad, 30 Sep 2026: "the tree button is not visible at all; make it stand out, another color, bigger") */
.nav-fold { display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer; text-align: start; font: inherit; font-size: 13px; font-weight: 700;
  letter-spacing: .03em; color: var(--primary); background: var(--primary-soft); border: 1px solid transparent; border-radius: var(--r-sm); padding: 7px 10px; margin: 10px 0 4px; }
.nav-fold:hover { border-color: var(--primary); }
.nav-fold:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-fold .fold-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--primary); color: var(--primary-ink, #fff);
  font-size: 12px; line-height: 1; transition: transform .15s; flex: 0 0 auto; }
.nav-fold.open .fold-ico { transform: rotate(90deg); }
[dir="rtl"] .nav-fold:not(.open) .fold-ico { transform: rotate(180deg); }
.nav-fold .count { margin-inline-start: auto; }
.nav-sub { padding-inline-start: 10px; margin-inline-start: 10px; border-inline-start: 2px solid var(--primary-soft); }
.nav-sub.hide { display: none; }

/* projects in the menu: a gear beside each name, pinned on top, archived ones dimmed */
.proj-row { display: flex; align-items: center; gap: 2px; }
.proj-row .proj-link { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.proj-row .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-link.archived { opacity: .6; font-style: italic; }
.proj-gear { background: none; border: 0; cursor: pointer; font-size: 15px; color: var(--muted); padding: 4px 6px; border-radius: 6px; opacity: .55; }
.proj-row:hover .proj-gear, .proj-gear:focus-visible { opacity: 1; }
.proj-gear:hover { background: var(--surface2); color: var(--ink); }
.proj-arch { display: flex; align-items: center; gap: 6px; padding: 6px 10px; cursor: pointer; }
.pop-menu { position: fixed; z-index: 60; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 6px; }
.pop-title { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-item { display: flex; gap: 8px; align-items: center; width: 100%; background: none; border: 0; text-align: start; font: inherit; padding: 7px 8px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.pop-item:hover:not([disabled]) { background: var(--surface2); }
.pop-item.danger { color: var(--bad); }
.pop-item[disabled] { opacity: .45; cursor: not-allowed; }

/* the server is restarting: a banner instead of empty pages (R46) */
.restart-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 80; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--warn);
  padding: 10px 16px; text-align: center; font-weight: 600; box-shadow: var(--shadow); }

/* code library tree (M14.6 to M14.9) */
.cl-proj { border-bottom: 1px solid var(--line, #e5e5e5); padding: 6px 0; }
.cl-proj:last-child { border-bottom: 0; }
.cl-proj > summary { cursor: pointer; font-size: 15px; }
.cl-search { min-width: 360px; flex: 1; }
.cl-dir { margin-inline-start: 14px; }
.cl-dir > summary { cursor: pointer; padding: 3px 0; }
.cl-dir.kind > summary { font-weight: 650; }
.cl-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin-inline-start: 14px; border-bottom: 1px solid var(--line, #e5e5e5); flex-wrap: wrap; }
.cl-row:hover { background: var(--idle-soft); }
.cl-row.gone .cl-name { text-decoration: line-through; opacity: .7; }
.cl-name { overflow-wrap: anywhere; min-width: 0; }
.cl-user, .cl-date { white-space: nowrap; }
.cl-row .btn.icon, .cl-row button.icon { padding: 1px 6px; min-width: 0; }
.cl-hits { max-height: 420px; overflow-y: auto; margin: 6px 0; }
.cl-pk { margin: 6px 14px; line-height: 1.7; overflow-wrap: anywhere; }
.brief .pb-sec { margin-top: 10px; } .brief .pb-sec h3 { margin: 0 0 6px; font-size: 14px; } .brief tr.stale td { opacity: .75; }

.nav-new-top { display: block; text-align: center; margin: 4px 8px 10px; }
.nav .nav-new { font-weight: 600; }

/* sign-in: the icon under the logo, and the screen that is all there is while signed out (2 Oct 2026) */
.brand-wrap { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.brand-wrap .brand { padding-bottom: 4px; }
.auth-box { display: flex; align-items: center; gap: 10px; padding: 0 8px; min-width: 0; }
.auth-ico { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--primary); font-size: 17px; cursor: pointer; display: grid; place-items: center; }
.auth-ico:hover { background: var(--primary-soft); }
.auth-ico svg, .auth-out svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-out { width: 24px; height: 24px; flex: none; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.auth-out svg { width: 15px; height: 15px; }
.auth-out:hover { color: var(--bad); background: var(--bad-soft); }
.auth-state { min-width: 0; line-height: 1.25; }
.auth-box.in .auth-state b { color: var(--ok); }
.auth-box.out .auth-state b { color: var(--muted); }
.auth-state .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.signin-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 16px; box-sizing: border-box; }
.signin-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 10px 30px rgba(20,30,60,.10); }
.signin-panel { gap: 10px; margin-top: 8px; }
.signin-panel input { width: 100%; box-sizing: border-box; }
.signin-panel input[type=checkbox] { width: auto; flex: 0 0 auto; margin: 0; }
.signin-panel .remember { display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; user-select: none; }
.signin-panel .btn { width: 100%; justify-content: center; }
.auth-msg { color: var(--bad); min-height: 1em; }
.auth-or { text-align: center; }
.btn.google[disabled] { opacity: .55; cursor: not-allowed; }
.signin-foot { margin-top: 10px; }

/* a key or PIN field: masked like a password but not one, so the browser never autofills a saved user name into the page */
.secret-field { -webkit-text-security: disc; text-security: disc; }
.content.is-loading, .is-loading > * { opacity: .55; transition: opacity .15s; }

/* the server's browser on the Sign-ins page (6 Oct 2026): its own cursor, click rings, a text cursor, a frame and a label */
.rb-view { position: relative; outline: none; border-radius: 8px; box-shadow: 0 0 0 2px var(--line, #d0d4dc); transition: box-shadow .15s; }
.rb-view.on { box-shadow: 0 0 0 3px #5b4bdb, 0 0 18px rgba(91, 75, 219, .35); }
.rb-img { width: 100%; height: auto; display: block; background: #fff; border-radius: 8px;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M3 2 L3 21 L8 16 L11.5 24 L14.5 22.7 L11 15 L18 15 Z' fill='%235b4bdb' stroke='white' stroke-width='1.6' stroke-linejoin='round'/%3E%3Ccircle cx='22' cy='22' r='4.5' fill='%23ffb020' stroke='white' stroke-width='1.4'/%3E%3C/svg%3E") 3 2, crosshair; }
.rb-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: 8px; }
.rb-ripple { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid #ffb020;
  background: rgba(255, 176, 32, .25); animation: rb-ring .6s ease-out forwards; }
.rb-ripple.double { border-color: #5b4bdb; background: rgba(91, 75, 219, .2); }
@keyframes rb-ring { from { transform: scale(.25); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.rb-caret { position: absolute; width: 2px; height: 22px; margin-top: -11px; background: #5b4bdb; pointer-events: none; animation: rb-caret-out .7s ease-out forwards; }
@keyframes rb-caret-out { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rb-blink { 50% { opacity: 0; } }
.rb-wrap { display: flex; flex-direction: column; gap: 8px; }
.rb-badge { align-self: flex-end; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: rgba(30, 30, 40, .72); color: #fff; }
.rb-badge.on { background: #5b4bdb; }
