/*
 * CRM ДО visual system vNext.
 * This final cascade layer intentionally normalizes the legacy section styles
 * without changing their DOM contracts or role-specific behaviour.
 */

:root {
  color-scheme: light;
  --page: #f3f6f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f7f9fc;
  --surface-strong: #eef3f7;
  --text: #172b3d;
  --muted: #677d90;
  --muted-2: #90a0ae;
  --line: #dfe7ed;
  --line-strong: #cdd9e1;
  --accent: #0b8fa4;
  --accent-strong: #087285;
  --accent-soft: #e4f5f7;
  --accent-glow: rgba(11, 143, 164, 0.16);
  --sidebar: #f5fafb;
  --sidebar-deep: #edf5f7;
  --sidebar-line: #d9e7ec;
  --nav-text: #587184;
  --nav-active: #dff3f3;
  --hover: #edf6f7;
  --ready: #e4f6ee;
  --ready-text: #147458;
  --warning: #fff4dc;
  --warning-surface: #fff8e9;
  --warning-text: #86611a;
  --danger: #fdebed;
  --danger-text: #b54550;
  --info: #eaf2ff;
  --closed: #eef1f4;
  --chip: #edf3f6;
  --shadow-xs: 0 1px 2px rgba(21, 43, 61, 0.04);
  --shadow-sm: 0 5px 18px rgba(21, 43, 61, 0.055);
  --shadow: 0 12px 32px rgba(21, 43, 61, 0.07);
  --shadow-lg: 0 24px 70px rgba(9, 27, 42, 0.2);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 17px;
  --motion-fast: 140ms;
  --motion-base: 220ms;
  --motion-slow: 340ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-standard: cubic-bezier(0.2, 0.72, 0.24, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #091827;
  --surface: #102337;
  --surface-raised: #142a40;
  --surface-muted: #162b40;
  --surface-strong: #1b344a;
  --text: #edf5f8;
  --muted: #9ab0bf;
  --muted-2: #71899a;
  --line: #263e51;
  --line-strong: #365166;
  --accent: #4bd2ce;
  --accent-strong: #78e2dd;
  --accent-soft: #123d47;
  --accent-glow: rgba(75, 210, 206, 0.16);
  --sidebar: #0c1d2c;
  --sidebar-deep: #081521;
  --sidebar-line: rgba(255, 255, 255, 0.09);
  --nav-text: #9bb2c1;
  --nav-active: rgba(75, 210, 206, 0.16);
  --hover: #193449;
  --ready: #153c36;
  --ready-text: #77dabb;
  --warning: #3d321f;
  --warning-surface: #352f24;
  --warning-text: #efca7e;
  --danger: #432833;
  --danger-text: #f09aa0;
  --info: #17334d;
  --closed: #293746;
  --chip: #1d3549;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.14);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 26px 80px rgba(0, 0, 0, 0.42);
}

html { background: var(--page); }

body {
  background:
    radial-gradient(circle at 82% -15%, rgba(55, 187, 196, 0.08), transparent 28rem),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, summary, [data-section], tbody tr { -webkit-tap-highlight-color: transparent; }

button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-size: 12px;
  font-weight: 650;
  transition:
    color var(--motion-fast) ease,
    background var(--motion-fast) ease,
    border-color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease,
    transform var(--motion-fast) var(--ease-out);
}

button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: var(--hover);
  box-shadow: 0 4px 14px var(--accent-glow);
}

button:active:not(:disabled) { transform: scale(0.975); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 1px rgba(17, 39, 57, 0.02);
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background var(--motion-fast) ease;
}

input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }

.app-shell {
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: 68px minmax(0, 1fr);
}

.topbar {
  min-height: 68px;
  padding: 10px 20px;
  gap: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-color: var(--line);
  box-shadow: 0 1px 0 rgba(17, 37, 54, 0.02);
  backdrop-filter: blur(18px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 40;
}

.identity {
  min-width: 203px;
  gap: 11px;
  padding-right: 0;
  border-right: 0;
}

.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #35c4c0, #0b8198 72%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(11, 143, 164, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.identity strong { font-size: 14px; font-weight: 760; }
.identity small { margin-top: 1px; color: var(--muted); }

.topbar-context {
  margin-right: auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  font-weight: 600;
  white-space: nowrap;
}

.system-state { gap: 6px; min-width: 0; }
.system-state > button { min-width: 38px; }
.btn-icon-label .nav-icon { width: 17px; height: 17px; }
.btn-icon-label .nav-icon svg { width: 17px; height: 17px; }

.sync-state {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(24vw, 330px);
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.sync-state::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted-2) 15%, transparent);
}

