/* Centra theme: tokens, the app frame, and one look for every page.
   Loaded last on every page, so it wins over app.css, shell.css and expenditure.css.
   The frame (body.cx) is built by shell.js: sidebar | top bar / one scrolling content area,
   exactly the size of the window, so nothing can spill outside it. */

:root {
  --cx-font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  --cx-mono: "Cascadia Mono", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --cx-bg: #f4f6f9;
  --cx-surface: #ffffff;
  --cx-surface-2: #f8fafc;
  --cx-border: #e3e8ef;
  --cx-border-strong: #cdd5df;
  --cx-text: #0f1b2d;
  --cx-text-2: #44546a;
  --cx-text-3: #6b7a90;

  --cx-primary: var(--brand, #0b3457);
  --cx-primary-hover: #0f4471;
  --cx-accent: var(--brand-accent, #2198b0);
  --cx-accent-tint: color-mix(in srgb, var(--cx-accent) 12%, white);
  --cx-focus: color-mix(in srgb, var(--cx-accent) 45%, transparent);

  --cx-side-bg: #0c1d31;
  --cx-side-bg-2: #12283f;
  --cx-side-text: #b8c4d3;
  --cx-side-text-strong: #ffffff;
  --cx-side-muted: #7387a0;

  --cx-success: #067647; --cx-success-bg: #ecfdf3; --cx-success-line: #abefc6;
  --cx-info: #175cd3;    --cx-info-bg: #eff8ff;    --cx-info-line: #b2ddff;
  --cx-warn: #b54708;    --cx-warn-bg: #fffaeb;    --cx-warn-line: #fedf89;
  --cx-danger: #b42318;  --cx-danger-bg: #fef3f2;  --cx-danger-line: #fecdca;

  --cx-r-sm: 6px; --cx-r: 8px; --cx-r-lg: 12px; --cx-r-xl: 16px;
  --cx-shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --cx-shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --cx-shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --cx-shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, .22);

  --cx-side-w: 248px;
  --cx-side-w-collapsed: 68px;
  --cx-top-h: 60px;

  font-family: var(--cx-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--cx-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The hidden attribute always wins, whatever display a class gives an element. Page scripts
   show and hide buttons with it. */
[hidden] { display: none !important; }

body { font-family: var(--cx-font); color: var(--cx-text); background: var(--cx-bg); }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--cx-accent); outline-offset: 2px; }
::selection { background: var(--cx-accent-tint); }

/* ---------- Frame ---------- */

body.cx { height: 100vh; overflow: hidden; margin: 0; --desk: var(--cx-bg); }
body.cx #app {
  display: grid;
  grid-template-columns: var(--cx-side-w) minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  background: var(--cx-bg);
  transition: grid-template-columns .18s ease;
}
body.cx #app[hidden] { display: none; }
body.cx.cx-collapsed #app { grid-template-columns: var(--cx-side-w-collapsed) minmax(0, 1fr); }

.cx-main { display: grid; grid-template-rows: var(--cx-top-h) minmax(0, 1fr); min-width: 0; min-height: 0; }
.cx-content { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.cx-content > * { min-width: 0; }

/* Pages with their own list + document (Invoices, Expenditure): each side scrolls by itself. */
body.cx[data-layout="split"] .cx-content { overflow: hidden; display: flex; flex-direction: column; }
body.cx[data-layout="split"] .cx-content > .workspace { flex: 1 1 auto; min-height: 0; height: auto; grid-template-columns: 288px minmax(0, 1fr); }
body.cx[data-layout="split"] .workspace > .rail,
body.cx[data-layout="split"] .workspace > main,
body.cx[data-layout="split"] .workspace > #desk { min-height: 0; overflow: auto; }

/* ---------- Sidebar ---------- */

.cx-side {
  display: flex; flex-direction: column; gap: 4px; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  background: linear-gradient(180deg, var(--cx-side-bg) 0%, var(--cx-side-bg-2) 100%);
  color: var(--cx-side-text);
  padding: 14px 12px 12px;
  border-right: 1px solid rgba(255, 255, 255, .04);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
.cx-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 12px; }
.cx-brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--cx-side-text-strong); text-decoration: none; }
.cx-brand img { width: 30px; height: 30px; object-fit: contain; flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.cx-brand-words { display: grid; line-height: 1.15; min-width: 0; }
.cx-brand-name { font-weight: 700; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.cx-brand-sub { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--cx-side-muted); white-space: nowrap; }
.cx-collapse {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border: 0; border-radius: var(--cx-r-sm); background: transparent; color: var(--cx-side-muted); cursor: pointer;
}
.cx-collapse:hover { background: rgba(255, 255, 255, .08); color: var(--cx-side-text-strong); }
.cx-collapse .cx-icon { transition: transform .18s ease; }

.cx-unit { display: grid; gap: 6px; margin: 0 2px 10px; padding: 10px; border-radius: var(--cx-r); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); }
.cx-unit-label { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--cx-side-muted); }
.cx-unit select {
  width: 100%; min-width: 0; min-height: 34px; padding: 0 28px 0 10px;
  border-radius: var(--cx-r-sm); border: 1px solid rgba(255, 255, 255, .12);
  background: var(--cx-side-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b8c4d3' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--cx-side-text-strong); font-size: 13px; font-weight: 600;
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
}
.cx-unit select:disabled { opacity: 1; cursor: default; background-image: none; }
.cx-unit select option { color: #0f1b2d; background: #fff; }
body[data-scope="holding"] .cx-unit { border-color: rgba(212, 175, 55, .45); }

.cx-nav { display: grid; gap: 1px; align-content: start; }
.cx-nav-heading { margin: 12px 10px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--cx-side-muted); white-space: nowrap; }
.cx-nav-link {
  position: relative; display: flex; align-items: center; gap: 11px; min-height: 36px; padding: 0 10px;
  border-radius: var(--cx-r-sm); color: var(--cx-side-text); text-decoration: none; font-weight: 500; white-space: nowrap;
}
.cx-nav-link:hover { background: rgba(255, 255, 255, .06); color: var(--cx-side-text-strong); }
.cx-nav-link.on { background: rgba(255, 255, 255, .1); color: var(--cx-side-text-strong); }
.cx-nav-link.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cx-accent); }
body[data-scope="holding"] .cx-nav-link.on::before { background: #d4af37; }
.cx-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cx-side-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .07); display: grid; gap: 2px; }
.cx-version { margin: 4px 10px 0; font-size: 11px; color: var(--cx-side-muted); white-space: nowrap; }

