/* ============================================================================
   LoopCore — the theme (owner approved 5 Nov 2026)

   Loaded after every other stylesheet (only rtl.css follows), so this file has the last
   word on how a component looks; the colours are the tokens in loop.css. Light is a
   white page with black ink; dark is true black with blue light.

   On purpose NOT the new look:
     * the dashboard tower canvases (.dash-tower) keep the old palette and fonts;
     * the login globe pane keeps its own dark art direction (login.css).
   ========================================================================= */

:root { --accent-soft: color-mix(in srgb, var(--color-signal) 14%, transparent); }

/* ------------------------------------------------------------ the old canvas, pinned */

.dash-tower {
  --color-page: #09090b; --color-body: #f5f5f7; --color-muted: #c4c4cc; --color-faint: #8a8a93;
  --color-line: rgb(255 255 255 / 0.1); --color-line-strong: rgb(255 255 255 / 0.18);
  --color-raised: rgb(255 255 255 / 0.05); --color-raised-2: rgb(255 255 255 / 0.08);
  --color-accent: #7b7bff; --color-signal: #4f46e5;
  --color-ok: #4e9a6b; --color-warn: #d89a30; --color-breach: #c4462f;
  --color-ok-bg: rgb(78 154 107 / 0.14); --color-warn-bg: rgb(216 154 48 / 0.14); --color-breach-bg: rgb(196 70 47 / 0.14);
  --font-display: "Instrument Serif", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  --radius: 3px;
  font-family: var(--font-sans); color: var(--color-body); background: var(--color-page);
  border-radius: var(--r-card);
}
:root[data-theme="light"] .dash-tower {
  --color-page: #f7f7f8; --color-body: #09090b; --color-muted: #3f3f46; --color-faint: #6b6b74;
  --color-line: rgb(9 9 11 / 0.12); --color-line-strong: rgb(9 9 11 / 0.2);
  --color-raised: rgb(9 9 11 / 0.04); --color-raised-2: rgb(9 9 11 / 0.07);
  --color-accent: #4338ca;
  --color-ok: #2f6b47; --color-warn: #8a5e14; --color-breach: #a3311d;
  --color-ok-bg: rgb(47 107 71 / 0.12); --color-warn-bg: rgb(138 94 20 / 0.12); --color-breach-bg: rgb(163 49 29 / 0.12);
}
html[dir="rtl"] .dash-tower { --font-sans: "Noto Naskh Arabic", "Inter", system-ui, sans-serif; }

/* ---------------------------------------------------------------------- ground */

body { font-family: var(--font-sans); font-optical-sizing: auto; font-feature-settings: "cv05", "cv11"; letter-spacing: -0.005em; }
::selection { background: color-mix(in srgb, var(--color-signal) 30%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--color-line-strong) transparent; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }
.display { font-weight: 600; letter-spacing: -0.03em; }
.page-title { font-weight: 650; letter-spacing: -0.036em; font-size: clamp(1.6rem, 2.6vw, 2.15rem); line-height: 1.1; }
.eyebrow { letter-spacing: 0.08em; }
:focus-visible { outline-color: var(--color-signal); }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
.theme-flipping *, .theme-flipping *::before, .theme-flipping *::after { transition: none !important; }

/* ---------------------------------------------------------------------- the rail */

@media (min-width: 62.0625rem) {
  .shell-rail { grid-template-columns: 4rem minmax(0, 1fr); }
  .shell-rail .shell-nav {
    width: 4rem; padding: 0.875rem 0 1rem; gap: 4px; align-items: center;
    overflow: visible; background: var(--bg-2); border-inline-end: 1px solid var(--color-line); z-index: 40;
  }
  .shell-rail .nav-brand { padding: 0 0 0.75rem; }
  .nav-home .nav-mark, .nav-home .nav-version { display: none; }
  .nav-groups { display: flex; flex-direction: column; gap: 4px; align-items: center; }
  .nav-group-btn .nav-group-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-panel {
    position: fixed; inset-inline-start: calc(4rem + 6px); top: var(--fly-top, 12px);
    width: 250px; max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface);
    border-radius: 16px; box-shadow: var(--sh-pop); padding: 8px; z-index: 60;
    opacity: 0; visibility: hidden; transform: translateX(-8px) scale(0.98); transform-origin: left top;
    transition: opacity 0.16s var(--ease), transform 0.28s var(--ease), visibility 0s linear 0.2s;
  }
  html[dir="rtl"] .nav-panel { transform: translateX(8px) scale(0.98); transform-origin: right top; }
  .nav-panel.is-wide { width: 500px; column-count: 2; column-gap: 4px; }
  .nav-panel.is-wide > .eyebrow:first-child { column-span: all; }
  .nav-group.is-open > .nav-panel, .nav-group:has(:focus-visible) > .nav-panel {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 0.16s var(--ease), transform 0.28s var(--ease), visibility 0s;
  }
  .shell-rail .nav-foot { margin-top: auto; }
  .nav-panel-foot { width: 260px; top: auto; bottom: 12px; }
}

.nav-home { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; color: inherit; }
.nav-glyph {
  width: 36px; height: 36px; border-radius: 11px; flex: none; background: var(--solid); color: var(--on-solid);
  display: grid; place-items: center; box-shadow: var(--sh-2); transition: transform 0.5s var(--spring);
}
.nav-home:hover .nav-glyph { transform: rotate(-10deg) scale(1.06); }
.nav-glyph path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: lc-draw 1.2s var(--ease) 0.15s forwards; }

.shell-rail .nav-group { position: relative; display: block; }
.shell-rail .nav-group > .eyebrow { padding: 0; }
.nav-group-btn {
  position: relative; width: 40px; height: 40px; border: 0; border-radius: 11px; background: none;
  color: var(--color-faint); display: grid; place-items: center; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.25s var(--ease);
}
.nav-group-btn:hover, .nav-group.is-open > .nav-group-btn { background: var(--hover); color: var(--color-body); }
.nav-group-btn:active { transform: scale(0.92); }
.nav-group.is-current > .nav-group-btn { background: var(--accent-soft); color: var(--color-accent); }
.nav-group.is-current > .nav-group-btn::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px; background: var(--color-signal); animation: lc-bar 0.4s var(--spring);
}
.nav-panel .eyebrow { display: block; padding: 8px 10px 6px; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; color: var(--color-faint); }
.nav-panel .eyebrow:first-child { color: var(--color-body); text-transform: none; letter-spacing: -0.01em; font-size: 0.8125rem; }
.nav-panel .nav-sub { margin-top: 6px; }
.nav-panel .nav-link {
  display: flex; align-items: center; padding: 7px 10px; border: 0; border-radius: 9px;
  font-size: 0.84375rem; color: var(--color-muted); break-inside: avoid;
  transition: background-color 0.15s, color 0.15s, transform 0.25s var(--ease);
}
.nav-panel .nav-link:hover { background: var(--hover); color: var(--color-body); transform: translateX(2px); }
html[dir="rtl"] .nav-panel .nav-link:hover { transform: translateX(-2px); }
.nav-panel .nav-link[aria-current="page"] { background: var(--hover); color: var(--color-body); font-weight: 550; }
.nav-panel .nav-link[aria-current="page"]::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--color-signal); margin-inline-end: 8px; flex: none; }

