/* ---------- base ---------- */
html{ font-size:var(--fs-base); }
html, body{ margin:0; min-height:100%; background:var(--bg); color:var(--text); }
body{
  font-family:var(--font); line-height:var(--lh-base);
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
}
*, *::before, *::after{ box-sizing:border-box; }
a{ color:var(--primary-text); }
h1, h2, h3{ margin:0; font-weight:600; letter-spacing:-.01em; }
h1{ font-size:var(--fs-title-1); line-height:1.2; }
h2{ font-size:var(--fs-title-2); line-height:1.25; }
h3{ font-size:var(--fs-title-3); line-height:1.3; }
.num, .tabular{ font-variant-numeric:tabular-nums; }
.muted{ color:var(--text-2); }
.small{ font-size:var(--fs-small); }
.caption{ font-size:var(--fs-caption); color:var(--text-2); text-transform:uppercase; letter-spacing:.06em; font-weight:600; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
/* skip link: hidden until keyboard focus, then a visible pill above everything (WCAG 2.4.1 / 2.4.7) */
.skip-link:focus{ position:fixed; top:8px; left:8px; width:auto; height:auto; margin:0; padding:8px 14px; clip:auto; overflow:visible;
  z-index:2000; background:var(--primary); color:var(--on-primary); border-radius:var(--radius-pill); box-shadow:var(--shadow-2); text-decoration:none; }
:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; border-radius:6px; }
.mud-typography, .mud-input, .mud-button-root, .mud-table{ font-family:var(--font) !important; }

/* MudBlazor surfaces follow our tokens */
.mud-paper{ background-color:var(--surface); color:var(--text); }
.mud-popover{ border:1px solid var(--hairline); border-radius:var(--radius-control) !important; }

/* ---------- shell ---------- */
.shell{
  display:grid; grid-template-columns:var(--sidebar-w) minmax(0,1fr);
  min-height:100vh; transition:grid-template-columns var(--dur-slow) var(--ease-out);
}
.shell.rail{ grid-template-columns:var(--sidebar-rail-w) minmax(0,1fr); }
.main{ min-width:0; display:flex; flex-direction:column; }
.content{ padding:20px 24px 40px; flex:1; min-width:0; }

/* ---------- sidebar ---------- */
.sidebar{
  position:sticky; top:0; height:100vh; padding:12px 0 12px 12px; z-index:1200;
}
.sidebar-panel{
  height:100%; display:flex; flex-direction:column; border-radius:18px; overflow:hidden;
}
.sidebar-head{
  display:flex; align-items:center; gap:10px; padding:14px 14px 10px; min-height:56px;
}
.sidebar-scroll{ flex:1; overflow-y:auto; overflow-x:hidden; padding:4px 8px 12px; position:relative; scrollbar-width:thin; }
.nav-section{ margin-top:10px; }
.nav-section-title{
  display:flex; align-items:center; width:100%; gap:8px; padding:6px 10px; border:0; background:none;
  color:var(--text-2); font:inherit; font-size:var(--fs-caption); font-weight:600; letter-spacing:.06em;
  text-transform:uppercase; cursor:pointer; border-radius:8px; min-height:32px;
}
.nav-section-title:hover{ color:var(--text); }
.nav-section-title .chev{ margin-left:auto; transition:transform var(--dur) var(--ease-out); }
.nav-section.collapsed .chev{ transform:rotate(-90deg); }
.nav-items{ display:grid; grid-template-rows:1fr; transition:grid-template-rows var(--dur-slow) var(--ease-out); }
.nav-section.collapsed .nav-items{ grid-template-rows:0fr; }
.nav-items > div{ overflow:hidden; }
.nav-link{
  position:relative; z-index:1; display:flex; align-items:center; gap:12px;
  min-height:40px; padding:8px 12px; margin:1px 0; border-radius:10px;
  color:var(--text); text-decoration:none; font-size:14px; font-weight:500; white-space:nowrap;
}
.nav-link:hover{ background:var(--row-hover); }
.nav-link .mud-icon-root{ flex:none; color:var(--text-2); font-size:20px; }
.nav-link.active{ color:var(--primary-text); font-weight:600; }
.nav-link.active .mud-icon-root{ color:var(--primary); }
.nav-link .planned{ margin-left:auto; font-size:11px; color:var(--text-2); font-weight:500; }
.nav-indicator{
  position:absolute; left:8px; right:8px; top:0; height:40px; z-index:0; border-radius:10px;
  background:color-mix(in srgb, var(--primary) 16%, transparent);
  box-shadow:inset 3px 0 0 var(--primary);
  opacity:0; pointer-events:none;
}
.nav-indicator.ready{ opacity:1; }
.sidebar-foot{ padding:10px 14px; border-top:1px solid var(--line); font-size:var(--fs-caption); color:var(--text-2); }
.shell.rail .nav-link span.label, .shell.rail .nav-section-title span, .shell.rail .nav-section-title .chev,
.shell.rail .sidebar-foot, .shell.rail .wordmark-text, .shell.rail .nav-link .planned{ display:none; }
.shell.rail .nav-link{ justify-content:center; padding:8px; }
.shell.rail .nav-section-title{ justify-content:center; }
.shell.rail .nav-section.collapsed .nav-items{ grid-template-rows:1fr; }
/* the rail is 68px: logo and expand button stack, or the button is clipped and the rail can't be expanded again */
.shell.rail .sidebar-head{ flex-direction:column; gap:6px; padding:12px 0 6px; }
/* the rail still scrolls, but without a visible scrollbar eating 12 of its 40px (items and the active pill went off-centre) */
.shell.rail .sidebar-scroll{ scrollbar-width:none; }
.shell.rail .sidebar-scroll::-webkit-scrollbar{ display:none; }
@media (min-width:600px) and (max-width:1024px){
  .shell:not(.drawer-open) .sidebar-scroll{ scrollbar-width:none; }
  .shell:not(.drawer-open) .sidebar-scroll::-webkit-scrollbar{ display:none; }
}
.shell.rail .sidebar-head .mud-spacer{ display:none; }

/* ---------- top bar ---------- */
.topbar{
  position:sticky; top:12px; z-index:1100; margin:12px 24px 0; min-height:var(--topbar-h);
  display:flex; align-items:center; gap:8px; padding:6px 10px 6px 12px; border-radius:16px;
}
.breadcrumb{ display:flex; align-items:center; gap:6px; min-width:0; font-size:14px; color:var(--text-2); }
.breadcrumb a{ color:var(--text-2); text-decoration:none; }
.breadcrumb a:hover{ color:var(--text); }
.breadcrumb .current{ color:var(--text); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.topbar .spacer{ flex:1; }
.search-trigger{
  display:flex; align-items:center; gap:8px; min-height:36px; padding:0 10px 0 12px; min-width:220px;
  border:1px solid var(--line); border-radius:var(--radius-control); background:color-mix(in srgb, var(--surface) 50%, transparent);
  color:var(--text-2); font:inherit; font-size:14px; cursor:pointer;
}
.search-trigger:hover{ border-color:var(--primary); color:var(--text); }
.kbd{
  display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 6px;
  border:1px solid var(--line); border-bottom-width:2px; border-radius:6px; font-size:11px; font-weight:600;
  color:var(--text-2); background:var(--surface); font-family:var(--font);
}
.search-trigger .kbd{ margin-left:auto; }
.search-trigger .label, .search-trigger .kbd{ white-space:nowrap; }
/* small laptops: the search box goes icon-only so the breadcrumb isn't cut to "Home > Live > C…" */
@media (max-width:1280px){ .search-trigger{ min-width:0; } .search-trigger .label, .search-trigger .kbd{ display:none; } }
.date-chip{
  display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:0 12px; border-radius:var(--radius-pill);
  background:color-mix(in srgb, var(--primary) 12%, transparent); color:var(--primary-text); font-size:13px; font-weight:600;
  font-variant-numeric:tabular-nums; white-space:nowrap;
}
.user-btn{ display:flex; align-items:center; gap:8px; border:0; background:none; font:inherit; color:var(--text); cursor:pointer; padding:4px 6px; border-radius:10px; min-height:40px; }
.user-btn:hover{ background:var(--row-hover); }
.user-btn .user-name{ white-space:nowrap; max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.avatar{
  width:32px; height:32px; border-radius:50%; display:grid; place-items:center; font-weight:600; font-size:13px;
  background:linear-gradient(135deg, var(--vibs-blue-400), var(--vibs-accent)); color:var(--vibs-white);
}

/* ---------- page header ---------- */
.page-header{ display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin:10px 0 18px; }
.page-header .titles{ min-width:0; }
.page-header .subtitle{ color:var(--text-2); margin-top:4px; }
.page-header .actions{ margin-left:auto; display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.star-btn.on .mud-icon-root{ color:var(--warning-text); }

/* ---------- logo ---------- */
.wordmark{ display:flex; align-items:center; gap:10px; text-decoration:none; color:var(--text); }
/* route badge (brand/README.md): VIBS badge shape + rising route ending in the VIBS red */
.wordmark-mark{ width:32px; height:32px; flex:none; display:block; }
.wordmark-mark .badge{ fill:var(--brand-blue); }
.wordmark-mark .route{ fill:none; stroke:var(--vibs-white); stroke-width:5; stroke-linecap:round; stroke-linejoin:round; }
.wordmark-mark .dot{ fill:var(--brand-red); stroke:var(--vibs-white); stroke-width:2.5; }
.wordmark-text{ font-size:19px; line-height:1; letter-spacing:-.02em; white-space:nowrap; }
.wordmark-text b{ font-weight:650; color:var(--brand-blue); }
[data-theme="dark"] .wordmark-text b{ color:var(--brand-blue-light); }
.wordmark-text span{ font-weight:400; color:var(--wordmark); }
.login-card .wordmark-mark{ width:44px; height:44px; }
.login-card .wordmark-text{ font-size:25px; }

/* ---------- cards, tiles ---------- */
.card-pad{ padding:18px 20px; }
.card-head{ display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-bottom:12px; min-width:0; }
.card-head h3{ min-width:0; overflow-wrap:anywhere; }
/* an unpadded card (a table edge to edge) still pads its own heading */
.card:not(.card-pad) > .card-head{ padding:14px 16px 0; margin-bottom:10px; }
/* tables in cards scroll inside the card instead of spilling out of it */
.card{ min-width:0; }
.card:not(.card-pad):has(> .simple-table){ overflow-x:auto; }
.grid-auto{ display:grid; gap:16px; grid-template-columns:repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.stack{ display:flex; flex-direction:column; gap:16px; }
.row-wrap{ display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.kpi{ padding:16px 18px; display:flex; flex-direction:column; gap:6px; min-height:116px; position:relative; overflow:hidden; }
.kpi .kpi-label{ font-size:13px; color:var(--text-2); font-weight:500; display:flex; align-items:center; gap:8px; min-height:36px; }
.kpi:has(.kpi-icon) .kpi-label{ padding-right:44px; }   /* clear of the corner icon */
/* big amounts (1,234,567.89) shrink a little on narrow tiles instead of running out of the card */
.kpi .kpi-value{ font-size:clamp(21px, 1.1rem + .7vw, 28px); line-height:1.15; font-weight:650; letter-spacing:-.02em;
  font-variant-numeric:tabular-nums; overflow-wrap:anywhere; min-width:0; }
.kpi .kpi-sub{ font-size:12.5px; color:var(--text-2); }
.kpi .kpi-icon{ position:absolute; right:14px; top:14px; width:36px; height:36px; border-radius:10px; display:grid; place-items:center;
  background:color-mix(in srgb, var(--kpi-tone, var(--primary)) 16%, transparent); color:var(--kpi-tone, var(--primary)); }
.delta-up{ color:var(--success-text); } .delta-down{ color:var(--danger-text); }
/* KPI rows fill the width evenly: no empty gap after 3-4 tiles, no tile left alone on its own row */
.grid-auto:has(> .kpi){ grid-template-columns:repeat(auto-fit, minmax(min(180px, 100%), 1fr)); }
.grid-auto:has(> .kpi:nth-child(6):last-child){ grid-template-columns:repeat(6, minmax(0, 1fr)); }
@media (max-width:1440px){ .grid-auto:has(> .kpi:nth-child(6):last-child){ grid-template-columns:repeat(3, minmax(0, 1fr)); } }
@media (max-width:599.98px){
  .grid-auto:has(> .kpi), .grid-auto:has(> .kpi:nth-child(6):last-child){ grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
}
button.kpi{ align-items:stretch; border:1px solid var(--hairline); }   /* buttons centre their content by default */
button.kpi, a.kpi{ text-align:left; font:inherit; color:inherit; cursor:pointer; text-decoration:none; }

/* ---------- filter bar ---------- */
.filter-bar{ border-radius:var(--radius-card); padding:12px 14px; margin-bottom:16px; }
.filter-bar form{ display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
/* tops aligned: a field with helper text ("Starts with") is taller, and bottom alignment left the boxes at different heights */
.filter-bar .filter-fields{ display:flex; flex-wrap:wrap; gap:12px; flex:1; align-items:flex-start; }
.filter-bar .filter-fields > *{ min-width:160px; flex:1 1 200px; max-width:340px; }   /* room for "ALM07 - Gensys Technologies…" */
.filter-bar .filter-fields .mud-input-control{ margin-top:0; }
/* From/To pair: two dates and the presets button; each date needs ~150px to show dd-MM-yyyy beside its calendar icon */
.date-range{ display:flex; gap:8px; align-items:flex-start; }
.filter-bar .filter-fields > .date-range{ flex:1 1 380px; min-width:min(330px, 100%); max-width:480px; }
.date-range > .mud-picker{ flex:1 1 0; min-width:0; }
.filter-bar .filter-actions{ display:flex; gap:8px; align-items:center; margin-left:auto; }
.filter-toggle{ display:none; }

/* ---------- grid ---------- */
.grid-card{ overflow:hidden; }
.grid-toolbar{ display:flex; align-items:center; gap:8px; padding:10px 12px; flex-wrap:wrap; border-bottom:1px solid var(--line); }
.grid-toolbar .grid-search{ flex:0 1 280px; min-width:160px; }
.grid-toolbar .count{ font-size:13px; color:var(--text-2); font-variant-numeric:tabular-nums; }
.grid-toolbar .spacer{ flex:1; }
.dgp .mud-table-container{ background:transparent; }
.dgp .mud-table, .dgp .mud-table-root{ background:transparent; }
.dgp .mud-table-head .mud-table-cell{ font-weight:600; font-size:12.5px; color:var(--text-2); background:color-mix(in srgb, var(--surface) 92%, transparent); white-space:nowrap; }
.dgp .mud-table-body .mud-table-row:hover{ background:var(--row-hover) !important; }
.dgp .mud-table-cell{ border-bottom-color:var(--line); font-variant-numeric:tabular-nums; }
.dgp .mud-table-foot .mud-table-cell{ font-weight:650; border-top:2px solid var(--line); background:color-mix(in srgb, var(--surface) 92%, transparent); }
.dgp.clickable .mud-table-body .mud-table-row{ cursor:pointer; }
.cell-right{ text-align:right !important; }
.cell-center{ text-align:center !important; }
.col-filter input{ width:100%; min-width:60px; margin-top:4px; padding:3px 6px; border:1px solid var(--line); border-radius:6px;
  background:var(--surface); color:var(--text); font:inherit; font-size:12px; font-weight:400; }
.stacked-list{ display:none; }
.stacked-item{ padding:12px 14px; border-bottom:1px solid var(--line); }
.stacked-item .key{ display:flex; justify-content:space-between; gap:8px; font-weight:600; }
.stacked-item dl{ display:grid; grid-template-columns:auto 1fr; gap:2px 12px; margin:8px 0 0; font-size:13px; }
.stacked-item dt{ color:var(--text-2); }
.stacked-item dd{ margin:0; text-align:right; font-variant-numeric:tabular-nums; }
.grid-state{ padding:40px 20px; text-align:center; }

/* ---------- skeleton & states ---------- */
.skeleton{
  border-radius:8px; background:color-mix(in srgb, var(--text) 8%, transparent); position:relative; overflow:hidden;
}
.skeleton.shimmer::after{
  content:""; position:absolute; inset:0; transform:translateX(-100%);
  background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent);
}
.empty-state{ display:flex; flex-direction:column; align-items:center; gap:10px; padding:40px 20px; text-align:center; color:var(--text-2); }
.empty-state .icon-bubble{ width:56px; height:56px; border-radius:16px; display:grid; place-items:center;
  background:color-mix(in srgb, var(--primary) 12%, transparent); color:var(--primary); }
.empty-state h3{ color:var(--text); }
.error-card{ border-left:3px solid var(--vibs-danger); }
.slow-bar{ height:3px; background:linear-gradient(90deg, transparent, var(--primary), transparent); background-size:200% 100%; border-radius:2px; }

/* ---------- overlays: palette, sheets ---------- */
.palette{
  position:fixed; z-index:1400; left:50%; top:12vh; width:min(640px, calc(100vw - 32px));
  transform:translateX(-50%); overflow:hidden;
}
.palette-input{ display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--line); }
.palette-input input{ flex:1; border:0; outline:0; background:transparent; color:var(--text); font:inherit; font-size:17px; }
.palette-list{ max-height:min(56vh, 460px); overflow-y:auto; padding:6px; margin:0; list-style:none; }
.palette-group{ padding:10px 10px 4px; }
.palette-item{ display:flex; align-items:center; gap:12px; padding:9px 10px; border-radius:10px; cursor:pointer; min-height:40px; }
.palette-item .sub{ margin-left:auto; font-size:12px; color:var(--text-2); }
.palette-item.selected{ background:color-mix(in srgb, var(--primary) 16%, transparent); }
.palette-item mark{ background:none; color:var(--primary-text); font-weight:700; }
.palette-foot{ display:flex; gap:14px; padding:8px 14px; border-top:1px solid var(--line); font-size:12px; color:var(--text-2); }
.sheet{
  position:fixed; z-index:1400; left:50%; top:50%; transform:translate(-50%,-50%);
  width:min(440px, calc(100vw - 32px)); padding:22px;
}
.sheet h2{ font-size:var(--fs-title-3); margin-bottom:8px; }
.sheet .sheet-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
.shortcut-list{ display:grid; grid-template-columns:1fr auto; gap:10px 16px; margin:14px 0 0; }
.shortcut-list dd{ margin:0; display:flex; gap:4px; }

/* ---------- buttons (plain, used on SSR pages and sheets) ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:40px; padding:0 18px;
  border-radius:var(--radius-control); border:1px solid transparent; font:inherit; font-weight:600; font-size:14px;
  cursor:pointer; text-decoration:none; transition:transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out), background var(--dur);
}
.btn-primary{ background:var(--primary-strong); color:var(--vibs-white); }
.btn-primary:hover{ background:var(--primary); }
.btn-danger{ background:var(--vibs-danger); color:var(--vibs-white); }
.btn-plain{ background:transparent; border-color:var(--line); color:var(--text); }
.btn-plain:hover{ background:var(--row-hover); }
.btn:disabled{ opacity:.6; cursor:default; }

/* ---------- login ---------- */
.login-wrap{ min-height:100vh; display:grid; place-items:center; padding:24px 16px; }
.login-card{ width:min(400px, 100%); padding:32px 28px 26px; }
.login-card .wordmark{ justify-content:center; margin-bottom:22px; }
.login-card h1{ font-size:var(--fs-title-2); text-align:center; }
.login-card .lead{ text-align:center; color:var(--text-2); margin:6px 0 22px; font-size:14px; }
.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:14px; }
.field label{ font-size:13px; font-weight:600; color:var(--text-2); }
.field input:not([type=checkbox]){
  min-height:44px; padding:0 14px; border-radius:var(--radius-control); border:1px solid var(--line);
  background:color-mix(in srgb, var(--surface) 70%, transparent); color:var(--text); font:inherit; font-size:15px;
}
.field input:focus{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
.field .hint{ font-size:12.5px; color:var(--warning-text); display:flex; align-items:center; gap:6px; }
.field .validation-message, .login-alert{ font-size:13px; color:var(--danger-text); }
.login-alert{ display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-radius:var(--radius-control); margin-bottom:16px;
  background:color-mix(in srgb, var(--vibs-danger) 12%, transparent); border:1px solid color-mix(in srgb, var(--vibs-danger) 35%, transparent); }
.check{ display:flex; align-items:center; gap:8px; font-size:14px; margin:4px 0 18px; min-height:28px; }
.check input{ width:18px; height:18px; accent-color:var(--primary-strong); }
.login-card .btn{ width:100%; min-height:44px; }
.login-foot{ text-align:center; margin-top:18px; font-size:12px; color:var(--text-2); }

/* ---------- planned / not found ---------- */
.planned-card{ max-width:620px; margin:24px auto; }

/* ---------- motion (only when the user allows it) ---------- */
@media (prefers-reduced-motion: no-preference){
  /* backwards, not both: a transform held after the animation would trap position:fixed panels inside the page */
  .page-enter{ animation:page-in var(--dur) var(--ease-out) backwards; }
  .stagger > *{ animation:page-in var(--dur-slow) var(--ease-out) both; }
  .stagger > *:nth-child(2){ animation-delay:30ms; } .stagger > *:nth-child(3){ animation-delay:60ms; }
  .stagger > *:nth-child(4){ animation-delay:90ms; } .stagger > *:nth-child(5){ animation-delay:120ms; }
  .stagger > *:nth-child(6){ animation-delay:150ms; } .stagger > *:nth-child(7){ animation-delay:180ms; }
  .stagger > *:nth-child(8){ animation-delay:210ms; }
  .lift{ transition:transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
  .lift:hover{ transform:translateY(-1px); box-shadow:var(--shadow-2); }
  .lift:active, .btn:active{ transform:scale(.98); }
  .nav-indicator{ transition:transform var(--dur-slow) var(--ease-spring), height var(--dur-slow) var(--ease-spring), opacity var(--dur); }
  .skeleton.shimmer::after{ animation:shimmer 1.4s infinite; }
  .slow-bar{ animation:slide 1.2s linear infinite; }
  .dgp .mud-table-body .mud-table-row{ animation:fade-in var(--dur) var(--ease-out) both; }
  .palette, .sheet{ animation:pop-in var(--dur) var(--ease-out) both; }
  .scrim{ animation:fade-in var(--dur) var(--ease-out) both; }
  .value-flash{ animation:flash 600ms var(--ease-out); }
}
@keyframes page-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
@keyframes fade-in{ from{ opacity:0; } to{ opacity:1; } }
@keyframes pop-in{ from{ opacity:0; transform:translate(-50%, 0) scale(.97); } to{ opacity:1; } }
.sheet{ animation-name:sheet-in; }
@keyframes sheet-in{ from{ opacity:0; transform:translate(-50%,-48%) scale(.97); } to{ opacity:1; transform:translate(-50%,-50%); } }
@keyframes shimmer{ to{ transform:translateX(100%); } }
@keyframes slide{ from{ background-position:200% 0; } to{ background-position:-200% 0; } }
@keyframes flash{ from{ color:var(--primary); } }

/* ---------- responsive: phone < 600, tablet 600–1024, desktop > 1024 ---------- */
@media (max-width:1024px){
  .shell, .shell.rail{ grid-template-columns:var(--sidebar-rail-w) minmax(0,1fr); }
  .shell .nav-link span.label, .shell .nav-section-title span, .shell .nav-section-title .chev,
  .shell .sidebar-foot, .shell .wordmark-text, .shell .nav-link .planned{ display:none; }
  .shell .nav-link{ justify-content:center; padding:8px; }
  .shell .nav-section.collapsed .nav-items{ grid-template-rows:1fr; }
  .rail-toggle{ display:none !important; }
  .shell .sidebar-head{ flex-direction:column; gap:6px; padding:12px 0 6px; }
  .shell .sidebar-head .mud-spacer{ display:none; }
  /* tablets: the rail is fixed, so the top bar's menu button opens the full sidebar over the page */
  .shell.drawer-open .sidebar{ position:fixed; left:0; top:0; bottom:0; width:var(--sidebar-w); z-index:1350; }
  .shell.drawer-open .nav-link span.label, .shell.drawer-open .nav-section-title span,
  .shell.drawer-open .sidebar-foot, .shell.drawer-open .wordmark-text, .shell.drawer-open .nav-link .planned{ display:revert; }
  .shell.drawer-open .nav-section-title .chev{ display:inline-flex; }
  .shell.drawer-open .nav-link{ justify-content:flex-start; padding:8px 12px; }
  .shell.drawer-open .sidebar-head{ flex-direction:row; padding:14px 14px 10px; }
  .search-trigger{ min-width:0; }
  .search-trigger .label, .search-trigger .kbd{ display:none; }
}
@media (max-width:599.98px){
  .shell, .shell.rail{ grid-template-columns:minmax(0,1fr); }
  .sidebar{ position:fixed; left:0; top:0; bottom:0; width:min(300px, 86vw); padding:8px; transform:translateX(-105%);
    transition:transform var(--dur-slow) var(--ease-out); }
  .shell.drawer-open .sidebar{ transform:none; z-index:1350; }   /* above its scrim (1300), or taps close it instead of navigating */
  .shell .sidebar-head{ flex-direction:row; padding:14px 14px 10px; }
  .shell .nav-link span.label, .shell .nav-section-title span, .shell .nav-section-title .chev,
  .shell .sidebar-foot, .shell .wordmark-text, .shell .nav-link .planned{ display:revert; }
  .shell .nav-link{ justify-content:flex-start; padding:8px 12px; }
  .shell .nav-section-title .chev{ display:inline-flex; }
  .topbar{ margin:8px 8px 0; top:8px; }
  .content{ padding:14px 12px 32px; }
  .date-chip .label, .user-btn .user-name, .breadcrumb .crumb-parent{ display:none; }
  h1{ font-size:24px; }
  .filter-toggle{ display:inline-flex; }
  .filter-bar.collapsed .filter-fields{ display:none; }
  .filter-bar .filter-fields > *{ flex:1 1 100%; }
  .dgp-table{ display:none; }
  .stacked-list{ display:block; }
}
@media (min-width:1025px){ .drawer-scrim, .menu-btn{ display:none !important; } }

/* ---------- forms ---------- */
.form-grid{ display:grid; gap:4px 16px; grid-template-columns:repeat(auto-fill, minmax(min(220px, 100%), 1fr)); align-items:start; }
.check-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap:0 8px; }
.start-lowered .mud-input-helper-text{ color:var(--warning-text) !important; font-weight:600; }
.cell-input{ width:120px; min-height:32px; padding:0 8px; border:1px solid var(--line); border-radius:8px; background:var(--surface);
  color:var(--text); font:inherit; font-variant-numeric:tabular-nums; text-align:right; }
.cell-input.changed{ border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
.cell-input.invalid{ border-color:var(--vibs-danger); box-shadow:0 0 0 2px color-mix(in srgb, var(--vibs-danger) 20%, transparent); }
.save-bar{ position:sticky; bottom:12px; z-index:5; display:flex; align-items:center; gap:12px; padding:10px 14px; margin-top:12px; border-radius:var(--radius-card); }

/* ---------- document validation ---------- */
.doc-layout{ display:grid; grid-template-columns:minmax(260px, 5fr) 7fr; gap:16px; align-items:start; }
.doc-list{ list-style:none; margin:0; padding:6px; max-height:calc(100vh - 260px); overflow:auto; }
.doc-item{ display:flex; flex-direction:column; gap:2px; width:100%; text-align:left; padding:10px 12px; border-radius:10px; border:1px solid transparent;
  background:none; color:var(--text); font:inherit; cursor:pointer; min-height:44px; }
.doc-item:hover{ background:var(--row-hover); }
.doc-item.selected{ background:color-mix(in srgb, var(--primary) 14%, transparent); border-color:color-mix(in srgb, var(--primary) 40%, transparent); }
.doc-image{ max-width:100%; border-radius:10px; cursor:zoom-in; transition:transform var(--dur-slow) var(--ease-out); transform-origin:top left; }
.doc-image.zoomed{ transform:scale(2); cursor:zoom-out; }
.doc-viewer{ overflow:auto; max-height:calc(100vh - 300px); border-radius:10px; background:color-mix(in srgb, var(--text) 4%, transparent); padding:8px; }
@media (max-width:1024px){ .doc-layout{ grid-template-columns:1fr; } }
/* ---------- side sheet, documents ---------- */
.side-sheet{ position:fixed; z-index:1350; top:12px; right:12px; bottom:12px; width:min(920px, calc(100vw - 24px));
  display:flex; flex-direction:column; border-radius:18px; overflow:hidden; }
.side-sheet-head{ display:flex; align-items:center; gap:8px; padding:12px 14px 12px 20px; border-bottom:1px solid var(--line); }
.side-sheet-head h2{ font-size:var(--fs-title-3); }
.side-sheet-body{ flex:1; overflow:auto; padding:16px 20px 24px; }
@media (prefers-reduced-motion: no-preference){ .side-sheet{ animation:sheet-slide var(--dur-slow) var(--ease-out) both; } }
@keyframes sheet-slide{ from{ transform:translateX(24px); opacity:0; } to{ transform:none; opacity:1; } }
@media (max-width:599.98px){ .side-sheet{ top:0; right:0; bottom:0; width:100vw; border-radius:0; } }
.doc-head{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap:16px; margin-bottom:16px; }
.doc-head h4{ margin:0 0 6px; font-size:var(--fs-caption); text-transform:uppercase; letter-spacing:.06em; color:var(--text-2); }
.doc-head p{ margin:0; font-size:14px; line-height:1.5; }
.doc-summary{ display:grid; grid-template-columns:auto auto; justify-content:end; gap:4px 24px; margin-top:12px; font-variant-numeric:tabular-nums; }
.doc-summary dt{ color:var(--text-2); } .doc-summary dd{ margin:0; text-align:right; font-weight:600; }
.doc-summary .net{ font-size:17px; color:var(--text); }
.two-line{ display:flex; flex-direction:column; line-height:1.3; }
.two-line small{ color:var(--text-2); }
.doc-link{ color:var(--primary-text); font-weight:600; text-decoration:none; cursor:pointer; background:none; border:0; padding:0; font:inherit; }
.doc-link:hover{ text-decoration:underline; }
/* ---------- dashboard ---------- */
.dash-grid{ display:grid; gap:16px; grid-template-columns:repeat(3, minmax(0,1fr)); }
.dash-grid > .dash-wide{ grid-column:span 2; }
.dash-grid > .dash-full{ grid-column:1 / -1; }
@media (max-width:1024px){ .dash-grid{ grid-template-columns:1fr; } .dash-grid > .dash-wide{ grid-column:auto; } }
.bar-row{ margin-bottom:12px; }
.bar-label{ display:flex; justify-content:space-between; gap:8px; font-size:13px; margin-bottom:4px; }
.bar-label span:first-child{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track{ height:8px; border-radius:var(--radius-pill); background:color-mix(in srgb, var(--text) 8%, transparent); overflow:hidden; }
.bar-fill{ height:100%; border-radius:inherit; background:linear-gradient(90deg, var(--primary), var(--vibs-accent)); }
@media (prefers-reduced-motion: no-preference){ .bar-fill{ transition:width var(--dur-slow) var(--ease-out); } }
.simple-table{ width:100%; border-collapse:collapse; font-size:14px; font-variant-numeric:tabular-nums; }
.simple-table th{ text-align:left; font-size:12.5px; color:var(--text-2); font-weight:600; padding:8px 14px; border-bottom:1px solid var(--line); }
.simple-table td{ padding:8px 14px; border-bottom:1px solid var(--line); }
.simple-table tbody tr:hover{ background:var(--row-hover); }
/* phones: wide simple tables scroll inside their card instead of widening the page */
@media (max-width:599.98px){ .simple-table{ display:block; overflow-x:auto; white-space:nowrap; -webkit-overflow-scrolling:touch; } }
.people-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(84px, 1fr)); gap:12px; }
.person{ display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center; text-decoration:none; color:var(--text); padding:6px; border-radius:10px; }
.person:hover{ background:var(--row-hover); }
.avatar-lg{ width:48px; height:48px; font-size:16px; }
.chat{ display:grid; grid-template-columns:minmax(160px, 1fr) 2fr; gap:12px; min-height:260px; }
.chat-contacts{ display:flex; flex-direction:column; gap:4px; max-height:300px; overflow:auto; }
.chat-contact{ display:flex; flex-direction:column; align-items:flex-start; gap:1px; text-align:left; border:1px solid transparent; background:none; color:var(--text);
  font:inherit; font-size:13px; padding:8px 10px; border-radius:10px; cursor:pointer; }
.chat-contact:hover{ background:var(--row-hover); }
.chat-contact.on{ border-color:color-mix(in srgb, var(--primary) 40%, transparent); background:color-mix(in srgb, var(--primary) 12%, transparent); }
.chat-contact small{ font-size:11.5px; color:var(--text-2); }
.chat-pane{ display:flex; flex-direction:column; gap:8px; }
.chat-messages{ flex:1; display:flex; flex-direction:column; gap:8px; max-height:260px; overflow:auto; padding:4px; }
.chat-msg{ display:flex; flex-direction:column; max-width:80%; }
.chat-msg.out{ align-self:flex-end; align-items:flex-end; }
.chat-bubble{ padding:8px 12px; border-radius:14px; background:color-mix(in srgb, var(--text) 7%, transparent); }
.chat-msg.out .chat-bubble{ background:var(--primary-strong); color:var(--vibs-white); }
.chat-send{ display:flex; gap:8px; align-items:center; }
@media (max-width:599.98px){ .chat{ grid-template-columns:1fr; } }
.route-map{ width:100%; border-radius:12px; overflow:hidden; background:color-mix(in srgb, var(--text) 5%, transparent); }
.map-pin{ width:28px; height:28px; border-radius:50% 50% 50% 0; transform:rotate(-45deg); display:grid; place-items:center; box-shadow:var(--shadow-1); border:2px solid var(--vibs-white); }
.map-pin span{ transform:rotate(45deg); color:var(--vibs-white); font-size:11px; font-weight:700; }
/* ---------- salesmen ---------- */
.salesman-card{ display:flex; flex-direction:column; gap:12px; padding:16px; text-decoration:none; color:var(--text); }
.salesman-head{ display:flex; gap:12px; align-items:center; }
.salesman-stats{ display:grid; grid-template-columns:1fr auto; gap:4px 12px; margin:0; font-size:14px; }
.salesman-stats dt{ color:var(--text-2); } .salesman-stats dd{ margin:0; text-align:right; font-weight:600; }
.profile-layout{ display:grid; grid-template-columns:minmax(240px, 1fr) 3fr; gap:16px; align-items:start; }
.profile-photo{ width:112px; height:112px; border-radius:50%; object-fit:cover; display:inline-grid; place-items:center; font-size:32px; box-shadow:var(--shadow-1); }
@media (max-width:1024px){ .profile-layout{ grid-template-columns:1fr; } }
.login-card [aria-busy="true"]{ opacity:.7; cursor:progress; }
