:root {
  --color-primary-50: #ebf8ff;
  --color-primary-100: #bee3f8;
  --color-primary-200: #90cdf4;
  --color-primary-300: #63b3ed;
  --color-primary-400: #00a4d2;
  --color-primary-500: #0086b3;
  --color-primary-600: #006a91;
  --color-primary-700: #014a60;
  --color-primary-800: #013040;
  --color-primary-900: #001620;
  --color-navy-50: #f5f7fa;
  --color-navy-100: #e4e7eb;
  --color-navy-200: #cbd2d9;
  --color-navy-300: #9aa5b1;
  --color-navy-400: #7b8794;
  --color-navy-500: #616e7c;
  --color-navy-600: #52606d;
  --color-navy-700: #3e4c59;
  --color-navy-800: #323f4b;
  --color-navy-900: #1f2933;
  --color-navy-950: #0f1419;
  --color-gray-50: #fafafa;
  --color-gray-100: #f4f4f5;
  --color-gray-200: #e4e4e7;
  --color-gray-300: #d4d4d8;
  --color-gray-400: #a1a1aa;
  --color-gray-500: #71717a;
  --color-gray-600: #52525b;
  --color-gray-700: #3f3f46;
  --color-gray-800: #27272a;
  --color-gray-900: #18181b;
  --color-gray-950: #09090b;
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;
  --color-bg-primary: #ffffff;
  --color-bg-secondary: var(--color-gray-50);
  --color-bg-tertiary: var(--color-gray-100);
  --color-text-primary: var(--color-gray-900);
  --color-text-secondary: var(--color-gray-600);
  --color-text-tertiary: var(--color-gray-500);
  --color-text-inverse: #ffffff;
  --color-text-brand: var(--color-primary-400);
  --color-border-light: var(--color-gray-200);
  --color-border-medium: var(--color-gray-300);
  --color-border-strong: var(--color-gray-400);
  --gradient-primary: linear-gradient(135deg, #00a4d2 0%, #006a91 100%);
  --gradient-primary-soft: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.08) 0%,
    rgba(0, 106, 145, 0.04) 100%
  );
  --gradient-hero: linear-gradient(135deg, #00a4d2 0%, #014a60 100%);
  --gradient-bg-subtle: linear-gradient(180deg, #fafafa 0%, #f4f4f5 100%);
  --gradient-text: linear-gradient(135deg, #00a4d2 0%, #006a91 100%);
  --gradient-glow: radial-gradient(
    circle at center,
    rgba(0, 164, 210, 0.3) 0%,
    transparent 70%
  );
  --gradient-dark: linear-gradient(135deg, #0f1419 0%, #1f2933 100%);
  --gradient-animated: linear-gradient(
    270deg,
    #00a4d2,
    #006a91,
    #63b3ed,
    #00a4d2
  );
  --font-primary:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;
  --text-7xl: 4.5rem;
  --heading-h1: clamp(2.5rem, 5vw, 4rem);
  --heading-h2: clamp(2rem, 4vw, 3rem);
  --heading-h3: clamp(1.5rem, 3vw, 2rem);
  --heading-h4: clamp(1.25rem, 2vw, 1.5rem);
  --heading-h5: 1.125rem;
  --heading-h6: 1rem;
  --leading-none: 1;
  --leading-tight: 1.2;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 1.8;
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;
  --space-1: 0.25rem;
  --space-1-5: 0.375rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-28: 7rem;
  --space-32: 8rem;
  --space-40: 10rem;
  --space-48: 12rem;
  --section-padding-y: clamp(3rem, 8vw, 6rem);
  --section-padding-x: clamp(1rem, 4vw, 2rem);
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm:
    0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  --shadow-glow-sm: 0 0 20px rgba(0, 164, 210, 0.3);
  --shadow-glow-md: 0 0 40px rgba(0, 164, 210, 0.4);
  --shadow-glow-lg: 0 0 60px rgba(0, 164, 210, 0.5);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 12px 40px -4px rgba(0, 0, 0, 0.15);
  --radius-none: 0;
  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;
  --duration-instant: 50ms;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;
  --duration-slowest: 1000ms;
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --transition-base: all var(--duration-normal) var(--ease-smooth);
  --transition-fast: all var(--duration-fast) var(--ease-smooth);
  --transition-slow: all var(--duration-slow) var(--ease-smooth);
  --transition-colors:
    color var(--duration-normal) var(--ease-smooth),
    background-color var(--duration-normal) var(--ease-smooth),
    border-color var(--duration-normal) var(--ease-smooth);
  --transition-transform: transform var(--duration-normal) var(--ease-smooth);
  --transition-opacity: opacity var(--duration-normal) var(--ease-smooth);
  --blur-sm: 4px;
  --blur-md: 8px;
  --blur-lg: 16px;
  --blur-xl: 24px;
  --blur-2xl: 40px;
  --glass-bg-light: rgba(255, 255, 255, 0.7);
  --glass-bg-dark: rgba(0, 0, 0, 0.5);
  --glass-bg-primary: rgba(0, 164, 210, 0.1);
  --glass-border-light: rgba(255, 255, 255, 0.3);
  --glass-border-dark: rgba(255, 255, 255, 0.1);
  --z-hide: -1;
  --z-base: 0;
  --z-content: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-bg: 40;
  --z-modal: 50;
  --z-popover: 60;
  --z-tooltip: 70;
  --z-notification: 80;
  --z-max: 9999;
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;
  --container-max: 1536px;
  --btn-padding-x-sm: var(--space-3);
  --btn-padding-y-sm: var(--space-2);
  --btn-padding-x-md: var(--space-5);
  --btn-padding-y-md: var(--space-3);
  --btn-padding-x-lg: var(--space-6);
  --btn-padding-y-lg: var(--space-4);
  --btn-radius: var(--radius-lg);
  --btn-font-weight: var(--font-weight-semibold);
  --card-padding: var(--space-6);
  --card-radius: var(--radius-xl);
  --card-bg: var(--color-bg-primary);
  --card-border: 1px solid var(--color-border-light);
  --card-shadow: var(--shadow-card);
  --card-shadow-hover: var(--shadow-card-hover);
  --input-height: 48px;
  --input-padding-x: var(--space-4);
  --input-radius: var(--radius-md);
  --input-border: 1px solid var(--color-border-medium);
  --input-border-focus: 2px solid var(--color-primary-400);
  --input-bg: var(--color-bg-primary);
  --input-font-size: var(--text-base);
  --header-height: 80px;
  --header-height-mobile: 64px;
  --header-bg: rgba(255, 255, 255, 0.8);
  --header-blur: var(--blur-lg);
  --focus-ring: 0 0 0 3px rgba(0, 164, 210, 0.4);
  --focus-ring-offset: 2px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 68px;
  --motion-fast: 180ms;
  --motion-base: 280ms;
  --motion-slow: 480ms;
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-pop: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --gap-card: 24px;
  --gap-section: 32px;
  --gap-page: 48px;
  --surface-canvas: #fbfbfd;
  --surface-card: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-strong: rgba(255, 255, 255, 0.86);
  --hairline: rgba(0, 0, 0, 0.06);
  --hairline-strong: rgba(0, 0, 0, 0.1);
  --glow-brand: 0 0 0 4px rgba(0, 164, 210, 0.12);
  --glow-brand-strong: 0 8px 32px rgba(0, 164, 210, 0.22);
  --accent-emerald: #10b981;
  --accent-emerald-soft: rgba(16, 185, 129, 0.12);
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-soft: rgba(245, 158, 11, 0.12);
  --accent-amber-glow: rgba(245, 158, 11, 0.3);
  --accent-indigo: #6366f1;
  --accent-indigo-soft: rgba(99, 102, 241, 0.12);
  --accent-indigo-glow: rgba(99, 102, 241, 0.3);
  --accent-violet: #8b5cf6;
  --accent-violet-soft: rgba(139, 92, 246, 0.12);
  --accent-violet-glow: rgba(139, 92, 246, 0.3);
  --accent-rose: #f43f5e;
  --accent-rose-soft: rgba(244, 63, 94, 0.12);
  --accent-rose-glow: rgba(244, 63, 94, 0.3);
  --accent-cyan: #00a4d2;
  --accent-cyan-soft: rgba(0, 164, 210, 0.12);
  --accent-cyan-glow: rgba(0, 164, 210, 0.3);
  --accent-sky: #0ea5e9;
  --accent-sky-soft: rgba(14, 165, 233, 0.12);
  --accent-sky-glow: rgba(14, 165, 233, 0.3);
  --accent-fuchsia: #d946ef;
  --accent-fuchsia-soft: rgba(217, 70, 239, 0.12);
  --accent-fuchsia-glow: rgba(217, 70, 239, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;
    --duration-slowest: 0ms;
  }

  *,
  ::after,
  ::before {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

[data-theme="dark"] {
  --surface-canvas: #000000;
  --surface-card: #1c1c1e;
  --surface-glass: rgba(28, 28, 30, 0.72);
  --surface-glass-strong: rgba(28, 28, 30, 0.92);
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --color-text-primary: #f5f5f7;
  --color-text-secondary: #a1a1a6;
  --color-text-tertiary: #6e6e73;
  --color-bg-primary: #1c1c1e;
  --color-bg-secondary: #000000;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 12px 40px -4px rgba(0, 0, 0, 0.65);
  --accent-emerald-soft: rgba(16, 185, 129, 0.18);
  --accent-amber-soft: rgba(245, 158, 11, 0.18);
  --accent-indigo-soft: rgba(99, 102, 241, 0.2);
  --accent-violet-soft: rgba(139, 92, 246, 0.2);
  --accent-rose-soft: rgba(244, 63, 94, 0.18);
  --accent-cyan-soft: rgba(0, 164, 210, 0.2);
}

*,
::after,
::before {
  box-sizing: border-box;
}

body,
html {
  margin: 0;
  padding: 0;
  background: var(--surface-canvas);
  color: var(--color-text-primary, #1d1d1f);
  font-family: var(
    --font-primary,
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif
  );
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: 0 0;
}

input,
select,
textarea {
  font-family: inherit;
}

a {
  color: var(--color-primary-400);
  text-decoration: none;
}

.t-display {
  font-size: clamp(32px, 4.5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.08;
}

.t-h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.019em;
  line-height: 1.15;
}

.page-header {
  margin: 0 0 22px;
}

.page-header .t-h1 {
  margin: 0;
}

.page-header .t-meta {
  margin-top: 6px;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.t-h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.014em;
  line-height: 1.25;
}

.t-h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.011em;
  line-height: 1.3;
}

.t-body {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
}

.t-meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.t-caption {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.t-mono {
  font-family: var(--font-mono);
  font-feature-settings:
    "tnum" 1,
    "cv11" 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  transition:
    transform var(--motion-fast) var(--ease-apple),
    box-shadow var(--motion-fast) var(--ease-apple),
    background var(--motion-fast) var(--ease-apple);
  user-select: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary-400);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 4px 14px rgba(0, 164, 210, 0.25);
}

.btn-primary:hover {
  background: var(--color-primary-500);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    var(--glow-brand-strong);
}

.btn-primary:focus-visible {
  outline: 0;
  box-shadow:
    var(--glow-brand),
    0 4px 14px rgba(0, 164, 210, 0.25);
}

.btn-ghost {
  background: 0 0;
  color: var(--color-text-primary);
  border: 1px solid var(--hairline-strong);
}

.btn-ghost:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-300);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-link {
  background: 0 0;
  color: var(--color-primary-400);
  padding: 6px 8px;
  font-weight: 500;
}

.btn-link:hover {
  color: var(--color-primary-500);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: 0 0;
  color: var(--color-text-secondary);
  border: 1px solid transparent;
}

.btn-icon:hover {
  background: var(--color-gray-100);
  color: var(--color-text-primary);
}

[data-theme="dark"] .btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  background: var(--surface-card);
  color: var(--color-text-primary);
  font-size: 15px;
  transition:
    border-color var(--motion-fast) var(--ease-apple),
    box-shadow var(--motion-fast) var(--ease-apple),
    background var(--motion-fast) var(--ease-apple);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:focus {
  outline: 0;
  border-color: var(--color-primary-400);
  box-shadow: var(--glow-brand);
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-card);
  transition:
    border-color var(--motion-fast) var(--ease-apple),
    box-shadow var(--motion-fast) var(--ease-apple);
}

.input-group:focus-within {
  border-color: var(--color-primary-400);
  box-shadow: var(--glow-brand);
}

.input-group .prefix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-weight: 600;
  font-size: 15px;
  color: var(--color-text-secondary);
  border-right: 1px solid var(--hairline);
  background: var(--color-gray-50);
}

[data-theme="dark"] .input-group .prefix {
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary);
}

.input-group input {
  flex: 1;
  border: none;
  outline: 0;
  background: 0 0;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--color-text-primary);
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  padding: var(--gap-card);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow var(--motion-base) var(--ease-apple),
    transform var(--motion-base) var(--ease-apple);
}