.nav-initials {
  width: 34px; height: 34px; border-radius: 50%; flex: none; background: linear-gradient(135deg, #2563eb, #6d5dfc);
  color: #fff; font-size: 0.75rem; font-weight: 600; letter-spacing: 0; display: grid; place-items: center;
}
.nav-avatar .nav-initials { box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 3.5px var(--color-line-strong); transition: transform 0.35s var(--spring); }
.nav-avatar:hover { background: none; }
.nav-avatar:hover .nav-initials { transform: scale(1.08); }
.nav-who { display: flex; align-items: center; gap: 10px; padding: 4px 10px 10px; }
.nav-who b { display: block; font-size: 0.875rem; font-weight: 600; color: var(--color-body); }
.nav-who small { display: block; font-size: 0.75rem; }
.nav-panel-foot > a { display: block; padding: 6px 10px; border-radius: 8px; font-size: 0.8125rem; text-decoration: none; }
.nav-panel-foot > a:hover { background: var(--hover); color: var(--color-body); }
.nav-panel .lang-switch-nav { display: flex; margin: 4px 10px 8px; }
.nav-signout { margin: 8px 10px 4px; }

@media (max-width: 62rem) {
  .shell-nav {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(86vw, 330px); height: 100dvh;
    padding: 14px 10px calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--surface);
    border-inline-end: 0; box-shadow: var(--sh-pop); display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; transform: translateX(-105%); visibility: hidden; transition: transform 0.4s var(--ease), visibility 0s linear 0.4s; z-index: 80;
  }
  html[dir="rtl"] .shell-nav { transform: translateX(105%); }
  body.nav-open .shell-nav, html[dir="rtl"] body.nav-open .shell-nav { transform: none; visibility: visible; transition: transform 0.4s var(--ease), visibility 0s; }
  .nav-brand { padding: 0 6px 8px; }
  .nav-groups { display: flex; flex-direction: column; gap: 2px; }
  .nav-group-btn { width: 100%; height: auto; display: flex; justify-content: flex-start; gap: 12px; padding: 10px 12px; font-size: 0.9375rem; color: var(--color-muted); }
  /* Physical borders on purpose: rotated 45deg they point down in either direction. */
  .nav-group-btn::after {
    content: ""; margin-inline-start: auto; width: 8px; height: 8px;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg); transition: transform 0.3s var(--ease); opacity: 0.6;
  }
  .nav-group.is-open > .nav-group-btn::after { transform: rotate(225deg); }
  .nav-group.is-current > .nav-group-btn::before { display: none; }
  .nav-avatar::after { display: none; }
  .nav-panel { display: none; padding: 0 0 8px; padding-inline-start: 42px; }
  .nav-panel > .eyebrow:first-child { display: none; }
  .nav-group.is-open > .nav-panel { display: block; animation: lc-up 0.35s var(--ease); }
  .nav-foot { margin-top: auto; border-top: 1px solid var(--color-line); padding-top: 6px; }
  .nav-scrim { background: var(--scrim); }
}

/* ---------------------------------------------------------------------- header */

.shell-rail .shell-header { display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 12px 28px 4px; border-bottom: 0; }
.head-bar { gap: 6px; flex-wrap: wrap; align-items: center; }
.head-grow { flex: 1 1 0; min-width: 0; }
.head-title { min-width: 0; }
.shell-rail .lang-switch-head { display: none !important; }
.shell-header .btn-sm { min-height: 34px; padding: 0 12px; }
.create-group { display: inline-flex; gap: 6px; }

.theme-toggle, .notification-bell, .tour-open, .cmdk-btn {
  height: 36px; min-width: 36px; border-radius: 10px; border: 0; background: none; color: var(--color-muted);
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.theme-toggle:hover, .notification-bell:hover, .notification-bell[aria-expanded="true"], .tour-open:hover, .cmdk-btn:hover { background: var(--hover); color: var(--color-body); }
.theme-toggle:active, .notification-bell:active, .cmdk-btn:active { transform: scale(0.9); }
.theme-toggle svg { width: 18px; height: 18px; transition: transform 0.6s var(--spring); }
.theme-toggle:hover svg { transform: rotate(-25deg); }
.cmdk-btn { display: inline-flex; gap: 8px; padding: 0 8px 0 10px; background: var(--surface); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); }
@media (max-width: 40rem) { .cmdk-btn kbd { display: none; } }
.cmdk-btn kbd { font-family: var(--font-mono); font-size: 0.6875rem; background: var(--bg-2); border-radius: 6px; padding: 1px 6px; color: var(--color-faint); border: 0; }

/* ---------------------------------------------------------------- buttons */

.btn { border-radius: var(--radius); font-weight: 500; transition: background-color 0.2s, border-color 0.2s, box-shadow 0.3s, transform 0.2s var(--ease), filter 0.2s; }
.btn:hover { background: var(--hover); border-color: var(--color-line-strong); }
.btn-danger:hover { background: var(--color-breach-bg); border-color: var(--color-breach); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-signal); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2), 0 1px 2px rgb(0 0 0 / 0.12), 0 6px 18px -6px var(--glow); }
.btn-primary:hover { background: var(--color-signal); border-color: transparent; filter: brightness(1.08); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.2), 0 10px 26px -6px var(--glow); }
.btn-ghost { border-color: transparent; }
.btn.is-busy { pointer-events: none; color: transparent !important; position: relative; --busy-ink: var(--color-signal); }
.btn-primary.is-busy { --busy-ink: #fff; }
.btn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 15%, var(--busy-ink));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  animation: lc-spin 0.7s linear infinite;
}

/* ---------------------------------------------------------------- surfaces */