/* Collapsed: icons only. Automatic on narrow windows. */
body.cx-collapsed .cx-side { padding-inline: 10px; }
body.cx-collapsed .cx-brand-words,
body.cx-collapsed .cx-nav-text,
body.cx-collapsed .cx-nav-heading,
body.cx-collapsed .cx-unit,
body.cx-collapsed .cx-version { display: none; }
body.cx-collapsed .cx-brand-row { flex-direction: column; padding-inline: 0; }
body.cx-collapsed .cx-collapse .cx-icon { transform: rotate(180deg); }
body.cx-collapsed .cx-nav-link { justify-content: center; padding: 0; }
body.cx-collapsed .cx-nav-link.on::before { left: -10px; }
body.cx-collapsed .cx-nav { padding-top: 8px; }
@media (max-width: 1100px) {
  body.cx #app { grid-template-columns: var(--cx-side-w-collapsed) minmax(0, 1fr); }
  body.cx .cx-side { padding-inline: 10px; }
  body.cx .cx-brand-words, body.cx .cx-nav-text, body.cx .cx-nav-heading, body.cx .cx-unit, body.cx .cx-version, body.cx .cx-collapse { display: none; }
  body.cx .cx-nav-link { justify-content: center; padding: 0; }
  body.cx .cx-nav-link.on::before { left: -10px; }
  body.cx .cx-brand-row { justify-content: center; padding-inline: 0; }
  /* The unit picker moves into the top bar when the sidebar is narrow. */
  body.cx .cx-top-unit { display: flex; }
}

/* ---------- Top bar ---------- */

.cx-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-width: 0; padding: 0 24px;
  background: var(--cx-surface); border-bottom: 1px solid var(--cx-border);
  box-shadow: 0 1px 0 rgba(16, 24, 40, .02);
}
.cx-top-titles { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cx-page-title { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; color: var(--cx-text); white-space: nowrap; }
.cx-crumbs { order: 2; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--cx-text-3); }
.cx-crumbs:not(:empty)::before { content: "·"; margin-right: 10px; color: var(--cx-border-strong); }
.cx-top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cx-top-unit { display: none; }
body.cx-collapsed .cx-top-unit { display: flex; }
.cx-top-unit select {
  max-width: 220px; min-height: 34px; padding: 0 28px 0 10px; border-radius: var(--cx-r); border: 1px solid var(--cx-border);
  background: var(--cx-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--cx-text); font-weight: 600; font-size: 13px; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; cursor: pointer;
}

