/* FlockWise design system.
   Brand: Midnight #0A2540 · Royal #1D4ED8 · Sea #0369A1 · Sky #38BDF8 · Baby #BAE6FD · Ice #F0F7FF · Readex Pro.
   Every layout rule uses logical properties (inline-start/end), so Arabic (RTL) mirrors automatically. */
:root {
  --midnight: #0A2540; --midnight-2: #0F2E57; --royal: #1D4ED8; --royal-dark: #1E3A8A; --sea: #0369A1;
  --sky: #38BDF8; --baby: #BAE6FD; --ice: #F0F7FF;
  --ink: #0A2540; --muted: #4A5672; --faint: #64718F;
  --line: #DCE2EF; --line-soft: #EBEFF7; --surface: #FFFFFF; --surface-soft: #F6F9FE;
  --wait: #1D4ED8; --wait-bg: #E3EBFD; /* status colours stay fixed whatever the brand */
  --good: #047857; --good-bg: #E7F6EF; --warn: #8A4B08; --warn-bg: #FEF3E2; --bad: #B42318; --bad-bg: #FDECEA;
  --radius: 10px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(10, 37, 64, .05), 0 4px 16px rgba(10, 37, 64, .05);
  --shadow-lg: 0 24px 60px rgba(6, 28, 61, .28);
  --sidebar: 252px;
  /* Tints derived from the brand colours (they follow Settings → Company identity). */
  --tint: color-mix(in srgb, var(--royal) 3%, #FFFFFF);
  --tint-2: color-mix(in srgb, var(--royal) 9%, #FFFFFF);
  --line-brand: color-mix(in srgb, var(--royal) 22%, #FFFFFF);
  --hover-line: color-mix(in srgb, var(--royal) 50%, #FFFFFF);
  --soft-accent: color-mix(in srgb, var(--royal) 42%, #FFFFFF);
  --sea-tint: color-mix(in srgb, var(--sea) 11%, #FFFFFF);
  --royal-a6: color-mix(in srgb, var(--royal) 6%, transparent);
  --royal-a15: color-mix(in srgb, var(--royal) 15%, transparent);
  --royal-a25: color-mix(in srgb, var(--royal) 25%, transparent);
  --sky-a14: color-mix(in srgb, var(--sky) 14%, transparent);
  --sky-a22: color-mix(in srgb, var(--sky) 22%, transparent);
  --deep: color-mix(in srgb, var(--midnight) 82%, #000000);
  --dark-a12: color-mix(in srgb, var(--midnight) 12%, transparent);
  --dark-a15: color-mix(in srgb, var(--midnight) 15%, transparent);
  --scrim: color-mix(in srgb, var(--deep) 45%, transparent);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Readex Pro', 'Segoe UI', Tahoma, system-ui, sans-serif; font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--ice); min-height: 100vh; }
a { color: var(--royal); text-decoration: none; }
a:hover { color: var(--royal-dark); text-decoration: underline; }
h1 { font-size: 24px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; } .hidden { display: none !important; } .end { text-align: end; } .center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }
[dir="rtl"] .logo-mark, [dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------------- app shell ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; flex: 0 0 var(--sidebar); width: var(--sidebar); display: flex; flex-direction: column; gap: 18px; padding: 18px 14px; overflow-y: auto; color: #DCE6F2;
  background: radial-gradient(120% 40% at 0% 0%, var(--sky-a14), transparent 60%), linear-gradient(180deg, var(--deep) 0%, var(--midnight) 60%, var(--midnight-2) 100%); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #FFFFFF; text-decoration: none; padding: 2px 8px; }
.brand:hover { color: #FFFFFF; text-decoration: none; }
.brand-word { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.brand-word span { color: var(--sky); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8EA3BD; padding: 0 10px 4px; }
[dir="rtl"] .nav-label { letter-spacing: 0; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 10px; color: #C9D5E4; font-weight: 500; text-decoration: none; }
.nav-link svg { flex: 0 0 18px; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; text-decoration: none; }
.nav-link.on { background: linear-gradient(90deg, var(--sky-a22), var(--royal-a25)); color: #FFFFFF; box-shadow: inset 2px 0 0 var(--sky); }
[dir="rtl"] .nav-link.on { background: linear-gradient(270deg, var(--sky-a22), var(--royal-a25)); box-shadow: inset -2px 0 0 var(--sky); }
.nav-link .count { margin-inline-start: auto; background: rgba(245, 181, 71, .2); color: #FFD58F; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 12px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: #FFFFFF; text-decoration: none; }
.me-card:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: var(--midnight); background: linear-gradient(135deg, var(--baby), var(--sky)); flex: 0 0 34px; }
.me-name { font-weight: 500; line-height: 1.2; }
.me-role { font-size: 11px; color: #8EA3BD; }
.side-actions { display: flex; gap: 6px; }
.side-btn { flex: 1; min-height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .05); color: #DCE6F2; font: inherit; font-size: 12px; cursor: pointer; }
.side-btn:hover { background: rgba(255, 255, 255, .12); color: #FFFFFF; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(240, 247, 255, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--faint); }
.crumbs b { color: var(--ink); font-weight: 600; }
.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #FFFFFF; cursor: pointer; align-items: center; justify-content: center; }
main.page { padding: 22px 24px 56px; display: flex; flex-direction: column; gap: 18px; max-width: 1600px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head .lead { margin-top: 4px; color: var(--muted); max-width: 860px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.backdrop { display: none; }

/* ---------------- controls ---------------- */
.input { box-sizing: border-box; max-width: 100%; min-width: 0; min-height: 38px; padding: 6px 10px; border: 1px solid #C3CCE0; border-radius: var(--radius); background: #FFFFFF; font: inherit; color: var(--ink); }
.input:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 3px var(--royal-a15); }
.input.search { padding-inline-start: 34px; background: #FFFFFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364718F' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat; background-position: 10px center; }
[dir="rtl"] .input.search { background-position: calc(100% - 10px) center; }
.w-xs { width: 90px; } .w-s { width: 150px; } .w-m { width: 230px; } .w-l { width: 300px; } .w-full { width: 100%; }
.btn, .btn-primary, .btn-danger, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: var(--radius); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn { border: 1px solid #C3CCE0; background: #FFFFFF; color: var(--ink); }
.btn:hover { border-color: var(--hover-line); background: var(--tint-2); text-decoration: none; color: var(--ink); }
.btn-primary { border: 0; color: #FFFFFF; background: linear-gradient(97deg, var(--royal), color-mix(in srgb, var(--royal) 80%, var(--sky)) 55%, var(--sea)); box-shadow: 0 1px 2px var(--dark-a15); }
.btn-primary:hover { filter: brightness(1.08); color: #FFFFFF; text-decoration: none; }
.btn-danger { border: 1px solid #F3B4AE; background: #FFFFFF; color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { border: 0; background: transparent; color: var(--royal); padding: 0 10px; }
.btn-ghost:hover { background: var(--tint-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span:first-child { font-size: 12px; font-weight: 500; color: var(--muted); }
.field .hint { font-weight: 400; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--royal); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #C3CCE0; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--royal); }
.switch input:checked::after { inset-inline-start: 19px; }
.pw { position: relative; display: flex; }
.pw .input { width: 100%; padding-inline-end: 38px; }
.pw button { position: absolute; inset-block: 0; inset-inline-end: 0; width: 36px; border: 0; background: none; color: var(--faint); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw button:hover, .pw button[aria-pressed="true"] { color: var(--royal); }
.pw-checks { list-style: none; margin: 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.pw-checks li { color: var(--faint); }
.pw-checks li::before { content: "○"; display: inline-block; width: 16px; }
.pw-checks li.ok { color: var(--good); }
.pw-checks li.ok::before { content: "✓"; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: #E6EEFA; border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs a { padding: 6px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { background: #FFFFFF; color: var(--ink); box-shadow: var(--shadow); }
.tabs .n { font-size: 11px; color: var(--faint); }

/* ---------------- cards, tables, chips ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card.pad, .card > .pad { padding: 18px 20px; }
.card > .pad + .pad, .card > .divided { border-top: 1px solid var(--line-soft); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .sub { margin-top: 2px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.scroll-x { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: start; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); background: var(--surface-soft); border-bottom: 1px solid var(--line); padding: 10px 14px; white-space: nowrap; }
[dir="rtl"] .table th { letter-spacing: 0; }
.table td { border-bottom: 1px solid var(--line-soft); padding: 10px 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--tint); }
.table tr.off td { opacity: .55; }
.table .actions { text-align: end; white-space: nowrap; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12px; color: var(--faint); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--line-soft); color: var(--muted); }
.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); }
.chip.blue { background: var(--sea-tint); color: var(--sea); }
.chip.royal { background: var(--royal); color: #FFFFFF; }
.chip.dark { background: var(--midnight); color: #FFFFFF; }
.dotlabel::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-inline-end: 6px; vertical-align: middle; }
.empty { padding: 36px 20px; text-align: center; color: var(--faint); }
.alert { border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.alert.ok { background: var(--good-bg); color: var(--good); }
.alert.error { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #F5D9A8; }
.alert.issued { background: #FFF8E6; color: #6B3E05; border: 1px solid #F5D9A8; }
.alert code { font-family: ui-monospace, Consolas, monospace; background: #FFFFFF; padding: 1px 6px; border-radius: 6px; user-select: all; direction: ltr; unicode-bidi: embed; }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }
.danger-zone { border-color: #F3B4AE; }

/* ---------------- overview ---------------- */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .note { font-size: 12px; color: var(--faint); }
.bar { height: 8px; border-radius: 6px; background: var(--line-soft); overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; }
.bar.sm { height: 6px; min-width: 90px; }
.avatar.lg { width: 52px; height: 52px; flex-basis: 52px; font-size: 18px; }
.back { transform: scaleX(-1); vertical-align: -2px; }
[dir="rtl"] .back { transform: none; }
.table tr.current td { background: var(--ice); }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 16px; border: 2px dashed var(--baby); border-radius: 14px; background: var(--ice); color: var(--sea); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--royal); background: var(--tint-2); }
.dropzone b { color: var(--midnight); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 3px solid var(--royal-a25); outline-offset: 2px; }
.todo { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.todo:last-child { border-bottom: 0; }
.todo:hover { background: var(--tint); text-decoration: none; color: var(--ink); }
.todo .n { min-width: 34px; text-align: center; font-weight: 600; border-radius: 8px; padding: 2px 6px; }
.todo .arrow { margin-inline-start: auto; color: var(--faint); }
.quick { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: #FFFFFF; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.quick:hover { border-color: var(--hover-line); text-decoration: none; color: var(--ink); transform: translateY(-1px); }
.quick .ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: #E0EAFF; color: var(--royal); }

/* ---------------- drawer and dialogs ---------------- */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog.drawer { margin: 0; margin-inline-start: auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); box-shadow: var(--shadow-lg); background: #FFFFFF; }
dialog.drawer[open] { display: flex; flex-direction: column; animation: slide-in .18s ease-out; }
[dir="rtl"] dialog.drawer[open] { animation-name: slide-in-rtl; }
@keyframes slide-in { from { transform: translateX(40px); opacity: .4; } }
@keyframes slide-in-rtl { from { transform: translateX(-40px); opacity: .4; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); background: var(--surface-soft); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #FFFFFF; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { color: var(--ink); border-color: var(--hover-line); }
dialog.modal { width: min(440px, calc(100vw - 32px)); border-radius: 18px; box-shadow: var(--shadow-lg); }
dialog.modal[open] { animation: pop .14s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: .5; } }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.bulkbar { position: sticky; bottom: 16px; z-index: 15; display: none; align-items: flex-end; flex-wrap: wrap; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--midnight); color: #FFFFFF; box-shadow: var(--shadow-lg); }
.bulkbar.show { display: flex; }
.bulkbar .field > span:first-child { color: #C9D5E4; }

/* ---------------- toasts ---------------- */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(440px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 12px; color: #FFFFFF; background: var(--midnight); box-shadow: var(--shadow-lg); animation: pop .15s ease-out; }
.toast.error { background: var(--bad); }
.toast.ok::before { content: "✓"; color: var(--sky); font-weight: 700; }
.toast button { margin-inline-start: auto; border: 0; background: none; color: inherit; font-size: 18px; cursor: pointer; }

/* ---------------- allocation grid ---------------- */
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { display: inline-flex; align-items: baseline; gap: 6px; border: 1px solid var(--line); background: #FFFFFF; border-radius: 10px; padding: 5px 12px; cursor: pointer; font: inherit; }
.stat b { font-size: 16px; font-weight: 600; }
.stat:hover { border-color: var(--hover-line); }
.stat.on { border-color: var(--royal); background: var(--ice); box-shadow: inset 0 0 0 1px var(--royal); }
.month-pick { font-weight: 600; font-size: 15px; min-width: 180px; }
.grid-wrap { max-height: calc(100vh - 300px); min-height: 320px; overflow: auto; }
table.grid { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.grid thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-soft); border-bottom: 1px solid var(--line); padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: start; vertical-align: bottom; }
.grid thead tr.entities th { z-index: 4; text-align: center; background: #E8F0FC; color: var(--sea); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 4px 8px; }
.grid thead tr.cols th { top: 25px; }
.grid th.proj { width: 96px; min-width: 96px; border-inline-start: 1px solid var(--line); text-align: center; }
.grid th.proj .code { display: block; font-weight: 400; color: var(--faint); }
.grid th.proj.mine { background: #E0EAFF; }
.grid th.proj.closed { opacity: .6; }
.grid td { border-bottom: 1px solid var(--line-soft); padding: 4px 8px; background: #FFFFFF; }
.grid tr:hover td { background: #F7FAFF; }
.grid .sticky1 { position: sticky; inset-inline-start: 0; z-index: 2; width: 64px; min-width: 64px; }
.grid .sticky2 { position: sticky; inset-inline-start: 64px; z-index: 2; min-width: 220px; border-inline-end: 1px solid var(--line); }
.grid thead .sticky1, .grid thead .sticky2 { z-index: 5; }
.grid td.cell { border-inline-start: 1px solid var(--line-soft); text-align: center; padding: 0; position: relative; font-variant-numeric: tabular-nums; }
.grid td.cell.can { cursor: pointer; }
.grid td.cell.can:hover { background: var(--tint-2); box-shadow: inset 0 0 0 1px #B9CCFF; }
.grid td.cell.ro { color: var(--faint); background: #FAFBFD; }
.grid td.cell span { display: block; padding: 8px 4px; }
.grid td.cell.has span { font-weight: 600; }
.grid td.cell input { width: 100%; border: 0; padding: 8px 4px; text-align: center; font: inherit; font-weight: 600; outline: 2px solid var(--royal); background: #FFFFFF; }
.grid td.cell .dot { position: absolute; top: 4px; inset-inline-end: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); }
.grid .pname { font-weight: 500; line-height: 1.25; }
.grid .ptitle { font-size: 12px; color: var(--faint); line-height: 1.25; }
.grid .lm { font-size: 12px; color: var(--muted); }
.total { display: inline-block; min-width: 50px; text-align: center; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 600; }
.total.full { background: var(--good-bg); color: var(--good); }
.total.part { background: var(--warn-bg); color: var(--warn); }
.total.zero { background: var(--line-soft); color: var(--muted); }
.total.over { background: var(--bad-bg); color: var(--bad); }
.tag { margin-inline-start: 4px; border-radius: 4px; padding: 0 4px; font-size: 10px; background: var(--line-soft); color: var(--muted); }
.tag.you { background: var(--sea-tint); color: var(--sea); }

/* ---------------- sign-in screens ---------------- */
.hero { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 24px; position: relative; overflow: hidden; color: #FFFFFF;
  background: radial-gradient(45% 60% at 50% 0%, color-mix(in srgb, var(--sky) 28%, transparent), transparent 100%), linear-gradient(160deg, var(--royal) 0%, var(--midnight) 70%); }
.hero .watermark { position: absolute; inset-inline-end: -80px; bottom: -80px; width: 520px; height: 520px; opacity: .1; pointer-events: none; }
.hero-title { font-size: 34px; font-weight: 500; text-align: center; background: linear-gradient(180deg, #FFFFFF, var(--baby)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .tag-line { text-align: center; color: rgba(255, 255, 255, .75); font-weight: 300; }
.hero-lang { position: absolute; top: 18px; inset-inline-end: 18px; }
.hero-lang button { border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1); color: #FFFFFF; border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.glass { width: 100%; max-width: 380px; padding: 24px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .1); backdrop-filter: blur(10px); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; position: relative; }
.glass .field > span:first-child { color: rgba(255, 255, 255, .9); font-size: 13px; }
.glass .alert.error { background: rgba(180, 35, 24, .25); color: #FFE1DD; border: 1px solid rgba(255, 180, 170, .35); }
.auth-card { width: 100%; max-width: 420px; padding: 24px; position: relative; color: var(--ink); }
.auth-foot { color: rgba(255, 255, 255, .45); font-size: 12px; position: relative; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; transform: translateX(-105%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: var(--scrim); }
  .menu-btn { display: inline-flex; }
  .grid2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  main.page { padding: 16px 14px 48px; }
  .topbar { padding: 10px 14px; }
}
@media (max-width: 560px) { .grid4 { grid-template-columns: 1fr; } }

/* ---------------- users ---------------- */
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.user-cell .cell-main { white-space: nowrap; }
.user-cell .cell-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.table td.tight, .table th.tight { white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.profile-hero { display: flex; align-items: center; gap: 16px; }
.profile-hero .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.profile-hero .meta span { display: inline-flex; align-items: center; gap: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.cols-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols-2 > * { min-width: 0; }
@media (max-width: 1000px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }

/* permission list (user page) */
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
@media (max-width: 1280px) { .perm-list { grid-template-columns: 1fr; } }
.perm-group h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.perm-item { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 14px; color: var(--faint); }
.perm-item .tick { flex: 0 0 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line); display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.perm-item.on { color: var(--ink); }
.perm-item.on .tick { background: var(--royal); border-color: var(--royal); color: #FFFFFF; }
.perm-item.on .tick::after { content: "✓"; font-size: 11px; font-weight: 700; }
.perm-item small { display: block; color: var(--muted); font-size: 12px; }
.perm-item:not(.on) small { color: var(--faint); }

/* roles page */
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.role-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; }
.role-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role-card h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.role-card .role-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--ice); color: var(--royal); }
.role-card.admin .role-ico { background: var(--midnight); color: var(--sky); }
.role-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.meter { height: 5px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--royal), var(--sky)); }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.matrix th, .matrix td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); text-align: center; vertical-align: middle; }
.matrix th:first-child, .matrix td:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; min-width: 280px; }
.matrix thead th { position: sticky; top: 0; background: var(--surface-soft); font-size: 13px; font-weight: 600; z-index: 2; white-space: nowrap; }
.matrix thead th:first-child { z-index: 3; background: var(--surface-soft); }
.matrix tr.group td { background: var(--ice); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--sea); }
.matrix tr.group td:first-child { background: var(--ice); }
.matrix td small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; max-width: 420px; }
.matrix tbody tr:not(.group):hover td { background: var(--tint); }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--royal); cursor: pointer; }
.matrix input[type=checkbox]:disabled { cursor: not-allowed; opacity: .7; }
.matrix-wrap { overflow: auto; max-height: 70vh; }
.savebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); background: var(--surface-soft); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.savebar .dirty { display: none; color: var(--warn); font-weight: 500; }
.savebar.changed .dirty { display: inline; }
.checklist { display: flex; flex-direction: column; gap: 12px; }
.checklist fieldset { border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 14px; margin: 0; }
.checklist legend { font-size: 12px; font-weight: 600; color: var(--sea); padding: 0 4px; text-transform: uppercase; letter-spacing: .05em; }
.checklist label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 14px; cursor: pointer; }
.checklist label small { display: block; color: var(--muted); font-size: 12px; }
.checklist input { margin-top: 3px; accent-color: var(--royal); }
fieldset { min-width: 0; }

/* per-user overrides */
.perm-list.edit { grid-template-columns: minmax(0, 1fr); }
.perm-list.edit .perm-item { align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.perm-list.edit .perm-group .perm-item:last-child { border-bottom: 0; }
.perm-text { flex: 1; min-width: 0; }
.perm-src { display: block; font-style: normal; font-size: 12px; font-weight: 500; }
.perm-item.overridden .perm-src { color: var(--warn); }
.seg { display: inline-flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #FFFFFF; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 4px 10px; font-size: 12px; font-weight: 500; color: var(--muted); }
.seg label + label span { border-inline-start: 1px solid var(--line); }
.seg input:checked + span { color: #FFFFFF; background: var(--midnight); }
.seg .seg-allow input:checked + span { background: var(--good); }
.seg .seg-deny input:checked + span { background: var(--bad); }
.seg input:focus-visible + span { outline: 2px solid var(--royal); outline-offset: -2px; }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
@media (max-width: 520px) { .perm-list.edit .perm-item { flex-wrap: wrap; } .perm-list.edit .seg { margin-inline-start: 26px; } }
.card > form > .pad { padding: 18px 20px; }
.card > form > .savebar { border-radius: 0; border-bottom: 1px solid var(--line-soft); }
@media (max-width: 520px) { .perm-list.edit .perm-text { flex: 1 1 calc(100% - 30px); } .perm-list.edit .seg { margin-top: 6px; } }

/* ---------------- approvals ---------------- */
.team-card { display: flex; flex-wrap: wrap; gap: 16px 24px; justify-content: space-between; padding: 16px 20px; border-inline-start: 4px solid var(--royal); }
.team-main { flex: 1 1 360px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.team-main h2 { margin: 0; font-size: 17px; }
.team-main .meter { max-width: 420px; }
.team-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.history summary { cursor: pointer; color: var(--sea); }
.history ol { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.flow li { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500; }
.flow li small { color: var(--faint); font-weight: 400; }
.flow li + li::before { content: ""; position: absolute; inset-inline-start: -18px; top: 50%; width: 14px; height: 1px; background: var(--soft-accent); }
.flow-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--ice); color: var(--royal); font-size: 12px; font-weight: 600; flex: 0 0 24px; }
.flow li.done .flow-dot, .step.done .flow-dot { background: var(--good); color: #FFFFFF; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps .step { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); }
.steps .step:last-child { border-bottom: 0; }
.steps .step.fixed { background: var(--surface-soft); }
.status-strip { display: flex; gap: 2px; height: 10px; min-width: 160px; flex: 1; max-width: 360px; border-radius: 6px; overflow: hidden; align-self: center; }
.status-strip.lg { height: 14px; max-width: none; }
.status-strip span { display: block; min-width: 4px; cursor: default; }
.seg-good { background: var(--good); } .seg-royal { background: var(--royal); } .seg-bad { background: var(--bad); } .seg-muted { background: #C3CCE0; }
.status-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 13px; }
.status-legend li { display: flex; align-items: center; gap: 8px; }
.status-legend i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.status-legend b { margin-inline-start: auto; }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.tag.frozen { background: #E7F6EF; color: var(--good); }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--sky); color: var(--midnight); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ---------------- notifications ---------------- */
.bell { position: relative; margin-inline-start: auto; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }
.bell:hover { background: #FFFFFF; }
.bell-count { position: absolute; top: 3px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #FFFFFF; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ice); }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.notice:last-child { border-bottom: 0; }
.notice:hover { background: var(--tint); }
.notice.unread { background: var(--ice); }
.notice-ico { width: 32px; height: 32px; border-radius: 10px; flex: 0 0 32px; display: inline-flex; align-items: center; justify-content: center; background: var(--ice); color: var(--royal); }
.notice-ico.kind-approved { background: var(--good-bg); color: var(--good); }
.notice-ico.kind-rejected { background: var(--bad-bg); color: var(--bad); }
.notice-ico.kind-reminder { background: var(--warn-bg); color: var(--warn); }
.notice-text { flex: 1; font-size: 14px; }
.notice-text small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--royal); margin-top: 6px; }

/* ---------------- dashboard ---------------- */
.kpis { display: grid; grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-hero { background: linear-gradient(135deg, var(--midnight), var(--royal)); color: #FFFFFF; border: 0; }
.kpi-hero .label, .kpi-hero .note { color: var(--baby); }
.kpi-hero .value { font-size: 48px; font-variant-numeric: normal; }
.kpi .value small { font-size: 16px; color: var(--faint); font-weight: 500; }
.dash-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1150px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-hero { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .dash-2, .dash-even { grid-template-columns: minmax(0, 1fr); } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; }
.mini-head { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.plain-list li:last-child { border-bottom: 0; }
.bench { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 560px) { .bench, .status-legend { grid-template-columns: minmax(0, 1fr); } }
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; color: var(--sea); }
.table-view .table { margin-top: 8px; }

/* horizontal bars: thin, rounded data end, square at the baseline, hairline baseline */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 44px; align-items: center; gap: 10px; border-radius: 6px; padding: 2px 4px; }
.hbars li:hover, .hbars li:focus-visible { background: var(--ice); outline: none; }
.hb-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 14px; display: flex; border-inline-start: 1px solid var(--line); }
.hb-bar { display: block; height: 100%; background: var(--royal); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.hb-value { font-size: 13px; font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }

/* stacked columns */
.cchart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.cc-axis { display: flex; flex-direction: column; justify-content: space-between; height: 200px; font-size: 11px; color: var(--faint); text-align: end; font-variant-numeric: tabular-nums; transform: translateY(-6px); }
.cc-plot { position: relative; min-width: 0; }
.cc-grid { position: absolute; inset: 0 0 auto 0; height: 200px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cc-grid i { display: block; height: 1px; background: var(--line-soft); }
.cc-grid i:last-child { background: var(--line); }
.cc-cols { position: relative; height: 200px; display: flex; align-items: flex-end; justify-content: space-around; gap: 4px; }
.cc-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px; cursor: default; }
.cc-col:hover, .cc-col:focus-visible { background: var(--royal-a6); outline: none; }
.cc-stack { width: min(24px, 70%); display: flex; flex-direction: column-reverse; gap: 2px; }
.cc-stack span { display: block; min-height: 2px; }
.cc-stack span:last-child { border-radius: 4px 4px 0 0; }
.cc-col.current::after { content: ""; position: absolute; bottom: -4px; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); }
.cc-cap { position: absolute; bottom: calc(100% + 2px); font-size: 12px; color: var(--ink); }
.cc-labels { display: flex; justify-content: space-around; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--faint); }
.cc-labels span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }
.chart-tip { position: fixed; z-index: 80; display: none; max-width: 300px; padding: 7px 10px; border-radius: 8px; background: var(--midnight); color: #FFFFFF; font-size: 12px; line-height: 1.4; box-shadow: var(--shadow-lg); pointer-events: none; }
.chip.filter { text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.chip.filter:hover { border-color: var(--line); }
.chip.filter.on { box-shadow: 0 0 0 2px var(--midnight); }
.actions { white-space: nowrap; text-align: end; }
.tag.frozen.waiting { background: var(--wait-bg); color: var(--wait); }

/* ---------------- personal dashboard ---------------- */
.callout { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--ice); border: 1px solid var(--line-brand); color: var(--midnight); text-decoration: none; }
.callout b { margin-inline-start: auto; color: var(--royal); }
.callout:hover { border-color: var(--royal); }
.dash-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.meter.sm { width: 90px; height: 6px; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 56px; border-bottom: 1px solid var(--line); }
.spark span, .spark a { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px 4px 0 0; cursor: default; }
.spark span:hover, .spark span:focus-visible, .spark a:hover, .spark a:focus-visible { background: var(--royal-a6); outline: none; }
.spark i { display: block; width: min(14px, 80%); background: var(--soft-accent); border-radius: 3px 3px 0 0; }
.spark span.current i, .spark a.current i { background: var(--royal); }

/* ---------------- reports ---------------- */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.report-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.report-card:hover { border-color: var(--hover-line); }
.report-card.on { border-color: var(--royal); box-shadow: 0 0 0 1px var(--royal), var(--shadow); background: linear-gradient(180deg, #FFFFFF, var(--ice)); }
.report-card b { font-size: 14px; }
.rc-ico { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--ice); color: var(--royal); margin-bottom: 4px; }
.report-card.on .rc-ico { background: var(--royal); color: #FFFFFF; }
.filter-panel { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.fp-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.fp-row .grow { flex: 1 1 200px; }
.fp-row .grow .input { width: 100%; }
.fp-more summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--sea); list-style: none; }
.fp-more summary::-webkit-details-marker { display: none; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 10px; }
.fp-grid .input { width: 100%; }
.active-filters, .fb-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-chip { border: 1px solid var(--line-brand); background: var(--ice); color: var(--midnight); text-decoration: none; cursor: pointer; font: inherit; font-size: 12px; }
.filter-chip:hover { border-color: var(--bad); color: var(--bad); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--faint); }
.heat-legend i { width: 18px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--royal) calc(var(--h) * 100%), var(--ice)); }
.report-wrap { max-height: 70vh; }
.table.report th { position: sticky; top: 0; z-index: 2; background: var(--surface-soft); white-space: nowrap; }
.table.report .stick { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); }
.table.report th.stick { z-index: 3; background: var(--surface-soft); }
.table.report td.heat { background: color-mix(in srgb, var(--royal) calc(var(--h) * 85%), var(--ice)); font-variant-numeric: tabular-nums; border-inline-start: 2px solid var(--surface); }
.table.report td.heat.hi { color: #FFFFFF; font-weight: 600; }
.table.report tfoot td { background: var(--surface-soft); border-top: 2px solid var(--line); }
.table.report tbody tr:hover td.stick { background: var(--tint); }

/* ---------------- allocation filter bar ---------------- */
.filterbar { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.fb-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fb-search { flex: 1 1 280px; }
.fb-search .input { width: 100%; min-height: 42px; border-radius: 12px; font-size: 15px; }
.fb-toggle { min-height: 42px; border-radius: 12px; }
.fb-toggle.on { border-color: var(--royal); color: var(--royal); background: var(--ice); }
.fb-toggle .nav-badge { margin-inline-start: 2px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 9px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button.on { background: #FFFFFF; color: var(--midnight); font-weight: 600; box-shadow: 0 1px 3px var(--dark-a12); }
.fb-panel { display: grid; gap: 14px; padding: 14px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line-soft); }
.fb-panel[hidden] { display: none; }
.fb-group { display: flex; flex-direction: column; gap: 6px; }
.fb-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; }
.fb-find { max-width: 320px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #FFFFFF; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; }
.fchip small { font-size: 11px; color: var(--faint); }
.fchip:hover { border-color: var(--hover-line); }
.fchip.on { background: var(--midnight); border-color: var(--midnight); color: #FFFFFF; }
.fchip.on small { color: var(--baby); }
.fchip[hidden] { display: none; }
.stats { gap: 4px; padding: 3px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line); }
.stat { border: 0; background: none; border-radius: 9px; padding: 6px 12px; }
.stat.on { background: #FFFFFF; box-shadow: 0 1px 3px var(--dark-a12); border: 0; }
@media (max-width: 640px) { .segmented { width: 100%; overflow-x: auto; } .fb-main .switch { width: 100%; } }
.nav-badge[hidden] { display: none; }

/* ---------------- settings: company identity ---------------- */
.settings-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.brand-logo { display: block; max-width: 200px; width: auto; object-fit: contain; object-position: left center; }
[dir="rtl"] .brand-logo { object-position: right center; }
.powered { margin: 8px 0 0; text-align: center; font-size: 11px; color: rgba(255, 255, 255, .45); }
.auth-foot a { color: inherit; text-decoration: underline; }
.identity { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .identity { grid-template-columns: minmax(0, 1fr); } }
.identity .savebar { position: sticky; bottom: 12px; z-index: 5; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.logo-slots { display: grid; gap: 16px; }
.logo-slot { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; }
.logo-well { height: 72px; border-radius: 12px; border: 1px dashed var(--line); background: var(--surface-soft); display: flex; align-items: center; justify-content: center; padding: 10px; overflow: hidden; color: var(--faint); }
.logo-well.dark { background: var(--midnight); border-style: solid; border-color: var(--midnight); }
.logo-well.square { width: 72px; justify-self: center; }
.logo-well img { max-width: 100%; max-height: 100%; object-fit: contain; }
.file-btn { position: relative; overflow: hidden; align-self: flex-start; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: #FFFFFF; font: inherit; font-size: 13px; cursor: pointer; }
.preset:hover { border-color: var(--hover-line); }
.preset.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.preset .sw { display: inline-flex; border-radius: 999px; overflow: hidden; }
.preset .sw i { width: 14px; height: 22px; }
.colour-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 700px) { .colour-grid { grid-template-columns: minmax(0, 1fr); } .logo-slot { grid-template-columns: minmax(0, 1fr); } }
.colour-pick { display: flex; gap: 8px; align-items: center; }
.colour-pick input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: #FFFFFF; cursor: pointer; flex: 0 0 44px; }
.colour-pick .input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.checks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.checks-list li { display: inline-flex; align-items: center; gap: 6px; }
.checks-list li b { font-variant-numeric: tabular-nums; color: var(--ink); }
.checks-list li .dotlabel::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.checks-list li.ok .dotlabel::before { background: var(--good); }
.checks-list li.bad { color: var(--bad); }
.checks-list li.bad .dotlabel::before { background: var(--bad); }
.checks-list li.bad::after { content: "⚠"; }
/* preview */
.preview { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; }
.pv-app { display: grid; grid-template-columns: 112px 1fr; height: 170px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-soft); background: var(--ice); }
.pv-side { background: linear-gradient(180deg, var(--deep), var(--midnight)); padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.pv-brand { display: flex; align-items: center; gap: 6px; color: #FFFFFF; font-size: 12px; margin-bottom: 8px; min-height: 24px; }
.pv-brand span { display: inline-flex; align-items: center; gap: 5px; }
.pv-brand img { max-height: 24px; max-width: 96px; object-fit: contain; }
.pv-nav { font-size: 10px; color: rgba(255, 255, 255, .72); padding: 4px 6px; border-radius: 6px; }
.pv-nav.on { color: #FFFFFF; background: linear-gradient(90deg, var(--sky-a22), var(--royal-a25)); box-shadow: inset 2px 0 0 var(--sky); }
[dir="rtl"] .pv-nav.on { box-shadow: inset -2px 0 0 var(--sky); }
.pv-main { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pv-hero { border-radius: 10px; padding: 8px 10px; color: #FFFFFF; background: linear-gradient(135deg, var(--midnight), var(--royal)); display: flex; flex-direction: column; }
.pv-hero small { font-size: 9px; color: var(--baby); }
.pv-hero b { font-size: 20px; line-height: 1.1; }
.pv-btn { display: inline-block; font-size: 10px; font-weight: 600; color: #FFFFFF; padding: 4px 10px; border-radius: 7px; background: linear-gradient(97deg, var(--royal), color-mix(in srgb, var(--royal) 80%, var(--sky)) 55%, var(--sea)); }
.pv-link { font-size: 10px; color: var(--royal); font-weight: 600; }
.pv-main .chip { font-size: 9px; padding: 1px 6px; }
.pv-bars { display: flex; flex-direction: column; gap: 4px; }
.pv-bars i { display: block; height: 6px; border-radius: 0 3px 3px 0; background: var(--royal); }
.pv-bars i:nth-child(2) { background: var(--soft-accent); }
.pv-bars i:nth-child(3) { background: var(--sky); }
.pv-login { border-radius: 12px; padding: 16px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: #FFFFFF; text-align: center;
  background: radial-gradient(45% 60% at 50% 0%, color-mix(in srgb, var(--sky) 28%, transparent), transparent 100%), linear-gradient(160deg, var(--royal) 0%, var(--midnight) 70%); }
.pv-login .pv-brand { margin: 0; font-size: 14px; }
.pv-tag { font-size: 12px; font-weight: 600; }
.pv-card { width: 70%; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); }
.pv-foot { font-size: 9px; color: rgba(255, 255, 255, .6); }
.pv-brand [hidden], .pv-brand img[hidden] { display: none; }
.chip.wait { background: var(--wait-bg); color: var(--wait); }
.seg-wait { background: var(--wait); }

/* ---------------- help centre ---------------- */
.help-top { margin-inline-start: auto; }
.help-top + .bell { margin-inline-start: 0; }
.help-top.on { background: #FFFFFF; color: var(--royal); }
.help-link { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: #FFFFFF; color: var(--sea); font-size: 13px; font-weight: 700; vertical-align: middle; margin-inline-start: 6px; text-decoration: none; }
.help-link:hover { border-color: var(--royal); color: var(--royal); text-decoration: none; }
.help-hero { padding: 26px 24px; display: flex; flex-direction: column; gap: 12px; background: linear-gradient(135deg, var(--ice), #FFFFFF 60%); }
.help-hero h1 { margin: 0; }
.help-search .input { width: 100%; min-height: 48px; font-size: 16px; border-radius: 14px; }
.help-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.help-cats .fchip { text-decoration: none; }
.help-section[hidden] { display: none; }
.help-item { border-top: 1px solid var(--line-soft); }
.help-item[hidden] { display: none; }
.help-item summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; font-weight: 500; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary:hover { background: var(--tint); }
.help-chev { flex: 0 0 auto; color: var(--faint); transform: rotate(90deg); transition: transform .15s; }
.help-item[open] .help-chev { transform: rotate(-90deg); }
.help-item[open] summary { color: var(--royal); }
.help-answer { padding: 0 20px 16px; color: var(--muted); font-size: 14px; }
.help-answer p { margin: 0 0 6px; }
.help-answer ul { margin: 4px 0 8px; padding-inline-start: 20px; }
.help-item.flash summary { background: var(--tint-2); }
.help-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------------- % filters and interactive reports ---------------- */
.range-field { border: 0; margin: 0; padding: 0; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.range-field legend { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 4px; float: left; width: 100%; }
.range-field .input { width: 70px; }
.pct-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pct-presets .fchip { text-decoration: none; }
.sort-btn { border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; }
.sort-btn:hover { color: var(--royal); }
.sort-ico::after { content: "↕"; font-size: 10px; opacity: .35; }
th[aria-sort="ascending"] .sort-ico::after { content: "↑"; opacity: 1; color: var(--royal); }
th[aria-sort="descending"] .sort-ico::after { content: "↓"; opacity: 1; color: var(--royal); }
.month-drill { margin-inline-start: 4px; font-size: 11px; text-decoration: none; opacity: .5; }
.month-drill:hover { opacity: 1; }
.table.report a.drill { color: var(--ink); text-decoration: none; border-bottom: 1px dotted var(--hover-line); }
.table.report a.drill:hover { color: var(--royal); border-bottom-color: var(--royal); }
.table.report td.clickable { padding: 0; }
.table.report td.clickable a { display: block; padding: 10px 14px; color: inherit; text-decoration: none; }
.table.report td.clickable a:hover { box-shadow: inset 0 0 0 2px var(--royal); }
.table.report td.heat.hi.clickable a { color: #FFFFFF; }
.table.report td a.chip { text-decoration: none; }
.pad-x { padding: 8px 18px 0; margin: 0; }
/* dashboard drill-downs */
a.kpi { color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; color: inherit; }
a.kpi.kpi-hero:hover { color: #FFFFFF; }
.kpi .go { font-size: 12px; opacity: .6; }
a.cc-col, a.hb-row, .spark a { text-decoration: none; color: inherit; }
.hbars a.hb-row { display: contents; }
.hbars li.clickable { cursor: pointer; }
.hbars li.clickable:hover .hb-bar { filter: brightness(1.15); }
.hbars li.clickable:hover .hb-label { color: var(--royal); text-decoration: underline; }
.plain-list a { color: inherit; text-decoration: none; }
.plain-list a:hover { color: var(--royal); }
.status-strip a, .status-legend a { display: contents; color: inherit; text-decoration: none; }
.status-legend a li:hover, .status-legend li a:hover span { color: var(--royal); text-decoration: underline; }
.dash-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.fb-ranges { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.fb-range { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fb-range .input { width: 72px; }
a.kpi.kpi-hero, a.kpi.kpi-hero:hover { color: #FFFFFF; }

/* ---------------- demo ---------------- */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 24px; font-size: 13px; background: linear-gradient(90deg, var(--sky-a22), var(--royal-a15)); border-bottom: 1px solid var(--line-brand); color: var(--ink); }
.demo-banner b { background: var(--royal); color: #FFFFFF; border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.demo-banner a { margin-inline-start: auto; font-weight: 600; }
.demo-logins { width: min(440px, 100%); margin-top: 14px; padding: 18px 20px; }
.demo-logins h2 { margin: 0 0 4px; font-size: 15px; color: #FFFFFF; }
.demo-logins p { margin: 0 0 10px; color: rgba(255, 255, 255, .75); }
.demo-logins code { background: rgba(255, 255, 255, .14); color: #FFFFFF; padding: 1px 8px; border-radius: 6px; user-select: all; }
.demo-logins ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.demo-login { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: start; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #FFFFFF; font: inherit; cursor: pointer; }
.demo-login:hover, .demo-login:focus-visible { background: rgba(255, 255, 255, .14); border-color: var(--sky); outline: none; }
.demo-login b { font-size: 14px; }
.demo-login span { font-size: 12px; color: rgba(255, 255, 255, .7); }
