/* ═══════════════════════════════════════════════════════════════════════════
   ControlHorario — "Clarity" Design System
   A refined, professional dual-theme design using Outfit + Source Sans 3.
   Built on Bootstrap 5.3 with CSS custom properties for full theming.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Fonts ── */
:root {
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Light Theme (default) ── */
[data-bs-theme="light"] {
  --bg-body: #F8F9FC;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F1F3F9;
  --bg-inset: #E8EBF2;
  --border: #E2E5EE;
  --border-strong: #CDD1DC;

  --text: #1A1D26;
  --text-secondary: #464B5C;
  --text-muted: #7A8099;
  --text-dim: #9DA2B5;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-dim: rgba(5, 150, 105, 0.08);
  --accent-ring: rgba(5, 150, 105, 0.25);

  --blue: #2563EB;
  --blue-dim: rgba(37, 99, 235, 0.08);
  --red: #DC2626;
  --red-dim: rgba(220, 38, 38, 0.08);
  --amber: #D97706;
  --amber-dim: rgba(217, 119, 6, 0.08);
  --purple: #7C3AED;
  --purple-dim: rgba(124, 58, 237, 0.08);
  --cyan: #0891B2;

  --sidebar-bg: #1E293B;
  --sidebar-text: #CBD5E1;
  --sidebar-text-muted: #64748B;
  --sidebar-active-bg: rgba(5, 150, 105, 0.15);
  --sidebar-active-text: #34D399;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --topbar-bg: #FFFFFF;
  --topbar-border: #E2E5EE;
  --topbar-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);

  --modal-overlay: rgba(15, 23, 42, 0.5);
  --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);

  --toast-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);

  --input-bg: #FFFFFF;
  --input-border: #D1D5DB;
  --input-focus-border: var(--accent);
  --input-focus-ring: var(--accent-ring);

  --badge-success-bg: rgba(5, 150, 105, 0.1);
  --badge-success-text: #047857;
  --badge-danger-bg: rgba(220, 38, 38, 0.1);
  --badge-danger-text: #B91C1C;
  --badge-warning-bg: rgba(217, 119, 6, 0.1);
  --badge-warning-text: #B45309;
  --badge-info-bg: rgba(37, 99, 235, 0.1);
  --badge-info-text: #1D4ED8;
  --badge-secondary-bg: rgba(100, 116, 139, 0.1);
  --badge-secondary-text: #475569;
  --badge-primary-bg: rgba(37, 99, 235, 0.1);
  --badge-primary-text: #1D4ED8;
}

/* ── Dark Theme ── */
[data-bs-theme="dark"] {
  --bg-body: #0F1219;
  --bg-surface: #171B26;
  --bg-elevated: #1E2333;
  --bg-inset: #141822;
  --border: #262D3D;
  --border-strong: #343D52;

  --text: #E2E8F0;
  --text-secondary: #B0B8CC;
  --text-muted: #7A8099;
  --text-dim: #525A70;

  --accent: #10B981;
  --accent-hover: #34D399;
  --accent-dim: rgba(16, 185, 129, 0.1);
  --accent-ring: rgba(16, 185, 129, 0.3);

  --blue: #60A5FA;
  --blue-dim: rgba(96, 165, 250, 0.1);
  --red: #F87171;
  --red-dim: rgba(248, 113, 113, 0.1);
  --amber: #FBBF24;
  --amber-dim: rgba(251, 191, 36, 0.1);
  --purple: #A78BFA;
  --purple-dim: rgba(167, 139, 250, 0.1);
  --cyan: #22D3EE;

  --sidebar-bg: #111621;
  --sidebar-text: #94A3B8;
  --sidebar-text-muted: #475569;
  --sidebar-active-bg: rgba(16, 185, 129, 0.12);
  --sidebar-active-text: #34D399;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.04);
  --sidebar-border: rgba(255, 255, 255, 0.05);

  --topbar-bg: #171B26;
  --topbar-border: #262D3D;
  --topbar-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
  --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  --modal-overlay: rgba(0, 0, 0, 0.65);
  --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);

  --toast-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);

  --input-bg: #1E2333;
  --input-border: #343D52;
  --input-focus-border: var(--accent);
  --input-focus-ring: var(--accent-ring);

  --badge-success-bg: rgba(16, 185, 129, 0.15);
  --badge-success-text: #34D399;
  --badge-danger-bg: rgba(248, 113, 113, 0.15);
  --badge-danger-text: #FCA5A5;
  --badge-warning-bg: rgba(251, 191, 36, 0.15);
  --badge-warning-text: #FCD34D;
  --badge-info-bg: rgba(96, 165, 250, 0.15);
  --badge-info-text: #93C5FD;
  --badge-secondary-bg: rgba(148, 163, 184, 0.12);
  --badge-secondary-text: #94A3B8;
  --badge-primary-bg: rgba(96, 165, 250, 0.15);
  --badge-primary-text: #93C5FD;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-body);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

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

