:root {
  color-scheme: light;

  --page: #F4F7FA;
  --surface: #ffffff;
  --surface-2: #F7FAFC;
  --text-primary: #0A2744;
  --text-secondary: #4A6272;
  --text-muted: #7A8FA0;
  --gridline: #D5DEE6;
  --baseline: #C5D0DA;
  --border: #D5DEE6;
  --border-strong: #C5D0DA;

  --accent: #0072C6;
  --accent-hover: #0058A0;
  --accent-soft: #E7F3FB;
  --accent-contrast: #ffffff;
  --navy: #002A54;

  --series-1: #0072C6;
  --series-2: #002A54;
  --seq-100: #D6EAF8; --seq-250: #7EB7DC; --seq-450: #0072C6; --seq-600: #002A54;
  --ord2-100: #FBF3E6; --ord2-250: #E9C58A; --ord2-450: #C98A2B; --ord2-600: #A8711F;

  --good: #1F7A62;
  --good-soft: #E8F5F1;
  --warning: #A8711F;
  --warning-soft: #FBF3E6;
  --critical: #9E5138;
  --critical-soft: #FaF0EC;
  --success-text: #1F7A62;

  --sidebar-bg: #F7FAFC;
  --sidebar-text: #4A6272;
  --sidebar-text-active: #0072C6;
  --sidebar-active-bg: #FFFFFF;
  --sidebar-border: #D5DEE6;

  --r-sm: 9px;
  --r-md: 11px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(20,20,22,0.04), 0 1px 1px rgba(20,20,22,0.03);
  --shadow-md: 0 6px 20px rgba(20,20,22,0.08), 0 1px 3px rgba(20,20,22,0.05);
  --shadow-lg: 0 20px 50px rgba(20,20,22,0.16), 0 3px 10px rgba(20,20,22,0.08);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0B1520;
    --surface: #13202C;
    --surface-2: #1A2B3A;
    --text-primary: #E8F1F8;
    --text-secondary: #A8BBC9;
    --text-muted: #7A8FA0;
    --gridline: #243848;
    --baseline: #2E4558;
    --border: #243848;
    --border-strong: #2E4558;

    --accent: #4DB3E8;
    --accent-hover: #7EC8F0;
    --accent-soft: rgba(0, 114, 198, 0.22);
    --accent-contrast: #0B1520;
    --navy: #7EB7DC;

    --series-1: #4DB3E8; --series-2: #7EB7DC;
    --seq-100: #0A2A40; --seq-250: #003060; --seq-450: #0072C6; --seq-600: #D6EAF8;
    --ord2-100: #A8711F; --ord2-250: #C98A2B; --ord2-450: #E9C58A; --ord2-600: #FBF3E6;

    --good: #5EC4A8; --good-soft: rgba(31, 122, 98, 0.2);
    --warning: #E9C58A; --warning-soft: rgba(201,138,43,0.16);
    --critical: #E0A78F; --critical-soft: rgba(192,104,74,0.16);
    --success-text: #5EC4A8;

    --sidebar-bg: #0F1A26;
    --sidebar-text: #A8BBC9;
    --sidebar-text-active: #4DB3E8;
    --sidebar-active-bg: #1A2B3A;
    --sidebar-border: #243848;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 6px 20px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0B1520;
  --surface: #13202C;
  --surface-2: #1A2B3A;
  --text-primary: #E8F1F8;
  --text-secondary: #A8BBC9;
  --text-muted: #7A8FA0;
  --gridline: #243848;
  --baseline: #2E4558;
  --border: #243848;
  --border-strong: #2E4558;

  --accent: #4DB3E8;
  --accent-hover: #7EC8F0;
  --accent-soft: rgba(0, 114, 198, 0.22);
  --accent-contrast: #0B1520;
  --navy: #7EB7DC;

  --series-1: #4DB3E8; --series-2: #7EB7DC;
  --seq-100: #0A2A40; --seq-250: #003060; --seq-450: #0072C6; --seq-600: #D6EAF8;
  --ord2-100: #A8711F; --ord2-250: #C98A2B; --ord2-450: #E9C58A; --ord2-600: #FBF3E6;

  --good: #5EC4A8; --good-soft: rgba(31, 122, 98, 0.2);
  --warning: #E9C58A; --warning-soft: rgba(201,138,43,0.16);
  --critical: #E0A78F; --critical-soft: rgba(192,104,74,0.16);
  --success-text: #5EC4A8;

  --sidebar-bg: #0F1A26;
  --sidebar-text: #A8BBC9;
  --sidebar-text-active: #4DB3E8;
  --sidebar-active-bg: #1A2B3A;
  --sidebar-border: #243848;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.6);
}

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

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------- Auth screens (Solesbee Analytics login language) ---------- */
.auth-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px;
  overflow-y: auto;
  color-scheme: light;
  background: #F4F7FA;
  color: #0A2744;
}
.auth-screen[hidden] { display: none; }
.auth-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid #D5DEE6; border-top-color: #0072C6;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth-frame { width: min(36rem, 100%); }
.auth-identity {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-bottom: 32px; text-align: center;
}
.auth-mark { width: 48px; height: 48px; display: block; margin: 0 auto; overflow: visible; }
.auth-logo {
  display: block;
  height: 88px;
  width: auto;
  max-width: min(100%, 420px);
  object-fit: contain;
}
.auth-mark-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 16px;
  display: block;
}
.auth-wordmark { display: flex; flex-direction: column; line-height: 1.15; }
.auth-wordmark-name {
  font-size: 18px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: #002A54;
}
.auth-wordmark-desc {
  margin-top: 4px; font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: #9A968E;
}