.card, .box, .setup-card, .headline-item {
  background: var(--surface) linear-gradient(180deg, rgb(255 255 255 / var(--sheen)), transparent 55%);
  border: 0; border-radius: var(--r-card);
  box-shadow: var(--sh-1), var(--edge), inset 0 0 0 1px var(--color-line);
}
.card[role="alert"] { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-breach); }
.card-raised { background-color: var(--surface-2); }
.box, .headline-item { transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease); }
.box:hover, .headline-item:hover { transform: translateY(-3px); box-shadow: var(--sh-2), var(--edge), inset 0 0 0 1px var(--color-line-strong); }
.box:has(.box-value.is-breach) { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset 3px 0 0 var(--color-breach); }
.box:has(.box-value.is-warn) { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset 3px 0 0 var(--color-warn); }
html[dir="rtl"] .box:has(.box-value.is-breach) { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset -3px 0 0 var(--color-breach); }
html[dir="rtl"] .box:has(.box-value.is-warn) { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset -3px 0 0 var(--color-warn); }
.box-label, .headline-label { text-transform: none; letter-spacing: 0; font-size: 0.8125rem; color: var(--color-muted); }
.box-value, .headline-value, .camera-figure, .kpi-value { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.04em; }
.headline { border: 0; gap: 12px; overflow: visible; }
.headline-value { font-size: 2.25rem; }
.empty { border-radius: var(--r-card); background: var(--surface-2); }
.status-banner { border-radius: 12px; }

/* First paint only: shell.js marks the body ready once these have run, so a re-render does
   not replay them; fill "backwards" leaves no transform (and no stacking context) behind. */
body:not(.is-ready) :is(.headline-item, .grid > .box, .card, .needs-you) { animation: lc-rise 0.7s var(--ease) backwards; }
.headline-item:nth-child(2), .grid > :nth-child(2) { animation-delay: 50ms; }
.headline-item:nth-child(3), .grid > :nth-child(3) { animation-delay: 100ms; }
.headline-item:nth-child(4), .grid > :nth-child(4) { animation-delay: 150ms; }
.headline-item:nth-child(5), .grid > :nth-child(n+5) { animation-delay: 200ms; }

/* ---------------------------------------------------------------- tabs, tables, forms */

.period-tabs { background: var(--bg-2); border-radius: 12px; padding: 3px; gap: 2px; }
.period-tabs .period-tab, .period-tabs .period-tab:first-child, .period-tabs .period-tab:last-child { border: 0; border-radius: 9px; color: var(--color-faint); transition: background-color 0.25s, color 0.25s, box-shadow 0.3s; }
.period-tabs .period-tab:hover { background: var(--hover); color: var(--color-body); }
.period-tabs .period-tab.is-on { background: var(--surface); color: var(--color-body); box-shadow: var(--sh-2); }

table.data th { background: var(--surface-2); text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--color-faint); }
table.data tbody tr { transition: background-color 0.15s; }
table.data tbody tr:hover { background: var(--surface-2); }
.badge { border-radius: 999px; padding: 0.125rem 0.5rem; border: 0; font-weight: 500; letter-spacing: 0; }
.badge-neutral { background: var(--bg-2); color: var(--color-muted); }
.tag { border-radius: 999px; }

.input, select.input, textarea.input { background: var(--surface); border-radius: var(--radius); transition: border-color 0.2s, box-shadow 0.25s var(--ease); }
.input:hover { border-color: var(--color-faint); }
.input:focus { outline: 0; border-color: var(--color-signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-signal) 16%, transparent); }
select.input option { background: var(--surface); }
.field label { font-weight: 500; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-signal); }

/* Bare controls (no class at all) that a screen left unstyled get the .input look. :where
   keeps this at element weight; the dashboard tower keeps its own. */
:where(.shell-body) :is(select, textarea, input):where(:not([class], .dash-tower *, [type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="color"], [type="image"])) {
  min-height: 2.25rem; padding: 0.4rem 0.7rem; background: var(--surface); color: var(--color-body);
  border: 1px solid var(--color-line-strong); border-radius: var(--radius); transition: border-color 0.2s, box-shadow 0.25s var(--ease);
}
:where(.shell-body) :is(select, textarea, input):where(:not([class], .dash-tower *, [type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="color"], [type="image"])):hover { border-color: var(--color-faint); }
:where(.shell-body) :is(select, textarea, input):where(:not([class], .dash-tower *, [type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="color"], [type="image"])):focus { outline: 0; border-color: var(--color-signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-signal) 16%, transparent); }
input[type="file"] { font-size: 0.8125rem; color: var(--color-muted); }
input[type="file"]::file-selector-button {
  margin-inline-end: 0.75rem; min-height: 2.25rem; padding: 0 0.9rem; font: inherit; font-weight: 500; color: var(--color-body); cursor: pointer;
  background: var(--surface); border: 1px solid var(--color-line-strong); border-radius: var(--radius); transition: background-color 0.2s, border-color 0.2s;
}
input[type="file"]:hover::file-selector-button { background: var(--hover); border-color: var(--color-faint); }

/* Per-screen controls that predate the theme (calendar, labour grid, forms, drawings,
   commercial tabs): same corners, hover and focus ring as .btn and .input. */
.cal-icon-btn, .cal-today-btn, .frm-opt, .cal-segment, .vw-chips button { border-radius: var(--radius); }
.cal-icon-btn, .cal-today-btn, .cal-segment button, .frm-opt, .vw-seg button, .vw-chips button, .segmented button { transition: background-color 0.2s, border-color 0.2s, color 0.2s; }
.cal-icon-btn:hover, .cal-today-btn:hover, .frm-opt:hover, .vw-seg button:hover, .vw-chips button:hover, .segmented button:hover { background: var(--hover); border-color: var(--color-line-strong); color: var(--color-body); }
.cal-segment button:hover { background: var(--hover); color: var(--color-body); }
.cal-segment button.is-active { background: var(--accent-soft); }
.vw-seg button:first-child, .segmented button:first-child { border-start-start-radius: var(--radius); border-end-start-radius: var(--radius); }
.vw-seg button:last-child, .segmented button:last-child { border-start-end-radius: var(--radius); border-end-end-radius: var(--radius); }
.cal-search-field input, .lb-in { background: var(--surface); border-radius: var(--radius); transition: border-color 0.2s, box-shadow 0.25s var(--ease); }
.cal-search-field input:hover, .lb-in:hover { border-color: var(--color-faint); }
.cal-search-field input:focus, .cal-search-field input:focus-visible, .lb-in:focus { outline: 0; border-color: var(--color-signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-signal) 16%, transparent); }
.lb-in.is-dirty { background: var(--color-warn-bg); }