.mono, .font-mono { font-family: var(--font-mono); }

/* ── App Layout ── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.app-sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  transition: transform 0.25s ease;
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-text-muted); border-radius: 4px; }

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

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #047857 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-profile {
  padding: 16px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim), rgba(16, 185, 129, 0.2));
  border: 2px solid rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sidebar-active-text);
  flex-shrink: 0;
}

.sidebar-profile-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.sidebar-profile-role {
  font-size: 0.72rem;
  color: var(--sidebar-text-muted);
}

.sidebar-nav {
  padding: 8px 0;
  flex: 1;
}

.sidebar-section {
  padding: 16px 20px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-text-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-text);
}

.sidebar-link i {
  font-size: 1.15rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-link.active i { opacity: 1; }

/* ── Main content area ── */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.app-topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--topbar-shadow);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-clock {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1rem;
}

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

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
  color: var(--text);
}

.topbar-user:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

.topbar-user-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.topbar-burger {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* ── Language Picker ── */
.lang-picker {
  position: relative;
}

.lang-picker-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--card-hover-shadow);
  padding: 4px;
  min-width: 140px;
  z-index: 1050;
}

.lang-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.lang-picker-item:hover { background: var(--bg-elevated); }
.lang-picker-item.active { color: var(--accent); font-weight: 600; }

/* ── Content ── */
.app-content {
  flex: 1;
  padding: 24px;
}

/* ── Footer ── */
.app-footer {
  padding: 16px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
}

.page-title-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.page-breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Cards ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--card-hover-shadow); }

.card-body { padding: 20px; }

.card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.grid-margin { margin-bottom: 20px; }

/* ── KPI Stat Cards ── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-1px);
}

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

.stat-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.stat-card-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stat-card-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* ── Stat boxes (inline) ── */
.stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.stat-box-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-box-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Chart containers ── */
.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}
.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-container-sm {
  height: 220px;
}

/* ── Report summary stats ── */
.report-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.report-stats .stat-box {
  flex: 1;
  min-width: 140px;
}