.auth-card {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #D5DEE6;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 42, 84, 0.04), 0 4px 16px rgba(0, 42, 84, 0.06);
  padding: 24px;
}
.auth-card-center { text-align: center; padding: 32px 24px; }
.auth-card-center .auth-mark { margin-bottom: 16px; }
.auth-card-center .auth-status-badge { margin-bottom: 14px; }
.auth-card-center .auth-title { margin-top: 8px; }
.auth-card-center .auth-submit { margin-top: 18px; }

.auth-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; color: #002A54;
}
.auth-sub { color: #4A6272; margin: 0 0 24px; font-size: 14px; line-height: 1.5; }
.auth-body { color: #4A6272; margin: 0; font-size: 14px; line-height: 1.55; }
.auth-error {
  background: #FaF0EC; color: #9E5138;
  border: 1px solid #E0A78F;
  border-radius: 10px; padding: 12px 16px; font-size: 13.5px; margin: 0 0 16px;
}
.auth-submit { width: 100%; height: 48px; margin-top: 4px; font-size: 16px; }
.auth-screen .btn-primary {
  background: #0072C6; color: #fff; border-radius: 10px; font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 42, 84, 0.08);
}
.auth-screen .btn-primary:hover { background: #0058A0; }
.auth-screen .btn-primary:active { background: #003060; }
.auth-screen .btn-secondary {
  background: #FFFFFF; color: #0A2744; border: 1px solid #C5D0DA;
  border-radius: 10px; height: 48px; font-size: 16px; font-weight: 500;
}
.auth-screen .btn-secondary:hover { background: #F7FAFC; }
.auth-screen .btn-secondary:disabled { opacity: 0.5; cursor: default; }
.auth-screen .form-row { margin-bottom: 16px; gap: 6px; }
.auth-screen .form-row label { font-size: 14px; font-weight: 500; color: #4A6272; }
.auth-screen .form-row input,
.auth-screen .form-row select,
.auth-screen .form-row textarea {
  height: 40px; padding: 0 14px;
  border: 1px solid #C5D0DA; border-radius: 10px; background: #FFFFFF; color: #0A2744;
  box-shadow: 0 1px 2px rgba(0, 42, 84, 0.05);
  font-size: 14px;
}
.auth-screen .form-row textarea { height: auto; padding: 10px 14px; }
.auth-screen .form-row input:hover,
.auth-screen .form-row select:hover,
.auth-screen .form-row textarea:hover { border-color: #7EB7DC; }
.auth-screen .form-row input:focus,
.auth-screen .form-row select:focus,
.auth-screen .form-row textarea:focus {
  border-color: #0072C6; box-shadow: none; outline: none;
}
.auth-field-hint { font-size: 12px; color: #9A968E; line-height: 1.4; }
.auth-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 520px) { .auth-form-grid { grid-template-columns: 1fr; } }

.auth-or {
  position: relative; text-align: center; margin: 18px 0;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #9A968E;
}
.auth-or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #D5DEE6; }
.auth-or span { position: relative; background: #FFFFFF; padding: 0 12px; }
.auth-caption { text-align: center; font-size: 12px; color: #9A968E; margin: 8px 0 0; line-height: 1.45; }
.demo-login-hint {
  margin-top: 20px;
  background: #F4F0E8;
  border-radius: 12px;
  padding: 16px 18px;
  text-align: left;
  color: #0A2744;
}
.demo-login-hint-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}
.demo-login-hint-title code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
}
.demo-login-hint p { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: #4A6272; }
.demo-login-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  user-select: all;
}
.demo-login-fill {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: #0A2744;
  cursor: pointer;
  word-break: break-word;
}
.demo-login-fill:last-child { margin-bottom: 0; }
.demo-login-fill:hover, .demo-login-fill:focus-visible {
  background: rgba(0, 114, 198, 0.1);
  outline: none;
}
.auth-footer-links {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 18px; font-size: 14px;
}
.auth-text-btn {
  background: none; border: none; padding: 0; cursor: pointer; font: inherit;
  color: #4A6272;
}
.auth-text-btn:hover { color: #002A54; }
.auth-text-btn-accent { color: #0072C6; font-weight: 500; }
.auth-text-btn-accent:hover { color: #0058A0; }
.auth-back { text-align: center; margin: 16px 0 0; }
.auth-tagline {
  margin: 32px 0 0; text-align: center;
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #9A968E;
}
.auth-mode-toggle {
  display: flex; gap: 4px; background: #E7F0F6; border-radius: 999px; padding: 3px; margin-top: 18px;
}
.auth-mode-btn {
  flex: 1; background: none; border: none; padding: 7px 0; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: #4A6272; cursor: pointer;
}
.auth-mode-btn.active { background: #FFFFFF; color: #002A54; box-shadow: 0 1px 2px rgba(0, 42, 84, 0.06); }
.auth-success {
  background: #E8F5F1; color: #1F7A62;
  border-radius: 10px; padding: 16px; font-size: 13.5px; line-height: 1.6; margin-top: 12px;
}
.auth-success p { margin: 0; }
.auth-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 500;
  background: #E7F0F6; color: #4A6272; box-shadow: inset 0 0 0 1px #C5D0DA;
}
.auth-status-badge.attention { background: #FBF3E6; color: #A8711F; box-shadow: inset 0 0 0 1px #E9C58A; }
.auth-status-badge.critical { background: #FaF0EC; color: #9E5138; box-shadow: inset 0 0 0 1px #E0A78F; }
.auth-sent-check {
  width: 48px; height: 48px; border-radius: 50%; margin: 8px auto 12px;
  display: grid; place-items: center;
  background: #E7F3FB; color: #0072C6; font-size: 22px;
}
.auth-sent-title { font-size: 18px; font-weight: 600; margin: 0 0 8px; text-align: center; color: #002A54; }
#request-sent-panel, #forgot-sent-panel { text-align: center; }

/* ---------- Icons ---------- */
.nav-icon, .theme-icon-sun, .theme-icon-moon, .search-icon, .chevron,
.user-menu-item svg, .drag-handle-icon {
  width: 17px; height: 17px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- App shell ---------- */
.app-chrome {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 76rem;
  margin: 0 auto;
  padding: 12px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  flex: none;
}
.brand-mark { width: 36px; height: 36px; display: block; flex: none; object-fit: contain; }
:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .auth-mark-img {
  filter: brightness(1.28) saturate(1.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark,
  :root:not([data-theme="light"]) .auth-mark-img {
    filter: brightness(1.28) saturate(1.08);
  }
}
.brand-logo { height: 36px; width: auto; max-width: 220px; display: block; object-fit: contain; }
.brand-summit { width: 28px; height: 28px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-size: 13px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--navy);
}
.brand-desc {
  margin-top: 2px; font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-muted);
}
.module-nav-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 24px 10px;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nav-link {
  color: var(--text-primary);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.nav-admin {
  margin-left: auto;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-icon { display: none; }

#app-shell { min-height: 100vh; }
#app-shell[hidden] { display: none !important; }
.app { min-height: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-secondary); margin: 0; font-size: 13px; }
.agent-picker { display: flex; align-items: center; gap: 8px; }
.agent-picker label { color: var(--text-secondary); font-size: 12.5px; }

select, input[type="search"], input[type="text"], input[type="email"], input[type="password"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--r-md);
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.global-search { position: relative; flex: 1; max-width: 280px; min-width: 160px; }
.global-search .search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.global-search input[type="text"] {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  border-radius: var(--r-pill);
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
}

/* Theme toggle */
.theme-toggle { position: relative; }
.theme-icon-sun, .theme-icon-moon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease); }
:root:not([data-theme="dark"]) .theme-icon-moon,
:root[data-theme="light"] .theme-icon-moon { opacity: 0; transform: translate(-50%, -50%) rotate(-40deg) scale(0.6); }
:root:not([data-theme="dark"]) .theme-icon-sun,
:root[data-theme="light"] .theme-icon-sun { opacity: 1; }
:root[data-theme="dark"] .theme-icon-sun { opacity: 0; transform: translate(-50%, -50%) rotate(40deg) scale(0.6); }
:root[data-theme="dark"] .theme-icon-moon { opacity: 1; }

.notif-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.notif-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--critical); color: #fff;
  font-size: 9.5px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}
.notif-count[hidden] { display: none; }

/* User menu */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-pill); padding: 4px 10px 4px 4px;
  cursor: pointer; color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease);
}
.user-menu-btn:hover { background: var(--gridline); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: none; text-transform: uppercase;
}
.user-email { font-size: 12.5px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: var(--text-muted); width: 14px; height: 14px; }
.user-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 8px; z-index: 60;
  animation: menu-in var(--dur-base) var(--ease);
}
.user-menu-dropdown[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.user-menu-email { padding: 8px 10px 10px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--gridline); margin-bottom: 6px; word-break: break-all; }
.user-menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: none; text-align: left; cursor: pointer;
  padding: 9px 10px; border-radius: var(--r-md); font-size: 13px; color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease);
}
.user-menu-item:hover { background: var(--critical-soft); color: var(--critical); }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 13px;
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.status-banner {
  margin: 12px auto 0;
  max-width: 76rem;
  width: calc(100% - 48px);
  padding: 11px 15px;
  border-radius: var(--r-md);
  background: var(--critical-soft);
  color: var(--critical);
  font-size: 13px;
  animation: fade-in var(--dur-base) var(--ease);
}
@keyframes fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.content { padding: 28px 24px 80px; max-width: 76rem; margin: 0 auto; width: 100%; box-sizing: border-box; }
.panel { display: none; }
.panel.active { display: block; animation: fade-in var(--dur-slow) var(--ease); }
.panel h2 { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.panel > .muted { margin-bottom: 18px; }
.card-sub { margin-bottom: 12px !important; font-size: 13px; }

.overview-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.overview-kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scope-badge {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 500;
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.overview-asof { font-size: 12px; color: var(--text-muted); }
.overview-welcome {
  margin: 12px 0 6px; font-size: 32px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15;
}
.briefing-card {
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.briefing-kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 10px;
}
.briefing-narrative { margin: 0; font-size: 17px; line-height: 1.55; color: var(--text-primary); }
.briefing-note { margin: 10px 0 0; font-size: 12px; color: var(--text-muted); }
.pulse-widget { grid-column: 1 / -1; scroll-margin-top: 160px; }
.pulse-widget .card-head h3 { font-size: 16px; font-weight: 600; }

/* ---------- KPI tiles (value-first hierarchy) ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: proportional-nums; line-height: 1.15; margin-top: 6px; }
.stat-value.tone-critical { color: var(--critical); }
.stat-value.tone-warning { color: var(--warning); }
.stat-value.tone-good { color: var(--success-text); }
.stat-sub { order: 3; font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 28px; }
@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  min-width: 0;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.card.widget:hover, .card.chart-card:hover, .card.match-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card h3 { margin: 0 0 2px; font-size: 13.5px; font-weight: 650; }
.report-group-title { font-size: 12px; color: var(--text-secondary); font-weight: 650; margin: 6px 0 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.table-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
#ticket-search { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--gridline);
  white-space: nowrap;
}
.data-table td.wrap { white-space: normal; }
.data-table th { color: var(--text-muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td.num, .data-table th.num { font-variant-numeric: tabular-nums; text-align: right; }
.data-table .empty-row td { color: var(--text-muted); text-align: center; padding: 32px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.priority-p0 { background: var(--critical-soft); color: var(--critical); }
.priority-p1 { background: var(--warning-soft); color: var(--warning); }
.priority-p2 { background: var(--gridline); color: var(--text-secondary); }
.priority-p3 { background: var(--gridline); color: var(--text-muted); }

.status-open .badge-dot, .status-in_progress .badge-dot { background: var(--accent); }
.status-pending .badge-dot, .status-waiting_on_customer .badge-dot { background: var(--warning); }
.status-resolved .badge-dot, .status-closed .badge-dot { background: var(--good); }
.status-pill { background: var(--gridline); color: var(--text-secondary); }

.overdue { color: var(--critical); font-weight: 650; position: relative; padding-left: 12px; }
.overdue::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--critical); }
.row-link { color: var(--accent); cursor: pointer; text-decoration: none; background: none; border: none; padding: 0; font: inherit; font-weight: 600; transition: opacity var(--dur-fast) var(--ease); }
.row-link:hover { opacity: 0.7; }

.activity-feed { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.activity-feed li {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 12.5px;
  align-items: flex-start;
}
.activity-feed li:last-child { border-bottom: none; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex: none; }
.activity-dot.good { background: var(--good); }
.activity-dot.warning { background: var(--warning); }
.activity-dot.neutral { background: var(--text-muted); }
.activity-text { flex: 1; }
.activity-time { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

.chart-card { display: flex; flex-direction: column; }
.chart-title { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.chart-sub { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
svg.chart { width: 100%; height: auto; overflow: visible; }
.chart-axis-label { fill: var(--text-muted); font-size: 10px; }
.chart-value-label { fill: var(--text-secondary); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-category-label { fill: var(--text-secondary); font-size: 11px; }
.chart-gridline { stroke: var(--gridline); stroke-width: 1; }
.chart-baseline { stroke: var(--baseline); stroke-width: 1; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:hover + rect.chart-bar, .chart-bar.hover { filter: brightness(1.08); }

.chart-tooltip {
  position: fixed;
  z-index: 50;
  background: var(--text-primary);
  color: var(--page);
  padding: 8px 11px;
  border-radius: var(--r-md);
  font-size: 12px;
  pointer-events: none;
  max-width: 240px;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  transition: opacity var(--dur-fast) var(--ease);
}
.chart-tooltip .tt-value { font-weight: 700; }
.chart-tooltip .tt-row { display: flex; gap: 6px; align-items: baseline; }
.chart-tooltip .tt-key { width: 8px; height: 2px; border-radius: 1px; flex: none; margin-top: 6px; display: inline-block; }

.mobile-nav-btn { display: none; }
.sidebar-backdrop { display: none; }
.module-nav-row { position: relative; }
@media (max-width: 900px) {
  .mobile-nav-btn { display: inline-flex; }
  #module-nav {
    display: none;
    position: absolute;
    top: calc(100% - 4px);
    left: 24px;
    right: 24px;
    z-index: 50;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
  }
  #module-nav.mobile-open { display: flex; }
  .nav-admin { margin-left: 0; }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(43,42,40,0.28); z-index: 45;
    opacity: 0; pointer-events: none; transition: opacity var(--dur-base) var(--ease);
  }
  .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }
  .app-header, .module-nav-row, .content { padding-left: 16px; padding-right: 16px; }
  #module-nav { left: 16px; right: 16px; }
  .global-search { order: 3; width: 100%; max-width: none; flex-basis: 100%; }
  .overview-welcome { font-size: 26px; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .icon-btn, .nav-link { min-height: 40px; }
  .agent-picker label { display: none; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .user-email { display: none; }
  .brand-mark { width: 30px; height: 30px; }
  .auth-logo { height: 56px; }
}

.tabstrip {
  display: flex;
  align-items: center;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 24px 10px;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
.tabstrip[hidden] { display: none; }
.tabstrip-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabstrip-tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  background: var(--gridline);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tab.active { background: var(--accent); color: #fff; }
.tab .tab-close { opacity: 0.7; font-size: 13px; cursor: pointer; }
.tab .tab-close:hover { opacity: 1; }
.tabstrip-utility { display: flex; align-items: center; gap: 16px; flex: none; }
.util-item { color: var(--text-secondary); font-size: 12px; text-decoration: none; display: flex; align-items: center; gap: 5px; transition: color var(--dur-fast) var(--ease); }
.util-item#help-link:hover { color: var(--accent); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); flex: none; }
.status-dot.ok { background: var(--good); }
.status-dot.bad { background: var(--critical); }

.quick-links-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 76rem;
  margin: 0 auto;
  padding: 8px 24px 0;
  width: 100%;
  box-sizing: border-box;
}
.quick-links-label { color: var(--text-muted); font-size: 11px; font-weight: 600; flex: none; white-space: nowrap; }
.quick-links-items { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.quick-links-items::-webkit-scrollbar { display: none; }
.quick-link-chip {
  flex: none;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.quick-link-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.quick-link-chip .qlc-id { font-weight: 700; }
.quick-link-chip .qlc-subject { color: var(--text-secondary); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  align-items: start;
}
.widget-full { grid-column: 1 / -1; }
.widget-grid.freeform {
  display: block;
  position: relative;
}
.widget-grid.freeform .widget {
  position: absolute;
  margin: 0;
  box-sizing: border-box;
}
.widget-grid.freeform .widget-full { grid-column: auto; }
@media (max-width: 900px) {
  .widget-grid.freeform {
    display: grid;
    position: static;
    min-height: 0 !important;
  }
  .widget-grid.freeform .widget {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    z-index: auto !important;
  }
}
.card-head { display: flex; align-items: center; margin-bottom: 2px; gap: 6px; }
.card-head h3 { margin: 0; font-size: 13.5px; }

.donut-layout { display: flex; align-items: center; gap: 16px; }
.donut-holder { flex: none; }
.legend-list { list-style: none; margin: 0; padding: 0; font-size: 12px; flex: 1; }
.legend-list li { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.legend-list li.legend-priority-row {
  display: grid;
  grid-template-columns: 9px auto 1fr auto;
  align-items: center;
  column-gap: 8px;
}
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.legend-label { flex: 1; color: var(--text-secondary); min-width: 0; }
.legend-priority-row .legend-label { flex: none; }
.legend-value { font-variant-numeric: tabular-nums; font-weight: 650; justify-self: end; }
.priority-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
  font-size: 12px;
}
.priority-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

/* ---------- Drawer / modal ---------- */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20,20,22,0.4); backdrop-filter: blur(2px); animation: fade-in var(--dur-base) var(--ease); }
.drawer-panel {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: min(500px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: 28px;
  animation: drawer-in var(--dur-slow) var(--ease);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-close { position: absolute; top: 20px; right: 20px; }
.drawer-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; padding-right: 34px; }
.drawer-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.drawer-status-editor {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.drawer-status-editor .filter-label {
  display: flex; align-items: center; gap: 8px; margin: 0;
}
.drawer-status-editor select { min-width: 180px; }
.drawer-status-actions, .drawer-ai-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center;
}
.drawer-ai-actions { margin: 0 0 10px; }
#drawer-fix-results { margin-top: 4px; }
.drawer-section { margin-top: 22px; }
.drawer-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0 0 9px; font-weight: 650; }
.drawer-desc { font-size: 13px; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; }
.drawer-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 12.5px; }
.drawer-field-grid dt { color: var(--text-muted); margin-bottom: 2px; font-size: 11px; }
.drawer-field-grid dd { margin: 0; }
.comment { border-bottom: 1px solid var(--gridline); padding: 11px 0; font-size: 12.5px; }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 11px; margin-bottom: 4px; }
.comment.internal { background: var(--warning-soft); border-radius: var(--r-md); padding: 9px 11px; }
.comment-body { white-space: pre-wrap; }

.fix-panel { margin-bottom: 18px; }
.fix-search-row { display: flex; gap: 10px; margin-bottom: 6px; }
.fix-search-row input { flex: 1; padding: 10px 12px; font-size: 13.5px; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: var(--r-md);
  padding: 0 20px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--r-md);
  padding: 0 14px;
  height: 32px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary:active { transform: scale(0.97); }

.fix-empty { color: var(--text-muted); font-size: 13px; padding: 28px 0; text-align: center; }
.suggested-path {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin: 16px 0;
  animation: fade-in var(--dur-slow) var(--ease);
}
.suggested-path h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--accent-hover); }
.suggested-path-body { font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.source-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.source-chip {
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--r-pill);
  padding: 4px 11px;
  font-size: 11px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.source-chip:hover { border-color: var(--accent); color: var(--accent); }

.match-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
}
.match-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.match-title { font-size: 13.5px; font-weight: 650; }
.match-score { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.match-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }
.match-note { font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; white-space: pre-wrap; overflow: hidden; max-height: 0; transition: max-height var(--dur-slow) var(--ease); }
.match-card.expanded .match-note { max-height: 400px; }
.match-note-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 3px; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.match-note-label::after { content: '▾'; font-size: 9px; transition: transform var(--dur-base) var(--ease); }
.match-card.expanded .match-note-label::after { transform: rotate(180deg); }