/* ---------------------------------------------------------------- popups */

.modal-overlay, :root[data-theme="light"] .modal-overlay { background: var(--scrim); animation: lc-fade 0.25s var(--ease); }
.modal-panel { background: var(--surface); border: 0; border-radius: 20px; box-shadow: var(--sh-pop); animation: lc-pop 0.5s var(--spring); }
.modal-title { font-family: var(--font-sans); font-weight: 650; font-size: 1.25rem; letter-spacing: -0.025em; }
.modal-close { border-radius: 8px; transition: background-color 0.2s; }
.modal-close:hover { background: var(--hover); }
.modal-foot { background: var(--surface-2); border-radius: 0 0 20px 20px; }

.toast { background: var(--solid); color: var(--on-solid); border: 0; border-radius: 13px; box-shadow: var(--sh-pop); display: flex; align-items: center; gap: 10px; animation: lc-toast 0.5s var(--spring); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--color-signal); }
.toast.is-ok::before { background: #16a34a; }
.toast.is-error::before { background: #dc2626; }
/* The Undo button sits on the toast's own ink, light or dark. */
.toast .btn { color: inherit; background: none; border-color: color-mix(in srgb, currentColor 35%, transparent); }
.toast .btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); border-color: color-mix(in srgb, currentColor 50%, transparent); }

.notification-panel, .tower-panel, .my-projects-menu {
  background: var(--surface) !important; border: 0 !important; border-radius: 16px !important; box-shadow: var(--sh-pop) !important;
}
.notification-panel:not([hidden]), .tower-panel:not([hidden]), .my-projects[open] .my-projects-menu { animation: lc-pop-sm 0.3s var(--spring); }
.notification-item:hover { background: var(--hover); }
.notification-count { background: #dc2626; color: #fff; border-radius: 999px; }

.tower-button { border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s, box-shadow 0.25s; }
.tower-button[aria-expanded="true"] { border-color: var(--color-signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-signal) 14%, transparent); }
.tower-panel { padding: 6px !important; }
.tower-option { border-radius: 9px; transition: background-color 0.15s, color 0.15s; }
.tower-option:hover, .tower-option:focus-visible { background: var(--hover); }
.tower-option.is-on { background: var(--accent-soft); color: var(--color-body); }
.tower-tick { color: var(--color-signal); }
.my-projects-switch { border-radius: 9px; }
.my-projects-switch:hover { background: var(--hover); }

/* ---------------------------------------------------------------- dashboard */

.needs-you {
  background: var(--ai-wash), var(--surface); border: 0; border-radius: var(--r-card); padding: 14px 18px;
  box-shadow: var(--sh-1), var(--edge), inset 0 0 0 1px color-mix(in srgb, var(--color-signal) 24%, var(--color-line));
}
.needs-you-head { font-weight: 600; }
.needs-you-head::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--ai-1), var(--ai-3)); animation: lc-ping 2.2s var(--ease) 0.8s 3; }
.needs-you-total, .ny-badge { background: linear-gradient(135deg, #2563eb, #6d5dfc); color: #fff; font-weight: 600; }
.ny-incident .ny-badge { background: #dc2626; }
.ny-group-title { text-transform: none; letter-spacing: 0; font-size: 0.75rem; font-weight: 600; color: var(--color-muted); }
.ny-item, .ny-more { border-radius: 8px; padding-inline: 6px; margin-inline: -6px; transition: background-color 0.15s; }
.ny-item:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.dash-section .section-head .eyebrow { text-transform: none; letter-spacing: -0.01em; font-size: 0.9375rem; font-weight: 600; color: var(--color-body); }
.period-title { font-weight: 600; letter-spacing: -0.03em; }

/* ---------------------------------------------------------------- sign-in */

/* The form side only; the globe pane keeps its own art direction (login.css). */
.login-pane-form { position: relative; overflow: hidden; background: var(--color-page); }
.login-pane-form::before {
  content: ""; position: absolute; width: 560px; height: 560px; top: -260px; inset-inline-start: -180px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ai-2) 22%, transparent), transparent);
  pointer-events: none; animation: lc-drift 18s ease-in-out infinite alternate;
}
.login-card { position: relative; background: var(--surface); border-radius: 22px; padding: 26px 28px; box-shadow: var(--sh-2), var(--edge), inset 0 0 0 1px var(--color-line); animation: lc-rise 0.8s var(--ease) backwards; }
.login-card .page-title { font-size: 2rem; }
.login-card .input { min-height: 44px; }
.login-card .btn { min-height: 44px; }
@keyframes lc-drift { to { transform: translate(120px, 60px) scale(1.15); } }

/* ---------------------------------------------------------------- portal and platform sidebars */

.shell:not(.shell-rail) .shell-nav { background: var(--bg-2); border-inline-end-color: var(--color-line); }
.shell:not(.shell-rail) .nav-link { margin: 1px 10px; padding: 0.5rem 0.75rem; border-radius: 9px; border-inline-start: 0; }
.shell:not(.shell-rail) .nav-link:hover { background: var(--hover); }
.shell:not(.shell-rail) .nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--color-body); }

/* ---------------------------------------------------------------- loaders */

