/* ==========================================================================
   Asaqefah · Tenders — estate design tokens
   Blue acts, navy speaks, amber points. Light is the default; dark is an explicit choice.
   ========================================================================== */
:root {
  --navy: #0D3156;
  --navy-deep: #0A2647;
  --navy-night: #071B33;
  --orange: #FF9E18;
  --orange-soft: #FFF4E2;
  --orange-text: #945700;      /* amber that passes contrast on white and on its soft tint */
  --act: #1E6FD9;              /* product accent: carries white at 4.85:1 */
  --act-hover: #185DB8;
  --act-soft: #EBF3FE;
  --act-ring: rgba(30, 111, 217, .18);
  --heading: #0D3156;
  --paper: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #C9D3DF;
  --line-strong: #98A7BA;
  --chart-grid: #E8EDF3;
  --ink: #1E293B;
  --muted: #64748B;
  --link: #185DB8;
  --good: #0F7A4F;
  --good-soft: #E6F6EE;
  --bad: #C2361A;
  --bad-soft: #FDECE7;
  --info-soft: #EEF3F9;
  --grey: #94A3B8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(10, 38, 71, .06);
  --shadow: 0 2px 12px rgba(10, 38, 71, .06);
  --shadow-lg: 0 8px 30px rgba(10, 38, 71, .12);
  --font: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: var(--font);
  --code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 256px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --heading: #F1F5F9;
  --paper: #071B33;
  --surface: #0C2542;
  --surface-2: #10304F;
  --line: #2F5379;
  --line-strong: #4A7099;
  --chart-grid: #17324F;
  --ink: #E2E8F0;
  --muted: #9DB0C6;
  --link: #8FBEF7;
  --act: #3F86E8;
  --act-hover: #5C9AEE;
  --act-soft: rgba(63, 134, 232, .16);
  --act-ring: rgba(92, 154, 238, .28);
  --orange-soft: rgba(255, 158, 24, .14);
  --orange-text: #FFB84D;
  --good: #4AD39A;
  --good-soft: rgba(74, 211, 154, .13);
  --bad: #FF9276;
  --bad-soft: rgba(255, 146, 118, .13);
  --info-soft: rgba(143, 190, 247, .1);
  --grey: #7088A3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.7;
  color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.4; font-weight: 700; color: var(--heading); }
