/* almutawaa.ai identity: tokens.css from the owner's brand folder. Fonts are self-hosted because of the CSP. */
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap; src: url(fonts/plex-arabic-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+20AC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap; src: url(fonts/plex-arabic-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+20AC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap; src: url(fonts/plex-arabic-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2010-2027, U+20AC; }
@font-face { font-family: "Playfair Display"; font-weight: 400; font-display: swap; src: url(fonts/playfair-latin-400.woff2) format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 400; font-display: swap; src: url(fonts/cinzel-latin-400.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --navy-950: #070C18; --navy-900: #0E1930; --navy-800: #1B2C52; --navy-700: #24365F;
  --gold-100: #F6DFA0; --gold-500: #D4AF37;
  --bg: var(--navy-900); --surface: var(--navy-800); --surface-2: var(--navy-700);
  --border: rgba(212, 175, 55, .35); --border-soft: rgba(212, 175, 55, .18); --control: rgba(242, 234, 218, .22); --line: rgba(242, 234, 218, .12);
  --ink: #F2EADA; --ink-2: #C4CBD6; --ink-3: #A9B3C2;
  --accent: var(--gold-500); --accent-ink: var(--navy-950); --chart: var(--gold-500); --grid: rgba(242, 234, 218, .12);
  --good: #8FC9A5; --good-bg: #1E3F3E; --warn: #F0A868; --warn-bg: #4A3A28;
  --bad: #F2A79B; --bad-bg: #4B2B38; --mute-bg: #2B3F6E;
  /* Chart marks, checked with the palette validator against the card surface. */
  --s-run: #3FA877; --s-done: #4F93E0; --s-wip: #B08A1F; --s-plan: #A77BD0; --s-stop: #D9594C;
  --radius: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--navy-950); scrollbar-gutter: stable; }
.ico { width: 20px; height: 20px; flex: none; }
.long { display: inline; } .short { display: none; }
.topbar { display: none; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 30% 35%, var(--navy-800) 0%, var(--navy-900) 55%, var(--navy-950) 100%) fixed; color: var(--ink); font: 15px/1.6 "IBM Plex Sans Arabic", -apple-system, "Segoe UI", Tahoma, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
a { color: var(--accent); }
bdi.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; direction: ltr; }
.muted { color: var(--ink-3); font-size: 13px; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy-950); border-inline-end: 1px solid var(--border); padding: 20px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; direction: ltr; justify-content: flex-end; }
.brand img { width: 40px; height: 40px; flex: none; }
.wordmark { display: grid; line-height: 1.1; text-align: start; }
.wordmark b { font: 400 20px/1.15 "Playfair Display", Georgia, serif; letter-spacing: .5px; color: var(--ink); }
.wordmark i { font: 400 10px/1.3 "Cinzel", serif; letter-spacing: 4px; color: var(--accent); }
.login-logo { display: grid; justify-items: center; gap: 10px; }
.login-logo img { width: 92px; height: 92px; }
.login-logo .wordmark { justify-items: center; direction: ltr; }
.login-logo .wordmark b { font-size: 32px; }
.login-logo .wordmark i { font-size: 12px; letter-spacing: 6px; }
.login h1 { text-align: center; font-size: 17px; font-weight: 600; color: var(--ink-2); }
.navs { display: grid; gap: 4px; }
.side a.nav { display: flex; gap: 10px; align-items: center; color: var(--ink-2); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
.side a.nav:hover { background: var(--surface-2); }
.side a.nav.on { background: var(--surface-2); color: var(--gold-100); font-weight: 600; }
.badge { margin-inline-start: auto; background: var(--bad); color: var(--navy-950); border-radius: 99px; font-size: 12px; min-width: 20px; text-align: center; padding: 0 6px; }
.side .foot { margin-top: auto; padding: 0 12px; display: grid; gap: 8px; }
main { padding: 24px; max-width: 1280px; width: 100%; margin-inline: auto; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; min-height: 44px; }

.grid { display: grid; gap: 14px; }
.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); margin-bottom: 14px; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card + .card.block, .block { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.tile .value bdi.num { font-variant-numeric: normal; }
.tile .sub { color: var(--ink-3); font-size: 13px; }
.tile-meter { margin-top: 8px; }

button, .btn { font: inherit; border: 1px solid var(--control); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; min-height: 36px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.danger { color: var(--bad); }
button.icon { padding: 4px 8px; min-width: 36px; justify-content: center; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--navy-900); border: 1px solid var(--control); border-radius: 8px; padding: 6px 9px; width: 100%; min-height: 36px; }
textarea { min-height: 90px; resize: vertical; }
input[type=checkbox] { width: 18px; min-height: 18px; height: 18px; accent-color: var(--accent); }
input[type=number], input[type=date], input[type=url] { direction: ltr; text-align: start; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 9px; border-radius: 99px; font-size: 13px; line-height: 24px; white-space: nowrap; background: var(--mute-bg); color: var(--ink-2); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.projects { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pcard { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; }
.pcard:hover { border-color: var(--accent); }
.pcard .title { font-weight: 700; font-size: 16px; }
.meta { color: var(--ink-2); font-size: 13px; display: grid; gap: 2px; }
.meter { height: 6px; background: var(--mute-bg); border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--chart); border-radius: 99px; }
.meter-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; font-size: 13px; }

.list { display: grid; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .acts { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.empty { color: var(--ink-3); padding: 10px 0; }
.alert { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.alert:first-child { border-top: 0; }
.alert .grow { overflow-wrap: anywhere; }

.items { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.item-add { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 10px; }
.kind { width: auto; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button.on { background: var(--surface-2); border-color: var(--ink-3); font-weight: 600; }

.table-wrap { overflow-x: auto; container-type: inline-size; }
table.stack td:first-child { min-width: 130px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; color: var(--ink-2); font-size: 13px; font-weight: 600; white-space: nowrap; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
td.narrow { width: 1%; white-space: nowrap; }
td input, td select { min-width: 84px; }
.check-cell { text-align: center; }
.total td { font-weight: 700; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.note { color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.rates { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.rates label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); max-width: 170px; }

.chart-plot { position: relative; height: 200px; margin-top: 26px; }
.gridline { position: absolute; inset-inline: 0; border-top: 1px solid var(--grid); }
.gridline span { position: absolute; inset-inline-start: 0; top: -9px; font-size: 12px; color: var(--ink-3); background: var(--surface); padding-inline-end: 6px; }
.columns { position: absolute; inset: 0; padding-inline-start: 56px; display: flex; align-items: flex-end; gap: 2px; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; border: 0; background: none; padding: 0; min-height: 0; min-width: 0; border-radius: 0; cursor: default; }
.col:hover { background: none; }
.bar { width: 100%; max-width: 20px; background: var(--chart); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bar.zero { background: var(--grid); }
.peak { position: absolute; bottom: 100%; inset-inline: -24px; text-align: center; font-size: 12px; color: var(--ink); padding-bottom: 2px; }
.tip { position: absolute; bottom: calc(100% - 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 6px 9px; border-radius: 8px; font-size: 12px; width: max-content; max-width: 220px; display: none; z-index: 4; text-align: start; line-height: 1.5; }
.tip.edge-right { left: auto; right: 0; transform: none; }
.tip.edge-left { left: 0; transform: none; }
.col:hover .tip, .col:focus .tip { display: block; }
.x-labels { display: flex; gap: 2px; padding-inline-start: 56px; margin-top: 4px; }
.x-labels span { flex: 1; text-align: center; font-size: 12px; color: var(--ink-3); line-height: 1.25; min-width: 0; }
details summary { cursor: pointer; color: var(--ink-2); font-size: 13px; margin-top: 12px; }
.bars { display: grid; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; }
.hbar-top > :first-child { min-width: 0; overflow-wrap: anywhere; }
.hbar-val { white-space: nowrap; }
.track { height: 8px; background: var(--mute-bg); border-radius: 4px; overflow: hidden; position: relative; }
.fill { height: 100%; background: var(--chart); border-radius: 4px; min-width: 2px; }
.fill.warn { background: var(--s-wip); } .fill.bad { background: var(--s-stop); }
.track.div::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--ink-3); }
.fill.gain, .fill.loss { position: absolute; top: 0; }
.fill.gain { left: 50%; background: var(--s-run); border-radius: 0 4px 4px 0; }
.fill.loss { right: 50%; background: var(--s-stop); border-radius: 4px 0 0 4px; }

.seg-wrap + .seg-wrap { margin-top: 20px; }
.seg-title { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.seg { display: flex; gap: 2px; height: 28px; }
.part { flex: 1 1 0; min-width: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--navy-950); }
.part:first-child { border-start-start-radius: 4px; border-end-start-radius: 4px; }
.part:last-child { border-start-end-radius: 4px; border-end-end-radius: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.s-run { background: var(--s-run); } .s-done { background: var(--s-done); } .s-wip { background: var(--s-wip); } .s-plan { background: var(--s-plan); } .s-stop { background: var(--s-stop); }

.seg-toggle { display: inline-flex; border: 1px solid var(--control); border-radius: 8px; overflow: hidden; }
.seg-toggle button { border: 0; border-radius: 0; background: none; }
.seg-toggle button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board-col { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.board-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.board-head h2 { flex: 1; }
.board-tabs { display: none; }
.task-list { display: grid; gap: 10px; }
.task { background: var(--navy-900); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; margin-top: 2px; }
.task-acts { display: flex; gap: 6px; align-items: center; }
.task-acts select { flex: 1; min-width: 0; }
.task-list .task { grid-template-columns: minmax(0, 1fr) 300px; align-items: center; }
.row-acts { flex-wrap: nowrap; }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 18px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.fields { display: grid; gap: 10px; margin: 14px 0; }
.fields label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.fields label.check { grid-template-columns: auto 1fr; align-items: center; }
.dlg-acts { display: flex; gap: 8px; justify-content: flex-end; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); display: grid; gap: 12px; padding: 24px; }
.pw { position: relative; }
.pw input { padding-inline-end: 44px; }
.pw button { position: absolute; inset-inline-end: 2px; top: 2px; border: 0; background: none; min-height: 32px; }
.err { color: var(--bad); font-size: 14px; min-height: 22px; }
#toast { position: fixed; bottom: 18px; inset-inline-start: 16px; max-width: calc(100vw - 32px); background: var(--ink); color: var(--surface); padding: 9px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
#toast.show { opacity: 1; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  html { scrollbar-gutter: auto; }
  .layout { display: block; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; height: 56px; padding: 0 16px; background: var(--navy-950); border-bottom: 1px solid var(--border-soft); }
  .topbar .brand { padding: 0; }
  .topbar .brand img { width: 34px; height: 34px; }
  .side { position: fixed; inset: auto 0 0 0; z-index: 20; display: block; height: auto; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); border-inline-end: 0; border-top: 1px solid var(--border); }
  .side .brand, .side .foot { display: none; }
  .navs { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; }
  .side a.nav { position: relative; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 0; font-size: 10.5px; line-height: 1.2; text-align: center; }
  .long { display: none; } .short { display: inline; }
  .badge { position: absolute; top: 1px; inset-inline-end: 6px; margin: 0; font-size: 10px; min-width: 16px; line-height: 16px; padding: 0 4px; }
  main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; }
  .tile .value { font-size: 20px; }
  .tiles.t3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.t3 > :last-child { grid-column: 1 / -1; }
  .board { grid-template-columns: minmax(0, 1fr); }
  .board-col:not(.active) { display: none; }
  .board-head { display: none; }
  .board-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
  .board-tabs button { justify-content: center; padding-inline: 4px; }
  .board-tabs button.on { background: var(--surface-2); border-color: var(--accent); color: var(--gold-100); font-weight: 600; }
  .task-list .task { grid-template-columns: minmax(0, 1fr); }
  .row-acts { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .row { flex-wrap: wrap; }
  .row .grow { flex-basis: 100%; }
  .row .acts { margin-inline-start: auto; }
}
@media (max-width: 720px) {
  .chart-plot { height: 170px; }
  .columns, .x-labels { padding-inline-start: 46px; }
}

@container (max-width: 520px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
  table.stack td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: center; border: 0; padding: 5px 0; white-space: normal; min-width: 0; }
  table.stack td::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; }
  table.stack td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td.check-cell { text-align: start; }
}
@container (max-width: 860px) {
  table.stack.wide, table.stack.wide tbody, table.stack.wide tr, table.stack.wide td { display: block; width: 100%; }
  table.stack.wide thead { display: none; }
  table.stack.wide tr { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
  table.stack.wide td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; align-items: center; border: 0; padding: 5px 0; white-space: normal; min-width: 0; }
  table.stack.wide td::before { content: attr(data-label); color: var(--ink-2); font-size: 13px; }
  table.stack.wide td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  table.stack.wide td[data-label=""]::before { display: none; }
  table.stack.wide td.check-cell { text-align: start; }
}
