/* ==========================================================================
   Al-Saqifa · Tender Radar — design tokens
   Navy #013765 = identity / structure.  Orange #FF9F17 = attention / action.
   ========================================================================== */
:root {
  --navy: #013765;
  --navy-deep: #00284b;
  --navy-night: #001a33;
  --orange: #ff9f17;
  --orange-soft: #fff1dc;
  --orange-text: #a85f00;      /* orange that passes contrast on white */
  --paper: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dde4ee;
  --line-strong: #c6d1df;
  --ink: #0b1f33;
  --muted: #5a6b80;
  --link: #013765;
  --good: #13804f;
  --good-soft: #e3f4ec;
  --bad: #c2410c;
  --bad-soft: #fdeae2;
  --info-soft: #e6eef7;
  --grey: #8a97a8;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(1, 55, 101, .05), 0 6px 18px -10px rgba(1, 55, 101, .18);
  --font: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --side-w: 252px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #061628;
  --surface: #0b2139;
  --surface-2: #0e2843;
  --line: #1b3757;
  --line-strong: #2a4a6e;
  --ink: #e6edf6;
  --muted: #94a7bd;
  --link: #9cc8f5;
  --orange-soft: rgba(255, 159, 23, .14);
  --orange-text: #ffb54d;
  --good: #3ccf8e;
  --good-soft: rgba(60, 207, 142, .13);
  --bad: #ff8a5c;
  --bad-soft: rgba(255, 138, 92, .13);
  --info-soft: rgba(156, 200, 245, .1);
  --grey: #6f8299;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65;
  color: var(--ink); background: var(--paper);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0 0 .75rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.01em; }
.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; }

/* ---------- shell: navy sidebar (right, RTL) + content ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--navy); color: #d7e4f2; padding: 22px 16px;
  background-image: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}
.brand { display: block; padding: 0 4px 6px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 178px; height: auto; margin-inline-start: -14px; }
.brand-sub { display: flex; align-items: center; gap: 8px; margin: 0 8px 22px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: .8rem; color: var(--orange); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #c4d5e8; font-weight: 500;
}
.nav a i { font-size: 1.1rem; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .09); color: #fff; font-weight: 600; }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute; inset-inline-start: -16px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--orange);
}
.nav a[aria-current="page"] i { color: var(--orange); opacity: 1; }
.side-foot { margin-top: auto; display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; background: transparent; color: #d7e4f2; cursor: pointer;
}
.side-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-btn form { display: contents; }
.menu-toggle { display: none; }

.main { min-width: 0; padding: 30px clamp(16px, 3vw, 40px) 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.eyebrow { display: block; font-size: .8rem; font-weight: 600; color: var(--orange-text); margin-bottom: 4px; }
.page-title { font-size: 1.6rem; }
.page-lede { color: var(--muted); max-width: 62ch; margin: 6px 0 0; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-body { padding: 20px 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: 1rem; }
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 1.15rem; }
.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%, 330px), 1fr)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 40px;
  border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: var(--surface); color: var(--ink); transition: background-color .15s, border-color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
:root[data-theme="dark"] .btn-primary { background: #1c5a96; }
.btn-accent { background: var(--orange); color: var(--navy-night); }
.btn-accent:hover { background: #f28f00; }
.btn-ghost { border-color: var(--line-strong); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: .84rem; 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.15rem;
}
.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: 6px; }
.label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.select { appearance: none; -webkit-appearance: none; padding-inline-end: 12px; padding-inline-start: 36px;
  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='%235a6b80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat left 12px center / 14px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(255, 159, 23, .35); }
:root[data-theme="dark"] .input:focus, :root[data-theme="dark"] .select:focus, :root[data-theme="dark"] .textarea:focus { border-color: var(--orange); }
.input-lg { min-height: 52px; font-size: 1.05rem; padding-inline-start: 46px; }
.search { position: relative; }
.search i { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; font-size: .86rem; font-weight: 600; color: var(--muted); }
.segmented input:checked + span { background: var(--navy); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--orange); }

/* ---------- score ring: green >= 75, amber 50-74, grey < 50 ---------- */
.score {
  --c: var(--grey); --p: 0;
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0);
}
.score::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.score b { position: relative; font-family: var(--mono); font-size: .98rem; font-weight: 600; color: var(--ink); }
.score-success { --c: var(--good); }
.score-warning { --c: var(--orange); }
.score-secondary { --c: var(--grey); }
.score-lg { width: 76px; height: 76px; }
.score-lg::before { inset: 7px; }
.score-lg b { font-size: 1.45rem; }
.score-none b { color: var(--muted); }

