/* ==========================================================================
   APGMRS Branded Design System
   Brand Identity: Blue Palette / White Surfaces / Thamanya Typography
   ========================================================================== */

/* Thamanya (Thmanyah Sans) Typography System */
@font-face {
  font-family: 'Thamanya';
  src: url('/fonts/thmanyahsans-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thamanya';
  src: url('/fonts/thmanyahsans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thamanya';
  src: url('/fonts/thmanyahsans-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thamanya';
  src: url('/fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thamanya';
  src: url('/fonts/thmanyahsans-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('/fonts/thmanyahsans-Light.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('/fonts/thmanyahsans-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('/fonts/thmanyahsans-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('/fonts/thmanyahsans-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Thmanyah Sans';
  src: url('/fonts/thmanyahsans-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
  /* ------------------------------------------------------------
     1. BRAND IDENTITY
     ------------------------------------------------------------ */
  --brand-primary: #0057D9;
  --brand-primary-hover: #004BC0;
  --brand-primary-active: #003FA8;
  --brand-blue: #0067E8;
  --brand-bright: #1683F5;
  --brand-deep: #003BB5;
  --brand-light: #DCEEFF;
  --brand-lighter: #EEF7FF;
  --brand-gradient: linear-gradient(135deg, #003BB5 0%, #0057D9 45%, #1683F5 100%);
  --white: #FFFFFF;

  /* Backward compatibility for blue tokens */
  --blue-400: var(--brand-bright);
  --blue-500: var(--brand-blue);
  --blue-600: var(--brand-primary);
  --blue-700: var(--brand-deep);
  --blue-950: #001f5c;

  /* ------------------------------------------------------------
     2. SEMANTIC COLORS
     ------------------------------------------------------------ */
  --semantic-success: #16A34A;
  --semantic-success-light: #DCFCE7;
  --semantic-success-dark: #15803D;

  --semantic-warning: #F59E0B;
  --semantic-warning-light: #FEF3C7;
  --semantic-warning-dark: #D97706;

  --semantic-error: #DC2626;
  --semantic-error-light: #FEE2E2;
  --semantic-error-dark: #B91C1C;

  --semantic-info: #0284C7;
  --semantic-info-light: #E0F2FE;
  --semantic-info-dark: #0369A1;

  /* Semantic Badges */
  --badge-emerald-bg: var(--semantic-success-light);
  --badge-emerald-text: var(--semantic-success-dark);
  --badge-emerald-border: #86efac;
  --badge-emerald-dot: var(--semantic-success);

  --badge-amber-bg: var(--semantic-warning-light);
  --badge-amber-text: var(--semantic-warning-dark);
  --badge-amber-border: #fde68a;
  --badge-amber-dot: var(--semantic-warning);

  --badge-rose-bg: var(--semantic-error-light);
  --badge-rose-text: var(--semantic-error-dark);
  --badge-rose-border: #fca5a5;
  --badge-rose-dot: var(--semantic-error);

  --badge-blue-bg: var(--brand-lighter);
  --badge-blue-text: var(--brand-deep);
  --badge-blue-border: var(--brand-light);
  --badge-blue-dot: var(--brand-primary);

  /* ------------------------------------------------------------
     3. LIGHT MODE NEUTRALS & SURFACES
     ------------------------------------------------------------ */
  --app-bg: #F6F9FC;
  --canvas-bg: var(--app-bg);
  --surface-primary: #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-secondary: #F8FAFC;
  --surface-field: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border-primary: #E2E8F0;
  --border-secondary: #CBD5E1;
  --divider: #EDF2F7;

  /* Slate Gray scale */
  --slate-50: #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-850: #172033;
  --slate-900: #0F172A;
  --slate-950: #020617;

  /* ------------------------------------------------------------
     4. TYPOGRAPHY (Thamanya / Thmanyah Sans)
     ------------------------------------------------------------ */
  --font-family: 'Thamanya', 'Thmanyah Sans', 'Tajawal', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-xs: 0.75rem;
  --font-sm: 0.875rem;
  --font-md: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 1.875rem;
  --font-4xl: 2.25rem;

  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* ------------------------------------------------------------
     5. SPACING SYSTEM
     ------------------------------------------------------------ */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ------------------------------------------------------------
     6. BORDER RADIUS
     ------------------------------------------------------------ */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  /* ------------------------------------------------------------
     7. SHADOW SYSTEM
     ------------------------------------------------------------ */
  --shadow-xs: 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-sm: 0 2px 6px rgb(15 23 42 / 0.06);
  --shadow-md: 0 6px 18px rgb(15 23 42 / 0.08);
  --shadow-lg: 0 12px 32px rgb(15 23 42 / 0.12);
  --shadow-xl: 0 20px 45px rgb(15 23 42 / 0.16);

  /* ------------------------------------------------------------
     8. MOTION TRANSITIONS
     ------------------------------------------------------------ */
  --motion-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --motion-normal: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --motion-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ------------------------------------------------------------
     9. LUMO THEME INTEGRATION
     ------------------------------------------------------------ */
  --lumo-font-family: var(--font-family);
  --lumo-primary-color: var(--brand-primary);
  --lumo-primary-text-color: var(--brand-primary);
  --lumo-primary-color-10pct: var(--brand-lighter);
  --lumo-primary-color-50pct: var(--brand-light);
  --lumo-base-color: var(--surface-primary);
  --lumo-body-text-color: var(--text-primary);
  --lumo-secondary-text-color: var(--text-secondary);
  --lumo-header-text-color: var(--text-primary);
  --lumo-border-radius-s: var(--radius-sm);
  --lumo-border-radius-m: var(--radius-md);
  --lumo-border-radius-l: var(--radius-lg);
  --lumo-space-xs: var(--space-1);
  --lumo-space-s: var(--space-2);
  --lumo-space-m: var(--space-4);
  --lumo-space-l: var(--space-6);
  --lumo-space-xl: var(--space-8);
  --vaadin-grid-cell-background: var(--surface-primary);
  --color-success: var(--semantic-success);
  --color-danger: var(--semantic-error);
  --color-warning: var(--semantic-warning);
}

/* ==========================================================================
   DARK MODE THEME
   ========================================================================== */
html.dark, html[theme~="dark"] {
  --app-bg: #080D18;
  --canvas-bg: var(--app-bg);
  --surface-primary: #0F1726;
  --surface-raised: #151F32;
  --surface-secondary: #121B2B;
  --surface-field: #162238;
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border-primary: #243248;
  --border-secondary: #334155;
  --divider: #1C293D;

  /* Dark brand colors */
  --brand-primary: #4D9AFF;
  --brand-primary-hover: #6BABFF;
  --brand-primary-active: #2F83F7;
  --brand-blue: #3D91FF;
  --brand-bright: #64A9FF;
  --brand-deep: #8CC4FF;
  --brand-light: #102C55;
  --brand-lighter: #0D223F;
  --brand-gradient: linear-gradient(135deg, #0A1E3D 0%, #102C55 50%, #164282 100%);

  /* Dark mode badges */
  --badge-emerald-bg: rgba(6, 78, 59, 0.45);
  --badge-emerald-text: #6ee7b7;
  --badge-emerald-border: rgba(16, 185, 129, 0.35);
  --badge-emerald-dot: #34d399;

  --badge-amber-bg: rgba(120, 53, 15, 0.45);
  --badge-amber-text: #fcd34d;
  --badge-amber-border: rgba(245, 158, 11, 0.35);
  --badge-amber-dot: #fbbf24;

  --badge-rose-bg: rgba(136, 19, 55, 0.45);
  --badge-rose-text: #fda4af;
  --badge-rose-border: rgba(244, 63, 94, 0.35);
  --badge-rose-dot: #fb7185;

  --badge-blue-bg: rgba(16, 44, 85, 0.6);
  --badge-blue-text: #93c5fd;
  --badge-blue-border: rgba(59, 130, 246, 0.4);
  --badge-blue-dot: #60a5fa;

  /* Lumo Dark Overrides */
  --lumo-base-color: var(--surface-primary);
  --lumo-body-text-color: var(--text-primary);
  --lumo-secondary-text-color: var(--text-secondary);
  --lumo-header-text-color: var(--text-primary);
  --lumo-contrast-5pct: rgba(255, 255, 255, 0.05);
  --lumo-contrast-10pct: rgba(255, 255, 255, 0.1);
  --lumo-contrast-20pct: rgba(255, 255, 255, 0.2);
  --lumo-contrast-30pct: rgba(255, 255, 255, 0.3);
  --vaadin-grid-cell-background: var(--surface-primary);
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
}

/* ==========================================================================
   GLOBAL RESET & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--app-bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  transition: background-color var(--motion-normal), color var(--motion-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-weight: var(--font-bold);
  margin-top: 0;
}

.page-container {
  max-width: 1440px;
  width: 100%;
  margin-inline: auto;
  padding-inline: 24px;
  padding-block: 28px;
}

@media (max-width: 768px) {
  .page-container {
    padding-inline: 16px;
    padding-block: 20px;
  }
}

.content-container {
  max-width: 1440px;
  width: 100%;
  margin-inline: auto;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
vaadin-button {
  font-family: var(--font-family) !important;
  font-weight: var(--font-semibold) !important;
  font-size: var(--font-sm) !important;
  border-radius: var(--radius-md) !important;
  transition: all var(--motion-normal) !important;
  cursor: pointer !important;
  min-height: 40px;
}

vaadin-button[theme~="primary"] {
  background: var(--brand-gradient) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 87, 217, 0.25) !important;
}

vaadin-button[theme~="primary"]:hover {
  box-shadow: 0 4px 14px rgba(0, 87, 217, 0.35) !important;
  transform: translateY(-1px);
}

vaadin-button[theme~="primary"]:active {
  transform: translateY(0);
}

vaadin-button[theme~="secondary"],
vaadin-button:not([theme]) {
  background-color: var(--surface-primary) !important;
  color: var(--brand-primary) !important;
  border: 1px solid var(--border-primary) !important;
  box-shadow: var(--shadow-xs) !important;
}

vaadin-button[theme~="secondary"]:hover,
vaadin-button:not([theme]):hover {
  background-color: var(--brand-lighter) !important;
  border-color: var(--brand-blue) !important;
  color: var(--brand-deep) !important;
}

vaadin-button[theme~="tertiary"] {
  background: transparent !important;
  color: var(--brand-primary) !important;
  border: none !important;
  box-shadow: none !important;
}

vaadin-button[theme~="tertiary"]:hover {
  background-color: var(--brand-lighter) !important;
  color: var(--brand-deep) !important;
}

vaadin-button[theme~="success"] {
  background-color: var(--semantic-success) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25) !important;
}

vaadin-button[theme~="success"]:hover {
  background-color: var(--semantic-success-dark) !important;
  transform: translateY(-1px);
}

vaadin-button[theme~="error"] {
  background-color: var(--semantic-error) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25) !important;
}

vaadin-button[theme~="error"]:hover {
  background-color: var(--semantic-error-dark) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */
vaadin-text-field,
vaadin-password-field,
vaadin-combo-box,
vaadin-date-picker,
vaadin-time-picker,
vaadin-date-time-picker,
vaadin-select,
vaadin-text-area {
  font-family: var(--font-family) !important;
}

vaadin-text-field::part(input-field),
vaadin-password-field::part(input-field),
vaadin-combo-box::part(input-field),
vaadin-date-picker::part(input-field),
vaadin-time-picker::part(input-field),
vaadin-date-time-picker::part(input-field),
vaadin-select::part(input-field),
vaadin-text-area::part(input-field) {
  background-color: var(--surface-field) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-family) !important;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast) !important;
}

vaadin-text-field:hover::part(input-field),
vaadin-password-field:hover::part(input-field),
vaadin-combo-box:hover::part(input-field),
vaadin-date-picker:hover::part(input-field),
vaadin-select:hover::part(input-field) {
  border-color: var(--border-secondary) !important;
}

vaadin-text-field[focus-ring]::part(input-field),
vaadin-password-field[focus-ring]::part(input-field),
vaadin-combo-box[focus-ring]::part(input-field),
vaadin-date-picker[focus-ring]::part(input-field),
vaadin-select[focus-ring]::part(input-field) {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px rgba(0, 87, 217, 0.15) !important;
}

html.dark vaadin-text-field[focus-ring]::part(input-field),
html.dark vaadin-password-field[focus-ring]::part(input-field),
html.dark vaadin-combo-box[focus-ring]::part(input-field),
html.dark vaadin-date-picker[focus-ring]::part(input-field) {
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px rgba(77, 154, 255, 0.25) !important;
}

vaadin-text-field::part(label),
vaadin-password-field::part(label),
vaadin-combo-box::part(label),
vaadin-date-picker::part(label),
vaadin-select::part(label) {
  font-family: var(--font-family) !important;
  font-size: var(--font-xs) !important;
  font-weight: var(--font-semibold) !important;
  color: var(--text-secondary) !important;
  margin-bottom: 4px !important;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   CARDS & SURFACES
   ========================================================================== */
.app-card,
.card-panel,
.stat-card {
  background-color: var(--surface-primary) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  padding: 24px;
  color: var(--text-primary);
  transition: background-color var(--motion-normal), border-color var(--motion-normal), box-shadow var(--motion-normal);
}

.app-card-primary {
  background: var(--brand-gradient) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.app-card-flat {
  background-color: var(--surface-primary) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  padding: 20px;
}

.card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
  font-weight: 700;
}

.secondary-container {
  background-color: var(--surface-secondary) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* High-Emphasis Stat Card */
.stat-card-highlight-revenue {
  background: linear-gradient(135deg, #003BB5 0%, #0057D9 45%, #1683F5 100%) !important;
  color: #ffffff !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 87, 217, 0.4), 0 8px 10px -6px rgba(0, 87, 217, 0.25) !important;
  border: 1.5px solid rgba(147, 197, 253, 0.5) !important;
  position: relative;
  overflow: hidden;
}

html.dark .stat-card-highlight-revenue {
  background: linear-gradient(135deg, #0A1E3D 0%, #102C55 50%, #164282 100%) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
  border: 1.5px solid rgba(77, 154, 255, 0.4) !important;
}

/* ==========================================================================
   VAADIN GRID
   ========================================================================== */
vaadin-grid {
  font-family: var(--font-family) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-lg) !important;
  background-color: var(--surface-primary) !important;
  --vaadin-grid-cell-background: var(--surface-primary) !important;
  box-shadow: var(--shadow-xs);
  overflow: hidden !important;
  width: 100%;
  max-width: 100%;
}

vaadin-grid::part(header-cell) {
  background-color: var(--surface-secondary) !important;
  color: var(--text-secondary) !important;
  font-family: var(--font-family) !important;
  font-size: var(--font-xs) !important;
  font-weight: var(--font-bold) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid var(--border-primary) !important;
  padding-block: 12px !important;
}

html.dark vaadin-grid::part(header-cell) {
  background-color: var(--surface-secondary) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-primary) !important;
}

vaadin-grid::part(cell) {
  background-color: var(--surface-primary) !important;
}

vaadin-grid::part(body-cell) {
  background-color: var(--surface-primary) !important;
  font-family: var(--font-family) !important;
  font-size: var(--font-sm) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--divider) !important;
  padding-block: 10px !important;
}

html.dark vaadin-grid::part(cell),
html.dark vaadin-grid::part(body-cell) {
  background-color: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--divider) !important;
}

vaadin-grid::part(row):hover vaadin-grid::part(cell),
vaadin-grid::part(row):hover {
  background-color: var(--brand-lighter) !important;
}

html.dark vaadin-grid::part(row):hover vaadin-grid::part(cell),
html.dark vaadin-grid::part(row):hover {
  background-color: rgba(77, 154, 255, 0.08) !important;
}

vaadin-grid::part(row)[selected] vaadin-grid::part(cell),
vaadin-grid::part(row)[selected] {
  background-color: var(--brand-light) !important;
}

html.dark vaadin-grid::part(row)[selected] vaadin-grid::part(cell),
html.dark vaadin-grid::part(row)[selected] {
  background-color: rgba(77, 154, 255, 0.18) !important;
}

vaadin-grid::part(footer-cell) {
  background-color: var(--surface-secondary) !important;
  color: var(--text-secondary) !important;
  border-top: 1px solid var(--border-primary) !important;
}

html.dark vaadin-grid::part(footer-cell) {
  background-color: var(--surface-secondary) !important;
  color: var(--text-muted) !important;
  border-top: 1px solid var(--border-primary) !important;
}

/* ==========================================================================
   STATUS BADGES
   ========================================================================== */
.status-badge,
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: var(--font-xs);
  font-weight: var(--font-bold);
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.2;
}

.status-badge-primary {
  background-color: var(--brand-lighter);
  color: var(--brand-deep);
  border: 1px solid var(--brand-light);
}

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

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

.status-badge-error,
.status-badge-rose {
  background-color: var(--badge-rose-bg);
  color: var(--badge-rose-text);
  border: 1px solid var(--badge-rose-border);
}

.status-badge-info,
.status-badge-blue {
  background-color: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border: 1px solid var(--badge-blue-border);
}

.status-badge-neutral {
  background-color: var(--surface-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-primary);
}

.status-badge-plate,
.license-plate-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: var(--font-xs);
  font-weight: var(--font-bold);
  letter-spacing: 0.08em;
  background-color: #f1f5f9;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

html.dark .status-badge-plate,
html.dark .license-plate-badge {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

/* ==========================================================================
   DIALOG OVERLAYS & DROPDOWNS
   ========================================================================== */
vaadin-dialog-overlay::part(overlay) {
  border-radius: var(--radius-xl) !important;
  background-color: var(--surface-primary) !important;
  border: 1px solid var(--border-primary) !important;
  box-shadow: var(--shadow-xl) !important;
  padding: 24px !important;
  font-family: var(--font-family) !important;
  color: var(--text-primary) !important;
  max-width: 95vw !important;
  box-sizing: border-box !important;
}

vaadin-dialog-overlay::part(backdrop) {
  background-color: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(2px);
}

html.dark vaadin-dialog-overlay::part(backdrop) {
  background-color: rgba(0, 0, 0, 0.75) !important;
}

/* Dropdown Overlays (Select, ComboBox, DatePicker, MenuBar, ContextMenu) */
vaadin-combo-box-overlay::part(overlay),
vaadin-select-overlay::part(overlay),
vaadin-date-picker-overlay::part(overlay),
vaadin-menu-bar-overlay::part(overlay),
vaadin-context-menu-overlay::part(overlay) {
  background-color: var(--surface-primary) !important;
  border: 1px solid var(--border-primary) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xl) !important;
  color: var(--text-primary) !important;
  padding: 6px !important;
}

vaadin-combo-box-item,
vaadin-select-item {
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  font-family: var(--font-family) !important;
  transition: background-color var(--motion-fast) !important;
}

vaadin-combo-box-item:hover,
vaadin-select-item:hover,
vaadin-combo-box-item[selected],
vaadin-select-item[selected] {
  background-color: var(--brand-lighter) !important;
  color: var(--brand-deep) !important;
}

html.dark vaadin-combo-box-item:hover,
html.dark vaadin-select-item:hover,
html.dark vaadin-combo-box-item[selected],
html.dark vaadin-select-item[selected] {
  background-color: rgba(77, 154, 255, 0.16) !important;
  color: var(--brand-bright) !important;
}

vaadin-date-picker-overlay::part(content) {
  background-color: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

/* ==========================================================================
   SIDEBAR & HEADER
   ========================================================================== */
vaadin-side-nav {
  font-family: var(--font-family) !important;
}

vaadin-side-nav-item::part(link) {
  font-family: var(--font-family) !important;
  font-size: var(--font-sm) !important;
  font-weight: var(--font-semibold) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-md) !important;
  min-height: 44px !important;
  margin-inline: 6px !important;
  margin-block: 2px !important;
  padding-inline: 12px !important;
  transition: all var(--motion-fast) !important;
}

vaadin-side-nav-item::part(link):hover {
  background-color: var(--brand-lighter) !important;
  color: var(--brand-deep) !important;
}

html.dark vaadin-side-nav-item::part(link):hover {
  background-color: rgba(77, 154, 255, 0.12) !important;
  color: var(--brand-bright) !important;
}

vaadin-side-nav-item[current]::part(link) {
  background-color: var(--brand-light) !important;
  color: var(--brand-deep) !important;
  font-weight: var(--font-bold) !important;
}

html.dark vaadin-side-nav-item[current]::part(link) {
  background-color: rgba(77, 154, 255, 0.22) !important;
  color: #ffffff !important;
}

.app-header {
  height: 72px;
  background-color: var(--surface-primary);
  border-bottom: 1px solid var(--border-primary);
  padding-inline: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color var(--motion-normal), border-color var(--motion-normal);
}

/* Pulse animation for active status indicators */
.pulse-dot {
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.15);
  }
}

/* Vaadin App Layout Shell */
vaadin-app-layout::part(drawer) {
  background-color: var(--surface-primary) !important;
  border-inline-end: 1px solid var(--border-primary) !important;
}

vaadin-app-layout::part(navbar) {
  background-color: var(--surface-primary) !important;
  border-bottom: 1px solid var(--border-primary) !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM & UTILITY CLASSES
   ========================================================================== */

/* Responsive Dashboard KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

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

@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Operational Split Rows (Desktop: horizontal, Tablet/Mobile: vertical stack) */
.dashboard-split-row {
  display: flex;
  flex-direction: row;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

@media (max-width: 1023px) {
  .dashboard-split-row {
    flex-direction: column !important;
  }
}

/* Visibility Breakpoint Helpers */
@media (max-width: 600px) {
  .hide-on-mobile {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .hide-on-tablet {
    display: none !important;
  }
}

.show-on-mobile {
  display: none !important;
}

@media (max-width: 600px) {
  .show-on-mobile {
    display: flex !important;
  }
}

/* Responsive Table / Grid Scrolling Container */
.grid-container-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Filter Toolbar Responsive Wrapping */
.filter-bar-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.filter-bar-responsive > * {
  flex: 1 1 150px;
  min-width: 120px;
  max-width: 100%;
}

@media (max-width: 600px) {
  .filter-bar-responsive > * {
    flex: 1 1 100%;
    width: 100% !important;
  }
}

/* Mobile Touch Target Standards */
@media (max-width: 600px) {
  vaadin-button {
    min-height: 44px !important;
  }

  .app-header {
    height: 60px !important;
    padding-inline: 12px !important;
  }

  vaadin-dialog-overlay::part(overlay) {
    padding: 16px !important;
    margin: 8px !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
  }

  .stat-card,
  .app-card,
  .card-panel {
    padding: 16px !important;
  }
}

/* ==========================================================================
   CIRCULAR REVEAL VIEW TRANSITIONS
   ========================================================================== */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}