/* ── Gradients for icons ── */
.bg-gradient-primary { background: linear-gradient(135deg, #2563EB, #1D4ED8); }
.bg-gradient-success { background: linear-gradient(135deg, #059669, #047857); }
.bg-gradient-danger { background: linear-gradient(135deg, #DC2626, #B91C1C); }
.bg-gradient-warning { background: linear-gradient(135deg, #D97706, #B45309); }
.bg-gradient-info { background: linear-gradient(135deg, #0891B2, #0E7490); }

/* ── Tables ── */
.table {
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0;
}

.table thead th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  background: transparent;
}

.table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.table-hover tbody tr:hover {
  background: var(--bg-elevated);
}

/* ── Badges ── */
.badge {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.badge-success { background: var(--badge-success-bg); color: var(--badge-success-text); }
.badge-danger { background: var(--badge-danger-bg); color: var(--badge-danger-text); }
.badge-warning { background: var(--badge-warning-bg); color: var(--badge-warning-text); }
.badge-info { background: var(--badge-info-bg); color: var(--badge-info-text); }
.badge-secondary { background: var(--badge-secondary-bg); color: var(--badge-secondary-text); }
.badge-primary { background: var(--badge-primary-bg); color: var(--badge-primary-text); }
.badge-purple { background: rgba(139, 92, 246, 0.12); color: #7C3AED; }
[data-bs-theme="dark"] .badge-purple { background: rgba(139, 92, 246, 0.2); color: #A78BFA; }

/* ── Buttons ── */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 8px 16px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-success {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-success:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-warning {
  background: var(--amber);
  border-color: var(--amber);
  color: #000;
}

.btn-outline-primary {
  border-color: var(--border);
  color: var(--text-secondary);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline-success {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn-outline-success:hover {
  background: var(--accent-dim);
}

.btn-outline-danger {
  border-color: var(--border);
  color: var(--red);
  background: transparent;
}
.btn-outline-danger:hover {
  background: var(--red-dim);
  border-color: var(--red);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 0.95rem;
}

.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-control, .form-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  background: var(--input-bg);
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
  color: var(--text);
  outline: none;
}

.form-control::placeholder { color: var(--text-dim); }

.form-control-lg { padding: 10px 14px; font-size: 0.9rem; }
.form-control-sm { padding: 5px 10px; font-size: 0.8rem; }

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

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

select.form-control { appearance: auto; }

.form-check-input {
  border-color: var(--input-border);
  background-color: var(--input-bg);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-check-label {
  font-size: 0.85rem;
  color: var(--text);
}

textarea.form-control { resize: vertical; }

/* ── Alerts ── */
.alert {
  border-radius: 10px;
  font-size: 0.85rem;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.alert-danger {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.alert .close, .alert .btn-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  margin-left: auto;
  cursor: pointer;
  opacity: 0.7;
}

/* ── Progress ── */
.progress {
  background: var(--bg-inset);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar { transition: width 0.4s ease; }

/* ── Pagination ── */
.pagination { gap: 2px; }

.page-link {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px !important;
  padding: 4px 10px;
}

.page-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.page-item.active .page-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-item.disabled .page-link {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border-color: var(--border);
}

/* ── Tabs ── */
.tab-nav {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--border);
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.modal-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--modal-shadow);
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.2s ease;
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.modal-x {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}

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

.modal-bdy { padding: 16px 20px; }

.modal-ftr {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ── Timer display ── */
.timer-display {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.timer-display.inactive {
  color: var(--text-dim);
}

/* ── Status pills ── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-pill.active {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
}

.status-pill.warning {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
}

.status-pill.inactive {
  background: var(--badge-secondary-bg);
  color: var(--badge-secondary-text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active { background: var(--accent); animation: pulse 2s infinite; }
.status-dot.warning { background: var(--amber); animation: pulse 2s infinite; }
.status-dot.inactive { background: var(--text-dim); }

/* ── Clock button ── */
.clock-btn {
  padding: 10px 24px;
  font-size: 0.9rem;
  border-radius: 10px;
  margin-top: 12px;
}

/* ── Quick actions ── */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
  text-decoration: none;
}

.quick-action:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.quick-action i { font-size: 1.5rem; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state i {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.85rem;
  margin: 0;
}

/* ── Auth Layout ── */
.auth-layout {
  min-height: 100vh;
  background: var(--bg-body);
  position: relative;
  overflow-x: hidden;
}

/* Container split-screen: left animated brand panel + right form panel.
   Used by Login.razor and Register.razor via the <AuthSplitLayout> component.
   Other auth pages (terms, privacy, forgot, reset, verify, activate) keep
   their own centered card layout — they don't render <AuthSplitLayout>. */
.auth-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

/* ── Left side: animated brand panel ── */
.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, #0f3527 0%, #0a1f17 100%);
  color: #fff;
  isolation: isolate;
}

.auth-aside-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
  pointer-events: none;
}

.auth-orb-1 {
  width: 480px;
  height: 480px;
  top: -120px;
  left: -120px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  animation: auth-orb-drift-1 22s ease-in-out infinite;
}

.auth-orb-2 {
  width: 420px;
  height: 420px;
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, #34d399 0%, transparent 70%);
  animation: auth-orb-drift-2 26s ease-in-out infinite;
}

.auth-orb-3 {
  width: 320px;
  height: 320px;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, #047857 0%, transparent 70%);
  animation: auth-orb-drift-3 30s ease-in-out infinite;
  opacity: 0.4;
}

@keyframes auth-orb-drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(80px, 120px) scale(1.15); }
}

@keyframes auth-orb-drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-100px, -80px) scale(1.1); }
}

@keyframes auth-orb-drift-3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  50%      { transform: translate(-30%, -70%) scale(1.2) rotate(180deg); }
}

/* Subtle grid texture overlay for that "tech" feel */
.auth-aside-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: 0.55;
}

.auth-aside-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 56px clamp(32px, 5vw, 64px);
  width: 100%;
  gap: 32px;
}

.auth-aside-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: auth-fade-up 0.7s ease-out both;
}

.auth-aside-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-aside-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.auth-aside-pitch {
  margin-top: auto;
  animation: auth-fade-up 0.9s ease-out 0.1s both;
}

.auth-aside-headline {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: #fff;
  margin: 0 0 14px;
}

.auth-aside-sub {
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  max-width: 460px;
}

.auth-aside-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: auth-fade-up 1.1s ease-out 0.2s both;
}

.auth-aside-bullets li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.85);
}

.auth-aside-bullets li .mud-icon-root {
  color: #34d399;
  flex-shrink: 0;
}

.auth-aside-footnote {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

@keyframes auth-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Right side: form panel ── */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px clamp(20px, 5vw, 56px);
  background: var(--bg-body);
  min-height: 100vh;
  overflow-y: auto;
}

.auth-main-inner {
  width: 100%;
  max-width: 440px;
  animation: auth-form-in 0.6s ease-out both;
}

.auth-main-inner.wide { max-width: 520px; }

@keyframes auth-form-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card that holds the form on the right ── */
.auth-card {
  background: transparent;
  padding: 0;
  width: 100%;
}

/* Keep .wide class working with the legacy markup of other auth pages */
.auth-card.wide { max-width: 520px; }

/* Top-row plan badge (Register) */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 18px;
}

/* ── Inline brand mini-mark shown above the form on mobile ── */
.auth-brand {
  text-align: left;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #047857 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
}

.auth-brand h4 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}

.auth-brand p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.2;
}

.auth-link {
  color: var(--accent);
  font-weight: 600;
}

.auth-link:hover { color: var(--accent-hover); }

/* ── Animated step transition (Register) ── */
.auth-step {
  animation: auth-step-in 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes auth-step-in {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Responsive: collapse split below 900px ── */
@media (max-width: 899px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    display: none;
  }
  .auth-main {
    padding: 32px 20px;
  }
}

/* ── Legal pages (/terms, /privacy) ── */
.legal-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 40px clamp(20px, 5vw, 56px);
  color: var(--text);
  line-height: 1.65;
  font-size: 0.93rem;
}

.legal-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.legal-header h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--text);
}