.account-menu { position: relative; }
.account-menu > summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 5px;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast);
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--hover); }
.account-menu[open] > summary { box-shadow: 0 0 0 4px var(--accent-glow); }
.account-menu > summary > svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; color: var(--muted); transition: transform var(--motion-base) var(--ease-out); }
.account-menu[open] > summary > svg { transform: rotate(180deg); }
.account-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(145deg, var(--accent), #225174); position: relative; }
.account-avatar::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.82); box-shadow: 0 7px 0 -3px rgba(255, 255, 255, 0.82); }
.account-menu .pill { max-width: 145px; padding: 0; border: 0; background: transparent; color: var(--text); font-size: 11px; }
.account-menu-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: 238px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: menu-in var(--motion-base) var(--ease-out) both;
}
.account-menu-label { padding: 7px 9px 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; }
.account-menu-popover button { width: 100%; text-align: left; background: transparent; border-color: transparent; box-shadow: none; }
.account-menu-popover .account-logout { color: var(--danger-text); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin-top: 3px; }

.mobile-nav-toggle, .mobile-nav-close, .nav-backdrop { display: none; }

.tabs {
  top: 68px;
  min-height: calc(100vh - 68px);
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 13px 18px;
  gap: 3px;
  background:
    radial-gradient(circle at 15% 0, rgba(65, 204, 201, 0.12), transparent 15rem),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
  border-color: var(--sidebar-line);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nav-heading { margin-bottom: 12px; padding: 0 12px 21px; border-color: var(--sidebar-line); }
.nav-heading strong { color: #f0f6f8; font-size: 14px; line-height: 1.38; }
.nav-heading-overline, .nav-section-label { color: #7894a5; }
.workspace-switcher {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid var(--sidebar-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
}
.workspace-switcher-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(145deg, #3ccbc7, #14889e); color: #fff; font-size: 10px; font-weight: 800; }
.workspace-switcher > span:nth-child(2) { min-width: 0; }
.workspace-switcher strong, .workspace-switcher small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-switcher strong { font-size: 11px; }
.workspace-switcher small { margin-top: 1px; color: #7894a5; font-size: 9px; }
.nav-section-label { margin-top: 5px; padding: 0 12px 7px; }
.directory-label, .help-label { border-color: var(--sidebar-line); }
.nav-group { margin: 6px 0 0; }
.nav-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 5px 11px;
  list-style: none;
  cursor: pointer;
  color: #7894a5;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  border-radius: 7px;
  transition: color var(--motion-fast), background var(--motion-fast);
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { color: #b8cbd5; background: rgba(255, 255, 255, 0.045); }
.nav-group > summary svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform var(--motion-base) var(--ease-out); }
.nav-group:not([open]) > summary svg { transform: rotate(-90deg); }
.nav-group-content { display: grid; gap: 2px; padding-top: 2px; transform-origin: top; animation: group-in var(--motion-base) var(--ease-out) both; }
.nav-group:not(:has(.tab:not([hidden]))) { display: none; }
.tab {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--nav-text);
  font-size: 12px;
  font-weight: 610;
  box-shadow: none;
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-base) var(--ease-out);
}
.tab::before { display: none; }
.tabs .tab:hover:not(:disabled) { transform: translateX(2px); color: #f2f8fa; background: rgba(255, 255, 255, 0.065); border-color: transparent; box-shadow: none; }
.tabs .tab.active, .tabs .tab.active:hover:not(:disabled) {
  color: #e9ffff;
  background: linear-gradient(105deg, rgba(44, 200, 198, 0.21), rgba(38, 136, 158, 0.16));
  border-color: rgba(91, 223, 218, 0.16);
  box-shadow: inset 3px 0 0 #47d3ce;
}
.tab .nav-icon { width: 20px; height: 20px; color: currentColor; }
.tab .nav-icon svg { width: 18px; height: 18px; }
.nav-footnote { color: #7894a5; border-color: var(--sidebar-line); }

:root:not([data-theme="dark"]) .tabs {
  background: radial-gradient(circle at 12% 0, rgba(31, 174, 178, 0.12), transparent 15rem), linear-gradient(180deg, var(--sidebar), var(--sidebar-deep));
  scrollbar-color: rgba(59, 99, 116, 0.22) transparent;
}
:root:not([data-theme="dark"]) .nav-heading strong { color: var(--text); }
:root:not([data-theme="dark"]) .nav-heading-overline,
:root:not([data-theme="dark"]) .nav-section-label,
:root:not([data-theme="dark"]) .nav-group > summary,
:root:not([data-theme="dark"]) .nav-footnote,
:root:not([data-theme="dark"]) .workspace-option { color: var(--muted); }
:root:not([data-theme="dark"]) .workspace-switcher { background: rgba(255,255,255,.65); }
:root:not([data-theme="dark"]) .workspace-option:hover:not(:disabled),
:root:not([data-theme="dark"]) .nav-group > summary:hover { color: var(--text); background: rgba(11,143,164,.07); }
:root:not([data-theme="dark"]) .workspace-option.is-active { color: var(--accent-strong); background: var(--accent-soft); }
:root:not([data-theme="dark"]) .tabs .tab:hover:not(:disabled) { color: var(--text); background: rgba(11,143,164,.07); }
:root:not([data-theme="dark"]) .tabs .tab.active,
:root:not([data-theme="dark"]) .tabs .tab.active:hover:not(:disabled) {
  color: var(--accent-strong); background: linear-gradient(105deg, rgba(11,143,164,.13), rgba(65,193,192,.08));
  border-color: rgba(11,143,164,.18); box-shadow: inset 3px 0 0 var(--accent);
}

.content {
  padding: 31px clamp(20px, 2.5vw, 42px) 52px;
  max-width: 1880px;
}

.intro { margin-bottom: 22px; gap: 20px; }
.section-overline { margin-bottom: 6px; color: var(--accent); font-size: 9px; }
h1 { font-size: clamp(25px, 2vw, 31px); font-weight: 780; letter-spacing: -0.045em; }
.intro p { color: var(--muted); font-size: 12px; }
.intro-actions { padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-xs); }
.intro-actions #search { min-height: 40px; border-color: transparent; background-color: transparent; box-shadow: none; }
.intro-actions select { min-height: 40px; border-color: transparent; background-color: var(--surface-muted); }

.kpi-strip { gap: 10px; margin-bottom: 17px; }
.kpi-card {
  min-height: 102px;
  padding: 15px 16px;
  gap: 2px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.kpi-card::after { content: ""; position: absolute; inset: auto 14px 0; height: 2px; border-radius: 3px; background: var(--accent); opacity: 0; transform: scaleX(0.3); transition: opacity var(--motion-base), transform var(--motion-base) var(--ease-out); }
.kpi-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); box-shadow: var(--shadow); }
.kpi-card:hover::after { opacity: 1; transform: scaleX(1); }
.kpi-card span { color: var(--muted); font-size: 10px; letter-spacing: 0.02em; text-transform: uppercase; }
.kpi-card strong { font-size: 27px; font-variant-numeric: tabular-nums; }
.kpi-card small { color: var(--muted-2); }
.kpi-alert { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--danger) 45%, var(--surface))); border-color: color-mix(in srgb, var(--danger-text) 20%, var(--line)); }
.kpi-alert::after { background: var(--danger-text); }

.freshness-banner { margin: 0 0 15px; padding: 11px 14px; border-radius: 10px; background: var(--warning-surface); color: var(--warning-text); }

.toolbar {
  gap: 7px;
  margin: 0 0 13px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-xs);
}
.toolbar button { min-height: 36px; box-shadow: none; }
.primary, .toolbar #new-program:not([hidden]), #new-order:not([hidden]), .toolbar #new-person:not([hidden]) {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: var(--accent);
  box-shadow: 0 5px 14px var(--accent-glow);
}
:root[data-theme="dark"] .primary,
:root[data-theme="dark"] .toolbar #new-program:not([hidden]),
:root[data-theme="dark"] #new-order:not([hidden]),
:root[data-theme="dark"] .toolbar #new-person:not([hidden]) { color: #06272d; }
.data-menu { margin-left: auto; }
.data-menu summary { border-radius: var(--radius-sm); }
.data-menu-content { border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: menu-in var(--motion-base) var(--ease-out) both; }