.card-hoverable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-card);
  transition:
    box-shadow var(--motion-base) var(--ease-apple),
    transform var(--motion-base) var(--ease-apple);
}

.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at 100% 0,
    rgba(0, 164, 210, 0.08),
    transparent 50%
  );
  opacity: 0;
  transition: opacity var(--motion-base) var(--ease-apple);
  pointer-events: none;
}

.kpi:hover::after {
  opacity: 1;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.kpi-value {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin: 8px 0 6px;
  line-height: 1.1;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.kpi-delta.up {
  color: var(--color-success);
}

.kpi-delta.down {
  color: var(--color-error);
}

.kpi-delta.neutral {
  color: var(--color-text-tertiary);
}

.kpi-spark {
  margin-top: 14px;
  height: 32px;
  width: 100%;
}

.kpi-pulse {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: pulse-dot 2s var(--ease-apple) infinite;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 260ms var(--ease-apple);
}

html.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 0 16px 18px;
  z-index: 10;
  transition: padding 220ms var(--ease-apple);
}

/* ── Collapsed (desktop icon-rail) state ─────────────────────────────── */
html.sidebar-collapsed .sidebar {
  padding: 0 10px 18px;
}

html.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

html.sidebar-collapsed .sidebar-brand .brand-text {
  display: none;
}

html.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 10px;
}

html.sidebar-collapsed .nav-item span,
html.sidebar-collapsed .nav-item .badge,
html.sidebar-collapsed .nav-section-label,
html.sidebar-collapsed .theme-toggle {
  display: none;
}

html.sidebar-collapsed .nav-item.active::before {
  left: 0;
}

/* Custom hover tooltip — shows the full label the collapsed rail hides.
   Reuses each nav-item's own data-tooltip attribute rather than the plain
   native browser title tooltip, so it matches the app's visual language. */
html.sidebar-collapsed .nav-item {
  position: relative;
}

html.sidebar-collapsed .nav-item[data-tooltip]:hover::after,
html.sidebar-collapsed .nav-item[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-text-primary);
  color: var(--surface-canvas);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 60;
  pointer-events: none;
  animation: sidebarTooltipIn 140ms var(--ease-apple) both;
}

@keyframes sidebarTooltipIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Floating collapse/expand toggle — pinned to the sidebar's right edge */
.sidebar-collapse-btn {
  position: absolute;
  top: 24px;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--hairline-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: grid;
  place-items: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  z-index: 20;
  padding: 0;
  transition:
    background 160ms var(--ease-apple),
    color 160ms var(--ease-apple),
    box-shadow 160ms var(--ease-apple);
}

.sidebar-collapse-btn:hover {
  background: var(--color-primary-400);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.sidebar-collapse-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 260ms var(--ease-apple);
}

html.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 14px;
}

.sidebar-brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    var(--color-primary-400),
    var(--color-primary-600)
  );
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.sidebar-brand .name {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.sidebar-brand .tag {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition:
    background var(--motion-fast) var(--ease-apple),
    color var(--motion-fast) var(--ease-apple);
  cursor: pointer;
  position: relative;
  line-height: 1;
}

.nav-item span {
  display: block;
  line-height: 1;
  padding-top: 2px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text-primary);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  background: rgba(0, 164, 210, 0.1);
  color: var(--color-primary-400);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--color-primary-400);
  border-radius: 0 2px 2px 0;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--color-primary-400);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.theme-toggle:hover {
  background: var(--color-gray-100);
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--color-gray-200);
  border-radius: 999px;
  position: relative;
  transition: background var(--motion-fast) var(--ease-apple);
  cursor: pointer;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform var(--motion-fast) var(--ease-pop);
}

.toggle-switch.on,
input[type="checkbox"]:checked + .toggle-switch {
  background: var(--color-primary-400);
}

.toggle-switch.on::after,
input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(16px);
}

.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  min-height: 0;
  position: relative;
  padding: 0 !important;
  margin: 0 !important;
}

.toggle-switch.on {
  background: var(--color-primary-400);
}

.toggle-switch.on::after {
  transform: translateX(16px);
}

.main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.content-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.topbar {
  position: relative;
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
  z-index: 9;
}

.topbar .greeting .who {
  letter-spacing: -0.011em;
}

.topbar .greeting .when {
  color: var(--color-text-tertiary);
}

.topbar-actions {
  display: flex;
  align-items: center;
}

.avatar {
  background: linear-gradient(
    135deg,
    var(--color-primary-400),
    var(--color-primary-600)
  );
  display: grid;
  place-items: center;
  color: #fff;
  letter-spacing: -0.01em;
}

/* ── Navbar avatar dropdown ───────────────────────────────────────────── */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms var(--ease-apple);
}

.user-menu-trigger:hover,
.user-menu.open .user-menu-trigger {
  background: rgba(0, 0, 0, 0.045);
}

[data-theme="dark"] .user-menu-trigger:hover,
[data-theme="dark"] .user-menu.open .user-menu-trigger {
  background: rgba(255, 255, 255, 0.08);
}

.user-menu-chevron {
  width: 15px;
  height: 15px;
  color: var(--color-text-tertiary);
  transition: transform 220ms var(--ease-apple);
}

.user-menu.open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow:
    0 16px 44px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity 160ms var(--ease-apple),
    transform 200ms var(--ease-pop),
    visibility 0s linear 200ms;
  z-index: var(--z-popover, 60);
}

.user-menu.open .user-menu-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 160ms var(--ease-apple),
    transform 200ms var(--ease-pop),
    visibility 0s linear 0s;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    background var(--motion-fast) var(--ease-apple),
    color var(--motion-fast) var(--ease-apple);
}

.user-menu-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.user-menu-item:hover {
  background: rgba(0, 0, 0, 0.045);
  color: var(--color-text-primary);
}

[data-theme="dark"] .user-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.user-menu-item.danger:hover {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
}

/* A pretty gradient rule above Sign out — not just a plain hairline — matching
   the accent-bar treatment used elsewhere (chat hero underline, result cards). */
.user-menu-divider {
  height: 1px;
  margin: 7px 4px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--hairline-strong) 15%,
    var(--accent-cyan-glow) 50%,
    var(--hairline-strong) 85%,
    transparent
  );
  position: relative;
}

.user-menu-divider::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -1.5px;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
  opacity: 0.85;
}

.page {
  padding: 24px;
  max-width: 100%;
  width: 100%;
  margin: 0;
}

.auth-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-stage::after,
.auth-stage::before {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}

.auth-stage::before {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(0, 164, 210, 0.32), transparent 60%);
  top: -180px;
  right: -120px;
  animation: aurora-1 14s var(--ease-apple) infinite alternate;
}

.auth-stage::after {
  width: 420px;
  height: 420px;
  background: radial-gradient(
    circle,
    rgba(99, 179, 237, 0.28),
    transparent 60%
  );
  bottom: -160px;
  left: -120px;
  animation: aurora-2 16s var(--ease-apple) infinite alternate;
}

@keyframes aurora-1 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-40px, 60px) scale(1.15);
  }
}

@keyframes aurora-2 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(50px, -40px) scale(1.12);
  }
}

[data-theme="dark"] .auth-stage::before {
  opacity: 0.32;
}

[data-theme="dark"] .auth-stage::after {
  opacity: 0.26;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  background: var(--surface-glass-strong);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: 40px 32px 32px;
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(0, 0, 0, 0.02);
  animation: lift-in 0.7s var(--ease-apple) both;
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-card .brand .logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--color-primary-400),
    var(--color-primary-600)
  );
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 16px rgba(0, 164, 210, 0.28);
}

.auth-card .brand .name {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.012em;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.019em;
}

.auth-card .sub {
  margin: 0 0 28px;
  color: var(--color-text-secondary);
  font-size: 15px;
}

.auth-card .form-row {
  margin-bottom: 16px;
}

.auth-card .actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.auth-card .footer-link {
  margin-top: 22px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.auth-card .footer-link a {
  font-weight: 600;
  color: var(--color-primary-400);
}

.status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  display: none;
}

.status.show {
  display: block;
  animation: lift-in 280ms var(--ease-apple) both;
}

.status.error {
  background: var(--color-error-light);
  color: #b91c1c;
}

.status.success {
  background: var(--color-success-light);
  color: #065f46;
}

.status.info {
  background: var(--color-info-light);
  color: #1d4ed8;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-pill {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--color-gray-200);
  overflow: hidden;
  position: relative;
}

.step-pill.active::after,
.step-pill.done::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-primary-400);
  transition: transform var(--motion-base) var(--ease-apple);
}

.step-pill.active::after {
  transform: scaleX(0.5);
  transform-origin: left;
}

.step-pill.done::after {
  transform: scaleX(1);
  transform-origin: left;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: var(--gap-section);
}

.widget-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: var(--gap-section);
}

.widget-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--color-text-tertiary);
}

.empty-state svg {
  opacity: 0.4;
  margin-bottom: 8px;
}

.skel {
  background: linear-gradient(
    90deg,
    var(--color-gray-100) 0,
    var(--color-gray-200) 50%,
    var(--color-gray-100) 100%
  );
  background-size: 200% 100%;
  animation: 1.6s linear infinite shimmer;
  border-radius: 6px;
}

[data-theme="dark"] .skel {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 1100px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .widget-grid,
  .widget-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell,
  html.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  /* The desktop icon-rail collapse toggle has no meaning on mobile — the
     hamburger (.mobile-toggle) already shows/hides the full-screen drawer. */
  .sidebar-collapse-btn {
    display: none;
  }

  .page {
    padding: 20px 16px 48px;
  }

  .topbar {
    padding: 0 16px;
  }
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-1 {
  margin-bottom: 4px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-tertiary {
  color: var(--color-text-tertiary);
}

.hidden {
  display: none !important;
}

.kpi {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition:
    transform 480ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 320ms;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: radial-gradient(
    140px circle at var(--mx, 50%) var(--my, 0),
    var(--kpi-glow, transparent),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 380ms;
  pointer-events: none;
  z-index: 0;
}

.kpi > * {
  position: relative;
  z-index: 1;
}

.kpi:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow:
    0 18px 48px -12px var(--kpi-glow, rgba(0, 0, 0, 0.18)),
    0 4px 12px rgba(0, 0, 0, 0.04);
  border-color: var(--kpi-color, var(--color-primary-300));
}

.kpi:hover::before {
  opacity: 1;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--kpi-soft, var(--color-primary-50));
  color: var(--kpi-color, var(--color-primary-400));
  display: grid;
  place-items: center;
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.kpi-icon-box svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.kpi:hover .kpi-icon-box {
  transform: scale(1.08) rotate(-3deg);
}

.kpi-pulse-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  position: relative;
}

.kpi-pulse-live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent-emerald);
  opacity: 0.4;
  animation: 1.6s ease-out infinite kpiPulse;
}

@keyframes kpiPulse {
  0% {
    transform: scale(0.7);
    opacity: 0.6;
  }

  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.kpi-spark-canvas {
  width: 100%;
  height: 38px;
  margin-top: 14px;
  display: block;
  pointer-events: none;
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stagger-in {
  animation: 620ms cubic-bezier(0.22, 1, 0.36, 1) both cardRise;
}

.stagger-in[data-i="0"] {
  animation-delay: 0s;
}

.stagger-in[data-i="1"] {
  animation-delay: 60ms;
}

.stagger-in[data-i="2"] {
  animation-delay: 120ms;
}

.stagger-in[data-i="3"] {
  animation-delay: 180ms;
}

.stagger-in[data-i="4"] {
  animation-delay: 240ms;
}

.stagger-in[data-i="5"] {
  animation-delay: 0.3s;
}

.stagger-in[data-i="6"] {
  animation-delay: 360ms;
}

.stagger-in[data-i="7"] {
  animation-delay: 420ms;
}

.briefing-aurora {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.08) 0,
    rgba(99, 102, 241, 0.06) 35%,
    rgba(139, 92, 246, 0.05) 70%,
    rgba(16, 185, 129, 0.06) 100%
  );
  border: 1px solid rgba(0, 164, 210, 0.14);
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.briefing-aurora::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -25%;
  right: -25%;
  bottom: -50%;
  background:
    radial-gradient(
      35% 40% at 20% 30%,
      rgba(0, 164, 210, 0.18),
      transparent 60%
    ),
    radial-gradient(
      35% 40% at 80% 70%,
      rgba(139, 92, 246, 0.16),
      transparent 60%
    ),
    radial-gradient(
      30% 30% at 50% 90%,
      rgba(16, 185, 129, 0.1),
      transparent 60%
    );
  filter: blur(36px);
  animation: 14s ease-in-out infinite alternate auroraDrift;
  pointer-events: none;
  z-index: 0;
}