.cx-currency select {
  min-height: 34px; padding: 0 28px 0 10px; border-radius: var(--cx-r); border: 1px solid var(--cx-border);
  background: var(--cx-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  color: var(--cx-text-2); font-weight: 600; font-size: 13px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.cx-icon-btn {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--cx-r); color: var(--cx-text-2); text-decoration: none; border: 1px solid transparent;
}
.cx-icon-btn:hover { background: var(--cx-surface-2); border-color: var(--cx-border); color: var(--cx-text); }
.cx-icon-btn .cx-icon { width: 19px; height: 19px; }
.cx-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #f04438; box-shadow: 0 0 0 2px var(--cx-surface); display: none; }
.cx-icon-btn.has-unread .cx-dot { display: block; }

.cx-user { position: relative; }
.cx-user > summary { list-style: none; }
.cx-user > summary::-webkit-details-marker { display: none; }
.cx-user-chip {
  display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; min-height: 36px;
  border-radius: 999px; border: 1px solid var(--cx-border); cursor: pointer; user-select: none;
}
.cx-user-chip:hover { background: var(--cx-surface-2); }
.cx-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--cx-primary); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.cx-user-text { font-size: 12.5px; font-weight: 600; color: var(--cx-text-2); text-transform: capitalize; }
.cx-user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 260px; padding: 6px;
  background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg); box-shadow: var(--cx-shadow-lg);
}
.cx-user-email { margin: 0; padding: 8px 10px 0; font-weight: 600; overflow-wrap: anywhere; }
.cx-user-role { margin: 0; padding: 0 10px 8px; color: var(--cx-text-3); font-size: 12.5px; text-transform: capitalize; border-bottom: 1px solid var(--cx-border); }
.cx-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 6px; padding: 8px 10px;
  border: 0; border-radius: var(--cx-r-sm); background: transparent; color: var(--cx-text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.cx-menu-item:hover { background: var(--cx-surface-2); color: var(--cx-danger); }

.fx-note { margin: 0; padding: 8px 32px; background: var(--cx-info-bg); color: var(--cx-info); border-bottom: 1px solid var(--cx-info-line); font-size: 12.5px; }

/* ---------- Buttons ---------- */

.cx-btn, .fd-btn, .primary, .quiet, .danger, .signin-card button, .vat-form button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--cx-r);
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.cx-btn-primary, .fd-btn, .primary, .signin-card .primary {
  background: var(--cx-primary); border-color: var(--cx-primary); color: #fff; box-shadow: var(--cx-shadow-xs);
}
.cx-btn-primary:hover:not(:disabled), .fd-btn:hover:not(:disabled):not(.quiet):not(.danger), .primary:hover:not(:disabled) { background: var(--cx-primary-hover); border-color: var(--cx-primary-hover); }
.cx-btn-secondary, .fd-btn.quiet, .quiet, .topbar .quiet, .fd-topbar .quiet, .quiet.on-dark {
  background: var(--cx-surface); border-color: var(--cx-border-strong); color: var(--cx-text); box-shadow: var(--cx-shadow-xs);
}
.cx-btn-secondary:hover:not(:disabled), .fd-btn.quiet:hover:not(:disabled), .quiet:hover:not(:disabled) { background: var(--cx-surface-2); border-color: var(--cx-text-3); color: var(--cx-text); }
.danger, .fd-btn.danger { background: var(--cx-surface); border-color: var(--cx-danger-line); color: var(--cx-danger); }
.danger:hover:not(:disabled), .fd-btn.danger:hover:not(:disabled) { background: var(--cx-danger-bg); }
.cx-btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.cx-btn:disabled, .fd-btn:disabled, .primary:disabled, .quiet:disabled, .danger:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.cx-link { color: var(--cx-info); font-weight: 600; text-decoration: none; }
.cx-link:hover { text-decoration: underline; }

/* ---------- Page body ---------- */

body.cx .dash, body.cx .app { min-height: 0; background: var(--cx-bg); }
.cx-content .dash-main, .cx-content .group-page {
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px; display: grid; gap: 20px; align-content: start;
}
.cx-content .dash-hello { display: grid; gap: 4px; }
.cx-content .dash-hello h1, .cx-content > main > h1, .cx-content .group-page h1, .cx-content .dash-main > h1 {
  margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; color: var(--cx-text);
}
.cx-content .eyebrow, .cx-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cx-accent); }
.muted, .cx-muted { color: var(--cx-text-3); }
.cx-content .dash-hello .muted, .cx-content .dash-main > p.muted { margin: 0; max-width: 70ch; }
.cx-content h2 { color: var(--cx-text); font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.cx-content .paper h2 { font-size: 12px; color: var(--cx-text-3); font-weight: 600; }

/* Cards */
.cx-card, .cx-content .dash-panel, .cx-content .dash-note, .cx-content .admin-card, .cx-content .change-card {
  background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg);
  box-shadow: var(--cx-shadow-xs); padding: 20px 22px; min-width: 0;
}
.cx-content .dash-panel h2, .cx-content .dash-note h2, .cx-card h2 { margin: 0 0 12px; }
.cx-content .dash-note { border-left: 3px solid var(--cx-accent); }
.cx-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cx-card-head h2 { margin: 2px 0 0 !important; font-size: 16px; }

