/* ========================================
   LP Marketing Survey Panel - Main Styles
   ======================================== */

/* CSS Custom Properties */
:root {
  /* Colors - Light theme (default) */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #dbeafe;
  --color-secondary: #64748b;
  --color-secondary-hover: #475569;
  --color-success: #059669;
  --color-success-light: #d1fae5;
  --color-warning: #d97706;
  --color-warning-light: #fef3c7;
  --color-danger: #dc2626;
  --color-danger-light: #fee2e2;
  --color-info: #0891b2;
  --color-info-light: #cffafe;

  --color-bg: #f8fafc;
  --color-bg-elevated: #ffffff;
  --color-bg-hover: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;

  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
  --content-max-width: 1400px;
}

/* Dark theme */
[data-theme="dark"] {
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-primary-light: #1e3a5f;
  --color-secondary: #94a3b8;
  --color-secondary-hover: #cbd5e1;
  --color-success: #10b981;
  --color-success-light: #064e3b;
  --color-warning: #f59e0b;
  --color-warning-light: #78350f;
  --color-danger: #ef4444;
  --color-danger-light: #7f1d1d;
  --color-info: #06b6d4;
  --color-info-light: #164e63;

  --color-bg: #0f172a;
  --color-bg-elevated: #1e293b;
  --color-bg-hover: #334155;
  --color-border: #334155;
  --color-border-light: #1e293b;
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-hover); }
a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { margin-bottom: 0.75rem; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Layout */
.main-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  flex: 1;
  padding: 1.5rem;
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

/* Page Header */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}
.page-title { font-size: 1.5rem; font-weight: 600; }
.page-subtitle { color: var(--color-text-secondary); margin-top: 0.25rem; margin-bottom: 0; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--color-bg-hover); border-color: var(--color-border); }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--color-primary-light); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg-hover); color: var(--color-text); }

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);
  border-color: var(--color-success);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.5rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover { background: var(--color-bg-hover); color: var(--color-text); }
