/* Hourline design base.
   Identity (see brand/): Hour Blue ring and "line", Plan Mint and Today Amber bars, Ink text on a cool Mist canvas,
   white cards, a 3px blue rule under the header, Manrope for headings and labels, Inter for text. */
:root {
  --bg: #F4F7FC; --panel: #ffffff; --panel-2: #F6F9FE; --fg: #13213C; --muted: #5B6B86; --line: #E1E7F2; --grid: #EDF1F8;
  --accent: #13213C; --accent-ink: #ffffff; --brand: #2F6FE0; --brand-ink: #ffffff; --link: #1F55B8;
  --mint: #3CCBB4; --amber: #F5B544; --mist: #EAF1FD;
  --hot: #2F6FE0; --warm: #13213C; --watch: #C3CCDB;
  --ok: #1E8A6E; --warn: #A15C00; --bad: #C2272D;
  --hot-tint: rgba(47, 111, 224, .09);
  --glass-1: rgba(47, 111, 224, .97); --glass-2: rgba(28, 72, 160, .96);
  --shadow: 0 1px 2px rgba(19, 33, 60, .06);
  --sans: "Inter", "Segoe UI", "Noto Sans", "Noto Sans Arabic", system-ui, sans-serif;
  --display: "Manrope", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "Manrope", ui-monospace, monospace;
  --radius: 10px; --pad: 22px; --gap: 14px;
  --fs-caption: 12px; --fs-body: 14px; --fs-heading: 13px; --fs-title: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1426; --panel: #121D33; --panel-2: #18243D; --fg: #F2F6FC; --muted: #9FB0CC; --line: #26334D; --grid: #1C2840;
    --accent: #F2F6FC; --accent-ink: #0B1426; --brand: #5B92F0; --brand-ink: #0B1426; --link: #8DB4F6;
    --mint: #46D6BF; --amber: #F7C35F; --mist: #18243D;
    --hot: #5B92F0; --warm: #F2F6FC; --watch: #45536E;
    --ok: #4CC7A2; --warn: #E6B65A; --bad: #EF5A5F; --hot-tint: rgba(91, 146, 240, .16);
    --glass-1: rgba(47, 111, 224, .96); --glass-2: rgba(22, 52, 120, .96);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1426; --panel: #121D33; --panel-2: #18243D; --fg: #F2F6FC; --muted: #9FB0CC; --line: #26334D; --grid: #1C2840;
  --accent: #F2F6FC; --accent-ink: #0B1426; --brand: #5B92F0; --brand-ink: #0B1426; --link: #8DB4F6;
  --mint: #46D6BF; --amber: #F7C35F; --mist: #18243D;
  --hot: #5B92F0; --warm: #F2F6FC; --watch: #45536E;
  --ok: #4CC7A2; --warn: #E6B65A; --bad: #EF5A5F; --hot-tint: rgba(91, 146, 240, .16);
  --glass-1: rgba(47, 111, 224, .96); --glass-2: rgba(22, 52, 120, .96);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--fs-body)/1.5 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-family: var(--display); font-weight: 300; font-size: var(--fs-title); line-height: 1.08; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h2 { font-family: var(--display); font-size: var(--fs-heading); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin: 0; display: flex; align-items: center; gap: 8px; }
h3 { font-family: var(--display); font-weight: 500; font-size: 19px; line-height: 1.3; margin: 0; }
.muted { color: var(--muted); }
.small, .caption { font-size: var(--fs-caption); }
.lead { margin: 8px 0 0; max-width: 62ch; color: var(--muted); }
.wrap { max-width: 1280px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: var(--gap); }