.nprog {
  position: fixed; top: 0; inset-inline-start: 0; width: 100%; height: 2.5px; z-index: 200; pointer-events: none;
  background: linear-gradient(90deg, #3b82f6, #4c5bff, #8b7bff); box-shadow: 0 0 10px #4c5bff, 0 0 3px #4c5bff;
  transform-origin: left; transform: scaleX(0); opacity: 0;
}
html[dir="rtl"] .nprog { transform-origin: right; }
.nprog.is-going { opacity: 1; transform: scaleX(0.86); transition: transform 8s cubic-bezier(.08, .7, .2, 1), opacity 0.2s; }
.shell-body { animation: lc-enter 0.4s var(--ease) backwards; }

/* ---------------------------------------------------------------- owner's pass, 6 Nov 2026 */

/* Every [hidden] stays hidden: a class that says display:flex (.row, .toolbar) used to
   beat the attribute, so a header meant to wait for a choice showed its buttons anyway. */
.shell-body [hidden], .shell-header [hidden], .modal-overlay [hidden] { display: none !important; }

/* Page header: the bar, then the title with room on both sides of it. */
.shell-rail .shell-header { gap: 0; padding: 0 28px; }
.shell-rail .head-bar { padding: 12px 0; border-bottom: 1px solid var(--color-line); }
.shell-rail .head-title { display: flex; flex-direction: column; gap: 6px; padding: 26px 0 4px; }
.shell-rail .head-title .eyebrow:empty { display: none; }
.shell-rail .head-title .header-status { margin: 4px 0 0; }
.shell-rail .shell-body { padding: 24px 28px 40px; }
.head-bar > * { flex: none; }
.head-bar > .head-grow { flex: 1 1 0; }
.head-bar .btn { min-height: 34px; }

/* Buttons: two heights, centred, icon and text on one line. */
.btn { min-height: 2.375rem; padding: 0.375rem 1rem; line-height: 1.25; vertical-align: middle; }
.btn-sm, .btn-small { min-height: 2rem; padding: 0.25rem 0.75rem; font-size: 0.8125rem; gap: 0.375rem; }
.btn-small { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-line-strong); border-radius: var(--radius); background: transparent; color: var(--color-body); cursor: pointer; }
.btn svg { flex: none; }
.row:has(> .btn), .p67-tools, .ga-actions, .tk-do, .export-bar { gap: 0.5rem; }
/* In a footer or a toolbar the primary action sits at the end, the others before it. */
.modal-foot { justify-content: flex-end; }
.modal-foot > .btn-primary, .modal-foot > div > .btn-primary { order: 9; }

/* Fields: one height, one corner, a chevron on every select and a calm date input. */
.input, select.input { min-height: 2.375rem; }
textarea.input { min-height: 0; }
:root { --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2382828c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
:root[data-theme="light"] { --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); }
:root select:not([multiple]):not([size]):not(.dash-tower *) {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: var(--chev); background-repeat: no-repeat; background-size: 14px 14px; background-position: right 0.7rem center;
  padding-inline-end: 2.1rem;
}
html[dir="rtl"] select:not([multiple]):not([size]):not(.dash-tower *) { background-position: left 0.7rem center; }
:root select:not(.dash-tower *):disabled { cursor: not-allowed; opacity: 0.6; }
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="month"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.55; border-radius: 6px; padding: 3px; margin-inline-start: 4px; transition: opacity 0.2s, background-color 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover, input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background-color: var(--hover); }

/* Filter rows: everything on one line at the same height. */
.toolbar { gap: 0.625rem; }
.toolbar .field label, .p67-form label { text-transform: none; letter-spacing: 0; font-size: 0.75rem; font-weight: 500; color: var(--color-faint); }
.row > label:not(.field, .btn, .btn-sm) { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 2.375rem; }
.row > select.input, .row > input.input:not([type="checkbox"]) { width: auto; }

/* My projects: a popover under its own button, inside the screen. */
.my-projects-menu {
  inset-inline-end: auto !important; inset-inline-start: 0; top: calc(100% + 8px); z-index: 90;
  width: max-content; min-width: 18rem; max-width: min(26rem, calc(100vw - 2rem)); padding: 6px !important;
}
.my-projects-row { gap: 8px; padding-inline-end: 4px; border-radius: 10px; transition: background-color 0.15s; }
.my-projects-row + .my-projects-row { margin-top: 2px; }
.my-projects-row:hover { background: var(--hover); }
.my-projects-row form { min-width: 0; }
.my-projects-switch { padding: 8px 10px; gap: 2px; min-width: 0; }
.my-projects-switch:hover { background: none; }
.my-projects-switch > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.my-projects-switch > span:first-child { font-size: 0.875rem; font-weight: 550; color: var(--color-body); }
.my-projects-switch > .faint { font-size: 0.75rem; }
.my-projects-switch[aria-current="true"] > span:first-child { color: var(--color-accent); }
.my-projects-row > .btn { flex: none; color: var(--color-muted); }

/* The command palette: one glass panel over a soft scrim. */
.cmdk { padding: 14vh 1rem 1rem; }
.cmdk-scrim { background: color-mix(in srgb, var(--color-page) 30%, rgb(0 0 0 / 0.28)); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: lc-fade 0.2s var(--ease); }
.cmdk-panel {
  max-width: 40rem; max-height: 70vh; overflow: hidden; border: 0; border-radius: 18px; color: var(--color-body);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: var(--sh-pop), inset 0 0 0 1px var(--color-line), inset 0 1px 0 rgb(255 255 255 / 0.08);
  animation: lc-pop-sm 0.3s var(--spring);
}
.cmdk-input {
  padding: 18px 20px 14px 50px; border: 0; font-size: 1.0625rem; letter-spacing: -0.01em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382828c' 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 left 20px center / 18px;
}
html[dir="rtl"] .cmdk-input { padding: 18px 50px 14px 20px; background-position: right 20px center; }
.cmdk-input::placeholder { color: var(--color-faint); }
.cmdk-input:focus-visible { box-shadow: none; }
.cmdk-filters { gap: 8px !important; padding: 0 16px 12px !important; align-items: center; border-bottom: 1px solid var(--color-line); }
.cmdk-filters label { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding-inline: 12px 4px; border-radius: 999px; background: color-mix(in srgb, var(--hover) 85%, transparent); box-shadow: inset 0 0 0 1px var(--color-line); font-size: 0.75rem; color: var(--color-faint); }
.cmdk-filters select, .cmdk-filters input {
  height: 26px; min-height: 0; border: 0; border-radius: 999px; background-color: transparent; color: var(--color-body);
  font: inherit; font-size: 0.75rem; font-weight: 500; padding-block: 0; outline: 0;
}
:root .cmdk-filters select { padding-inline: 4px 22px; background-position: right 4px center; background-size: 12px 12px; }
html[dir="rtl"] .cmdk-filters select { background-position: left 4px center; }
.cmdk-filters input { padding-inline: 4px 2px; }
.cmdk-filters select:focus-visible, .cmdk-filters input:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-signal) 40%, transparent); }
.cmdk-list { padding: 6px; }
.cmdk-group { padding: 10px 10px 4px; font-size: 0.6875rem; color: var(--color-faint); }
.cmdk-item { align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; transition: background-color 0.12s; }
.cmdk-item.is-active { background: color-mix(in srgb, var(--color-signal) 12%, transparent); box-shadow: none; }
.cmdk-item.is-active .cmdk-kind { background: color-mix(in srgb, var(--color-signal) 18%, transparent); color: var(--color-accent); }
.cmdk-text { flex: 1 1 auto; gap: 1px; }
.cmdk-title { font-size: 0.875rem; font-weight: 500; }
.cmdk-sub { font-size: 0.75rem; }
.cmdk-kind {
  order: 2; flex: none; margin-inline-start: auto; padding: 2px 8px; border-radius: 999px; background: var(--hover);
  font-size: 0.6875rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--color-faint); white-space: nowrap;
}
.cmdk-note { padding: 10px; }
.cmdk-foot { gap: 6px; padding: 10px 14px; border-top: 1px solid var(--color-line); align-items: center; }
.cmdk-foot span {
  font-family: var(--font-mono); font-size: 0.6875rem; padding: 2px 7px; border-radius: 6px; color: var(--color-faint);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--color-line-strong), inset 0 -1px 0 var(--color-line-strong);
}

