/* ═══════════════════════════════════════════════════════════════════════════
   MPS Operations Tracker — Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties — Light (Default) ──────────────────────────────── */
:root {
  /* Primary - True Adventus Cyan */
  --color-primary: #00A0E4; 
  --color-primary-dark: #0081B8;
  --color-primary-light: #33B3E9;
  --color-primary-ghost: rgba(0, 160, 228, 0.12);
  --color-primary-ghost-hover: rgba(0, 160, 228, 0.2);

  /* Backgrounds — Light (Glassmorphic Premium) */
  --color-bg: #F8FAFC;
  --color-surface: rgba(255, 255, 255, 0.85);
  --color-surface-hover: rgba(255, 255, 255, 1);
  --color-sidebar: #121F48; /* True Adventus Navy */
  --color-header: rgba(255, 255, 255, 0.8);

  /* Text — Light */
  --color-text: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #94A3B8;
  --color-text-disabled: #CBD5E1;
  --color-text-inverse: #FFFFFF;

  /* Borders — Light */
  --color-border: rgba(18, 31, 72, 0.1);
  --color-border-light: rgba(18, 31, 72, 0.05);
  --color-border-focus: #00A0E4;

  /* Semantic */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #279cd8;

  /* Stage colors - BOLD */
  --stage-new: #279cd8;
  --stage-logistics: #A855F7;
  --stage-deployment: #F59E0B;
  --stage-billing: #10B981;
  --stage-pending: #EF4444;
  --stage-completed: #475569;
  --stage-hold: #64748B;
  --stage-lease: #06B6D4;

  /* Premium Shadows — Light (Softer, Larger) */
  --shadow-xs: 0 2px 4px rgba(18, 31, 72, 0.03);
  --shadow-sm: 0 4px 12px rgba(18, 31, 72, 0.05), 0 2px 4px rgba(18, 31, 72, 0.03);
  --shadow-md: 0 12px 24px rgba(18, 31, 72, 0.08), 0 4px 8px rgba(18, 31, 72, 0.04);
  --shadow-lg: 0 24px 48px rgba(18, 31, 72, 0.1), 0 8px 16px rgba(18, 31, 72, 0.05);
  --shadow-glow: 0 0 20px rgba(0, 160, 228, 0.35);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --header-height: 64px;

  /* Premium Sharp Edges (Enterprise SaaS) */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  --radius-xl: 8px;
  --radius-full: 4px; /* We repurpose full to sharp 4px to strip out pill shapes globally */

  /* Typography (Modernizing to Outfit or deeper weights if needed, keeping Inter) */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --color-bg: #0B1120; /* Very deep navy/black */
  --color-surface: rgba(18, 31, 72, 0.4);
  --color-surface-hover: rgba(18, 31, 72, 0.6);
  --color-sidebar: #070B15; /* Extremely dark for contrast */
  --color-header: rgba(11, 17, 32, 0.8);

  --color-text: #F8FAFC;
  --color-text-secondary: #CBD5E1;
  --color-text-muted: #94A3B8;
  --color-text-disabled: #475569;
  --color-text-inverse: #0B1120;

  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-light: rgba(255, 255, 255, 0.05);
  --color-border-focus: #00A0E4;

  --color-error: #F87171;
  --color-warning: #FBBF24;

  /* Legendary Shadows — Dark */
  --shadow-xs: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-sm: 0 8px 24px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 16px 32px rgba(0,0,0,0.7), 0 8px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 32px 64px rgba(0,0,0,0.8), 0 16px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(0, 160, 228, 0.6);
}


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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: 
    radial-gradient(circle at 15% 50%, rgba(0, 160, 228, 0.15), transparent 50%), 
    radial-gradient(circle at 85% 30%, rgba(18, 31, 72, 0.2), transparent 50%), 
    var(--color-bg);
  background-attachment: fixed;
  color: var(--color-text);
  line-height: 1.5;
  letter-spacing: -0.01em;
  overflow: hidden;
  height: 100dvh;
  transition: background var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
  pointer-events: none;
}

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

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

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 4px var(--color-primary-ghost), inset 0 1px 2px rgba(0,0,0,0.02);
  background: var(--color-surface);
}

/* ── App Layout ───────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  background: rgba(18, 31, 72, 0.95); /* Deep Adventus Navy */
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: width var(--duration-slow) var(--ease-spring),
              transform var(--duration-slow) var(--ease-spring);
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
}