.briefing-aurora > * {
  position: relative;
  z-index: 1;
}

@keyframes auroraDrift {
  0% {
    transform: translate(0, 0) rotate(0) scale(1);
  }

  50% {
    transform: translate(8%, -4%) rotate(20deg) scale(1.08);
  }

  100% {
    transform: translate(-6%, 6%) rotate(-15deg) scale(1.04);
  }
}

.briefing-aurora .ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0, 164, 210, 0.35);
}

.briefing-aurora .ic svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

.briefing-aurora .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
}

.briefing-aurora .text {
  font-size: 14.5px;
  color: var(--color-text-primary);
  line-height: 1.55;
  font-weight: 500;
}

.sidebar.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
}

[data-theme="dark"] .sidebar.glass {
  background: rgba(20, 20, 22, 0.78);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar.glass {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .topbar.glass {
  background: rgba(20, 20, 22, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pill-toggle {
  position: relative;
  display: inline-flex;
  background: var(--color-gray-100);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
}

[data-theme="dark"] .pill-toggle {
  background: rgba(255, 255, 255, 0.05);
}

.pill-toggle button {
  position: relative;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  z-index: 1;
  transition: color 280ms;
}

.pill-toggle button.active {
  color: var(--color-text-primary);
  font-weight: 600;
}

.pill-toggle .slider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  background: var(--surface-card);
  border-radius: 999px;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
  transition:
    left 480ms cubic-bezier(0.34, 1.56, 0.64, 1),
    width 480ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
}

[data-theme="dark"] .pill-toggle .slider {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.floating-chat {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--accent-cyan) 0,
    var(--accent-indigo) 100%
  );
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow:
    0 10px 32px rgba(0, 164, 210, 0.42),
    0 4px 12px rgba(99, 102, 241, 0.2);
  cursor: pointer;
  transition:
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 320ms;
  z-index: 50;
}

.floating-chat::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0, 164, 210, 0.45);
  animation: 2.4s ease-out infinite fabPulse;
  pointer-events: none;
}

@keyframes fabPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }

  100%,
  70% {
    transform: scale(1.45);
    opacity: 0;
  }
}

.floating-chat:hover {
  transform: scale(1.08) rotate(-6deg);
  box-shadow:
    0 16px 44px rgba(0, 164, 210, 0.55),
    0 6px 18px rgba(99, 102, 241, 0.32);
}

.floating-chat svg {
  width: 24px;
  height: 24px;
}

.modal-backdrop {
  inset: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms;
  place-items: flex-start center;
  padding: 8vh 24px 24px;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.32);
  transform: translateY(20px) scale(0.96);
  transition: transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}

.spotlight {
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.spotlight-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}

.spotlight-input-row::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--accent-cyan),
    var(--accent-violet),
    var(--accent-fuchsia)
  );
  opacity: 0.7;
}

.spotlight-input {
  flex: 1;
  background: 0 0;
  border: none;
  outline: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.spotlight-input::placeholder {
  color: var(--color-text-tertiary);
}

.spotlight-list {
  overflow-y: auto;
  padding: 6px 0;
}

.spotlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background 180ms;
}

.spotlight-item.active,
.spotlight-item:hover {
  background: var(--accent-cyan-soft);
}

.spotlight-item .ic-mini {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  display: grid;
  place-items: center;
}

.spotlight-item .ic-mini svg {
  width: 14px;
  height: 14px;
}

.spotlight-item .label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.spotlight-item .kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-gray-100);
  color: var(--color-text-tertiary);
}

[data-theme="dark"] .spotlight-item .kbd {
  background: rgba(255, 255, 255, 0.08);
}

.drill-modal {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.drill-head {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 14px;
}

.drill-head .ic-lg {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--kpi-soft, var(--color-primary-50));
  color: var(--kpi-color, var(--color-primary-400));
  display: grid;
  place-items: center;
}

.drill-head .ic-lg svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

.drill-head .t-h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.drill-head .t-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.drill-body {
  padding: 22px 28px;
  overflow-y: auto;
}

.drill-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.drill-stat {
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--surface-page);
}

.drill-stat .lbl {
  font-size: 11px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.drill-canvas {
  width: 100%;
  height: 280px;
}

.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin-left: auto;
  color: var(--color-text-secondary);
  transition: background 180ms;
}

.btn-close:hover {
  background: var(--color-gray-100);
  color: var(--color-text-primary);
}

[data-theme="dark"] .btn-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-close svg {
  width: 18px;
  height: 18px;
}

.tip-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    var(--accent-amber-soft) 0,
    var(--accent-emerald-soft) 100%
  );
  border: 1px solid var(--accent-amber-soft);
  margin-top: var(--gap-section);
}

.tip-banner .ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(
    135deg,
    var(--accent-amber),
    var(--accent-emerald)
  );
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tip-banner .ic svg {
  width: 17px;
  height: 17px;
}

