:root {
  color-scheme: light;
  --on-brand: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --bg: #f3f4fb;
  --white: #ffffff;
  --surface-alt: #fafaff;
  --text: #1e1b33;
  --muted: #6b7280;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;
  --success: #10b981;
  --success-soft: #d1fae5;
  --success-text: #047857;
  --success-border: #a7f3d0;
  --info: #4f46e5;
  --info-soft: #eef0fe;
  --border: #e6e7f2;
  --hover-bg: #faf9ff;
  --badge-neutral-bg: #f1f1f8;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --card-glass-bg: rgba(255, 255, 255, 0.92);
  --card-glass-border: rgba(255, 255, 255, 0.6);
  --surface-translucent: rgba(243, 244, 251, 0.85);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
  --gradient-cool: linear-gradient(135deg, #4f46e5, #7c3aed);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 10px rgba(79, 70, 229, 0.06);
  --shadow-md: 0 14px 34px rgba(79, 70, 229, 0.16);
  --shadow-glow: 0 10px 26px rgba(99, 102, 241, 0.38);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --bottom-nav-h: 68px;
}

/* ---------- Dark mode ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #818cf8;
    --primary-dark: #a5b4fc;
    --primary-light: #a5b4fc;
    --bg: #100e1c;
    --white: #211f3d;
    --surface-alt: #29264a;
    --text: #eeecf9;
    --muted: #b7b1d9;
    --danger-soft: rgba(239, 68, 68, 0.16);
    --danger-text: #fca5a5;
    --danger-border: rgba(239, 68, 68, 0.35);
    --success-soft: rgba(16, 185, 129, 0.16);
    --success-text: #6ee7b7;
    --success-border: rgba(16, 185, 129, 0.35);
    --info-soft: rgba(129, 140, 248, 0.16);
    --border: #3d3a63;
    --hover-bg: rgba(255, 255, 255, 0.07);
    --badge-neutral-bg: rgba(255, 255, 255, 0.09);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23b7b1d9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --card-glass-bg: rgba(26, 24, 48, 0.85);
    --card-glass-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.45);
    --surface-translucent: rgba(16, 14, 28, 0.85);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --primary-light: #a5b4fc;
  --bg: #100e1c;
  --white: #211f3d;
  --surface-alt: #29264a;
  --text: #eeecf9;
  --muted: #b7b1d9;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --danger-text: #fca5a5;
  --danger-border: rgba(239, 68, 68, 0.35);
  --success-soft: rgba(16, 185, 129, 0.16);
  --success-text: #6ee7b7;
  --success-border: rgba(16, 185, 129, 0.35);
  --info-soft: rgba(129, 140, 248, 0.16);
  --border: #3d3a63;
  --hover-bg: rgba(255, 255, 255, 0.07);
  --badge-neutral-bg: rgba(255, 255, 255, 0.09);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23b7b1d9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --card-glass-bg: rgba(26, 24, 48, 0.85);
  --card-glass-border: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 34px rgba(0, 0, 0, 0.45);
  --surface-translucent: rgba(16, 14, 28, 0.85);
}

* { box-sizing: border-box; }

/* Must outrank any component's own display rule, or el.hidden stops working. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: 'Prompt', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { text-decoration: none; }

input::placeholder, select::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* ---------- Icons ---------- */
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.icon-xs { width: 12px; height: 12px; vertical-align: -1px; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 40px; height: 40px; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -24px) scale(1.06); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.12s var(--ease), box-shadow 0.2s var(--ease), filter 0.15s var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--gradient-cool); color: var(--on-brand); box-shadow: var(--shadow-glow); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 14px 30px rgba(99, 102, 241, 0.45); }
.btn-secondary { background: var(--text); color: var(--bg); }
.btn-secondary:hover { opacity: 0.88; }
.btn-ghost { background: var(--white); color: var(--primary-dark); border-color: var(--border); }
.btn-ghost:hover { background: var(--info-soft); border-color: var(--primary-light); }
.btn-danger-outline { background: var(--white); color: var(--danger); border-color: var(--danger-border); }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Auth pages ---------- */
.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--gradient-primary);
  padding: 24px;
}
.auth-body::before,
.auth-body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.55;
  animation: floatBlob 9s ease-in-out infinite;
  pointer-events: none;
}
.auth-body::before {
  width: 340px; height: 340px;
  background: radial-gradient(circle, #fbcfe8, transparent 70%);
  top: -80px; left: -80px;
}
.auth-body::after {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #a5f3fc, transparent 70%);
  bottom: -120px; right: -100px;
  animation-delay: -4s;
}
.auth-card {
  position: relative;
  z-index: 1;
  background: var(--card-glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 28px;
  padding: 36px 30px;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 30px 60px rgba(30, 27, 51, 0.35);
  border: 1px solid var(--card-glass-border);
  animation: popIn 0.4s var(--ease);
}
.auth-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-cool);
  color: var(--on-brand);
  box-shadow: var(--shadow-glow);
}
.auth-logo .icon { width: 28px; height: 28px; }
.auth-brand { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.auth-sub { color: var(--muted); text-align: center; font-size: 14px; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.auth-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.14); }

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px !important; }
.input-icon-inline { flex: 1; min-width: 180px; }
.input-icon-inline input { width: 100%; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 260px;
  background: linear-gradient(190deg, #1e1b4b 0%, #3730a3 55%, #4f46e5 100%);
  color: var(--on-brand);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  flex-shrink: 0;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 15px;
  padding: 0 22px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  margin-bottom: 14px;
  line-height: 1.3;
}
.brand-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  color: var(--on-brand);
}
.brand-icon .icon { width: 20px; height: 20px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; padding: 0 12px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  color: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.sidebar-nav a .icon { color: rgba(255, 255, 255, 0.6); transition: color 0.15s var(--ease); }
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-brand); transform: translateX(2px); }
.sidebar-nav a:hover .icon { color: var(--on-brand); }
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.16);
  color: var(--on-brand);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.sidebar-nav a.active .icon { color: #fbcfe8; }

.sidebar-user {
  padding: 16px 22px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 13px;
}
.sidebar-user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #a78bfa);
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.sidebar-user-name { font-weight: 600; }
.sidebar-user-role { color: rgba(255, 255, 255, 0.6); font-size: 12px; }
.logout-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fecdd3;
  font-size: 13px;
  padding-bottom: 16px;
  transition: color 0.15s var(--ease);
}
.logout-link:hover { color: #ffffff; text-decoration: none; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface-translucent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-logout {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--white);
  color: var(--danger);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s var(--ease);
}
.topbar-logout:hover { background: var(--danger-soft); text-decoration: none; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.theme-toggle:hover { background: var(--info-soft); transform: rotate(12deg); }
.theme-toggle:active { transform: scale(0.9); }
.theme-icon { display: inline-flex; }
.theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: inline-flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-icon-moon { display: inline-flex; }
}