.filter-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.filter-label select { font-size: 12px; padding: 6px 9px; }

.confidence-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; white-space: nowrap; }
.confidence-badge.good { background: var(--good-soft); color: var(--success-text); }
.confidence-badge.warning { background: var(--warning-soft); color: var(--warning); }
.confidence-badge.bad { background: var(--critical-soft); color: var(--critical); }
.confidence-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.confidence-dot.good { background: var(--good); }
.confidence-dot.warning { background: var(--warning); }
.confidence-dot.bad { background: var(--critical); }
.confidence-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.risk-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.risk-badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.risk-critical { background: var(--critical-soft); color: var(--critical); }
.risk-critical .badge-dot { background: var(--critical); }
.risk-high { background: var(--warning-soft); color: var(--warning); }
.risk-high .badge-dot { background: var(--warning); }
.risk-normal { background: var(--gridline); color: var(--text-secondary); }
.risk-normal .badge-dot { background: var(--text-muted); }
.risk-low { background: var(--gridline); color: var(--text-muted); }
.risk-low .badge-dot { background: var(--text-muted); }

.sentiment-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.sentiment-positive { background: var(--good-soft); color: var(--success-text); }
.sentiment-neutral { background: var(--gridline); color: var(--text-secondary); }
.sentiment-frustrated { background: var(--warning-soft); color: var(--warning); }
.sentiment-highly_frustrated { background: var(--critical-soft); color: var(--critical); }

