/* ============================================================
   OminiSis Enterprise — Main CSS
   Design System: Dark glassmorphism premium UI
   ============================================================ */

:root {
  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;

  /* Fiori Light Theme Colors */
  --bg-base: #f4f5f7; /* Very light gray/blue background */
  --bg-surface: rgba(255, 255, 255, 0.8);
  --bg-elevated: #ffffff; /* White cards */
  --bg-card: #ffffff;
  --bg-card-hover: #f9f9fc;

  /* Borders */
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);

  /* Typography */
  --text-primary: #1d2d3e; /* Dark slate text */
  --text-secondary: #566472;
  --text-muted: #8493a1;
  --text-brand: #0f828f;

  /* Brand Colors (Fiori style blues) */
  --brand-primary: #0070f2;
  --brand-success: #107e3e;
  --brand-warning: #e9730c;
  --brand-danger: #bb0000;
  --brand-info: #0070f2;
  --brand-accent: #0f828f;

  /* Sidebar Specific (Dark Sidebar contrast) */
  --sidebar-bg: #2b303b;
  --sidebar-text: #ffffff;
  --sidebar-text-muted: rgba(255, 255, 255, 0.75); /* Whiter text for better contrast */
  --sidebar-hover: rgba(255,255,255,0.05);
  --sidebar-active: rgba(0,112,242,0.15);
  --sidebar-active-border: #0070f2;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #0070f2 0%, #0054b6 100%);
  --grad-success: linear-gradient(135deg, #107e3e 0%, #0c612f 100%);
  --grad-warning: linear-gradient(135deg, #e9730c 0%, #d97706 100%);
  --grad-danger: linear-gradient(135deg, #bb0000 0%, #900000 100%);
  --grad-teal: linear-gradient(135deg, #0f828f 0%, #086d78 100%);
  
  /* Shadows (Fiori style softer shadows) */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 15px rgba(0, 112, 242, 0.15);

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --trans-fast: 150ms ease;
  --trans-base: 250ms ease;
  --trans-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Splash Screen
   ============================================================ */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 50% 50%, var(--bg-elevated) 0%, var(--bg-base) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  animation: splashEntrance 0.6s ease forwards;
}

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

.splash-logo {
  display: flex;
  align-items: center;
  gap: 20px;
}

.splash-icon {
  animation: logoFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 16px rgba(99,102,241,0.25));
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.splash-brand h1 {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -2px;
}

.splash-brand span {
  font-size: 14px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 500;
}

.splash-progress {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.splash-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.splash-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--grad-brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 82, 204, 0.3);
}

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

.splash-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ============================================================
   App Layout
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns var(--trans-slow);
}

.app.hidden { display: none; }

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

.main-wrapper {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--trans-fast), background var(--trans-fast);
}

.mobile-menu-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb span:last-child { color: var(--text-primary); font-weight: 500; }

.topbar-ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-brand);
  font-weight: 500;
}

.ai-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-primary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.topbar-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: color var(--trans-fast), background var(--trans-fast);
}

.topbar-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }

.topbar-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--brand-danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--trans-fast);
}

.user-menu:hover { background: var(--bg-elevated); }

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Content Area
   ============================================================ */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-base);
  scroll-behavior: smooth;
}

.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   Module Header
   ============================================================ */
.module-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.module-title-area { display: flex; flex-direction: column; gap: 4px; }

.module-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.module-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--trans-fast);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--grad-brand);
  color: white;
  box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

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

.btn-success {
  background: var(--grad-success);
  color: white;
}

.btn-danger {
  background: var(--grad-danger);
  color: white;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  gap: 5px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--trans-fast), transform var(--trans-fast), box-shadow var(--trans-fast);
}

.card:hover {
  border-color: var(--border-default);
}

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

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--trans-base);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card.kpi-primary::before { background: var(--grad-brand); }
.kpi-card.kpi-success::before { background: var(--grad-success); }
.kpi-card.kpi-warning::before { background: var(--grad-warning); }
.kpi-card.kpi-danger::before { background: var(--grad-danger); }
.kpi-card.kpi-info::before { background: var(--grad-teal); }

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

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

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.kpi-primary { background: rgba(99,102,241,0.15); color: var(--brand-primary); }
.kpi-icon.kpi-success { background: rgba(16,185,129,0.15); color: var(--brand-success); }
.kpi-icon.kpi-warning { background: rgba(245,158,11,0.15); color: var(--brand-warning); }
.kpi-icon.kpi-danger { background: rgba(239,68,68,0.15); color: var(--brand-danger); }
.kpi-icon.kpi-info { background: rgba(6,182,212,0.15); color: var(--brand-accent); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.kpi-trend.up { background: rgba(16,185,129,0.15); color: var(--brand-success); }
.kpi-trend.down { background: rgba(239,68,68,0.15); color: var(--brand-danger); }

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

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

.kpi-sparkline {
  height: 40px;
  margin-top: 12px;
  opacity: 0.7;
}

/* ============================================================
   Tables
   ============================================================ */
.table-container {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-elevated);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

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

tbody tr {
  background: var(--bg-card);
  transition: background var(--trans-fast);
  cursor: pointer;
}

tbody tr:hover { background: var(--bg-card-hover); }

/* ============================================================
   Badges & Status
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(16,185,129,0.15); color: var(--brand-success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--brand-warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--brand-danger); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--brand-info); }
.badge-primary { background: rgba(99,102,241,0.15); color: var(--brand-primary); }
.badge-muted { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* Status dot */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot-success { background: var(--brand-success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-dot-warning { background: var(--brand-warning); box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.status-dot-danger { background: var(--brand-danger); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.status-dot-muted { background: var(--text-muted); }

/* ============================================================
   Grid Layouts
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 16px; }

.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ============================================================
   Tabs
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 24px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  transition: all var(--trans-fast);
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Forms
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

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

.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
}

/* ============================================================
   Progress Bars
   ============================================================ */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill-primary { background: var(--grad-brand); }
.progress-fill-success { background: var(--grad-success); }
.progress-fill-warning { background: var(--grad-warning); }
.progress-fill-danger { background: var(--grad-danger); }
.progress-fill-info { background: var(--grad-teal); }

/* ============================================================
   Notification Panel
   ============================================================ */
.notification-panel {
  position: fixed;
  top: 0; right: 0;
  width: 380px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--trans-slow);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.notification-panel.open { transform: translateX(0); }

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

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

.notif-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--trans-fast);
}

.notif-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.notification-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--trans-fast);
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.notif-item:hover { background: var(--bg-elevated); }
.notif-item.notif-unread { border-color: rgba(99,102,241,0.15); background: rgba(99,102,241,0.04); }

.notif-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-icon-warning { background: rgba(245,158,11,0.15); color: var(--brand-warning); }
.notif-icon-success { background: rgba(16,185,129,0.15); color: var(--brand-success); }
.notif-icon-info { background: rgba(59,130,246,0.15); color: var(--brand-info); }
.notif-icon-ai { background: rgba(99,102,241,0.15); color: var(--brand-primary); }

.notif-title { font-size: 12px; font-weight: 500; color: var(--text-primary); line-height: 1.4; margin-bottom: 4px; }
.notif-time { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Modal (for AI Copilot etc)
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans-base);
  backdrop-filter: blur(4px);
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: min(640px, 95vw);
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.98);
  transition: transform var(--trans-base);
}

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

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-in {
  animation: fadeInUp 0.4s ease forwards;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-card-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Utilities
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--brand-success); }
.text-danger { color: var(--brand-danger); }
.text-warning { color: var(--brand-warning); }
.text-brand { color: var(--brand-primary); }

