/* ==========================================================================
   THEME SOLAR CRM - MODERN SOLAR TECH DESIGN SYSTEM
   Brand Colors:
     - Primary: Royal Electric Blue (#0052cc / #0d5be1 / #0040a8)
     - Accent: Solar Amber Orange (#ff7a00 / #f56c00 / #ff9533)
   ========================================================================== */

:root {
  color-scheme: light;
  --font-family: 'Inter', 'Prompt', 'Sarabun', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Brand Colors */
  --brand-blue: #0052cc;
  --brand-blue-hover: #0043a8;
  --brand-blue-soft: #eff6ff;
  --brand-blue-border: #bfdbfe;

  --solar-orange: #ff7a00;
  --solar-orange-hover: #e56b00;
  --solar-orange-soft: #fff7ed;
  --solar-orange-border: #fed7aa;

  /* Surfaces & Backgrounds */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-hover: #e2e8f0;
  --sidebar-bg: #0b1528;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #94a3b8;
  --sidebar-active: #0052cc;
  --sidebar-border: #1e293b;

  /* Typography */
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  /* Status Colors */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  /* Elevations */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-solar: 0 10px 30px -5px rgba(0, 82, 204, 0.2);
  --shadow-orange: 0 10px 30px -5px rgba(255, 122, 0, 0.25);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08101e;
  --surface: #0f1c32;
  --surface-2: #162642;
  --surface-hover: #1e3355;
  --sidebar-bg: #060c18;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #889bb5;
  --sidebar-active: #0052cc;
  --sidebar-border: #142239;

  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --muted: #8da2c0;
  --line: #1c2e4e;
  --line-strong: #273e66;

  --brand-blue-soft: rgba(0, 82, 204, 0.2);
  --brand-blue-border: #1d4ed8;
  --solar-orange-soft: rgba(255, 122, 0, 0.15);
  --solar-orange-border: rgba(255, 122, 0, 0.35);

  --success-soft: rgba(16, 185, 129, 0.15);
  --warning-soft: rgba(245, 158, 11, 0.15);
  --danger-soft: rgba(239, 68, 68, 0.15);
  --info-soft: rgba(2, 132, 199, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

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

.hidden {
  display: none !important;
}

/* ==========================================================================
   LAYOUT: APP SHELL & SIDEBAR
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px 8px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo-container {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.brand-logo-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-info strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.brand-info span {
  display: block;
  font-size: 11px;
  color: var(--solar-orange);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Sidebar User Info */
.sidebar-user-card {
  margin: 12px 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.sidebar-user-header .muted {
  font-size: 11px;
  color: var(--sidebar-muted);
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(0, 82, 204, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(0, 82, 204, 0.4);
  width: fit-content;
}

.user-role-badge.role-admin { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.user-role-badge.role-ceo { background: rgba(245, 158, 11, 0.2); color: #fde68a; border-color: rgba(245, 158, 11, 0.35); }
.user-role-badge.role-lead-admin { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.35); }
.user-role-badge.role-sales { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; border-color: rgba(16, 185, 129, 0.35); }
.user-role-badge.role-engineer { background: rgba(14, 165, 233, 0.2); color: #bae6fd; border-color: rgba(14, 165, 233, 0.35); }
.user-role-badge.role-pm { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.35); }

/* Navigation */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: var(--transition);
}

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

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--brand-blue);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 82, 204, 0.4);
}

/* Sidebar Footer & Monthly Target */
.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius);
}

.sidebar-footer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-bottom: 6px;
}

.sidebar-footer strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.progress-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue) 0%, var(--solar-orange) 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-switch-container {
  margin-top: 10px;
  padding: 8px 4px 0 4px;
}

.role-switch-container .muted {
  display: block;
  font-size: 11px;
  color: var(--sidebar-muted);
  margin-bottom: 4px;
}

.role-select {
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: #101c30;
  border: 1px solid var(--sidebar-border);
  color: #f8fafc;
  font-size: 12px;
  outline: none;
}