.tip-banner .ttl {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.tip-banner .desc {
  font-size: 13.5px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.tilt-card {
  transform: perspective(800px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg)) translateZ(0);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.delta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.delta-chip.up {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.delta-chip.down {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
}

.delta-chip.flat {
  background: var(--color-gray-100);
  color: var(--color-text-tertiary);
}

[data-theme="dark"] .delta-chip.flat {
  background: rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  .briefing-aurora::before,
  .floating-chat::before,
  .stagger-in {
    animation: none !important;
  }

  .kpi:hover {
    transform: none;
  }
}

.modal-card.drill-modal {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(
      1200px 600px at 90% -20%,
      var(--kpi-soft, rgba(0, 164, 210, 0.12)) 0,
      transparent 60%
    ),
    radial-gradient(
      800px 400px at -10% 110%,
      var(--kpi-soft, rgba(0, 164, 210, 0.08)) 0,
      transparent 60%
    ),
    var(--surface-card);
  border: 1px solid
    color-mix(in srgb, var(--kpi-color, #00a4d2) 22%, var(--hairline));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 80px 160px -40px
      color-mix(in srgb, var(--kpi-color, #00a4d2) 35%, transparent);
}

[data-theme="dark"] .modal-card.drill-modal {
  background:
    radial-gradient(
      1200px 600px at 90% -20%,
      color-mix(in srgb, var(--kpi-color, #00a4d2) 18%, transparent) 0,
      transparent 60%
    ),
    radial-gradient(
      800px 400px at -10% 110%,
      color-mix(in srgb, var(--kpi-color, #00a4d2) 12%, transparent) 0,
      transparent 60%
    ),
    #1c1c1e;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 80px 200px -40px
      color-mix(in srgb, var(--kpi-color, #00a4d2) 50%, transparent);
}

.modal-card.drill-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(
    90deg,
    transparent 0,
    var(--kpi-color, #00a4d2) 30%,
    var(--accent-fuchsia) 50%,
    var(--accent-cyan) 70%,
    transparent 100%
  );
  opacity: 0.7;
  pointer-events: none;
}

.drill-head .ic-lg {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--kpi-color, #00a4d2) 18%, var(--surface-card)),
    var(--kpi-soft, var(--color-primary-50))
  );
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--kpi-color, #00a4d2) 18%, transparent),
    0 8px 22px color-mix(in srgb, var(--kpi-color, #00a4d2) 28%, transparent);
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.drill-head:hover .ic-lg {
  transform: scale(1.06) rotate(-3deg);
}

.drill-head .t-h2 {
  background: linear-gradient(
    135deg,
    var(--color-text-primary),
    color-mix(in srgb, var(--kpi-color, #00a4d2) 70%, var(--color-text-primary))
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.drill-stat {
  position: relative;
  background: linear-gradient(
    180deg,
    var(--surface-card) 0,
    color-mix(
        in srgb,
        var(--kpi-soft, rgba(0, 164, 210, 0.06)) 60%,
        var(--surface-card)
      )
      100%
  );
  border: 1px solid
    color-mix(in srgb, var(--kpi-color, #00a4d2) 12%, var(--hairline));
  overflow: hidden;
  transition:
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 240ms;
}

.drill-stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    var(--kpi-color, #00a4d2),
    color-mix(in srgb, var(--kpi-color, #00a4d2) 40%, transparent)
  );
}

.drill-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px
    color-mix(in srgb, var(--kpi-color, #00a4d2) 18%, transparent);
}

.drill-stat .val {
  font-family: var(--font-mono);
  font-weight: 600;
  margin-top: 4px;
  font-size: 19px;
  letter-spacing: -0.02em;
  background: linear-gradient(
    135deg,
    var(--color-text-primary),
    color-mix(in srgb, var(--kpi-color, #00a4d2) 35%, var(--color-text-primary))
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.drill-chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: 16px;
  padding: 4px 0;
}

.drill-chart-wrap::before {
  content: "";
  position: absolute;
  inset: -10px 0 -10px 0;
  background: radial-gradient(
    80% 100% at 50% 100%,
    color-mix(in srgb, var(--kpi-color, #00a4d2) 14%, transparent) 0,
    transparent 70%
  );
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  animation: 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards chartHaloFade;
}

.drill-chart-wrap canvas {
  position: relative;
  z-index: 1;
}

@keyframes chartHaloFade {
  to {
    opacity: 1;
  }
}

.drill-marker {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition:
    opacity 320ms,
    transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
}

.drill-marker.show {
  opacity: 1;
  transform: translate(-50%, calc(-100% - 4px));
}

.drill-marker .pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  background: var(--surface-card);
  border: 1px solid
    color-mix(in srgb, var(--kpi-color, #00a4d2) 30%, var(--hairline));
  box-shadow: 0 6px 16px
    color-mix(in srgb, var(--kpi-color, #00a4d2) 22%, transparent);
  white-space: nowrap;
}

.drill-marker.high .pill {
  color: var(--accent-emerald);
  border-color: color-mix(in srgb, var(--accent-emerald) 28%, var(--hairline));
}

.drill-marker.low .pill {
  color: var(--accent-rose);
  border-color: color-mix(in srgb, var(--accent-rose) 28%, var(--hairline));
}

.drill-marker .arr {
  width: 0;
  height: 0;
  margin: 1px auto 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--surface-card);
  filter: drop-shadow(
    0 1px 0 color-mix(in srgb, var(--kpi-color, #00a4d2) 30%, var(--hairline))
  );
}

[data-theme="dark"] .drill-marker .pill {
  background: rgba(28, 28, 30, 0.95);
}

[data-theme="dark"] .drill-marker .arr {
  border-top-color: rgba(28, 28, 30, 0.95);
}

.drill-pulse {
  position: absolute;
  z-index: 2;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  animation: 480ms 0.6s forwards drillPulseFade;
}

.drill-pulse.high {
  background: var(--accent-emerald);
  box-shadow: 0 0 0 0 var(--accent-emerald);
  animation:
    480ms 0.6s forwards drillPulseFade,
    1.8s 0.8s infinite drillPulseRing;
}

.drill-pulse.low {
  background: var(--accent-rose);
  box-shadow: 0 0 0 0 var(--accent-rose);
  animation:
    480ms 0.6s forwards drillPulseFade,
    1.8s 0.8s infinite drillPulseRingRose;
}

@keyframes drillPulseFade {
  to {
    opacity: 1;
  }
}

@keyframes drillPulseRing {
  0% {
    box-shadow: 0 0 0 0
      color-mix(in srgb, var(--accent-emerald) 50%, transparent);
  }

  70% {
    box-shadow: 0 0 0 12px
      color-mix(in srgb, var(--accent-emerald) 0, transparent);
  }

  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-emerald) 0, transparent);
  }
}

@keyframes drillPulseRingRose {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-rose) 50%, transparent);
  }

  70% {
    box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent-rose) 0, transparent);
  }

  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-rose) 0, transparent);
  }
}

.modal-backdrop.open .modal-card.drill-modal {
  animation: 540ms cubic-bezier(0.34, 1.56, 0.64, 1) both drillOpen;
}

@keyframes drillOpen {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .drill-chart-wrap::before,
  .drill-marker,
  .drill-pulse,
  .modal-card.drill-modal::before {
    animation: none !important;
    transition: none !important;
  }
}

.page-header-hero {
  position: relative;
  padding: 16px 24px;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 18px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.65),
    rgba(255, 255, 255, 0.3)
  );
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 8px 28px rgba(99, 102, 241, 0.07);
  isolation: isolate;
  transform: perspective(1000px) rotateX(var(--hero-rx, 0deg))
    rotateY(var(--hero-ry, 0deg));
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: 0.6s cubic-bezier(0.22, 1, 0.36, 1) both heroReveal;
  min-height: 84px;
  display: flex;
  align-items: center;
}

[data-theme="dark"] .page-header-hero {
  background: linear-gradient(
    135deg,
    rgba(28, 28, 30, 0.72),
    rgba(28, 28, 30, 0.4)
  );
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 28px rgba(0, 0, 0, 0.4);
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: perspective(1000px) translateY(12px);
  }

  to {
    opacity: 1;
    transform: perspective(1000px) translateY(0);
  }
}

.page-header-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.28;
  mix-blend-mode: screen;
  animation: 22s ease-in-out infinite auroraFloat;
}

[data-theme="dark"] .aurora {
  opacity: 0.22;
  mix-blend-mode: lighten;
}

.aurora-1 {
  width: 280px;
  height: 280px;
  background: #00a4d2;
  top: -110px;
  left: -70px;
}

.aurora-2 {
  width: 220px;
  height: 220px;
  background: #8b5cf6;
  top: -50px;
  right: -80px;
  animation-delay: -8s;
}

.aurora-3 {
  display: none;
}

@keyframes auroraFloat {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  33% {
    transform: translate(30px, -20px) scale(1.08);
  }

  66% {
    transform: translate(-25px, 15px) scale(0.95);
  }
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(
    ellipse 100% 80% at 50% 50%,
    black,
    transparent
  );
  mask-image: radial-gradient(ellipse 100% 80% at 50% 50%, black, transparent);
  pointer-events: none;
}

[data-theme="dark"] .grid-overlay {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

.page-header-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
}

.page-icon-glow {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #00a4d2, #6366f1, #d946ef);
  box-shadow:
    0 0 24px rgba(99, 102, 241, 0.45),
    0 6px 20px rgba(0, 164, 210, 0.28);
  flex-shrink: 0;
  animation: 3.6s ease-in-out infinite iconPulse;
}

.page-icon-glow svg {
  width: 22px;
  height: 22px;
  color: #fff;
  stroke-width: 2.2;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

@keyframes iconPulse {
  0%,
  100% {
    box-shadow:
      0 0 24px rgba(99, 102, 241, 0.45),
      0 6px 20px rgba(0, 164, 210, 0.28);
  }

  50% {
    box-shadow:
      0 0 36px rgba(99, 102, 241, 0.65),
      0 8px 28px rgba(0, 164, 210, 0.4);
  }
}

.page-header-text {
  flex: 1;
  min-width: 0;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title-gradient {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0;
  background: linear-gradient(
    110deg,
    #00a4d2 0,
    #6366f1 25%,
    #8b5cf6 50%,
    #d946ef 75%,
    #00a4d2 100%
  );
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: 14s linear infinite titleGradient;
  position: relative;
  display: inline-block;
}

@keyframes titleGradient {
  0% {
    background-position: 0 50%;
  }

  100% {
    background-position: 220% 50%;
  }
}

.page-title-gradient::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  pointer-events: none;
  opacity: 0;
}

.page-header-hero:hover .page-title-gradient::after {
  animation: 1.2s ease-out titleShimmer;
}

@keyframes titleShimmer {
  0% {
    left: -100%;
    opacity: 1;
  }

  100% {
    left: 100%;
    opacity: 0;
  }
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #10b981;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: 2s ease-in-out infinite dotPulse;
}

.page-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 3px 0 0;
  max-width: 680px;
  line-height: 1.4;
}

.page-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.page-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 164, 210, 0.08);
  border: 1px solid rgba(0, 164, 210, 0.18);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

[data-theme="dark"] .page-chip {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.page-underline {
  position: relative;
  height: 2px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 2px;
}

.page-underline::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #00a4d2, #6366f1, #d946ef, transparent);
  transform-origin: left center;
  transform: scaleX(0);
  animation: 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards drawUnderline;
}

@keyframes drawUnderline {
  to {
    transform: scaleX(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aurora,
  .page-header-hero,
  .page-icon-glow,
  .page-title-gradient,
  .page-underline::before {
    animation: none;
  }
}

.page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      circle at 8% -10%,
      rgba(0, 164, 210, 0.06),
      transparent 40%
    ),
    radial-gradient(
      circle at 92% -5%,
      rgba(139, 92, 246, 0.05),
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 110%,
      rgba(217, 70, 239, 0.04),
      transparent 50%
    );
}

[data-theme="dark"] .page::before {
  background:
    radial-gradient(circle at 8% -10%, rgba(0, 164, 210, 0.1), transparent 40%),
    radial-gradient(
      circle at 92% -5%,
      rgba(139, 92, 246, 0.08),
      transparent 40%
    ),
    radial-gradient(
      circle at 50% 110%,
      rgba(217, 70, 239, 0.06),
      transparent 50%
    );
}

.page > * {
  position: relative;
  z-index: 1;
}

.kpi-row .kpi {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 280ms;
  animation: 0.6s cubic-bezier(0.22, 1, 0.36, 1) both kpiReveal;
  overflow: hidden;
}

.kpi-row .kpi:first-child {
  animation-delay: 0s;
}

.kpi-row .kpi:nth-child(2) {
  animation-delay: 80ms;
}

.kpi-row .kpi:nth-child(3) {
  animation-delay: 160ms;
}

.kpi-row .kpi:nth-child(4) {
  animation-delay: 240ms;
}

.kpi-row .kpi:nth-child(5) {
  animation-delay: 320ms;
}

@keyframes kpiReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-row .kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 16px;
  background: linear-gradient(135deg, #00a4d2, #6366f1, #d946ef, #00a4d2);
  background-size: 220% auto;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 280ms;
  pointer-events: none;
  animation: 6s linear infinite kpiBorderShift;
}

.kpi-row .kpi:hover::before {
  opacity: 0.85;
}

@keyframes kpiBorderShift {
  0% {
    background-position: 0 50%;
  }

  100% {
    background-position: 220% 50%;
  }
}

.kpi-row .kpi:hover {
  transform: translateY(-3px);
  box-shadow:
    0 14px 38px rgba(99, 102, 241, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.04);
  border-color: transparent;
}

[data-theme="dark"] .kpi-row .kpi:hover {
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(99, 102, 241, 0.18);
}

.kpi-row .kpi .kpi-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.1),
    rgba(139, 92, 246, 0.1)
  );
  color: var(--accent-cyan, #00a4d2);
  transition: transform 280ms;
}

.kpi-row .kpi:hover .kpi-icon-box {
  transform: scale(1.06) rotate(-3deg);
}

.chart-card,
.charts-row .chart-card,
.table-widget {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 280ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both chartReveal;
  overflow: hidden;
}

@keyframes chartReveal {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chart-card:hover,
.charts-row .chart-card:hover,
.table-widget:hover {
  transform: translateY(-2px);
  box-shadow:
    0 18px 40px rgba(99, 102, 241, 0.1),
    0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .chart-card:hover,
[data-theme="dark"] .charts-row .chart-card:hover,
[data-theme="dark"] .table-widget:hover {
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.chart-card .head,
.table-widget .head {
  position: relative;
}

.chart-card .head::after,
.table-widget .head::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
  animation: 2.4s ease-in-out infinite dotPulse;
}

.def-table tbody tr,
.invoice-table tbody tr,
.ledger-table tbody tr,
.parties-table tbody tr,
.stock-table tbody tr {
  position: relative;
  transition:
    background 0.2s,
    transform 0.2s;
}

.def-table tbody tr::before,
.invoice-table tbody tr::before,
.ledger-table tbody tr::before,
.parties-table tbody tr::before,
.stock-table tbody tr::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00a4d2, #6366f1, #d946ef);
  opacity: 0;
  transition: opacity 220ms;
}

.def-table tbody tr:hover::before,
.invoice-table tbody tr:hover::before,
.ledger-table tbody tr:hover::before,
.parties-table tbody tr:hover::before,
.stock-table tbody tr:hover::before {
  opacity: 1;
}

.def-table tbody tr:hover,
.invoice-table tbody tr:hover,
.ledger-table tbody tr:hover,
.parties-table tbody tr:hover,
.stock-table tbody tr:hover {
  background: linear-gradient(
    90deg,
    rgba(0, 164, 210, 0.05),
    rgba(139, 92, 246, 0.03),
    transparent
  );
}

[data-theme="dark"] .def-table tbody tr:hover,
[data-theme="dark"] .invoice-table tbody tr:hover,
[data-theme="dark"] .ledger-table tbody tr:hover,
[data-theme="dark"] .parties-table tbody tr:hover,
[data-theme="dark"] .stock-table tbody tr:hover {
  background: linear-gradient(
    90deg,
    rgba(0, 164, 210, 0.1),
    rgba(139, 92, 246, 0.06),
    transparent
  );
}

.def-table td.num,
.invoice-table td.num,
.kpi .kpi-value,
.ledger-table td.num,
.parties-table td.num,
.stock-table td.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.filter-bar {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.6),
    rgba(255, 255, 255, 0.3)
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

[data-theme="dark"] .filter-bar {
  background: linear-gradient(
    135deg,
    rgba(28, 28, 30, 0.6),
    rgba(28, 28, 30, 0.3)
  );
  border-color: rgba(255, 255, 255, 0.05);
}

#refreshBtn.spinning svg {
  animation: 0.8s linear infinite refreshSpin;
}

@keyframes refreshSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .page-header-hero {
    padding: 22px 20px 18px;
    border-radius: 16px;
    margin: 0 0 20px;
  }

  .page-header-content {
    gap: 14px;
  }

  .page-icon-glow {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .page-icon-glow svg {
    width: 24px;
    height: 24px;
  }

  .page-title-gradient {
    font-size: 26px;
  }

  .page-desc {
    font-size: 13.5px;
    margin: 4px 0 10px;
  }

  .aurora-1 {
    width: 240px;
    height: 240px;
    top: -100px;
    left: -60px;
  }

  .aurora-2 {
    width: 200px;
    height: 200px;
    top: -40px;
    right: -70px;
  }
}

@media (max-width: 760px) {
  .page-header-hero {
    padding: 20px 18px 14px;
    border-radius: 14px;
    transform: none !important;
  }

  .page-header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-icon-glow {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    animation-duration: 5s;
  }

  .page-icon-glow svg {
    width: 22px;
    height: 22px;
  }

  .page-title-row {
    gap: 8px;
  }

  .page-title-gradient {
    font-size: 22px;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  .page-title-gradient::after {
    display: none;
  }

  .live-pill {
    padding: 3px 8px;
    font-size: 10px;
  }

  .page-desc {
    font-size: 13px;
    margin: 4px 0 8px;
    max-width: 100%;
  }

  .page-chips {
    gap: 6px;
  }

  .page-chip {
    padding: 4px 9px;
    font-size: 11px;
  }

  .page-chip svg {
    display: none;
  }

  .page-underline {
    margin-top: 10px;
  }

  .page-header-content > button {
    width: 100%;
    align-self: stretch !important;
  }

  .kpi-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .kpi-row .kpi {
    padding: 16px;
  }

  .kpi-row .kpi:hover {
    transform: none;
  }

  .charts-row {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .chart-card:hover,
  .table-widget:hover {
    transform: none;
  }

  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }

  .topbar {
    padding: 0 14px;
    gap: 10px;
  }

  .topbar .greeting .when {
    font-size: 11px;
  }

  .page::before {
    background:
      radial-gradient(circle at 0 0, rgba(0, 164, 210, 0.05), transparent 50%),
      radial-gradient(
        circle at 100% 0,
        rgba(139, 92, 246, 0.04),
        transparent 50%
      );
  }
}

@media (max-width: 380px) {
  .page-title-gradient {
    font-size: 20px;
  }

  .page-icon-glow {
    width: 40px;
    height: 40px;
  }

  .page-icon-glow svg {
    width: 20px;
    height: 20px;
  }

  .page-header-hero {
    padding: 16px 14px 12px;
  }
}

.skel-kpi {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel-kpi .skel-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.skel-kpi .skel-label {
  width: 50%;
  height: 11px;
}

.skel-kpi .skel-value {
  width: 70%;
  height: 28px;
  margin-top: 4px;
}

.skel-kpi .skel-delta {
  width: 35%;
  height: 14px;
}

.skel-chart {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skel-chart .skel-head {
  width: 40%;
  height: 14px;
}

.skel-chart .skel-sub {
  width: 25%;
  height: 10px;
}

.skel-chart .skel-body {
  flex: 1;
  min-height: 200px;
  border-radius: 12px;
}

.skel-table {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skel-table .skel-row {
  display: flex;
  gap: 10px;
}

.skel-table .skel-cell {
  height: 14px;
  flex: 1;
}

.skel-table .skel-cell.narrow {
  flex: 0 0 80px;
}

.chat-hero {
  padding: 32px 0 18px;
  text-align: center;
  animation: heroFadeIn 0.6s var(--ease-apple) both;
}

@keyframes heroFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-hero h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  background: linear-gradient(
    120deg,
    var(--accent-cyan),
    var(--accent-violet) 60%,
    var(--accent-fuchsia)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chat-hero p {
  font-size: 14.5px;
  color: var(--color-text-secondary);
  margin: 0;
}

.chat-hero .underline {
  display: block;
  width: 56px;
  height: 3px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
  border-radius: 99px;
  opacity: 0.8;
  animation: underlineGrow 0.8s var(--ease-pop) both;
}

@keyframes underlineGrow {
  0% {
    width: 0;
    opacity: 0;
  }

  100% {
    width: 56px;
    opacity: 0.8;
  }
}

.chips-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 16px 24px 20px;
}

.chip {
  --chip-fg: var(--color-text-primary);
  --chip-bg: var(--surface-card);
  --chip-border: var(--hairline-strong);
  --chip-glow: var(--accent-cyan-glow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-fg);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    transform 220ms var(--ease-pop),
    border-color 220ms ease,
    box-shadow 220ms ease,
    background 220ms ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  opacity: 0;
  transform: translateY(8px);
  animation: chipRise 480ms var(--ease-pop) forwards;
}

.chip svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

.chip:hover {
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow:
    0 8px 22px var(--chip-glow),
    0 0 0 1.5px var(--accent-cyan);
}

.chip:active {
  transform: translateY(0) scale(0.97);
}

.chip::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(
    120deg,
    var(--accent-cyan),
    var(--accent-violet),
    var(--accent-fuchsia)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 220ms;
  pointer-events: none;
}

.chip:hover::before {
  opacity: 1;
}

.chip[data-kind="sales"] {
  --chip-glow: var(--accent-emerald-glow);
}

.chip[data-kind="sales"] svg {
  color: var(--accent-emerald);
}

.chip[data-kind="purchases"] {
  --chip-glow: var(--accent-amber-glow);
}

.chip[data-kind="purchases"] svg {
  color: var(--accent-amber);
}

.chip[data-kind="outstanding"] {
  --chip-glow: var(--accent-rose-glow);
}

.chip[data-kind="outstanding"] svg {
  color: var(--accent-rose);
}

.chip[data-kind="stock"] {
  --chip-glow: var(--accent-indigo-glow);
}

.chip[data-kind="stock"] svg {
  color: var(--accent-indigo);
}

.chip[data-kind="ledger"] {
  --chip-glow: var(--accent-violet-glow);
}

.chip[data-kind="ledger"] svg {
  color: var(--accent-violet);
}

.chip[data-kind="expenses"] {
  --chip-glow: var(--accent-fuchsia-glow);
}

.chip[data-kind="expenses"] svg {
  color: var(--accent-fuchsia);
}

.chip[data-kind="generic"] svg,
.chip[data-kind="payments"] svg {
  color: var(--accent-cyan);
}

.chip[data-kind="leads"] svg {
  color: var(--accent-violet);
}

.chip[data-kind="tasks"] svg {
  color: var(--accent-indigo);
}

.chip[data-i="0"] {
  animation-delay: 60ms;
}

.chip[data-i="1"] {
  animation-delay: 120ms;
}

.chip[data-i="2"] {
  animation-delay: 180ms;
}

.chip[data-i="3"] {
  animation-delay: 240ms;
}

.chip[data-i="4"] {
  animation-delay: 0.3s;
}

.chip[data-i="5"] {
  animation-delay: 360ms;
}

.chip[data-i="6"] {
  animation-delay: 420ms;
}

.chip[data-i="7"] {
  animation-delay: 480ms;
}

@keyframes chipRise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 2.5vw 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  /* Left full-width + padded (same pattern as .composer-wrap below) — actual
     centering/width-capping happens on .bubble-row (and .composer inside
     .composer-wrap), both at max-width:1280px, so they resolve to identical
     edges. Capping THIS container too (as before) used a different reference
     box than .composer-wrap's pad-then-cap-inner pattern and drifted out of
     sync at non-trivial viewport widths. */
  /* Slightly refined type for the conversation itself — tasteful stylistic-set +
     single-story alternates Inter ships with, distinct from the plain body copy
     used on data-heavy pages (tables/reports) elsewhere in the app. */
  font-feature-settings:
    "cv11" 1,
    "ss01" 1;
}

.chat-stream::-webkit-scrollbar {
  width: 8px;
}

.chat-stream::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 4px;
}

.chat-stream::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

.bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  /* Single source of truth for the chat column width — matches .composer
     exactly (both 1280px, both margin:0 auto) so every message row and the
     input bar share the same left/right edges. (.chat-stream itself is left
     full-width + padded, same as .composer-wrap — this is where centering
     actually happens, not on the scroll container.) */
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  animation: bubbleRise 460ms var(--ease-pop) both;
}

@keyframes bubbleRise {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bubble-row.user {
  flex-direction: row-reverse;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.avatar.bot {
  background: linear-gradient(135deg, #1c1c1e, #3a3a3c);
  color: #fff;
}

.avatar.user {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
}

.bubble {
  position: relative;
  font-size: 14.5px;
  letter-spacing: -0.006em;
  line-height: 1.6;
  max-width: 86%;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 240ms var(--ease-apple);
}

.bubble:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.bubble.user {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
}

.bubble.bot {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  color: var(--color-text-primary);
}

[data-theme="dark"] .bubble.bot {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.bubble.bot::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(
    180deg,
    var(--accent-violet),
    var(--accent-indigo)
  );
  opacity: 0.55;
}

.bubble.html {
  padding: 12px 14px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
}

.bubble.html table {
  font-size: 12.5px !important;
  font-family: inherit !important;
}

.bubble.html th {
  border: 1px solid var(--hairline-strong) !important;
  background: var(--accent-cyan-soft) !important;
  color: var(--color-text-primary) !important;
  text-align: left !important;
}

.bubble.html td {
  border: 1px solid var(--hairline) !important;
}

.bubble.html tbody tr:nth-child(2n) td {
  background: var(--surface-canvas) !important;
}

.bubble.html tbody tr:hover td {
  background: var(--accent-cyan-soft) !important;
  background: var(--accent-cyan-soft, #eef4ff) !important;
}

.bubble.html td a {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 500;
}

.bubble.html td a:hover {
  text-decoration: underline;
}

.bubble .ts {
  font-size: 10.5px;
  color: var(--color-text-tertiary);
  margin-top: 4px;
  opacity: 0.8;
}

.bubble.user .ts {
  color: rgba(255, 255, 255, 0.75);
}

.bubble-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.bubble-row.user .bubble-col {
  align-items: flex-end;
}

.bubble b,
.bubble strong {
  font-weight: 700;
}

.bubble code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--accent-cyan-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

.bubble.typing-cursor::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent-cyan);
  animation: 0.9s steps(2) infinite caretBlink;
}

@keyframes caretBlink {
  0%,
  49% {
    opacity: 1;
  }

  100%,
  50% {
    opacity: 0;
  }
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 13px 16px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: 1.2s ease-in-out infinite typingBounce;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%,
  100%,
  60% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.att-img {
  width: 100%;
  max-width: 560px;
  max-height: 420px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  cursor: zoom-in;
  object-fit: contain;
  background: var(--surface-canvas);
  transition: transform 220ms var(--ease-apple);
}

.att-img:hover {
  transform: scale(1.005);
}

.att-caption {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.att-doc {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  text-decoration: none;
  color: var(--color-text-primary);
  background: var(--surface-card);
  font-size: 13px;
  transition:
    transform 0.2s var(--ease-pop),
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  max-width: 360px;
}

.att-doc:hover {
  transform: translateY(-1px);
  border-color: var(--accent-cyan);
  box-shadow: 0 6px 18px var(--accent-cyan-glow);
}

.att-icon {
  font-size: 18px;
}

.att-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-meta {
  color: var(--color-text-tertiary);
  font-size: 11.5px;
}

.composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 12px 2.5vw 18px;
  background: linear-gradient(180deg, transparent, var(--surface-canvas) 38%);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 10px 8px 14px;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid var(--hairline-strong);
  border-radius: 22px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition:
    box-shadow 220ms ease,
    border-color 220ms ease,
    transform 220ms var(--ease-pop);
}

.composer:focus-within {
  border-color: transparent;
  box-shadow:
    0 12px 44px var(--accent-cyan-glow),
    0 0 0 2px var(--accent-cyan);
}

.composer-input {
  flex: 1;
  border: none;
  background: 0 0;
  outline: 0;
  resize: none;
  font: inherit;
  font-size: 15px;
  letter-spacing: -0.006em;
  color: var(--color-text-primary);
  padding: 8px 4px;
  min-height: 24px;
  max-height: 180px;
  line-height: 1.5;
}

.composer-input::placeholder {
  color: var(--color-text-tertiary);
}

.composer-btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: 0 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    transform 0.2s var(--ease-pop),
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.composer-btn:hover {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  transform: scale(1.06);
}

.composer-btn svg {
  width: 18px;
  height: 18px;
}

.composer-btn.send {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-cyan-glow);
}

.composer-btn.send:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow:
    0 10px 26px var(--accent-cyan-glow),
    0 0 0 4px rgba(0, 164, 210, 0.18);
}

.composer-btn.send:active {
  transform: scale(0.96);
}

.composer-btn.send:disabled,
.composer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mic-btn {
  position: relative;
}

.mic-btn.recording {
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--accent-rose),
    var(--accent-fuchsia)
  );
  box-shadow: 0 0 0 0 var(--accent-rose-glow);
  animation: 1.4s ease-out infinite micPulse;
}

@keyframes micPulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-rose-glow);
  }

  100% {
    box-shadow: 0 0 0 14px rgba(244, 63, 94, 0);
  }
}

.waveform-wrap {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: min(560px, 84vw);
  padding: 10px 14px;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: blur(28px) saturate(150%);
  border: 1px solid var(--hairline-strong);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
  display: none;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition:
    opacity 220ms ease,
    transform 320ms var(--ease-pop);
  z-index: 5;
}

.waveform-wrap.show {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.waveform-wrap canvas {
  flex: 1;
  height: 36px;
  display: block;
}

.waveform-wrap .rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-rose);
  animation: 0.8s ease-in-out infinite dotBlink;
}

@keyframes dotBlink {
  50% {
    opacity: 0.3;
  }
}

.waveform-wrap .rec-time {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-text-secondary);
  min-width: 38px;
}

.waveform-wrap .rec-stop {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--accent-rose);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.slideover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-apple);
  z-index: 50;
}

.slideover-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.slideover {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: var(--surface-card);
  border-left: 1px solid var(--hairline-strong);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.1);
  transform: translateX(110%);
  transition: transform 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 51;
  display: flex;
  flex-direction: column;
}

.slideover.show {
  transform: translateX(0);
}

.slideover-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slideover-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.slideover-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: 0 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s var(--ease-pop);
}

.slideover-close:hover {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  transform: rotate(90deg);
}

.slideover-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.so-section h4 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin: 0 0 10px;
}

.so-card {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface-card);
}

.so-input-row {
  display: flex;
  gap: 8px;
}

.so-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--hairline-strong);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  outline: 0;
  background: var(--surface-canvas);
  color: var(--color-text-primary);
  transition:
    border-color 180ms,
    box-shadow 180ms;
}

.so-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-cyan-soft);
}

