@import url('/assets/fonts/signal-fonts.css');
/* Signal UI kit: Untitled UI visual language (cool gray + Jones IT blue), shared with Tracker.
   Screen-only skin. Print keeps the compact light report rules from layout(). */

:root {
  --signal-panel: var(--paper);
  --signal-line: var(--line);
  --signal-muted: var(--muted);
  --signal-text: var(--ink);
  --signal-raised: var(--surface-raised);
  --signal-blue: var(--primary);
}

:root,
:root[data-theme='light'] {
  color-scheme: light;
  --brand-25: #f5fafd;
  --brand-50: #eef6fb;
  --brand-100: #d9ebf5;
  --brand-200: #b5d7eb;
  --brand-300: #85bcdd;
  --brand-400: #4f9dcb;
  --brand-500: #328bbd;
  --brand-600: #287fae;
  --brand-700: #1e5f83;
  --brand-800: #1b4f6c;
  --gray-25: #fdfdfd;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e9eaeb;
  --gray-300: #d5d7da;
  --gray-400: #a4a7ae;
  --gray-500: #717680;
  --gray-600: #535862;
  --gray-700: #414651;
  --gray-800: #252b37;
  --gray-900: #181d27;
  --gray-950: #0a0d12;

  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-text: var(--brand-700);
  --primary-tint: var(--brand-50);
  --primary-pale: var(--brand-100);
  --page: #ffffff;
  --page-alt: var(--gray-50);
  --paper: #ffffff;
  --surface-raised: var(--gray-50);
  --hover: var(--gray-50);
  --field: #ffffff;
  --ink: var(--gray-900);
  --ink-2: var(--gray-700);
  --muted: var(--gray-600);
  --muted-2: var(--gray-500);
  --icon: var(--gray-400);
  --line: var(--gray-200);
  --line-strong: var(--gray-300);
  --track: var(--gray-100);
  --bar: var(--brand-500);
  --link: var(--brand-700);
  --warning-bg: #fffaeb;
  --warning-line: #fedf89;
  --warning-text: #b54708;
  --success: #067647;
  --success-bg: #ecfdf3;
  --danger: #d92d20;
  --gold: #dc6803;
  --silver: #717680;
  --bronze: #b54708;
  --rail-bg: #ffffff;

  --shadow-xs: 0 1px 2px rgba(10, 13, 18, 0.05);
  --shadow-sm: 0 1px 3px rgba(10, 13, 18, 0.1), 0 1px 2px -1px rgba(10, 13, 18, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(10, 13, 18, 0.1), 0 2px 4px -2px rgba(10, 13, 18, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(10, 13, 18, 0.08), 0 4px 6px -2px rgba(10, 13, 18, 0.03), 0 2px 2px -1px rgba(10, 13, 18, 0.04);
  --shadow-skeu: inset 0 0 0 1px rgba(10, 13, 18, 0.18), inset 0 -2px 0 rgba(10, 13, 18, 0.05);
  --focus-ring: 0 0 0 2px var(--page), 0 0 0 4px var(--brand-500);
  --radius: 12px;
  --radius-sm: 8px;
  --rail-width: 72px;
}

/* Print always uses the light palette. */
@media screen {
  :root[data-theme='dark'] {
    color-scheme: dark;
    --gray-50: #f7f7f7;
    --gray-100: #f0f0f1;
    --gray-200: #ececed;
    --gray-300: #cecfd2;
    --gray-400: #94969c;
    --gray-500: #85888e;
    --gray-600: #61656c;
    --gray-700: #373a41;
    --gray-800: #22262f;
    --gray-900: #13161b;
    --gray-950: #0c0e12;

    --primary: var(--brand-600);
    --primary-hover: var(--brand-500);
    --primary-text: var(--brand-300);
    --primary-tint: #0f2a3b;
    --primary-pale: #19425a;
    --page: var(--gray-950);
    --page-alt: var(--gray-950);
    --paper: var(--gray-900);
    --surface-raised: var(--gray-800);
    --hover: #1a1d24;
    --field: var(--gray-950);
    --ink: #f7f7f7;
    --ink-2: var(--gray-300);
    --muted: var(--gray-400);
    --muted-2: var(--gray-500);
    --icon: var(--gray-500);
    --line: var(--gray-800);
    --line-strong: var(--gray-700);
    --track: var(--gray-800);
    --bar: var(--brand-400);
    --link: var(--brand-300);
    --warning-bg: #2b1d0e;
    --warning-line: #4e3410;
    --warning-text: #fdb022;
    --success: #47cd89;
    --success-bg: #053321;
    --danger: #f97066;
    --gold: #fdb022;
    --silver: #cecfd2;
    --bronze: #f38744;
    --rail-bg: var(--gray-950);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-skeu: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 -2px 0 rgba(10, 13, 18, 0.05);
  }

  /* Unlisted Blush theme. Light rules apply; only the palette changes. */
  :root[data-theme='light'][data-blush] {
    --brand-25: #fff7fa;
    --brand-50: #fdeef4;
    --brand-100: #fbdbe7;
    --brand-200: #f7b9d0;
    --brand-300: #f190b4;
    --brand-400: #e86a98;
    --brand-500: #dc4d82;
    --brand-600: #c93a70;
    --brand-700: #a52d5b;
    --brand-800: #84264b;
    --gray-50: #fff8fb;
    --gray-100: #fdf0f5;
    --gray-200: #f6dfe8;
    --gray-300: #ecc9d7;
    --page: #fffafc;
    --page-alt: #fff3f7;
    --surface-raised: #fff5f9;
    --hover: #fdeef4;
    --rail-bg: #fff0f6;
    --line: #f6dfe8;
    --line-strong: #ecc9d7;
    --track: #fde4ee;
    --ink: #3b1d2a;
    --muted: #8a5a6e;
    --icon: #d38aa8;
    --shadow-xs: 0 1px 2px rgba(201, 58, 112, 0.08);
    --shadow-sm: 0 1px 3px rgba(201, 58, 112, 0.12), 0 1px 2px -1px rgba(201, 58, 112, 0.1);
  }
  :root[data-blush] th { background: #fff3f7; }
  :root[data-blush] .avatar { background: #fbdbe7; color: #a52d5b; }
}

@media screen {
  /* Base */
  body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 400 14px/1.5 Figtree, 'Avenir Next', 'Segoe UI', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 40px 72px;
    box-sizing: border-box;
  }
  h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
  h2 { margin: 32px 0 12px; font-size: 18px; line-height: 1.4; font-weight: 600; letter-spacing: 0; color: var(--ink); }
  h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
  p { line-height: 1.5; }
  a { color: var(--link); text-decoration: none; font-weight: 500; }
  a:hover { text-decoration: underline; text-underline-offset: 3px; }
  small, .muted, .other, .period, .report-title, .trend-label, .trend-value, .gauge-period { color: var(--muted); }
  .eyebrow { margin: 0 0 4px; color: var(--primary-text); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  :is(a, button, summary, input, select, [tabindex]):focus-visible { outline: none; box-shadow: var(--focus-ring); }
  input:focus, select:focus, button:focus, a:focus { outline: none; }

  /* Buttons */
  button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-xs), var(--shadow-skeu), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background-color 0.1s, color 0.1s, box-shadow 0.1s;
  }
  button:hover, .button:hover { background: var(--primary-hover); text-decoration: none; }
  button:focus-visible, .button:focus-visible { box-shadow: var(--shadow-skeu), var(--focus-ring); }
  button:disabled { opacity: 0.5; cursor: not-allowed; }
  button .icon, .button .icon { width: 20px; height: 20px; flex: none; }
  .secondary, .button.secondary {
    border: 0;
    background: var(--paper);
    color: var(--ink-2);
    box-shadow: var(--shadow-xs), var(--shadow-skeu), inset 0 0 0 1px var(--line-strong);
  }
  .secondary:hover, .button.secondary:hover { background: var(--hover); color: var(--ink); }
  .secondary:focus-visible { box-shadow: inset 0 0 0 1px var(--line-strong), var(--focus-ring); }
  .tertiary, .button.tertiary { background: transparent; color: var(--muted); box-shadow: none; }
  .tertiary:hover, .button.tertiary:hover { background: var(--hover); color: var(--ink-2); }
  .button.small, button.small { min-height: 36px; padding: 0 12px; }

  /* Form controls */
  input, select, textarea {
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--field);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    line-height: 20px;
    box-sizing: border-box;
    max-width: 100%;
    box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong);
  }
  input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: inset 0 0 0 1px var(--brand-500), 0 0 0 3px color-mix(in srgb, var(--brand-500) 25%, transparent); }
  input[type=checkbox], input[type=radio] { min-height: 0; box-shadow: none; accent-color: var(--primary); }
  input[type=file] { min-height: 0; padding: 0; background: transparent; box-shadow: none; color: var(--muted); font-size: 13px; }
  input[type=file]::file-selector-button {
    margin-right: 10px;
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--paper);
    color: var(--ink-2);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong);
  }
  input[type=file]::file-selector-button:hover { background: var(--hover); color: var(--ink); }
  .photo-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .photo-upload input[type=file] { flex: 0 1 260px; min-width: 0; }
  table + button, .table-wrap + button, table + .button, .table-wrap + .button { margin-top: 16px; }
  .table-wrap + form, table + form { margin-top: 16px; }
  .button-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .badge-success { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-bg); color: var(--success); }
  .badge-warning { border-color: var(--warning-line); background: var(--warning-bg); color: var(--warning-text); }
  :root[data-theme='dark'] .badge.badge-success { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-bg); color: var(--success); }
  :root[data-theme='dark'] .badge.badge-warning { border-color: var(--warning-line); background: var(--warning-bg); color: var(--warning-text); }
  .panel.provider-card { max-width: none; padding: 0; overflow: hidden; }
  .provider-card > summary { list-style: none; cursor: pointer; }
  .provider-card > summary::-webkit-details-marker { display: none; }
  .provider-card:not([open]) > .provider-head { border-bottom: 0; }
  .provider-card > summary:hover { background: var(--hover); }
  .provider-card > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--brand-500); }
  .provider-chevron { display: flex; flex: none; color: var(--muted); transition: transform 0.15s; }
  .provider-card[open] .provider-chevron { transform: rotate(90deg); color: var(--ink); }
  .provider-head { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
  .provider-head > div { flex: 1; min-width: 0; }
  .provider-head h2 { margin: 0 0 2px; }
  .provider-head p { margin: 0; font-size: 14px; }
  .provider-mark { flex: none; padding: 8px; box-sizing: content-box; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
  .provider-setup { max-width: none; margin: 0; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--page-alt); }
  .provider-setup summary { cursor: pointer; color: var(--ink-2); font-size: 14px; font-weight: 600; }
  .provider-setup ol { margin: 12px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; line-height: 22px; }
  .provider-setup li + li { margin-top: 6px; }
  .provider-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding: 24px; }
  .provider-form > label { display: flex; flex-direction: column; gap: 6px; }
  .provider-form > label input:not([type=checkbox]) { width: 100%; }
  .provider-form .provider-toggle { grid-column: 1 / -1; flex-direction: row; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
  .provider-toggle input { flex: none; width: 16px; height: 16px; min-height: 0; margin: 2px 0 0; }
  .provider-toggle span { display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-weight: 600; }
  .provider-toggle small { color: var(--muted); font-size: 13px; font-weight: 400; }
  .provider-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
  .provider-foot p { margin: 0; font-size: 13px; }
  @media (max-width: 720px) { .provider-form { grid-template-columns: 1fr; } }
  :root[data-theme='dark'] input[type=date]::-webkit-calendar-picker-indicator { filter: invert(0.8); }
  label { color: var(--ink-2); font-size: 14px; font-weight: 500; }

  /* Toolbar: date range + segmented period shortcuts */
  .toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin: 0 0 24px; }
  .range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 24px; }
  .toolbar .range-form { margin: 0; }
  .range-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
  .range-form input, .range-form select { margin: 0; }
  .range-form button { background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-xs), var(--shadow-skeu), inset 0 0 0 1px var(--line-strong); }
  .range-form button:hover { background: var(--hover); color: var(--ink); }
  .period-shortcuts, .segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    border-radius: var(--radius-sm);
    background: var(--paper);
    box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong);
    overflow: hidden;
  }
  .period-shortcuts a, .segmented > * {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 0;
    border-right: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
  }
  .period-shortcuts a:last-child, .segmented > *:last-child { border-right: 0; }
  .period-shortcuts a:hover, .segmented > *:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
  .period-shortcuts a[aria-current], .segmented > [aria-current], .segmented > [aria-pressed=true] { background: var(--surface-raised); color: var(--ink); }
  :root[data-theme='dark'] .period-shortcuts a[aria-current] { background: var(--gray-800); }

  /* Surfaces */
  .panel, .card, .metric-card, .areas, .team-tile, .gauge {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
  }
  .panel { padding: 24px; margin: 24px 0; }
  .panel h2 { margin: 0 0 8px; }
  .card { padding: 20px; margin: 20px 0; }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
  .metric-card { padding: 20px 24px; border-top: 1px solid var(--line); }
  .metric-card span { display: block; color: var(--muted); font-size: 14px; font-weight: 500; }
  .metric-card strong { display: block; margin-top: 8px; color: var(--ink); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

  /* Notices and badges */
  .coverage, .print-help {
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--page-alt);
    color: var(--muted);
    font-size: 13px;
  }
  :root[data-theme='dark'] .coverage, :root[data-theme='dark'] .print-help { background: var(--gray-900); }
  .warn {
    padding: 12px 16px;
    border: 1px solid var(--warning-line);
    border-left: 1px solid var(--warning-line);
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 13px;
  }
  .tag, .badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid var(--brand-200);
    border-radius: 999px;
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: 12px;
    font-weight: 500;
  }
  :root[data-theme='dark'] .tag, :root[data-theme='dark'] .badge { background: var(--primary-tint); border-color: var(--primary-pale); color: var(--brand-300); }
  .empty-state { display: grid; place-items: center; gap: 4px; padding: 32px 16px; color: var(--muted); text-align: center; }

  /* Tables */
  .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
  table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); color: var(--ink); }
  th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
  th { background: var(--page-alt); color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
  :root[data-theme='dark'] th { background: var(--gray-900); }
  td { color: var(--ink-2); font-size: 14px; }
  td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  tbody tr:last-child td { border-bottom: 0; }
  tbody tr:hover { background: var(--hover); }

  /* Leaderboards and avatars */
  .leaderboard { margin: 0; padding: 0; list-style: none; border-radius: 0; box-shadow: none; }
  .leaderboard li, .leaderboard li:first-child, .leaderboard li:nth-child(2), .leaderboard li:nth-child(3) {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    background: transparent;
    border-bottom: 1px solid var(--line);
  }
  .leaderboard li:last-child { border-bottom: 0; }
  .leaderboard li:hover { background: var(--hover); }
  .leaderboard li a { flex: 1; min-width: 0; color: var(--ink); font-weight: 500; }
  .leaderboard li strong { color: var(--ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .rank {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 999px;
    background: var(--surface-raised);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }
  .leaderboard li:nth-child(1) .rank { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
  .leaderboard li:nth-child(2) .rank { background: color-mix(in srgb, var(--silver) 18%, transparent); color: var(--silver); }
  .leaderboard li:nth-child(3) .rank { background: color-mix(in srgb, var(--bronze) 16%, transparent); color: var(--bronze); }
  .avatar, img.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: 13px;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(10, 13, 18, 0.08);
  }
  :root[data-theme='dark'] .avatar { background: var(--primary-pale); color: var(--brand-200); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
  .person-photo { display: block; object-fit: cover; object-position: 50% 0%; }
  .leader-target { color: var(--muted); }

  /* Bars and trends */
  .bar-track, .trend-track, .client-bar > div { background: var(--track); }
  .bar-track span, .trend-track span, .client-bar > div > span { background: var(--bar); }
  .trend-column { min-width: 0; }
  .trend-value { display: flex; align-items: end; justify-content: center; min-height: 28px; overflow-wrap: anywhere; font-size: 10px; line-height: 1.2; }
  .trend-track { border-radius: 6px 6px 2px 2px; }
  .trend-track span { border-radius: 4px 4px 0 0; }
  .trend-data summary, .work-table summary, details summary { color: var(--link); font-weight: 500; cursor: pointer; }

  /* Team pages inherit the kit */
  .team-tile { color: var(--ink); text-decoration: none; }
  .team-tile:hover { border-color: var(--brand-300); box-shadow: var(--shadow-md); text-decoration: none; }
  .team-tile strong { color: var(--ink); font-weight: 600; }

  /* Icon rail. The window stays put; each page scrolls under its header. */
  html:has(.app-rail) { height: 100%; }
  body:has(.app-rail) { height: 100%; padding-left: var(--rail-width); overflow: hidden; }
  .app-rail {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: var(--rail-width);
    padding: 16px 0 12px;
    box-sizing: border-box;
    background: var(--rail-bg);
    border-right: 1px solid var(--line);
  }
  .rail-brand { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
  .rail-brand img { width: 20px; height: 30px; object-fit: contain; }
  .rail-brand:hover { background: var(--hover); text-decoration: none; }
  .rail-top { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; }
  .rail-brand-title, .rail-brand-divider, .rail-brand-by { display: none; }
  .rail-toggle.rail-item {
    position: absolute;
    z-index: 2;
    top: 6px;
    right: 0;
    width: 28px;
    height: 28px;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--rail-bg);
    color: var(--muted);
    box-shadow: var(--shadow-xs);
    transform: translateX(64%);
  }
  .rail-toggle .icon { width: 16px; height: 16px; }
  .rail-toggle:hover { background: var(--paper); color: var(--ink); }
  .rail-nav, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
  .rail-nav { gap: 10px; }
  .rail-section { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
  .rail-section + .rail-section { padding-top: 10px; border-top: 0; }
  .rail-section + .rail-section::before { content: ""; width: 16px; height: 1px; margin: 0 0 8px; background: var(--line); }
  .rail-section-title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
  }
  .rail-bottom { margin-top: auto; gap: 8px; }
  .rail-bottom > .rail-account { position: relative; padding-top: 9px; }
  .rail-bottom > .rail-account::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 16px;
    height: 1px;
    background: var(--line);
    transform: translateX(-50%);
  }
  .rail-divider { width: 32px; height: 1px; margin: 8px 0; background: var(--line); }
  .rail-item {
    box-sizing: border-box;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--icon);
    box-shadow: none;
    cursor: pointer;
    list-style: none;
  }
  .rail-item::-webkit-details-marker { display: none; }
  .rail-item .icon { width: 22px; height: 22px; }
  .rail-item:hover { background: var(--hover); color: var(--muted); text-decoration: none; }
  .rail-item[aria-current], .rail-group.selected > .rail-item, .rail-group[open] > .rail-item { background: var(--primary-tint); color: var(--primary); }
  :root[data-theme='dark'] .rail-item[aria-current], :root[data-theme='dark'] .rail-group.selected > .rail-item, :root[data-theme='dark'] .rail-group[open] > .rail-item { color: var(--brand-300); }
  .rail-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail-item[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 22px);
    top: 50%;
    z-index: 30;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--gray-900);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity 0.12s, transform 0.12s;
  }
  :root[data-theme='dark'] .rail-item[data-tip]::after { background: var(--gray-800); }
  .rail-item[data-tip]:hover::after, .rail-item[data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
  .rail-group { position: relative; }
  .rail-menu {
    position: absolute;
    left: calc(100% + 22px);
    top: 0;
    z-index: 30;
    min-width: 240px;
    padding: 4px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper);
    box-shadow: var(--shadow-lg);
  }
  .rail-bottom .rail-menu { top: auto; bottom: 0; }
  .rail-menu-title { margin: 0; padding: 10px 14px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
  .rail-menu-section { margin: 6px 14px 0; padding: 8px 0 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; }
  .rail-menu > .rail-menu-section:first-of-type { margin-top: 0; padding-top: 2px; border-top: 0; }
  .rail-menu a { display: flex; align-items: center; gap: 8px; margin: 1px 6px; padding: 9px 10px; border-radius: 6px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
  .rail-menu a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
  .rail-menu a[aria-current] { background: var(--primary-tint); color: var(--primary-text); }
  /* Account menu: avatar, appearance and sign out */
  .rail-account > .rail-item .avatar { width: 36px; height: 36px; font-size: 12px; color: var(--brand-700); }
  .rail-account > .rail-item .rail-avatar { background: var(--surface-raised); color: var(--muted); }
  .rail-account > .rail-item .rail-avatar .icon { width: 18px; height: 18px; }
  .rail-account > .rail-item:hover .avatar, .rail-account[open] > .rail-item .avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--brand-300); }
  .rail-account[open] > .rail-item, .rail-account > .rail-item:hover { background: transparent; }
  .rail-account .rail-menu { min-width: 260px; padding: 0 0 6px; }
  .rail-account-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .rail-account-head:empty { display: none; }
  .rail-account-head .avatar { width: 40px; height: 40px; }
  .rail-account-head > div { display: grid; min-width: 0; }
  .rail-account-head strong { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .rail-account-head small { color: var(--muted); font-size: 13px; }
  .rail-theme-options { display: flex; margin: 0 14px 8px; }
  .rail-theme-options > button { flex: 1; justify-content: center; gap: 6px; min-height: 36px; padding: 0 10px; box-shadow: none; font-size: 13px; }
  .rail-theme-options > button .icon { width: 16px; height: 16px; }
  .rail-session { margin: 0; padding-top: 4px; border-top: 1px solid var(--line); }
  .rail-session:empty { display: none; }
  .rail-menu-item { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: calc(100% - 12px); min-height: 0; margin: 1px 6px; padding: 9px 10px; border-radius: 6px; background: transparent; color: var(--ink-2); box-shadow: none; font-size: 14px; font-weight: 500; }
  .rail-menu-item:hover { background: var(--hover); color: var(--ink); }
  .rail-menu-item .icon { width: 16px; height: 16px; color: var(--icon); }

  @media (min-width: 761px) {
    :root[data-sidebar='expanded'] { --rail-width: 272px; }
    :root[data-sidebar='expanded'] .app-rail { align-items: stretch; gap: 18px; padding: 14px 12px 12px; overflow: visible; }
    :root[data-sidebar='expanded'] .rail-top { box-sizing: border-box; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; height: 44px; padding: 0 0 0 10px; }
    :root[data-sidebar='expanded'] .rail-brand { display: flex; align-items: center; justify-content: flex-start; gap: 0; width: auto; height: 44px; padding: 0; background: transparent; }
    :root[data-sidebar='expanded'] .rail-brand:hover { background: transparent; text-decoration: none; }
    :root[data-sidebar='expanded'] .rail-brand img { width: 22px; height: 34px; margin: 0 6px 0 0; }
    :root[data-sidebar='expanded'] .rail-brand-title { display: inline; color: var(--ink); font-size: 16px; font-weight: 600; letter-spacing: -0.03em; }
    :root[data-sidebar='expanded'] .rail-brand-divider { display: block; width: 1px; height: 16px; margin: 0 8px; background: var(--line-strong); }
    :root[data-sidebar='expanded'] .rail-brand-by { display: inline; color: var(--muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
    :root[data-sidebar='expanded'] .rail-toggle.rail-item { position: static; width: 32px; height: 32px; min-height: 32px; border: 0; background: transparent; box-shadow: none; transform: none; }
    :root[data-sidebar='expanded'] .rail-nav,
    :root[data-sidebar='expanded'] .rail-bottom,
    :root[data-sidebar='expanded'] .rail-section { align-items: stretch; width: 100%; }
    :root[data-sidebar='expanded'] .rail-nav { gap: 0; }
    :root[data-sidebar='expanded'] .rail-section { gap: 2px; }
    :root[data-sidebar='expanded'] .rail-section + .rail-section { margin-top: 18px; padding-top: 0; border-top: 0; }
    :root[data-sidebar='expanded'] .rail-section + .rail-section::before { content: none; }
    :root[data-sidebar='expanded'] .rail-section-title { position: static; width: auto; height: auto; margin: 0 0 4px; overflow: visible; clip: auto; padding: 0 10px; text-align: left; font-size: 12px; font-weight: 600; line-height: 16px; }
    :root[data-sidebar='expanded'] .rail-section > .rail-item,
    :root[data-sidebar='expanded'] .rail-group,
    :root[data-sidebar='expanded'] .rail-bottom > .rail-group { width: 100%; }
    :root[data-sidebar='expanded'] .rail-item:not(.rail-toggle) { justify-content: flex-start; gap: 10px; width: 100%; height: 36px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; }
    :root[data-sidebar='expanded'] .rail-group > .rail-item { width: 100%; }
    :root[data-sidebar='expanded'] .rail-item > .icon { width: 18px; height: 18px; flex-shrink: 0; }
    :root[data-sidebar='expanded'] .rail-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap; color: inherit; }
    :root[data-sidebar='expanded'] .rail-item[data-tip]::after { display: none; }
    :root[data-sidebar='expanded'] .rail-bottom { gap: 0; margin-top: auto; padding-top: 0; border-top: 0; }
    :root[data-sidebar='expanded'] .rail-bottom > .rail-account { margin-top: 12px; padding-top: 12px; }
    :root[data-sidebar='expanded'] .rail-bottom > .rail-account::before { left: 0; width: 100%; transform: none; }
    :root[data-sidebar='expanded'] .rail-account > .rail-item .avatar { width: 24px; height: 24px; margin: 0; font-size: 11px; }
    :root[data-sidebar='expanded'] .rail-account > .rail-item:hover,
    :root[data-sidebar='expanded'] .rail-account[open] > .rail-item { background: var(--hover); }
    :root[data-sidebar='expanded'] .rail-account > .rail-item:hover .avatar,
    :root[data-sidebar='expanded'] .rail-account[open] > .rail-item .avatar { box-shadow: none; }
  }

  /* Page header */
  .page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 0 0 24px; padding: 0 0 20px; border-bottom: 1px solid var(--line); }
  .page-header h1 { margin: 0; }
  .page-header .lede { margin: 4px 0 0; max-width: 72ch; color: var(--muted); font-size: 14px; }
  .page-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  #layout-status { color: var(--muted); font-size: 13px; }
  #layout-status:empty { display: none; }

  html:has(dialog:modal) { overflow: hidden; }
  dialog:modal, dialog:modal .widget-editor-body { overscroll-behavior: contain; }

  /* Section tabs, filter chips and search */
  .page-lede { margin: -8px 0 20px; color: var(--muted); font-size: 15px; }
  .section-tabs-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
  .section-tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
  .section-tabs a { padding: 10px 2px 12px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; }
  .section-tabs a:hover { color: var(--ink); text-decoration: none; }
  .section-tabs a[aria-current] { border-bottom-color: var(--primary); color: var(--primary); }
  .section-tabs-row .badge { margin-bottom: 8px; }
  .filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
  .filter-chips a { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
  .filter-chips a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
  .filter-chips a[aria-current] { border-color: var(--primary); background: var(--primary-tint); color: var(--primary); }
  .chip-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
  .filter-chips a[aria-current] .chip-count { background: var(--paper); color: var(--primary); }
  .report-filters, .library-filters { justify-content: flex-start; align-items: center; margin-bottom: 16px; }
  .search-field { position: relative; display: block; flex: 1 1 260px; max-width: 360px; margin: 0; }
  .search-field .icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--icon); pointer-events: none; }
  .search-field input { width: 100%; padding-left: 38px; }
  .check-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; }
  .check-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); color: var(--primary); }
  .check-chip input { margin: 0; }
  .table-count { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
  .library-filters .table-count { margin: 0 0 0 auto; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* Time entry work notes */
  .note-cell { min-width: 260px; max-width: 520px; }
  .entries-table td:first-child, .entries-table td.num { white-space: nowrap; }
  .entries-table td:nth-child(2), .entries-table td:nth-child(3) { min-width: 140px; }
  .page-toolbar { align-items: flex-end; }
  .timesheet-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
  .timesheet-filters .range-form, .timesheet-filters .segmented { margin: 0; }
  .timesheet-filters .ui-select-trigger { max-width: 240px; }
  .timesheet-summary .cards { margin-top: 0; }
  .timesheet-alerts { display: grid; gap: 8px; margin: 0 0 16px; }
  .timesheet-alerts > .warn, .timesheet-alerts > .coverage { margin: 0; }
  .timesheet-entries td:nth-child(2), .timesheet-entries td:nth-child(3) { min-width: 0; }
  .timesheet-entries td:first-child { width: 112px; }
  .timesheet-entries td.num { width: 88px; }
  .timesheet-work { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .timesheet-work strong { color: var(--ink); font-weight: 600; }
  .timesheet-work small { color: var(--muted); }
  .timesheet-status { margin-top: 8px; color: var(--muted); font-size: 13px; }
  .timesheet-status p { margin: 0 0 4px; }
  .pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
  .work-note > summary { display: block; list-style: none; cursor: pointer; }
  .work-note > summary::-webkit-details-marker { display: none; }
  .note-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--ink-2); font-size: 14px; font-weight: 400; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
  .work-note[open] .note-text { display: block; -webkit-line-clamp: unset; }
  .note-more, .note-less { display: inline-block; margin-top: 4px; color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }
  .work-note:not([open]) .note-less, .work-note[open] .note-more { display: none; }
  .work-note.fits .note-more { display: none; }
  .work-note.fits > summary { cursor: default; }
  .note-empty { color: var(--muted); font-size: 13px; font-style: italic; }

  /* Widget Library */
  .library-group { margin: 28px 0 0; scroll-margin-top: 16px; }
  .library-group h2 { margin: 0 0 12px; font-size: 16px; }
  .widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
  .widget-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-xs); }
  .widget-card h3 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 600; }
  .widget-card p { flex: 1; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
  .used-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
  .used-in > span { margin-right: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
  .used-in .tag { text-decoration: none; }
  .used-in .tag:hover { text-decoration: underline; }

  /* Dashboard header, views and toolbar */
  .page-header.dashboard-heading { margin-bottom: 16px; }
  .page-header #dashboard-description { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
  .page-header #dashboard-description:empty { display: none; }
  .dashboard-actions button .icon { width: 18px; height: 18px; }
  .menu-button { position: relative; }
  .page-header #dashboard-settings.menu-button > summary { box-sizing: border-box; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong); list-style: none; cursor: pointer; }
  .page-header .menu-button > summary::-webkit-details-marker { display: none; }
  .page-header .menu-button > summary:hover, .page-header .menu-button[open] > summary { background: var(--hover); color: var(--ink); }
  .page-header .dashboard-menu { right: 0; min-width: 200px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-lg); }
  .page-header .dashboard-menu button { justify-content: flex-start; width: 100%; min-height: 0; padding: 9px 10px; border-radius: 6px; background: transparent; color: var(--ink-2); box-shadow: none; font-size: 14px; font-weight: 500; }
  .page-header .dashboard-menu button:hover { background: var(--hover); color: var(--ink); }
  .page-header .dashboard-menu button[data-board-action='delete'] { color: var(--danger, #d92d20); }
  .view-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
  .view-tabs[hidden] { display: none; }
  .view-tab { min-height: 34px; padding: 0 12px; border-radius: var(--radius-sm); background: transparent; color: var(--muted); box-shadow: none; font-size: 14px; font-weight: 600; }
  .view-tab:hover { background: var(--hover); color: var(--ink); }
  .view-tab[aria-pressed=true] { background: var(--primary-tint); color: var(--primary); }
  .view-tab:not([aria-pressed]) { color: var(--primary); }
  .dashboard-toolbar { align-items: center; justify-content: flex-start; }
  .dashboard-toolbar .period-shortcuts { order: -1; margin: 0; }
  .dashboard-toolbar > a.button { margin-left: auto; }
  .dashboard-toolbar .range-form { align-items: center; gap: 8px; }
  .dashboard-toolbar .range-form label { font-size: 0; gap: 0; }
  .dashboard-toolbar .range-form label > * { font-size: 14px; }
  .dashboard-toolbar .gauge-period { margin: 0; color: var(--muted); }
  .edit-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-2); font-size: 14px; }
  .edit-bar[hidden] { display: none; }
  .edit-bar > .icon { flex: none; color: var(--primary); }
  .edit-bar-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; flex: 1; }
  .edit-bar-text strong { color: var(--ink); font-weight: 600; }
  .edit-hint { color: var(--muted); }
  .edit-state { flex: none; padding: 2px 10px; border-radius: 999px; background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 600; }
  .edit-state.dirty { background: var(--primary-tint); color: var(--primary); }
  .dashboard-editing #layout-status:empty { display: none; }
  .dashboard-editing .page-header #add-widget { background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong); }
  .dashboard-editing .page-header #add-widget:hover { background: var(--hover); color: var(--ink); }
  .dashboard-actions #cancel-changes { order: 1; }
  .dashboard-actions #save-dashboard { order: 2; }
  .dashboard-actions #dashboard-settings { order: 3; }
  .page-header #save-dashboard:disabled { opacity: 1; background: var(--hover); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }

  /* Session control fallback (pages without the rail) */
  .session-control { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
  .session-control button { min-height: 32px; padding: 0 12px; font-size: 13px; background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong); }

  /* Sign-in */
  body:has(.signal-signin) { background: var(--page-alt); }
  .signal-signin {
    display: grid;
    justify-items: center;
    gap: 24px;
    width: 100%;
    max-width: 400px;
    margin: 10vh auto 0;
    padding: 40px 32px 32px;
    box-sizing: border-box;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
  }
  .signal-signin-art { width: 56px; height: 56px; object-fit: contain; padding: 8px; border-radius: var(--radius); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-100); }
  :root[data-theme='dark'] .signal-signin-art { background: var(--primary-tint); box-shadow: inset 0 0 0 1px var(--primary-pale); }
  .signal-signin h1 { margin: 4px 0 8px; font-size: 24px; }
  .signal-signin p { margin: 0 0 16px; color: var(--muted); }
  .signal-signin > div { width: 100%; }
  .signal-signin .button, .signal-signin button { width: 100%; }
  .signal-signin .eyebrow { margin: 0; }
  .signal-signin .panel { padding: 16px; margin: 16px 0 0; text-align: left; }

  /* Small screens: rail becomes a bottom bar */
  @media (max-width: 760px) {
    body:has(.app-rail) { padding-left: 0; padding-bottom: 0; overflow: hidden; }
    main, main:has(.gauge-grid) { padding: 20px 16px 48px; }
    main:has(.app-rail) { height: 100%; padding: 0; }
    main:has(.app-rail):not(:has(.page-head)) { padding: 20px 16px 88px; }
    .page-head, .page-scroll { padding-inline: 16px; }
    .page-head { padding-top: 16px; }
    .page-scroll { padding-top: 16px; padding-bottom: 88px; }
    h1 { font-size: 22px; }
    .app-rail {
      inset: auto 0 0 0;
      flex-direction: row;
      justify-content: space-between;
      gap: 4px;
      width: auto;
      height: 64px;
      padding: 0 8px;
      border-right: 0;
      border-top: 1px solid var(--line);
    }
    .rail-top, .rail-brand, .rail-divider, .rail-section-title { display: none; }
    .rail-section + .rail-section::before { content: none; }
    .rail-section { display: contents; }
    .rail-nav, .rail-bottom { flex-direction: row; justify-content: center; width: auto; margin: 0; gap: 2px; }
    .rail-bottom > .rail-account { margin-top: 0; padding-top: 0; }
    .rail-bottom > .rail-account::before { content: none; }
    .rail-nav { flex: 1; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
    .rail-item { width: 40px; height: 40px; min-height: 40px; }
    .rail-item[data-tip]::after { display: none; }
    .rail-menu, .rail-bottom .rail-menu { position: fixed; left: 8px; right: 8px; top: auto; bottom: 72px; min-width: 0; }
    .page-header { align-items: flex-start; }
    .toolbar { align-items: stretch; }
    .period-shortcuts { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .period-shortcuts a { flex: 1 0 auto; justify-content: center; padding: 0 10px; font-size: 13px; white-space: nowrap; }
    .signal-signin { margin-top: 32px; }
  }

  /* Page title with optional info popover */
  .title-row { display: flex; align-items: center; gap: 6px; margin: 0 0 24px; padding: 0 0 20px; border-bottom: 1px solid var(--line); }
  .page-header .title-row { margin: 0; padding: 0; border: 0; }
  .title-row:has(+ .section-tabs-row) { margin-bottom: 8px; padding-bottom: 0; border-bottom: 0; }
  .title-row h1 { margin: 0; }

  main:has(.app-rail) {
    --page-measure: 1600px;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  main:has(.app-rail):not(:has(.page-head)) {
    overflow: auto;
    padding: 32px max(40px, calc((100% - var(--page-measure)) / 2)) 72px;
  }
  .page-head {
    flex: none;
    position: relative;
    z-index: 6;
    box-sizing: border-box;
    background: var(--page);
    border-bottom: 1px solid var(--line);
    padding: 24px max(40px, calc((100% - var(--page-measure)) / 2)) 16px;
  }
  .page-head > .page-header,
  .page-head > .title-row { margin: 0; padding: 0; border: 0; background: transparent; }
  .page-head > .page-header.dashboard-heading { margin: 0; }
  .page-head > .section-tabs-row,
  .page-head > .view-tabs,
  .page-head > .page-lede,
  .page-head > .dashboard-toolbar,
  .page-head > .page-toolbar,
  .page-head > .edit-bar,
  .page-head > #layout-status { margin-bottom: 0; }
  .page-head > .section-tabs-row { width: 100%; min-width: 0; margin-top: 8px; margin-bottom: 0; border-bottom: 0; }
  .page-head > .section-tabs-row:last-child { margin-bottom: -16px; }
  .page-head .section-tabs { flex-wrap: wrap; min-width: 0; overflow: visible; }
  .page-head > .view-tabs { margin-top: 4px; padding-bottom: 0; border-bottom: 0; }
  .page-head > .page-lede { margin-top: 8px; }
  .page-head > .gauge-period { margin: 8px 0 0; }
  .page-head > .dashboard-toolbar,
  .page-head > .page-toolbar { margin-top: 12px; }
  .page-head > .edit-bar { margin-top: 12px; }
  .page-head > #layout-status:not(:empty) { margin-top: 8px; }
  .page-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    padding: 24px max(40px, calc((100% - var(--page-measure)) / 2)) 72px;
  }
  .info-tip { position: relative; }
  .info-tip > summary { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--icon); cursor: pointer; list-style: none; }
  .info-tip > summary::-webkit-details-marker { display: none; }
  .info-tip > summary:hover, .info-tip[open] > summary { background: var(--hover); color: var(--ink-2); }
  .info-tip > summary .icon { width: 18px; height: 18px; }
  .info-tip-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: max-content; max-width: min(380px, calc(100vw - 32px)); padding: 12px 14px; border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-2); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); font-size: 13px; font-weight: 400; line-height: 1.5; animation: ui-drop 0.12s ease-out; }
  .info-tip-panel p { margin: 0; }
  .info-tip-panel p + p { margin-top: 8px; }

  /* Select and date picker (signal-controls.js) */
  .ui-select, .ui-date { position: relative; display: inline-flex; vertical-align: bottom; max-width: 100%; }
  .ui-select-trigger, .ui-date-trigger {
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 0 12px 0 14px;
    background: var(--field);
    color: var(--ink);
    font-weight: 400;
    text-align: left;
    box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line-strong);
  }
  .ui-select-trigger { min-width: 140px; }
  .ui-date-trigger { min-width: 152px; font-variant-numeric: tabular-nums; }
  .ui-select-trigger:hover, .ui-date-trigger:hover { background: var(--field); color: var(--ink); }
  .ui-select-trigger:focus-visible, .ui-date-trigger:focus-visible,
  .ui-select[data-open] > .ui-select-trigger, .ui-date[data-open] > .ui-date-trigger { box-shadow: var(--shadow-xs), inset 0 0 0 2px var(--brand-500); }
  .ui-select[data-invalid] > .ui-select-trigger, .ui-date[data-invalid] > .ui-date-trigger { box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--danger); }
  .ui-select-trigger > .icon, .ui-date-trigger > .icon { width: 16px; height: 16px; flex: none; color: var(--icon); transition: transform 0.15s; }
  .ui-select[data-open] > .ui-select-trigger > .icon { transform: rotate(180deg); }
  .ui-select-value, .ui-date-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ui-select-value[data-placeholder], .ui-date-value[data-placeholder] { color: var(--muted-2); }

  .ui-popover-backdrop { position: fixed; inset: 0; z-index: 55; background: transparent; }
  .ui-popover {
    position: fixed;
    z-index: 60;
    box-sizing: border-box;
    max-width: calc(100vw - 16px);
    background: var(--paper);
    color: var(--ink);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
    animation: ui-drop 0.12s ease-out;
  }
  .ui-popover[data-placement='top'] { animation-name: ui-lift; }
  @keyframes ui-drop { from { opacity: 0; transform: translateY(-4px); } }
  @keyframes ui-lift { from { opacity: 0; transform: translateY(4px); } }
  .ui-select-popover { display: flex; flex-direction: column; max-height: min(320px, calc(100vh - 24px)); overflow: hidden; }
  .ui-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); color: var(--icon); }
  .ui-search .icon { width: 15px; height: 15px; flex: none; }
  .ui-search input, .ui-search input:focus-visible { flex: 1; min-height: 42px; margin: 0; padding: 0; background: transparent; box-shadow: none; }
  .ui-search input::-webkit-search-cancel-button { display: none; }
  .ui-listbox { flex: 1; min-height: 0; padding: 4px; overflow: auto; overscroll-behavior: contain; outline: none; }
  .ui-option { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 6px; color: var(--ink); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
  .ui-option[hidden], .ui-section[hidden] { display: none; }
  .ui-option > span { flex: 1; min-width: 0; }
  .ui-option[data-focused] { background: var(--hover); }
  :root[data-theme='dark'] .ui-option[data-focused] { background: var(--surface-raised); }
  .ui-option[aria-disabled='true'] { opacity: 0.5; cursor: default; }
  .ui-option > .icon { width: 16px; height: 16px; flex: none; color: var(--primary); }
  :root[data-theme='dark'] .ui-option > .icon { color: var(--brand-300); }
  .ui-section:not(:first-child) { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
  .ui-section-header { padding: 8px 10px 4px; color: var(--muted-2); font-size: 12px; font-weight: 600; }
  .ui-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 14px; }

  .ui-calendar-dialog { padding: 16px; }
  .ui-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
  .ui-calendar-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
  .ui-calendar-head .icon-button { width: 36px; min-width: 36px; min-height: 36px; padding: 0; color: var(--muted); }
  .ui-calendar-head .icon-button .icon { width: 18px; height: 18px; }
  .ui-calendar-grid { border-collapse: collapse; border: 0; }
  .ui-calendar-grid th { width: 40px; padding: 0 0 6px; background: transparent; border: 0; color: var(--muted); font-size: 13px; font-weight: 500; text-align: center; text-transform: none; letter-spacing: 0; }
  .ui-calendar-grid td { padding: 1px 0; border: 0; background: transparent; }
  .ui-calendar-cell { position: relative; display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; background: transparent; color: var(--ink-2); box-shadow: none; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .ui-calendar-cell:hover { background: var(--hover); color: var(--ink); }
  :root[data-theme='dark'] .ui-calendar-cell:hover { background: var(--surface-raised); }
  .ui-calendar-cell[data-outside-month] { color: var(--icon); }
  .ui-calendar-cell[data-today]::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--primary); }
  .ui-calendar-cell[data-selected], .ui-calendar-cell[data-selected]:hover { background: var(--primary); color: #fff; font-weight: 600; }
  .ui-calendar-cell[data-selected]::after { background: #fff; }
  .ui-calendar-cell:focus-visible { box-shadow: var(--focus-ring); }
  .ui-calendar-cell:disabled { background: transparent; color: var(--icon); opacity: 0.45; }
  .ui-calendar-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
  .card-controls .ui-select-trigger > .icon { width: 14px; height: 14px; }

  /* Staging banner, inserted by the staging wrapper above page content */
  main > aside[role='status'] { margin: 0 0 24px; border-radius: var(--radius-sm); }

  /* Charts, tables and cards with live data */
  .trend-value, .trend-label { white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
  .trend-label { overflow: hidden; text-align: center; font-size: 11px; }
  @media (max-width: 760px) { .trend-value { visibility: hidden; } }
  .table-wrap th { white-space: nowrap; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

  /* Title row actions and directory */
  .title-actions { display: flex; align-items: center; gap: 8px; margin: 0 0 0 auto; }
  .directory-sync { margin-bottom: 8px; font-size: 13px; }
  .internal-report-grid { margin-bottom: 24px; }
  .internal-report-grid h3 a { color: var(--ink); text-decoration: none; }
  .internal-report-grid h3 a:hover { color: var(--primary); }
  .internal-report-grid .used-in { justify-content: space-between; }
  .internal-report-grid .used-in > span:first-child { color: var(--ink-2); font-size: 13px; font-weight: 500; }
  .internal-report-grid .used-in > .badge-success { color: var(--success); }
  .internal-report-grid .used-in > .badge-warning { color: var(--warning-text); }

  /* Report tools: comparison queue, delivery, and schedule */
  .status-line { margin: 0 0 20px; }
  .stack-form { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
  .stack-form > label { align-items: flex-start; }
  .stack-form .ui-date { width: 220px; max-width: 100%; }
  .compare-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
  .stack-form > label, .compare-form > label { display: flex; flex-direction: column; gap: 6px; }
  .stack-form input:not([type=checkbox]), .stack-form textarea, .compare-form input, .compare-form textarea { width: 100%; }
  .stack-form .full, .compare-form .full, .stack-form .form-actions { grid-column: 1 / -1; }
  .stack-form .check-row { flex-direction: row; align-items: flex-start; gap: 10px; }
  .stack-form .check-row input { width: 16px; height: 16px; min-height: 0; margin: 2px 0 0; }
  .stack-form .check-row span { display: flex; flex-direction: column; gap: 2px; color: var(--ink); font-weight: 600; }
  .stack-form .check-row small { color: var(--muted); font-size: 13px; font-weight: 400; }
  .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .compare-card { margin: 0 0 16px; }
  .compare-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }
  .compare-meta strong { color: var(--ink); font-weight: 600; }
  .compare-form textarea { min-height: 88px; }
  .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .row-actions form { margin: 0; }
  .readiness-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; margin: 16px 0 0; }
  .readiness-stats div { display: flex; flex-direction: column; gap: 4px; }
  .readiness-stats dt { color: var(--muted); font-size: 13px; font-weight: 500; }
  .readiness-stats dd { margin: 0; color: var(--ink); font-size: 16px; font-weight: 600; }
  .readiness-stats dd.num { font-size: 24px; font-variant-numeric: tabular-nums; }
  .empty-state strong { color: var(--ink); font-size: 14px; }
  #identity-review, #delivery-preferences { scroll-margin-top: 24px; }
  @media (max-width: 720px) {
    .compare-form { grid-template-columns: 1fr; }
    .readiness-stats { grid-template-columns: 1fr 1fr; }
  }
}

.ui-native { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; pointer-events: none; }

@media print {
  html, body, main, .page-head, .page-scroll { height: auto !important; max-height: none !important; overflow: visible !important; display: block !important; }
  .page-head, .page-scroll { padding: 0 !important; border: 0 !important; }
  .app-rail, .session-control, .ui-popover, .ui-popover-backdrop, .info-tip { display: none !important; }
  body { padding: 0 !important; }
}