/* KPI tiles */
.cx-content .dash-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.cx-content .dash-card {
  position: relative; gap: 4px; padding: 18px 20px; border-radius: var(--cx-r-lg); border: 1px solid var(--cx-border);
  background: var(--cx-surface); box-shadow: var(--cx-shadow-xs); transition: border-color .15s ease, box-shadow .15s ease; transform: none !important;
}
.cx-content .dash-card:hover { border-color: var(--cx-border-strong); box-shadow: var(--cx-shadow-sm); }
.cx-content .dash-card::after { content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 2px; border-radius: 0 0 2px 2px; background: var(--cx-accent); opacity: 0; transition: opacity .15s ease; }
.cx-content a.dash-card:hover::after { opacity: 1; }
.cx-content .dash-card-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cx-text-3); }
.cx-content .dash-card strong { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: var(--cx-text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cx-content .dash-card .muted { font-size: 13px; }
.cx-content button.dash-card { font: inherit; text-align: left; cursor: pointer; }

/* Lists */
.cx-content .dash-list { gap: 0; }
.cx-content .dash-list > li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 44px; padding: 8px 4px; border-bottom: 1px solid var(--cx-border); }
.cx-content .dash-list > li:last-child { border-bottom: 0; }
.cx-content .dash-list > li > span:first-child { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
.cx-content .dash-list a { flex: 1; min-height: 36px; padding: 6px 8px; margin: -6px -8px; border-radius: var(--cx-r-sm); color: var(--cx-text); font-weight: 500; }
.cx-content .dash-list a:hover { background: var(--cx-surface-2); color: var(--cx-info); }
.cx-content .dash-empty-row { color: var(--cx-text-3); }

/* Forms outside the printed documents */
.cx-content .dash-panel .field, .cx-content .admin-card label, .cx-content .vat-form label {
  display: grid; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--cx-text-2);
}
.cx-content .dash-panel input:not([type="checkbox"]):not([type="radio"]),
.cx-content .dash-panel select, .cx-content .dash-panel textarea,
.cx-content .admin-card input, .cx-content .admin-card select,
.cx-content .vat-form input, .cx-dialog textarea, .cx-dialog input, .part-dialog textarea {
  width: 100%; min-width: 0; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--cx-border-strong); border-radius: var(--cx-r); background: var(--cx-surface);
  color: var(--cx-text); font: inherit; font-size: 14px; font-weight: 400; box-shadow: var(--cx-shadow-xs);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.cx-content .dash-panel textarea { min-height: 84px; resize: vertical; }
.cx-content .dash-panel input:focus, .cx-content .dash-panel select:focus, .cx-content .dash-panel textarea:focus,
.cx-content .admin-card input:focus, .cx-content .admin-card select:focus, .cx-content .vat-form input:focus,
.cx-dialog textarea:focus, .part-dialog textarea:focus {
  outline: none; border-color: var(--cx-accent); box-shadow: 0 0 0 3px var(--cx-focus);
}
.cx-content form.dash-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; align-items: end; }
.cx-content form.dash-panel > .field:has(textarea), .cx-content form.dash-panel > .status-line,
.cx-content form.dash-panel > p, .cx-content form.dash-panel > datalist { grid-column: 1 / -1; }
.cx-content form.dash-panel > button { justify-self: start; margin: 4px 8px 8px 0; grid-column: auto; }
.cx-content .vat-form { gap: 12px; }
.cx-content .vat-form label { margin: 0; flex: 1 1 160px; }
.status-line { margin: 4px 0 0; color: var(--cx-text-2); font-size: 13px; }
.status-line:empty { display: none; }

/* Tables */
.cx-content .group-table { border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg); border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--cx-surface); font-size: 13.5px; }
.cx-content .group-table thead th { background: var(--cx-surface-2); color: var(--cx-text-3); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; border-bottom: 1px solid var(--cx-border); position: sticky; top: 0; }
.cx-content .group-table td { border-bottom: 1px solid var(--cx-border); font-variant-numeric: tabular-nums; }
.cx-content .group-table tbody tr:hover td { background: #fafbfd; }
.cx-content .group-table tbody tr:last-child td { border-bottom: 0; }
/* A wide table scrolls inside its own box; the page never scrolls sideways. */
.cx-content .group-table { display: block; max-width: 100%; overflow-x: auto; }
.cx-content .group-table > thead, .cx-content .group-table > tbody { min-width: 100%; }
.cx-content .table-scroll { overflow-x: auto; max-width: 100%; }

/* Pills */
.cx-pill, .pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.cx-pill-info { background: var(--cx-info-bg); color: var(--cx-info); border-color: var(--cx-info-line); }
.cx-pill-success { background: var(--cx-success-bg); color: var(--cx-success); border-color: var(--cx-success-line); }
.cx-pill-warn { background: var(--cx-warn-bg); color: var(--cx-warn); border-color: var(--cx-warn-line); }

/* Insights bars */
.cx-content .insight-row { grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr) minmax(7rem, auto); }
.cx-content .insight-track { height: 8px; background: #edf1f6; }
.cx-content #chart > section { background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg); padding: 20px 22px; box-shadow: var(--cx-shadow-xs); margin-bottom: 16px; }
.cx-content #chart > section h2 { margin-top: 0; }

/* ---------- Invoices and Expenditure workspaces ---------- */

body.cx .rail { background: var(--cx-surface); border-right: 1px solid var(--cx-border); padding: 16px 12px; }
body.cx .rail-head .primary, body.cx .rail-head button { width: 100%; }
body.cx .invoice-item, body.cx .rail .request-item, body.cx .rail button.r-item {
  border-radius: var(--cx-r); border-left: 0; padding: 10px 12px; color: var(--cx-text);
}
body.cx .invoice-item:hover { background: var(--cx-surface-2); }
body.cx .invoice-item.selected { background: var(--cx-accent-tint); box-shadow: inset 3px 0 0 var(--cx-accent); }
body.cx .invoice-item strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.cx .invoice-item span { color: var(--cx-text-3); font-size: 12.5px; }
body.cx #desk, body.cx .workspace > main { padding: 0 28px 48px; background: var(--cx-bg); }
body.cx .actions {
  position: sticky; top: 0; z-index: 5; margin: 0 -28px 16px; padding: 12px 28px;
  background: color-mix(in srgb, var(--cx-bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cx-border);
}
body.cx .paper { border-radius: 4px; box-shadow: var(--cx-shadow-md); border: 1px solid var(--cx-border); max-width: 100%; }
body.cx .empty { border-radius: var(--cx-r-xl); box-shadow: var(--cx-shadow-md); border: 1px solid var(--cx-border); }
body.cx .warning { border-radius: var(--cx-r); border: 1px solid var(--cx-warn-line); border-left: 3px solid var(--cx-warn); background: var(--cx-warn-bg); color: #7a2e0e; }
body.cx .line-table { overflow-x: auto; max-width: 100%; }
body.cx .save-state { color: var(--cx-text-3); font-size: 12.5px; }

/* ---------- Dialogs ---------- */

.cx-dialog, .part-dialog, .cx-news {
  width: min(560px, calc(100vw - 48px)); max-height: calc(100vh - 64px); overflow: auto;
  padding: 24px; border: 1px solid var(--cx-border); border-radius: var(--cx-r-xl);
  background: var(--cx-surface); color: var(--cx-text); box-shadow: var(--cx-shadow-lg);
}
.cx-dialog::backdrop, .part-dialog::backdrop, .cx-news::backdrop { background: rgba(12, 29, 49, .5); backdrop-filter: blur(3px); }
.cx-dialog h2, .part-dialog h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: var(--cx-text); }
.cx-dialog > p, .part-dialog > p { margin: 0 0 14px; }
.part-dialog h3 { margin: 16px 0 8px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--cx-text-3); }
.part-list { gap: 6px; }
.part-choice { min-height: 42px; border-radius: var(--cx-r); border: 1px solid var(--cx-border); background: var(--cx-surface); color: var(--cx-text); font-weight: 600; }
.part-choice:hover { border-color: var(--cx-border-strong); background: var(--cx-surface-2); }
.part-choice[aria-pressed="true"] { border-color: var(--cx-accent); background: var(--cx-accent-tint); box-shadow: inset 3px 0 0 var(--cx-accent); }
.cx-dialog-actions, .part-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--cx-border); }
.cx-status-line { margin: 12px 0 0; color: var(--cx-text-2); font-size: 13px; }
.cx-status-line:empty { display: none; }
.cx-update-notes { max-height: 240px; overflow: auto; margin: 4px 0 0; padding: 12px 14px; background: var(--cx-surface-2); border: 1px solid var(--cx-border); border-radius: var(--cx-r); }
.cx-update-notes h3 { margin: 8px 0 4px; font-size: 13px; }
.cx-update-notes p { margin: 0 0 6px; color: var(--cx-text-2); }