.legal-updated {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.legal-page section {
  margin-bottom: 28px;
}

.legal-page h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.legal-page p {
  margin: 0 0 12px;
  color: var(--text);
}

.legal-page ul {
  margin: 0 0 12px;
  padding-left: 24px;
}

.legal-page li {
  margin-bottom: 6px;
}

.legal-page strong {
  color: var(--text);
  font-weight: 600;
}

.legal-page em {
  color: var(--text-muted);
  font-style: italic;
}

.legal-page a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 50%, transparent);
}

.legal-page a:hover {
  color: var(--accent-hover);
  border-bottom-style: solid;
}

.legal-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legal-sep {
  margin: 0 10px;
  color: var(--border);
}

/* ── Dropdown menu (Bootstrap override) ── */
.dropdown-menu {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--card-hover-shadow);
  padding: 4px;
}

.dropdown-item {
  color: var(--text);
  font-size: 0.85rem;
  border-radius: 6px;
  padding: 8px 12px;
}

.dropdown-item:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.dropdown-divider { border-color: var(--border); }

/* ── Spinner override ── */
.spinner-border { color: var(--accent); }

/* ── App Loader ── */
.app-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-body, #F8F9FC);
}

.app-loader-inner { text-align: center; }

.app-loader-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #059669, #047857);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  margin: 0 auto 16px;
}

.app-loader-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid #E2E5EE;
  border-right-color: #059669;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 12px;
}

.app-loader-text {
  color: #7A8099;
  font-size: 0.8rem;
  font-family: 'Source Sans 3', sans-serif;
  margin: 0;
}

/* ── Blazor error UI ── */
#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface, #fff);
  border: 1px solid var(--red, #DC2626);
  color: var(--red, #DC2626);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 9999;
  box-shadow: var(--card-shadow);
}

#blazor-error-ui a {
  color: var(--blue, #2563EB);
  margin-left: 8px;
  font-weight: 600;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  margin-left: 12px;
  color: var(--text-dim, #9DA2B5);
}

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

/* ── Sidebar overlay for mobile ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1039;
}

.sidebar-overlay.show { display: block; }

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .topbar-burger {
    display: block;
  }

  .topbar-clock { display: none; }
}

@media (max-width: 767.98px) {
  .app-content { padding: 16px; }
  .page-header h3 { font-size: 1.1rem; }
  .topbar-user-name { display: none; }
  .timer-display { font-size: 2rem; }
}

/* ── Validation messages ── */
.validation-message { color: var(--red); font-size: 0.78rem; margin-top: 4px; }

/* ── Utility ── */
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--red) !important; }
.text-success { color: var(--accent) !important; }