.so-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 180ms var(--ease-pop),
    box-shadow 180ms;
}

.so-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px var(--accent-cyan-glow);
}

.so-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.so-btn.ghost {
  background: 0 0;
  color: var(--color-text-primary);
  border: 1px solid var(--hairline-strong);
}

.so-btn.ghost:hover {
  background: var(--accent-cyan-soft);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: none;
}

.so-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-cyan-soft);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  display: none;
}

.so-result.show {
  display: block;
}

.drop-zone {
  display: block;
  border: 1.5px dashed var(--hairline-strong);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  background: var(--surface-canvas);
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s,
    color 0.2s;
}

.drop-zone svg {
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  opacity: 0.65;
}

.drop-zone.dragover,
.drop-zone:hover {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
}

.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sync-status {
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

.sync-status .ok-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  margin-right: 6px;
  vertical-align: middle;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  opacity: 0;
  transition: opacity 240ms;
  cursor: zoom-out;
}

.lightbox.show {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.92);
  transition: transform 380ms var(--ease-pop);
}

.lightbox.show img {
  transform: scale(1);
}

.lightbox .close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 20px;
  transition:
    transform 0.2s var(--ease-pop),
    background 0.2s;
}

.lightbox .close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(90deg) scale(1.05);
}

@media (max-width: 760px) {
  .chat-hero h1 {
    font-size: 24px;
  }

  .chip {
    font-size: 12.5px;
    padding: 9px 14px;
  }

  .bubble {
    max-width: 88%;
    font-size: 13.5px;
  }

  .composer-wrap {
    padding: 10px 14px 14px;
  }

  .composer {
    padding: 6px 8px 6px 12px;
    gap: 6px;
  }

  .composer-btn {
    width: 34px;
    height: 34px;
  }

  .composer-btn.send {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .att-img,
  .bubble-row,
  .chat-hero,
  .chat-hero .underline,
  .chip,
  .lightbox img,
  .mic-btn.recording,
  .typing-dots span,
  .waveform-wrap .rec-dot {
    animation: none !important;
    transition: none !important;
  }
}

.bubble {
  border-radius: 22px;
  padding: 13px 18px;
}

.bubble.user {
  border-bottom-right-radius: 8px;
}

.bubble.bot {
  border-bottom-left-radius: 8px;
  background: linear-gradient(
    180deg,
    var(--surface-card) 0,
    var(--surface-canvas) 100%
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.03),
    0 0 0 1px var(--hairline) inset;
  border: none;
  line-height: 1.6;
  /* Clip the ::before left accent bar to the bubble's own rounded corners —
     without this it's a straight bar pinned to left:0 while the corner curves
     inward at that same y-offset, so it visibly pokes out past the radius. */
  overflow: hidden;
}

[data-theme="dark"] .bubble.bot {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.bubble.bot:hover {
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.06),
    0 0 0 1px var(--hairline-strong) inset;
  transform: translateY(-1px);
}

.bubble.user {
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
}

.bubble.user:hover {
  box-shadow: 0 8px 22px var(--accent-cyan-glow);
  transform: translateY(-1px);
}

.chat-stream {
  gap: 18px;
}

.bubble .money {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  background: var(--accent-cyan-soft);
  color: var(--color-text-primary);
  padding: 1px 7px;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: -0.005em;
  vertical-align: 1px;
}

.bubble.user .money {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.bubble .money.big {
  font-size: 14.5px;
  background: linear-gradient(
    135deg,
    var(--accent-emerald-soft),
    var(--accent-cyan-soft)
  );
  color: var(--accent-emerald);
  font-weight: 700;
  padding: 2px 10px;
}

[data-theme="dark"] .bubble .money.big {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.18),
    rgba(0, 164, 210, 0.18)
  );
  color: #34d399;
}