p { margin: 0 0 .75rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; border-radius: 6px; }
pre, code, .prompt-box, .run-log { font-family: var(--code); }
.mono { font-family: var(--font); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; }
[hidden] { display: none !important; }
/* the page and the sidebar still scroll, without a visible scrollbar */
html, body, .side-scroll, .sticky, .qual-aside { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, .side-scroll::-webkit-scrollbar, .sticky::-webkit-scrollbar, .qual-aside::-webkit-scrollbar { display: none; }

/* ---------- shell: light sidebar + content ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); }
.side-in { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; color: var(--heading); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 42px; width: auto; }
.brand .logo-on-dark { display: none; }
:root[data-theme="dark"] .brand .logo-on-light { display: none; }
:root[data-theme="dark"] .brand .logo-on-dark { display: block; }
.lockup-rule { flex: none; width: 1.5px; height: 32px; background: linear-gradient(to bottom, transparent, var(--act) 22%, var(--act) 78%, transparent); }
.lockup-word { direction: ltr; color: var(--act); font-size: 12px; font-weight: 700; letter-spacing: .28em; margin-inline-end: -.28em; }
.side-menu { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 16px; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-inline: -4px; padding-inline: 4px; }
.nav-group { margin: 16px 10px 4px; font-size: .74rem; font-weight: 600; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 1px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--ink); font-weight: 500; font-size: .92rem; transition: background-color .15s;
}
.nav a i { font-size: 1.02rem; color: var(--muted); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--act-soft); color: var(--act-hover); font-weight: 600; }
.nav a[aria-current="page"] i { color: var(--act); }
.menu-toggle { display: none; }
.sector-switch { display: grid; gap: 4px; margin: 0; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.sector-switch label { color: var(--muted); font-size: .76rem; font-weight: 600; }
.sector-switch .select { min-height: 36px; padding-block: 4px; font-size: .86rem; }
.sector-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; font-weight: 600; }
.sector-chip i { color: var(--muted); }
.nav-badge { margin-inline-start: auto; min-width: 20px; text-align: center; background: var(--orange); color: var(--navy-night); border-radius: 999px; padding: 0 6px; font-size: .72rem; font-weight: 700; line-height: 20px; }
.side-foot { display: flex; align-items: center; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: var(--ink); }
.me:hover, .me[aria-current="page"] { background: var(--surface-2); text-decoration: none; }
.me > span:last-child { min-width: 0; }
.me b { display: block; font-size: .85rem; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { display: block; color: var(--muted); font-size: .74rem; line-height: 1.3; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 600; font-size: .9rem; }
:root[data-theme="dark"] .avatar { background: var(--act); }
.side-icon { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.side-icon:hover { background: var(--surface-2); color: var(--ink); }
.side-foot form { display: contents; }
.app-version { margin-top: 6px; text-align: center; font-size: .68rem; color: var(--grey); }

.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 64px; }
.main > * { max-width: 1320px; margin-inline: auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.eyebrow { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.page-title { font-size: 1.5rem; font-weight: 700; line-height: 1.4; color: var(--heading); margin: 0; }
.page-title a { color: inherit; }
.page-lede { color: var(--muted); max-width: 70ch; margin: 4px 0 0; font-size: .92rem; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-body { padding: 18px 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: .98rem; font-weight: 600; }
.section { margin-top: 28px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title { font-size: 1.05rem; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; min-height: 40px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: .9rem; cursor: pointer;
  background: var(--surface); color: var(--ink); text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .18s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--act); color: #fff; box-shadow: 0 1px 2px rgba(30, 111, 217, .3); }
.btn-primary:hover { background: var(--act-hover); }
.btn-accent { background: var(--orange-soft); color: var(--orange-text); border-color: rgba(255, 158, 24, .35); }
.btn-accent:hover { background: var(--orange-soft); border-color: var(--orange); }
.btn-ghost { border-color: var(--line-strong); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-sm { min-height: 32px; padding: 4px 11px; font-size: .82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--grey); cursor: pointer; font-size: 1.05rem;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.is-on { color: var(--orange); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.label { font-size: .8rem; font-weight: 500; color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: .92rem; transition: border-color .15s, box-shadow .15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input::placeholder, .textarea::placeholder { color: var(--grey); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.select { appearance: none; -webkit-appearance: none; padding-inline-end: 12px; padding-inline-start: 34px; text-overflow: ellipsis;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' fill='none' stroke='%2364748B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat left 11px center / 13px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--act); box-shadow: 0 0 0 3px var(--act-ring); }
.input-lg { min-height: 46px; font-size: .98rem; padding-inline-start: 42px; }
.search { position: relative; display: block; flex: 1; min-width: min(100%, 260px); }
.search i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; }
.check input { width: 17px; height: 17px; accent-color: var(--act); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; padding: 3px; border-radius: var(--radius-sm); background: var(--info-soft); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span, .segmented .seg-link { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 8px; font-size: .84rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.segmented input:checked + span, .segmented .seg-link.is-on { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--act); }
.segmented .seg-link:hover { text-decoration: none; color: var(--ink); }

/* ---------- filter bar ---------- */
.filters .panel-body { padding: 14px 16px; }
.filters-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters-toggle { display: none; }
.filters-body { margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: .82rem; font-weight: 500; color: var(--muted); transition: all .15s; }
.chip-check:hover span { border-color: var(--muted); color: var(--ink); }
.chip-check input:checked + span { background: var(--act-soft); border-color: var(--act); color: var(--act-hover); font-weight: 600; }
.chip-check input:focus-visible + span { outline: 2px solid var(--act); outline-offset: 2px; }
.filters-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* ---------- fit score: a tinted pill in lists, a ring where it is the headline ---------- */
.score { --c: var(--grey); --p: 0; display: inline-grid; place-items: center; flex: none; min-width: 42px; height: 30px; padding: 0 8px; border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.score b { font-size: .92rem; font-weight: 700; font-variant-numeric: tabular-nums; color: inherit; }
.score-success { --c: var(--good); background: var(--good-soft); color: var(--good); }
.score-warning { --c: var(--orange); background: var(--orange-soft); color: var(--orange-text); }
.score-secondary { --c: var(--grey); background: var(--info-soft); color: var(--muted); }
.score-none { background: transparent; color: var(--grey); }
.score-lg { position: relative; width: 84px; height: 84px; padding: 0; border-radius: 50%; color: var(--heading);
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.score-lg::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.score-lg b { position: relative; font-size: 1.55rem; }

/* ---------- the deadline runway ---------- */
.runway { --fill: var(--act); display: grid; gap: 5px; min-width: 0; }
.runway-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 10px; font-size: .84rem; }
.runway-left { font-weight: 600; color: var(--ink); white-space: nowrap; }
.runway-date { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.runway-track { position: relative; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.runway-track span {
  position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: inherit; background: var(--fill);
  transform-origin: right center; animation: runway-in .6s var(--ease) both;
}
.runway.is-soon { --fill: var(--orange); }
.runway.is-soon .runway-left { color: var(--orange-text); }
.runway.is-urgent { --fill: var(--bad); }
.runway.is-urgent .runway-left { color: var(--bad); }
.runway.is-over .runway-left { color: var(--muted); }
.runway-lg .runway-track { height: 6px; }
.runway-lg .runway-head { font-size: .92rem; }
@keyframes runway-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- tender card ---------- */
.tcard { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.tcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.tcard-top { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.tcard-title { font-size: .96rem; font-weight: 600; line-height: 1.6; color: var(--ink); }
.tcard-title:hover { color: var(--link); }
.tcard-agency { font-size: .84rem; color: var(--muted); margin-top: 3px; }
.tcard-reason { font-size: .88rem; color: var(--ink); background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius-sm); margin: 0; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 99px; font-size: .75rem; font-weight: 500; background: var(--info-soft); color: var(--navy); }
:root[data-theme="dark"] .tag { color: var(--link); }
.tag:hover { text-decoration: none; }
.tag-orange { background: var(--orange-soft); color: var(--orange-text); }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-grey { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
:root[data-theme="dark"] .tag-orange { color: var(--orange-text); }
:root[data-theme="dark"] .tag-good { color: var(--good); }
:root[data-theme="dark"] .tag-bad { color: var(--bad); }
:root[data-theme="dark"] .tag-grey { color: var(--muted); }

/* ---------- overview ---------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .18s var(--ease); }
.stat:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .86rem; font-weight: 500; }
.stat-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--info-soft); color: var(--navy); font-size: 1rem; }
:root[data-theme="dark"] .stat-ic { color: var(--link); }
.stat-ic.is-act { background: var(--act-soft); color: var(--act); }
.stat-ic.is-good { background: var(--good-soft); color: var(--good); }
.stat-ic.is-warn { background: var(--orange-soft); color: var(--orange-text); }
.stat-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; color: var(--heading); font-variant-numeric: tabular-nums; }
.status-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: .82rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grey); margin-inline-end: 6px; }
.dot-good { background: var(--good); } .dot-warn { background: var(--orange); } .dot-bad { background: var(--bad); }
.dot-info { background: var(--act); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; color: var(--muted); font-size: .88rem; }

/* best pick */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 28px; padding: 20px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--act-soft) 0%, var(--surface) 62%); border-radius: var(--radius) var(--radius) 0 0; }
.feature .eyebrow { color: var(--act-hover); font-weight: 600; }
:root[data-theme="dark"] .feature .eyebrow { color: var(--link); }
.feature-title { font-size: 1.15rem; font-weight: 700; line-height: 1.6; }
.feature-title a { color: var(--heading); }
.feature-agency { color: var(--muted); margin-top: 2px; font-size: .9rem; }
.feature .tcard-reason { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); margin-top: 12px; }
.feature-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.feature-side small { color: var(--muted); }
.feature-foot { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 24px; align-items: end; }
.feature-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- list rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row-item { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(170px, 240px); gap: 14px; align-items: center; padding: 12px 22px; border-top: 1px solid var(--line); transition: background-color .15s; }
.rows .row-item:first-child { border-top: 0; }
.row-item:hover { background: var(--surface-2); }
.row-title { display: block; font-weight: 600; color: var(--ink); line-height: 1.55; font-size: .93rem; }
.row-title:hover { color: var(--link); }
.row-meta { font-size: .8rem; color: var(--muted); margin-top: 1px; }

/* ---------- tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border-radius: inherit; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-size: .76rem; font-weight: 600; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover td { background: var(--surface-2); }
.t-title { font-weight: 600; color: var(--ink); line-height: 1.6; font-size: .92rem; }
.t-title:hover { color: var(--link); }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: .78rem; color: var(--muted); margin-top: 3px; }
.col-runway { width: 220px; min-width: 200px; }
.col-agency { width: 210px; min-width: 150px; font-size: .84rem; color: var(--muted); }
.col-title { min-width: 260px; }
.col-score { width: 60px; }
.col-star { width: 44px; padding-inline: 6px !important; }

/* ---------- toolbar / results / pagination ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.count { font-weight: 500; color: var(--muted); font-size: .9rem; }
.count .mono { color: var(--heading); font-weight: 700; font-size: 1.05rem; }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 20px 0 0; list-style: none; padding: 0; }
.pager a, .pager span { display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 10px; border-radius: 9px; font-size: .88rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.pager a:hover { background: var(--surface); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.pager .is-current { background: var(--act); color: #fff; font-weight: 600; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--act); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#results.htmx-request { opacity: 1; }
.filters-more { margin-top: 10px; }
.filters-more summary { cursor: pointer; color: var(--link); font-weight: 500; font-size: .86rem; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.filters-more summary::-webkit-details-marker { display: none; }
.filters-more summary i { transition: transform .18s var(--ease); }
.filters-more[open] summary i { transform: rotate(180deg); }

/* ---------- empty / alerts ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 1.7rem; color: var(--grey); display: block; margin-bottom: 8px; }
.empty .btn { margin-top: 14px; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 500; font-size: .92rem;
  background: var(--info-soft); }
.flash-success { background: var(--good-soft); color: var(--good); }
.flash-danger, .flash-warning { background: var(--bad-soft); color: var(--bad); }
.flash-info { background: var(--orange-soft); color: var(--orange-text); }
.flash button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 1.1rem; line-height: 1; }
.saved { color: var(--good); font-size: .86rem; font-weight: 600; }

/* ---------- detail page ---------- */
.back-link { display: flex; width: max-content; align-items: center; gap: 6px; margin-bottom: 10px; font-size: .86rem; color: var(--muted); }
.detail-hero { padding: 16px 20px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 22px; align-items: center; }
.detail-sum { display: grid; gap: 12px; min-width: 0; }
.detail-score { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.jump { position: sticky; top: 0; z-index: 5; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 12px 0 16px; padding: 6px 0; background: var(--paper); }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 5px 12px; border-radius: 8px; font-size: .84rem; font-weight: 500; color: var(--muted); }
.jump a:hover { background: var(--surface); color: var(--ink); text-decoration: none; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.detail-grid section[id] { scroll-margin-top: 56px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 0 16px; margin: 0; }
.fact { padding: 11px 0; border-bottom: 1px solid var(--line); }
.fact dt { font-size: .76rem; color: var(--muted); font-weight: 500; margin-bottom: 1px; }
.fact dd { margin: 0; font-weight: 500; font-size: .92rem; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.points li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.points i { margin-top: 3px; }
.points-good i { color: var(--good); } .points-bad i { color: var(--bad); }
.verdict { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px; border-radius: 99px; font-weight: 600; font-size: .84rem; }
.verdict-bid { background: var(--good-soft); color: var(--good); }
.verdict-review { background: var(--orange-soft); color: var(--orange-text); }
.verdict-skip { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.breakdown { display: grid; gap: 8px; margin-top: 12px; }
.bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 46px; gap: 10px; align-items: center; font-size: .82rem; }
.bar-track { height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--act); border-radius: inherit; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 14px; padding-inline-start: 22px; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 7px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline del { color: var(--muted); }
.sticky { position: sticky; top: 52px; display: grid; gap: 16px; max-height: calc(100vh - 64px); overflow-y: auto; }
.split-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.split-actions form { flex: 1; }
.split-actions .btn { width: 100%; }
.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- pipeline (kanban) ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 280px; display: flex; flex-direction: column; gap: 8px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 6px; }
.lane-head b { font-size: .9rem; font-weight: 600; color: var(--heading); }
.lane-count { font-size: .76rem; font-variant-numeric: tabular-nums; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; padding: 0 9px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; box-shadow: var(--shadow-sm); }
.kcard-title { font-weight: 600; font-size: .88rem; line-height: 1.55; color: var(--ink); }
.kcard .select { min-height: 34px; padding-block: 4px; font-size: .84rem; }

/* ---------- calendar ---------- */
.cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 720px; }
.cal th { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 10px; text-align: start; border-bottom: 1px solid var(--line); }
.cal td { height: 112px; vertical-align: top; padding: 8px; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal tr td:first-child { border-inline-start: 0; }
.cal tbody tr:last-child td { border-bottom: 0; }
.cal .off { background: var(--surface-2); }
.cal .day { font-size: .84rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.cal .is-today .day { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--act); color: #fff; font-weight: 600; }
.chip { display: block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; font-size: .74rem; font-weight: 500; line-height: 1.5;
  background: var(--info-soft); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-hot { background: var(--orange-soft); color: var(--orange-text); }
.chip:hover { text-decoration: none; filter: brightness(.97); }
.month-nav { display: inline-flex; align-items: center; gap: 6px; }
.month-nav strong { min-width: 9ch; text-align: center; font-size: 1rem; font-weight: 600; }

/* ---------- runs ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--orange-soft); color: var(--orange-text); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--link); }
.runbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.runbar .input { width: 130px; min-height: 40px; }
.err-list { margin: 6px 0 0; padding-inline-start: 18px; font-size: .82rem; color: var(--muted); }

/* ---------- charts ---------- */
/* flex: in RTL, Safari reports a block canvas's leftover width as margin, which Chart.js then subtracts, pinning it at 300px */
.chart-box { position: relative; display: flex; height: 240px; margin-top: 10px; }
.chart-box canvas { min-width: 0; }

/* ---------- login: the estate auth pattern ---------- */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 22px; padding: 32px 16px;
  background: linear-gradient(135deg, #071B33 0%, #0A2647 50%, #0D3156 100%); overflow: hidden; }
.login::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(255, 158, 24, .10), transparent 60%); pointer-events: none; }
.login > * { position: relative; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand img { height: 58px; width: auto; }
.login-brand .lockup-rule { height: 42px; background: linear-gradient(to bottom, transparent, #5C9AEE 22%, #5C9AEE 78%, transparent); }
.login-brand .lockup-word { color: #8FBEF7; font-size: 13px; }
.login-card { width: min(100%, 400px); display: grid; gap: 16px; padding: 26px 28px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.login-card .page-title { font-size: 1.25rem; }
.login-sign { font-size: .78rem; color: rgba(255, 255, 255, .5); }
.login-theme { position: absolute !important; top: 16px; inset-inline-end: 16px; color: rgba(255, 255, 255, .7); }
.login-theme:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; z-index: 20; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .side-in { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 14px; }
  .brand { flex: 1; padding: 0; }
  .brand img { height: 36px; }
  .menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 1.3rem; cursor: pointer; }
  .side-menu { display: none; flex-basis: 100%; margin-top: 10px; max-height: calc(100vh - 70px); }
  .side.is-open .side-menu { display: flex; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .row-item { grid-template-columns: auto minmax(0, 1fr); }
  .row-item .runway { grid-column: 1 / -1; }
  .jump { top: 57px; }
  .detail-grid section[id] { scroll-margin-top: 112px; }
}
@media (max-width: 760px) {
  /* tender list: a stack of readable rows instead of a clipped table */
  .table-tenders, .table-tenders tbody { display: block; }
  .table-tenders thead { display: none; }
  .table-tenders tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-tenders tbody tr:last-child { border-bottom: 0; }
  .table-tenders td { display: block; padding: 0; border: 0 !important; width: auto; min-width: 0; }
  .table-tenders .col-score { grid-area: 1 / 1; }
  .table-tenders .col-title { grid-area: 1 / 2; }
  .table-tenders .col-star { grid-area: 1 / 3; padding: 0 !important; }
  .table-tenders .col-agency { grid-area: 2 / 2 / auto / -1; }
  .table-tenders .col-runway { grid-area: 3 / 1 / auto / -1; margin-top: 4px; }
  .filters-toggle { display: inline-flex; }
  .filters:not(.is-open) .filters-body { display: none; }
}
@media (max-width: 640px) {
  .main { padding: 16px 14px 48px; }
  .panel-body { padding: 14px 16px; }
  .panel-head { padding: 12px 16px; }
  .row-item { padding: 12px 16px; }
  .row-item[style] { grid-template-columns: auto minmax(0, 1fr) !important; }
  .row-item[style] > :nth-child(3) { grid-column: 1 / -1; }
  .two { grid-template-columns: 1fr; }
  .page-title, .title-input { font-size: 1.3rem; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.5rem; }
  .feature { padding: 16px; gap: 12px 14px; }
  .feature-foot { grid-template-columns: minmax(0, 1fr); }
  .detail-hero { padding: 16px; gap: 12px 14px; }
  .detail-hero .score-lg { width: 64px; height: 64px; }
  .detail-hero .score-lg b { font-size: 1.2rem; }
  .bar { grid-template-columns: 96px minmax(0, 1fr) 46px; }
  .toolbar-actions .btn-csv { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* dates in Arabic and bare numbers both read correctly inside RTL */
.fact dd.mono, td.mono { unicode-bidi: plaintext; text-align: right; }

/* ---------- scrape launchers / watched agencies / run detail ---------- */
.launchers { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); align-items: stretch; }
.launcher .panel-body { height: 100%; grid-template-rows: auto 1fr auto; }
.launcher-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; margin-bottom: 10px;
  background: var(--act-soft); color: var(--act); font-size: 1.1rem; }
.watch-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 10px; }
.watch-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.watch-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.watch-add { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.btn-link { border: 0; background: none; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; margin: 14px 0 0; }
.stats > div { padding: 8px 14px; border-inline-start: 1px solid var(--line); }
.stats > div:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stats dt { font-size: .76rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 600; color: var(--heading); font-variant-numeric: tabular-nums; }
.change-list { list-style: none; margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--orange-soft); font-size: .84rem; display: grid; gap: 2px; }
.change-list del { color: var(--muted); }
.runs-table .t-title { font-weight: 600; }
@media (max-width: 640px) {
  .stats > div { border-inline-start: 0; padding-inline-start: 0; }
}
.watch-list li > div:first-child { min-width: 0; }
.watch-list li b { overflow-wrap: anywhere; }
.watch-add .field { min-width: min(100%, 220px); }
.launcher textarea, .launcher input { min-width: 0; }

/* ---------- users & account ---------- */
.roles { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.roles legend { margin-bottom: 6px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--act); background: var(--act-soft); }
.role-opt input { margin-top: 5px; accent-color: var(--act); }
.role-opt b { display: block; font-size: .92rem; }
.role-opt small { color: var(--muted); }
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px 16px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
.user-list li:first-child { border-top: 0; }
.user-list li.is-off { opacity: .6; }
.user-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.user-edit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-edit .input { flex: 1; width: auto; min-width: min(100%, 200px); min-height: 34px; padding-block: 4px; }
.user-edit .select { width: auto; min-width: 110px; min-height: 34px; padding-block: 4px; }
.user-pw { grid-column: 1 / -1; }
.user-pw summary { cursor: pointer; color: var(--link); width: max-content; }
.users-span { grid-column: span 2; }

/* ---------- attachments ---------- */
.file-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.file-icon { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 9px; font-size: 1.25rem;
  background: var(--info-soft); color: var(--link); }
.file-pdf { background: var(--bad-soft); color: var(--bad); }
.file-xlsx, .file-xls, .file-csv { background: var(--good-soft); color: var(--good); }
.file-meta { flex: 1; min-width: 0; }
.file-name { display: block; max-width: 100%; border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink);
  text-align: start; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--link); text-decoration: underline; }
.file-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.upload { display: grid; gap: 10px; }
.dropzone { position: relative; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1.5px dashed var(--line-strong);
  border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--act); background: var(--act-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone > i { font-size: 1.4rem; color: var(--act); }
.dropzone b { display: block; }
.dropzone small { color: var(--muted); }
.dz-picked { flex-basis: 100%; color: var(--link); font-weight: 600; }
.dz-picked:empty { display: none; }
.upload-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* preview dialog: a near-full-screen sheet over the tender page */
dialog.preview { width: min(1200px, 96vw); height: min(92vh, 1000px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(7, 27, 51, .7); }
dialog.preview::backdrop { background: rgba(7, 27, 51, .7); backdrop-filter: blur(3px); }
#preview-body { height: 100%; display: flex; flex-direction: column; }
.pv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.pv-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.pv-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.pv-frame { flex: 1; width: 100%; border: 0; background: #525659; }
.pv-pdf { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px; background: #525659; overflow: auto; }
.pv-pdf canvas { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); max-width: 100%; height: auto; }
.pv-pdf .pv-pdf-status { color: #e8edf3; }
.pv-image { flex: 1; display: grid; place-items: center; padding: 16px; background: var(--surface-2); }
.pv-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.pv-tab { border: 1px solid transparent; border-bottom: 0; background: none; padding: 7px 14px; border-radius: 8px 8px 0 0; cursor: pointer; font: inherit;
  font-size: .86rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pv-tab.is-on { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.pv-sheet { padding: 12px; flex: 1; min-height: 0; }
.pv-grid-wrap { overflow: auto; max-height: 100%; border: 1px solid var(--line); border-radius: 8px; }
.pv-grid { border-collapse: collapse; font-size: .84rem; min-width: 100%; }
.pv-grid td, .pv-grid th { border: 1px solid var(--line); padding: 5px 9px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.pv-grid th { position: sticky; inset-inline-start: 0; background: var(--surface-2); color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; font-size: .75rem; }
.pv-grid tr:first-child td { background: var(--info-soft); font-weight: 600; }
@media (max-width: 900px) { .users-span { grid-column: auto; } .user-list li { grid-template-columns: 1fr; } }
@media (max-width: 640px) { dialog.preview { width: 100vw; height: 100vh; border-radius: 0; } .file-actions .btn { display: none; } }

/* ==========================================================================
   Qualification calculator
   ========================================================================== */
.qual-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.qual-aside { position: sticky; top: 20px; max-height: calc(100vh - 32px); overflow-y: auto; }
.title-input { display: block; width: 100%; border: 0; background: transparent; font: inherit; font-size: 1.5rem; font-weight: 700; line-height: 1.4;
  color: var(--heading); padding: 0; border-bottom: 2px dashed transparent; }
.title-input:hover:not(:disabled), .title-input:focus { border-bottom-color: var(--line-strong); outline: none; }
.qn { min-height: 34px; padding: 4px 8px; width: 78px; text-align: center; }

/* criterion card */
.qc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.qc-head, .qg-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; }
.qc-head { padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.qc-head h2 { font-size: .98rem; font-weight: 600; }
.qc-head .qc-score { background: var(--act-soft); color: var(--act-hover); }
.qc-weight { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); }
.qc-score { padding: 4px 12px; border-radius: 99px; background: var(--info-soft); color: var(--link); font-size: .9rem; white-space: nowrap; }
.qc-score b { font-weight: 700; }
.qc-sum { padding: 0 18px; color: var(--bad); font-weight: 600; }
.qc-sum:not(:empty) { padding-top: 10px; }
.qg { margin: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.qg-head { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.qg-head h3 { font-size: .95rem; }
.qg .qm { background: var(--surface); }
.qg .qm:last-child { border-radius: 0 0 12px 12px; }
.qc-unused { margin: 6px 0 16px; }
.qc-unused summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: 6px 0; }

/* metric row */
.qm { display: grid; grid-template-columns: minmax(170px, 1.2fr) minmax(170px, 1.3fr) auto 120px; gap: 10px 18px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--line); }
.qc > .qm:first-of-type { border-top: 0; }
.qm-name b { display: block; font-size: .92rem; line-height: 1.45; }
.qm-value { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .76rem; color: var(--muted); }
.qm-value .qn { width: 110px; min-height: 28px; font-size: .82rem; }
.qm-level-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.qm-level-head output { font-weight: 600; color: var(--ink); }
.qm-weights { display: flex; gap: 8px; }
.qm-weights label { display: grid; gap: 2px; font-size: .72rem; color: var(--muted); text-align: center; }
.qm-weights .qn { width: 64px; }
.qm-points { display: grid; gap: 6px; text-align: end; font-size: .88rem; }
.qbar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.qbar span { display: block; height: 100%; background: var(--act); border-radius: inherit; transition: width .2s; }

/* level slider */
.qrange { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
.qrange::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--line); }
.qrange::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
.qrange::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 4px solid var(--act); box-shadow: var(--shadow-sm); }
.qrange::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 4px solid var(--act); }
.qrange:disabled { cursor: default; opacity: .7; }

/* result panel */
.qres-top { display: flex; gap: 18px; align-items: center; }
.qdial { --p: 0; --c: var(--act); position: relative; flex: none; width: 118px; height: 118px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.qdial::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.qdial b, .qdial small { position: relative; }
.qdial b { font-size: 2rem; font-weight: 600; line-height: 1; }
.qdial small { color: var(--muted); font-size: .75rem; }
.qdial.is-pass { --c: var(--good); }
.qdial.is-fail { --c: var(--bad); }
.qverdict { flex: 1; min-width: 0; }
.qverdict .badge { white-space: normal; line-height: 1.5; }
.qres-h { font-size: .88rem; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
.q100 { display: flex; height: 22px; border-radius: 8px; overflow: hidden; gap: 3px; }
.q100-seg { position: relative; min-width: 6px; background: repeating-linear-gradient(-45deg, var(--surface-2) 0 5px, var(--line) 5px 7px); border-radius: 4px; overflow: hidden; }
.q100-seg i { position: absolute; inset-block: 0; inset-inline-start: 0; transition: width .25s; }
.q100-seg.c0 i, .dotc.c0 { background: var(--act); }
.q100-seg.c1 i, .dotc.c1 { background: var(--orange); }
.q100-seg.c2 i, .dotc.c2 { background: var(--good); }
.q100-seg.c3 i, .dotc.c3 { background: #7c6fd6; }
.q100-legend { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: .84rem; }
.q100-legend li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.dotc { width: 10px; height: 10px; border-radius: 3px; }
.qgaps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.qgaps li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px;
  background: var(--bad-soft); font-size: .86rem; }
.qgaps li b { display: block; font-size: .86rem; }
.qgaps li small { display: block; font-size: .75rem; margin-top: 2px; }
.gap-pts { color: var(--bad); font-weight: 600; white-space: nowrap; }
.qwarn { list-style: none; margin: 14px 0 0; padding: 0; color: var(--bad); font-size: .84rem; font-weight: 600; }
.qwarn:empty { display: none; }
.qres .btn-block { margin-top: 18px; }

.qual-tools { margin-top: 22px; }
.qual-tools-row { display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-end; }
.qual-tools .tool { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.qual-tools .tool .field { min-width: 200px; }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); }
.btn.danger:hover { background: var(--bad-soft); }

/* hub */
.qcard { display: grid; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--ink); }
.qcard:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow); }
.qcard-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.qcard-title { display: block; line-height: 1.5; }
.qcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.minibar { display: flex; width: 90px; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line); }
.minibar span { background: var(--act); }
.minibar span.t { background: var(--orange); }
.import { position: relative; }
.import summary { list-style: none; }
.import summary::-webkit-details-marker { display: none; }
.import-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 10; width: min(360px, 90vw); padding: 16px; }

/* template editor */
.tw .panel-head { gap: 12px; }
.tw-main { display: inline-flex; align-items: center; gap: 8px; }
.tw-main small, .tw-row small { color: var(--muted); font-size: .72rem; }
.tw-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 110px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tw-row label { display: grid; gap: 2px; text-align: center; }
.tw-row .qn { width: 100%; }
.tw-group { margin-bottom: 10px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.tw-ghead { border-bottom: 1px solid var(--line); }

/* tender page panel */
.qmini { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.qmini:hover { text-decoration: none; border-color: var(--line-strong); }
.qmini + .qmini { margin-top: 8px; }

@media (max-width: 1180px) {
  .qual-layout { grid-template-columns: minmax(0, 1fr); }
  .qual-aside { position: static; order: -1; max-height: none; overflow: visible; }
  .qm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .qm { grid-template-columns: minmax(0, 1fr); }
  .qm-points { text-align: start; }
  .qc-head, .qg-head { grid-template-columns: minmax(0, 1fr) auto; }
  .qc-head .qc-weight, .qg-head .qc-weight { grid-row: 2; }
  .tw-row { grid-template-columns: minmax(0, 1fr) 80px 80px; }
}

/* fractions like 51 / 70 read left-to-right inside RTL */
.qc-score, .qm-points > span.mono, .qm-level-head output, .q100-legend b { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

/* ==========================================================================
   Criteria extraction (AI prompt -> JSON -> review)
   ========================================================================== */
.steps { list-style: none; counter-reset: step; margin: 0 0 20px; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.steps li { counter-increment: step; position: relative; padding: 14px 16px 14px 16px; padding-inline-start: 52px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; inset-inline-start: 14px; top: 14px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--act-soft); color: var(--act-hover); font-weight: 700; }
.steps b { display: block; }
.steps span { font-size: .84rem; color: var(--muted); }
.prompt-box { width: 100%; min-height: 420px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2);
  color: var(--ink); font-size: .8rem; line-height: 1.7; resize: vertical; white-space: pre-wrap; }
.tips { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.issue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issue-list li { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 12px; padding: 8px 12px; border-radius: 8px;
  background: var(--orange-soft); font-size: .86rem; }
.import-errors .issue-list li { background: var(--bad-soft); }
.issue-list.notes li { grid-template-columns: 1fr; background: var(--info-soft); }
.issue-list code { font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; direction: ltr; text-align: start; }
.crit-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.crit-stats div { padding: 8px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; }
.crit-stats .mono { font-weight: 700; font-size: 1.05rem; color: var(--heading); }
.crit-stats .warn { border-color: var(--orange); background: var(--orange-soft); }
.stage-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.stage-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.tree { padding: 6px 0; }
.sec { padding: 12px 18px; }
.sec .sec { margin: 8px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sec .sec .sec { background: var(--surface); }
.sec.is-heading { border-style: dashed; }
.sec-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.sec.depth-0 > .sec-head { display: none; }
.sec-body { display: grid; gap: 8px; }
.cr { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cr.is-gate { border-color: var(--bad); }
.cr-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cr-title { min-width: 0; }
.cr-weight { flex: none; min-width: 48px; text-align: center; padding: 3px 10px; border-radius: 99px; background: var(--orange-soft); color: var(--orange-text); font-weight: 700; }
.cr-weight s { color: var(--bad); font-weight: 400; margin-inline-start: 4px; }
.cr-rule { margin: 8px 0 4px; padding-inline-start: 18px; font-size: .86rem; display: grid; gap: 2px; }
.quote { margin: 8px 0 0; padding: 6px 12px; border-inline-start: 3px solid var(--line-strong); background: var(--surface-2); font-size: .8rem; color: var(--muted); border-radius: 0 6px 6px 0; }
@media (max-width: 640px) { .issue-list li { grid-template-columns: 1fr; gap: 2px; } .steps li { padding-inline-start: 48px; } }

/* ---------- assessment <-> tender link ---------- */
.tlink { margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tlink.is-linked { border-color: var(--good); }
.tlink-body { display: flex; align-items: center; gap: 14px; padding: 14px 18px; flex-wrap: wrap; }
.tlink-icon { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; font-size: 1.3rem;
  background: var(--info-soft); color: var(--link); }
.is-linked .tlink-icon { background: var(--good-soft); color: var(--good); }
.tlink-info { flex: 1; min-width: 220px; }
.tlink-title { display: block; font-weight: 700; line-height: 1.5; color: var(--ink); }
.tlink-title:hover { color: var(--link); }
.tlink-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; align-items: center; }
.tlink-fit { display: grid; text-align: center; padding: 4px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.tlink-fit b { font-size: 1.3rem; line-height: 1.2; }
.tlink-actions { display: flex; gap: 6px; align-items: center; }
.tlink-change { position: relative; }
.tlink-change summary { list-style: none; cursor: pointer; }
.tlink-change summary::-webkit-details-marker { display: none; }
.tlink-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 12; width: min(480px, 88vw); padding: 14px; }
.tlink-picker { padding: 0 18px 16px; }
.pick-box { margin-top: 8px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 330px; overflow-y: auto; }
.pick-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.pick-title { display: block; line-height: 1.5; font-size: .9rem; }
.link-existing { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.tlink .search i { position: absolute; }

/* sectors */
.sector-fit{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.sector-fit li{padding:9px 12px;border:1px solid var(--line);border-radius:10px}
.sector-fit li.is-mine{border-color:var(--act);background:var(--act-soft)}
.sector-fit-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.handoff-list,.thread{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.handoff-list li,.thread li{padding:10px 12px;border:1px solid var(--line);border-radius:10px}
.thread li.is-event{border:0;padding:2px 4px}
.run-log { margin: 0; max-height: 420px; overflow: auto; background: #0b1726; color: #cfe0f2; border-radius: 10px; padding: 12px 14px; font-size: .78rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; text-align: left; }
.run-log .log-warn { color: #ffcf7a; }
.run-log .log-err { color: #ff8f8f; }
.text-bad { color: var(--bad); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.progress { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--act); }
.kpi { color: inherit; text-decoration: none; }
.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow); text-decoration: none; }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; margin-top: 6px; color: var(--heading); font-variant-numeric: tabular-nums; }