.content { padding: 20px 24px 40px; max-width: 1200px; margin: 0 auto; width: 100%; animation: fadeInUp 0.3s var(--ease); }

/* ---------- Alerts ---------- */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 500;
  animation: fadeInUp 0.25s var(--ease);
}
.alert-success { background: var(--success-soft); color: var(--success-text); border: 1px solid var(--success-border); }
.alert-error { background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-border); }

/* ---------- Cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat-card-accent { border-color: transparent; background: var(--gradient-cool); color: var(--on-brand); }
.stat-card-accent .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat-card-accent .stat-value { color: var(--on-brand); }
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat-value-sm { font-size: 16px; }
.stat-icon { width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon .icon { width: 19px; height: 19px; }
.stat-icon-blue { background: var(--info-soft); color: var(--primary); }
.stat-icon-navy { background: #f3e8ff; color: var(--violet); }
.stat-icon-danger { background: var(--danger-soft); color: var(--danger); }
.stat-card-accent .stat-icon { background: rgba(255, 255, 255, 0.2); color: var(--on-brand); }

/* ---------- Panels ---------- */
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.panel-header h2 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text); display: flex; align-items: center; gap: 9px; }
.panel-header h2 .icon { color: var(--primary); }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.grid-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.grid-form input, .grid-form select {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.grid-form input:focus, .grid-form select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); }
.grid-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}
.grid-form select:hover { border-color: var(--primary-light); }
.grid-span-2 { grid-column: span 2; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } .grid-span-2 { grid-column: span 1; } }