.filter-pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.filter-pill:hover { border-color: var(--accent); color: var(--accent); }
.filter-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-pill .pill-count { opacity: 0.75; margin-left: 4px; }

.sortable-th { cursor: pointer; user-select: none; transition: color var(--dur-fast) var(--ease); }
.sortable-th:hover { color: var(--text-primary); }
.sortable-th .sort-arrow { display: inline-block; width: 10px; }

.ai-assistant-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; margin-top: 4px; }
.ai-assistant-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ai-assistant-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none;
}
.collapsible { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.collapsible::after { content: '▾'; font-size: 9px; transition: transform var(--dur-base) var(--ease); }
.collapsible.collapsed::after { transform: rotate(-90deg); }
.ai-collapsible { overflow: hidden; max-height: 600px; transition: max-height var(--dur-slow) var(--ease); }
.ai-collapsible.collapsed { max-height: 0; }
.ai-summary-text { font-size: 12.5px; line-height: 1.65; color: var(--text-secondary); margin: 6px 0 14px; white-space: pre-wrap; }
.ai-next-action { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ai-next-action-badge { background: var(--accent-soft); color: var(--accent-hover); border-radius: var(--r-pill); padding: 5px 13px; font-size: 12px; font-weight: 700; }
.ai-response-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; align-items: center; }
.ai-response-toolbar select { font-size: 11.5px; padding: 5px 8px; }
#ai-suggested-response { width: 100%; min-height: 110px; font-size: 12.5px; line-height: 1.55; font-family: inherit; padding: 11px; }
.ai-copy-flash { color: var(--success-text); font-size: 11px; margin-left: 6px; }

.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head-row h2 { margin: 0; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.layout-toolbar { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; opacity: 0.85; }
.layout-toolbar .btn-secondary[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.drag-handle {
  display: none;
  cursor: grab;
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 2px;
  user-select: none;
}
.widget-grid.editable .drag-handle { display: inline-block; }
.widget-grid.editable .widget { cursor: grab; user-select: none; touch-action: none; }
.widget-grid.editable .widget:hover { outline: 1px dashed var(--baseline); }
.widget-grid.freeform.editable .widget.dragging {
  opacity: 0.96;
  cursor: grabbing;
  box-shadow: var(--shadow-lg);
  outline: 2px solid var(--accent);
  z-index: 20;
}
.widget.dragging { opacity: 0.4; }
.widget.drag-over { outline: 2px solid var(--accent); }
#layout-hint { display: none; }
.layout-toolbar:has(#layout-lock-btn[aria-pressed="true"]) #layout-hint { display: inline; }

.kpi-row-large { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi-tile { display: flex; flex-direction: column; gap: 6px; }
.kpi-value-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kpi-delta { font-size: 12px; font-weight: 700; }
.kpi-delta.tone-good { color: var(--success-text); }
.kpi-delta.tone-bad { color: var(--critical); }
.kpi-delta.tone-neutral { color: var(--text-muted); }
.kpi-tile .stat-label { margin-top: 0; }
.kpi-spark { margin-top: 4px; }
svg.sparkline { display: block; width: 100%; max-width: 110px; height: 28px; }

.modal { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,20,22,0.45); backdrop-filter: blur(3px); animation: fade-in var(--dur-base) var(--ease); }
.modal-panel {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  font-family: inherit;
  padding: 9px 11px;
}
.form-row textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Skeleton loaders ---------- */
.skeleton-line, .skeleton-block {
  background: linear-gradient(90deg, var(--gridline) 25%, var(--baseline) 37%, var(--gridline) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-block { height: 60px; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-block { animation: none; background: var(--gridline); }
}

.report-compose { margin-bottom: 20px; }
.report-doc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 28px 28px 20px;
  margin: 0 0 28px;
  scroll-margin-top: 160px;
}
.report-doc[hidden] { display: none !important; }
.report-mark {
  background: var(--warning-soft); color: var(--warning);
  text-align: center; font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 18px;
}
.report-kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent);
}
.report-doc-head h1 { margin: 8px 0 4px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.report-meta { margin: 0; font-size: 13px; color: var(--text-muted); }
.report-band { margin-top: 28px; }
.report-band-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 4px;
}
.report-band-q { margin: 0 0 12px; font-size: 13px; color: var(--text-secondary); }
.report-kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.report-kpi {
  background: var(--accent-soft); border-radius: 12px; padding: 12px 14px;
}
.report-alerts { list-style: none; margin: 0; padding: 0; }
.report-alert { border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 6px; }
.report-alert-critical { background: var(--critical-soft); color: var(--critical); }
.report-alert-attention { background: var(--warning-soft); color: var(--warning); }
.report-alert-info { background: var(--accent-soft); color: var(--text-primary); }
.report-section { margin-bottom: 16px; }
.report-section h3 { margin: 0 0 8px; font-size: 15px; }
.report-narrative { font-size: 17px; line-height: 1.55; margin: 0 0 10px; }
.report-items { margin: 0; padding: 0; list-style: none; }
.report-item-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 8px 0; border-bottom: 1px solid var(--gridline); font-size: 13px;
}
.report-item-val { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.report-method { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
.report-foot { font-size: 12px; color: var(--text-muted); margin: 24px 0 0; }

/* ---------- Admin Console ---------- */
.admin-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 20px;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.admin-tab:hover { background: var(--surface-2); color: var(--text-primary); }
.admin-tab.active {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}
.admin-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: var(--warning);
  color: #fff;
}
.admin-tab.active .admin-tab-badge { background: rgba(255, 255, 255, 0.28); color: #fff; }
.admin-flash {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--text-primary);
}
.admin-flash.warn { background: var(--warning-soft); color: var(--warning); }
.admin-flash.bad { background: var(--critical-soft); color: var(--critical); }
.admin-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.admin-pane-head h3 { margin: 0 0 4px; font-size: 16px; }
.admin-note {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 14px;
}
.admin-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: inherit;
}
.admin-chip:hover { background: var(--surface-2); }
.admin-chip strong { font-variant-numeric: tabular-nums; }
.admin-audit-list { list-style: none; margin: 0; padding: 0; }
.admin-audit-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gridline);
  font-size: 13px;
}
.admin-audit-list .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.admin-request-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.admin-request-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.admin-request-name { font-size: 15px; font-weight: 650; }
.admin-request-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.admin-request-reason { margin: 10px 0 0; font-size: 13px; max-width: 42rem; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.admin-actions .btn-secondary,
.admin-actions .btn-primary { height: 30px; padding: 0 12px; font-size: 12px; }
.admin-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 28px 12px;
  font-size: 13px;
}
.admin-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.admin-filters input, .admin-filters select { min-width: 160px; }
.admin-user-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.admin-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.admin-check input { margin-top: 2px; }
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .admin-form-grid { grid-template-columns: 1fr; }
}
.admin-org-row td { white-space: normal; }
.admin-pw-form { display: grid; gap: 10px; max-width: 22rem; }
.admin-pw-form .form-row { margin: 0; }

@media print {
  .auth-screen, .app-chrome, .quick-links-bar, .status-banner,
  .layout-toolbar, .report-compose, .table-controls, .btn-primary, .btn-secondary,
  .nav, .module-nav-row, .topbar-actions, #new-ticket-btn { display: none !important; }
  body.printing-report .content > .panel { display: none !important; }
  body.printing-report #reports { display: block !important; }
  body.printing-report #reports > *:not(#report-document) { display: none !important; }
  body.printing-report #report-document {
    display: block !important;
    position: static; box-shadow: none; border: none; padding: 0;
  }
  .report-doc { break-inside: avoid; }
}