/* ---------- signature: the deadline runway ---------- */
.runway { --fill: var(--navy); display: grid; gap: 6px; }
:root[data-theme="dark"] .runway { --fill: #5f9be0; }
.runway-head { white-space: nowrap; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .84rem; }
.runway-left { font-weight: 700; color: var(--ink); }
.runway-date { color: var(--muted); font-family: var(--mono); font-size: .8rem; direction: ltr; }
.runway-track { position: relative; height: 6px; 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 .9s cubic-bezier(.2, .7, .2, 1) 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: 10px; }
.runway-lg .runway-head { font-size: .95rem; }
@keyframes runway-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- tender card ---------- */
.tcard { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tcard:hover { border-color: var(--line-strong); }
.tcard-top { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; }
.tcard-title { font-size: 1rem; font-weight: 700; line-height: 1.6; color: var(--ink); }
.tcard-title:hover { color: var(--link); }
.tcard-agency { font-size: .86rem; color: var(--muted); margin-top: 4px; }
.tcard-reason { font-size: .9rem; color: var(--ink); background: var(--surface-2); border-inline-start: 3px solid var(--orange); padding: 8px 12px; border-radius: 0 8px 8px 0; 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: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 600;
  background: var(--info-soft); color: var(--link); }
.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); border: 1px solid var(--line); }

/* featured pick on the overview */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; padding: 26px 28px;
  background: var(--navy); color: #fff; border-radius: calc(var(--radius) + 4px); position: relative; overflow: hidden; }