/* Popups: title left, actions right, all on one centre line. */
.modal-head { align-items: center; gap: 8px; padding: 18px 20px 16px 24px; }
html[dir="rtl"] .modal-head { padding: 18px 24px 16px 20px; }
.modal-head > :first-child { flex: 1 1 auto; min-width: 0; }
.modal-head > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.modal-head > .btn { flex: none; }
.modal-head .modal-title { line-height: 1.2; overflow-wrap: anywhere; }
.modal-close { flex: none; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 1.375rem; line-height: 1; color: var(--color-faint); }
.modal-close:hover { color: var(--color-body); }
.modal-body { padding: 20px 24px 24px; }
.modal-body h3 { margin: 0 0 0.5rem; font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; text-transform: none; color: var(--color-body); }
.modal-foot { padding: 14px 24px; gap: 8px; }
.tk-panel { gap: 18px; }
.tk-line { gap: 6px; align-items: center; }
.tk-line > span { padding: 2px 9px; border-radius: 999px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--color-line); font-size: 0.75rem; }
.tk-block { padding-top: 16px; border-top: 1px solid var(--color-line); }
.tk-block .bd-empty { text-align: start; padding: 4px 0; }
.tk-block textarea + .btn-small, .tk-block textarea + .btn { margin-top: 8px !important; }
@media (max-width: 640px) {
  .modal-head { padding: 14px 14px 12px 16px; }
  .modal-body { padding: 16px; }
}

/* Project home and its siblings: widgets as cards, compact tables. */
.gapsa { max-width: 80rem; }
.gapsa .ga-card {
  background: var(--surface) linear-gradient(180deg, rgb(255 255 255 / var(--sheen)), transparent 55%);
  border: 0; border-radius: var(--r-card); padding: 18px 20px; box-shadow: var(--sh-1), var(--edge), inset 0 0 0 1px var(--color-line);
}
.gapsa .ga-card h3 { margin: 0 0 12px; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.015em; }
.gapsa .ga-widgets { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); align-items: stretch; }
.gapsa .ga-widgets > .ga-card { margin: 0; min-width: 0; overflow-x: auto; }
.gapsa .ga-big { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; margin: 0 0 10px; }
.gapsa .ga-card p { font-size: 0.8125rem; }
.gapsa table { font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.gapsa th { padding: 6px 8px; border-top: 0; border-bottom: 1px solid var(--color-line); font-size: 0.75rem; font-weight: 500; color: var(--color-faint); white-space: nowrap; }
.gapsa td { padding: 6px 8px; border-top: 0; border-bottom: 1px solid var(--color-line); }
.gapsa tbody tr:last-child td { border-bottom: 0; }
.gapsa thead:has(th:first-child:empty + th:last-child:empty) { display: none; }
.gapsa td:first-child, .gapsa td:nth-child(n+3) { white-space: nowrap; }
.gapsa td:first-child:not(:only-child) { color: var(--color-muted); }
.gapsa .ga-tag { border: 0; border-radius: 999px; padding: 1px 8px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--color-line); font-size: 0.75rem; }
.gapsa .ga-mile { border: 0; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--color-line); padding: 8px 10px; }
.gapsa .ga-mile.is-done { box-shadow: inset 0 0 0 1px var(--color-ok); }
.gapsa .ga-mile.is-late { box-shadow: inset 0 0 0 1px var(--color-breach); }
.gapsa > [data-body] > .ga-actions { margin: 0 0 16px; }
@media (min-width: 75rem) { .gapsa .ga-widgets > [data-widget="weather"] { grid-column: span 2; } }
.period-tabs .period-tab { white-space: nowrap; }
@media (min-width: 62.0625rem) {
  .shell-rail .nav-foot { align-self: stretch; display: flex; flex-direction: column; align-items: center; padding: 12px 0 0; }
}

/* Dashboards (saved reports on one page). */
.p67-split { gap: 24px; }
.p67-side { background: var(--surface); border-radius: var(--r-card); padding: 14px; box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); }
.p67 .p67-side .p67-tools { margin: 0 0 10px; }
.p67-side .p67-tools .btn { flex: 1 1 auto; }
.p67-side .vw-list { margin: 0; padding: 0; list-style: none; }
.p67-side .vw-list li { padding: 6px 8px; border-radius: 8px; font-size: 0.875rem; }
.p67-side .vw-list li:not(.p67-folder):hover { background: var(--hover); }
.p67-side .p67-folder { margin-top: 8px; font-size: 0.75rem; color: var(--color-faint); }
.p67-side > p.faint { margin: 4px 2px 0; font-size: 0.8125rem; line-height: 1.5; }
.p67-main > .row:first-child { gap: 8px; align-items: center; min-height: 2.375rem; }
.p67-main > .row:first-child h2 { margin: 0; flex: 1 1 auto; }
.p67-main > #d-hint { margin: 0; padding: 32px; border-radius: var(--r-card); background: var(--surface-2); text-align: center; }
.p67-widget { border: 0; border-radius: var(--r-card); padding: 16px 18px; background: var(--surface); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); }
.p67-kpi { border: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); padding: 14px 16px; }
.p67-code { border: 0; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--color-line); }

