:root {
  --navy: #1F3A4D; --navy-2: #2C5068; --ink: #1D2328; --muted: #6B7076; --line: #DDD8D0;
  --paper: #F6F3EE; --card: #FFFFFF; --accent: #B8862B; --ok: #2E7D5B; --warn: #B7791F; --bad: #B23A3A; --info: #3B6EA8;
  --radius: 10px; --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
[dir="rtl"] body, [dir="rtl"] { font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif; }
a { color: var(--info); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 6px; } h2 { font-size: 17px; font-weight: 600; margin: 18px 0 8px; } h3 { font-size: 15px; font-weight: 600; margin: 12px 0 6px; }
p { margin: 0 0 8px; } small, .muted { color: var(--muted); }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* layout */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #E8EEF2; padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 600; font-size: 17px; letter-spacing: .3px; margin-bottom: 14px; color: #fff; }
.brand small { display: block; color: #A9BCC9; font-weight: 400; font-size: 12px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 8px; color: #D7E1E8; font-weight: 500; }
.nav a:hover { background: var(--navy-2); text-decoration: none; }
.nav a.active { background: #fff; color: var(--navy); }
.nav .pill { background: var(--accent); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.nav a.active .pill { background: var(--navy); }
.side .foot { margin-top: auto; font-size: 12px; color: #A9BCC9; }
.side .foot button { width: 100%; margin-top: 8px; }
.main { padding: 22px 26px 60px; max-width: 1240px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; padding: 6px; gap: 0; overflow-x: auto; z-index: 5; }
  .brand, .side .foot { display: none; }
  .nav { display: flex; gap: 2px; width: 100%; }
  .nav a { flex-direction: column; font-size: 11px; padding: 6px 8px; gap: 2px; white-space: nowrap; }
  .main { padding: 14px 12px 90px; }
}

/* cards, grids */
.grid { display: grid; gap: 12px; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .card { padding: 12px 14px; } .kpi .n { font-size: 26px; font-weight: 600; line-height: 1.1; } .kpi .l { font-size: 12px; color: var(--muted); }
.kpi .card.bad .n { color: var(--bad); } .kpi .card.warn .n { color: var(--warn); } .kpi .card.ok .n { color: var(--ok); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { font-weight: 500; } .row .s { font-size: 13px; color: var(--muted); }

/* badges */
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #EEE9E0; color: var(--ink); vertical-align: middle; }
.badge.est { background: #FBEFD9; color: #7A4E00; } .badge.conf { background: #DDF1E6; color: #1E5C41; }
.badge.go { background: #DDF1E6; color: #1E5C41; } .badge.no_bid { background: #F6DADA; color: #7A1F1F; } .badge.watch { background: #E2ECF7; color: #24476F; } .badge.pending { background: #FBEFD9; color: #7A4E00; } .badge.discuss { background: #FBEFD9; color: #7A4E00; }
.badge.Confirmed { background: #DDF1E6; color: #1E5C41; } .badge.Likely { background: #E2ECF7; color: #24476F; } .badge.Unverified { background: #EEE9E0; color: #5A554C; }
.badge.radar { background: #EAE3F5; color: #4B2E83; }
.badge.approved { background: #DDF1E6; color: #1E5C41; } .badge.retired { background: #EEE9E0; color: #5A554C; }
.due-bad { color: var(--bad); font-weight: 600; } .due-warn { color: var(--warn); font-weight: 600; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #F1EDE6; font-weight: 600; font-size: 12px; text-transform: none; color: #3F4750; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #FBF9F5; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.wrap { overflow-x: auto; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; }
.col { background: #F1EDE6; border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col h3 { margin: 4px 4px 8px; font-size: 13px; display: flex; justify-content: space-between; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.kcard:hover { border-color: var(--navy-2); }
.kcard .a { color: var(--muted); font-size: 12px; } .kcard .v { margin-top: 4px; display: flex; justify-content: space-between; align-items: center; }

/* inbox cards */
.tcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; border-inline-start: 4px solid var(--accent); }
.tcard.gcc { border-inline-start-color: var(--info); }
.tcard .head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tcard .meta { font-size: 13px; color: var(--muted); margin: 4px 0 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.tcard .kill { background: #FBEFD9; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0; }
.tcard .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.stars { color: var(--accent); letter-spacing: 1px; }

/* score panel */
.score { display: grid; gap: 10px; }
.score .c { display: grid; grid-template-columns: 1fr 60px; gap: 8px; align-items: center; }
.score .c .lbl { font-weight: 500; } .score .c .hint { font-size: 12px; color: var(--muted); }
.score input[type=range] { width: 100%; }
.score .total { font-size: 22px; font-weight: 600; }

/* forms */
button, .btn { font: inherit; font-size: 14px; font-weight: 500; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--navy-2); }
button.primary { background: var(--navy); color: #fff; border-color: var(--navy); } button.primary:hover { background: var(--navy-2); }
button.ok { background: var(--ok); color: #fff; border-color: var(--ok); } button.bad { background: #fff; color: var(--bad); border-color: var(--bad); } button.warn { background: #fff; color: var(--warn); border-color: var(--warn); }
button.sm { padding: 4px 9px; font-size: 13px; } button.link { border: 0; background: none; color: var(--info); padding: 0; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9DB8CC; outline-offset: 0; border-color: var(--navy-2); }
label { display: block; font-size: 12px; color: #3F4750; font-weight: 600; margin-bottom: 3px; }
.f { margin-bottom: 10px; } .f .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; } .filters input, .filters select { width: auto; min-width: 140px; }
dialog { border: 0; border-radius: 14px; padding: 0; width: min(720px, 94vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,30,40,.45); }
.mhead { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.mbody { padding: 16px 18px; max-height: 70vh; overflow: auto; } .mfoot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--bad); font-size: 13px; margin-top: 6px; }
.toast { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; }
[dir="rtl"] .toast { transform: translateX(50%); }
.toast.bad { background: var(--bad); }
@media (max-width: 860px) { .toast { bottom: 76px; } }
a.back::before { content: "\2190\00a0"; } [dir="rtl"] a.back::before { content: "\2192\00a0"; }
.offline { background: #FBEFD9; color: #7A4E00; padding: 6px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
pre.md { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-height: 60vh; overflow: auto; }
.login { max-width: 380px; margin: 12vh auto; }
.login .card { padding: 24px; }
.tabs { display: flex; gap: 6px; margin: 10px 0 12px; flex-wrap: wrap; } .tabs button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.sim { background: #FBEFD9; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 6px 0; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); margin: 2px 2px 2px 0; background: #fff; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; font-size: 14px; } .dl dt { color: var(--muted); } .dl dd { margin: 0; }
