/* Top Corner — demo admin
   Layout: fixed sidebar on the start side (right in Arabic), slim top bar, fluid content.
   One signature element: the spend-vs-progress gauge used on every project. */

@font-face { font-family: "Tajawal"; font-weight: 300; font-display: swap; src: url("../fonts/tajawal-arabic-300-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url("../fonts/tajawal-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url("../fonts/tajawal-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url("../fonts/tajawal-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url("../fonts/tajawal-arabic-800-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "Tajawal"; font-weight: 300; font-display: swap; src: url("../fonts/tajawal-latin-300-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap; src: url("../fonts/tajawal-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap; src: url("../fonts/tajawal-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap; src: url("../fonts/tajawal-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }
@font-face { font-family: "Tajawal"; font-weight: 800; font-display: swap; src: url("../fonts/tajawal-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-21FF; }

:root {
  /* surfaces */
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --line: #e1e4de;
  --line-soft: #eceee9;
  /* text */
  --ink: #1b2225;
  --ink-2: #485256;
  --muted: #7a8381;
  /* brand: brass from the logo */
  --brass: #94701f;
  --brass-500: #b38c3c;
  --brass-soft: #f4ecdb;
  --brass-line: #e6d6b3;
  /* sidebar */
  --night: #1d2528;
  --night-2: #263034;
  --night-line: #323d41;
  --night-text: #c5ccc9;
  --night-muted: #87918e;
  /* states */
  --ok: #2b7654; --ok-soft: #e4f1ea;
  --warn: #a2650c; --warn-soft: #fbf0dc;
  --bad: #b1412b; --bad-soft: #f8e7e2;
  --info: #2c6386; --info-soft: #e3eef5;
  --idle: #6c7573; --idle-soft: #eef0ed;

  --font: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --side: 268px;
  --top: 64px;
  --shadow-pop: 0 12px 32px -8px rgba(20, 28, 31, .22), 0 2px 6px rgba(20, 28, 31, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass-500); outline-offset: 2px; border-radius: 4px; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.strong { font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- icons ---------- */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 15px; height: 15px; }
.i-lg { width: 22px; height: 22px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--night); color: var(--night-text);
  display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--night-line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 14px 20px 12px; border-bottom: 1px solid var(--night-line); }
.brand img { width: 46px; height: auto; }
.brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name b { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand-name span { color: var(--night-muted); font-size: 12.5px; }
.nav { flex: 1; overflow-y: auto; padding: 12px 12px 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--night-line) transparent; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group h6 { margin: 0 0 2px; padding-inline: 10px; font-size: 12px; font-weight: 500; color: var(--night-muted); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 10px; border-radius: 8px;
  color: var(--night-text); font-size: 14.5px; font-weight: 500;
  position: relative;
}
.nav a:hover { background: var(--night-2); color: #fff; }
.nav a.active { background: var(--night-2); color: #fff; }
.nav a.active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brass-500);
}
[dir="rtl"] .nav a.active::before { border-radius: 3px 0 0 3px; }
.nav a .i { color: var(--night-muted); }
.nav a.active .i, .nav a:hover .i { color: var(--brass-500); }
.nav .count { margin-inline-start: auto; font-size: 12px; background: var(--night-line); color: #fff; padding: 0 7px; border-radius: 99px; line-height: 20px; }
.nav .count.hot { background: var(--brass-500); color: var(--night); font-weight: 700; }
.side-foot { padding: 10px 14px; border-top: 1px solid var(--night-line); display: flex; align-items: center; gap: 10px; font-size: 13px; }
.side-foot .branch-pick { flex: 1; background: var(--night-2); border: 1px solid var(--night-line); color: #fff; border-radius: 8px; padding: 7px 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top);
  display: flex; align-items: center; gap: 12px;
  padding-inline: 28px;
  background: rgba(243, 244, 241, .92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.search {
  flex: 1; max-width: 460px; position: relative; display: flex; align-items: center;
}
.search .i { position: absolute; inset-inline-start: 12px; color: var(--muted); }
.search input {
  width: 100%; height: 40px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  padding-inline: 38px 54px;
}
.search kbd { position: absolute; inset-inline-end: 10px; font: 12px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; background: var(--surface-2); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 99px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; color: var(--ink-2); position: relative;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.icon-btn .dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; border-radius: 99px; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
.lang-btn { height: 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); padding-inline: 14px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.lang-btn:hover { border-color: var(--brass-line); color: var(--brass); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
[dir="rtl"] .user-chip { padding: 4px 12px 4px 4px; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip .who b { font-size: 13.5px; }
.user-chip .who span { font-size: 12px; color: var(--muted); }

.content { padding: 26px 28px 56px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a:hover { color: var(--brass); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  height: 40px; padding-inline: 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: #cdd1ca; background: var(--surface-2); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2b3438; border-color: #2b3438; }
.btn-brass { background: var(--brass); border-color: var(--brass); color: #fff; }
.btn-brass:hover { background: #83621a; border-color: #83621a; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); border-color: var(--line); }
.btn-sm { height: 32px; padding-inline: 11px; font-size: 13px; border-radius: 7px; }
.btn-danger { color: var(--bad); }
.link { color: var(--brass); font-weight: 700; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-head .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-main-r { grid-template-columns: minmax(0, 1fr) minmax(320px, .55fr); }

/* ---------- figures strip (dashboard, page summaries) ---------- */
.figures { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.figure { padding: 18px 22px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.figure + .figure { border-inline-start: 1px solid var(--line-soft); }
.figure .label { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.figure .value { font-size: 26px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.figure .value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.figure .note { font-size: 13px; color: var(--ink-2); }
.figure .note.up { color: var(--ok); }
.figure .note.down { color: var(--bad); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding-inline: 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--idle-soft); color: var(--idle); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.chip.plain::before { display: none; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.brass { background: var(--brass-soft); color: var(--brass); }
.tag { display: inline-flex; align-items: center; height: 22px; padding-inline: 8px; border-radius: 6px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }

/* ---------- tables ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.toolbar .filter-search { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .filter-search .i { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .filter-search input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding-inline: 34px 12px; background: var(--surface-2); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 28px; padding-inline: 11px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button .n { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(20,28,31,.08), 0 0 0 1px var(--line); }
.select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding-inline: 10px; background: var(--surface-2); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover td { background: #fafbf8; }
.tbl th:first-child, .tbl td:first-child { padding-inline-start: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-inline-end: 20px; }
.tbl td.num, .tbl th.num { text-align: end; white-space: nowrap; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.cell-title { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.cell-title b { font-weight: 700; }
.cell-title span { font-size: 12.5px; color: var(--muted); }
.code { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }

/* ---------- avatar ---------- */
.av { width: 32px; height: 32px; border-radius: 99px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--brass-soft); border: 1px solid var(--brass-line); flex: none; }
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.dark { background: var(--brass-500); color: var(--night); border-color: transparent; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stack { display: flex; }
.stack .av { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); margin-inline-start: -8px; }
.stack .av:first-child { margin-inline-start: 0; }

/* ---------- gauge: spend vs progress ---------- */
.gauge { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.gauge-track { position: relative; height: 10px; border-radius: 99px; background: var(--line-soft); }
.gauge-track::after { /* budget line at 100% of the budget zone */
  content: ""; position: absolute; top: -4px; bottom: -4px; inset-inline-start: var(--cap); width: 0;
  border-inline-start: 1.5px dashed var(--ink-2); opacity: .55;
}
.gauge-fill { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: var(--spent); border-radius: 99px; background: var(--brass-500); }
.gauge.over .gauge-fill { background: linear-gradient(to var(--end), var(--brass-500) 0, var(--brass-500) var(--capPct), var(--bad) var(--capPct)); }
[dir="rtl"] .gauge { --end: left; }
[dir="ltr"] .gauge { --end: right; }
.gauge-mark { position: absolute; top: 50%; inset-inline-start: var(--prog); width: 12px; height: 12px; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 3px; transform: translate(50%, -50%) rotate(45deg); }
[dir="ltr"] .gauge-mark { transform: translate(-50%, -50%) rotate(45deg); }
.gauge-legend { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge-legend b { color: var(--ink); font-weight: 700; }
.gauge.over .gauge-legend .spent b { color: var(--bad); }
.gauge.lg .gauge-track { height: 14px; }
.gauge.lg .gauge-mark { width: 16px; height: 16px; }
.gauge.lg .gauge-legend { font-size: 13.5px; }
.gauge-key { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.gauge-key span { display: inline-flex; align-items: center; gap: 6px; }
.gauge-key .k-spent { width: 14px; height: 6px; border-radius: 9px; background: var(--brass-500); }
.gauge-key .k-prog { width: 9px; height: 9px; border: 2px solid var(--ink); transform: rotate(45deg); border-radius: 2px; }
.gauge-key .k-cap { width: 0; height: 12px; border-inline-start: 1.5px dashed var(--ink-2); }

/* plain progress bar */
.bar { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--ink-2); }
.bar.ok > span { background: var(--ok); }
.bar.brass > span { background: var(--brass-500); }
.pct { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 36px; text-align: end; }
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row .bar { flex: 1; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 12px 14px; font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs button .n { font-size: 12px; background: var(--line-soft); color: var(--ink-2); border-radius: 99px; padding: 0 7px; line-height: 19px; font-variant-numeric: tabular-nums; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--brass-500); }
.tabs button.on .n { background: var(--brass-soft); color: var(--brass); }

/* ---------- project hero ---------- */
.p-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.p-hero-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 22px 24px 18px; align-items: start; }
.p-hero h1 { margin: 2px 0 6px; font-size: 24px; font-weight: 800; line-height: 1.35; }
.p-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; }
.p-meta span { display: inline-flex; align-items: center; gap: 6px; }
.p-meta .i { color: var(--muted); }
.p-hero-stats { display: grid; grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.p-hero-stats > div { padding: 16px 24px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.p-hero-stats > div + div { border-inline-start: 1px solid var(--line-soft); }
.p-hero-stats .label { font-size: 13px; color: var(--muted); }
.p-hero-stats .value { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.p-hero-stats .value small { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ---------- definition list ---------- */
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }

/* ---------- timeline (visits, log) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline > li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; position: relative; padding-bottom: 20px; }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; inset-inline-start: 16px; top: 34px; bottom: 0; border-inline-start: 1px solid var(--line); }
.timeline > li:last-child::before { display: none; }
.tl-ico { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.tl-ico.brass { background: var(--brass-soft); border-color: var(--brass-line); color: var(--brass); }
.tl-ico.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tl-body { min-width: 0; padding-top: 5px; }
.tl-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.tl-head b { font-weight: 700; }
.tl-head time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-body p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.tl-foot { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); }
.photos { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.photo { width: 68px; height: 52px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--muted); position: relative; overflow: hidden; }
.photo svg { width: 100%; height: 100%; }

/* ---------- task list ---------- */
.tasks { display: flex; flex-direction: column; }
.task { display: grid; grid-template-columns: 26px minmax(0, 1fr) 150px 120px 110px; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.task:last-child { border-bottom: 0; }
.task-check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid #c6cbc3; display: grid; place-items: center; background: var(--surface); }
.task.done .task-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.doing .task-check { border-color: var(--brass-500); background: var(--brass-soft); }
.task.doing .task-check::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--brass-500); }
.task.done .t-name { color: var(--ink-2); }
.task .t-name b { font-weight: 700; display: block; }
.task .t-name span { font-size: 12.5px; color: var(--muted); }
.task .late { color: var(--bad); font-weight: 700; }

/* ---------- kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #eceee9; border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; }
.col-head b { font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.col-head .sum { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-head .swatch { width: 9px; height: 9px; border-radius: 99px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.card:hover { border-color: #ccd1c9; }
.card h4 { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- lists in panels ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .end { margin-inline-start: auto; text-align: end; flex: none; }
.alert-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alert-ico.bad { background: var(--bad-soft); color: var(--bad); }
.alert-ico.warn { background: var(--warn-soft); color: var(--warn); }
.alert-ico.info { background: var(--info-soft); color: var(--info); }
.alert-ico.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 12px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 8px; border-radius: 3px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 130px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13.5px; }
.hbar .track { height: 10px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--ink-2); border-radius: 99px; }
.hbar .v { text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.input, .field select, .field textarea {
  height: 42px; border: 1px solid var(--line); border-radius: 8px; padding-inline: 12px; background: var(--surface); width: 100%;
}
.field textarea { height: auto; min-height: 84px; padding-block: 10px; resize: vertical; }
.input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brass-500); box-shadow: 0 0 0 3px var(--brass-soft); }
.upload { border: 1.5px dashed #cdd2ca; border-radius: 10px; padding: 18px; display: flex; align-items: center; gap: 12px; color: var(--ink-2); background: var(--surface-2); font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ---------- modal / drawer / popover ---------- */
.overlay { position: fixed; inset: 0; background: rgba(22, 29, 32, .42); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-pop); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: 60; overflow: hidden; }
.pop-head { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.pop-head b { font-size: 15px; }
.pop .list > li { padding: 12px 18px; align-items: flex-start; }
.pop .list p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.pop .list time { font-size: 12px; color: var(--muted); }

.toast-wrap { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
[dir="rtl"] .toast-wrap { transform: translateX(50%); }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; display: flex; align-items: center; gap: 10px; font-weight: 500; box-shadow: var(--shadow-pop); animation: toast-in .22s ease-out; }
.toast .i { color: #8fd3ad; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- document / quotation sheet ---------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 34px 38px; display: flex; flex-direction: column; gap: 22px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 20px; border-bottom: 2px solid var(--brass-500); }
.sheet-head img { width: 92px; }
.sheet-head .co { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-2); }
.sheet-head .co b { color: var(--ink); font-size: 15px; }
.sheet-title { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: end; }
.sheet-title h2 { margin: 0; font-size: 22px; font-weight: 800; }
.sheet .parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; font-size: 14px; }
.sheet .parties h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.totals { margin-inline-start: auto; width: min(340px, 100%); display: flex; flex-direction: column; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.totals div:last-child { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 800; font-size: 16px; padding-top: 10px; margin-top: 4px; }
.terms { font-size: 13.5px; color: var(--ink-2); margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- misc ---------- */
.section-title { font-size: 15px; font-weight: 700; margin: 0; }
.stat-inline { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-inline div { display: flex; flex-direction: column; }
.stat-inline span { font-size: 12.5px; color: var(--muted); }
.stat-inline b { font-size: 17px; font-variant-numeric: tabular-nums; }
.diff-up { color: var(--bad); font-weight: 700; }
.diff-down { color: var(--ok); font-weight: 700; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--brass-soft); border: 1px solid var(--brass-line); font-size: 14px; }
.callout.bad { background: var(--bad-soft); border-color: #efcdc4; }
.callout.ok { background: var(--ok-soft); border-color: #c9e3d4; }
.callout .i { margin-top: 2px; flex: none; }
.perm-grid { display: grid; grid-template-columns: minmax(160px, 1fr) repeat(5, 74px); }
.perm-grid > div { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; font-size: 14px; }
.perm-grid > div.c { justify-content: center; }
.perm-grid .h { font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.tick { width: 20px; height: 20px; border-radius: 6px; background: var(--ok); color: #fff; display: grid; place-items: center; }
.tick.off { background: var(--line-soft); color: var(--muted); }
.steps-line { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 2px; }
.step { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13.5px; color: var(--muted); }
.step .dotx { width: 24px; height: 24px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.step.done { color: var(--ink-2); }
.step.done .dotx { background: var(--ink); border-color: var(--ink); color: #fff; }
.step.now { color: var(--ink); font-weight: 700; }
.step.now .dotx { background: var(--brass-500); border-color: var(--brass-500); color: #fff; }
.step-sep { flex: 1; min-width: 22px; height: 1.5px; background: var(--line); margin-inline: 10px; }
.step-sep.done { background: var(--ink); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.login-art {
  position: relative; overflow: hidden; background: var(--night); color: var(--night-text);
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px 52px;
}
.login-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-art > * { position: relative; }
.login-art .mark-big { width: min(300px, 60%); filter: drop-shadow(0 10px 30px rgba(0,0,0,.35)); }
.login-art h2 { margin: 26px 0 8px; color: #fff; font-size: 30px; font-weight: 800; line-height: 1.35; max-width: 18ch; }
.login-art p { margin: 0; max-width: 42ch; color: var(--night-text); font-size: 15.5px; }
.login-art .facts { display: flex; gap: 34px; flex-wrap: wrap; border-top: 1px solid var(--night-line); padding-top: 22px; }
.login-art .facts div { display: flex; flex-direction: column; }
.login-art .facts b { color: #fff; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.login-art .facts span { font-size: 13px; color: var(--night-muted); }
.login-form-side { display: flex; flex-direction: column; padding: 28px 36px; background: var(--surface); }
.login-top { display: flex; justify-content: space-between; align-items: center; }
.login-form { margin: auto; width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; padding-block: 30px; }
.login-form h1 { margin: 0; font-size: 28px; font-weight: 800; }
.login-form .lead { margin: -8px 0 6px; color: var(--muted); }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-inline-end: 44px; }
.pass-wrap button { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; }
.login-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }
.demo-creds { border: 1px dashed var(--brass-line); background: #fbf8f1; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.demo-creds code { font-family: var(--font); font-weight: 700; direction: ltr; unicode-bidi: isolate; }
.login-foot { font-size: 12.5px; color: var(--muted); text-align: center; }
.err { color: var(--bad); font-size: 13.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g-main, .g-main-r { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task { grid-template-columns: 26px minmax(0, 1fr) 120px 100px; }
  .task .t-owner { display: none; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 90; transform: translateX(100%); transition: transform .22s ease; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none !important; }
  .icon-btn.menu-btn { display: grid; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { border-inline-start: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .p-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-hero-stats > div:nth-child(3) { border-inline-start: 0; }
  .p-hero-stats > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .user-chip .who { display: none; }
}
@media (max-width: 700px) {
  .table-wrap .tbl { min-width: 760px; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding-inline: 12px; }
  .search kbd { display: none; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .p-hero-top { grid-template-columns: minmax(0, 1fr); }
  .task { grid-template-columns: 26px minmax(0, 1fr) 90px; }
  .task .t-date { display: none; }
  .sheet { padding: 22px 18px; }
  .sheet .parties { grid-template-columns: minmax(0, 1fr); }
  .hbar { grid-template-columns: 96px minmax(0, 1fr) 70px; }
  .lang-btn { padding-inline: 10px; }
  .login-form-side { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