.bubble.bot.result-card {
  padding: 14px 18px 16px;
  background: linear-gradient(
    180deg,
    var(--surface-card) 0,
    color-mix(in srgb, var(--accent-violet-soft) 25%, var(--surface-card)) 100%
  );
  box-shadow:
    0 4px 18px rgba(139, 92, 246, 0.05),
    0 0 0 1px var(--hairline) inset,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .bubble.bot.result-card {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04) 0,
    rgba(139, 92, 246, 0.06) 100%
  );
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.bubble.bot.result-card::before {
  background: linear-gradient(
    180deg,
    var(--accent-violet),
    var(--accent-fuchsia),
    var(--accent-cyan)
  );
  opacity: 0.85;
  width: 3px;
  left: 0;
  top: 10px;
  bottom: 10px;
}

.composer-input.ph-fade::placeholder {
  animation: phFadeIn 320ms var(--ease-apple) both;
}

@keyframes phFadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-fab {
  /* Anchored to #chatPage (position:relative), NOT the viewport — so it always
     sits just inside that container's own right/bottom padding regardless of
     composer width or whether the sidebar is collapsed, instead of a hardcoded
     viewport-width formula that only matched one specific layout. */
  position: absolute;
  right: max(16px, 2.5vw);
  bottom: 96px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  color: var(--color-text-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.9);
  transition:
    opacity 240ms var(--ease-apple),
    transform 320ms var(--ease-pop);
  z-index: 30;
  animation: 3.6s ease-in-out infinite fabBob;
}

.scroll-fab svg {
  width: 18px;
  height: 18px;
}

.scroll-fab:hover {
  background: var(--accent-cyan);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 26px var(--accent-cyan-glow);
}

.scroll-fab.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

@keyframes fabBob {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-3px) scale(1);
  }
}

.scroll-fab .badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 5px;
  box-shadow: 0 0 0 2px var(--surface-canvas);
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 880px;
  width: 100%;
  margin: 14px auto 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

.date-divider::after,
.date-divider::before {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--hairline-strong),
    transparent
  );
}

.nav-item.active {
  color: var(--color-primary-600);
  background: var(--color-primary-50);
}

[data-theme="dark"] .nav-item.active {
  color: var(--accent-cyan);
  background: rgba(0, 164, 210, 0.1);
}

.greeting .who {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.greeting .when {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.greeting .who .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald, #10b981);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: 2.4s ease-in-out infinite dotPulse;
}

.tenant-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

@media (max-width: 760px) {
  .mobile-toggle {
    display: block;
  }
}

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
}

.charts-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-icon {
  background: var(--color-primary-50);
  color: var(--color-primary-400);
  display: grid;
  place-items: center;
}

.filter-bar input {
  flex: 1;
  border: 1px solid var(--hairline);
  background: var(--surface-page);
  color: var(--color-text-primary);
}

.filter-bar .btn {
  background: var(--color-primary-500);
}

.filter-bar .meta {
  color: var(--color-text-tertiary);
  font-size: 13px;
  padding: 0 6px;
}

.invoice-table {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
}

.invoice-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.invoice-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.invoice-table td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--color-text-primary);
}

.invoice-table tr:hover td {
  background: var(--color-primary-50);
}

[data-theme="dark"] .invoice-table tr:hover td {
  background: rgba(0, 164, 210, 0.06);
}

.invoice-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.pager {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding-top: 14px;
}

.pager button {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 13px;
}

.pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager button:hover:not(:disabled) {
  background: var(--color-primary-50);
}

[data-theme="dark"] .pager button:hover:not(:disabled) {
  background: rgba(0, 164, 210, 0.08);
}

.pager .info {
  color: var(--color-text-tertiary);
  font-size: 13px;
  margin-right: auto;
}

@media (max-width: 1100px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row,
  .charts-row-2 {
    grid-template-columns: 1fr;
  }
}

.chart-icon {
  color: var(--accent-rose, #f43f5e);
  display: grid;
  place-items: center;
}

.defaulters {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
}

.defaulters table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.defaulters th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.defaulters td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--color-text-primary);
}

.defaulters tr:hover td {
  background: rgba(244, 63, 94, 0.04);
}

[data-theme="dark"] .defaulters tr:hover td {
  background: rgba(244, 63, 94, 0.08);
}

.defaulters td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.age-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.age-pill.bg-30 {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.age-pill.bg-60 {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.age-pill.bg-90 {
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
}

.age-pill.bg-99 {
  background: rgba(217, 70, 239, 0.16);
  color: #d946ef;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 1100px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
}

.chart-card .body {
  height: 320px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.chart-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  display: grid;
  place-items: center;
}

[data-theme="dark"] .chart-icon {
  background: rgba(99, 102, 241, 0.2);
}

.stock-table {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
}

.stock-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stock-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.stock-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--color-text-primary);
}

.stock-table tr:hover td {
  background: rgba(99, 102, 241, 0.04);
}

[data-theme="dark"] .stock-table tr:hover td {
  background: rgba(99, 102, 241, 0.08);
}

.stock-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge.low {
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
}

.badge.slow {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.badge.healthy {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.empty-state {
  color: var(--color-text-tertiary);
  grid-column: 1/-1;
}

.page-grid {
  display: grid;
  gap: 18px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
}

.filter-bar input {
  flex: 1;
  min-width: 240px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--surface-page);
  color: var(--color-text-primary);
  font-size: 14px;
}

.filter-bar input:focus {
  outline: 2px solid var(--color-primary-300);
  border-color: transparent;
}

.filter-bar .btn {
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--color-primary-500);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
}

.filter-bar .btn:hover {
  background: var(--color-primary-600);
}

.balance-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  align-items: center;
}

.balance-card.empty {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-tertiary);
}

.balance-stat {
  padding: 4px 0;
}

.balance-stat .lbl {
  font-size: 11px;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.balance-stat .val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.balance-stat.party .val {
  font-family: inherit;
  font-size: 17px;
  line-height: 1.3;
}

.balance-stat.net .val.positive {
  color: #10b981;
}

.balance-stat.net .val.negative {
  color: #f43f5e;
}

.timeline {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
}

.timeline table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.timeline th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
}

.timeline td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--color-text-primary);
}

.timeline tr:hover td {
  background: var(--color-primary-50);
}

[data-theme="dark"] .timeline tr:hover td {
  background: rgba(0, 164, 210, 0.06);
}

.timeline td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
}

.kind-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.kind-pill.sale {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.kind-pill.purchase {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.summary-table .timeline {
  padding: 18px 20px;
}

@media (max-width: 1100px) {
  .balance-card {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 24px;
}

.admin-tab {
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  transition: 0.2s;
}

.admin-tab.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.admin-tab:hover {
  color: var(--accent-cyan);
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-tertiary);
  border-bottom: 1px solid var(--hairline);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
}

.data-table tr:hover td {
  background: var(--accent-cyan-soft);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-red {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.btn-primary {
  background: var(--accent-cyan);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  cursor: pointer;
}

.btn-sm:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.btn-danger-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: 0 0;
  color: #ef4444;
  cursor: pointer;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  place-items: center;
}

.modal-overlay.show {
  display: grid;
}

.modal {
  background: var(--surface-card);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 440px;
}

.modal h3 {
  margin-bottom: 18px;
  font-size: 18px;
}

.modal .form-group {
  margin-bottom: 14px;
}

.modal .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--color-text-secondary);
}

.modal .form-group input,
.modal .form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface-bg);
  color: var(--color-text-primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.perm-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.perm-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-cyan);
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.empty-state {
  color: var(--color-text-tertiary);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f6fa;
  min-height: 100vh;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
}

.header {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.header h1 {
  font-size: 22px;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.header p {
  color: #666;
  font-size: 13px;
}

.sheet-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.sheet-url {
  font-size: 11px;
  color: #888;
  word-break: break-all;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: center;
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  border-bottom: 2px solid #eee;
}

th:first-child {
  text-align: left;
}

td {
  padding: 10px 6px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
  vertical-align: middle;
}

td:first-child {
  text-align: left;
  font-weight: 500;
}

tr:hover {
  background: #f8f9ff;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #667eea;
}

select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
}

.btn-save {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
}

.btn-save:hover {
  opacity: 0.9;
}

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toast.ok {
  opacity: 1;
}

.toast.err {
  opacity: 1;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #667eea;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

[data-theme="dark"] body {
  background: #000;
}

[data-theme="dark"] .header,
[data-theme="dark"] .sheet-card {
  background: #1c1c1e;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .header h1,
[data-theme="dark"] .sheet-title {
  color: #f5f5f7;
}

[data-theme="dark"] .header p {
  color: #a1a1a6;
}

[data-theme="dark"] th {
  color: #a1a1a6;
  border-bottom-color: #333;
}

[data-theme="dark"] td {
  border-bottom-color: #2a2a2a;
  color: #f5f5f7;
}

[data-theme="dark"] td:first-child span {
  color: #6e6e73 !important;
}

[data-theme="dark"] tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] select {
  background: #2a2a2a;
  color: #f5f5f7;
  border-color: #444;
}

[data-theme="dark"] .loading {
  color: #a1a1a6;
}

[data-theme="dark"] .back-link {
  color: #818cf8;
}

.row-configured {
  background: #f0fdf4;
}

[data-theme="dark"] .row-configured {
  background: rgba(74, 222, 128, 0.08);
}

.badge-configured {
  font-size: 10px;
  color: #16a34a;
  font-weight: 600;
}

[data-theme="dark"] .badge-configured {
  color: #4ade80;
}

[data-theme="dark"] td:first-child strong {
  color: #f5f5f7;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  margin-bottom: 16px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-nav .month-label {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 180px;
}

.cal-nav button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: 0 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--color-text-secondary);
  transition: 180ms;
}