.stretch-card { display: flex; }
.stretch-card > .card { flex: 1; }

/* ── Password strength pills ── */
.pw-pill {
  font-size: 0.72rem;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.25s ease, color 0.25s ease,
              border-color 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.pw-pill .mud-icon-root {
  font-size: 1rem !important;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pw-pill.met {
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-surface));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transform: scale(1.02);
}

.pw-pill.met .mud-icon-root {
  transform: rotate(360deg) scale(1.1);
}

/* ── Step progress ── */
.step-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.step-bar-segment {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.step-bar-segment.active { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   MudBlazor layout overrides — Clarity bridge for MainLayout.razor
   ═══════════════════════════════════════════════════════════════════════════ */

.ch-appbar {
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: var(--topbar-shadow) !important;
  backdrop-filter: blur(8px);
}

.ch-clock {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  margin-right: 8px;
}

.ch-user-btn {
  text-transform: none !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
}

.ch-user-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  margin-right: 6px;
}

.ch-lang-spacer {
  display: inline-block;
  width: 20px;
}

.ch-drawer-header {
  background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  padding: 18px 16px !important;
}

.ch-drawer-brand {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  /* Drawer background is dark in both themes (--sidebar-bg). Without this
     override, the global "h1..h6 { color: var(--text) }" rule paints near-black
     on slate in light mode → unreadable. */
  color: var(--sidebar-text) !important;
}

.ch-drawer-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.ch-drawer-profile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ch-profile-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-profile-role {
  font-size: 0.75rem;
  color: var(--sidebar-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.ch-nav-section {
  padding: 14px 16px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  font-family: var(--font-display);
}

.ch-navmenu .mud-nav-link {
  border-radius: 8px;
  margin: 2px 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.ch-navmenu .mud-nav-link:hover {
  background: var(--accent-dim);
}

.ch-navmenu .mud-nav-link.active {
  background: var(--accent-dim);
  color: var(--accent) !important;
  font-weight: 600;
}

.ch-navmenu .mud-nav-link.active .mud-icon-root {
  color: var(--accent) !important;
}

.ch-main {
  background: var(--bg-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ch-page {
  flex: 1;
  padding: 24px;
  max-width: 100%;
}

@media (max-width: 768px) {
  .ch-page { padding: 16px; }
}

.ch-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-surface);
}

.ch-auth-topbar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
}

/* ── Profile page header card ──
   Gives the user's name + avatar a clear focal point instead of a plain Paper.
   The accent-dim gradient is intentional but subtle. */
.ch-profile-header {
  background: linear-gradient(135deg, var(--accent-dim) 0%, var(--bg-surface) 70%);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ch-profile-header .mud-avatar {
  box-shadow: 0 0 0 3px var(--bg-surface), 0 0 0 5px var(--accent-ring);
}

/* ── Dialog header (reusable component) ──
   Used by <DialogHeader Icon="..." Text="..."/> in TitleContent. */
.ch-dialog-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

.ch-dialog-title-icon.is-warning {
  background: var(--amber-dim);
  color: var(--amber);
}

.ch-dialog-title-icon.is-danger {
  background: var(--red-dim);
  color: var(--red);
}

/* ── Modal section subtitle ──
   Groups related fields inside a dialog so the form doesn't look like a wall
   of inputs. Use with <MudIcon> + <MudText Typo="Typo.subtitle2">. */
.ch-modal-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 -4px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.ch-modal-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  margin-left: 8px;
}

/* Avatar crop dialog — round the cropbox so users see the actual final shape. */
.avatar-crop-host {
  max-height: 60vh;
  overflow: hidden;
  background: #1a1a1a;
  border-radius: 8px;
}
.avatar-crop-host img {
  max-width: 100%;
  display: block;
}
.avatar-crop-host .cropper-view-box,
.avatar-crop-host .cropper-face {
  border-radius: 50%;
}
