/* ============================================
   HAYATI PHARMA — SERVICE MONITOR
   Design System & Global Styles
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Color Palette - Deep Navy + Teal */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1629;
  --bg-card: #141b2d;
  --bg-card-hover: #1a2340;
  --bg-input: #0d1220;
  --bg-header: rgba(15, 22, 41, 0.85);

  --border-color: rgba(255, 255, 255, 0.06);
  --border-focus: #14b8a6;

  --text-primary: #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted: #5a6478;
  --text-heading: #f1f5f9;

  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-glow: rgba(20, 184, 166, 0.15);
  --accent-light: rgba(20, 184, 166, 0.1);

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 0.7rem;
  --font-size-sm: 0.8rem;
  --font-size-base: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.15rem;
  --font-size-xl: 1.35rem;
  --font-size-2xl: 1.75rem;
  --font-size-3xl: 2.25rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(20, 184, 166, 0.15);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --header-height: 64px;
}

/* ---------- Light Theme ---------- */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #e4e7ec;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-input: #f5f6f8;
  --bg-header: rgba(255, 255, 255, 0.88);

  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #0d9488;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-heading: #0f172a;

  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.12);
  --accent-light: rgba(13, 148, 136, 0.08);

  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.08);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-glow: 0 0 20px rgba(13, 148, 136, 0.1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ---------- LOGIN PAGE ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  overflow: hidden;
}

.login-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(20, 184, 166, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  z-index: 0;
}

.login-particles {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.1) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 30%, rgba(255,255,255,0.12) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 70%, rgba(255,255,255,0.08) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.1) 0%, transparent 100%);
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: var(--space-lg);
}

.login-card {
  background: rgba(20, 27, 45, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.6s ease;
}

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

.login-logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.logo-icon {
  display: inline-flex;
  margin-bottom: var(--space-md);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(20, 184, 166, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(20, 184, 166, 0.5)); }
}

.login-logo h1 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.login-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 4px;
  font-weight: 500;
}

.login-form .form-group {
  margin-bottom: var(--space-lg);
}

.login-form label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.login-form .input-wrapper input {
  width: 100%;
  padding: 14px 48px 14px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  transition: var(--transition-base);
  outline: none;
}

.login-form .input-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition-fast);
}

.toggle-password:hover { color: var(--text-primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-base);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(20, 184, 166, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background: rgba(255,255,255,0.03);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--font-size-xs);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.btn-login {
  width: 100%;
  padding: 16px;
  font-size: var(--font-size-md);
}

.login-error {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: var(--font-size-sm);
  text-align: center;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ---------- APP LAYOUT ---------- */
.app-body {
  background: var(--bg-primary);
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 100;
  gap: var(--space-lg);
}

.header-left {
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-name {
  display: block;
  font-size: var(--font-size-md);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-heading);
}

.brand-sub {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
  overflow: visible;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

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

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* Nav dropdown (Reports → Summary / View Doctor) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle .nav-caret {
  margin-left: 2px;
  opacity: 0.7;
  transition: transform var(--transition-fast);
}

.nav-dropdown:hover .nav-dropdown-toggle .nav-caret,
.nav-dropdown.open .nav-dropdown-toggle .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
  z-index: 200;
}

.nav-dropdown-menu.up {
  top: auto;
  bottom: calc(100% + 6px);
}

/* Invisible bridge over the gap so hover doesn't drop when moving to the menu */
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
}

.nav-dropdown-menu.up::before {
  top: auto;
  bottom: -8px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
  animation: fadeIn 0.15s ease;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: var(--transition-fast);
}

.nav-dropdown-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* Active highlight when Summary or View Doctor is the current tab */
html[data-tab="reports"] #navReports,
html[data-tab="viewDoctor"] #navReports {
  color: var(--accent);
  background: var(--accent-light);
}

html[data-tab="reports"] .mobile-nav-dropdown .nav-dropdown-toggle,
html[data-tab="viewDoctor"] .mobile-nav-dropdown .nav-dropdown-toggle {
  color: var(--accent);
}

html[data-tab="reports"] .nav-dropdown-item[data-tab="reports"],
html[data-tab="viewDoctor"] .nav-dropdown-item[data-tab="viewDoctor"] {
  color: var(--accent);
  background: var(--accent-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.prevbiz-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.prevbiz-toggle input {
  cursor: pointer;
  accent-color: var(--accent);
}

/* Prev. Business figures are shown only when "Include Prev. Business" is on */
.prevbiz-col { display: none; }
.show-prevbiz .prevbiz-col { display: table-cell; }
.prevbiz-row { display: none; }
.show-prevbiz .prevbiz-row { display: flex; }

.fy-selector {
  position: relative;
}

.fy-dropdown {
  padding: 8px 32px 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2314b8a6' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
}

.fy-dropdown:focus {
  border-color: var(--accent);
}

.fy-dropdown option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Mobile Nav */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  padding: var(--space-xs) 0;
  z-index: 100;
  justify-content: space-around;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.mobile-nav-btn.active {
  color: var(--accent);
}

.mobile-nav-btn:hover {
  color: var(--text-primary);
}

/* ---------- MAIN CONTENT ---------- */
.app-main {
  padding-top: calc(var(--header-height) + var(--space-lg));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  padding-bottom: var(--space-2xl);
  max-width: 1400px;
  margin: 0 auto;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* Attribute-driven tab visibility — set in <head> before first paint so the
   correct tab renders immediately (no Dashboard flash on refresh/deep-link). */
html[data-tab="dashboard"]  #tabDashboard,
html[data-tab="dataEntry"]  #tabDataEntry,
html[data-tab="viewDoctor"] #tabViewDoctor,
html[data-tab="doctorsDb"]  #tabDoctorsDb,
html[data-tab="productsDb"]    #tabProductsDb,
html[data-tab="reports"]       #tabReports,
html[data-tab="reportBuilder"] #tabReportBuilder,
html[data-tab="settings"]      #tabSettings {
  display: block;
}

/* Matching nav highlight (desktop + mobile) for the same first-paint reason */
html[data-tab="dashboard"]  .nav-tab[data-tab="dashboard"],
html[data-tab="dataEntry"]  .nav-tab[data-tab="dataEntry"],
html[data-tab="viewDoctor"] .nav-tab[data-tab="viewDoctor"],
html[data-tab="doctorsDb"]  .nav-tab[data-tab="doctorsDb"],
html[data-tab="productsDb"] .nav-tab[data-tab="productsDb"],
html[data-tab="reports"]    .nav-tab[data-tab="reports"] {
  color: var(--accent);
  background: var(--accent-light);
}

html[data-tab="dashboard"]  .mobile-nav-btn[data-tab="dashboard"],
html[data-tab="dataEntry"]  .mobile-nav-btn[data-tab="dataEntry"],
html[data-tab="viewDoctor"] .mobile-nav-btn[data-tab="viewDoctor"],
html[data-tab="doctorsDb"]  .mobile-nav-btn[data-tab="doctorsDb"],
html[data-tab="productsDb"] .mobile-nav-btn[data-tab="productsDb"],
html[data-tab="reports"]    .mobile-nav-btn[data-tab="reports"] {
  color: var(--accent);
}

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

/* Flash a form card when it enters edit mode */
@keyframes editFlash {
  0%   { background-color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-glow); }
  100% { background-color: var(--bg-card); box-shadow: var(--shadow-sm); }
}
.edit-flash {
  animation: editFlash 0.55s ease 2;
}

/* ---------- PAGE HEADER ---------- */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.page-desc {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
}

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: var(--transition-base);
}

.card:hover {
  border-color: rgba(255,255,255,0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-heading);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  font-size: var(--font-size-xs);
  font-weight: 700;
}

/* ---------- STATS GRID ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
  box-shadow: var(--shadow-md);
}

.stat-card.stat-success::before { background: linear-gradient(90deg, var(--success), #16a34a); }
.stat-card.stat-warning::before { background: linear-gradient(90deg, var(--warning), #d97706); }
.stat-card.stat-danger::before { background: linear-gradient(90deg, var(--danger), #dc2626); }
.stat-card.stat-info::before { background: linear-gradient(90deg, var(--info), #2563eb); }

.stat-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.stat-value {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-heading);
}

.stat-value.text-success { color: var(--success); }
.stat-value.text-warning { color: var(--warning); }
.stat-value.text-danger { color: var(--danger); }

/* ---------- TABLES ---------- */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table thead th {
  background: rgba(255,255,255,0.03);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.data-table tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  border-top: 2px solid var(--border-color);
  color: var(--accent);
  background: rgba(20, 184, 166, 0.03);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.amount-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.action-btns {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.btn-table {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: var(--transition-fast);
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-table-edit {
  color: var(--info);
}
.btn-table-edit:hover { background: var(--info-bg); }

.btn-table-delete {
  color: var(--danger);
}
.btn-table-delete:hover { background: var(--danger-bg); }

/* ---------- FORMS ---------- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: var(--transition-base);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.readonly-field {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  align-items: end;
}

.form-row-inline {
  grid-template-columns: 1fr auto auto;
}

.form-group-sm {
  min-width: 120px;
}

.flex-grow { flex: 1; }

.form-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.form-hint {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}
.form-hint strong { color: var(--accent); }

/* Report Builder — group-by chips */
.rb-field { margin-bottom: var(--space-lg); }
.rb-field > label {
  display: block;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.rb-chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.rb-chip {
  padding: 8px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}
.rb-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.rb-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Multi-select (chips + search) */
.multiselect { position: relative; width: 100%; }
.ms-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: var(--transition-base);
}
.ms-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 9px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
}
.ms-chip button {
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}
.ms-chip button:hover { color: var(--danger); }
.ms-input {
  flex: 1;
  min-width: 90px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  outline: none;
  padding: 2px 0;
}
.ms-input::placeholder { color: var(--text-muted); }
.ms-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
  display: none;
}
.ms-list.open { display: block; animation: fadeIn 0.15s ease; }
.ms-option {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-fast);
}
.ms-option:hover { background: var(--accent-light); color: var(--accent); }
.ms-option.selected { color: var(--accent); font-weight: 600; }
.ms-empty { padding: 10px; text-align: center; color: var(--text-muted); font-size: var(--font-size-sm); }

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: var(--font-size-base) !important;
  color: var(--text-primary) !important;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* ---------- ENTRY FORM ---------- */
.entry-form-card {
  border-left: 3px solid var(--accent);
}

.entry-filters {
  display: flex;
  gap: var(--space-sm);
}

.filter-select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  outline: none;
}

.filter-select:focus {
  border-color: var(--accent);
}

.filter-select option {
  background: var(--bg-card);
}

/* ---------- VIEW DOCTOR ---------- */
.doctor-selector-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.doctor-selector-bar label {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.doctor-select {
  flex: 1;
  max-width: 400px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  outline: none;
}

.doctor-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.doctor-select option {
  background: var(--bg-card);
}

/* Searchable combobox (View Doctor + Data Entry) */
.combobox {
  position: relative;
  width: 100%;
}

/* View Doctor selector bar keeps a constrained width */
.doctor-selector-bar .combobox {
  flex: 1;
  max-width: 400px;
}

.combobox .doctor-select {
  width: 100%;
  max-width: none;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.combobox-list.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.combobox-option {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--accent-light);
  color: var(--accent);
}

.combobox-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Clear (×) button inside a clearable combobox */
.combobox-clear {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.combobox-clear:hover {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text-primary);
}

.combobox input.has-clear {
  padding-right: 38px;
}

.doctor-header-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.doctor-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.doctor-info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.doctor-info-card h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: var(--space-sm);
}

.doctor-info-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xs);
}

.doctor-info-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 80px;
}

.doctor-info-value {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.doctor-metrics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.metric-item {
  text-align: center;
  padding: var(--space-sm);
}

.metric-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-heading);
}

.metric-value.positive { color: var(--success); }
.metric-value.negative { color: var(--danger); }

/* Matrix Table */
.matrix-container {
  max-height: 600px;
  overflow: auto;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-card);
  text-align: center;
}

.matrix-table thead th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--bg-card);
}

.matrix-table tbody td:first-child {
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 1;
  font-weight: 500;
  white-space: nowrap;
}

.matrix-table tbody td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
}

.matrix-table tfoot td {
  text-align: right;
}

.matrix-table tfoot td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: rgba(20, 184, 166, 0.03);
  z-index: 1;
}

.matrix-cell-filled {
  color: var(--accent);
  font-weight: 500;
}

.matrix-cell-total {
  color: var(--text-heading);
  font-weight: 700;
  background: rgba(255,255,255,0.02);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
  gap: var(--space-md);
}

.empty-state p {
  font-size: var(--font-size-md);
}

/* ---------- PAGINATION ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.pagination button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- MODALS ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-heading);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  justify-content: flex-end;
}

.confirm-message {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

.toast-success {
  background: #065f46;
  color: #a7f3d0;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.toast-error {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.toast-info {
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ---------- ACHIEVEMENT BAR ---------- */
.achievement-bar {
  width: 80px;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.achievement-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.achievement-fill.low { background: var(--danger); }
.achievement-fill.mid { background: var(--warning); }
.achievement-fill.high { background: var(--success); }

/* ---------- LOADING SPINNER ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .header-nav { display: none; }
  .mobile-nav { display: flex; }
  .app-main { padding-bottom: 80px; }
  .doctor-header-cards { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-header { padding: 0 var(--space-md); gap: var(--space-sm); }
  .brand-name { font-size: var(--font-size-sm); }
  .brand-sub { display: none; }
  .app-main { padding-left: var(--space-md); padding-right: var(--space-md); }
  .page-header h1 { font-size: var(--font-size-xl); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .form-row-inline { grid-template-columns: 1fr; }
  .entry-filters { flex-direction: column; }
  .card-header { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .doctor-selector-bar { flex-direction: column; align-items: stretch; }
  .toast-container { left: 16px; right: 16px; bottom: 80px; }
  .toast { min-width: auto; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .modal { padding: var(--space-lg); width: 95%; }
}

/* ---------- THEME TOGGLE ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.theme-toggle:hover {
  background: rgba(128,128,128,0.1);
  color: var(--text-primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.3s ease;
}

/* Dark mode: show sun icon (to switch to light) */
.theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg); }
.theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg); }

/* Light mode: show moon icon (to switch to dark) */
[data-theme="light"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg); }

/* Login page toggle */
.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.app-theme-toggle {
  flex-shrink: 0;
}

/* ---------- LIGHT THEME OVERRIDES ---------- */
/* Smooth theme transition */
body, .app-header, .card, .stat-card, .modal, .login-card,
.nav-tab, .mobile-nav, .doctor-info-card, .doctor-metrics-card {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] .login-backdrop {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(13, 148, 136, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .login-particles {
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(0,0,0,0.04) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(0,0,0,0.03) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 30%, rgba(0,0,0,0.04) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 70%, rgba(0,0,0,0.02) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 40%, rgba(0,0,0,0.03) 0%, transparent 100%);
}

[data-theme="light"] .login-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .nav-tab:hover {
  background: rgba(0,0,0,0.04);
}

[data-theme="light"] .btn-ghost:hover {
  background: rgba(0,0,0,0.04);
}

[data-theme="light"] .btn-icon:hover {
  background: rgba(0,0,0,0.06);
}

[data-theme="light"] .data-table thead th {
  background: rgba(0,0,0,0.02);
}

[data-theme="light"] .data-table tbody td {
  border-bottom-color: rgba(0,0,0,0.04);
}

[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(0,0,0,0.02);
}

[data-theme="light"] .data-table tfoot td {
  background: rgba(13, 148, 136, 0.04);
}

[data-theme="light"] .card:hover {
  border-color: rgba(0,0,0,0.12);
}

[data-theme="light"] .stat-card:hover {
  border-color: rgba(0,0,0,0.12);
}

[data-theme="light"] .achievement-bar {
  background: rgba(0,0,0,0.06);
}

[data-theme="light"] .toast-success {
  background: #dcfce7;
  color: #166534;
  border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="light"] .toast-error {
  background: #fee2e2;
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.2);
}

[data-theme="light"] .toast-info {
  background: #dbeafe;
  color: #1e40af;
  border-color: rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #e4e7ec;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #c1c7d0;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #a0a8b4;
}

[data-theme="light"] .matrix-table tbody td:first-child,
[data-theme="light"] .matrix-table thead th:first-child,
[data-theme="light"] .matrix-table thead th {
  background: #ffffff;
}

[data-theme="light"] .matrix-table tfoot td:first-child {
  background: rgba(13, 148, 136, 0.04);
}

/* ---------- PRINT / PDF EXPORT ---------- */
#printArea { display: none; }

.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-print:hover { border-color: var(--accent); color: var(--accent); }

@media print {
  /* Show only the print render target */
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  html, body { background: #fff !important; }

  .print-doc {
    color: #111;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 11px;
    line-height: 1.4;
  }
  .print-head {
    border-bottom: 2px solid #0d9488;
    padding-bottom: 8px;
    margin-bottom: 14px;
  }
  .print-brand { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: #0d9488; }
  .print-brand span { color: #555; font-weight: 600; }
  .print-title { font-size: 17px; font-weight: 700; color: #111; margin: 5px 0 2px; }
  .print-meta { font-size: 10px; color: #555; }
  .print-info { margin: 8px 0; font-size: 11px; color: #222; }
  .print-info strong { font-size: 13px; }
  .print-doc h3 { font-size: 12px; margin: 14px 0 5px; color: #0d9488; }
  .print-stats { display: flex; flex-wrap: wrap; gap: 18px; margin: 8px 0 12px; font-size: 11px; font-weight: 600; }

  .print-stat-cards { display: flex; gap: 10px; margin: 10px 0 16px; }
  .print-stat {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-top: 3px solid #0d9488;
    border-radius: 4px;
    padding: 8px 10px;
  }
  .print-stat-label { font-size: 8px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; font-weight: 700; }
  .print-stat-val { font-size: 14px; font-weight: 700; color: #0f172a; margin-top: 3px; }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
  }
  .print-table th {
    background: #f0fdfa;
    border: 1px solid #cbd5e1;
    padding: 5px 7px;
    text-align: left;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #334155;
  }
  .print-table td {
    border: 1px solid #cbd5e1;
    padding: 4px 7px;
    font-size: 10px;
    color: #1e293b;
  }
  .print-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .print-table tfoot td { font-weight: 700; background: #f1f5f9; }
  .print-table tbody tr:nth-child(even) td { background: #fafafa; }

  /* Keep individual ROWS intact, but let the table flow across pages
     (avoid on the table itself pushes the whole table to a new page). */
  .print-table tr, .print-table td, .print-table th { page-break-inside: avoid; }
  .print-table thead { display: table-header-group; } /* repeat header on each page */
}

[data-theme="light"] .matrix-cell-total {
  background: rgba(0,0,0,0.02);
}