.filter-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-form input, .filter-form select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
}
.filter-form input:focus, .filter-form select:focus { outline: none; border-color: var(--primary); }
.filter-form select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
  cursor: pointer;
}
.filter-form select:hover { border-color: var(--primary-light); }
.filter-sep { color: var(--muted); font-size: 13px; }

/* ---------- Slim search bar with collapsible advanced filters ---------- */
.panel-slim { padding: 16px 18px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-search { flex: 1; min-width: 220px; }
.filter-search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.filter-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); }
.filter-bar .btn.is-active { background: var(--info-soft); border-color: var(--primary-light); color: var(--primary); }

.filter-menu-panel {
  position: fixed;
  z-index: 55;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md);
  animation: fadeInUp 0.15s var(--ease);
}
.filter-menu-head { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.filter-menu-head .icon { color: var(--primary); }
.filter-menu-panel label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.filter-menu-panel select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 11px 40px 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--white);
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}
.filter-menu-panel input[type="date"] {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
}
.filter-menu-panel input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--info-soft);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.filter-chip:hover { border-color: var(--primary-light); text-decoration: none; }
.filter-chip-clear { background: none; color: var(--muted); }
.filter-chip-clear:hover { color: var(--danger); border-color: var(--danger-border); }

.inline-toggle { margin-top: 16px; }

.field-hint { font-size: 12px; color: var(--muted); margin: 7px 0 0; font-weight: 400; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-alt); }
.data-table th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table th:last-child { border-top-right-radius: var(--radius-sm); }
.data-table tbody tr { transition: background-color 0.12s var(--ease); }
.data-table tbody tr:hover { background: var(--hover-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--muted); padding: 40px 0 !important; white-space: normal !important; }
.empty-row .icon { display: block; margin: 0 auto 10px; color: var(--border); }
.row-inactive { opacity: 0.5; }
.row-actions { display: flex; gap: 6px; }
.link-edit, .link-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.link-edit { color: var(--primary); }
.link-edit:hover { background: var(--info-soft); text-decoration: none; }
.link-delete { color: var(--danger); }
.link-delete:hover { background: var(--danger-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-neutral { background: var(--badge-neutral-bg); color: var(--muted); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-info { background: var(--info-soft); color: var(--primary); }

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.pagination a:hover { background: var(--info-soft); text-decoration: none; }
.pagination a.active { background: var(--gradient-cool); color: var(--on-brand); border-color: transparent; }

/* ---------- Combobox (searchable item picker) ---------- */
.combobox { position: relative; }
.combobox-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  animation: fadeInUp 0.15s var(--ease);
}
.combobox-menu.open { display: block; }
.combobox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.12s var(--ease);
}
.combobox-item:last-child { border-bottom: none; }
.combobox-item:hover { background: var(--info-soft); }
.combobox-item-name { font-weight: 600; color: var(--text); }
.combobox-item-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.combobox-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
.combobox-item-other { justify-content: flex-start; font-weight: 600; color: var(--primary); background: var(--info-soft); }

/* ---------- Styled select (themed replacement for native <select>) ---------- */
.styled-select { position: relative; display: flex; flex-direction: column; }
.styled-select select { display: none; }
.styled-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 11px 40px 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--white);
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.styled-select-button:hover { border-color: var(--primary-light); }
.styled-select-button[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12); }
.styled-select-button.is-placeholder { color: var(--muted); }
.filter-form .styled-select { min-width: 170px; }
.filter-form .styled-select-button { min-height: 41px; padding: 10px 36px 10px 12px; background-position: right 12px center; background-size: 15px; }