/* What's new */
.cx-news { width: min(600px, calc(100vw - 48px)); padding: 0; overflow: hidden; display: none; flex-direction: column; }
.cx-news[open] { display: flex; }
.cx-news-head { padding: 24px 26px 18px; background: linear-gradient(135deg, var(--cx-side-bg) 0%, #183a5c 100%); color: #fff; }
.cx-news-head .cx-eyebrow { color: #7fe3f0; }
.cx-news-head h2 { margin: 6px 0 4px; font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: #fff; }
.cx-news-version { margin: 0; color: #a9b8ca; font-size: 13px; }
.cx-news-body { padding: 18px 26px 6px; overflow: auto; min-height: 0; }
.cx-news-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 26px 18px; border-top: 1px solid var(--cx-border); background: var(--cx-surface-2); }
.cx-change-groups { display: grid; gap: 14px; }
.cx-change-group h4 { display: inline-flex; margin: 0 0 6px; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; }
.cx-change-group ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--cx-text-2); }
.cx-change-group li::marker { color: var(--cx-border-strong); }
.cx-change-group.added h4, .cx-kind.added { background: var(--cx-success-bg); color: var(--cx-success); border-color: var(--cx-success-line); }
.cx-change-group.changed h4, .cx-kind.changed { background: var(--cx-info-bg); color: var(--cx-info); border-color: var(--cx-info-line); }
.cx-change-group.fixed h4, .cx-kind.fixed { background: var(--cx-warn-bg); color: var(--cx-warn); border-color: var(--cx-warn-line); }
.cx-news-older { margin: 16px 0 8px; padding: 10px 14px; border: 1px solid var(--cx-border); border-radius: var(--cx-r); background: var(--cx-surface-2); }
.cx-news-older summary { cursor: pointer; font-weight: 600; color: var(--cx-text-2); }
.cx-news-older h3 { margin: 14px 0 8px; font-size: 14px; }
.cx-news-summary { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.cx-news-summary li { display: flex; gap: 10px; align-items: baseline; color: var(--cx-text-2); }
.cx-kind { flex: none; display: inline-flex; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.8; border: 1px solid transparent; }
.cx-news-card { border-top: 3px solid var(--cx-accent); }

.cx-timeline { position: relative; display: grid; gap: 18px; padding-left: 28px; }
.cx-timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--cx-border); border-radius: 2px; }
.cx-release { position: relative; }
.cx-release-marker { position: absolute; left: -28px; top: 22px; width: 16px; height: 16px; border-radius: 50%; background: var(--cx-surface); border: 3px solid var(--cx-accent); box-shadow: 0 0 0 4px var(--cx-bg); }
.cx-release:not(:first-child) .cx-release-marker { border-color: var(--cx-border-strong); }
.cx-release .cx-card-head > div { min-width: 0; }
.cx-release .cx-card-head { flex-wrap: wrap; }

/* ---------- Toasts ---------- */

.cx-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.cx-toast { margin: 0; padding: 12px 14px; border-radius: var(--cx-r); background: var(--cx-side-bg); color: #fff; box-shadow: var(--cx-shadow-lg); font-size: 13px; animation: cx-rise .2s ease both; }
.cx-toast.warn { background: #7a2e0e; }
@keyframes cx-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Loading screen ---------- */

#fd-boot { background: radial-gradient(1200px 600px at 50% 35%, #ffffff 0%, var(--cx-bg) 70%); gap: 18px; }
#fd-boot img { height: 120px; }
#fd-boot p { color: var(--cx-text-2); font-size: 14px; max-width: 34rem; }
#fd-boot .fd-boot-bar { position: relative; width: 160px; height: 3px; border-radius: 3px; background: var(--cx-border); overflow: hidden; }
#fd-boot .fd-boot-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 3px; background: var(--cx-accent); animation: cx-load 1.1s ease-in-out infinite; }
#fd-boot:has(.fd-boot-actions:not(:empty)) .fd-boot-bar { display: none; }
@keyframes cx-load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
#fd-boot .fd-boot-actions .cx-btn, #fd-boot .fd-btn { min-height: 38px; }

/* ---------- Sign-in ---------- */

.signin { background: radial-gradient(900px 500px at 70% 10%, #e6f6f9 0%, transparent 60%), radial-gradient(900px 600px at 0% 100%, #e8eef7 0%, transparent 60%), var(--cx-bg); }
.signin-card { border: 1px solid var(--cx-border); border-radius: var(--cx-r-xl); box-shadow: var(--cx-shadow-lg); padding: 36px 34px; }
.signin-card h1 { color: var(--cx-text); }
.signin-card p { color: var(--cx-text-2); }
.signin-card input { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--cx-border-strong); border-radius: var(--cx-r); font: inherit; font-size: 15px; }
.signin-card input:focus { outline: none; border-color: var(--cx-accent); box-shadow: 0 0 0 3px var(--cx-focus); }
.signin-card button { width: 100%; min-height: 42px; }
.signin-card .quiet { width: auto; }

@media (prefers-reduced-motion: reduce) {
  body.cx #app, .cx-collapse .cx-icon, .cx-toast { transition: none; animation: none; }
  #fd-boot .fd-boot-bar::after { animation: none; }
}

/* ---------- Unit picker ---------- */

.cx-unit-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--cx-r); background: rgba(255, 255, 255, .06);
  color: var(--cx-side-text-strong); font: inherit; text-align: left; cursor: pointer; transition: background .12s ease, border-color .12s ease;
}
.cx-unit-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); }
.cx-unit-btn:disabled { cursor: default; }
.cx-unit-btn:disabled > .cx-icon { display: none; }
.cx-unit-btn > .cx-icon { width: 16px; height: 16px; color: var(--cx-side-muted); flex: none; }
.cx-unit-mark {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 7px;
  background: var(--cx-accent); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em;
}
body[data-scope="holding"] .cx-unit-mark { background: #b8902a; }
.cx-unit-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.cx-unit-name { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-unit-meta { font-size: 11.5px; color: var(--cx-side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-unit { padding: 0; background: none; border: 0; gap: 6px; margin: 0 2px 10px; }
.cx-unit-label { padding-left: 2px; }

.cx-unit-btn.compact { width: auto; max-width: 240px; padding: 3px 10px 3px 3px; background: var(--cx-surface); border-color: var(--cx-border); color: var(--cx-text); }
.cx-unit-btn.compact:hover:not(:disabled) { background: var(--cx-surface-2); border-color: var(--cx-border-strong); }
.cx-unit-btn.compact .cx-unit-mark { width: 28px; height: 28px; font-size: 10px; }
.cx-unit-btn.compact .cx-unit-meta { color: var(--cx-text-3); }
.cx-unit-btn.compact > .cx-icon { color: var(--cx-text-3); }

.cx-pop {
  position: fixed; z-index: 70; display: flex; flex-direction: column; overflow: hidden;
  background: var(--cx-surface); color: var(--cx-text); border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg); box-shadow: var(--cx-shadow-lg);
  animation: cx-rise .14s ease both;
}
.cx-pop-search { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--cx-border); color: var(--cx-text-3); }
.cx-pop-search input { flex: 1; min-width: 0; border: 0; outline: none; font: inherit; font-size: 14px; color: var(--cx-text); background: transparent; }
.cx-unit-list { overflow: auto; padding: 6px; display: grid; gap: 1px; }
.cx-unit-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 6px 10px; border: 0; border-radius: var(--cx-r-sm);
  background: transparent; color: var(--cx-text); font: inherit; text-align: left; cursor: pointer;
}
.cx-unit-row:hover, .cx-unit-row:focus-visible { background: var(--cx-surface-2); outline: none; }
.cx-unit-row[aria-selected="true"] { background: var(--cx-accent-tint); }
.cx-unit-row > .cx-icon { color: var(--cx-accent); width: 16px; height: 16px; }
.cx-unit-row-name { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-weight: 550; }
.cx-unit-row-name > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-unit-row-name .cx-icon { width: 16px; height: 16px; color: var(--cx-text-3); }
.cx-unit-prefix { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--cx-text-3); }
.cx-role-chip { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--cx-surface-2); color: var(--cx-text-2); border: 1px solid var(--cx-border); }
.cx-role-chip.admin { background: #f4f3ff; color: #5925dc; border-color: #d9d6fe; }
.cx-role-chip.finance { background: var(--cx-success-bg); color: var(--cx-success); border-color: var(--cx-success-line); }
.cx-role-chip.approver { background: var(--cx-info-bg); color: var(--cx-info); border-color: var(--cx-info-line); }

/* ---------- Notifications ---------- */

.cx-inbox { position: relative; }
.cx-count {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #f04438; color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--cx-surface); display: none;
}
.cx-icon-btn.has-count .cx-count { display: block; }
.cx-inbox-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-height: min(480px, calc(100vh - 90px)); }
.cx-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--cx-border); }
.cx-link-btn { border: 0; background: none; padding: 0; color: var(--cx-info); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.cx-link-btn:hover { text-decoration: underline; }
.cx-inbox-list { overflow: auto; padding: 6px; display: grid; gap: 2px; }
.cx-inbox-item {
  position: relative; display: grid; gap: 2px; width: 100%; padding: 10px 12px 10px 24px; border: 0; border-radius: var(--cx-r-sm);
  background: transparent; color: var(--cx-text-2); font: inherit; text-align: left; cursor: pointer;
}
.cx-inbox-item:hover { background: var(--cx-surface-2); }
.cx-inbox-item.unread { color: var(--cx-text); }
.cx-inbox-item.unread::before { content: ""; position: absolute; left: 10px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--cx-info); }
.cx-inbox-title { font-weight: 550; font-size: 13.5px; line-height: 1.35; }
.cx-inbox-item.unread .cx-inbox-title { font-weight: 650; }
.cx-inbox-meta { font-size: 12px; color: var(--cx-text-3); }
.cx-empty-note { margin: 0; padding: 22px 16px; text-align: center; color: var(--cx-text-3); font-size: 13px; }