.icon-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.btn-form { margin: 0; }
.dropdown-form { margin: 0; }
.dropdown-form .btn { width: 100%; text-align: left; padding: 0.5rem 0.75rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-section { padding-bottom: 1.25rem; border-bottom: 1px solid var(--color-border); }
.form-section:last-child { border-bottom: none; padding-bottom: 0; }
.form-section h3 { font-size: 0.875rem; font-weight: 600; margin-bottom: 1rem; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-label { font-size: 0.8125rem; font-weight: 500; color: var(--color-text); }
.form-label .required { color: var(--color-danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-input::placeholder { color: var(--color-text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--color-danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--color-border); }
.form-checkbox { flex-direction: row; align-items: center; gap: 0.5rem; }
.form-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--color-primary); cursor: pointer; }
.password-field { position: relative; }
.password-field .form-input { padding-right: 44px; }
.toggle-password {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
}
.toggle-password:hover { color: var(--color-text); }
.toggle-password .eye-closed { display: none; }
.toggle-password[aria-expanded="true"] .eye-open { display: none; }
.toggle-password[aria-expanded="true"] .eye-closed { display: block; }

/* Dropdowns */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 200px;
  padding: 0.375rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
}
.dropdown-menu.dropdown-right { right: 0; left: auto; }
.dropdown-menu[style*="display: block"] { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--color-bg-hover); }
.dropdown-item.dropdown-danger { color: var(--color-danger); }
.dropdown-item.dropdown-danger:hover { background: var(--color-danger-light); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 0.375rem 0; }
.dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem; }
.dropdown-footer { padding: 0.5rem 0.75rem; border-top: 1px solid var(--color-border); }
.dropdown-empty { padding: 1rem; text-align: center; color: var(--color-text-muted); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-secondary { background: var(--color-border); color: var(--color-text-secondary); }
.badge-muted { background: var(--color-border-light); color: var(--color-text-muted); }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-purple { background: #f3e8ff; color: #9333ea; }
.badge-orange { background: #ffedd5; color: #ea580c; }
.badge-teal { background: #ccfbf1; color: #0d9488; }
.badge-amber { background: #fef3c7; color: #d97706; }
.badge-rose { background: #ffe4e6; color: #e11d48; }

/* Tables */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { font-weight: 600; color: var(--color-text-secondary); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--color-bg); white-space: nowrap; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--color-bg-hover); }
.table td:last-child, .table th:last-child { text-align: right; }

/* Lists */
.list { list-style: none; }
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--color-border); }
.list-item:last-child { border-bottom: none; }
.list-item .flex-1 { flex: 1; min-width: 0; }

/* Stats */
.stats-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.stats-list dt { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stats-list dd { font-size: 1.125rem; font-weight: 600; color: var(--color-text); }

/* KPI Cards */
.grid { display: grid; gap: 1rem; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-dashboard { grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }
.grid-2col { grid-template-columns: 1fr; }
@media (min-width: 1024px) { .grid-2col { grid-template-columns: 1fr 380px; } }

.kpi-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  color: var(--color-text-inverse);
}
.kpi-icon.primary { background: var(--color-primary); }
.kpi-icon.blue { background: var(--color-info); }
.kpi-icon.green { background: var(--color-success); }
.kpi-icon.purple { background: var(--color-primary); }
.kpi-icon.orange { background: var(--color-warning); }
.kpi-icon.teal { background: #0d9488; }
.kpi-icon.amber { background: #f59e0b; }
.kpi-icon.rose { background: #e11d48; }
.kpi-icon.yellow { background: #fbbf24; }
.kpi-icon.red { background: var(--color-danger); }
.kpi-content { display: flex; flex-direction: column; }
.kpi-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--color-text); line-height: 1.2; }

/* Chart */
.chart-card .card-body { padding: 1rem 1.25rem; }
.chart-container { position: relative; width: 100%; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem; }
.pagination-info { font-size: 0.8125rem; color: var(--color-text-secondary); }

/* Filters */
.filters-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; padding: 1rem; background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.filters-bar .form-group { flex: 1; min-width: 200px; }

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  animation: slideIn 0.3s ease;
}
.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-danger); }
.toast svg { flex-shrink: 0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-bg-elevated);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; height: var(--topbar-height); padding: 0 1rem; border-bottom: 1px solid var(--color-border); }
.brand { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 1.125rem; color: var(--color-primary); text-decoration: none; }
.brand:hover { color: var(--color-primary-hover); }
.logo { width: 32px; height: 32px; color: var(--color-primary); }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0.5rem; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li { margin-bottom: 0.125rem; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; border-radius: var(--radius); color: var(--color-text-secondary); font-weight: 500; transition: all var(--transition-fast); }
.sidebar-nav a:hover { background: var(--color-bg-hover); color: var(--color-text); }
.sidebar-nav a.active { background: var(--color-primary-light); color: var(--color-primary); }
.nav-divider { height: 1px; background: var(--color-border); margin: 0.75rem 0.5rem; }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--color-border); }
.user-info { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.user-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--color-primary); color: var(--color-text-inverse); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem; }
.user-avatar-sm { width: 32px; height: 32px; font-size: 0.875rem; }
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 500; truncate; }
.user-role { font-size: 0.75rem; color: var(--color-text-muted); text-transform: capitalize; }
.sidebar-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,0.4); opacity: 0; visibility: hidden; transition: all var(--transition); }
.sidebar-overlay[style*="display: block"] { opacity: 1; visibility: visible; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
}
.menu-toggle { display: none; }
.topbar-search { position: relative; flex: 1; max-width: 400px; }
.topbar-search .search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); pointer-events: none; }
.topbar-search input { width: 100%; padding: 0.5rem 0.75rem 0.5rem 2.5rem; font-size: 0.875rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-full); transition: all var(--transition-fast); }
.topbar-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-light); background: var(--color-bg-elevated); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Notifications Dropdown */
.notifications-dropdown { position: relative; }
.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--color-text-inverse);
  background: var(--color-danger);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}