.styled-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 60;
  display: none;
  animation: fadeInUp 0.15s var(--ease);
}
.styled-select-menu.open { display: block; }
.styled-select-option {
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.12s var(--ease);
}
.styled-select-option:last-child { border-bottom: none; }
.styled-select-option:hover { background: var(--info-soft); }
.styled-select-option.selected { background: var(--info-soft); color: var(--primary); font-weight: 600; }
.combobox-selected-tag { display: none; align-items: center; gap: 6px; margin-top: 7px; font-size: 12px; font-weight: 600; color: var(--success); }
.combobox-selected-tag.show { display: inline-flex; }

/* ---------- External employee box ---------- */
.external-employee-box {
  background: var(--info-soft);
  border: 1.5px dashed var(--primary-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: -4px;
  animation: fadeInUp 0.2s var(--ease);
}
.external-employee-box .grid-form { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 600px) { .external-employee-box .grid-form { grid-template-columns: 1fr; } }

/* ---------- Print report ---------- */
.print-body { background: var(--white); font-family: 'Prompt', sans-serif; }
.print-toolbar { padding: 16px; text-align: right; }
.print-sheet { max-width: 900px; margin: 0 auto; padding: 0 24px 40px; }
.print-sheet h1 { color: var(--text); font-size: 22px; }
.print-sheet h2 { color: var(--text); font-size: 16px; margin-top: 28px; }
.print-meta { color: var(--muted); font-size: 13px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.print-table th, .print-table td { border: 1px solid #ccc; padding: 6px 10px; text-align: left; }
.print-table th { background: var(--info-soft); }
@media print { .no-print { display: none !important; } }

/* ---------- Bottom nav (mobile app-style) ---------- */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--card-glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(30, 27, 51, 0.08);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  transition: color 0.15s var(--ease), transform 0.15s var(--ease);
}
.bottom-nav a .icon { width: 21px; height: 21px; }
.bottom-nav a:hover { text-decoration: none; color: var(--primary); }
.bottom-nav a.active { color: var(--primary); transform: translateY(-2px); }
.bottom-nav a.active .icon { filter: drop-shadow(0 3px 6px rgba(79, 70, 229, 0.4)); }

/* ---------- Responsive: tablet & mobile ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .content { padding: 16px 16px calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 24px); }
  .topbar { padding: 16px; }
  .page-title { font-size: 18px; }
  .topbar-logout { display: inline-flex; }
}

@media (max-width: 600px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 16px; border-radius: var(--radius-md); }
  .data-table th, .data-table td { padding: 10px 10px; font-size: 13px; }
}

/* ---------- Toolbar (page-level action buttons above panels) ---------- */
.page-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

/* ---------- Modal (native <dialog>) ---------- */
dialog.modal {
  border: none;
  padding: 0;
  width: calc(100vw - 32px);
  max-width: 560px;
  max-height: calc(100dvh - 64px);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow-md);
}
dialog.modal-lg { max-width: 820px; }
dialog.modal::backdrop { background: rgba(15, 13, 28, 0.55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: popIn 0.2s var(--ease); display: flex; flex-direction: column; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 9px; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.modal-close:hover { background: var(--hover-bg); color: var(--text); }
.modal-body { padding: 20px 22px 24px; overflow-y: auto; }
.modal-danger-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.modal-danger-zone .field-hint { flex-basis: 100%; margin: 0; }

@media (max-width: 600px) {
  dialog.modal { width: calc(100vw - 24px); max-height: calc(100dvh - 40px); }
  .modal-body { padding: 16px; }
}