/* Notifications: a compact list, not a stack of boxes. */
#inbox-list { margin-top: 10px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); overflow: hidden; }
#inbox-list:has(> .inb-empty) { background: none; box-shadow: none; }
.inb {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto auto; align-items: center; gap: 2px 14px;
  margin: 0; padding: 9px 16px; border: 0; border-top: 1px solid var(--color-line); transition: background-color 0.15s;
}
.inb:first-child { border-top: 0; }
.inb:hover { background: var(--hover); }
.inb.is-unread { border-inline-start: 0; box-shadow: inset 3px 0 0 var(--color-signal); }
html[dir="rtl"] .inb.is-unread { box-shadow: inset -3px 0 0 var(--color-signal); }
.inb.is-read { opacity: 0.6; }
.inb.is-read .inb-when { grid-column: 3 / 5; justify-self: end; }
.inb-tool {
  justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--color-line);
  font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.02em;
}
.inb-main { line-height: 1.35; }
.inb-title strong { font-weight: 550; font-size: 0.875rem; }
.inb-detail { margin-top: 1px; font-size: 0.78125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inb-when { font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.inb .btn-sm { min-height: 28px; padding-inline: 10px; font-size: 0.75rem; }
.inb-empty { padding: 32px 0; text-align: center; }
@media (max-width: 40rem) {
  .inb { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 14px; }
  .inb-main { grid-column: 1 / -1; grid-row: 2; }
  .inb-when { grid-column: 2; grid-row: 1; }
  .inb .btn-sm { grid-column: 1 / -1; grid-row: 3; justify-self: start; margin-top: 4px; }
  .inb.is-read .inb-when { grid-column: 2; }
  .inb-detail { white-space: normal; }
}

/* The dashboard scrolls like any other page; the tower column stays one screen tall
   beside the figures (dashboard.js measures where it starts), so it draws the same. */
@media (min-width: 80.0625rem) {
  body.shell-fixed:has(#dashboard) { overflow: visible; }
  body.shell-fixed:has(#dashboard) .shell { height: auto; min-height: 100vh; }
  body.shell-fixed:has(#dashboard) .shell-body { overflow: visible; }
  body.shell-fixed:has(#dashboard) #dashboard,
  body.shell-fixed:has(#dashboard) .dash-left { height: auto; }
  body.shell-fixed:has(#dashboard) .dash-left > .dash { overflow: visible; padding-inline-end: 0; }
  body.shell-fixed:has(#dashboard) .dash-split:not(.is-site) > .dash-tower {
    position: sticky; top: 1rem; height: calc(100vh - var(--dash-top, 11rem) - 1rem); min-height: 28rem;
  }
}

body.shell-fixed .shell-rail .shell-header { padding: 0 28px; }
body.shell-fixed .shell-rail .head-title { padding-top: 18px; }
body.shell-fixed:has(#dashboard) .shell-rail .shell-body { padding: 20px 28px 32px; }

/* One height for single-line fields, whatever the browser thinks a date needs. */
input.input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"]), select.input { height: 2.375rem; padding-block: 0; }
.period-dates .btn { min-height: 2.375rem; }

/* KPI strips across the registers: one card with hairline dividers. */
:is(.erp-kpis, .ops-kpis, .plan-kpis, .phase-kpis, .comp-kpis, .close-kpis, .acct-kpis, .mr-kpis, .bc-kpis, .spec-kpis, .cde-kpis, .store-kpis, .ap-kpis, .proc-kpis, .boq-kpis) {
  border: 0; border-radius: var(--r-card); overflow: hidden;
  background: var(--surface) linear-gradient(180deg, rgb(255 255 255 / var(--sheen)), transparent 55%);
  box-shadow: var(--sh-1), var(--edge), inset 0 0 0 1px var(--color-line);
}
:is(.erp-kpis, .ops-kpis, .plan-kpis, .phase-kpis, .comp-kpis, .close-kpis, .acct-kpis, .mr-kpis, .bc-kpis, .spec-kpis, .cde-kpis, .store-kpis, .ap-kpis, .proc-kpis, .boq-kpis) .eyebrow { text-transform: none; letter-spacing: 0; font-size: 0.75rem; color: var(--color-muted); }
:is(.erp-kpis, .ops-kpis, .plan-kpis, .phase-kpis, .comp-kpis, .close-kpis, .acct-kpis, .mr-kpis, .bc-kpis, .spec-kpis, .cde-kpis, .store-kpis, .ap-kpis, .proc-kpis, .boq-kpis) strong { font-weight: 600; letter-spacing: -0.03em; font-size: 1.375rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.erp-kpis div { padding: 14px 18px; }

/* Register tabs: one underline in the signal colour. */
.erp-tabs { gap: 4px; margin: 18px 0 12px; }
.erp-tabs button { padding: 10px 10px; margin-bottom: -1px; font-size: 0.875rem; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.2s; cursor: pointer; }
.erp-tabs button:hover { color: var(--color-body); }
.erp-tabs .active { color: var(--color-body); font-weight: 550; border-bottom-color: var(--color-signal); }

/* Work and task registers: compact rows on one surface, lateness as a bar, not a red box. */
.wk, .tasks .tk {
  border: 0; border-radius: 12px; margin-top: 6px; padding: 10px 16px; align-items: center;
  background: var(--surface); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line);
  transition: box-shadow 0.2s, background-color 0.15s;
}
.wk:hover, .tasks .tk:hover { background: var(--surface-2); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line-strong); }
.wk.is-overdue, .tasks .tk.is-overdue { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset 3px 0 0 var(--color-breach); }
.tasks .tk.is-blocked { border-left: 0; box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset 3px 0 0 var(--color-accent); }
html[dir="rtl"] .wk.is-overdue, html[dir="rtl"] .tasks .tk.is-overdue { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset -3px 0 0 var(--color-breach); }
html[dir="rtl"] .tasks .tk.is-blocked { box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line), inset -3px 0 0 var(--color-accent); }
.wk-kind { flex: 0 0 auto; min-width: 4.5rem; text-transform: none; letter-spacing: 0; }
.wk-kind, .tk-pill {
  font-size: 0.6875rem; font-weight: 500; padding: 2px 8px; border: 0; border-radius: 999px; text-align: center;
  background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--color-line); color: var(--color-muted);
}
.wk-title { font-size: 0.875rem; font-weight: 550; }
.wk-state { font-size: 0.78125rem; margin-top: 1px; }
.wk-when, .tk-when { font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.tasks .tk-head { align-items: center; }
.tasks .tk-head :is(h2, h3) { margin: 0; line-height: 1.3; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.015em; }
.tasks .tk-state { margin-top: 6px; }
.tasks .tk-body h4 { text-transform: none; letter-spacing: 0; font-size: 0.8125rem; font-weight: 600; color: var(--color-body); }
.work-search { border-radius: var(--radius); border-color: var(--color-line-strong); background: var(--surface); height: 2.375rem; padding-block: 0; }
.work-search:focus { outline: 0; border-color: var(--color-signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-signal) 16%, transparent); }
.wk-report { border: 0; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--sh-1), inset 0 0 0 1px var(--color-line); padding: 16px 18px; }
.wk-figure strong { font-weight: 600; letter-spacing: -0.03em; }

/* Button rows: centred on one line, one height per row. A small button among default
   ones brings them down to its size; a field in the row brings the small ones up to it. */
:is([class$="-actions"], [class$="-tools"], .lb-actions):not(.modal-foot, .tour-actions) { align-items: center; }
:is(.row, [class$="-actions"], [class$="-tools"], [class$="-bar"]):not(.head-bar, .modal-foot):has(> :is(.btn-sm, .btn-small)) > .btn:not(.btn-sm, .btn-small) { min-height: 2rem; padding-block: 0.25rem; font-size: 0.8125rem; }
:is(.row, [class$="-actions"], [class$="-tools"], [class$="-bar"]):not(.head-bar):has(> :is(.input, select)) > :is(.btn, .btn-sm, .btn-small) { min-height: 2.375rem; }
.head-bar .input, .head-bar select { height: 34px; min-height: 34px; font-size: 0.8125rem; }

.acts { align-items: center; }
.acts:has(> select) > :is(.btn, .btn-sm) { min-height: 2.375rem; }
/* Buttons inside a table row stay small, so a row is as tall as its text. */
td .btn, td .btn-small { min-height: 1.875rem; padding: 0.2rem 0.65rem; font-size: 0.8125rem; }
/* QA UX-010: row buttons never touch, also when something sits between them or they wrap. */
td .btn ~ .btn, td .btn ~ span > .btn:first-child { margin-inline-start: 4px; }
td .btn { margin-block: 2px; }
/* QA UX-006: in a table wider than its box, the last column's buttons (Approve, Open) stay in view. */
:is(.table-wrap, .q3-scroll) table:has(td:last-child .btn) :is(th, td):last-child { position: sticky; inset-inline-end: 0; z-index: 1; background: var(--color-page); box-shadow: -1px 0 0 var(--color-line); }
.card > :is(h2, h3):first-child { margin: 0 0 12px; }
.erp-kpis strong { font-size: 1.1875rem; }

:not(.head-bar, td, .cmdk-filters, .modal-foot):has(> :is(input.input, select.input)) > :is(.btn-sm, .btn-small) { min-height: 2.375rem; }
.shell-body :has(> .sf-field, > .field) { align-items: flex-end; }
/* That rule is for toolbars (a row: fields and buttons share one bottom line). In a column, flex-end means "push right",
   which threw whole settings forms to the right edge (/admin/security, 20 Nov 2026). Columns keep their normal layout. */
.shell-body :is(.stack, .ap-card):has(> .sf-field, > .field) { align-items: stretch; }
.btn.loc-filter { min-height: 2.375rem; }
table.data td { vertical-align: middle; }
.table-wrap > p:only-child { padding: 12px 14px; }

.toolbar { padding-bottom: 0; }
.sv-pop { background: var(--surface); border: 0; border-radius: 14px; box-shadow: var(--sh-pop); }
.sv-pop.is-flipped { inset-inline-end: auto; inset-inline-start: 0; }
.toolbar :is(.btn, .btn-sm, .btn-small) { min-height: 2.375rem; }
.export-bar { margin: 0 0 8px; }

/* ---------------------------------------------------------------- phone */

@media (max-width: 62rem) {
  .shell-header { padding: 10px 16px 2px; gap: 10px; }
}
@media (max-width: 40rem) {
  /* A sheet from the bottom; the auto margin (not flex-end) keeps a tall form's top reachable. */
  .modal-overlay { align-items: flex-start; padding: 0; }
  .modal-panel { margin-top: auto; border-radius: 22px 22px 0 0; max-width: none; animation: lc-sheet 0.45s var(--ease); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-foot { border-radius: 0; }
  .headline-value { font-size: 1.75rem; }
}

/* ---------------------------------------------------------------- motion */

@keyframes lc-draw { to { stroke-dashoffset: 0; } }
@keyframes lc-bar { from { transform: scaleY(0); } }
@keyframes lc-spin { to { transform: rotate(360deg); } }
@keyframes lc-fade { from { opacity: 0; } }
@keyframes lc-up { from { opacity: 0; transform: translateY(-4px); } }
@keyframes lc-rise { from { opacity: 0; transform: translateY(14px) scale(0.99); } }
@keyframes lc-enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes lc-pop { from { opacity: 0; transform: scale(0.95) translateY(12px); } }
@keyframes lc-pop-sm { from { opacity: 0; transform: scale(0.96) translateY(-6px); } }
@keyframes lc-sheet { from { transform: translateY(100%); } }
@keyframes lc-toast { from { opacity: 0; transform: translateY(16px) scale(0.92); } }
@keyframes lc-ping { 0% { box-shadow: 0 0 0 0 var(--glow); } 80%, 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .nprog { display: none; } }

/* QA PR-002: on a phone the header was five rows (40% of the screen) before any content.
   Menu, project and tower share the first row; the bell, search and create buttons the second;
   a screen's own actions the third. Nothing is hidden, only packed. */
@media (max-width: 37.4375rem) {
  .shell-header .head-bar { gap: 6px; row-gap: 6px; }
  .shell-header .head-bar > #nav-toggle { order: -3; }
  .shell-header .head-bar > .my-projects { order: -2; min-width: 0; }
  .shell-header .head-bar > .my-projects > summary { max-width: 8.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell-header .head-bar > .tower-pick { order: -1; width: auto; flex: 1 1 8rem; min-width: 0; }
  .shell-header .head-bar > .tower-pick .tower-pick-label { display: none; }
  .shell-header .head-bar > :is(.create-group, .notification-centre, .cmdk-btn, .theme-toggle, .nav-avatar, .tour-open) { order: 1; }
  .shell-header .head-bar > :is(a.btn, form, .btn):not(.cmdk-btn, .theme-toggle, .tour-open) { order: 2; }
  .shell-header .head-bar input[type="date"] { max-width: 8.25rem; }
  .shell-header .head-bar > a.btn { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* Rail search icon (opens the command palette). */
.nav-search-btn { margin: 0 auto 6px; flex: none; }
.nav-search-btn::after { display: none !important; }