/* ---------- Account ---------- */

.cx-user-text { display: grid; line-height: 1.2; text-transform: none; text-align: left; min-width: 0; max-width: 170px; }
.cx-user-name { font-size: 13px; font-weight: 650; color: var(--cx-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-user-job { font-size: 11.5px; font-weight: 500; color: var(--cx-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-user-chip { padding-right: 12px; }
.cx-user-menu { width: 290px; }
.cx-user-head { display: flex; gap: 12px; align-items: flex-start; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--cx-border); }
.cx-avatar.lg { width: 40px; height: 40px; font-size: 14px; flex: none; }
.cx-user-ident { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.cx-user-ident strong { font-size: 14px; }
.cx-user-ident > span { overflow-wrap: anywhere; color: var(--cx-text-2); }
.cx-user-ident .cx-pill { justify-self: start; margin-top: 4px; }
.cx-menu-item { margin-top: 2px; text-decoration: none; }
.cx-menu-item .cx-icon { width: 16px; height: 16px; color: var(--cx-text-3); }
.cx-menu-item:hover { color: var(--cx-text); }
.cx-menu-item.danger-item:hover { color: var(--cx-danger); }
.cx-menu-item.danger-item:hover .cx-icon { color: var(--cx-danger); }
@media (max-width: 1240px) { .cx-user-text { display: none; } .cx-user-chip { padding-right: 3px; } }

/* ---------- Shared page parts: tabs, toolbars, chips ---------- */

.cx-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cx-toolbar input[type="search"], .cx-toolbar select {
  min-height: 34px; padding: 0 10px; border: 1px solid var(--cx-border-strong); border-radius: var(--cx-r);
  background: var(--cx-surface); color: var(--cx-text); font: inherit; font-size: 13px;
}
.cx-toolbar input[type="search"] { min-width: 220px; }
.cx-toolbar input:focus, .cx-toolbar select:focus { outline: none; border-color: var(--cx-accent); box-shadow: 0 0 0 3px var(--cx-focus); }
.cx-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cx-text-2); cursor: pointer; }
.cx-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--cx-r); background: #eef1f5; border: 1px solid var(--cx-border); }
.cx-tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--cx-text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cx-tab:hover { color: var(--cx-text); }
.cx-tab.on { background: var(--cx-surface); color: var(--cx-text); box-shadow: var(--cx-shadow-xs); }
.cx-tab-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--cx-surface-2); color: var(--cx-text-3); font-size: 11.5px; line-height: 18px; text-align: center; }
.cx-tab.on .cx-tab-count { background: var(--cx-accent-tint); color: var(--cx-text); }
.cx-card-head .cx-toolbar { margin-left: auto; }
.cx-content .cx-card-head { flex-wrap: wrap; }
.small { font-size: 12px; }
.cx-content .group-table td.wrap { white-space: normal; min-width: 180px; }
.cx-content .group-table.compact td, .cx-content .group-table.compact th { padding: 7px 10px; }
.cx-content .group-table th:not(.num), .cx-content .group-table td:not(.num) { text-align: left; }
.cx-content .group-table th.num, .cx-content .group-table td.num { text-align: right; }

/* ---------- Tracker ---------- */

.track-table tr.row-link { cursor: pointer; }
.track-table tr.row-link:focus-visible { outline: 2px solid var(--cx-accent); outline-offset: -2px; }
.track-table tr.mine-to-do td:first-child { box-shadow: inset 3px 0 0 var(--cx-accent); }
.track-ref { display: flex; align-items: center; gap: 8px; }
.track-title { margin-top: 2px; color: var(--cx-text); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-chip { padding: 0 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 18px; }
.kind-chip.expense { background: #fef6ee; color: #b93815; }
.kind-chip.request { background: var(--cx-info-bg); color: var(--cx-info); }
.stage { display: grid; gap: 5px; min-width: 170px; }
.stage-bar { display: flex; gap: 3px; }
.stage-step { flex: 1; height: 6px; border-radius: 3px; background: #e6eaf0; }
.stage-step.done { background: var(--cx-success); opacity: .55; }
.stage-step.now { background: var(--cx-accent); }
.stage-label { font-size: 12px; color: var(--cx-text-2); }
.stage-label.bad { color: var(--cx-danger); }
.next-mine { color: var(--cx-text); font-weight: 600; }

/* ---------- People ---------- */

.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell > div { display: grid; line-height: 1.3; }
.person-cell .muted { font-size: 12.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.people-table tr.inactive td { opacity: .6; }
.role-guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.role-card { padding: 14px; border: 1px solid var(--cx-border); border-radius: var(--cx-r); background: var(--cx-surface-2); }
.role-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--cx-text-2); display: grid; gap: 4px; font-size: 13px; }
.people-dialog { width: min(620px, calc(100vw - 48px)); }
.dialog-form { display: grid; gap: 2px; }
.dialog-form .field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--cx-text-2); }
.dialog-form .field input, .dialog-form .field select, .role-row select {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--cx-border-strong); border-radius: var(--cx-r);
  background: var(--cx-surface); color: var(--cx-text); font: inherit; font-size: 14px; font-weight: 400;
}
.dialog-form .field input:focus, .dialog-form .field select:focus, .role-row select:focus { outline: none; border-color: var(--cx-accent); box-shadow: 0 0 0 3px var(--cx-focus); }
.dialog-form h3 { margin: 8px 0 8px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--cx-text-3); }
.role-rows { display: grid; gap: 6px; }
.role-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--cx-border); border-radius: var(--cx-r); }
.role-row.add { margin-top: 6px; border-style: dashed; }
.role-row .role-unit { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-row { margin: 14px 0 2px; font-weight: 600; color: var(--cx-text); }

/* ---------- Insights ---------- */

.insights-toolbar { justify-content: space-between; }
.kpi-grid .dash-card.kpi.good strong { color: var(--cx-success); }
.kpi-grid .dash-card.kpi.warn strong { color: var(--cx-warn); }
.chart-box { min-height: 200px; }
.trend-svg { width: 100%; height: 280px; display: block; }
.trend-svg .grid { stroke: #edf0f4; stroke-width: 1; }
.trend-svg .axis { fill: var(--cx-text-3); font-size: 11px; font-family: var(--cx-font); }
.s-invoiced { fill: #2369b1; background: #2369b1; }
.s-received { fill: #12a594; background: #12a594; }
.s-spent { fill: #f79009; background: #f79009; }
.s-amber { background: #fdb022; }
.s-orange { background: #f97316; }
.s-red { background: #e5484d; }
.s-dark-red { background: #9b1c1c; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--cx-text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(7rem, 13rem) minmax(0, 1fr) minmax(6.5rem, auto); gap: 12px; align-items: center; font-size: 13px; }
.hbar-label { color: var(--cx-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 10px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 99px; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.ins-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.tax-block h3 { margin: 18px 0 10px; font-size: 13px; color: var(--cx-text-2); }

/* ---------- Home activity ---------- */

.activity-list .activity-item { display: grid; gap: 2px; align-items: start; }
.activity-list .activity-item strong { font-weight: 650; color: var(--cx-text); }
.cx-unit-list { overflow-x: hidden; }
.cx-unit-row-name > span { min-width: 0; }
.cx-unit-row-name > span:nth-child(2) { flex: 0 1 auto; }
.cx-unit-row .cx-role-chip { margin-left: auto; }
/* Toolbars keep their controls on one line; the panel form style would make them full width. */
.cx-content .dash-panel .cx-toolbar input[type="search"],
.cx-content .dash-panel .cx-toolbar select,
.cx-content .cx-toolbar select { width: auto; min-height: 34px; padding: 0 10px; font-size: 13px; box-shadow: none; }
.cx-content .dash-panel .cx-toolbar input[type="search"] { width: 240px; }
.cx-content .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1680px) { .cx-content .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* Inside a scroll box the table is a normal full-width table; the box does the scrolling. */
.cx-content .table-scroll > .group-table { display: table; width: 100%; }
.cx-dialog input[type="checkbox"], .cx-dialog input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; box-shadow: none; accent-color: var(--cx-primary); }
.switch-row { display: flex; align-items: center; gap: 8px; }
/* One unit only: the picker shows where you are, at full strength, without the chevron. */
.cx-unit-btn:disabled { opacity: 1; }