.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mb-28 { margin-bottom: 28px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }

.w-full { width: 100%; }

.hidden { display: none !important; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .app { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .topbar-ai-status, .user-info { display: none; }
  .notification-panel { width: 100%; }
}

/* =========================================================
   Modal & Forms
========================================================= */
.modal-overlay {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  z-index: 9999999;
}

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}

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

.modal-body {
  padding: 24px;
}

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

.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* BITRIX-STYLE LEAD MODAL */
.modal-box-xl {
  width: 95%;
  max-width: 1400px;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.lead-pipeline-tracker {
  display: flex;
  align-items: stretch;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 8px 16px;
  gap: 4px;
  overflow-x: auto;
  min-height: 48px;
}

.tracker-stage {
  flex: 1;
  text-align: center;
  padding: 8px 16px;
  background: var(--bg-base);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  margin-right: -5px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tracker-stage:first-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}
.tracker-stage.active {
  background: var(--brand-primary);
  color: white;
}
.tracker-stage.past {
  background: rgba(88, 101, 242, 0.2);
  color: var(--brand-primary);
}

.lead-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--bg-base);
}

.lead-left-pane {
  flex: 0 0 45%;
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lead-section {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-default);
}

.lead-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
}

.lead-right-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.activity-tabs {
  display: flex;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
}
.activity-tab {
  padding: 16px 0;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.activity-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.activity-input-area {
  padding: 24px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}
.activity-textarea {
  width: 100%;
  min-height: 80px;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--text-primary);
  resize: vertical;
  margin-bottom: 12px;
}
.activity-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.timeline-feed {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}
.timeline-feed::before {
  content: '';
  position: absolute;
  left: 44px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: var(--border-default);
  z-index: 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.timeline-icon.system { border-color: var(--text-muted); color: var(--text-muted); }
.timeline-icon.user { border-color: var(--brand-primary); color: var(--brand-primary); }
.timeline-icon.success { border-color: #22c55e; color: #22c55e; }

.timeline-content {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
}
.timeline-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.timeline-author { font-weight: 600; color: var(--brand-primary); }
.timeline-date { color: var(--text-muted); }
.timeline-text { color: var(--text-secondary); line-height: 1.5; }

/* Contact inputs with icons */
.contact-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 12px;
  margin-bottom: 12px;
}
.contact-input-group span {
  color: var(--text-muted);
  font-size: 16px;
  margin-right: 8px;
}
.contact-input-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  color: var(--text-primary);
}
.contact-input-group input:focus {
  outline: none;
}

/* Light Theme Variables */
body.theme-light {
  /* Dark Theme Colors Overridden */
  --bg-base: #f3f4f6;
  --bg-surface: rgba(255, 255, 255, 0.95);
  --bg-elevated: rgba(255, 255, 255, 1);
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(249, 250, 251, 1);

  /* Borders */
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);

  /* Typography */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-brand: #4f46e5;

  /* Shadows (less glowing, more traditional) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* ============================================================
   Print Styles
   ============================================================ */
.print-only {
  display: none;
}

@media print {
  html, body {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app, .splash-screen, .app-sidebar, .topbar, .tab-nav, .module-actions, .btn, .ai-copilot-container {
    display: none !important;
  }
  .print-only {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
  }
  * {
    color: #000000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }
  input, select, textarea {
    border: 1px solid #cccccc !important;
    color: #000000 !important;
    background: #ffffff !important;
  }
  .table-input {
    border: none !important;
  }
  table th {
    background: #f0f0f0 !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
  }
  table td {
    border-bottom: 1px solid #cccccc !important;
  }
  .advanced-section-title {
    color: #000000 !important;
    border-bottom-color: #cccccc !important;
  }
}