/* ==========================================================================
   WORKSPACE & TOPBAR
   ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: var(--shadow-sm);
}

.topbar-title-area .eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--solar-orange);
}

.topbar-title-area h1 {
  margin: 2px 0 0 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding: 7px 12px 7px 32px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 13px;
  width: 240px;
  transition: var(--transition);
  outline: none;
}

.search-box input:focus {
  width: 290px;
  background: var(--surface);
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.15);
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.primary-button {
  background: var(--brand-blue);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(0, 82, 204, 0.25);
}
.primary-button:hover {
  background: var(--brand-blue-hover);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.35);
  transform: translateY(-1px);
}
.primary-button:active {
  transform: translateY(0);
}

.solar-button {
  background: var(--solar-orange);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(255, 122, 0, 0.25);
}
.solar-button:hover {
  background: var(--solar-orange-hover);
  box-shadow: 0 4px 12px rgba(255, 122, 0, 0.35);
  transform: translateY(-1px);
}

.primary-button.alt {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
.primary-button.alt:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.ghost-button {
  padding: 7px 12px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.ghost-button:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 15px;
  position: relative;
}
.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}

/* Notification Bell with Badge */
.notification-bell-btn {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--solar-orange);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  height: 18px;
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(255, 122, 0, 0.4);
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   ROLE SWITCHER BAR (DASHBOARD TOP PILLS)
   ========================================================================== */
.role-switcher-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.role-switcher-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.role-switcher-label .active-role-tag {
  background: var(--brand-blue);
  color: #ffffff;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.role-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.role-pill-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: var(--transition);
}
.role-pill-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--line-strong);
}
.role-pill-btn.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
  box-shadow: 0 2px 8px rgba(0, 82, 204, 0.3);
  font-weight: 600;
}
.role-pill-btn.super-admin.active {
  background: #0f172a;
  border-color: #334155;
  color: #38bdf8;
}

/* ==========================================================================
   VIEW CONTAINER & PANELS
   ========================================================================== */
.view {
  display: none;
  padding: 24px;
}
.view.active-view {
  display: block;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.panel-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head .muted {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Hero Panel (Solar Live Operations) */
.hero-panel {
  background: linear-gradient(135deg, #0043a8 0%, #002b70 65%, #ff7a00 160%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-solar);
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(255, 122, 0, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.hero-copy {
  max-width: 650px;
  position: relative;
  z-index: 1;
}

.hero-copy .eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffb066;
  margin: 0 0 6px 0;
}

.hero-copy h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.hero-copy p {
  font-size: 14px;
  color: #e0e7ff;
  margin: 0;
  line-height: 1.6;
}

.hero-badge-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}

.hero-stat-badge {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 8px 16px;
  text-align: right;
}

.hero-stat-badge span {
  display: block;
  font-size: 11px;
  color: #cbd5e1;
}

.hero-stat-badge strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

/* ==========================================================================
   METRIC CARDS GRID
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-blue);
  opacity: 0.8;
}

.metric-card.solar-accent::before {
  background: var(--solar-orange);
}

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

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

.metric-header span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.metric-icon-box {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.metric-icon-box.orange {
  background: var(--solar-orange-soft);
  color: var(--solar-orange);
}

.metric-card strong {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  line-height: 1.1;
}

.metric-card .trend {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.metric-card .trend.up {
  color: var(--success);
}

.metric-card .trend.down {
  color: var(--danger);
}

.metric-card .trend.solar {
  color: var(--solar-orange);
  font-weight: 600;
}

/* ==========================================================================
   ROLE-SPECIFIC DASHBOARD GRIDS & CARDS
   ========================================================================== */
.split-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

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

.leaderboard-table th, .leaderboard-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.leaderboard-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.sales-rep-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sales-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Task Item & Urgency list */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: var(--transition);
}

.task-item:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.task-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.task-info span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.task-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mini Kanban & Stepper */
.mini-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stage-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.mini-stage-card span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.mini-stage-card strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Chart Bars */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 100px;
  align-items: center;
  gap: 12px;
}

.bar-row span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.bar-track {
  height: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue) 0%, #3b82f6 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.bar-track i.solar {
  background: linear-gradient(90deg, var(--solar-orange) 0%, #fb923c 100%);
}

.bar-row strong {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: var(--text);
}

/* ==========================================================================
   TABLES & TOOLBARS
   ========================================================================== */
.table-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-panel .panel-head {
  padding: 20px 20px 14px 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.toolbar {
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar select {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.toolbar select:focus {
  border-color: var(--brand-blue);
}

.responsive-table {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead th {
  background: var(--surface);
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--surface-2);
}

/* Table Badges & Status */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.pill-lead { background: #dbeafe; color: #1d4ed8; }
.pill.pill-survey { background: #e0e7ff; color: #4338ca; }
.pill.pill-proposal { background: #fef3c7; color: #b45309; }
.pill.pill-contract { background: #ffedd5; color: #c2410c; }
.pill.pill-won { background: #dcfce7; color: #15803d; }
.pill.pill-lost { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.pill.pill-junk { background: #f1f5f9; color: #64748b; }

.priority-high { background: var(--danger-soft); color: var(--danger); }
.priority-med { background: var(--warning-soft); color: var(--warning); }
.priority-low { background: var(--info-soft); color: var(--info); }

/* ==========================================================================
   KANBAN BOARD (PIPELINE)
   ========================================================================== */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(280px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 500px;
}

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.kanban-col-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

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

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

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

.kanban-card strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Kanban Card Stage Movement Controls (Left & Right Buttons) */
.kanban-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  gap: 6px;
}

.stage-move-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.stage-move-btn:hover:not(:disabled) {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
}

.stage-move-btn.forward:hover:not(:disabled) {
  background: var(--solar-orange-soft);
  color: var(--solar-orange);
  border-color: var(--solar-orange-border);
}

.stage-move-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Coordinator Badge in Projects */
.coordinator-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-size: 11px;
  font-weight: 600;
}

/* Photo Checklist & Attachment Grids */
.photo-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.photo-upload-box {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  transition: var(--transition);
}

.photo-upload-box:hover {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.photo-upload-box img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.photo-upload-box span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
}

.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  border-radius: var(--radius-full);
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#surveyPdfReportContainer {
  display: none;
}

/* Print Styles for Site Survey PDF Report */
@media print {
  body > *:not(#surveyPdfReportContainer) {
    display: none !important;
  }
  #surveyPdfReportContainer {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 24px;
    background: #ffffff !important;
    color: #000000 !important;
  }
  #surveyPdfReportContainer, #surveyPdfReportContainer * {
    visibility: visible !important;
  }
  .no-print {
    display: none !important;
  }
}

/* ==========================================================================
   NOTIFICATION CENTER & DROPDOWN PANEL
   ========================================================================== */
.notification-dropdown {
  position: absolute;
  top: 60px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: dropdown-slide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.notification-dropdown.show {
  display: flex;
}

@keyframes dropdown-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.notif-tab {
  flex: 1;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  border-bottom: 2px solid transparent;
}
.notif-tab.active {
  color: var(--brand-blue);
  border-bottom-color: var(--brand-blue);
  background: var(--surface);
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.notif-item:hover {
  background: var(--surface-2);
}
.notif-item.unread {
  background: rgba(0, 82, 204, 0.04);
}
.notif-item.unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--solar-orange);
}

.notif-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-icon.solar {
  background: var(--solar-orange-soft);
  color: var(--solar-orange);
}

.notif-content strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.notif-content p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.notif-time {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

/* ==========================================================================
   FLOATING TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 320px;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--solar-orange);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateX(120%);
  animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toast-in {
  to { transform: translateX(0); }
}

.toast.toast-exit {
  animation: toast-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toast-out {
  to { transform: translateX(120%); opacity: 0; }
}

.toast-body strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.toast-body p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   EMAIL SUMMARY MODAL & HTML PREVIEW
   ========================================================================== */
.email-preview-wrapper {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-height: 480px;
  overflow-y: auto;
}

.email-template-card {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 600px;
  margin: 0 auto;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  color: #1e293b;
}

.email-tpl-header {
  background: #0052cc;
  padding: 24px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.email-tpl-header h2 {
  margin: 0;
  font-size: 20px;
  color: #ffffff;
}

.email-tpl-header p {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #bfdbfe;
}

.email-tpl-badge {
  background: #ff7a00;
  color: #ffffff;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 20px;
}

.email-tpl-body {
  padding: 24px;
}

.email-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.email-kpi-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.email-kpi-box span {
  font-size: 11px;
  color: #64748b;
  display: block;
}

.email-kpi-box strong {
  font-size: 16px;
  color: #0f172a;
  display: block;
}

.email-lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 20px;
}

.email-lead-table th {
  background: #f1f5f9;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 2px solid #cbd5e1;
  color: #475569;
}

.email-lead-table td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.email-tpl-footer {
  background: #f8fafc;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* ==========================================================================
   MODALS / DIALOGS
   ========================================================================== */
dialog {
  padding: 0;
  border: none;
  background: transparent;
  max-width: min(900px, 95vw);
  width: 100%;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
}

.dialog-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-card h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 18px;
}
.close-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.field input, .field select, .field textarea {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.12);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

menu {
  margin: 0;
  padding: 16px 0 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 82, 204, 0.18), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(255, 122, 0, 0.15), transparent 40%),
    var(--bg);
}

.login-card {
  width: min(460px, 100%);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-top: 6px solid var(--brand-blue);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 6px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}

.login-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand strong {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.login-brand span {
  display: block;
  font-size: 12px;
  color: var(--solar-orange);
  font-weight: 600;
}

.login-card h1 {
  margin: 0 0 6px 0;
  font-size: 24px;
  font-weight: 800;
}

.login-card p.subtitle {
  margin: 0 0 20px 0;
  font-size: 13px;
  color: var(--muted);
}

.demo-credentials {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.demo-credentials strong {
  display: block;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
}

.demo-credentials small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
}

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

.demo-grid button {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.demo-grid button:hover {
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
  border-color: var(--brand-blue-border);
}

.demo-grid button.super-admin-btn {
  grid-column: 1 / -1;
  background: #0f172a;
  color: #38bdf8;
  border-color: #334155;
}

/* ==========================================================================
   EPC PROJECT MODAL: MILESTONE PILLS & DYNAMIC EQUIPMENT / DOCUMENTS
   ========================================================================== */
.milestone-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.milestone-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef2f6;
  border: 1.5px solid transparent;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.milestone-pill-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
}

.milestone-pill-btn .pill-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.milestone-pill-btn.active {
  background: #fff9f2;
  border-color: var(--solar-orange);
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(255, 122, 0, 0.15);
}

.milestone-pill-btn.active .pill-num {
  background: var(--solar-orange);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(255, 122, 0, 0.4);
}

[data-theme="dark"] .milestone-pill-btn {
  background: #1e293b;
  color: #94a3b8;
  border-color: transparent;
}

[data-theme="dark"] .milestone-pill-btn:hover {
  background: #273e66;
  color: #f8fafc;
}

[data-theme="dark"] .milestone-pill-btn .pill-num {
  background: #0f1c32;
  color: #94a3b8;
}

[data-theme="dark"] .milestone-pill-btn.active {
  background: rgba(255, 122, 0, 0.15);
  border-color: var(--solar-orange);
  color: #f8fafc;
}

[data-theme="dark"] .milestone-pill-btn.active .pill-num {
  background: var(--solar-orange);
  color: #ffffff;
}

/* Dynamic Rows for Equipment & Documents */
.dynamic-item-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.2s ease;
}

.dynamic-item-card:hover {
  border-color: #cbd5e1;
  background: #edf2f7;
}

.dynamic-item-num {
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  min-width: 22px;
  flex-shrink: 0;
}

.dynamic-item-card select,
.dynamic-item-card input[type="text"],
.dynamic-item-card input[type="number"] {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dynamic-item-card select:focus,
.dynamic-item-card input[type="text"]:focus,
.dynamic-item-card input[type="number"]:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px var(--brand-blue-soft);
}

.equipment-type-select {
  min-width: 140px;
  max-width: 170px;
  flex: 1;
}

.equipment-brand-input {
  flex: 1.2;
}

.equipment-model-input {
  flex: 1.4;
}

.equipment-qty-input {
  width: 90px;
  flex-shrink: 0;
  text-align: center;
}

.doc-type-select {
  min-width: 170px;
  max-width: 210px;
  flex: 1.2;
}

.doc-file-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 2;
  min-width: 220px;
  overflow: hidden;
}

.doc-choose-file-btn {
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-choose-file-btn:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--brand-blue-soft);
}

.doc-file-status {
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.doc-file-status.file-attached {
  color: #059669;
  font-weight: 600;
}

.dynamic-remove-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 6px;
  color: #64748b;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.dynamic-remove-btn:hover {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #ef4444;
}

[data-theme="dark"] .dynamic-item-card {
  background: #162642;
  border-color: #273e66;
}

[data-theme="dark"] .dynamic-item-card:hover {
  background: #1e3355;
  border-color: #334e7a;
}

[data-theme="dark"] .dynamic-item-num {
  color: #cbd5e1;
}

[data-theme="dark"] .dynamic-item-card select,
[data-theme="dark"] .dynamic-item-card input[type="text"],
[data-theme="dark"] .dynamic-item-card input[type="number"] {
  background: #0f1c32;
  border-color: #273e66;
  color: #f8fafc;
}

[data-theme="dark"] .doc-choose-file-btn,
[data-theme="dark"] .dynamic-remove-btn {
  background: #0f1c32;
  border-color: #273e66;
  color: #cbd5e1;
}

[data-theme="dark"] .dynamic-remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

/* Project Docs Viewer Dialog styling */
.project-doc-view-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  gap: 12px;
}

.project-doc-view-card:hover {
  border-color: var(--brand-blue-border);
  background: var(--surface-hover);
}

/* ==========================================================================
   PIPELINE SURVEY APPOINTMENTS & DESIGN / BOQ WORKFLOW
   ========================================================================== */
.kanban-schedule-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--solar-orange-soft);
  color: var(--solar-orange);
  border: 1px solid var(--solar-orange-border);
  cursor: pointer;
  transition: var(--transition);
}

.kanban-schedule-btn:hover {
  background: var(--solar-orange);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.kanban-proposal-ready-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: #10b981;
  color: #ffffff;
  border: 1px solid #059669;
  cursor: pointer;
  transition: var(--transition);
  animation: pulseProposalBtn 2s infinite ease-in-out;
}

@keyframes pulseProposalBtn {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.survey-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
}

.survey-status-badge.pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.survey-status-badge.completed {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.survey-status-badge.ready {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.survey-design-attachment-box {
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  transition: border-color 0.2s;
}

.survey-design-attachment-box:hover {
  border-color: var(--brand-blue);
}

.survey-file-status {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.survey-file-status.attached {
  color: #059669;
  font-weight: 600;
}

/* Survey Project-Opened Badge */
.survey-status-badge.project-opened {
  background: #fdf4ff;
  color: #7e22ce;
  border: 1px solid #e9d5ff;
}

/* Kanban Drag & Drop and Lost Column Styles */
.kanban-card[draggable="true"] {
  cursor: grab;
}
.kanban-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
}
.kanban-col.drag-over {
  border: 2px dashed var(--brand-blue);
  background: rgba(0, 114, 206, 0.08);
}
.kanban-col[data-stage="Lost"] .kanban-col-head {
  border-bottom: 2px solid #ef4444;
}
.kanban-card.card-lost {
  opacity: 0.85;
  border-left: 3px solid #ef4444;
}
.kanban-card.card-lost:hover {
  opacity: 1;
}
.kanban-reopen-btn {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: var(--transition);
}
.kanban-reopen-btn:hover {
  background: #2563eb;
  color: #ffffff;
}
.kanban-lost-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: var(--transition);
}
.kanban-lost-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
}

/* Service Ticket Dialog Matching Screenshot */
.ticket-dialog-card {
  max-width: 680px;
  width: 95vw;
  border-radius: 16px;
  padding: 28px 32px;
}
.ticket-dialog-card label {
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}
.ticket-dialog-card input,
.ticket-dialog-card select,
.ticket-dialog-card textarea {
  background: #f1f5f9;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.ticket-dialog-card input:focus,
.ticket-dialog-card select:focus,
.ticket-dialog-card textarea:focus {
  border-color: var(--brand-blue);
  background: #ffffff;
  outline: none;
}
[data-theme="dark"] .ticket-dialog-card input,
[data-theme="dark"] .ticket-dialog-card select,
[data-theme="dark"] .ticket-dialog-card textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}

/* File Attachment Chips */
.file-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 11px;
  color: var(--text);
}
.file-attachment-chip a {
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 600;
}
.file-attachment-chip .chip-del {
  color: var(--danger);
  cursor: pointer;
  font-weight: bold;
  margin-left: 4px;
}

/* ==========================================================================
   EXECUTIVE CONFIDENTIAL INTELLIGENCE & TARGET DIALOG
   ========================================================================== */
.executive-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(0, 82, 204, 0.08), rgba(255, 122, 0, 0.08));
  border: 1px solid rgba(0, 82, 204, 0.2);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}

[data-theme="dark"] .executive-banner {
  background: linear-gradient(135deg, rgba(0, 82, 204, 0.2), rgba(255, 122, 0, 0.15));
  border-color: rgba(255, 255, 255, 0.12);
}

.executive-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.executive-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

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

.executive-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand-blue);
}

.executive-kpi-card.highlight::before {
  background: var(--solar-orange);
}

.executive-kpi-card.profit::before {
  background: var(--success);
}

.executive-kpi-card.deal::before {
  background: var(--brand-blue);
}

.executive-kpi-card.lost::before {
  background: var(--danger);
}

.executive-kpi-card.fleet::before {
  background: #8b5cf6;
}

.executive-kpi-card .card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.executive-kpi-card strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.executive-kpi-card .card-sub {
  font-size: 11px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Cloudflare D1 Status Badge */
.cloud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cloud-status-badge .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  transition: background 0.3s;
}

.cloud-status-badge.connected {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}
.cloud-status-badge.connected .status-dot {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.cloud-status-badge.syncing {
  border-color: rgba(255, 122, 0, 0.3);
  background: rgba(255, 122, 0, 0.08);
  color: #d97706;
}
.cloud-status-badge.syncing .status-dot {
  background: #f59e0b;
  animation: pulse-sync 1s infinite alternate;
}

.cloud-status-badge.offline {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}
.cloud-status-badge.offline .status-dot {
  background: #94a3b8;
}

@keyframes pulse-sync {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.2); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    box-shadow: var(--shadow-lg);
  }
}

/* ==========================================================================
   ENHANCEMENTS: PAGINATION, SEARCHABLE SELECT, SLA & ROUTE PLANNER
   ========================================================================== */

/* Pagination Bar */
.table-pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  padding: 5px 10px;
  min-width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--surface-2);
}
.page-btn.active {
  background: var(--brand-blue);
  color: #ffffff;
  border-color: var(--brand-blue);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Searchable Select (Combobox) */
.searchable-select-wrap {
  position: relative;
  width: 100%;
}
.searchable-select-input {
  width: 100%;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.searchable-select-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.15);
}
.searchable-select-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.searchable-select-clear:hover {
  color: var(--danger);
}
.searchable-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.searchable-select-dropdown.open {
  display: block;
}
.searchable-select-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.searchable-select-item:last-child {
  border-bottom: none;
}
.searchable-select-item:hover,
.searchable-select-item.selected {
  background: rgba(0, 82, 204, 0.08);
  color: var(--brand-blue);
  font-weight: 600;
}
.searchable-select-item small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: normal;
}
.searchable-select-no-results {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* SLA Info Box */
.sla-info-box {
  transition: all 0.2s ease;
}
.sla-info-box.sla-urgent {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}
.sla-info-box.sla-high {
  border-left-color: #f97316;
  background: rgba(249, 115, 22, 0.08);
}
.sla-info-box.sla-medium {
  border-left-color: #eab308;
  background: rgba(234, 179, 8, 0.08);
}
.sla-info-box.sla-low {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

/* Technician Route Planning */
.route-stop-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}
.route-stop-card:hover {
  border-color: var(--brand-blue);
}
.route-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.route-stop-info {
  flex: 1;
}
.route-stop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.route-stop-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.route-stop-time {
  font-size: 12px;
  color: var(--solar-orange);
  font-weight: 600;
}
.route-stop-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.route-stop-contact {
  font-size: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
}