.cal-nav button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.cal-nav button svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  font: inherit;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary svg {
  width: 14px;
  height: 14px;
}

.btn-secondary {
  font: inherit;
  border: 1px solid var(--hairline);
  color: var(--color-text-secondary);
}

.btn-danger {
  font: inherit;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}

.cal-day-head {
  background: var(--surface-card);
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  text-align: center;
}

.cal-cell {
  background: var(--surface-card);
  min-height: 110px;
  padding: 8px;
  position: relative;
  cursor: pointer;
  transition: background 180ms;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-cell:hover {
  background: var(--accent-cyan-soft);
}

.cal-cell.other-month {
  opacity: 0.4;
}

.cal-cell.today {
  background: var(--accent-cyan-soft);
}

.cal-cell .date {
  font-size: 13px;
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.cal-cell.today .date {
  background: var(--accent-cyan);
  color: #fff;
}

.cal-cell .events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.cal-event {
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: 5px;
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.18),
    rgba(139, 92, 246, 0.14)
  );
  border-left: 3px solid var(--accent-cyan);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 140ms;
}

.cal-event:hover {
  transform: translateX(2px);
}

.cal-event .t-time {
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  margin-right: 4px;
}

.cal-event-more {
  font-size: 11px;
  color: var(--color-text-tertiary);
  padding: 2px 6px;
  cursor: pointer;
}

.modal-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-row {
  margin-bottom: 12px;
}

.modal-row label {
  display: block;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.modal-row input,
.modal-row textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-input, transparent);
  color: var(--color-text-primary);
}

.modal-row input:focus,
.modal-row textarea:focus {
  outline: 0;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 164, 210, 0.12);
}

.modal-row textarea {
  resize: vertical;
  min-height: 60px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-tertiary);
}

.empty-state .ic {
  font-size: 36px;
  margin-bottom: 14px;
  opacity: 0.6;
}

.conflict-list {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
}

.conflict-list ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.event-detail-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.event-detail-row:last-child {
  border-bottom: none;
}

.event-detail-row .lab {
  color: var(--color-text-tertiary);
  font-size: 12px;
}

.tenant-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.28);
}

[data-theme="dark"] .tenant-avatar {
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.18);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: 320ms cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.report-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.report-card .head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.report-card .ic {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    var(--accent-cyan-soft),
    rgba(139, 92, 246, 0.1)
  );
  color: var(--accent-cyan);
}

.report-card .ic svg {
  width: 20px;
  height: 20px;
}

.report-card .t {
  font-size: 15px;
  font-weight: 600;
}

.report-card .desc {
  font-size: 12.5px;
  color: var(--color-text-tertiary);
  margin-bottom: 14px;
  line-height: 1.5;
}

.report-card .formats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.format-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--hairline);
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  margin-bottom: 20px;
}

.filter-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--color-text-secondary);
}

.filter-bar input[type="date"],
.filter-bar select {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--surface-input, transparent);
  color: var(--color-text-primary);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  place-items: center;
  z-index: 9000;
}

.modal-backdrop.open {
  display: grid;
}

.modal-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 24px;
  width: 92%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 14px;
}

.modal-options {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}

.format-btn {
  flex: 1;
  padding: 14px;
  border: 1.5px solid var(--hairline);
  background: 0 0;
  border-radius: 11px;
  cursor: pointer;
  text-align: center;
  transition: 220ms;
  font: inherit;
}

.format-btn:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.format-btn.selected {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}

.format-btn .icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.format-btn .label {
  font-size: 13px;
  font-weight: 600;
}

.format-btn .sub {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  font: inherit;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
}

.btn-secondary {
  font: inherit;
  border: 1px solid var(--hairline);
  color: var(--color-text-secondary);
}

.print-only {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-only,
  .print-only * {
    visibility: visible;
  }

  .print-only {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    font-family: Inter, system-ui, sans-serif;
    color: #000;
    background: #fff;
  }

  .print-only h1 {
    font-size: 20px;
    margin: 0 0 4px;
  }

  .print-only h2 {
    font-size: 14px;
    margin: 14px 0 8px;
    color: #333;
  }

  .print-only .meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 14px;
  }

  .print-only table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
  }

  .print-only td,
  .print-only th {
    padding: 6px 8px;
    border-bottom: 1px solid #ddd;
    text-align: left;
  }

  .print-only th {
    background: #f5f5f5;
    font-weight: 600;
  }

  .print-only .num {
    text-align: right;
    font-family: "JetBrains Mono", monospace;
  }

  .print-only .summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  .print-only .stat {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
  }

  .print-only .stat .lbl {
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
  }

  .print-only .stat .val {
    font-size: 16px;
    font-weight: 700;
    margin-top: 2px;
    font-family: "JetBrains Mono", monospace;
  }
}

.tenant-avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.28);
}

[data-theme="dark"] .tenant-avatar {
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.18);
}

@media (max-width: 760px) {
  .mobile-toggle {
    display: inline-grid;
  }
}

.settings-grid {
  display: grid;
  gap: 16px;
  max-width: 880px;
}

.settings-card {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.settings-card:hover {
  box-shadow: var(--shadow-card-hover);
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}

.settings-card-header .ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
}

.settings-card-header .ic svg {
  width: 18px;
  height: 18px;
}

.settings-card-header .titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-card-header .t {
  font-size: 15px;
  font-weight: 600;
}

.settings-card-header .sub {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.form-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="text"] {
  font: inherit;
  font-size: 13.5px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  background: var(--surface-input, transparent);
  color: var(--color-text-primary);
  transition:
    border-color 180ms,
    box-shadow 180ms;
}

.form-row input:focus {
  outline: 0;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 164, 210, 0.12);
}

.form-row input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-primary {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border: none;
  cursor: pointer;
  border-radius: 9px;
  background: linear-gradient(
    135deg,
    var(--accent-cyan) 0,
    var(--accent-violet) 100%
  );
  color: #fff;
  transition:
    transform 180ms,
    box-shadow 180ms,
    opacity 180ms;
  box-shadow: 0 2px 6px rgba(0, 164, 210, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 164, 210, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: wait;
}

.btn-danger {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  cursor: pointer;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  transition: 180ms;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.btn-secondary {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border: 1px solid var(--hairline);
  cursor: pointer;
  border-radius: 9px;
  background: 0 0;
  color: var(--color-text-secondary);
}

.btn-secondary:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.status-line {
  font-size: 12.5px;
  color: var(--color-text-tertiary);
}

.status-line .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.status-line .badge.ok {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.status-line .badge.off {
  background: rgba(148, 163, 184, 0.18);
  color: #64748b;
}

.status-line .badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.db-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.db-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: border-color 180ms;
}

.db-row.active {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}

.db-row .name {
  font-size: 13.5px;
  font-weight: 500;
}

.db-row .meta {
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.toast {
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transform: translateY(8px);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
}

.toast.err {
  background: rgba(239, 68, 68, 0.95);
}

.toast.ok {
  background: rgba(34, 197, 94, 0.95);
}

.empty-msg {
  padding: 16px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
}

.tenant-avatar {
  background: linear-gradient(135deg, #475569, #6366f1, #00a4d2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28);
}

[data-theme="dark"] .tenant-avatar {
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.18);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  animation: 2.4s ease-in-out infinite dotPulse;
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

.table-widget {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px 0 0;
  box-shadow: var(--shadow-card);
  transition:
    box-shadow 320ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.table-widget:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.table-widget .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px 14px;
  border-bottom: 1px solid var(--hairline);
}

.table-widget .row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
  transition: background 180ms;
}

.table-widget .row:hover {
  background: var(--accent-cyan-soft);
}

.table-widget .row:last-child {
  border-bottom: none;
}

.table-widget .row .rank {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.table-widget .row[data-rank="1"] .rank {
  background: linear-gradient(135deg, #f59e0b, #f97316);
}

.table-widget .row[data-rank="2"] .rank {
  background: linear-gradient(135deg, #94a3b8, #64748b);
}

.table-widget .row[data-rank="3"] .rank {
  background: linear-gradient(135deg, #b45309, #92400e);
}

.table-widget .row[data-rank="4"] .rank,
.table-widget .row[data-rank="5"] .rank,
.table-widget .row[data-rank="6"] .rank,
.table-widget .row[data-rank="7"] .rank,
.table-widget .row[data-rank="8"] .rank {
  background: var(--color-gray-200);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .table-widget .row[data-rank="4"] .rank,
[data-theme="dark"] .table-widget .row[data-rank="5"] .rank,
[data-theme="dark"] .table-widget .row[data-rank="6"] .rank,
[data-theme="dark"] .table-widget .row[data-rank="7"] .rank,
[data-theme="dark"] .table-widget .row[data-rank="8"] .rank {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
}

.table-widget .row .name {
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-widget .row .meta {
  color: var(--color-text-tertiary);
  font-size: 12.5px;
  white-space: nowrap;
}

.table-widget .row .val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.chart-card {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.92) 0,
    rgba(240, 248, 255, 0.85) 100%
  );
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(0, 164, 210, 0.15);
  border-radius: 22px;
  padding: 24px 24px 20px;
  box-shadow:
    0 8px 32px rgba(0, 164, 210, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .chart-card {
  background: linear-gradient(
    145deg,
    rgba(28, 28, 30, 0.88) 0,
    rgba(20, 20, 35, 0.92) 100%
  );
  border-color: rgba(0, 164, 210, 0.2);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 1px rgba(0, 164, 210, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.chart-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 23px;
  padding: 1.5px;
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.4),
    rgba(139, 92, 246, 0.3) 50%,
    rgba(236, 72, 153, 0.3)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 480ms;
  pointer-events: none;
  z-index: 0;
}

.chart-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background:
    radial-gradient(
      ellipse 60% 50% at 90% -5%,
      rgba(0, 164, 210, 0.12) 0,
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 40% at -5% 105%,
      rgba(139, 92, 246, 0.1) 0,
      transparent 60%
    );
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .chart-card::after {
  background:
    radial-gradient(
      ellipse 60% 50% at 90% -5%,
      rgba(0, 164, 210, 0.18) 0,
      transparent 60%
    ),
    radial-gradient(
      ellipse 50% 40% at -5% 105%,
      rgba(139, 92, 246, 0.15) 0,
      transparent 60%
    );
  opacity: 1;
}

.chart-card > * {
  position: relative;
  z-index: 1;
}

.chart-card:hover {
  transform: translateY(-4px) scale(1.005);
  border-color: rgba(0, 164, 210, 0.35);
  box-shadow:
    0 20px 50px rgba(0, 164, 210, 0.15),
    0 0 0 1px rgba(0, 164, 210, 0.2) inset,
    0 0 40px rgba(0, 164, 210, 0.06);
}

[data-theme="dark"] .chart-card:hover {
  box-shadow:
    0 20px 50px rgba(0, 164, 210, 0.2),
    0 0 0 1px rgba(0, 164, 210, 0.3) inset,
    0 0 60px rgba(0, 164, 210, 0.08);
}

.chart-card:hover::before {
  opacity: 1;
}

.chart-card .chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-card .chart-header .t-h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(
    135deg,
    var(--color-text-primary) 60%,
    var(--accent-cyan)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chart-card .chart-header .t-meta {
  font-size: 11.5px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.chart-card .chart-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.15),
    rgba(139, 92, 246, 0.12)
  );
  color: var(--accent-cyan);
  box-shadow:
    0 0 0 1px rgba(0, 164, 210, 0.2),
    0 4px 14px rgba(0, 164, 210, 0.15),
    0 0 20px rgba(0, 164, 210, 0.08);
  transition: 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] .chart-card .chart-icon {
  background: linear-gradient(
    135deg,
    rgba(0, 164, 210, 0.2),
    rgba(139, 92, 246, 0.18)
  );
  box-shadow:
    0 0 0 1px rgba(0, 164, 210, 0.3),
    0 4px 14px rgba(0, 164, 210, 0.2),
    0 0 24px rgba(0, 164, 210, 0.12);
}

.chart-card:hover .chart-icon {
  transform: scale(1.12) rotate(-6deg);
  box-shadow:
    0 0 0 1px rgba(0, 164, 210, 0.3),
    0 6px 20px rgba(0, 164, 210, 0.25),
    0 0 30px rgba(0, 164, 210, 0.15);
}

.chart-card .chart-icon svg {
  width: 17px;
  height: 17px;
}

.chart-card .body {
  flex: 1;
  min-height: 260px;
  position: relative;
}

.chart-card canvas {
  max-width: 100%;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--gap-section);
}

.mobile-toggle {
  display: none;
}

@media (max-width: 760px) {
  .sidebar.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100;
  }

  .mobile-toggle {
    display: inline-flex !important;
  }
}

.empty-card {
  grid-column: 1/-1;
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-secondary);
  background: var(--surface-card);
  border: 1px dashed var(--hairline-strong);
  border-radius: 16px;
}

.empty-card .ic {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.topbar .greeting .who {
  display: flex;
  align-items: center;
}

@keyframes dotPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

.kpi-anomaly {
  box-shadow:
    var(--shadow-card),
    0 0 0 2px rgba(239, 68, 68, 0.45),
    0 0 24px rgba(239, 68, 68, 0.18);
  animation: 2.4s ease-in-out infinite anomalyPulse;
}

[data-theme="dark"] .kpi-anomaly {
  box-shadow:
    var(--shadow-card),
    0 0 0 2px rgba(239, 68, 68, 0.55),
    0 0 28px rgba(239, 68, 68, 0.28);
}

@keyframes anomalyPulse {
  0%,
  100% {
    box-shadow:
      var(--shadow-card),
      0 0 0 2px rgba(239, 68, 68, 0.45),
      0 0 24px rgba(239, 68, 68, 0.18);
  }

  50% {
    box-shadow:
      var(--shadow-card),
      0 0 0 2px rgba(239, 68, 68, 0.6),
      0 0 32px rgba(239, 68, 68, 0.3);
  }
}

.kpi-anomaly-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  cursor: help;
}

@media (prefers-reduced-motion: reduce) {
  .kpi-anomaly {
    animation: none;
  }
}

.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms;
  z-index: 8500;
}

.notif-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 92vw);
  height: 100vh;
  background: var(--surface-card);
  border-left: 1px solid var(--hairline);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 8600;
  display: flex;
  flex-direction: column;
}

.notif-drawer.open {
  transform: translateX(0);
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--hairline);
}

.notif-head .ttl {
  font-size: 16px;
  font-weight: 700;
}

.notif-head .actions {
  display: flex;
  gap: 8px;
}

.notif-head button {
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: 0 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: 180ms;
}

.notif-head button:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.notif-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background 180ms;
}