.sidebar-brand-logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
  transition: transform var(--duration-normal) var(--ease-spring);
}
.sidebar-brand-logo:hover {
  transform: scale(1.02);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: linear-gradient(90deg, rgba(0, 160, 228, 0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--duration-fast);
  z-index: -1;
}

.nav-item:hover {
  color: #FFFFFF;
  transform: translateX(4px);
}
.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  background: rgba(0, 160, 228, 0.15);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: inset 2px 0 0 0 var(--color-primary);
}

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

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.nav-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
  height: var(--header-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
  flex-shrink: 0;
}

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

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background var(--duration-fast);
}
.menu-toggle:hover { background: var(--color-surface-hover); }

.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: 13px;
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-secondary);
  transition: all var(--duration-fast);
  position: relative;
}
.header-btn:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.header-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}

.theme-toggle {
  font-size: 16px;
}

/* ── Content Area ─────────────────────────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  scroll-behavior: smooth;
}

/* ── View Transitions ─────────────────────────────────────────────────────── */
.view {
  display: none;
  animation: legendaryFadeSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.view.active { display: block; }

@keyframes legendaryFadeSlideIn {
  0% { opacity: 0; transform: translateY(30px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: rgba(0, 160, 228, 0.4);
}

.card-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: all var(--duration-fast);
}
.card-glass:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-md);
}
[data-theme="light"] .card-glass {
  background: rgba(255, 255, 255, 0.75);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── Stat Cards (Dashboard) ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(18, 31, 72, 0.4);
  border: 1px solid rgba(0, 160, 228, 0.2);
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; right: -50%; bottom: -50%;
  background: radial-gradient(circle at center, rgba(0, 160, 228, 0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 48px rgba(0, 160, 228, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-color: rgba(0, 160, 228, 0.5);
}
.stat-card:hover::before {
  opacity: 1;
}
.stat-card > * {
  position: relative;
  z-index: 1;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  line-height: 1;
  background: linear-gradient(to right, #FFFFFF, var(--color-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(0, 160, 228, 0.3);
}

.stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.stat-change {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.stat-change.positive {
  color: var(--color-success);
  background: rgba(5, 150, 105, 0.1);
}
.stat-change.negative {
  color: var(--color-error);
  background: rgba(220, 38, 38, 0.1);
}

/* ── Kanban Board ─────────────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 400px;
  scroll-snap-type: x proximity;
}

.kanban-column {
  min-width: 280px;
  max-width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.kanban-column-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-column-title {
  font-size: 13px;
  font-weight: 600;
}

.kanban-column-count {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--color-primary-ghost);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kanban-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 2px;
}

.kanban-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: cardSlideIn var(--duration-normal) var(--ease-out) both;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.kanban-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: var(--color-primary-light);
  z-index: 10;
}

.kanban-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.kanban-card:hover::before {
  opacity: 1;
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kanban-card-customer {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-so {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-card-value {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary);
}

.kanban-card-owner {
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-surface-hover);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kanban-card-country {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-ghost);
  color: var(--color-primary);
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.data-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

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

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.data-table th {
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast);
}
.data-table th:hover { color: var(--color-text); }
.data-table th.sorted { color: var(--color-primary); }

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: all var(--duration-fast);
}
.data-table tbody tr:hover {
  background: var(--color-primary-ghost);
  transform: scale(1.001);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  position: relative;
  z-index: 1;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── Stage Badge ──────────────────────────────────────────────────────────── */
.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.stage-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stage-badge.new { background: rgba(59,130,246,0.1); color: var(--stage-new); }
.stage-badge.new::before { background: var(--stage-new); }
.stage-badge.logistics { background: rgba(139,92,246,0.1); color: var(--stage-logistics); }
.stage-badge.logistics::before { background: var(--stage-logistics); }
.stage-badge.deployment { background: rgba(245,158,11,0.1); color: var(--stage-deployment); }
.stage-badge.deployment::before { background: var(--stage-deployment); }
.stage-badge.billing { background: rgba(5,150,105,0.1); color: var(--stage-billing); }
.stage-badge.billing::before { background: var(--stage-billing); }
.stage-badge.pending-customer { background: rgba(239,68,68,0.1); color: var(--stage-pending); }
.stage-badge.pending-customer::before { background: var(--stage-pending); }
.stage-badge.completed { background: rgba(107,114,128,0.1); color: var(--stage-completed); }
.stage-badge.completed::before { background: var(--stage-completed); }
.stage-badge.on-hold { background: rgba(156,163,175,0.1); color: var(--stage-hold); }
.stage-badge.on-hold::before { background: var(--stage-hold); }
.stage-badge.active-lease { background: rgba(6,182,212,0.1); color: var(--stage-lease); }
.stage-badge.active-lease::before { background: var(--stage-lease); }

/* ── Filters Bar ──────────────────────────────────────────────────────────── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.filter-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-ghost);
}
.filter-chip.active {
  border-color: var(--color-primary);
  background: var(--color-primary-ghost);
  color: var(--color-primary);
}

.filter-select {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--duration-normal) var(--ease-spring);
  white-space: nowrap;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 160, 228, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  box-shadow: 0 6px 20px rgba(0, 160, 228, 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  transform: translateY(-2px) scale(1.02);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-sm), 0 0 10px rgba(0, 160, 228, 0.15);
}

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

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: 48px 24px;
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-ghost);
}
.drop-zone.drag-over {
  transform: scale(1.01);
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.drop-zone-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.drop-zone-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Detail Modal / Slideout ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 43, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn var(--duration-normal) var(--ease-out);
}
.modal-overlay.active { display: flex; }

@keyframes modalFadeIn {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(12px); }
}

.modal-panel {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideUp var(--duration-slow) var(--ease-spring);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* Glassmorphism Utility Class - Re-styled for Enterprise Sharpness */
.glass-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .glass-panel {
  background: var(--color-surface);
  border-color: rgba(255, 255, 255, 0.05);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 5;
}

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background var(--duration-fast);
}
.modal-close:hover { background: var(--color-surface-hover); }

.modal-body { padding: 24px; }

/* ── Notification Dropdown ────────────────────────────────────────────────── */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  display: none;
  animation: dropdownSlide var(--duration-fast) var(--ease-out);
}
.notification-dropdown.active { display: block; }

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--duration-fast);
  cursor: pointer;
}
.notification-item:hover { background: var(--color-surface-hover); }
.notification-item:last-child { border-bottom: none; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--color-text-muted);
  max-width: 400px;
  margin: 0 auto 24px;
}