/* top bar: row 1 brand + account, row 2 navigation (scrolls sideways on tablets, collapses on phones) */
.top { background: var(--panel); border-bottom: 3px solid var(--brand); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--panel); }
.top-row, .mainnav { max-width: 1280px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; flex: none; display: block; }
.logo .ring { fill: var(--panel); stroke: var(--brand); stroke-width: 6; }
.logo .stem { fill: var(--brand); }
.logo .crown, .logo .today { fill: var(--amber); }
.logo .plan { fill: var(--mint); }
.brand .word { font-family: var(--display); font-size: 20px; font-weight: 800; letter-spacing: -.015em; line-height: 1.05; color: var(--fg); }
.brand .word b { font-weight: 800; color: var(--brand); }
.brand .word span { display: block; color: var(--muted); font-family: var(--display); font-size: 9.5px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; margin-top: 3px; }
.mainnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { flex: none; padding: 10px 12px 9px; color: var(--fg); font-family: var(--display); font-size: 11.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; border-bottom: 2px solid transparent; }
.mainnav a.on { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }
.mainnav a:hover { color: var(--brand); text-decoration: none; }
.me { display: flex; gap: 10px; align-items: center; font-size: 13px; margin-left: auto; }
.me > a { font-weight: 600; }
.role { font-size: 11px; color: var(--muted); }
.menu-toggle { display: none; background: transparent; border: 1px solid var(--line); color: var(--fg); padding: 8px; width: 40px; height: 38px;
  flex-direction: column; justify-content: center; gap: 4px; }
.menu-toggle span { display: block; width: 100%; height: 2px; background: currentColor; border-radius: 1px; }
@media (max-width: 720px) {
  .brand .word { display: none; }
  .me .role, .me form { display: none; }
  .menu-toggle { display: inline-flex; }
  .mainnav { display: none; flex-direction: column; white-space: normal; padding-bottom: 8px; }
  .top.open .mainnav { display: flex; }
  .mainnav a { border-bottom: 1px solid var(--line); border-left: 3px solid transparent; padding: 12px 10px; }
  .mainnav a.on { border-bottom-color: var(--line); border-left-color: var(--brand); }
}

/* cards and grids */
.card { background: var(--panel); border-radius: var(--radius); padding: var(--pad); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.emph { background: linear-gradient(135deg, var(--glass-1), var(--glass-2)); color: var(--brand-ink); }
.card.emph a { color: var(--brand-ink); }
.grid, .grid2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.kpis { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); }
.kpi { gap: 4px; }
.kpi .l { color: var(--muted); font-size: var(--fs-caption); }
.kpi .n { font-family: var(--display); font-weight: 300; font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--watch); }
.dot.hot { background: var(--hot); } .dot.warm { background: var(--warm); }
.big { font-size: 20px; font-weight: 500; margin: 0; }
.flag { color: var(--warn); font-size: var(--fs-caption); }
.ico { width: 18px; height: 18px; flex: none; }
.corner { margin-left: auto; color: var(--fg); font-size: 16px; line-height: 1; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 11px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; line-height: 16px; text-transform: capitalize; background: var(--panel); }
.pill.hot { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pill.warm { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.pill.watch { color: var(--muted); }
.pill.NEW, .pill.ok { color: var(--ok); border-color: currentColor; }
.pill.UPDATED { color: var(--fg); border-color: var(--fg); }
.pill.CARRIED { color: var(--muted); }
.pill.bd { color: var(--warn); border-color: currentColor; text-transform: none; }
.pill.failed { color: var(--bad); border-color: currentColor; }

/* controls: every toolbar is one aligned row of equal-height fields that wraps on small screens */
.controls, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.space { justify-content: space-between; }
:root { --ctl-h: 38px; }
.chip { font: inherit; font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  height: var(--ctl-h); padding: 0 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip[aria-pressed="true"], .chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-caption); color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); font-size: 13px; }
input, select, textarea { font: inherit; font-size: 13px; color: var(--fg); background: var(--panel-2); border: 1px solid transparent;
  border-radius: 7px; padding: 9px 12px; min-width: 0; }