.notifications-dropdown .dropdown-menu { width: 360px; right: 0; top: calc(100% + 4px); }
.dropdown-list { max-height: 360px; overflow-y: auto; }
.notification-item { display: flex; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius); text-decoration: none; color: inherit; transition: background var(--transition-fast); }
.notification-item:hover { background: var(--color-bg-hover); }
.notification-item.unread { background: var(--color-primary-light); }
.notification-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius); flex-shrink: 0; }
.notification-icon.survey_completed { background: var(--color-success-light); color: var(--color-success); }
.notification-icon.survey_started { background: var(--color-primary-light); color: var(--color-primary); }
.notification-icon.client_created { background: #f3e8ff; color: #9333ea; }
.notification-content { flex: 1; min-width: 0; }
.notification-title { font-weight: 500; font-size: 0.8125rem; margin-bottom: 0.125rem; }
.notification-message { font-size: 0.8125rem; color: var(--color-text-secondary); margin-bottom: 0.125rem; line-clamp-1; }
.notification-time { font-size: 0.6875rem; color: var(--color-text-muted); }

/* User Menu */
.user-menu .dropdown-menu { width: 220px; right: 0; top: calc(100% + 4px); }
.dropdown-item { display: flex; align-items: center; gap: 0.5rem; }
.dropdown-danger { color: var(--color-danger); }
.dropdown-danger:hover { background: var(--color-danger-light); }

/* Theme Toggle */
.topbar .icon-btn .sun-icon { display: none; }
[data-theme="dark"] .topbar .icon-btn .sun-icon { display: block; }
[data-theme="dark"] .topbar .icon-btn .moon-icon { display: none; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; visibility: hidden; transition: all var(--transition); }
.modal-overlay[style*="display: flex"] { opacity: 1; visibility: visible; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--color-border); }
.modal-list { display: flex; flex-direction: column; gap: 0.25rem; }
.modal-option { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem; border-radius: var(--radius); cursor: pointer; transition: background var(--transition-fast); }
.modal-option:hover { background: var(--color-bg-hover); }
.modal-option input[type="checkbox"] { margin-top: 0.125rem; accent-color: var(--color-primary); }

/* Auth Pages */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; background: var(--color-bg); }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 2.5rem; }
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-brand { display: inline-flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.auth-brand .logo { width: 48px; height: 48px; }
.auth-header h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.auth-subtitle { color: var(--color-text-secondary); font-size: 0.875rem; margin-bottom: 0; }
.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.auth-links { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; font-size: 0.8125rem; color: var(--color-text-secondary); }
.auth-links a { font-weight: 500; }
.divider { color: var(--color-border); }
.auth-footer { text-align: center; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--color-border); font-size: 0.75rem; color: var(--color-text-muted); }

/* Utility Classes */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.min-w-0 { min-width: 0; }
.min-w-\[200px\] { min-width: 200px; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-danger { color: var(--color-danger); }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mb-4 { margin-bottom: 1rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-\[200px\] { max-width: 200px; }
.relative { position: relative; }
.spacer { flex: 1; }
.required-badge { font-size: 0.625rem; font-weight: 600; padding: 0.125rem 0.375rem; background: var(--color-danger-light); color: var(--color-danger); border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.05em; }

/* Responsive */
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); }
  .sidebar-close { display: none; }
  .sidebar-overlay { display: none; }
  .menu-toggle { display: none; }
  .content { margin-left: var(--sidebar-width); }
}

@media (max-width: 1023px) {
  .sidebar-close { display: flex; }
  .menu-toggle { display: flex; }
  .content { margin-left: 0; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: flex-start; }
  .kpi-card { padding: 1rem; }
  .kpi-icon { width: 40px; height: 40px; }
  .kpi-value { font-size: 1.25rem; }
  .auth-card { padding: 1.5rem; }
  .table-responsive { margin: 0 -1rem; padding: 0 1rem; }
}

/* Print */
@media print {
  .sidebar, .topbar, .page-actions, .form-actions, .dropdown, .icon-btn, .btn { display: none !important; }
  .content { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Focus visible for accessibility */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }