:root {
  --ui-canvas: #f3f5f4;
  --ui-canvas-warm: #faf9f6;
  --ui-card: rgba(255,255,255,.92);
  --ui-line: rgba(21,42,37,.10);
  --ui-ink: #13221e;
  --ui-muted: #6b7773;
  --ui-green: #103f37;
  --ui-green-2: #1d5d50;
  --ui-gold: #c28a43;
  --ui-shadow: 0 1px 2px rgba(18,35,31,.03), 0 16px 45px rgba(18,35,31,.055);
  --ui-shadow-hover: 0 2px 4px rgba(18,35,31,.04), 0 22px 55px rgba(18,35,31,.09);
}
html { scroll-behavior: smooth; }
body {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 78% -10%, rgba(194,138,67,.10), transparent 28rem),
    linear-gradient(145deg, var(--ui-canvas-warm), var(--ui-canvas) 48%, #eef2f0);
  font-family: "Avenir Next", "Aptos", "Segoe UI", sans-serif;
  font-feature-settings: "ss01" 1, "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
.app-shell { grid-template-columns: 248px minmax(0,1fr); }
.sidebar {
  width: 248px;
  padding: 22px 14px 16px;
  border-right: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, #10221e 0%, #0b1916 100%);
  box-shadow: 10px 0 40px rgba(8,22,18,.08);
}
.egnin-sidebar-logo { max-width: 156px; }
.sidebar-search {
  margin: 20px 2px 18px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  background: rgba(255,255,255,.065);
}
.sidebar-search:focus-within { border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.09); }
.nav-section { margin: 20px 11px 7px; color: rgba(255,255,255,.40); font-size: 9px; letter-spacing: .14em; }
.nav-item {
  min-height: 42px;
  margin: 2px 0;
  padding: 9px 11px;
  border-radius: 11px;
  color: rgba(255,255,255,.72);
  font-size: 12.5px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.075); transform: translateX(2px); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(194,138,67,.23), rgba(194,138,67,.09)); box-shadow: inset 3px 0 var(--ui-gold); }
.nav-icon { opacity: .84; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.09); padding-top: 15px; }
.workspace { min-width: 0; }
.topbar {
  height: 68px;
  padding: 0 clamp(20px,3vw,42px);
  border-bottom: 1px solid var(--ui-line);
  background: rgba(250,250,248,.78);
  backdrop-filter: blur(20px) saturate(140%);
}
.topbar-heading .eyebrow { color: var(--ui-gold); font-size: 8px; letter-spacing: .13em; }
.topbar-heading strong { font-size: 13px; font-weight: 650; }
.content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 36px clamp(22px,3.5vw,54px) 70px; }
.page-head { gap: 22px; margin-bottom: 26px; }
.page-head h1 { margin: 0; color: var(--ui-ink); font-size: clamp(26px,2.4vw,36px); font-weight: 680; letter-spacing: -.045em; line-height: 1.08; }
.page-head p { max-width: 700px; margin-top: 8px; color: var(--ui-muted); font-size: 13px; line-height: 1.55; }
.panel-card,.card {
  border: 1px solid var(--ui-line);
  border-radius: 19px;
  background: var(--ui-card);
  box-shadow: var(--ui-shadow);
}
.panel-card { padding: clamp(19px,2.2vw,28px); margin-bottom: 20px; }
.card { padding: 22px; }
.panel-card,.card,.kpi-card { animation: ui-rise .38s ease both; }
.panel-card:nth-of-type(2),.kpi-card:nth-child(2){animation-delay:.035s}.panel-card:nth-of-type(3),.kpi-card:nth-child(3){animation-delay:.07s}.kpi-card:nth-child(4){animation-delay:.105s}.kpi-card:nth-child(5){animation-delay:.14s}
@keyframes ui-rise { from { opacity:0; transform:translateY(7px) } to { opacity:1; transform:none } }
.card-heading { align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.card-heading h2,.panel-card > h2 { margin: 0; font-size: 16px; font-weight: 680; letter-spacing: -.02em; }
.card-heading span,.card-heading small { color: var(--ui-muted); line-height: 1.45; }
.form-section-title { margin: 28px 0 14px; padding-top: 19px; border-top: 1px solid var(--ui-line); color: var(--ui-ink); font-size: 12px; letter-spacing: .03em; }
label { display: block; margin: 0 0 7px; color: #56635f; font-size: 10px; font-weight: 720; letter-spacing: .055em; text-transform: uppercase; }
input,select,textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(23,48,41,.14);
  border-radius: 11px;
  background: rgba(250,251,250,.94);
  color: var(--ui-ink);
  font: inherit;
  font-size: 13px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { min-height: 92px; padding-top: 12px; resize: vertical; }
input:hover,select:hover,textarea:hover { border-color: rgba(23,48,41,.26); }
input:focus,select:focus,textarea:focus { outline: 0; border-color: var(--ui-green-2); background: #fff; box-shadow: 0 0 0 4px rgba(29,93,80,.10); }
input[type="checkbox"],input[type="radio"],input[type="color"] { min-height: 0; }
.grid,.grid3,.grid4 { gap: 17px; }
.field-help,.muted,.table-sub,small { color: var(--ui-muted); }
button,.btn {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 680;
  letter-spacing: -.005em;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
button:hover,.btn:hover { transform: translateY(-1px); }
button.primary,.btn.primary,.primary { border-color: var(--ui-green); background: linear-gradient(180deg, #194f45, var(--ui-green)); color: #fff; box-shadow: 0 7px 18px rgba(16,63,55,.17); }
button.primary:hover,.btn.primary:hover,.primary:hover { box-shadow: 0 10px 24px rgba(16,63,55,.25); }
button.secondary,.btn.secondary,.secondary { border-color: rgba(20,45,38,.13); background: rgba(255,255,255,.86); color: var(--ui-ink); box-shadow: 0 2px 8px rgba(18,35,31,.045); }
button.danger,.danger { background: #fff5f4; color: #a53c39; border-color: #efd4d1; }
.small { min-height: 34px; padding: 7px 11px; border-radius: 9px; font-size: 10.5px; }
.filters-card { padding: 17px 20px; background: rgba(255,255,255,.72); }
.filters-card form,.dash-filters { align-items: end; }
.table-scroll { margin: 0 -4px; border-radius: 13px; }
.clean-table { border-collapse: separate; border-spacing: 0; }
.clean-table th { padding: 11px 12px; border-bottom: 1px solid var(--ui-line); background: #f5f7f6; color: #71807a; font-size: 9px; letter-spacing: .08em; }
.clean-table th:first-child { border-radius: 10px 0 0 10px; }.clean-table th:last-child { border-radius: 0 10px 10px 0; }
.clean-table td { padding: 14px 12px; border-bottom-color: rgba(21,42,37,.075); vertical-align: middle; }
.clean-table tbody tr { transition: background .15s ease; }.clean-table tbody tr:hover { background: rgba(16,63,55,.026); }
.clean-table tbody tr:last-child td { border-bottom: 0; }
.status-pill,.partner-badge { padding: 5px 9px; border-radius: 999px; font-size: 9px; font-weight: 760; letter-spacing: .035em; }
.kpi-grid { gap: 14px; margin-bottom: 20px; }
.kpi-card { min-height: 132px; padding: 21px; border: 1px solid var(--ui-line); border-radius: 18px; background: var(--ui-card); box-shadow: var(--ui-shadow); }
.kpi-card > strong { font-size: clamp(21px,2vw,29px); font-weight: 670; letter-spacing: -.04em; }
.kpi-top span { color: var(--ui-muted); font-size: 9px; letter-spacing: .085em; }
.kpi-card.accent { color: #fff; border-color: transparent; background: linear-gradient(145deg,#174c42,#0f352e); }
.dashboard-grid { gap: 20px; }.goal-ring { filter: drop-shadow(0 8px 15px rgba(16,63,55,.10)); }
.pipeline-track,.progress { overflow: hidden; border-radius: 999px; background: #e8ecea; }
.empty,.empty-state { padding: 38px 18px !important; color: var(--ui-muted); text-align: center; }
.represented-admin-card,.admin-shortcuts a,.partner-price-box { border-color: var(--ui-line); border-radius: 16px; background: #fbfcfb; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.represented-admin-card:hover,.admin-shortcuts a:hover { transform: translateY(-2px); border-color: rgba(16,63,55,.22); box-shadow: var(--ui-shadow-hover); }
.quote-builder { grid-template-columns: minmax(330px,390px) minmax(0,1fr); gap: 20px; align-items: start; }
.quote-builder > div:first-child { position: sticky; top: 88px; }
.quote-builder .card { margin-bottom: 18px; }
.catalog-results { max-height: 440px; border: 1px solid var(--ui-line); border-radius: 13px; background: #fafbfa; }
.catalog-item { padding: 12px 13px; border-bottom-color: var(--ui-line); }
.catalog-item:hover { background: #eef4f1; }
.catalog-item strong { color: var(--ui-ink); font-size: 11.5px; }.catalog-item div { color: var(--ui-muted); font-size: 9.5px; line-height: 1.45; }
.line-table th { padding: 10px 8px; background: #f4f6f5; }.line-table td { padding: 10px 8px; }
.totalbox { margin-top: 15px; padding: 16px; border-radius: 14px; background: #f5f7f6; }
.totalrow.total { margin-top: 8px; border-top-color: var(--ui-green); color: var(--ui-green); }
.flash { border-radius: 13px; box-shadow: var(--ui-shadow); }
details > summary { cursor: pointer; font-weight: 650; }
html[data-theme="dark"] body { --ui-card:rgba(28,31,30,.94);--ui-line:rgba(255,255,255,.09);--ui-ink:#f2f4f3;--ui-muted:#9ca6a2;background:radial-gradient(circle at 80% -10%,rgba(194,138,67,.10),transparent 28rem),#111312;color:var(--ui-ink) }
html[data-theme="dark"] .topbar { background:rgba(17,19,18,.78) }
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] .filters-card,html[data-theme="dark"] button.secondary,html[data-theme="dark"] .btn.secondary,html[data-theme="dark"] .secondary,html[data-theme="dark"] .represented-admin-card,html[data-theme="dark"] .admin-shortcuts a,html[data-theme="dark"] .partner-price-box,html[data-theme="dark"] .catalog-results,html[data-theme="dark"] .totalbox { background:#202321;color:var(--ui-ink) }
html[data-theme="dark"] .clean-table th,html[data-theme="dark"] .line-table th { background:#252826;color:#aab2af }
html[data-theme="dark"] .catalog-item:hover,html[data-theme="dark"] .clean-table tbody tr:hover { background:#262b28 }
@media (max-width:1100px) { .app-shell{grid-template-columns:218px minmax(0,1fr)}.sidebar{width:218px}.content{padding-left:24px;padding-right:24px}.quote-builder{grid-template-columns:330px minmax(0,1fr)} }
@media (max-width:900px) { .app-shell{grid-template-columns:1fr}.sidebar{width:min(86vw,286px)}.content{padding:25px 18px 55px}.quote-builder{grid-template-columns:1fr}.quote-builder>div:first-child{position:static}.page-head{align-items:flex-start}.topbar-account>span:last-child{display:none} }
@media (max-width:620px) { .content{padding:20px 12px 45px}.panel-card,.card{padding:17px;border-radius:15px}.page-head h1{font-size:27px}.kpi-grid,.quick-actions{grid-template-columns:1fr 1fr}.kpi-card{min-height:110px;padding:16px}.clean-table td,.clean-table th{padding-left:9px;padding-right:9px}.topbar{padding:0 13px}.topbar-heading .eyebrow{display:none} }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important} }
@media print { .panel-card,.card{box-shadow:none} }

/* Theme contract: keep foregrounds and surfaces paired across legacy layers. */
@media screen {
  html[data-theme] {
    color-scheme: light;
    --ui-ink:#1d1d1f; --ui-muted:#626268; --ui-card:#ffffff;
    --ui-line:#dedee2; --theme-canvas:#f5f5f7; --theme-soft:#eeeef0;
    --theme-field:#ffffff; --theme-hover:#e5e5e9; --theme-link:#0066cc;
    --ink:var(--ui-ink); --ink-soft:#444449; --muted:var(--ui-muted);
    --card:var(--ui-card); --card-soft:var(--theme-soft); --bg:var(--theme-canvas);
    --line:var(--ui-line); --line-strong:#b9b9c0;
  }
  html[data-theme="dark"] {
    color-scheme:dark;
    --ui-ink:#f5f5f7; --ui-muted:#b0b0b8; --ui-card:#1c1c1e;
    --ui-line:#38383d; --theme-canvas:#101012; --theme-soft:#262629;
    --theme-field:#222225; --theme-hover:#343438; --theme-link:#80baff;
    --ink-soft:#d5d5db; --line-strong:#626269;
  }
  html[data-theme] body {
    --ui-ink:inherit; --ui-muted:inherit; --ui-card:inherit;
    --ui-line:inherit;
    background:var(--theme-canvas); color:var(--ink);
  }
  html[data-theme] .workspace { background:var(--theme-canvas); color:var(--ink); }
  html[data-theme] .topbar { background:var(--card); border-bottom:1px solid var(--line); }
  html[data-theme] :is(.panel-card,.card,.quick-card,.kpi-card,.account-profile-card,.table-scroll,.login-card) {
    background:var(--card); color:var(--ink); border-color:var(--line);
  }
  html[data-theme] :is(.page-head h1,.card-heading h2,.panel-card>h2,.card>h2,.kpi-card>strong,.quick-actions strong,.topbar strong,.goal-ring strong) { color:var(--ink); }
  html[data-theme] :is(label,.page-head .muted,.card-heading span,.kpi-top,.kpi-top span,.kpi-card>small,.quick-actions small,.field-help,.form-section-title) { color:var(--muted); }
  html[data-theme] :is(.filters-card,.commission-form,.margin-box,.commission-auto-note,.commission-rule-card,.address-preview,.internal-summary,.principal-logo-editor,.partner-price-box,.admin-shortcuts>a,.quick-actions>a,.totalbox,.catalog-results,.permission-grid label) {
    background:var(--theme-soft); color:var(--ink); border-color:var(--line);
  }
  html[data-theme] .represented-admin-card { background:var(--theme-soft)!important; color:var(--ink); border-color:var(--line)!important; }
  html[data-theme] :is(input,select,textarea) { background:var(--theme-field); color:var(--ink); border-color:var(--line-strong); }
  html[data-theme] :is(input,textarea)::placeholder { color:var(--muted); opacity:1; }
  html[data-theme] :is(input,select,textarea):focus { background:var(--theme-field); color:var(--ink); border-color:var(--theme-link); }
  html[data-theme] :is(input,textarea)[readonly] { background:var(--theme-soft); color:var(--ink-soft); }
  html[data-theme] :is(.clean-table,.line-table) th { background:var(--theme-soft); color:var(--muted); border-color:var(--line); }
  html[data-theme] :is(.clean-table,.line-table) td { color:var(--ink-soft); border-color:var(--line); }
  html[data-theme] :is(.clean-table,.line-table) tbody tr:hover { background:var(--theme-hover); }
  html[data-theme] .clickable-row:hover,html[data-theme] .clickable-row:focus { background:var(--theme-hover)!important; }
  html[data-theme] :is(.catalog-item:hover,.quick-actions>a:hover,.admin-shortcuts>a:hover) { background:var(--theme-hover); }
  html[data-theme] :is(.row-actions a,.card-heading>a,.quote-link,.ecb-rate-card,.cost-rate-audit) { color:var(--theme-link); }
  html[data-theme] :is(.ecb-rate-card,.cost-rate-audit) { background:var(--theme-soft); }
  html[data-theme] :is(.secondary,button.secondary,.btn.secondary,.theme-toggle,.mobile-menu,.ui-preferences select,.language-picker) {
    background:var(--theme-soft); color:var(--ink); border-color:var(--line);
  }
  html[data-theme] :is(.secondary,.theme-toggle,.mobile-menu):hover { background:var(--theme-hover); color:var(--ink); }
  html[data-theme] .kpi-card.accent { background:#29292d; color:#fff; border-color:#48484f; }
  html[data-theme] .kpi-card.accent>strong { color:#fff; }
  html[data-theme] .kpi-card.accent :is(.kpi-top,.kpi-top span,small) { color:#d5d5dc; }
  html[data-theme] .kpi-card.accent .trend { background:#414146; color:#f5f5f7; }
  html[data-theme] .totalrow.total { color:var(--theme-link); border-color:var(--theme-link); }
  html[data-theme] .sidebar { background:var(--card); color:var(--ink); border-color:var(--line); box-shadow:none; }
  html[data-theme] .sidebar .egnin-brand { height:auto; min-height:68px; padding:12px; margin:0 4px 10px; background:#f7faf8; border-radius:12px; flex-shrink:0; }
  html[data-theme] .sidebar .sidebar-search { background:var(--theme-soft); color:var(--muted); border-color:var(--line); flex-shrink:0; }
  html[data-theme] .sidebar-search input { background:transparent; color:var(--ink); border:0; box-shadow:none; }
  html[data-theme] .sidebar-search input::placeholder { color:var(--muted); }
  html[data-theme] .sidebar :is(.sidebar-user-text strong,.nav-item) { color:var(--ink); }
  html[data-theme] .sidebar :is(.sidebar-user-text span,.nav-section,.gear) { color:var(--muted); }
  html[data-theme] .sidebar .nav-item.active { background:var(--theme-hover); color:var(--ink); box-shadow:none; }
  html[data-theme] .sidebar .nav-item:hover { background:var(--theme-soft); color:var(--ink); transform:none; }
  html[data-theme] .sidebar .logout-form button { color:var(--ink-soft); }
  html[data-theme] .side-nav { display:block; overflow-y:auto; min-height:0; }
  html[data-theme] .sidebar .nav-section { margin:14px 0 5px; padding:6px 12px; }
  html[data-theme] .sidebar .nav-item { min-height:40px; padding:9px 12px; margin:3px 0; }
  html[data-theme] .sidebar .nav-item.active::before { background:var(--theme-link); }
  html[data-theme] .kpi-card::before { display:none; }
  html[data-theme] :is(.quick-icon,.trend,.trend.positive,.trend.gold) { background:var(--theme-soft); color:var(--ink-soft); }
  html[data-theme] :is(.primary,button.primary,.btn.primary) { background:#0071e3; color:#fff; border-color:transparent; box-shadow:none; }
  html[data-theme] :is(.primary,button.primary,.btn.primary):hover { background:#0077ed; }
  html[data-theme] :is(.progress,.pipeline-track) { background:var(--theme-soft); }
  html[data-theme] .goal-ring { background:conic-gradient(#458ddd calc(var(--progress)*1%),var(--theme-soft) 0); filter:none; }
  html[data-theme] :is(.goal-row span,.pipeline-label span,.goal-row small) { color:var(--muted); }
  html[data-theme] .progress i { background:#458ddd; }
  html[data-theme] :is(.panel-card,.card,.kpi-card,.quick-card) { box-shadow:0 2px 12px rgba(0,0,0,.04); }
  html[data-theme] .theme-toggle .theme-light { display:grid; }
  html[data-theme] .theme-toggle .theme-dark { display:none; }
  html[data-theme="dark"] .theme-toggle .theme-light { display:none; }
  html[data-theme="dark"] .theme-toggle .theme-dark { display:grid; }
  html[data-theme] :is(a,button):focus-visible { outline:2px solid var(--theme-link); outline-offset:3px; }
}

/* EGNIN identity: neutral surfaces with restrained green and gold accents. */
@media screen {
  html[data-theme] {
    --theme-link:#23634f;
    --identity-green:#245844;
    --identity-gold:#a36c27;
    --identity-soft:#edf3ef;
    --identity-on-soft:#245844;
    --identity-ring:#527965;
    --theme-canvas:#f5f5f3;
  }
  html[data-theme="dark"] {
    --theme-link:#add5bd;
    --identity-green:#245844;
    --identity-gold:#dbb579;
    --identity-soft:#28312c;
    --identity-on-soft:#c5dccd;
    --identity-ring:#88ac96;
    --theme-canvas:#141414;
    --ui-card:#202020;
    --theme-soft:#2a2a2a;
    --theme-field:#262626;
    --theme-hover:#333333;
    --ui-line:#3c3c3c;
  }
  html[data-theme] .sidebar .egnin-brand {
    min-height:62px; padding:11px 14px; background:#f7f7f4;
    border:1px solid #e4e5df; border-radius:14px;
  }
  html[data-theme] .sidebar .nav-item.active {
    background:var(--identity-soft); color:var(--identity-on-soft);
  }
  html[data-theme] .sidebar .nav-item.active::before { background:var(--identity-gold); }
  html[data-theme] :is(.primary,button.primary,.btn.primary) {
    background:var(--identity-green); color:#fff; border:1px solid #356c55;
    box-shadow:0 2px 5px rgba(0,0,0,.08);
  }
  html[data-theme] :is(.primary,button.primary,.btn.primary):hover { background:#2e6952; }
  html[data-theme] .quick-icon { background:var(--identity-soft); color:var(--identity-on-soft); }
  html[data-theme] .kpi-card.accent {
    background:var(--card); color:var(--ink); border-color:var(--line);
    box-shadow:inset 0 3px var(--identity-gold),0 2px 12px rgba(0,0,0,.04);
  }
  html[data-theme] .kpi-card.accent>strong { color:var(--ink); }
  html[data-theme] .kpi-card.accent :is(.kpi-top,.kpi-top span,small) { color:var(--muted); }
  html[data-theme] .kpi-card.accent .trend { background:var(--theme-soft); color:var(--identity-gold); }
  html[data-theme] .topbar-heading .eyebrow { color:var(--identity-gold); }
  html[data-theme] .goal-ring {
    background:conic-gradient(var(--identity-ring) calc(var(--progress)*1%),var(--theme-soft) 0);
  }
  html[data-theme] .progress i { background:var(--identity-ring); }
  html[data-theme] .progress.gold i { background:var(--identity-gold); }
  html[data-theme] .pipeline-track i { background:var(--identity-ring); }
  html[data-theme] .quick-actions>a { border:1px solid transparent; }
  html[data-theme] .quick-actions>a:hover { border-color:var(--line); box-shadow:none; }
  html[data-theme] .kpi-card:hover { transform:none; }
  html[data-theme] .page-head h1 { letter-spacing:-.035em; }
  html[data-theme] .card-heading span { line-height:1.55; }
  html[data-theme] .sidebar .nav-section { font-size:9px; letter-spacing:.10em; }
  .dashboard-grid-main { grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); align-items:stretch; gap:18px; }
  .dashboard-grid-main>.panel-card { margin-bottom:0; min-width:0; }
  .dashboard-grid-main>.panel-card:last-child { grid-column:1/-1; }
  .dashboard-grid-main .represented-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 28px; }
  .dashboard-grid-main+.lower-grid { margin-top:18px; }
  .lower-grid { align-items:stretch; gap:18px; }
  .lower-grid>.panel-card { min-width:0; }
  .page-head { flex-wrap:wrap; }
  .dash-filters { flex-wrap:wrap; max-width:100%; }
  .quote-builder>div:first-child { position:static; }
  .quote-builder>div { min-width:0; }
  .quote-builder>div:last-child>.card { overflow-x:auto; }
  .goal-row>div:first-child { flex-wrap:wrap; }
  .topbar-heading,.topbar-right { min-width:0; }
  @media (min-width:981px) {
    .app-shell { display:grid; grid-template-columns:248px minmax(0,1fr); }
    html[data-theme] .sidebar { display:flex; position:sticky; top:0; width:248px; height:100dvh; transform:none; visibility:visible; }
    .mobile-menu { display:none; }
  }
  @media (max-width:980px) {
    .app-shell { display:block; }
    .mobile-menu { display:inline-flex; }
    html[data-theme] .sidebar { position:fixed; inset:0 auto 0 0; width:min(86vw,286px); height:100dvh; z-index:100; transform:translateX(-100%); visibility:hidden; }
    html.sidebar-open[data-theme] .sidebar { transform:translateX(0); visibility:visible; }
    html.sidebar-open .sidebar-overlay { display:block; position:fixed; inset:0; width:100%; height:100%; z-index:90; background:rgba(0,0,0,.4); border:0; border-radius:0; }
    .quote-builder { grid-template-columns:1fr; }
  }
  @media (max-width:700px) {
    .dashboard-grid-main,.lower-grid { grid-template-columns:minmax(0,1fr); }
    .dashboard-grid-main .represented-list { grid-template-columns:1fr; }
    .goal-layout { grid-template-columns:1fr; }
    .five-kpis,.four-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
    input,select,textarea { font-size:16px; }
  }
}