input[type="color"] { padding: 2px; width: 44px; height: var(--ctl-h); }
textarea { width: 100%; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg); }
button:focus-visible, .chip:focus-visible, tr:focus-visible, a:focus-visible, g:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button, .btn { font: inherit; font-family: var(--display); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; border-radius: 7px; height: var(--ctl-h); padding: 0 18px; border: 1px solid var(--brand); background: var(--brand);
  color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
button.ghost, .btn.ghost { background: var(--panel); color: var(--fg); border-color: var(--line); }
button.link { border: 0; background: none; color: var(--muted); padding: 0; height: auto; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
form.inline { display: inline; }
/* toolbar: label text sits inside the field, left of the value */
.filters, .toolbar, .card.filters, .card.toolbar { display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters label, .toolbar label:not(.check) { flex-direction: row; align-items: center; gap: 0; height: var(--ctl-h); background: var(--panel-2);
  border-radius: 7px; padding-left: 12px; color: var(--muted); font-size: 11px; font-family: var(--display); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.filters label > input, .filters label > select, .toolbar label > input, .toolbar label > select { background: transparent; height: 100%;
  padding: 0 10px; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-weight: 400; color: var(--fg); font-size: 13px; }
.filters .grow, .toolbar .grow, .controls input[type="search"] { flex: 1 1 14rem; max-width: none; }
.filters .grow > input { flex: 1; min-width: 6rem; }
.controls input[type="search"], .controls select { height: var(--ctl-h); padding-block: 0; }
@media (max-width: 640px) { .filters label, .toolbar label:not(.check) { flex: 1 1 100%; } .filters label > *, .toolbar label > * { flex: 1; } }

/* tables */
.tbl-wrap { overflow: auto; max-width: 100%; min-width: 0; }
.wrap > *, .card > *, form > .card { min-width: 0; }
.tbl-wrap.tall { max-height: 32rem; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 400; font-size: var(--fs-caption); color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 8px; white-space: nowrap; z-index: 1; }
th button { all: unset; cursor: pointer; }
td { border-bottom: 1px solid var(--line); padding: 10px 8px; vertical-align: top; }
td.num, th.num { text-align: right; }
tbody tr:hover td { background: var(--panel-2); }
tr.sel td { background: var(--panel-2); }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
tr.click { cursor: pointer; }
.scorebar { display: inline-flex; align-items: center; gap: 6px; }
.bar { display: inline-block; height: 8px; border-radius: 2px; background: var(--watch); }
.bar.hot { background: var(--hot); } .bar.warm { background: var(--warm); }

/* charts */
.chart { position: relative; min-height: 320px; }
.chart svg, .mini svg { display: block; }
.chart svg text, .mini svg text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart svg text.lbl { fill: var(--fg); font-weight: 500; }
.tip { position: absolute; background: var(--panel); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.14);
  padding: 8px 12px; font-size: var(--fs-caption); pointer-events: none; max-width: 16rem; z-index: 2; }
.tip .t { color: var(--muted); }
.stat-big { font-family: var(--display); font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-big sup { font-size: 13px; vertical-align: top; position: relative; top: 4px; margin-left: 2px; }
.pair { display: flex; justify-content: space-between; gap: 8px; }
.pair b { display: block; font-weight: 500; font-size: 14px; }
.pair span { color: var(--muted); font-size: 11px; }
.strip { display: flex; align-items: stretch; height: 22px; gap: 2px; }
.strip i { display: block; border-radius: 1px; }
.strip .s-hot { background: var(--brand); } .strip .s-warm { background: var(--fg); } .strip .s-rest { background: var(--panel-2); flex: 1; }
.strip .ticks { flex: 0 0 26%; background: repeating-linear-gradient(90deg, var(--watch) 0 1px, transparent 1px 5px); border-radius: 0; opacity: .7; }
.detail dl { display: grid; grid-template-columns: minmax(6.5rem, auto) 1fr; gap: 6px 14px; margin: 0; }
.detail dt { color: var(--muted); font-size: var(--fs-caption); }
.detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* misc */
.flash { padding: 12px 16px; border-radius: 14px; background: var(--panel); border-left: 4px solid var(--ok); }
.flash.bad { border-left-color: var(--bad); color: var(--bad); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { border-left: 2px solid var(--brand); padding-left: 10px; }
.timeline .meta { font-size: var(--fs-caption); color: var(--muted); }
pre.breakdown { background: var(--panel-2); border-radius: 12px; padding: 12px; font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; margin: 0; }
.rtl { direction: rtl; text-align: right; font-family: "Noto Sans Arabic", var(--sans); white-space: pre-wrap; }
.pipeline { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); }
.pipeline div { background: var(--panel-2); border-radius: 12px; padding: 8px 10px; }
.pipeline b { display: block; font-family: var(--display); font-weight: 300; font-size: 24px; }
details summary { cursor: pointer; }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.section-title > div { min-width: 0; flex: 1 1 20rem; }
.pill.bd { white-space: normal; }
.card > h2 + .muted.small { margin-top: -6px; }
@media (max-width: 640px) { .hide-sm { display: none; } :root { --fs-title: 38px; --pad: 16px; } }
@media (prefers-reduced-motion: no-preference) { .card, .chip, .top nav a { transition: background-color .15s, color .15s; } }

/* footer line */
.site-foot { max-width: 1280px; margin: 0 auto; padding-block: 18px 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-family: var(--display); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.site-foot b { color: var(--brand); font-weight: 600; }
.card li, .card a, .card dd, td { overflow-wrap: anywhere; }

/* =====================================================================================
   Portal additions on top of the base (same tokens, same type)
   ===================================================================================== */
.hidden { display: none !important; }
.num, .tab-num { font-variant-numeric: tabular-nums; }
.nowrap, td.num, th.num { white-space: nowrap; }
.spacer { flex: 1; }
.sub { font-size: var(--fs-caption); color: var(--muted); }
.file { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }
.view { display: flex; flex-direction: column; gap: var(--gap); }
.mainnav a { cursor: pointer; }
.mainnav a .count { display: inline-block; min-width: 17px; margin-left: 5px; padding: 0 4px; border-radius: 7px; background: var(--brand); color: var(--brand-ink);
  font-size: 10px; line-height: 15px; text-align: center; letter-spacing: 0; }
.me .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.me .who b { font-weight: 600; font-size: 13px; }
button.sm, .btn.sm { height: 30px; padding: 0 12px; font-size: 10.5px; }
button.confirm { background: var(--bad); border-color: var(--bad); color: var(--brand-ink); }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--panel-2); border-radius: 7px; }
.seg button { height: 32px; background: transparent; border-color: transparent; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--fg); border-color: var(--line); }

/* status */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st i { width: 8px; height: 8px; border-radius: 50%; background: var(--watch); }
.st.working { color: var(--ok); } .st.working i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.st.online { color: var(--warn); } .st.online i { background: var(--warn); }
.st.offline { color: var(--muted); }
.st.meeting { color: var(--meet); } .st.meeting i { background: var(--meet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--meet) 22%, transparent); }
.app.margin { color: var(--muted); border-style: dashed; }
.pill.pending { color: var(--warn); border-color: currentColor; text-transform: none; }
.pill.approved { color: var(--ok); border-color: currentColor; text-transform: none; }
.pill.rejected { color: var(--bad); border-color: currentColor; text-transform: none; }
.pill.need { color: var(--warn); border-color: currentColor; text-transform: none; }
.pill.off { text-transform: none; }
.app { display: inline-block; padding: 1px 7px; border-radius: 7px; border: 1px solid var(--line); font-family: var(--display); font-size: 10.5px;
  font-weight: 600; letter-spacing: .04em; white-space: nowrap; color: var(--fg); }
.app.manual { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.tag { display: inline-block; padding: 1px 7px; margin: 2px 4px 0 0; border-radius: 7px; background: var(--panel-2); font-size: 11.5px; }

/* live */
.overview { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
.overview > div { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.kpi .n .u { font-size: 14px; margin-left: 2px; color: var(--muted); }
.dist { display: flex; height: 12px; gap: 2px; }
.dist span { border-radius: 2px; min-width: 3px; transition: width .4s ease; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.mini { display: flex; height: 5px; gap: 1px; margin-top: 6px; min-width: 70px; }
.mini span { border-radius: 1px; }
.feed { max-height: 300px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; font-size: 13px; }
.feed time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 980px) { .overview { grid-template-columns: minmax(0, 1fr); } }

/* dialogs */
dialog { border: 0; border-radius: var(--radius); background: var(--panel); color: var(--fg); padding: 0; width: min(600px, calc(100vw - 32px));
  box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog form { display: flex; flex-direction: column; }
dialog .hd { padding: 20px 22px 6px; display: flex; flex-direction: column; gap: 4px; }
dialog .hd h3 { font-size: 22px; font-weight: 300; }
dialog .bd { padding: 14px 22px; display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
dialog .ft { padding: 14px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg);
  padding: 11px 18px; border-radius: 7px; font-size: 13px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 8px 28px rgba(0,0,0,.2); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.login .card { width: min(400px, 100%); gap: 14px; border-top: 3px solid var(--brand); }
.login h1 { font-size: 34px; }

/* settings chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .c { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 7px; background: var(--panel-2); font-size: 13px; }
.chips .c button { all: unset; cursor: pointer; color: var(--muted); padding: 0 6px; font-size: 15px; }

/* privileges */
.perm-list { display: grid; gap: 6px; }
.perm-list label.check { align-items: flex-start; padding: 8px 10px; border-radius: 7px; background: var(--panel-2); }
.perm-list label.check input { margin-top: 3px; }
.perm-list label.check span b { display: block; font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.perm-list label.check span small { color: var(--muted); font-size: 12px; }
.privs { display: flex; flex-wrap: wrap; gap: 4px; }
.privs .pill { text-transform: none; }

/* manual time */
.manual-form { display: flex; flex-direction: column; gap: 12px; }
.mf-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.mf-row > label { flex: 0 1 170px; }
.mf-row > label.grow { flex: 1 1 280px; }
.mf-row input, .mf-row select { height: var(--ctl-h); padding-block: 0; }
@media (max-width: 640px) { .mf-row > label { flex: 1 1 100%; } .mf-row .or { flex-basis: 100%; } }
.or { align-self: center; padding: 18px 4px 0; color: var(--muted); font-size: 12px; }
.reject-box { display: flex; gap: 6px; margin-top: 6px; }
.reject-box input { flex: 1; min-width: 0; }

/* org chart: classic top-down tree with connector lines, scrolls sideways inside its card */
.org-wrap { overflow: auto; padding: 8px 4px 16px; min-height: 240px; }
.org, .org ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.org ul { padding-top: 22px; position: relative; }
.org li { position: relative; padding: 22px 6px 0; display: flex; flex-direction: column; align-items: center; }
.org > li { padding-top: 0; }
.org li::before, .org li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 22px; border-top: 1px solid var(--watch); }
.org li::after { right: auto; left: 50%; border-left: 1px solid var(--watch); }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 1px solid var(--watch); border-radius: 0 4px 0 0; }
.org li:first-child::after { border-radius: 4px 0 0 0; }
.org ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 22px; border-left: 1px solid var(--watch); }
.org > li::before, .org > li::after { display: none; }
.node { width: 206px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px 10px; text-align: left;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; position: relative; transition: box-shadow .2s, border-color .2s, opacity .2s; }
.node .nm { font-family: var(--display); font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.node .nm .st i { width: 7px; height: 7px; }
.node .tt { font-size: 12px; color: var(--fg); }
.node .dp { font-size: 11.5px; color: var(--muted); }
.node .lm { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }
.node .lm b { color: var(--fg); font-weight: 600; }
.node select { width: 100%; height: 30px; padding: 0 6px; font-size: 12px; margin-top: 4px; }
.node .kids { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); height: 20px; min-width: 20px; padding: 0 6px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 11px; line-height: 18px; cursor: pointer; z-index: 1; font-family: var(--display); font-weight: 600; }
.node .kids:hover { color: var(--brand); border-color: var(--brand); }
.node.top { border-top: 3px solid var(--fg); }
.node.me { border-color: var(--fg); }
.node.hit { border-color: var(--brand); box-shadow: 0 0 0 3px var(--hot-tint); }
.node.moved { animation: moved 1.6s ease; }
.node.dim { opacity: .35; }
.node[draggable="true"] { cursor: grab; }
.node.drop { border-color: var(--brand); border-style: dashed; background: var(--hot-tint); }
.org li.collapsed > ul { display: none; }
@keyframes moved { 0% { box-shadow: 0 0 0 6px var(--hot-tint); border-color: var(--brand); } 100% { box-shadow: var(--shadow); } }
.org-root-zone { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.org-root-zone.drop { border-color: var(--brand); color: var(--brand); background: var(--hot-tint); }
.org-list { list-style: none; margin: 0; padding: 0; }
.org-list ul { list-style: none; margin: 0 0 0 18px; padding: 0 0 0 12px; border-left: 1px solid var(--line); }
.org-list li { padding: 6px 0; }
.org-list .row1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.org-list .row1 b { font-family: var(--display); font-weight: 600; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .node.moved { animation: none; } }
.kpi .l .st { margin-right: 6px; vertical-align: -1px; }
/* wide charts scroll from their left edge instead of being clipped on both sides */
.org-wrap > .org { width: max-content; min-width: 100%; }

/* ================= v2.0 planning & case studies ================= */
/* Chart colours: validated for colour-blind separation on the white (light) and #1c1c1c (dark) panels.
   Variance is diverging: --pos (under plan, blue) / --neg (over plan, red). Comparisons use --s1…--s5 in this order. */
:root { --meet: #6250d6; --pos: #2a78d6; --neg: #d22630; --plan: #1b1b1b;
  --s1: #2a78d6; --s2: #d22630; --s3: #1baf7a; --s4: #eda100; --s5: #6250d6; --pos-ink: #1f5fae; --neg-ink: #b81d26; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --meet: #9085e9; --pos: #3987e5; --neg: #ef3e46; --plan: #f0f0f0;
  --s1: #3987e5; --s2: #ef3e46; --s3: #199e70; --s4: #c98500; --s5: #9085e9; --pos-ink: #7cb2f0; --neg-ink: #f2777d; } }
:root[data-theme="dark"] { --meet: #9085e9; --pos: #3987e5; --neg: #ef3e46; --plan: #f0f0f0;
  --s1: #3987e5; --s2: #ef3e46; --s3: #199e70; --s4: #c98500; --s5: #9085e9; --pos-ink: #7cb2f0; --neg-ink: #f2777d; }
.pos-ink { color: var(--pos-ink); } .neg-ink { color: var(--neg-ink); }
.var { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.var.pos { color: var(--pos-ink); } .var.neg { color: var(--neg-ink); } .var.zero { color: var(--muted); }
.var i { font-style: normal; font-size: 10px; margin-right: 3px; }

.chart { width: 100%; min-height: 60px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart .gr { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart text.lbl { fill: var(--fg); font-size: 11.5px; }
.chart text.val { fill: var(--fg); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .mark, .chart g.row:hover .mark { opacity: .8; }
.chart .today { stroke: var(--fg); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .xhair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
.chart .empty { padding: 26px 0; text-align: center; color: var(--muted); }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--panel); color: var(--fg); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); max-width: 280px; line-height: 1.45; }
.chart-tip b { font-family: var(--display); font-weight: 600; }
.chart-tip .k { display: inline-block; width: 10px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; margin: 4px 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 0; border-top: 3px solid currentColor; border-radius: 2px; }
.legend i.dash { border-top-style: dashed; }

.scen-list { display: flex; flex-wrap: wrap; gap: 8px; }
.scen { text-align: left; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 13px; font-weight: 400; height: auto;
  padding: 8px 12px; background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 2px; }
.scen b { font-family: var(--display); font-weight: 600; font-size: 13px; }
.scen .sub { color: var(--muted); font-size: 11.5px; }
.scen.on { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); background: var(--panel); }

.notes { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.plan-grid { font-variant-numeric: tabular-nums; }
.plan-grid th, .plan-grid td { padding: 4px 6px; white-space: nowrap; }
.plan-grid th.dept, .plan-grid td.dept { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 9rem; }
.plan-grid input { width: 4.6rem; text-align: right; padding: 4px 6px; height: 30px; font-variant-numeric: tabular-nums; }
.plan-grid input.tot { width: 5.4rem; font-weight: 600; }
.plan-grid tr.actual td { color: var(--muted); background: var(--panel-2); }
.plan-grid tr.actual td.dept { background: var(--panel-2); }
.plan-grid tr.sum td { font-weight: 600; border-top: 2px solid var(--line); }
.plan-grid td.cur, .plan-grid th.cur { box-shadow: inset 0 -2px 0 var(--fg); }
.plan-grid .x { border: 0; background: transparent; color: var(--muted); padding: 0 4px; height: 24px; font-size: 14px; }
.plan-grid .x:hover { color: var(--brand); }

.cmp-picker { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); margin-top: 6px; }
.cmp-proj { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 4px; align-content: start; }
.cmp-proj > b { font-family: var(--display); font-size: 13px; }
.cmp-proj label.check { font-size: 13px; }
.cmp-proj label.check .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
#planList, #planDetail, #cmpResult { display: flex; flex-direction: column; gap: var(--gap); }
#planList.hidden, #planDetail.hidden, #cmpResult.hidden { display: none; }
.plan-grid input { width: 4.2rem; }
#plKpis .n, #pdKpis .n { white-space: nowrap; font-size: clamp(24px, 7vw, 34px); }
#plBody td:first-child, #cmpTable td:first-child { min-width: 9.5rem; overflow-wrap: normal; }

/* ================= v3.0 software list ================= */
.sw-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); margin-top: 6px; }
.sw-cat { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 2px; align-content: start; }
.sw-head { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.sw-head b { font-family: var(--display); font-size: 13.5px; }
.sw-head .sub { margin-right: auto; }
.sw-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0; }
.sw-row + .sw-row { border-top: 1px dashed var(--line); }
.sw-row.off .sw-name b { color: var(--muted); font-weight: 500; }
.sw-name { display: grid; min-width: 0; } .sw-name b { font-weight: 600; font-size: 13.5px; } .sw-name .sub { overflow-wrap: anywhere; }
.sw-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.pill.meet { color: var(--meet); border-color: currentColor; }
.switch { position: relative; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--watch); transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 560px) { .sw-row { grid-template-columns: auto 1fr auto; } .sw-tags { grid-column: 2 / -1; justify-content: flex-start; } }

/* ================= live: team status ring + departments ================= */
.status-wrap { display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: center; }
.donut { flex: none; width: 196px; height: 196px; }
.donut svg, .dept svg { display: block; overflow: visible; }
.donut circle, .dept circle { transition: stroke-dasharray .4s ease, stroke-dashoffset .4s ease; }
.ring-n { font-family: var(--display); font-size: 44px; font-weight: 300; fill: var(--fg); }
.ring-l { font-size: 12px; fill: var(--muted); }
.ring-s { font-family: var(--display); font-size: 14px; font-weight: 600; fill: var(--fg); }
.status-legend { flex: 1 1 260px; display: grid; gap: 4px; min-width: 0; }
.status-legend button, .hours-today { display: grid; grid-template-columns: auto 1fr auto 3.2rem; align-items: center; gap: 10px; height: auto;
  padding: 8px 10px; border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--fg); text-transform: none;
  letter-spacing: 0; font: inherit; text-align: left; }
.status-legend button:hover { background: var(--panel-2); }
.status-legend button.on { background: var(--hot-tint); border-color: var(--brand); }
.status-legend .lab { display: grid; font-size: 14px; font-weight: 500; }
.status-legend .lab .sub { font-weight: 400; }
.status-legend b { font-family: var(--display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.status-legend .pct { color: var(--muted); font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.hours-today { grid-template-columns: 1fr auto; border-top: 1px solid var(--line); border-radius: 0; margin-top: 4px; padding-top: 12px; }
.dept-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); margin-top: 6px; }
.dept { display: flex; gap: 12px; align-items: center; height: auto; padding: 10px 12px; border-radius: 10px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--fg); text-transform: none; letter-spacing: 0; font: inherit; }
.dept:hover { border-color: var(--brand); }
.dept.on { border-color: var(--brand); background: var(--hot-tint); box-shadow: inset 3px 0 0 var(--brand); }
.dept .dn { display: grid; min-width: 0; } .dept .dn b { font-family: var(--display); font-size: 14px; }
@media (max-width: 560px) { .donut { width: 100%; display: flex; justify-content: center; } }
.ring-n, .ring-l, .ring-s { pointer-events: none; }