.filters-panel, .selection-tray {
  margin-bottom: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-panel, .stat-card, .stat-section, .work-card, .work-metric, .help-progress, .help-lesson, .help-repeat, .compensation-card, .load-change-row {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.table-panel { overflow: clip; }
.table-meta { min-height: 54px; padding: 12px 15px; background: var(--surface); border-color: var(--line); }
.table-meta strong { font-size: 13px; }
.table-meta button { box-shadow: none; }
.table-scroll { scrollbar-color: var(--line-strong) transparent; }
th, td { padding: 12px 14px; border-color: var(--line); }
th { z-index: 3; background: var(--surface-muted); color: var(--muted); font-size: 9px; font-weight: 760; letter-spacing: 0.065em; text-transform: uppercase; box-shadow: inset 0 -1px 0 var(--line); }
td { color: var(--text); font-size: 12px; }
tbody tr { transition: background var(--motion-fast), box-shadow var(--motion-fast); }
tbody tr:hover td { background: var(--hover); }
tbody tr.selected td { background: var(--accent-soft); }
tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.row-button { color: var(--accent); text-decoration: none; }
.row-button:hover { color: var(--accent-strong); text-decoration: none; }
.status-chip { border-radius: 999px; padding: 5px 9px; }

.detail-panel {
  z-index: 61;
  top: 68px;
  width: min(680px, 100vw);
  border-color: var(--line);
  border-radius: 18px 0 0 18px;
  background: var(--surface);
  box-shadow: -24px 0 70px rgba(4, 22, 35, 0.2);
  transform: translateX(calc(100% + 30px)) scale(0.99);
  transition: transform var(--motion-slow) var(--ease-out), opacity var(--motion-base) ease;
}
.detail-panel.is-open { transform: translateX(0) scale(1); }
.detail-backdrop { z-index: 60; inset: 68px 0 0; background: rgba(7, 23, 35, 0.4); backdrop-filter: blur(4px); animation: backdrop-in var(--motion-base) ease both; }
.detail-head { padding: 24px 25px 21px; background: linear-gradient(145deg, var(--surface), var(--surface-muted)); border-color: var(--line); }
.detail-head h2 { margin-top: 8px; padding-right: 46px; font-size: 20px; }
#detail-close, #dialog-close { border-radius: 50%; background: var(--surface-muted); box-shadow: none; }
.detail-content { padding: 23px 25px 34px; }
.entity-overview { border-radius: var(--radius); background: linear-gradient(140deg, var(--surface-muted), var(--surface)); }
.entity-avatar { border-radius: 14px; }
.entity-actionbar { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); }
.fact { background: var(--surface-muted); border-color: var(--line); border-radius: 9px; }

dialog {
  width: min(900px, calc(100vw - 32px));
  max-height: min(88vh, 940px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: dialog-in var(--motion-base) var(--ease-out) both;
}
dialog::backdrop { background: rgba(5, 20, 32, 0.55); backdrop-filter: blur(5px); animation: backdrop-in var(--motion-base) ease both; }
dialog.is-closing { animation: dialog-out 170ms ease-in both; }
dialog.is-closing::backdrop { animation: backdrop-out 170ms ease-in both; }
.dialog-head { top: -24px; margin-bottom: 12px; padding: 8px 0 15px; background: var(--surface-raised); border-color: var(--line); }
.dialog-head h2 { font-size: 20px; }
.program-create-form label:first-child, .program-create-form label:nth-child(7) { grid-column: 1 / -1; }

#message { border-radius: var(--radius); animation: toast-in var(--motion-base) var(--ease-out) both; }
.content.is-changing > :not(.intro) { animation: content-refresh var(--motion-slow) var(--ease-out) both; }
.motion-reveal { animation: reveal-in var(--motion-slow) var(--ease-out) both; }

.login-view { min-height: 100vh; overflow: hidden; }
.login-panel {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(480px, 1.18fr) minmax(420px, 0.82fr);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}
.login-art {
  min-height: 100vh;
  padding: clamp(32px, 4.5vw, 72px);
  background:
    radial-gradient(circle at 78% 15%, rgba(66, 211, 205, 0.3), transparent 29%),
    radial-gradient(circle at 10% 95%, rgba(45, 119, 156, 0.28), transparent 36%),
    linear-gradient(150deg, #143d53, #0b293c 62%, #071c2c);
}
.login-art::before { content: ""; position: absolute; width: 44vw; height: 44vw; max-width: 700px; max-height: 700px; left: -21vw; bottom: -25vw; border: 1px solid rgba(107, 228, 221, 0.12); border-radius: 50%; box-shadow: 0 0 0 90px rgba(107, 228, 221, 0.025), 0 0 0 180px rgba(107, 228, 221, 0.018); }
.login-art::after { width: min(36vw, 580px); height: min(36vw, 580px); right: -16vw; top: 16vh; border-color: rgba(255, 255, 255, 0.09); box-shadow: 0 0 0 110px rgba(255, 255, 255, 0.025), 0 0 0 220px rgba(255, 255, 255, 0.015); }
.login-art-mark { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, 0.09); backdrop-filter: blur(10px); }
.login-art-copy { max-width: 570px; margin-top: clamp(70px, 12vh, 150px); gap: 16px; }
.login-art-overline { color: #82dcd8; }
.login-art-copy strong { max-width: 560px; font-size: clamp(36px, 4.4vw, 66px); line-height: 1.02; letter-spacing: -0.055em; }
.login-art-copy > span:last-of-type { max-width: 470px; color: #b6cad3; font-size: 15px; line-height: 1.65; }
.login-benefits { display: grid; gap: 10px; margin-top: 13px; color: #c6d8df; font-size: 12px; }
.login-benefits span { display: flex; align-items: center; gap: 10px; }
.login-benefits i { width: 17px; height: 17px; display: inline-grid; place-items: center; flex: none; border: 1px solid rgba(90, 224, 218, 0.35); border-radius: 50%; background: rgba(62, 205, 201, 0.1); }
.login-benefits i::after { content: ""; width: 5px; height: 3px; border-left: 1.5px solid #6de1dc; border-bottom: 1.5px solid #6de1dc; transform: translateY(-1px) rotate(-45deg); }
.login-preview { width: min(520px, 82%); margin: clamp(44px, 8vh, 80px) 0 0 auto; padding: 13px 16px 18px; border-color: rgba(255, 255, 255, 0.58); border-radius: 16px; box-shadow: 0 34px 70px rgba(1, 13, 24, 0.32); transform: rotate(-2deg); }
.login-preview::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(120deg, rgba(255,255,255,.13), transparent 35%); pointer-events: none; }
.login-preview-summary { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: baseline; padding: 13px 5px 12px; color: #173146; }
.login-preview-summary b { font-size: 27px; line-height: 1; }
.login-preview-summary span { color: #6a7f8f; font-size: 10px; }
.login-preview-summary em { padding: 4px 7px; border-radius: 999px; background: #e8f7f2; color: #1c7c62; font-size: 9px; font-style: normal; font-weight: 700; }
.login-preview-row span { width: auto; height: auto; flex: 1; background: none; color: #385266; font-size: 10px; }
.login-preview-row em { width: auto; height: auto; padding: 4px 7px; color: #33725b; font-size: 9px; font-style: normal; font-weight: 700; }
.login-preview-row:nth-child(4) em { color: #8a651f; }
.login-preview-row:nth-child(5) em { color: #376699; }
.login-card { position: relative; padding: clamp(40px, 7vw, 110px); background: var(--surface); }
.login-card::before { content: "CRM 26"; position: absolute; top: 28px; right: 34px; color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: 0.14em; }
.login-card-inner { width: min(410px, 100%); margin: auto; }
.login-card .eyebrow { color: var(--accent); }
.login-card h1 { margin-top: 10px; font-size: clamp(34px, 4vw, 48px); }
.login-card > p, .login-card-inner > p { color: var(--muted); }
.login-card form { margin-top: 27px; }
.login-card form label { color: var(--text); font-size: 11px; }
.login-card form input { min-height: 50px; margin-top: 8px; padding-inline: 15px; background: var(--surface-muted); }
.login-card form button { min-height: 50px; margin-top: 20px; border-radius: 11px; font-size: 13px; }
.login-security { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 26px !important; color: var(--muted-2) !important; font-size: 10px; }
.login-security span { color: #27b987; font-size: 8px; }

@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes group-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(0.975); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes dialog-out { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(10px) scale(0.985); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes reveal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes content-refresh { from { opacity: 0.55; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1260px) {
  .app-shell { grid-template-columns: 214px minmax(0, 1fr); }
  .identity { min-width: 175px; }
  .topbar-context { display: none; }
  .sync-state { max-width: 220px; }
  .btn-icon-label .btn-label { display: none; }
  .kpi-card { padding: 14px; }
}

@media (max-width: 960px) {
  body.nav-open { overflow: hidden; }
  .app-shell { display: block; }
  .topbar { display: flex; flex-direction: row; align-items: center; min-height: 64px; padding: 10px 14px; }
  .identity { min-width: 0; margin-right: auto; }
  .identity small { display: none; }
  .mark { width: 38px; height: 38px; }
  .mobile-nav-toggle {
    order: -1;
    width: 38px;
    height: 38px;
    display: grid;
    place-content: center;
    gap: 4px;
    padding: 0;
    border-radius: 10px;
    box-shadow: none;
  }
  .mobile-nav-toggle span { width: 17px; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform var(--motion-base) var(--ease-out), opacity var(--motion-fast); }
  body.nav-open .mobile-nav-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  body.nav-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .mobile-nav-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
  .system-state { flex-wrap: nowrap; }
  .system-state #global-search-button, .system-state #health-button { display: none; }
  .sync-state { max-width: 210px; }
  .account-menu .pill { display: none; }
  .account-menu > summary { padding-right: 5px; }
  .account-menu > summary > svg { display: none; }
  .tabs {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 71;
    width: min(310px, calc(100vw - 46px));
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 13px;
    transform: translateX(-105%);
    opacity: 0.7;
    box-shadow: 20px 0 60px rgba(2, 16, 27, 0.28);
    transition: transform var(--motion-slow) var(--ease-out), opacity var(--motion-base) ease;
  }
  body.nav-open .tabs { transform: translateX(0); opacity: 1; }
  .mobile-nav-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    align-self: flex-end;
    flex: none;
    margin: -5px 0 7px;
    padding: 0;
    border-color: rgba(255,255,255,.13);
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    color: #dce8ed;
    font-size: 22px;
    box-shadow: none;
  }
  .tabs .nav-heading, .tabs .nav-section-label, .tabs .nav-footnote { display: block; }
  .tabs .nav-heading { flex: none; }
  .tabs .tab { width: 100%; flex: none; white-space: normal; }
  .tabs .nav-group { width: 100%; flex: none; }
  .tabs .nav-footnote { display: flex; margin-top: auto; }
  .nav-backdrop {
    position: fixed;
    inset: 64px 0 0;
    z-index: 70;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(4, 18, 29, 0.48);
    box-shadow: none;
    backdrop-filter: blur(3px);
    animation: backdrop-in var(--motion-base) ease both;
  }
  .content { padding: 26px 18px 44px; }
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-card:nth-child(4), .kpi-card:nth-child(5) { min-height: 88px; }
  .login-panel { grid-template-columns: 0.9fr 1.1fr; }
  .login-art { padding: 32px; }
  .login-art-copy strong { font-size: clamp(32px, 5vw, 48px); }
  .login-preview { width: 92%; }
}

@media (max-width: 680px) {
  .topbar { flex-direction: row; align-items: center; gap: 7px; }
  .identity strong { font-size: 13px; }
  .system-state { gap: 4px; }
  .system-state #theme-toggle, .system-state #notifications-button { width: 36px; min-width: 36px; padding: 0; }
  .sync-state { width: 10px; min-width: 10px; max-width: 10px; min-height: 10px; padding: 0; border: 0; background: transparent; overflow: visible; font-size: 0; }
  .sync-state::before { width: 9px; height: 9px; }
  .account-menu-popover { position: fixed; top: 60px; right: 10px; }
  .identity > div { display: none; }
  .content { padding: 22px 12px 38px; }
  .intro { align-items: stretch; margin-bottom: 18px; }
  .intro h1 { font-size: 25px; }
  .intro-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); }
  .intro-actions #search, .intro-actions select { width: 100%; min-width: 0; }
  .kpi-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 8px; }
  .kpi-card { min-width: 0; min-height: 86px; padding: 12px; }
  .kpi-card:nth-child(5) { grid-column: 1 / -1; }
  .kpi-card strong { font-size: 23px; }
  .kpi-card small { font-size: 9px; }
  .toolbar { overflow-x: auto; flex-wrap: nowrap; padding: 7px; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar button, .toolbar details { flex: 0 0 auto; }
  .data-menu { margin-left: 0; }
  .data-menu-content { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; padding: 10px; }
  .table-meta { display: grid; gap: 10px; }
  .table-meta > div { min-width: 0; }
  .table-meta > div:first-child { display: grid; grid-template-columns: auto 1fr; }
  .table-hint { grid-column: 1 / -1; }
  .table-meta > div:last-child { justify-content: space-between; }
  .table-scroll { max-height: none; }
  .detail-panel { top: 0; width: 100%; border-radius: 0; }
  .detail-backdrop { inset: 0; }
  .detail-head { padding: 21px 18px 18px; }
  .detail-content { padding: 19px 18px 30px; }
  .entity-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entity-actionbar { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); padding: 19px; border-radius: 15px; }
  .dialog-head { top: -19px; }
  .facts, .form-grid { grid-template-columns: 1fr; }
  .login-panel { width: calc(100vw - 18px); margin: 9px auto; border-radius: 18px; }
  .login-view { overflow: auto; background: var(--surface); }
  .login-panel { width: 100%; min-height: 100vh; display: grid; grid-template-columns: 1fr; margin: 0; border-radius: 0; }
  .login-art { min-height: 245px; padding: 24px; }
  .login-art-copy { margin-top: 32px; }
  .login-art-copy strong { font-size: 30px; }
  .login-art-copy > span:last-of-type { font-size: 12px; }
  .login-benefits, .login-preview { display: none; }
  .login-card { min-height: calc(100vh - 245px); padding: 34px 24px 48px; }
  .login-card::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Workspace navigation, organization map and management hub. */
html, body, .app-shell { max-width: 100%; overflow-x: hidden; }
@supports (overflow: clip) { html, body, .app-shell { overflow-x: clip; } }
.detail-panel:not(.is-open) { visibility: hidden; }
.detail-panel.is-open { visibility: visible; }
.detail-panel { transition: transform 240ms cubic-bezier(.2,.78,.24,1), opacity 200ms ease, visibility 0s linear 240ms; }
.detail-panel.is-open { transition-delay: 0s; }
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 200; padding: 10px 14px; border-radius: 9px; background: var(--accent); color: var(--surface); transform: translateY(-140%); transition: transform 140ms ease; }
.skip-link:focus { transform: translateY(0); }

.workspace-switcher {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 6px;
}
.workspace-option {
  min-width: 0;
  min-height: 47px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #89a2b1;
  text-align: left;
  box-shadow: none;
}
.workspace-option:hover:not(:disabled) { background: rgba(255,255,255,.06); color: #eef7f8; }
.workspace-option.is-active { background: rgba(66,207,202,.16); color: #79e0da; }
.workspace-option strong, .workspace-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-option strong { color: inherit; font-size: 11px; }
.workspace-option small { color: inherit; opacity: .72; font-size: 8px; }

.organization-panel, .management-panel { display: grid; gap: 16px; }
.organization-intro, .management-lead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent-soft) 48%, var(--surface)));
  box-shadow: var(--shadow);
}
.organization-intro h2, .management-lead h2 { margin: 4px 0 6px; font-size: 21px; }
.organization-intro p, .management-lead p { max-width: 760px; margin: 0; color: var(--muted); line-height: 1.6; }
.organization-overline { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.organization-view-toggle, .management-actions { display: flex; gap: 7px; flex-wrap: wrap; flex: none; }
.organization-view-toggle button.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.organization-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.organization-metric { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-sm); }
.organization-metric span, .organization-metric small { color: var(--muted); }
.organization-metric strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.organization-leadership { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; padding-bottom: 24px; }
.organization-leadership::after { content: ""; position: absolute; left: 16.67%; right: 16.67%; bottom: 8px; height: 1px; background: var(--line); }
.organization-leader { display: grid; align-content: start; gap: 6px; min-height: 132px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.organization-leader::after { content: ""; position: absolute; }
.organization-leader.is-empty { border-style: dashed; background: var(--surface-muted); }
.organization-leader strong { font-size: 15px; line-height: 1.4; }
.organization-leader p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.organization-role { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.organization-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 12px; }
.organization-branch, .organization-unlinked { padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.organization-branch-head { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.organization-team { display: grid; gap: 7px; }
.organization-person { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.organization-person.needs-review { border-color: color-mix(in srgb, var(--danger-text) 40%, var(--line)); }
.organization-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.organization-person-copy { display: grid; gap: 2px; min-width: 0; }
.organization-person-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.organization-person-copy span, .organization-person-copy small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.organization-person-copy .organization-warning { color: var(--danger-text); }
.organization-person-copy .organization-relation { color: var(--accent); }
.organization-open { min-height: 30px; padding: 5px 8px; font-size: 9px; }
.organization-empty { margin: 4px; color: var(--muted); font-size: 11px; }
.organization-unlinked { margin-top: 2px; }
.organization-unlinked h2 { margin: 0 0 4px; font-size: 15px; }
.organization-unlinked > p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.organization-unlinked .organization-team { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.responsibility-flow { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.responsibility-step { position: relative; display: grid; align-content: start; gap: 7px; min-height: 170px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.responsibility-step > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.responsibility-step strong { font-size: 14px; }
.responsibility-step p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.responsibility-step b { margin-top: auto; color: var(--accent); font-size: 11px; }

.management-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(260px,1fr)); gap: 10px; }
.management-card { display: grid; align-content: start; gap: 10px; min-height: 130px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.management-card.is-error { border-color: color-mix(in srgb,var(--danger-text) 45%,var(--line)); }
.management-card.is-attention, .management-card.is-setup { border-color: color-mix(in srgb,var(--warning-text) 38%,var(--line)); }
.management-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.management-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.management-checked { color: var(--muted); text-align: right; }

@media (max-width: 820px) {
  .organization-intro, .management-lead { align-items: stretch; flex-direction: column; }
  .organization-leadership, .responsibility-flow { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .organization-leadership::after { display: none; }
}
@media (max-width: 560px) {
  .organization-metrics, .organization-leadership, .responsibility-flow { grid-template-columns: 1fr; }
  .organization-branches { grid-template-columns: 1fr; }
  .organization-person { grid-template-columns: 34px minmax(0,1fr); }
  .organization-avatar { width: 34px; height: 34px; }
  .organization-open { grid-column: 2; justify-self: start; }
}

/* Final mobile shell pass. Keep this block last: it resolves legacy mobile
   overrides from styles.css and makes the first viewport intentionally compact. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

@media (max-width: 680px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 72;
    width: 100%;
    height: 56px;
    min-height: 56px;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 5px 18px rgba(7, 29, 45, .06);
    backdrop-filter: blur(14px);
  }
  .mobile-nav-toggle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
  }
  .mobile-nav-toggle span { width: 16px; }
  .identity {
    min-width: 0;
    flex: 0 0 auto;
    gap: 0;
    margin: 0 auto 0 0;
    padding: 0;
    border: 0;
  }
  .identity > div { display: none; }
  .mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 14px;
  }
  .system-state {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin: 0;
  }
  .system-state > button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border-radius: 9px;
  }
  .btn-icon-label .nav-icon, .btn-icon-label .nav-icon svg { width: 16px; height: 16px; }
  .sync-state {
    order: initial;
    width: 9px;
    min-width: 9px;
    max-width: 9px;
    min-height: 9px;
    flex: 0 0 9px;
    flex-basis: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
    font-size: 0;
  }
  #sync-state { width: 9px; min-width: 9px; max-width: 9px; height: 9px; min-height: 9px; padding: 0; border: 0; font-size: 0; overflow: hidden; }
  .sync-state::before { width: 8px; height: 8px; margin: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted-2) 14%, transparent); }
  .account-menu { flex: 0 0 34px; }
  .account-menu > summary {
    width: 34px;
    height: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 3px;
    border-radius: 10px;
  }
  .account-avatar { width: 26px; height: 26px; }
  .account-avatar::after { inset: 7px; }
  .account-menu-popover { top: 52px; right: 8px; width: min(238px, calc(100vw - 16px)); }
  .nav-backdrop { inset: 56px 0 0; }
  .content { padding: 18px 12px 34px; }
  .intro { gap: 8px; margin-bottom: 15px; }
  .section-overline { margin-bottom: 4px; line-height: 1.35; }
  .intro h1 { margin-bottom: 4px; font-size: clamp(23px, 7vw, 28px); line-height: 1.08; }
  .intro p { line-height: 1.45; }
  .organization-intro, .management-lead { gap: 14px; padding: 17px 16px; }
  .organization-intro h2, .management-lead h2 { font-size: 19px; }
  .organization-view-toggle, .management-actions { width: 100%; }
  .organization-view-toggle button, .management-actions button { flex: 1 1 auto; }
  .toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    overflow: visible;
    padding: 7px;
  }
  .toolbar > button, .toolbar > details {
    width: 100%;
    min-width: 0;
    margin: 0;
  }
  .toolbar #selection-count:empty,
  .toolbar #active-filters:empty { display: none !important; }
  .toolbar #data-menu { grid-column: 1 / -1; }
  .toolbar > button { min-height: 40px; padding-inline: 9px; white-space: normal; line-height: 1.25; }
  .toolbar > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .toolbar .data-menu { margin-left: 0; }
  .toolbar .data-menu > summary { width: 100%; justify-content: space-between; }
  .kpi-card::after { display: none; }
}

@media (max-width: 360px) {
  .topbar { gap: 4px; padding-inline: 8px; }
  .system-state #theme-toggle { display: none; }
  .mark { width: 30px; height: 30px; }
}

@media (hover: none) {
  .kpi-card:hover { transform: none; border-color: var(--line); box-shadow: var(--shadow-xs); }
  .kpi-alert:hover { border-color: color-mix(in srgb, var(--danger-text) 20%, var(--line)); }
}

/* Light mode keeps the navigation light as well; dark navigation belongs only to dark mode. */
:root:not([data-theme="dark"]) .workspace-option { color: var(--muted); }
:root:not([data-theme="dark"]) .workspace-option:hover:not(:disabled) { color: var(--text); background: rgba(11,143,164,.07); }
:root:not([data-theme="dark"]) .workspace-option.is-active { color: var(--accent-strong); background: var(--accent-soft); }