/* ── Grid Layouts ─────────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* ── Section Spacing ──────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ── Loading Skeleton ─────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--color-surface-hover) 25%, var(--color-border-light) 50%, var(--color-surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* ── Pulse Animation (for live status) ────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 2s ease-in-out infinite; }

/* ── Mobile Bottom Navigation ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  z-index: 100;
  padding: 4px 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--duration-fast);
  border-radius: var(--radius-md);
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
  color: var(--color-primary);
}

.bottom-nav-icon { font-size: 20px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle { display: flex; }
  .bottom-nav { display: block; }

  .content-area {
    padding: 16px;
    padding-bottom: 80px;
  }

  .header { padding: 0 16px; }
  .header-search { display: none; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .stat-icon { width: 36px; height: 36px; font-size: 16px; }

  .kanban-board { gap: 12px; }
  .kanban-column { min-width: 260px; }

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

  .modal-panel {
    width: 95%;
    max-height: 85vh;
  }
}

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

  .filters-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}

/* ── Sidebar Overlay (Mobile) ─────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
  border: 2px solid var(--color-surface);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ── Calendar Layout ──────────────────────────────────────────────────────── */
.calendar-layout-wrapper {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.calendar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.calendar-header-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.calendar-month-title {
  font-size: 16px;
  font-weight: 600;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-cell {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-height: 85px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  transition: all var(--duration-fast);
  cursor: pointer;
}
.calendar-cell:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
}
.calendar-cell.inactive {
  opacity: 0.35;
  cursor: default;
}
.calendar-cell.inactive:hover {
  border-color: var(--color-border);
  background: var(--color-bg);
}
.calendar-cell.today {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-ghost);
}

.calendar-cell-date {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.calendar-cell-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  overflow: hidden;
}

.calendar-event-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: var(--color-text-inverse);
}

.calendar-side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calendar-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.calendar-detail-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: border-color var(--duration-fast);
}
.calendar-detail-item:hover {
  border-color: var(--color-primary);
}

