/* ==========================================================================
   ULTRAGROUP 360 — EXECUTIVE IVORY DESIGN SYSTEM
   CEO Retail Cockpit Style Architecture
   Strictly Light Executive Ivory Theme
   ========================================================================== */

:root,
[data-theme="light"] {
  color-scheme: light;

  /* Canvas & Surfaces */
  --color-canvas: #F8FAFC;
  --color-bg-primary: #F8FAFC;
  --color-bg-secondary: #FFFFFF;
  --color-bg-tertiary: #F1F5F9;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F1F5F9;
  --color-surface-subtle: #F8FAFC;
  --color-surface-card: #FFFFFF;
  --color-surface-translucent: rgba(255, 255, 255, 0.92);

  /* Borders & Dividers */
  --color-border: #E2E8F0;
  --color-border-subtle: #EDF2F7;
  --color-border-focus: #0F172A;

  /* Typography Colors */
  --color-text-primary: #0F172A;   /* Slate 900 */
  --color-text-secondary: #475569; /* Slate 600 */
  --color-text-muted: #94A3B8;     /* Slate 400 */
  --color-text-invert: #FFFFFF;

  /* Semantic Deltas */
  --color-success-base: #059669;   /* Emerald 600 */
  --color-success-bg: #ECFDF5;     /* Emerald 50 */
  --color-success-text: #065F46;   /* Emerald 800 */
  --color-success-border: #A7F3D0;

  --color-danger-base: #DC2626;    /* Red 600 */
  --color-danger-bg: #FFF1F2;      /* Rose 50 */
  --color-danger-text: #9F1239;    /* Rose 800 */
  --color-danger-border: #FECDD3;

  --color-warning-base: #D97706;   /* Amber 600 */
  --color-warning-bg: #FFFBEB;     /* Amber 50 */
  --color-warning-text: #92400E;   /* Amber 800 */
  --color-warning-border: #FDE68A;

  --color-neutral-bg: #F1F5F9;
  --color-neutral-text: #334155;
  --color-neutral-border: #CBD5E1;

  /* Chart Accents */
  --chart-fact-line: #0F172A;
  --chart-base-line: #94A3B8;
  --chart-bar-pos: #059669;
  --chart-bar-neg: #DC2626;

  /* Tag and Day Summary Cell Tokens */
  --color-tag-bg: #EFF6FF;
  --color-tag-text: #1D4ED8;
  --color-tag-border: #BFDBFE;
  --color-day-cell-bg: var(--color-surface-subtle);
  --color-day-cell-border: var(--color-border);
  --color-day-active-bg: #EFF6FF;
  --color-day-active-border: #2563EB;
  --shadow-day-active: 0 4px 6px -1px rgba(37, 99, 235, 0.1);

  /* Layout & Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  --shadow-card-hover: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

/* ==========================================================================
   EXECUTIVE OBSIDIAN THEME (Dark Mode)
   docs/UI_SPEC_DARK_THEME.md
   ========================================================================== */
[data-theme="dark"],
html.dark-theme,
body.dark-theme {
  color-scheme: dark;

  /* Obsidian Base: Deep Slate & Jet Black Palette */
  --color-canvas: #0B0F17;
  --color-bg-primary: #0B0F17;
  --color-bg-secondary: #151E2E;
  --color-bg-tertiary: #1E293B;
  --color-surface: #151E2E;
  --color-surface-hover: #1E293B;
  --color-surface-subtle: #0B0F17;
  --color-surface-card: #151E2E;
  --color-surface-translucent: rgba(21, 30, 46, 0.85);

  /* Borders & Dividers */
  --color-border: #1E293B;
  --color-border-subtle: #243247;
  --color-border-focus: #38BDF8;

  /* Typography Colors */
  --color-text-primary: #F8FAFC;   /* Slate 50 */
  --color-text-secondary: #94A3B8; /* Slate 400 */
  --color-text-muted: #64748B;     /* Slate 500 */
  --color-text-invert: #0F172A;

  /* Semantic Deltas (Dark Mode Accessible) */
  --color-success-base: #10B981;   /* Emerald 500 */
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-success-text: #34D399;   /* Emerald 400 */
  --color-success-border: rgba(16, 185, 129, 0.3);

  --color-danger-base: #F43F5E;    /* Rose 500 */
  --color-danger-bg: rgba(244, 63, 94, 0.15);
  --color-danger-text: #FB7185;    /* Rose 400 */
  --color-danger-border: rgba(244, 63, 94, 0.3);

  --color-warning-base: #F59E0B;   /* Amber 500 */
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-warning-text: #FBBF24;   /* Amber 400 */
  --color-warning-border: rgba(245, 158, 11, 0.3);

  --color-neutral-bg: #1E293B;
  --color-neutral-text: #94A3B8;
  --color-neutral-border: #334155;

  /* Chart Accents */
  --chart-fact-line: #38BDF8;      /* Sky 400 */
  --chart-base-line: #64748B;      /* Slate 500 */
  --chart-bar-pos: #10B981;
  --chart-bar-neg: #F43F5E;

  /* Tag and Day Summary Cell Tokens for Dark Mode */
  --color-tag-bg: rgba(56, 189, 248, 0.15);
  --color-tag-text: #38BDF8;
  --color-tag-border: rgba(56, 189, 248, 0.35);
  --color-day-cell-bg: #151E2E;
  --color-day-cell-border: rgba(255, 255, 255, 0.08);
  --color-day-active-bg: rgba(56, 189, 248, 0.16);
  --color-day-active-border: #38BDF8;
  --shadow-day-active: 0 0 14px rgba(56, 189, 248, 0.25);

  /* Shadows for Dark Mode */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
}

/* Specific Dark Theme overrides for Header and Control Bar */
[data-theme="dark"] .app-header,
.dark-theme .app-header {
  background-color: var(--color-surface);
  border-bottom-color: var(--color-border);
}

[data-theme="dark"] .sticky-control-bar,
.dark-theme .sticky-control-bar {
  background-color: rgba(21, 30, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--color-border);
}


[data-theme="dark"] .bu-tab,
.dark-theme .bu-tab {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .bu-tab:hover:not(.bu-tab--disabled),
.dark-theme .bu-tab:hover:not(.bu-tab--disabled) {
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
  border-color: #475569;
}

[data-theme="dark"] .bu-tab.active,
.dark-theme .bu-tab.active {
  background-color: #1E293B;
  color: #F8FAFC;
  border-color: #38BDF8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .bu-tab--disabled,
.dark-theme .bu-tab--disabled {
  opacity: 0.45;
  background-color: transparent;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .form-select,
[data-theme="dark"] .form-date,
[data-theme="dark"] .form-input,
[data-theme="dark"] input[type="date"],
.dark-theme .form-select,
.dark-theme .form-date,
.dark-theme .form-input,
.dark-theme input[type="date"] {
  color-scheme: dark;
  background-color: var(--color-bg-primary);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

[data-theme="dark"] .form-select:hover,
[data-theme="dark"] .form-date:hover,
[data-theme="dark"] .form-input:hover,
.dark-theme .form-select:hover,
.dark-theme .form-date:hover,
.dark-theme .form-input:hover {
  border-color: #475569;
}

[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-date:focus,
[data-theme="dark"] .form-input:focus,
.dark-theme .form-select:focus,
.dark-theme .form-date:focus,
.dark-theme .form-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

/* Date picker calendar indicator styling for Dark Theme */
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
.dark-theme input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] .form-date::-webkit-calendar-picker-indicator,
.dark-theme .form-date::-webkit-calendar-picker-indicator {
  filter: invert(0.85) brightness(1.2);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, filter 0.15s ease;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
.dark-theme input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="dark"] .form-date::-webkit-calendar-picker-indicator:hover,
.dark-theme .form-date::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  filter: invert(1) brightness(1.3);
}

/* Custom radio buttons in comparison base switch and forms */
.comparison-radio,
.base-segmented-switch input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0;
  width: 14px;
  height: 14px;
  border: 1.5px solid #94a3b8;
  border-radius: 50%;
  background-color: #ffffff;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.comparison-radio::before,
.base-segmented-switch input[type="radio"]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.15s ease-in-out;
  background-color: #0284c7;
}

.comparison-radio:checked,
.base-segmented-switch input[type="radio"]:checked {
  border-color: #0284c7;
}

.comparison-radio:checked::before,
.base-segmented-switch input[type="radio"]:checked::before {
  transform: scale(1);
}

.comparison-radio:hover,
.base-segmented-switch input[type="radio"]:hover {
  border-color: #64748b;
}

.comparison-radio:focus-visible,
.base-segmented-switch input[type="radio"]:focus-visible {
  outline: 2px solid #0284c7;
  outline-offset: 2px;
}

/* Custom radio buttons in dark theme: border #64748b, dot #38bdf8 (TK-0015) */
[data-theme="dark"] input[type="radio"],
.dark-theme input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0;
  width: 14px;
  height: 14px;
  border: 1.5px solid #64748b;
  border-radius: 50%;
  background-color: #1e293b;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  transition: border-color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

[data-theme="dark"] input[type="radio"]::before,
.dark-theme input[type="radio"]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.15s ease-in-out;
  background-color: #38bdf8;
}

[data-theme="dark"] input[type="radio"]:checked,
.dark-theme input[type="radio"]:checked {
  border-color: #38bdf8;
}

[data-theme="dark"] input[type="radio"]:checked::before,
.dark-theme input[type="radio"]:checked::before {
  transform: scale(1);
}

[data-theme="dark"] input[type="radio"]:hover,
.dark-theme input[type="radio"]:hover {
  border-color: #94a3b8;
}

[data-theme="dark"] input[type="radio"]:focus-visible,
.dark-theme input[type="radio"]:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

[data-theme="dark"] .base-segmented-switch .btn-segment.active input[type="radio"],
.dark-theme .base-segmented-switch .btn-segment.active input[type="radio"] {
  border-color: #38bdf8;
}

[data-theme="dark"] input[type="checkbox"],
.dark-theme input[type="checkbox"] {
  border: 1.5px solid #64748b;
  background-color: #1e293b;
  accent-color: #38bdf8;
  cursor: pointer;
}

[data-theme="dark"] input[type="checkbox"]:hover,
[data-theme="dark"] input[type="checkbox"]:focus,
.dark-theme input[type="checkbox"]:hover,
.dark-theme input[type="checkbox"]:focus {
  border-color: #94a3b8;
  outline: none;
}

/* Period and comparison controls under dates in dark mode (MoM, YoY, period shortcuts) */
[data-theme="dark"] .period-shortcuts,
[data-theme="dark"] .base-segmented-switch,
.dark-theme .period-shortcuts,
.dark-theme .base-segmented-switch {
  border: 1.5px solid #64748b;
  background-color: #1e293b;
}

[data-theme="dark"] .period-shortcuts:hover,
[data-theme="dark"] .base-segmented-switch:hover,
.dark-theme .period-shortcuts:hover,
.dark-theme .base-segmented-switch:hover {
  border-color: #94a3b8;
}

[data-theme="dark"] .btn-segment,
[data-theme="dark"] .btn-tag,
.dark-theme .btn-segment,
.dark-theme .btn-tag {
  color: #94a3b8;
}

[data-theme="dark"] .btn-segment:hover,
[data-theme="dark"] .btn-tag:hover,
.dark-theme .btn-segment:hover,
.dark-theme .btn-tag:hover {
  color: #f8fafc;
  background-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .btn-segment.active,
[data-theme="dark"] .btn-tag.active,
.dark-theme .btn-segment.active,
.dark-theme .btn-tag.active {
  background-color: #334155;
  color: #f8fafc;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* CSS Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body.executive-ivory-theme,
body.dark-theme,
[data-theme="dark"] body {
  font-family: var(--font-sans);
  background-color: var(--color-canvas);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Number display rules */
.tabular-numbers,
.hero-value,
.delta-abs,
.delta-badge,
.base-text,
.th-sortable,
td,
.chip-item {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}

/* ==========================================================================
   Header Architecture
   ========================================================================== */
.app-header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 24px;
  position: relative;
  z-index: 40;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--color-text-primary);
}

.brand-symbol {
  color: #2563EB;
  font-size: 14px;
}

.header-divider {
  width: 1px;
  height: 22px;
  background-color: var(--color-border);
}

.cockpit-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cockpit-titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cockpit-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.cockpit-subtitle {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
  line-height: 1.2;
  margin: 1px 0 0 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.system-time-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-secondary);
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--color-text-primary);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.user-role {
  font-size: 10px;
  font-weight: 700;
  color: #2563EB;
  background-color: #EFF6FF;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

[data-theme="dark"] .user-role,
.dark-theme .user-role {
  color: #38BDF8;
  background-color: rgba(56, 189, 248, 0.15);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.theme-toggle-btn:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-focus);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.theme-toggle-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* ==========================================================================
   Sticky Control Bar
   ========================================================================== */
.sticky-control-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .sticky-control-bar,
.dark-theme .sticky-control-bar {
  background-color: rgba(21, 30, 46, 0.92);
  border-bottom-color: var(--color-border);
}

.control-bar-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 20px;
  box-sizing: border-box;
}

.control-bar-container .control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.control-island--time {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.control-divider {
  width: 1px;
  height: 22px;
  background-color: var(--color-border);
  flex-shrink: 0;
  opacity: 0.8;
}

[data-theme="dark"] .control-divider,
.dark-theme .control-divider {
  background-color: rgba(255, 255, 255, 0.12);
}

.control-label {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  user-select: none;
}

.control-label-icon {
  margin-right: 4px;
  vertical-align: -2px;
  color: var(--color-brand-primary, #2563EB);
  opacity: 0.85;
}

[data-theme="dark"] .control-label-icon,
.dark-theme .control-label-icon {
  color: #38bdf8;
}

/* Form inputs & selects */
.form-select,
.form-date,
.form-input {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-select:hover,
.form-date:hover,
.form-input:hover {
  border-color: #CBD5E1;
}

.form-select:focus,
.form-date:focus,
.form-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.form-date::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.form-date::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Slot 1: Store Scope */
.control-group--store {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.control-group--store .store-select-wrapper {
  width: 220px;
  max-width: 220px;
}

.control-group--store select.form-select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

/* Slot 2 & Slot 3: Dynamic Time Controls Engine (Strict Zero CLS) */
.control-group--period {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Mode Switch: 252px Apple Segmented Control */
.period-mode-switch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 252px;
  min-width: 252px;
  max-width: 252px;
  height: 34px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  box-sizing: border-box;
  flex-shrink: 0;
}

[data-theme="dark"] .period-mode-switch,
.dark-theme .period-mode-switch {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

.period-mode-btn {
  height: 26px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.period-mode-btn:hover {
  color: var(--color-text-primary);
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .period-mode-btn:hover,
.dark-theme .period-mode-btn:hover {
  color: #F8FAFC;
  background-color: rgba(255, 255, 255, 0.05);
}

.period-mode-btn.active {
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .period-mode-btn.active,
.dark-theme .period-mode-btn.active {
  background-color: #334155;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Sub-slot 3.1: Picker Reserved Zone (240px) */
.week-select-wrapper,
.month-select-wrapper,
.date-range-inputs {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  height: 34px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.week-select-wrapper select.week-select,
.month-select-wrapper select.month-select {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.base-month-select-wrapper {
  display: none;
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  height: 34px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.base-month-select-wrapper select.base-month-select {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.date-range-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-range-inputs input.form-date {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 4px;
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-sm);
}

.date-sep {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Date Stepper Buttons (Day mode prev/next) */
.btn-date-step {
  display: none !important;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 34px;
  padding: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}

.btn-date-step svg {
  pointer-events: none;
}

.btn-date-step:hover:not(:disabled) {
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-focus);
}

.btn-date-step:active:not(:disabled) {
  transform: scale(0.95);
}

.btn-date-step:disabled,
.btn-date-step[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* In DAY mode: single date input cleanly fills slot flanked by step arrows */
.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .btn-date-step,
.date-range-inputs.is-day-mode .btn-date-step {
  display: inline-flex !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .date-range-inputs input#dateEnd,
.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .date-range-inputs .date-sep,
.date-range-inputs.is-day-mode input#dateEnd,
.date-range-inputs.is-day-mode .date-sep {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .date-range-inputs input#dateStart,
.date-range-inputs.is-day-mode input#dateStart {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  text-align: center;
  font-weight: 600;
}

/* Sub-slot 3.2: Modifiers / Coverage Reserved Zone (180px) */
.period-shortcuts,
.period-coverage {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  height: 34px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.period-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

[data-theme="dark"] .period-shortcuts,
.dark-theme .period-shortcuts {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

.period-shortcuts .btn-tag {
  height: 26px;
  font-size: 11px;
  font-weight: 500;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
  user-select: none;
}

.period-shortcuts .btn-tag:hover {
  color: var(--color-text-primary);
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .period-shortcuts .btn-tag:hover,
.dark-theme .period-shortcuts .btn-tag:hover {
  color: #F8FAFC;
  background-color: rgba(255, 255, 255, 0.05);
}

.period-shortcuts .btn-tag.active {
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .period-shortcuts .btn-tag.active,
.dark-theme .period-shortcuts .btn-tag.active {
  background-color: #334155;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.period-shortcuts .btn-tag:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.period-coverage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.period-coverage.is-partial {
  color: var(--color-warning-text);
  border-color: var(--color-warning-border);
}

/* Slot 4: Comparison Base Toggle (200px) */
.control-group--base {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.base-segmented-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 200px;
  min-width: 200px;
  max-width: 200px;
  height: 34px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  box-sizing: border-box;
  flex-shrink: 0;
}

[data-theme="dark"] .base-segmented-switch,
.dark-theme .base-segmented-switch {
  background-color: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

.base-segmented-switch .btn-segment {
  height: 26px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.base-segmented-switch .btn-segment:hover {
  color: var(--color-text-primary);
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .base-segmented-switch .btn-segment:hover,
.dark-theme .base-segmented-switch .btn-segment:hover {
  color: #F8FAFC;
  background-color: rgba(255, 255, 255, 0.05);
}

.base-segmented-switch .btn-segment.active {
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .base-segmented-switch .btn-segment.active,
.dark-theme .base-segmented-switch .btn-segment.active {
  background-color: #334155;
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Context Ribbon */
.context-ribbon {
  background-color: var(--color-surface-subtle);
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
  height: 35px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

[data-theme="dark"] .context-ribbon,
.dark-theme .context-ribbon {
  background: linear-gradient(90deg, rgba(20, 29, 47, 0.96) 0%, rgba(15, 23, 42, 0.92) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(56, 189, 248, 0.12);
}

.context-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-text-secondary);
  flex-wrap: nowrap;
  gap: 12px;
  box-sizing: border-box;
}

.context-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .context-text,
.dark-theme .context-text {
  color: #E2E8F0;
}

.context-text strong {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.context-text strong:first-of-type {
  color: #0F172A;
}

[data-theme="dark"] .context-text strong:first-of-type,
.dark-theme .context-text strong:first-of-type {
  color: #FFFFFF;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.context-text strong:nth-of-type(2) {
  color: #0284C7;
}

[data-theme="dark"] .context-text strong:nth-of-type(2),
.dark-theme .context-text strong:nth-of-type(2) {
  color: #38BDF8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.context-dates {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: inherit;
}

[data-theme="dark"] .context-dates,
.dark-theme .context-dates {
  color: #F8FAFC;
}

.context-meta {
  color: var(--color-text-secondary);
  font-weight: 400;
  font-size: 11.5px;
}

[data-theme="dark"] .context-meta,
.dark-theme .context-meta {
  color: #94A3B8;
}

.context-icon {
  font-weight: 700;
  font-size: 14px;
  color: #2563EB;
  margin-right: 4px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

[data-theme="dark"] .context-icon,
.dark-theme .context-icon {
  color: #38BDF8;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.55);
}

.context-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.context-filter-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background-color: var(--color-tag-bg, #EFF6FF);
  color: var(--color-tag-text, #1D4ED8);
  border: 1px solid var(--color-tag-border, #BFDBFE);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.btn-reset-filters {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reset-filters:hover:not(:disabled) {
  color: var(--color-text-primary);
  border-color: var(--color-border-focus);
}

.btn-reset-filters:not(:disabled):not(.disabled) {
  background-color: #FFF1F2;
  color: #BE123C;
  border-color: #FECDD3;
}

.btn-reset-filters:not(:disabled):not(.disabled):hover {
  background-color: #FFE4E6;
  color: #9F1239;
  border-color: #FDA4AF;
}

.btn-reset-filters:disabled,
.btn-reset-filters.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-theme="dark"] .btn-reset-filters,
.dark-theme .btn-reset-filters {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--color-text-secondary);
}

[data-theme="dark"] .btn-reset-filters:not(:disabled):hover,
.dark-theme .btn-reset-filters:not(:disabled):hover {
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

/* ==========================================================================
   Main Content & Bento Grid
   ========================================================================== */
.dashboard-main {
  flex: 1;
  padding: 24px;
}

.main-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Bento Hero Grid (4 items) */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.bento-card {
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 162px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bento-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-border-focus);
  transform: translateY(-1px);
}

.bento-card--primary {
  /* Clean visual parity */
}

.bento-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.bento-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bento-icon {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.bento-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

.delta-badge {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2.5px 8px;
  border-radius: 6px;
  line-height: 1.2;
  white-space: nowrap;
}

.delta-badge--success {
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}

.delta-badge--danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger-text);
  border: 1px solid var(--color-danger-border);
}

.delta-badge--neutral {
  background-color: var(--color-neutral-bg);
  color: var(--color-neutral-text);
  border: 1px solid var(--color-neutral-border);
}

.hero-value {
  font-size: 30px !important;
  font-weight: 700 !important;
  line-height: 1.15;
  color: var(--color-text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.025em;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

.base-comparison-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  flex-wrap: wrap;
  min-height: 42px;
  align-content: flex-start;
}

.base-text {
  color: var(--color-text-muted);
  font-weight: 500;
}

.delta-abs {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.delta-abs--success {
  color: var(--color-success-base);
}

.delta-abs--danger {
  color: var(--color-danger-base);
}

.delta-abs--neutral {
  color: var(--color-text-muted);
}

.bento-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-subtle);
}

.bento-progress-track {
  height: 4px;
  background-color: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.bento-progress-bar {
  height: 100%;
  background-color: var(--color-warning-base);
  border-radius: 999px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.bento-subtext {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.subtext-mute {
  color: var(--color-text-muted);
}

.bento-stat-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-item {
  font-size: 11px;
  color: var(--color-text-secondary);
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  padding: 2px 7px;
  border-radius: 4px;
}

.chip-item--success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success-border);
  color: var(--color-success-text);
}

/* ==========================================================================
   Level 2: Head-to-Head Chart Section
   ========================================================================== */
.section-card {
  background-color: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px 24px;
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

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

.chart-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-flight-summary {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background-color: var(--color-surface-subtle, #F8FAFC);
  border: 1px solid var(--color-border-subtle, #E2E8F0);
  border-radius: 9999px;
  font-size: 11.5px;
  color: var(--color-text-secondary, #64748B);
  letter-spacing: -0.01em;
  gap: 6px;
  user-select: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

[data-theme="dark"] .chart-flight-summary,
.dark-theme .chart-flight-summary {
  background-color: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
  color: #94A3B8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.chart-flight-summary .flight-fact strong {
  color: var(--color-text-primary, #0F172A);
  font-weight: 600;
}

[data-theme="dark"] .chart-flight-summary .flight-fact strong,
.dark-theme .chart-flight-summary .flight-fact strong {
  color: #F8FAFC;
}

.chart-flight-summary .flight-sep {
  opacity: 0.35;
  margin: 0 2px;
}

.chart-flight-summary .flight-delta-pos {
  color: var(--color-emerald, #10B981);
  font-weight: 600;
}

.chart-flight-summary .flight-delta-neg {
  color: var(--color-rose, #EF4444);
  font-weight: 600;
}

/* Metric Segmented Switch (Executive Pill Segmented Control) */
.metric-segmented-switch,
.segmented-pill-switch {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-surface-subtle, #F1F5F9);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  box-sizing: border-box;
}

[data-theme="dark"] .metric-segmented-switch,
.dark-theme .metric-segmented-switch,
[data-theme="dark"] .segmented-pill-switch,
.dark-theme .segmented-pill-switch {
  background-color: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.btn-metric,
.btn-chart-align,
.btn-chart-res {
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 6px;
  border: none !important;
  background: transparent !important;
  color: var(--color-text-secondary, #64748B);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: none !important;
  outline: none;
}

.btn-metric:active,
.btn-chart-align:active,
.btn-chart-res:active {
  transform: scale(0.96);
}

.btn-metric:hover,
.btn-chart-align:hover,
.btn-chart-res:hover {
  color: var(--color-text-primary, #0F172A);
  background-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="dark"] .btn-metric,
.dark-theme .btn-metric,
[data-theme="dark"] .btn-chart-align,
.dark-theme .btn-chart-align,
[data-theme="dark"] .btn-chart-res,
.dark-theme .btn-chart-res {
  color: #94A3B8;
}

[data-theme="dark"] .btn-metric:hover,
.dark-theme .btn-metric:hover,
[data-theme="dark"] .btn-chart-align:hover,
.dark-theme .btn-chart-align:hover,
[data-theme="dark"] .btn-chart-res:hover,
.dark-theme .btn-chart-res:hover {
  color: #F8FAFC;
  background-color: rgba(255, 255, 255, 0.06) !important;
}

.btn-metric.active,
.btn-chart-align.active,
.btn-chart-res.active {
  color: var(--color-text-primary, #0F172A) !important;
  background-color: var(--color-surface, #FFFFFF) !important;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .btn-metric.active,
.dark-theme .btn-metric.active,
[data-theme="dark"] .btn-chart-align.active,
.dark-theme .btn-chart-align.active,
[data-theme="dark"] .btn-chart-res.active,
.dark-theme .btn-chart-res.active {
  background-color: #334155 !important;
  color: #FFFFFF !important;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
}

.echarts-container {
  width: 100%;
  height: 100%;
}

.chart-sub-summary {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-subtle);
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-summary-cell {
  background-color: var(--color-day-cell-bg, var(--color-surface-subtle));
  border: 1px solid var(--color-day-cell-border, var(--color-border));
  border-radius: 9px;
  padding: 9px 10px 8px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.day-summary-cell:hover {
  background: var(--color-surface-hover, #F8FAFC);
  border-color: var(--color-border-hover, #CBD5E1);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -3px rgba(0, 0, 0, 0.08);
}

.day-summary-cell.is-weekend {
  border-color: var(--color-day-cell-border, var(--color-border));
  background: var(--color-day-cell-bg, var(--color-surface-subtle));
}

[data-theme="dark"] .day-summary-cell.is-weekend,
.dark-theme .day-summary-cell.is-weekend {
  border-color: var(--color-day-cell-border, var(--color-border));
  background: var(--color-day-cell-bg, var(--color-surface-subtle));
}

.day-summary-cell.active-day {
  border: 1.5px solid #0284C7;
  background-color: var(--color-day-active-bg, #F0F9FF);
  box-shadow: 0 0 16px -2px rgba(56, 189, 248, 0.35), 0 2px 6px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .day-summary-cell.active-day,
.dark-theme .day-summary-cell.active-day {
  border-color: #38BDF8;
  background-color: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 18px -2px rgba(56, 189, 248, 0.45), inset 0 0 0 1px rgba(56, 189, 248, 0.3);
}

.day-summary-cell.is-pending {
  border-style: dashed;
  border-color: var(--color-border);
  opacity: 0.75;
  cursor: default;
}

.day-summary-cell.is-pending:hover {
  transform: none;
  box-shadow: none;
  background-color: var(--color-day-cell-bg, var(--color-surface-subtle));
  border-color: var(--color-border);
}

[data-theme="dark"] .day-summary-cell.is-pending,
.dark-theme .day-summary-cell.is-pending {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.35);
  opacity: 0.65;
}

[data-theme="dark"] .day-summary-cell.is-pending:hover,
.dark-theme .day-summary-cell.is-pending:hover {
  transform: none;
  box-shadow: none;
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.25);
}

.day-summary-cell .day-delta-val--pending {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.day-cell-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 20px;
  gap: 4px;
  margin-bottom: 3px;
}

.day-name-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: -0.01em;
}

.day-weekend-badge {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.14);
  color: #D97706;
  border: 1px solid rgba(245, 158, 11, 0.28);
  line-height: 1.2;
  white-space: nowrap;
}

[data-theme="dark"] .day-weekend-badge,
.dark-theme .day-weekend-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.35);
}

.day-fact-val {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
  margin: 2px 0 2px;
  letter-spacing: -0.02em;
}

.day-delta-val {
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.day-delta-sep {
  opacity: 0.4;
  font-weight: 400;
}

.day-delta-val--missing {
  font-style: italic;
  font-weight: 400;
  opacity: 0.75;
}

.day-weight-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--color-border-subtle, rgba(226, 232, 240, 0.5));
}

.day-weight-track {
  flex: 1;
  height: 3px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.day-weight-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #38BDF8, #2563EB);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .day-weight-fill,
.dark-theme .day-weight-fill {
  background: linear-gradient(90deg, #38BDF8, #60A5FA);
}

.day-weight-label {
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted, #94A3B8);
  letter-spacing: -0.01em;
  min-width: 24px;
  text-align: right;
}

/* ==========================================================================
   Level 3: Store Matrix Table
   ========================================================================== */
.section-card-header--table {
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: 16px;
}

.table-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.table-search-box .search-icon,
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-muted, #94A3B8);
  pointer-events: none;
  z-index: 2;
  transition: color 0.15s ease;
}

.table-search-box:focus-within .search-icon {
  color: #2563EB;
}

.table-search-box .search-input,
.search-input.form-input,
.search-input,
#storeSearchInput {
  padding-left: 34px !important;
  padding-right: 30px !important;
  min-width: 280px;
  height: 34px;
  font-size: 12.5px;
  border-radius: 6px;
  border: 1px solid var(--color-border, #E2E8F0);
  background-color: var(--color-surface, #FFFFFF);
  color: var(--color-text-primary, #0F172A);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.table-search-box .search-input:hover,
#storeSearchInput:hover {
  border-color: #94A3B8;
}

.table-search-box .search-input:focus,
#storeSearchInput:focus {
  border-color: #2563EB !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
}

.table-scroll-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface, #FFFFFF);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border, #CBD5E1) transparent;
}

.table-scroll-container::-webkit-scrollbar {
  height: 4px;
}

.table-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll-container::-webkit-scrollbar-thumb {
  background: var(--color-border, #CBD5E1);
  border-radius: 999px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted, #94A3B8);
}

.btn-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 11px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px 4px;
}

.btn-clear.hidden {
  display: none;
}

.btn-action {
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm, 6px);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background-color: var(--color-surface-hover, rgba(0, 0, 0, 0.04));
  color: var(--color-text-primary);
}

#resetStoreFilterBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #DC2626;
  font-size: 11.5px;
  padding: 5px 10px;
}

#resetStoreFilterBtn:hover {
  background-color: rgba(239, 68, 68, 0.16);
  border-color: #DC2626;
  color: #B91C1C;
}

[data-theme="dark"] #resetStoreFilterBtn,
.dark-theme #resetStoreFilterBtn {
  background-color: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #F87171;
}

[data-theme="dark"] #resetStoreFilterBtn:hover,
.dark-theme #resetStoreFilterBtn:hover {
  background-color: rgba(248, 113, 113, 0.22);
  border-color: #F87171;
  color: #FECACA;
}

#resetStoreFilterBtn.hidden {
  display: none !important;
}

.btn-action--export {
  background-color: var(--color-surface-subtle, #EFF6FF);
  border-color: var(--color-border, #BFDBFE);
  color: var(--color-text-primary, #1D4ED8);
}



/* Executive Clean Table */
.lfl-matrix-table,
.split-matrix-table {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1, "cv05" 1;
  font-variant-numeric: tabular-nums;
  width: 100%;
  min-width: 1111px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  table-layout: fixed;
}

.lfl-matrix-table th,
.lfl-matrix-table td,
.split-matrix-table th,
.split-matrix-table td {
  font-family: inherit;
  padding: 8px 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.lfl-matrix-table th,
.split-matrix-table th {
  background-color: var(--color-surface-subtle, #F8FAFC);
  color: var(--color-text-muted, #64748B);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border, #E2E8F0);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1.2;
  padding: 6px 4px;
}

/* Base Desktop Sticky Columns (Preserve Column 1 & 2 on horizontal scroll) */
.lfl-matrix-table .th-main-header th:nth-child(1),
.lfl-matrix-table tbody td:nth-child(1),
.lfl-matrix-table tfoot td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  background-color: var(--color-surface, #FFFFFF);
}

.lfl-matrix-table .th-main-header th:nth-child(1) {
  z-index: 4;
  background-color: var(--color-surface-subtle, #F8FAFC);
}

.lfl-matrix-table .th-main-header th:nth-child(2),
.lfl-matrix-table tbody td:nth-child(2),
.lfl-matrix-table tfoot td:nth-child(2) {
  position: sticky;
  left: 32px;
  z-index: 2;
  background-color: var(--color-surface, #FFFFFF);
  box-shadow: 2px 0 6px -1px rgba(15, 23, 42, 0.08);
}

.lfl-matrix-table .th-main-header th:nth-child(2) {
  z-index: 4;
  background-color: var(--color-surface-subtle, #F8FAFC);
}

.lfl-matrix-table tfoot td:nth-child(1),
.lfl-matrix-table tfoot td:nth-child(2) {
  background-color: var(--color-surface-subtle, #F8FAFC);
}

[data-theme="dark"] .lfl-matrix-table .th-main-header th:nth-child(1),
[data-theme="dark"] .lfl-matrix-table tbody td:nth-child(1),
[data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(1),
[data-theme="dark"] .lfl-matrix-table .th-main-header th:nth-child(2),
[data-theme="dark"] .lfl-matrix-table tbody td:nth-child(2),
[data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(2),
.dark-theme .lfl-matrix-table .th-main-header th:nth-child(1),
.dark-theme .lfl-matrix-table tbody td:nth-child(1),
.dark-theme .lfl-matrix-table tfoot td:nth-child(1),
.dark-theme .lfl-matrix-table .th-main-header th:nth-child(2),
.dark-theme .lfl-matrix-table tbody td:nth-child(2),
.dark-theme .lfl-matrix-table tfoot td:nth-child(2) {
  background-color: var(--color-surface, #0F172A);
  box-shadow: 2px 0 6px -1px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .lfl-matrix-table .th-main-header th:nth-child(1),
[data-theme="dark"] .lfl-matrix-table .th-main-header th:nth-child(2),
[data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(1),
[data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(2),
.dark-theme .lfl-matrix-table .th-main-header th:nth-child(1),
.dark-theme .lfl-matrix-table .th-main-header th:nth-child(2),
.dark-theme .lfl-matrix-table tfoot td:nth-child(1),
.dark-theme .lfl-matrix-table tfoot td:nth-child(2) {
  background-color: var(--color-surface-subtle, #1E293B);
}

/* Sortable Column Headers with Subtle Directional Arrows (Vector SVG) */
.th-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
}

.th-sortable:hover {
  color: var(--color-text-primary, #0F172A) !important;
}

[data-theme="dark"] .th-sortable:hover,
.dark-theme .th-sortable:hover {
  color: #F8FAFC !important;
}

.th-sortable.th-sort-active {
  color: var(--color-text-primary, #0F172A) !important;
}

[data-theme="dark"] .th-sortable.th-sort-active,
.dark-theme .th-sortable.th-sort-active {
  color: #F8FAFC !important;
}

.th-sortable.th-sort-active.th-sort-desc .th-label::after,
.th-sortable.th-sort-active.th-sort-desc::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 4px;
  vertical-align: -1px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  opacity: 0.85;
}

.th-sortable.th-sort-active.th-sort-asc .th-label::after,
.th-sortable.th-sort-active.th-sort-asc::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 4px;
  vertical-align: -1px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E");
  opacity: 0.85;
}

.th-sortable:has(.th-label).th-sort-active::after {
  content: none !important;
}

.th-sortable.th-split-col.th-sort-active.th-sort-desc .th-split-main::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 3px;
  vertical-align: -1px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  opacity: 0.85;
}

.th-sortable.th-split-col.th-sort-active.th-sort-asc .th-split-main::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 3px;
  vertical-align: -1px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E");
  opacity: 0.85;
}

.th-sortable.th-split-col.th-sort-active::after {
  content: none !important;
}

[data-theme="dark"] .th-sortable.th-sort-active.th-sort-desc .th-label::after,
[data-theme="dark"] .th-sortable.th-sort-active.th-sort-desc::after,
.dark-theme .th-sortable.th-sort-active.th-sort-desc .th-label::after,
.dark-theme .th-sortable.th-sort-active.th-sort-desc::after,
[data-theme="dark"] .th-sortable.th-split-col.th-sort-active.th-sort-desc .th-split-main::after,
.dark-theme .th-sortable.th-split-col.th-sort-active.th-sort-desc .th-split-main::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F8FAFC' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] .th-sortable.th-sort-active.th-sort-asc .th-label::after,
[data-theme="dark"] .th-sortable.th-sort-active.th-sort-asc::after,
.dark-theme .th-sortable.th-sort-active.th-sort-asc .th-label::after,
.dark-theme .th-sortable.th-sort-active.th-sort-asc::after,
[data-theme="dark"] .th-sortable.th-split-col.th-sort-active.th-sort-asc .th-split-main::after,
.dark-theme .th-sortable.th-split-col.th-sort-active.th-sort-asc .th-split-main::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F8FAFC' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Column Header with Dual-Channel Label */
.th-num,
.lfl-matrix-table th.th-num {
  text-align: right;
  padding: 8px 8px;
  white-space: nowrap;
}

.lfl-matrix-table th.th-num .th-label {
  display: block;
  text-align: right;
  width: 100%;
}

.th-tabular {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

.th-tabular .th-val {
  flex: 1 1 auto;
  text-align: right;
}

.th-tabular .th-delta {
  flex: 0 0 54px;
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  color: #94A3B8;
  letter-spacing: 0.02em;
}

.lfl-matrix-table td,
.split-matrix-table td {
  border-bottom: 1px solid var(--color-border-subtle, #F1F5F9);
  color: var(--color-text-primary, #0F172A);
  font-weight: 500;
}

/* Executive Vertical Micro-Stack Data Cell */
.td-num,
.lfl-matrix-table td.td-num {
  text-align: right;
  padding: 6px 8px;
  white-space: nowrap;
}

.tabular-cell,
.lfl-matrix-cell,
.lfl-matrix-table td.td-num .tabular-cell,
.lfl-matrix-table tfoot td.td-num .tabular-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1.5px;
  width: 100%;
  line-height: 1.15;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum" 1, "cv05" 1, "zero" 1;
  font-feature-settings: "tnum" 1, "cv05" 1, "zero" 1;
}

.cell-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-primary, #0F172A);
  letter-spacing: -0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.2;
}

.cell-delta {
  font-family: var(--font-mono);
  display: block;
  width: 100%;
  text-align: right;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}

/* Emerald Sage & Rose Terracotta Financial Status Tones */
.cell-delta--pos {
  color: #059669; /* Emerald Sage 600 */
}

.cell-delta--neg {
  color: #E11D48; /* Rose Terracotta 600 */
}

.cell-delta--neutral {
  color: #94A3B8;
}

[data-theme="dark"] .cell-delta--pos,
.dark-theme .cell-delta--pos {
  color: #34D399; /* Mint Emerald 400 */
}

[data-theme="dark"] .cell-delta--neg,
.dark-theme .cell-delta--neg {
  color: #FB7185; /* Soft Rose 400 */
}

[data-theme="dark"] .cell-delta--neutral,
.dark-theme .cell-delta--neutral {
  color: #64748B;
}

.cell-delta--empty {
  display: none;
}

/* Centered Tabular Metrics (UPT, SVT) */
.td-center {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

.td-status {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
}

/* SVT Executive Radar Chip */
.svt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 999px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  box-sizing: border-box;
}

.svt-chip--pos {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.22);
  color: #059669;
}

.svt-chip--neg {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.22);
  color: #E11D48;
}

.svt-chip--neutral {
  color: #94A3B8;
  background: transparent;
  border: 1px solid transparent;
}

[data-theme="dark"] .svt-chip--pos,
.dark-theme .svt-chip--pos {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
  color: #34D399;
}

[data-theme="dark"] .svt-chip--neg,
.dark-theme .svt-chip--neg {
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.25);
  color: #FB7185;
}

[data-theme="dark"] .svt-chip--neutral,
.dark-theme .svt-chip--neutral {
  color: #64748B;
}

/* Store Status Badges: Subtle Bordered Pills */
.badge-store-lfl {
  display: inline-block;
  background: rgba(100, 116, 139, 0.06);
  border: 1px solid rgba(100, 116, 139, 0.22);
  color: #64748B;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.badge-store-new {
  display: inline-block;
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.25);
  color: #059669;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.badge-store-closed {
  display: inline-block;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94A3B8;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

[data-theme="dark"] .badge-store-lfl,
.dark-theme .badge-store-lfl {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.22);
  color: #94A3B8;
}

[data-theme="dark"] .badge-store-new,
.dark-theme .badge-store-new {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.25);
  color: #34D399;
}

[data-theme="dark"] .badge-store-closed,
.dark-theme .badge-store-closed {
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.22);
  color: #64748B;
}

/* Kinetic Row Interactions */
.lfl-matrix-table tbody tr {
  cursor: pointer;
  transition: background-color 0.14s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.lfl-matrix-table tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.7);
}

.lfl-matrix-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 #2563EB;
}

.lfl-matrix-table tbody tr.row-selected,
.lfl-matrix-table tbody tr.row-selected:hover {
  background-color: rgba(239, 246, 255, 0.85);
}

.lfl-matrix-table tbody tr.row-selected td:first-child {
  box-shadow: inset 3px 0 0 #2563EB;
}

[data-theme="dark"] .lfl-matrix-table tbody tr:hover,
.dark-theme .lfl-matrix-table tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.55);
}

[data-theme="dark"] .lfl-matrix-table tbody tr:hover td:first-child,
.dark-theme .lfl-matrix-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 #60A5FA;
}

[data-theme="dark"] .lfl-matrix-table tbody tr.row-selected,
.dark-theme .lfl-matrix-table tbody tr.row-selected {
  background-color: rgba(30, 58, 138, 0.35);
}

[data-theme="dark"] .lfl-matrix-table tbody tr.row-selected td:first-child,
.dark-theme .lfl-matrix-table tbody tr.row-selected td:first-child {
  box-shadow: inset 3px 0 0 #60A5FA;
}

/* The Grand Ledger: Table Totals Footer */
.lfl-matrix-table tfoot td {
  background-color: var(--color-surface-subtle, #F8FAFC);
  font-weight: 700;
  border-top: 1px solid var(--color-border, #CBD5E1);
  border-bottom: none;
  color: var(--color-text-primary, #0F172A);
  padding: 7px 8px;
}

.lfl-matrix-table tfoot tr.tfoot-summary-row--lfl td {
  background-color: var(--color-surface-subtle, #F8FAFC);
  border-top: 1px solid var(--color-border, #CBD5E1);
}

.lfl-matrix-table tfoot tr.tfoot-summary-row--network td {
  background-color: rgba(241, 245, 249, 0.9);
  border-top: 2px solid var(--color-border, #94A3B8);
}

[data-theme="dark"] .lfl-matrix-table tfoot td,
.dark-theme .lfl-matrix-table tfoot td {
  background-color: var(--color-surface-subtle, #1E293B);
  border-top-color: #334155;
  color: #F8FAFC;
}

[data-theme="dark"] .lfl-matrix-table tfoot tr.tfoot-summary-row--network td,
.dark-theme .lfl-matrix-table tfoot tr.tfoot-summary-row--network td {
  background-color: rgba(30, 41, 59, 0.8);
  border-top-color: #475569;
}

.lfl-matrix-table tfoot .cell-val {
  font-weight: 700;
  font-size: 12.5px;
}

/* Cell Alignments */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.store-name-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #0F172A);
  line-height: 1.3;
  text-decoration: none;
}

.store-mall-sub {
  font-size: 11px;
  font-weight: 500;
  color: #64748B;
  margin-top: 1px;
  line-height: 1.2;
  display: block;
}

.badge-store-new,
.badge--new,
.badge-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 16px;
  padding: 0 6px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  min-width: 38px;
  color: #4338CA;
  background-color: #EEF2FF;
  border: 1px solid #C7D2FE;
  cursor: help;
  user-select: none;
}

/* Badges */
.badge:not(.badge-store-lfl):not(.badge-store-new):not(.badge-store-closed):not(.badge--lfl):not(.badge--new):not(.badge--closed) {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
}

.badge--format {
  font-size: 10px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.badge--format-mono {
  background-color: #F3E8FF;
  border-color: #E9D5FF;
  color: #6B21A8;
}

.badge--success {
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.badge--danger {
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger-text);
}

.badge--warning {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  color: var(--color-warning-text);
}

.badge--neutral {
  background-color: var(--color-neutral-bg);
  border: 1px solid var(--color-neutral-border);
  color: var(--color-neutral-text);
}

.table-legend-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 14px 24px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1200px) {
  .chart-sub-summary {
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
  }
  .bento-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .chart-sub-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .control-bar-container {
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 16px;
  }
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }

  .sticky-control-bar {
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .control-bar-container {
    height: auto;
    min-height: 50px;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 14px;
    gap: 10px;
  }

  .control-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .control-group--store {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .store-select-wrapper {
    flex: 1;
    min-width: 0;
  }

  .store-select-wrapper select {
    width: 100%;
    min-width: 0;
  }

  .control-group--period {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .period-mode-switch {
    display: flex;
    width: 100%;
  }

  .period-mode-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
    min-height: 38px;
  }

  .control-group--period .week-select-wrapper,
  .control-group--period .week-select-wrapper select {
    width: 100%;
    min-width: 0;
  }

  .control-group--period .date-range-inputs {
    width: 100%;
    display: flex;
    align-items: center;
  }

  .control-group--period .date-range-inputs input {
    flex: 1;
    min-width: 0;
  }

  .period-shortcuts {
    display: flex;
    width: 100%;
    gap: 6px;
    overflow-x: auto;
  }

  .period-shortcuts .btn-tag {
    flex: 1;
    text-align: center;
    justify-content: center;
    min-height: 36px;
  }

  .control-group--base {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .control-group--base .base-segmented-switch {
    flex: 1;
    display: flex;
  }

  .control-group--base .base-segmented-switch .btn-segment {
    flex: 1;
    text-align: center;
    justify-content: center;
    min-height: 36px;
  }

  .context-ribbon {
    height: auto;
    min-height: 30px;
    padding: 6px 0;
  }

  .context-container {
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px;
  }

  .context-left {
    width: 100%;
    white-space: normal;
    font-size: 11px;
  }

  .context-text {
    white-space: normal;
    font-size: 10.5px;
    line-height: 1.35;
  }

  .context-right {
    width: 100%;
    justify-content: space-between;
  }

  .btn-toggle,
  .btn-tag,
  .btn-segment,
  .btn-metric,
  .btn-action {
    min-height: 38px;
    padding: 8px 12px;
  }

  .lfl-matrix-table .th-main-header th:nth-child(1),
  .lfl-matrix-table tbody td:nth-child(1),
  .lfl-matrix-table tfoot td:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--color-surface);
  }

  .lfl-matrix-table .th-main-header th:nth-child(1) {
    z-index: 3;
    background: var(--color-surface-subtle, #F8FAFC);
  }

  .lfl-matrix-table .th-main-header th:nth-child(2),
  .lfl-matrix-table tbody td:nth-child(2),
  .lfl-matrix-table tfoot td:nth-child(2) {
    position: sticky;
    left: 32px;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: 2px 0 4px rgba(15, 23, 42, 0.08);
  }

  .lfl-matrix-table .th-main-header th:nth-child(2) {
    z-index: 3;
    background: var(--color-surface-subtle, #F8FAFC);
  }

  .lfl-matrix-table tfoot td:nth-child(1),
  .lfl-matrix-table tfoot td:nth-child(2) {
    background-color: var(--color-surface-subtle, #F8FAFC);
  }

  [data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(1),
  [data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(2),
  .dark-theme .lfl-matrix-table tfoot td:nth-child(1),
  .dark-theme .lfl-matrix-table tfoot td:nth-child(2) {
    background-color: var(--color-surface-subtle, #1E293B);
  }

  .chart-wrapper {
    height: 300px;
  }

  .chart-sub-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-main {
    padding: 16px 12px;
  }

  .hero-value {
    font-size: 24px;
  }
}

@media (max-width: 600px) {
  .lfl-matrix-table colgroup col:nth-child(1),
  .split-matrix-table colgroup col:nth-child(1) {
    display: none;
  }

  .lfl-matrix-table .th-main-header th:nth-child(1),
  .lfl-matrix-table tbody td:nth-child(1),
  .lfl-matrix-table tfoot td:nth-child(1) {
    display: none;
  }

  .lfl-matrix-table .th-main-header th:nth-child(2),
  .lfl-matrix-table tbody td:nth-child(2),
  .lfl-matrix-table tfoot td:nth-child(2) {
    left: 0;
    min-width: 180px;
    width: 180px;
    max-width: 180px;
  }

  .lfl-matrix-table tfoot td:nth-child(2) {
    background-color: var(--color-surface-subtle, #F8FAFC);
  }

  [data-theme="dark"] .lfl-matrix-table tfoot td:nth-child(2),
  .dark-theme .lfl-matrix-table tfoot td:nth-child(2) {
    background-color: var(--color-surface-subtle, #1E293B);
  }
}

/* Split Widget Section */
.bento-split-section {
  margin-top: 8px;
}
.split-card {
  padding: 20px 24px;
}
.split-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}
.split-note {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-style: italic;
}
.split-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

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

@media (max-width: 768px) {
  .split-grid {
    grid-template-columns: 1fr;
  }
}

.split-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.split-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.split-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.split-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  flex-grow: 1;
}
.split-pct {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--color-text);
}
.split-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 9999px;
  overflow: hidden;
}
.split-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.split-card--stock {
  border-top: 3px solid #78716C;
}
.split-bar-fill--stock {
  background-color: #78716C;
}

.split-segmented-bar {
  display: inline-flex;
  width: 130px;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  background-color: #E2E8F0;
  vertical-align: middle;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.split-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  overflow: hidden;
  transition: width 0.3s ease;
}

.split-seg--empty {
  display: none;
}

/* Business Unit Tabs */
.bu-tabs-container {
  width: 100%;
  max-width: 1440px;
  margin: 8px auto 6px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  box-sizing: border-box;
}

.bu-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.bu-tab:hover:not(.bu-tab--disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
  border-color: #CBD5E1;
}

.bu-tab.active {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

.bu-tab--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  border-color: var(--color-border);
}

.bu-badge {
  font-size: 10px;
  padding: 1.5px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.bu-tab.active .bu-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.bu-tab:not(.active) .bu-badge {
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* Split Matrix Table Specifics */
.split-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.split-pill--fw   { background: #EFF6FF; color: #1D4ED8; }
.split-pill--disc { background: #F5F3FF; color: #6D28D9; }
.split-pill--sale { background: #FFFBEB; color: #B45309; }
.split-pill--nos  { background: #ECFDF5; color: #047857; }
.split-pill--stock{ background: #F3F4F6; color: #4B5563; }

.split-empty {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: #CBD5E1;
  user-select: none;
}

.dominant-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
}

.split-table-total-row {
  background-color: var(--color-surface-subtle) !important;
  border-top: 2px solid var(--color-border) !important;
  color: var(--color-text-primary);
}

.split-table-total-label {
  color: var(--color-text-primary);
}

.split-table-dominant-total {
  color: var(--color-tag-text, #1D4ED8);
}

[data-theme="dark"] .split-table-dominant-total,
.dark-theme .split-table-dominant-total {
  color: #38BDF8;
}

/* Reset button in Context Ribbon: Apple/Linear minimal ghost micro-action */
.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-reset-filters:disabled,
.btn-reset-filters.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background-color: #F8FAFC;
  border-color: #E2E8F0;
  color: #94A3B8;
  box-shadow: none;
}

.btn-reset-filters:disabled .reset-icon,
.btn-reset-filters.disabled .reset-icon {
  color: #94A3B8;
}

.btn-reset-filters.active,
.btn-reset-filters:not(:disabled):not(.disabled) {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  background-color: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.btn-reset-filters:not(:disabled):not(.disabled):hover {
  background-color: #DBEAFE;
  border-color: #60A5FA;
  color: #1E40AF;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-reset-filters .reset-icon {
  font-size: 11px;
  font-weight: bold;
  color: #2563EB;
  line-height: 1;
  transition: transform 0.25s ease;
}

.btn-reset-filters:not(:disabled):not(.disabled):hover .reset-icon {
  transform: rotate(-90deg);
}


/* ==========================================================================
   Executive Tables: Master Layout & Alignment
   ========================================================================== */

/* Specific column widths for monolithic LFL matrix V0.0.3 (Sum: 1111px) */
/* Sequence: # (1), Store (2), GMV (3), Units (4), Checks (5), Traffic (6), UPT (7), CR (8), AOV (9), SVT (10), Split (11-15) */
.lfl-matrix-table .th-main-header th:nth-child(1) { width: 32px; max-width: 32px; }   /* # */
.lfl-matrix-table .th-main-header th:nth-child(2) { width: 180px; min-width: 180px; } /* Store */
.lfl-matrix-table .th-main-header th:nth-child(3) { width: 132px; }  /* GMV */
.lfl-matrix-table .th-main-header th:nth-child(4) { width: 90px; }   /* Units */
.lfl-matrix-table .th-main-header th:nth-child(5) { width: 90px; }   /* Checks */
.lfl-matrix-table .th-main-header th:nth-child(6) { width: 100px; }  /* Traffic */
.lfl-matrix-table .th-main-header th:nth-child(7) { width: 88px; }   /* UPT */
.lfl-matrix-table .th-main-header th:nth-child(8) { width: 93px; }   /* CR */
.lfl-matrix-table .th-main-header th:nth-child(9) { width: 110px; }  /* AOV / Середній чек */
.lfl-matrix-table .th-main-header th:nth-child(10){ width: 56px; }   /* SVT */
.lfl-matrix-table .th-main-header th:nth-child(11){ width: 52px; min-width: 52px; max-width: 52px; }   /* CURRENT FULL */
.lfl-matrix-table .th-main-header th:nth-child(12){ width: 52px; min-width: 52px; max-width: 52px; }   /* CURRENT DISC */
.lfl-matrix-table .th-main-header th:nth-child(13){ width: 52px; min-width: 52px; max-width: 52px; }   /* PREVIOUS SALE */
.lfl-matrix-table .th-main-header th:nth-child(14){ width: 52px; min-width: 52px; max-width: 52px; }   /* CORE БАЗА */
.lfl-matrix-table .th-main-header th:nth-child(15){ width: 52px; min-width: 52px; max-width: 52px; }   /* OUTLET СТОК */


/* Спеціальні стилі монолітної таблиці V0.0.1 */
.th-super-header th {
  background: var(--color-surface-subtle, #F8FAFC);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border, #E2E8F0);
}
.th-super--location { color: var(--color-text-muted, #64748B); }
.th-super--lfl { color: var(--color-text-primary, #0F172A); text-align: center; }
.th-super--split { color: #3B82F6; text-align: center; border-left: 2px solid var(--color-border, #E2E8F0); }

.th-split-first,
.td-split-first {
  border-left: 2px solid var(--color-border, #E2E8F0);
}

.th-split-col,
.td-split-col,
.lfl-matrix-table tfoot .td-split-col {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  text-align: center;
  padding: 6px 0;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.th-split-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  padding: 1px 0;
  gap: 1px;
}

.th-split-sub {
  font-size: 8px;
  font-weight: 600;
  color: #94A3B8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.th-split-main {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.th-split-main--fw   { color: #2563EB; }
.th-split-main--disc { color: #7C3AED; }
.th-split-main--sale { color: #D97706; }
.th-split-main--nos  { color: #059669; }
.th-split-main--stock{ color: #475569; }

.th-split-col .th-label,
.td-split-col .split-val,
.td-split-col .split-empty,
.lfl-matrix-table tfoot .td-split-col .split-val {
  display: block;
  text-align: center;
  width: 100%;
  margin: 0 auto;
}

.split-val {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.split-val--fw   { color: #2563EB; }
.split-val--disc { color: #7C3AED; }
.split-val--sale { color: #D97706; }
.split-val--nos  { color: #059669; }
.split-val--stock{ color: #475569; }
.split-val--muted{ color: #94A3B8; }

.split-stack-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.1;
  width: 100%;
  padding: 2px 0;
  position: relative;
}

.split-micro-delta {
  font-size: 9px;
  font-weight: 500;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.split-micro-delta--pos {
  color: #059669;
}

.split-micro-delta--neg {
  color: #E11D48;
}

.split-micro-delta--zero {
  color: #94A3B8;
  font-weight: 500;
}

/* Micro-Bar Spectrum: 2px fill track */
.split-bar-track {
  width: 32px;
  height: 2px;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  margin: 2px auto 0 auto;
  overflow: hidden;
}

.split-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.split-bar-fill--fw   { background-color: #2563EB; }
.split-bar-fill--disc { background-color: #7C3AED; }
.split-bar-fill--sale { background-color: #D97706; }
.split-bar-fill--nos  { background-color: #059669; }
.split-bar-fill--stock{ background-color: #475569; }

[data-theme="dark"] .split-micro-delta--pos,
.dark-theme .split-micro-delta--pos {
  color: #34D399 !important;
}

[data-theme="dark"] .split-micro-delta--neg,
.dark-theme .split-micro-delta--neg {
  color: #FB7185 !important;
}

[data-theme="dark"] .split-micro-delta--zero,
.dark-theme .split-micro-delta--zero {
  color: #64748B !important;
}

/* Dark Theme Assortment Split Colors (High Contrast & Legible) */
[data-theme="dark"] .th-split-main--fw,
.dark-theme .th-split-main--fw,
[data-theme="dark"] .split-val--fw,
.dark-theme .split-val--fw {
  color: #60A5FA !important; /* Sky 400 */
}

[data-theme="dark"] .th-split-main--disc,
.dark-theme .th-split-main--disc,
[data-theme="dark"] .split-val--disc,
.dark-theme .split-val--disc {
  color: #A78BFA !important; /* Purple 400 */
}

[data-theme="dark"] .th-split-main--sale,
.dark-theme .th-split-main--sale,
[data-theme="dark"] .split-val--sale,
.dark-theme .split-val--sale {
  color: #FBBF24 !important; /* Amber 400 */
}

[data-theme="dark"] .th-split-main--nos,
.dark-theme .th-split-main--nos,
[data-theme="dark"] .split-val--nos,
.dark-theme .split-val--nos {
  color: #34D399 !important; /* Emerald 400 */
}

[data-theme="dark"] .th-split-main--stock,
.dark-theme .th-split-main--stock,
[data-theme="dark"] .split-val--stock,
.dark-theme .split-val--stock {
  color: #94A3B8 !important; /* Slate 400 */
}

[data-theme="dark"] .split-bar-fill--fw,
.dark-theme .split-bar-fill--fw { background-color: #60A5FA; }
[data-theme="dark"] .split-bar-fill--disc,
.dark-theme .split-bar-fill--disc { background-color: #A78BFA; }
[data-theme="dark"] .split-bar-fill--sale,
.dark-theme .split-bar-fill--sale { background-color: #FBBF24; }
[data-theme="dark"] .split-bar-fill--nos,
.dark-theme .split-bar-fill--nos { background-color: #34D399; }
[data-theme="dark"] .split-bar-fill--stock,
.dark-theme .split-bar-fill--stock { background-color: #94A3B8; }

[data-theme="dark"] .th-split-main--stock,
.dark-theme .th-split-main--stock,
[data-theme="dark"] .split-val--stock,
.dark-theme .split-val--stock {
  color: #94A3B8 !important; /* Slate 400 */
}

[data-theme="dark"] .split-val--muted,
.dark-theme .split-val--muted {
  color: #64748B !important; /* Slate 500 */
}



/* ==========================================================================
   UltraGroup 360 — Annual Dashboard & New Store Tokens (Steve Jobs Spec)
   ========================================================================== */

/* 1. Header Period Selector Tweaks */
.week-select-wrapper select.week-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-weight: 500;
  font-size: 12px;
  color: var(--color-text-primary, #0F172A);
  background-color: var(--color-surface, #FFFFFF);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.week-select-wrapper select.week-select:hover {
  border-color: var(--color-border-subtle, #CBD5E1);
}

.week-select-wrapper select.week-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.week-select-wrapper select optgroup {
  font-weight: 700;
  font-size: 11.5px;
  color: var(--color-text-secondary, #475569);
  background: var(--color-surface-subtle, #F8FAFC);
}

.week-select-wrapper select option {
  font-weight: 400;
  font-size: 12.5px;
  color: var(--color-text-primary, #0F172A);
  background: var(--color-surface, #FFFFFF);
  padding: 4px 6px;
}

/* 2. Store Micro-Token [NEW] */
.store-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  overflow: hidden;
}

.badge-store-lfl,
.badge--lfl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 16px;
  padding: 0 6px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  min-width: 38px;
  color: #047857;
  background-color: #ECFDF5;
  border: 1px solid #A7F3D0;
  cursor: help;
  user-select: none;
}

.badge-store-closed,
.badge--closed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 16px;
  padding: 0 6px;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  min-width: 38px;
  color: #64748B;
  background-color: #F1F5F9;
  border: 1px solid #CBD5E1;
  cursor: help;
  user-select: none;
}

tr:has(.badge--closed),
tr:has(.badge-store-closed),
.row--closed,
.store-closed {
  opacity: 1;
}

tr:has(.badge--closed) td:not(:first-child):not(:nth-child(2)),
tr:has(.badge-store-closed) td:not(:first-child):not(:nth-child(2)),
.row--closed td:not(:first-child):not(:nth-child(2)),
.store-closed td:not(:first-child):not(:nth-child(2)) {
  opacity: 0.6;
}

.badge-store-new:hover,
.badge--new:hover,
.badge-new:hover {
  background-color: #E0E7FF;
  border-color: #A5B4FC;
}

.badge-store-lfl:hover,
.badge--lfl:hover {
  background-color: #D1FAE5;
  border-color: #6EE7B7;
}

.badge-store-closed:hover,
.badge--closed:hover {
  background-color: #E2E8F0;
  border-color: #94A3B8;
}

/* 3. Muted Bento Card & Cell States */
.bento-card--muted {
  background-color: #FAFAFA;
  border-color: #E2E8F0;
}

.bento-card--muted .hero-value {
  color: #94A3B8;
  font-weight: 500;
}

.bento-card--muted .bento-icon {
  opacity: 0.6;
}

.delta-badge--na {
  background-color: #F1F5F9;
  color: #64748B;
  border: 1px solid #CBD5E1;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}

.chip-item--muted {
  background-color: #F1F5F9;
  color: #64748B;
  font-size: 11px;
  font-weight: 500;
  border: 1px dashed #CBD5E1;
  padding: 3px 8px;
  border-radius: 4px;
}

.cell-val--muted,
.cell-val.cell-val--muted,
.hero-value.cell-val--muted {
  color: #94A3B8;
  font-weight: 500;
}

/* ==========================================================================
   Dark Mode Overrides: Status Badges (docs/UI_SPEC_DARK_THEME.md section 4.1)
   ========================================================================== */
[data-theme="dark"] .badge-store-lfl,
[data-theme="dark"] .badge--lfl,
.dark-theme .badge-store-lfl,
.dark-theme .badge--lfl {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34D399 !important;
  border: 1px solid rgba(52, 211, 153, 0.35) !important;
}

[data-theme="dark"] .badge-store-lfl:hover,
[data-theme="dark"] .badge--lfl:hover,
.dark-theme .badge-store-lfl:hover,
.dark-theme .badge--lfl:hover {
  background-color: rgba(16, 185, 129, 0.25) !important;
  border-color: rgba(52, 211, 153, 0.5) !important;
}

[data-theme="dark"] .badge-store-new,
[data-theme="dark"] .badge--new,
[data-theme="dark"] .badge-new,
.dark-theme .badge-store-new,
.dark-theme .badge--new,
.dark-theme .badge-new {
  background-color: rgba(99, 102, 241, 0.15) !important;
  color: #818CF8 !important;
  border: 1px solid rgba(129, 140, 248, 0.35) !important;
}

[data-theme="dark"] .badge-store-new:hover,
[data-theme="dark"] .badge--new:hover,
[data-theme="dark"] .badge-new:hover,
.dark-theme .badge-store-new:hover,
.dark-theme .badge--new:hover,
.dark-theme .badge-new:hover {
  background-color: rgba(99, 102, 241, 0.25) !important;
  border-color: rgba(129, 140, 248, 0.5) !important;
}

[data-theme="dark"] .badge-store-closed,
[data-theme="dark"] .badge--closed,
.dark-theme .badge-store-closed,
.dark-theme .badge--closed {
  background-color: rgba(100, 116, 139, 0.15) !important;
  color: #94A3B8 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

[data-theme="dark"] .badge-store-closed:hover,
[data-theme="dark"] .badge--closed:hover,
.dark-theme .badge-store-closed:hover,
.dark-theme .badge--closed:hover {
  background-color: rgba(100, 116, 139, 0.25) !important;
  border-color: rgba(148, 163, 184, 0.45) !important;
}

/* ==========================================================================
   Dark Mode Overrides: Table Search Input & Search Box (UI Spec Section 4.3)
   ========================================================================== */
[data-theme="dark"] .table-search-box,
.dark-theme .table-search-box {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

[data-theme="dark"] .table-search-box:focus-within,
.dark-theme .table-search-box:focus-within {
  border: none !important;
  box-shadow: none !important;
}

[data-theme="dark"] .table-search-box .search-input,
[data-theme="dark"] #storeSearchInput,
.dark-theme .table-search-box .search-input,
.dark-theme #storeSearchInput {
  background-color: var(--color-surface-subtle, #0B0F17) !important;
  color: var(--color-text-primary, #F8FAFC) !important;
  border: 1px solid var(--color-border, #334155) !important;
  padding-left: 34px !important;
  padding-right: 30px !important;
}

[data-theme="dark"] .table-search-box .search-input:hover,
[data-theme="dark"] #storeSearchInput:hover,
.dark-theme .table-search-box .search-input:hover,
.dark-theme #storeSearchInput:hover {
  border-color: #475569 !important;
}

[data-theme="dark"] .table-search-box .search-input:focus,
[data-theme="dark"] #storeSearchInput:focus,
.dark-theme .table-search-box .search-input:focus,
.dark-theme #storeSearchInput:focus {
  border-color: #38BDF8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25) !important;
}

[data-theme="dark"] .table-search-box .search-input::placeholder,
[data-theme="dark"] #storeSearchInput::placeholder,
.dark-theme .table-search-box .search-input::placeholder,
.dark-theme #storeSearchInput::placeholder {
  color: var(--color-text-muted, #64748B) !important;
}

[data-theme="dark"] .table-search-box .search-icon,
.dark-theme .table-search-box .search-icon {
  color: var(--color-text-muted, #64748B) !important;
}

[data-theme="dark"] .table-search-box:focus-within .search-icon,
.dark-theme .table-search-box:focus-within .search-icon {
  color: #38BDF8 !important;
}

[data-theme="dark"] .table-search-box .search-clear-btn,
[data-theme="dark"] .table-search-box .btn-clear,
.dark-theme .table-search-box .search-clear-btn,
.dark-theme .table-search-box .btn-clear {
  color: var(--color-text-muted, #64748B) !important;
}

[data-theme="dark"] .table-search-box .search-clear-btn:hover,
[data-theme="dark"] .table-search-box .btn-clear:hover,
.dark-theme .table-search-box .search-clear-btn:hover,
.dark-theme .table-search-box .btn-clear:hover {
  color: var(--color-text-primary, #F8FAFC) !important;
}

/* ==========================================================================
   Dark Mode Overrides: Matrix Table Rows & Cell States (UI Spec Section 4.2)
   ========================================================================== */
.lfl-matrix-table tbody tr:hover,
[data-theme="dark"] .lfl-matrix-table tbody tr:hover,
[data-theme="dark"] .lfl-matrix-table tbody tr:hover td,
.dark-theme .lfl-matrix-table tbody tr:hover,
.dark-theme .lfl-matrix-table tbody tr:hover td {
  background-color: var(--color-surface-hover, #1E293B) !important;
}

.lfl-matrix-table tbody tr.row-selected,
.lfl-matrix-table tbody tr.row-selected:hover,
[data-theme="dark"] .lfl-matrix-table tr.row-selected,
[data-theme="dark"] .lfl-matrix-table tr.row-selected td,
.dark-theme .lfl-matrix-table tr.row-selected,
.dark-theme .lfl-matrix-table tr.row-selected td {
  background-color: rgba(56, 189, 248, 0.12) !important;
}

[data-theme="dark"] .lfl-matrix-table th,
.dark-theme .lfl-matrix-table th {
  background-color: var(--color-surface, #1E293B) !important;
  color: var(--color-text-secondary, #CBD5E1) !important;
  border-bottom: 2px solid var(--color-border, #334155) !important;
}

[data-theme="dark"] .th-super-header th,
.dark-theme .th-super-header th {
  background: var(--color-surface-subtle, #0F172A) !important;
  border-bottom: 1px solid var(--color-border, #334155) !important;
}

[data-theme="dark"] .th-super--location,
.dark-theme .th-super--location {
  color: var(--color-text-muted, #94A3B8) !important;
}

[data-theme="dark"] .th-super--lfl,
.dark-theme .th-super--lfl {
  color: var(--color-text-primary, #F8FAFC) !important;
}

[data-theme="dark"] .th-super--split,
.dark-theme .th-super--split {
  color: #38BDF8 !important;
  border-left: 2px solid var(--color-border, #334155) !important;
}

[data-theme="dark"] .th-split-first,
[data-theme="dark"] .td-split-first,
.dark-theme .th-split-first,
.dark-theme .td-split-first {
  border-left: 2px solid var(--color-border, #334155) !important;
}

[data-theme="dark"] .th-main-header th,
.dark-theme .th-main-header th {
  background: var(--color-surface, #1E293B) !important;
}

[data-theme="dark"] .bento-card--muted,
.dark-theme .bento-card--muted {
  background-color: var(--color-surface-subtle, #0F172A) !important;
  border-color: var(--color-border, #334155) !important;
}

[data-theme="dark"] .bento-card--muted .hero-value,
.dark-theme .bento-card--muted .hero-value {
  color: #64748B !important;
}

[data-theme="dark"] .delta-badge--na,
.dark-theme .delta-badge--na {
  background-color: rgba(100, 116, 139, 0.2) !important;
  color: #94A3B8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

[data-theme="dark"] .chip-item--muted,
.dark-theme .chip-item--muted {
  background-color: rgba(100, 116, 139, 0.15) !important;
  color: #94A3B8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

[data-theme="dark"] .cell-val--muted,
[data-theme="dark"] .cell-val.cell-val--muted,
[data-theme="dark"] .hero-value.cell-val--muted,
.dark-theme .cell-val--muted,
.dark-theme .cell-val.cell-val--muted,
.dark-theme .hero-value.cell-val--muted {
  color: #64748B !important;
}

/* 1. Кнопка «Експорт CSV» в темной теме */
[data-theme="dark"] .btn-action--export,
.dark-theme .btn-action--export {
  background: rgba(56, 189, 248, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #38BDF8 !important;
}

/* 2. Карточки дней недели (day-summary-cell) в темной теме */
[data-theme="dark"] .day-summary-cell,
html.dark-theme .day-summary-cell,
body.dark-theme .day-summary-cell,
.dark-theme .day-summary-cell {
  background-color: #151E2E !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .day-summary-cell:hover,
html.dark-theme .day-summary-cell:hover,
body.dark-theme .day-summary-cell:hover,
.dark-theme .day-summary-cell:hover {
  background-color: #1E293B !important;
  border-color: #334155 !important;
}

[data-theme="dark"] .day-summary-cell.active-day,
html.dark-theme .day-summary-cell.active-day,
body.dark-theme .day-summary-cell.active-day,
.dark-theme .day-summary-cell.active-day {
  background-color: rgba(56, 189, 248, 0.16) !important;
  border-color: #38BDF8 !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.25) !important;
}

[data-theme="dark"] .day-summary-cell .day-name-label,
html.dark-theme .day-summary-cell .day-name-label,
body.dark-theme .day-summary-cell .day-name-label,
.dark-theme .day-summary-cell .day-name-label {
  color: #94A3B8 !important;
}

[data-theme="dark"] .day-summary-cell .day-fact-val,
html.dark-theme .day-summary-cell .day-fact-val,
body.dark-theme .day-summary-cell .day-fact-val,
.dark-theme .day-summary-cell .day-fact-val {
  color: #F8FAFC !important;
}

/* 3. Фильтры и бейджи контекстной ленты (Context Ribbon) в темной теме */
[data-theme="dark"] .context-filter-tag,
html.dark-theme .context-filter-tag,
body.dark-theme .context-filter-tag,
.dark-theme .context-filter-tag {
  background-color: rgba(56, 189, 248, 0.15) !important;
  color: #38BDF8 !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] .btn-reset-filters,
html.dark-theme .btn-reset-filters,
body.dark-theme .btn-reset-filters,
.dark-theme .btn-reset-filters {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #94A3B8 !important;
}

[data-theme="dark"] .btn-reset-filters:disabled,
[data-theme="dark"] .btn-reset-filters.disabled,
.dark-theme .btn-reset-filters:disabled,
.dark-theme .btn-reset-filters.disabled {
  background-color: rgba(255, 255, 255, 0.02) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #64748B !important;
  opacity: 0.45 !important;
}

[data-theme="dark"] .btn-reset-filters:not(:disabled):not(.disabled),
[data-theme="dark"] .btn-reset-filters.active,
.dark-theme .btn-reset-filters:not(:disabled):not(.disabled),
.dark-theme .btn-reset-filters.active {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #F8FAFC !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .btn-reset-filters:not(:disabled):not(.disabled):hover,
.dark-theme .btn-reset-filters:not(:disabled):not(.disabled):hover {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #FFFFFF !important;
}

[data-theme="dark"] .btn-reset-filters .reset-icon,
.dark-theme .btn-reset-filters .reset-icon {
  color: #94A3B8 !important;
}

[data-theme="dark"] .btn-reset-filters:not(:disabled):not(.disabled) .reset-icon,
.dark-theme .btn-reset-filters:not(:disabled):not(.disabled) .reset-icon {
  color: #38BDF8 !important;
}

/* 4. Строка закрытого магазина (.row--closed, .store-closed) в темной теме */
[data-theme="dark"] .row--closed,
.dark-theme .row--closed,
[data-theme="dark"] .store-closed,
.dark-theme .store-closed,
[data-theme="dark"] tr:has(.badge--closed),
[data-theme="dark"] tr:has(.badge-store-closed),
.dark-theme tr:has(.badge--closed),
.dark-theme tr:has(.badge-store-closed) {
  opacity: 1 !important;
}

[data-theme="dark"] .row--closed td:not(:first-child):not(:nth-child(2)),
.dark-theme .row--closed td:not(:first-child):not(:nth-child(2)),
[data-theme="dark"] .store-closed td:not(:first-child):not(:nth-child(2)),
.dark-theme .store-closed td:not(:first-child):not(:nth-child(2)),
[data-theme="dark"] tr:has(.badge--closed) td:not(:first-child):not(:nth-child(2)),
[data-theme="dark"] tr:has(.badge-store-closed) td:not(:first-child):not(:nth-child(2)),
.dark-theme tr:has(.badge--closed) td:not(:first-child):not(:nth-child(2)),
.dark-theme tr:has(.badge-store-closed) td:not(:first-child):not(:nth-child(2)) {
  opacity: 0.6 !important;
}

/* 5. Smooth Theme Transitions (Specific Properties Only - Avoid Initial Layout FOUC) */
html,
body,
.bento-card,
.section-card,
.table-scroll-container,
th {
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

@media (prefers-reduced-motion: reduce) {
  html,
  body,
  .bento-card,
  .section-card,
  .table-scroll-container,
  th,
  * {
    transition: none !important;
    animation: none !important;
  }
}



/* Daily data navigation */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


.period-coverage {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--color-success-border);
  border-radius: 999px;
  color: var(--color-success-text);
  background: var(--color-success-bg);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.period-coverage::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--color-success-base);
}

.period-coverage.is-partial {
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
  background: var(--color-warning-bg);
}

.period-coverage.is-partial::before {
  background: var(--color-warning-base);
}

.period-shortcuts .btn-tag:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .week-select-wrapper {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .date-range-inputs {
  display: flex !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .period-shortcuts {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .period-coverage {
  display: inline-flex !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .control-divider {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="WEEK"].active) .week-select-wrapper {
  display: flex !important;
}

.control-group--period:has(.period-mode-btn[data-mode="WEEK"].active) .date-range-inputs {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="WEEK"].active) .period-shortcuts {
  display: grid !important;
}

.control-group--period:has(.period-mode-btn[data-mode="WEEK"].active) .period-coverage {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="RANGE"].active) .week-select-wrapper {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="RANGE"].active) .date-range-inputs {
  display: flex !important;
}

.control-group--period:has(.period-mode-btn[data-mode="RANGE"].active) .period-shortcuts {
  display: grid !important;
}

.control-group--period:has(.period-mode-btn[data-mode="RANGE"].active) .period-coverage {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="DAY"].active) .month-select-wrapper {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="WEEK"].active) .month-select-wrapper {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="MONTH"].active) .week-select-wrapper {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="MONTH"].active) .month-select-wrapper {
  display: flex !important;
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
}

.control-group--period:has(.period-mode-btn[data-mode="MONTH"].active) .date-range-inputs {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="MONTH"].active) .period-shortcuts {
  display: grid !important;
}

.control-group--period:has(.period-mode-btn[data-mode="MONTH"].active) .period-coverage {
  display: none !important;
}

.control-group--period:has(.period-mode-btn[data-mode="RANGE"].active) .month-select-wrapper {
  display: none !important;
}

.control-bar-container:has(.period-mode-btn[data-mode="MONTH"].active) .base-segmented-switch {
  display: none !important;
}

.control-bar-container:has(.period-mode-btn[data-mode="MONTH"].active) .base-month-select-wrapper {
  display: flex !important;
  width: 200px !important;
  min-width: 200px !important;
  max-width: 200px !important;
}

@media (max-width: 1100px) {
  .control-island--time {
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .control-island--time {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    gap: 12px;
  }
  .control-divider {
    display: none;
  }
  .control-group--period {
    align-items: stretch;
  }
  .period-mode-switch {
    width: 100%;
  }
  .period-mode-btn {
    flex: 1;
    min-height: 42px;
  }
  .control-group--period .week-select-wrapper,
  .control-group--period .week-select-wrapper select,
  .control-group--period .month-select-wrapper,
  .control-group--period .month-select-wrapper select,
  .control-group--base .base-month-select-wrapper,
  .control-group--base .base-month-select-wrapper select {
    width: 100%;
    min-width: 0;
  }
  .control-group--period .date-range-inputs {
    width: 100%;
  }
  .control-group--period .date-range-inputs input {
    min-width: 0;
    flex: 1;
  }
  .period-coverage {
    width: fit-content;
  }
}

/* ==========================================================================
   Upload Modal & Operational Data Styling
   ========================================================================== */
.btn-upload-data {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--color-text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-upload-data:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border-color: rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
  background-color: var(--color-surface-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header-icon {
  color: var(--color-primary, #6366f1);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upload-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.form-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-input {
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--color-primary, #6366f1);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }
}

.upload-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pane-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md, 10px);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background-color: var(--color-surface-subtle);
  transition: all 0.2s ease;
  position: relative;
}

.dropzone:hover, .dropzone--active {
  border-color: var(--color-primary, #6366f1);
  background-color: rgba(99, 102, 241, 0.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dropzone-icon {
  color: var(--color-text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.dropzone:hover .dropzone-icon,
.dropzone--active .dropzone-icon {
  color: var(--color-primary, #6366f1);
  transform: translateY(-2px);
}

.dropzone-text {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.dropzone-text span {
  color: var(--color-primary, #6366f1);
  font-weight: 600;
  text-decoration: underline;
}

.file-name-badge {
  background-color: var(--color-primary, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm, 6px);
  max-width: 90%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.upload-traffic-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 10px);
  padding: 16px;
}

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

.pane-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.traffic-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.traffic-field {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.traffic-field:hover {
  border-color: var(--color-border-hover, #94a3b8);
}

.traffic-field:focus-within {
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.traffic-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.traffic-field input {
  padding: 5px 8px;
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 600;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 5px);
  color: var(--color-text-primary);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.traffic-field input:focus {
  background-color: var(--color-surface);
  border-color: var(--color-primary, #6366f1);
}

.upload-preview-section {
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-primary, #6366f1);
}

.preview-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.preview-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.preview-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.preview-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

.highlight-gmv {
  color: #10b981;
}

.upload-status-msg {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: none;
}

.upload-status-msg:not(:empty) {
  display: block;
}

.upload-status--loading {
  background-color: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.upload-status--success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.upload-status--warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.upload-status--error {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-surface-subtle);
}

/* ==========================================================================
   Universal Button Styles (Modal, Actions)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 8px 18px;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  text-decoration: none;
  min-height: 38px;
  box-sizing: border-box;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary, #6366f1);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  pointer-events: none;
}

.btn-secondary {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-surface-hover);
  border-color: var(--color-border-hover, #94a3b8);
  color: var(--color-text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Bento Card Polish */
.bento-card {
  min-height: 213px !important;
  display: flex !important;
  flex-direction: column !important;
}

.bento-footer {
  margin-top: auto !important;
}

.delta-badge {
  min-width: max-content !important;
  white-space: nowrap !important;
}

/* ==========================================================================
   EXECUTIVE GATE & AUTHENTICATION OVERLAY (P3 RELEASE)
   Executive Ivory (Day) & Executive Obsidian (Night) Glassmorphism
   ========================================================================== */

/* User Profile Pill & Logout in Header (Executive Luxury Design) */
.user-profile-pill {
  display: inline-flex;
  align-items: center;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.user-profile-pill.hidden {
  display: none !important;
}

.user-badge-symbol,
.user-name-label {
  display: none !important;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 11px;
  border-radius: var(--radius-sm, 6px);
  background-color: var(--color-surface-subtle, rgba(241, 245, 249, 0.8));
  border: 1px solid var(--color-border, #CBD5E1);
  color: var(--color-text-secondary, #64748B);
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-logout .logout-icon,
.btn-logout svg {
  width: 13px;
  height: 13px;
  color: currentColor;
  opacity: 0.85;
  transition: transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.btn-logout:hover {
  background-color: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
  color: #DC2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.08);
}

.btn-logout:hover .logout-icon,
.btn-logout:hover svg {
  opacity: 1;
  transform: translateX(1.5px);
}

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

.btn-logout:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.4);
  outline-offset: 1px;
}

/* Dark mode overrides for Logout Button */
[data-theme="dark"] .btn-logout,
.dark-theme .btn-logout {
  background-color: rgba(30, 41, 59, 0.7);
  border-color: #334155;
  color: #94A3B8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .btn-logout:hover,
.dark-theme .btn-logout:hover {
  background-color: rgba(239, 68, 68, 0.14);
  border-color: rgba(248, 113, 113, 0.4);
  color: #F87171;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

/* Executive Gate Overlay */
.executive-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--bg-app);
  background-image: radial-gradient(rgba(15, 23, 42, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

[data-theme="dark"] .executive-gate,
.dark-theme .executive-gate {
  background-color: #070B12;
  background-image: radial-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px);
}

.executive-gate.gate-hidden {
  display: none !important;
}

.executive-gate.gate-dissolve {
  opacity: 0;
  transform: scale(1.03);
  pointer-events: none;
}

.gate-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.gate-top-bar {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 10;
}

.gate-theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.gate-container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 400px;
  padding: 16px;
}

/* Glassmorphism Card — Compact Executive Proportions */
.gate-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  padding: 28px 26px 20px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  transform-style: preserve-3d;
}

.gate-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: radial-gradient(320px circle at var(--mouse-x, 50%) var(--mouse-y, 0%), rgba(217, 119, 6, 0.45), transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

[data-theme="dark"] .gate-card,
.dark-theme .gate-card {
  background: rgba(17, 24, 39, 0.84);
  border: 1px solid rgba(56, 189, 248, 0.18);
  box-shadow: 0 25px 55px -12px rgba(0, 0, 0, 0.75), 0 0 30px -5px rgba(56, 189, 248, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

[data-theme="dark"] .gate-card::before,
.dark-theme .gate-card::before {
  background: radial-gradient(320px circle at var(--mouse-x, 50%) var(--mouse-y, 0%), rgba(56, 189, 248, 0.5), transparent 70%);
}

.gate-card-sheen {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 70%);
  pointer-events: none;
}

[data-theme="dark"] .gate-card-sheen,
.dark-theme .gate-card-sheen {
  background: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.08), transparent 70%);
}

/* Card Branding & Header */
.gate-header {
  text-align: left;
  margin-bottom: 20px;
}

.gate-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.gate-brand-symbol {
  color: #D97706;
  font-size: 14px;
  line-height: 1;
}

[data-theme="dark"] .gate-brand-symbol,
.dark-theme .gate-brand-symbol {
  color: #F59E0B;
}

.gate-brand-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.gate-badge-pill {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 9999px;
  background: rgba(217, 119, 6, 0.1);
  color: #B45309;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .gate-badge-pill,
.dark-theme .gate-badge-pill {
  background: rgba(56, 189, 248, 0.12);
  color: #38BDF8;
  border-color: rgba(56, 189, 248, 0.28);
}

.gate-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.gate-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* Form Fields */
.gate-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.gate-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.gate-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.gate-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.gate-input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s ease;
}

.gate-input-wrapper:focus-within .gate-input-icon {
  color: #D97706;
}

[data-theme="dark"] .gate-input-wrapper:focus-within .gate-input-icon,
.dark-theme .gate-input-wrapper:focus-within .gate-input-icon {
  color: #38BDF8;
}

.gate-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 38px;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  color: #0F172A;
  transition: border-color 0.18s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.18s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.18s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

[data-theme="dark"] .gate-input,
.dark-theme .gate-input {
  background: #0B0F17;
  border-color: #243044;
  color: #F8FAFC;
  box-shadow: none;
}

.gate-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: #D97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.20), 0 2px 10px rgba(217, 119, 6, 0.10);
}

[data-theme="dark"] .gate-input:focus,
.dark-theme .gate-input:focus {
  background: #111827;
  border-color: #38BDF8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 2px 12px rgba(56, 189, 248, 0.12);
}

.gate-eye-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.gate-eye-btn:hover {
  color: var(--text-primary);
}

.gate-eye-btn.eye-open .icon-eye-show {
  display: none !important;
}

.gate-eye-btn.eye-open .icon-eye-hide {
  display: inline-block !important;
}

/* Options: Remember Me & Hint */
.gate-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  margin-top: -2px;
}

.gate-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
}

.gate-checkbox {
  accent-color: #D97706;
  cursor: pointer;
}

[data-theme="dark"] .gate-checkbox,
.dark-theme .gate-checkbox {
  accent-color: #38BDF8;
}

.gate-hint-text {
  color: var(--text-muted);
  font-size: 11px;
}

/* Error Banner */
.gate-error-banner {
  display: none;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  color: #9F1239;
  animation: fadeIn 0.2s ease;
}

[data-theme="dark"] .gate-error-banner,
.dark-theme .gate-error-banner {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
  color: #FCA5A5;
}

.gate-error-banner.visible {
  display: block;
}

/* Action Button */
.gate-submit-btn {
  position: relative;
  overflow: hidden;
  height: 42px;
  border-radius: 8px;
  background: #0F172A;
  color: #FFFFFF;
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
  transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.2s ease, background 0.2s ease;
}

.gate-submit-btn:active:not(:disabled) {
  transform: scale(0.985);
}

[data-theme="dark"] .gate-submit-btn,
.dark-theme .gate-submit-btn {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  box-shadow: 0 4px 20px rgba(2, 132, 199, 0.35);
}

.gate-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
}

[data-theme="dark"] .gate-submit-btn:hover:not(:disabled),
.dark-theme .gate-submit-btn:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(2, 132, 199, 0.45);
}

/* Luxury Sheen Sweep Animation */
.gate-submit-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: translateX(-150%) skewX(-20deg);
  animation: gateSheenSweep 6s infinite ease-in-out;
}

@keyframes gateSheenSweep {
  0% { transform: translateX(-150%) skewX(-20deg); }
  20%, 100% { transform: translateX(250%) skewX(-20deg); }
}

.gate-submit-btn .gate-btn-arrow {
  transition: transform 0.2s ease;
}

.gate-submit-btn:hover:not(:disabled) .gate-btn-arrow {
  transform: translateX(3px);
}

.gate-submit-btn.loading .gate-btn-text,
.gate-submit-btn.loading .gate-btn-arrow {
  display: none;
}

.gate-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: gateSpin 0.7s linear infinite;
}

.gate-submit-btn.loading .gate-spinner {
  display: inline-block;
}

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

/* Card Shake & Success animations */
.gate-card.gate-card--shake {
  animation: gateShake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes gateShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.gate-card.gate-card--success {
  border-color: var(--color-success-base);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.25);
  transition: all 0.35s ease;
}

/* Footer security badge */
.gate-card-footer {
  margin-top: 18px;
  text-align: center;
}

.gate-footer-security {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .gate-submit-btn::after {
    animation: none;
  }
  .gate-card.gate-card--shake {
    animation: none;
  }
  .executive-gate {
    transition: opacity 0.1s ease;
  }
}

/* Standalone Login Page & Success State */
.login-page-body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Strict Hidden utility */
.hidden,
[hidden],
.gate-form.hidden,
.gate-success-view.hidden {
  display: none !important;
}

.gate-success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 4px 0;
  animation: fadeIn 0.3s ease;
}

.gate-success-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.gate-success-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.gate-success-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 8px;
  line-height: 1.45;
}

.gate-success-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.gate-link-btn {
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  font-size: 13.5px;
}

.gate-switch-user-btn {
  margin: 2px auto 0;
  cursor: pointer;
}