.notif-item:hover {
  background: var(--accent-cyan-soft);
}

.notif-item.unread {
  background: rgba(0, 164, 210, 0.04);
}

.notif-item.unread::before {
  content: "";
  position: absolute;
  left: 8px;
  width: 6px;
  height: 6px;
  margin-top: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
}

.notif-item .ic {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
}

.notif-item .ic.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.notif-item .ic.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.notif-item .ic svg {
  width: 16px;
  height: 16px;
}

.notif-item .body {
  min-width: 0;
}

.notif-item .body .t {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.notif-item .body .m {
  font-size: 12.5px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notif-item .body .ts {
  font-size: 11px;
  color: var(--color-text-tertiary);
}

.notif-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--color-text-tertiary);
}

.notif-empty .ic {
  font-size: 36px;
  opacity: 0.6;
  margin-bottom: 12px;
}

.bubble.html {
  overflow-x: auto;
  max-width: 100%;
}

@media (max-width: 760px) {
  .sidebar.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100;
  }
}

.nav-item {
  transition:
    background 0.2s,
    color 0.2s,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-item:hover {
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    var(--accent-cyan-soft),
    var(--accent-indigo-soft)
  );
  color: var(--accent-cyan);
}

[data-theme="dark"] .nav-item.active {
  color: var(--accent-cyan);
}

.topbar-actions {
  gap: 8px;
}

.btn-icon {
  transition:
    background 220ms,
    transform 0.2s,
    color 220ms;
}

.btn-icon:hover {
  transform: scale(1.06);
}

.tenant-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    var(--accent-cyan),
    var(--accent-violet) 65%,
    var(--accent-fuchsia)
  );
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  box-shadow:
    0 0 0 3px rgba(0, 164, 210, 0.1),
    0 4px 10px rgba(0, 164, 210, 0.18);
  position: relative;
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tenant-avatar:hover {
  transform: scale(1.06) rotate(-2deg);
}

.topbar .greeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.topbar .greeting .who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.topbar .greeting .who .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  animation: 2.4s ease-out infinite dotPulse;
}

@keyframes dotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.topbar .greeting .when {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.2;
  margin-top: 1px;
}

[data-theme="dark"] .tenant-avatar {
  box-shadow:
    0 0 0 3px rgba(0, 164, 210, 0.18),
    0 4px 10px rgba(0, 164, 210, 0.3);
}

.bubble.html table {
  border-collapse: collapse !important;
  width: 100%;
}

.bubble.html th {
  padding: 7px 10px !important;
  border: 1px solid var(--hairline-strong, #444) !important;
  background: var(--accent-cyan-soft, #1a1a2e) !important;
  color: var(--color-text-primary, #fff) !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  white-space: nowrap !important;
}

.bubble.html td {
  padding: 6px 10px !important;
  border: 1px solid var(--hairline, #ddd) !important;
  font-size: 12.5px !important;
  white-space: nowrap !important;
  color: var(--color-text-primary, #333) !important;
}

.bubble.html tbody tr:nth-child(2n) td {
  background: var(--surface-canvas, #f9f9f9) !important;
}

[data-theme="dark"] .bubble.html th {
  background: rgba(0, 164, 210, 0.15) !important;
  color: #e0e0e0 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] .bubble.html td {
  color: #d4d4d4 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .bubble.html tbody tr {
  background: 0 0 !important;
}

[data-theme="dark"] .bubble.html tbody tr:nth-child(2n) {
  background: rgba(255, 255, 255, 0.03) !important;
}

[data-theme="dark"] .bubble.html tbody tr:hover {
  background: rgba(0, 164, 210, 0.1) !important;
}

/* Restore the flat card look for HTML/table response bubbles. The later
   ".bubble.bot" polish rule (gradient background + border:none) has the same
   (2-class) specificity as ".bubble.html" but comes after it in source order,
   so it was silently winning — table replies rendered with no border and a
   diagonal gradient instead of a flat card. The extra class here (3 vs 2)
   always wins regardless of position, in both themes. */
.bubble.bot.html {
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .bubble.bot.html {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .bubble.html tbody tr:last-child {
  background: rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] .bubble.html div[style*="color:#555"] {
  color: #a1a1a6 !important;
}

.download-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: 0.15s;
}

.dl-btn.pdf {
  background: #e53935;
  color: #fff;
}

.dl-btn.pdf:hover {
  background: #c62828;
}

.dl-btn.img {
  background: #1a73e8;
  color: #fff;
}

.dl-btn.img:hover {
  background: #1558b0;
}

.dl-btn.csv {
  background: #2e7d32;
  color: #fff;
}

.dl-btn.csv:hover {
  background: #1b5e20;
}

.chart-wrap {
  margin-top: 12px;
  padding: 8px 0;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text-primary);
}

.toast {
  position: fixed !important;
  top: 24px !important;
  right: 24px !important;
  bottom: auto !important;
  width: max-content !important;
  max-width: 400px !important;
  padding: 14px 22px !important;
  background: rgba(20, 20, 22, 0.85) !important;
  backdrop-filter: blur(12px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
  color: #fff !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
  opacity: 0 !important;
  transform: translateY(-12px) scale(0.95) !important;
  pointer-events: none !important;
  transition:
    opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.toast.show {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

@media (max-width: 768px) {
  .toast {
    right: 50% !important;
    transform: translate(50%, -12px) scale(0.95) !important;
  }

  .toast.show {
    transform: translate(50%, 0) scale(1) !important;
  }
}

.toast.ok {
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.9),
    rgba(21, 128, 61, 0.9)
  ) !important;
  box-shadow:
    0 10px 30px rgba(34, 197, 94, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
}

.toast.err {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.9),
    rgba(185, 28, 28, 0.9)
  ) !important;
  box-shadow:
    0 10px 30px rgba(239, 68, 68, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
}

/* ============================================================
   SweetAlert2 — MIS themed confirm/toast overrides
   Used by window.MIS.confirm / confirmDelete / confirmLogout / toast
   ============================================================ */
.mis-swal-popup {
  border-radius: var(--radius-2xl, 20px) !important;
  background: var(--surface-card) !important;
  color: var(--color-text-primary) !important;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.25),
    0 0 0 1px var(--hairline) !important;
  padding-bottom: 22px !important;
}

.mis-swal-popup .swal2-title {
  color: var(--color-text-primary) !important;
  font-size: 19px !important;
  font-weight: 700 !important;
  padding-top: 8px !important;
}

.mis-swal-popup .swal2-html-container {
  color: var(--color-text-secondary) !important;
  font-size: 14px !important;
}

.mis-swal-popup .swal2-icon.swal2-warning {
  border-color: #f59e0b !important;
  color: #f59e0b !important;
}

.mis-swal-popup .swal2-icon.swal2-question {
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
}

.mis-swal-popup .swal2-icon.swal2-success {
  border-color: #22c55e !important;
  color: #22c55e !important;
}

.mis-swal-popup .swal2-icon.swal2-error {
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

/* Actions row — generous, even gap between Cancel + Confirm (SweetAlert2's own
   spacing collapses when buttonsStyling:false, so it's set explicitly here). */
.mis-swal-popup .swal2-actions {
  gap: 14px !important;
  margin-top: 28px !important;
  padding: 0 6px !important;
}

.mis-swal-confirm,
.mis-swal-cancel {
  min-width: 112px !important;
  margin: 0 !important;
  cursor: pointer !important;
  outline-offset: 2px !important;
}

.mis-swal-confirm {
  background: linear-gradient(
    135deg,
    var(--accent-cyan),
    var(--accent-violet)
  ) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-lg, 10px) !important;
  padding: 11px 24px !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  box-shadow: 0 6px 16px rgba(0, 164, 210, 0.28) !important;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease !important;
}

.mis-swal-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 164, 210, 0.36) !important;
}

.mis-swal-confirm:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 164, 210, 0.3) !important;
}

.mis-swal-confirm:focus-visible {
  outline: 2px solid var(--accent-cyan) !important;
}

.mis-swal-confirm-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3) !important;
}

.mis-swal-confirm-danger:hover {
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4) !important;
}

.mis-swal-confirm-danger:active {
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3) !important;
}

.mis-swal-confirm-danger:focus-visible {
  outline-color: #ef4444 !important;
}

.mis-swal-cancel {
  background: transparent !important;
  color: var(--color-text-secondary) !important;
  border: 1px solid var(--hairline-strong, var(--hairline)) !important;
  border-radius: var(--radius-lg, 10px) !important;
  padding: 11px 22px !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease !important;
}

.mis-swal-cancel:hover {
  background: var(--surface-canvas) !important;
  border-color: var(--hairline-strong, var(--hairline)) !important;
  transform: translateY(-1px);
}

.mis-swal-cancel:active {
  transform: translateY(0);
}

.mis-swal-cancel:focus-visible {
  outline: 2px solid var(--accent-cyan) !important;
}

/* Toast variant — compact pill, top-right */
.mis-swal-toast {
  border-radius: var(--radius-xl, 14px) !important;
  background: var(--surface-card) !important;
  color: var(--color-text-primary) !important;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.18),
    0 0 0 1px var(--hairline) !important;
}

.mis-swal-toast .swal2-title {
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--color-text-primary) !important;
}

.mis-swal-toast .swal2-timer-progress-bar {
  background: var(--accent-cyan) !important;
}

[data-theme="dark"] .swal2-backdrop-show {
  background: rgba(0, 0, 0, 0.6) !important;
}