.calendar-detail-customer {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.calendar-detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}
.calendar-detail-owner {
  color: var(--color-text-muted);
}
.calendar-detail-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary);
}

.stage-tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.stage-tag.new { background: rgba(59,130,246,0.1); color: var(--stage-new); }
.stage-tag.logistics { background: rgba(139,92,246,0.1); color: var(--stage-logistics); }
.stage-tag.deployment { background: rgba(245,158,11,0.1); color: var(--stage-deployment); }
.stage-tag.billing { background: rgba(5,150,105,0.1); color: var(--stage-billing); }
.stage-tag.pending-customer { background: rgba(239,68,68,0.1); color: var(--stage-pending); }
.stage-tag.completed { background: rgba(107,114,128,0.1); color: var(--stage-completed); }
.stage-tag.on-hold { background: rgba(156,163,175,0.1); color: var(--stage-hold); }
.stage-tag.active-lease { background: rgba(6,182,212,0.1); color: var(--stage-lease); }

@media (max-width: 900px) {
  .calendar-layout-wrapper {
    grid-template-columns: 1fr;
  }
}

/* ── Print Styles ─────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .header, .bottom-nav, .filters-bar { display: none !important; }
  .main-content { margin: 0; }
  .content-area { padding: 0; }
  .card { break-inside: avoid; }
}

/* ── Login Screen ─────────────────────────────────────────────────────────── */
#login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 50% -20%, rgba(0, 160, 228, 0.4), transparent 60%),
    radial-gradient(circle at 50% 120%, rgba(18, 31, 72, 0.8), transparent 70%),
    #050A15;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), backdrop-filter 0.8s ease;
  backdrop-filter: blur(40px);
}
#login-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
@keyframes loginEntrance {
  0% { opacity: 0; transform: scale(0.9) translateY(40px); box-shadow: 0 0 0 rgba(0, 160, 228, 0); }
  100% { opacity: 1; transform: scale(1) translateY(0); box-shadow: 0 32px 64px rgba(0,0,0,0.8), 0 0 40px rgba(0, 160, 228, 0.4); }
}
.login-card {
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid rgba(0, 160, 228, 0.5);
  border-radius: 24px;
  padding: 56px 48px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  color: #FFFFFF;
  animation: loginEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.login-card img {
  height: 64px;
  margin-bottom: 32px;
}
.login-card h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #FFFFFF;
  letter-spacing: -0.02em;
  text-shadow: 0 0 10px rgba(0, 160, 228, 0.3);
}
.login-card p {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 32px;
  font-size: 14px;
}
.login-form input {
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2);
  color: #FFFFFF;
  font-family: var(--font-sans);
  transition: all var(--duration-fast);
}
.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}
.login-form input:focus {
  border-color: var(--color-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(0, 160, 228, 0.15);
}
.login-form button {
  width: 100%;
  padding: 14px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  box-shadow: 0 4px 12px rgba(0, 160, 228, 0.3);
}
.login-form button:hover {
  background: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 160, 228, 0.4);
}
.login-error {
  color: var(--color-error);
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* ── AI Chat Widget ───────────────────────────────────────────────────────── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-size: 32px;
  box-shadow: 0 4px 12px rgba(0, 160, 228, 0.4);
  cursor: pointer;
  z-index: 9900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast);
}
.ai-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 160, 228, 0.5);
}

.ai-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 9900;
  overflow: hidden;
  transition: opacity var(--duration-normal), transform var(--duration-normal) var(--ease-out);
  transform-origin: bottom right;
}
.ai-panel.hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.ai-panel-header {
  padding: 16px;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-panel-header h3 {
  margin: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
}
.ai-close-btn:hover { opacity: 1; }

.ai-chat-history {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-bg);
}

.ai-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ai-msg-system {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  align-self: center;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
  max-width: 95%;
}
.ai-msg-user {
  background: var(--color-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-msg-ai {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-msg-loading {
  align-self: flex-start;
  background: transparent;
  color: var(--color-text-secondary);
  font-style: italic;
  font-size: 13px;
}

.ai-chat-input-area {
  padding: 16px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
}
.ai-chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}
.ai-submit-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast);
}
.ai-submit-btn:hover {
  background: var(--color-primary-dark);
}
.ai-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