.feature .eyebrow { color: var(--orange); }
.feature-title { font-size: 1.35rem; line-height: 1.55; color: #fff; }
.feature-title a { color: #fff; }
.feature-agency { color: #b9cde3; margin-top: 6px; }
.feature .tcard-reason { background: rgba(255, 255, 255, .07); color: #eaf1f9; }
.feature .score::before { background: var(--navy); }
.feature .score b { color: #fff; }
.feature .score { background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .15) 0); }
.feature .runway { --fill: var(--orange); }
.feature .runway-track { background: rgba(255, 255, 255, .15); }
.feature .runway-left { color: #fff; }
.feature .runway-date { color: #b9cde3; }
.feature-actions { display: flex; gap: 10px; flex-wrap: wrap; grid-column: 1 / -1; }
.feature .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.feature .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.feature-side { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.feature-side small { color: #b9cde3; }

/* ---------- overview hero sentence ---------- */
.brief { font-size: clamp(1.35rem, 2.6vw, 2rem); font-weight: 300; line-height: 1.75; max-width: 34ch; margin: 0; }
.brief a { font-family: var(--mono); font-weight: 600; color: var(--navy); border-bottom: 3px solid var(--orange); padding: 0 2px; }
.brief a:hover { text-decoration: none; background: var(--orange-soft); }
:root[data-theme="dark"] .brief a { color: #fff; }
.brief strong { font-weight: 600; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 18px; color: var(--muted); font-size: .88rem; }
.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: #3b82c4; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- list rows (overview "more picks") ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row-item { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(150px, 220px); gap: 16px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--line); }
.row-item:first-child { border-top: 0; }
.row-title { font-weight: 600; color: var(--ink); line-height: 1.55; }
.row-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-size: .78rem; font-weight: 600; color: var(--muted); padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.t-title { font-weight: 600; color: var(--ink); line-height: 1.6; }
.t-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.col-runway { width: 230px; min-width: 210px; }
.col-agency { min-width: 150px; font-size: .86rem; }

/* ---------- toolbar / results / pagination ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.count { font-weight: 600; }
.count .mono { color: var(--navy); font-size: 1.1rem; }
:root[data-theme="dark"] .count .mono { color: var(--orange); }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 20px; list-style: none; padding: 0; }
.pager a, .pager span { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); font-feature-settings: "tnum"; color: var(--ink); }
.pager a:hover { border-color: var(--navy); text-decoration: none; }
.pager .is-current { background: var(--navy); border-color: var(--navy); color: #fff; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--orange); 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; }
.filters-more { margin-top: 14px; }
.filters-more summary { cursor: pointer; color: var(--link); font-weight: 600; font-size: .9rem; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.filters-more summary::-webkit-details-marker { display: none; }
.filters-more[open] summary i { transform: rotate(180deg); }

/* ---------- empty / alerts ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty i { font-size: 2rem; color: var(--line-strong); display: block; margin-bottom: 10px; }
.empty .btn { margin-top: 14px; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500;
  background: var(--info-soft); border: 1px solid var(--line); }
.flash-success { background: var(--good-soft); color: var(--good); border-color: transparent; }
.flash-danger, .flash-warning { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.flash-info { background: var(--orange-soft); color: var(--orange-text); border-color: transparent; }
.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 ---------- */
.detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 32px; align-items: start; margin-bottom: 24px; }
.detail-title { font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.55; }
.detail-agency { color: var(--muted); margin-top: 6px; }
.detail-score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 0; margin: 0; }
.fact { padding: 14px 0; border-bottom: 1px dashed var(--line); padding-inline-end: 16px; }
.fact dt { font-size: .78rem; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.fact dd { margin: 0; font-weight: 600; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.points li { display: flex; gap: 10px; align-items: flex-start; }
.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: 6px 14px; border-radius: 99px; font-weight: 700; font-size: .9rem; }
.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); border: 1px solid 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: .84rem; }
.bar-track { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--navy); border-radius: inherit; }
:root[data-theme="dark"] .bar-track span { background: #5f9be0; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 16px; 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: 20px; }
.split-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.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(230px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 280px; display: flex; flex-direction: column; gap: 10px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; border-bottom: 2px solid var(--line); }
.lane-head b { font-size: .95rem; }
.lane[data-lane="will_bid"] .lane-head { border-color: var(--orange); }
.lane[data-lane="submitted"] .lane-head { border-color: var(--good); }
.lane[data-lane="reviewing"] .lane-head { border-color: var(--navy); }
.lane-count { font-family: var(--mono); font-size: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px; display: grid; gap: 10px; }
.kcard-title { font-weight: 600; font-size: .9rem; 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: .8rem; color: var(--muted); font-weight: 600; padding: 10px; text-align: start; border-bottom: 1px solid var(--line); }
.cal td { height: 118px; 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-family: var(--mono); font-size: .85rem; color: var(--muted); }
.cal .is-today .day { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--orange); color: var(--navy-night); font-weight: 600; }
.chip { display: block; margin-top: 5px; padding: 3px 8px; border-radius: 6px; font-size: .76rem; font-weight: 500; line-height: 1.45;
  background: var(--info-soft); color: var(--link); border-inline-start: 3px solid var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.is-hot { background: var(--orange-soft); color: var(--orange-text); border-color: var(--orange); }
.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: 1.05rem; }

/* ---------- runs ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700; }
.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 ---------- */
.chart-box { position: relative; height: 260px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-art { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; inset-inline-start: -70px; bottom: -80px; width: 380px; height: 380px;
  background: url("brand/mark.svg") center / contain no-repeat; opacity: .12; pointer-events: none; }
.login-art > * { position: relative; z-index: 1; }
.login-art img { width: 210px; margin-inline-start: -18px; }
.login-logo { display: none; width: 190px; }
.login-art h1 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); font-weight: 300; line-height: 1.55; max-width: 16ch; }
.login-art h1 b { font-weight: 700; color: var(--orange); }
.login-art p { color: #b9cde3; max-width: 40ch; }
.login-form { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(100%, 380px); display: grid; gap: 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .brand { padding: 0; flex: 1; }
  .brand img { width: 132px; margin-block: -12px; }
  .brand-sub { display: none; }
  .menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #fff; font-size: 1.3rem; cursor: pointer; }
  .side-menu { display: none; width: 100%; padding-top: 12px; }
  .side.is-open .side-menu { display: block; }
  .nav a[aria-current="page"]::before { inset-inline-start: 0; }
  .side-foot { margin-top: 12px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .feature { grid-template-columns: minmax(0, 1fr); padding: 22px; }
  .feature-side { flex-direction: row; align-items: center; justify-content: flex-start; }
  .row-item { grid-template-columns: auto minmax(0, 1fr); }
  .row-item .runway { grid-column: 1 / -1; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .login-logo { display: block; margin-inline-start: -14px; }
  .detail-head { grid-template-columns: minmax(0, 1fr); }
  .detail-score { flex-direction: row; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .main { padding: 20px 16px 48px; }
  .panel-body { padding: 16px; }
  .panel-head { padding: 14px 16px; }
  .row-item { padding: 14px 16px; }
  .col-agency, .th-agency { display: none; }
  .two { grid-template-columns: 1fr; }
  .page-title { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* dates/numbers read left-to-right inside RTL text */
.fact dd.mono, .runway-date, td.mono { direction: ltr; unicode-bidi: isolate; 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: 38px; height: 38px; border-radius: 10px; margin-bottom: 10px;
  background: var(--orange-soft); color: var(--orange-text); font-size: 1.15rem; }
.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: 12px 14px;
  border: 1px solid var(--line); border-inline-start: 4px solid var(--orange); border-radius: 10px; 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: 18px 0 0; }
.stats > div { padding: 10px 14px; border-inline-start: 1px solid var(--line); }
.stats > div:first-child { border-inline-start: 0; padding-inline-start: 0; }
.stats dt { font-size: .78rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.45rem; font-weight: 600; }
.segmented .seg-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; font-size: .86rem; font-weight: 600; color: var(--muted); }
.segmented .seg-link:hover { text-decoration: none; color: var(--ink); }
.segmented .seg-link.is-on { background: var(--navy); color: #fff; }
.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; }
}
.section-head { flex-wrap: wrap; }
.segmented { max-width: 100%; overflow-x: auto; }
.segmented .seg-link, .segmented span { white-space: nowrap; }
.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; }
.table-wrap { position: relative; }

/* ---------- users & account ---------- */
.me { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 10px; border-radius: 10px; color: #d7e4f2; }
.me:hover, .me[aria-current="page"] { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.me b { display: block; font-size: .9rem; line-height: 1.3; }
.me small { color: var(--orange); font-size: .75rem; }
.avatar { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--orange); color: var(--navy-night); font-weight: 700; }
.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(--navy); background: var(--info-soft); }
.role-opt input { margin-top: 5px; accent-color: var(--navy); }
.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) auto; gap: 8px 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 .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: 14px; flex-wrap: wrap; padding: 18px; border: 2px dashed var(--line-strong);
  border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--orange); background: var(--orange-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone > i { font-size: 1.8rem; color: var(--orange-text); }
.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(0, 26, 51, .55); }
dialog.preview::backdrop { background: rgba(0, 26, 51, .55); }
#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-family: var(--mono); 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; } }
