:root {
  --primary: #4338ca;
  --primary-light: #6366f1;
  --primary-dark: #312e81;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-2: #8b5cf6;
  --pop: #f0abfc;
  --accent-subtle: #eef2ff;
  --accent-subtle-border: #c7d2fe;
  --bg-start: #eef2ff;
  --bg-mid: #f5f3ff;
  --bg-end: #faf5ff;
  --card-bg: rgba(255,255,255,0.85);
  --text: #1e1b4b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e0e7ff;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --sidebar-width: 260px;
  --sidebar-grad: linear-gradient(180deg, #312e81 0%, #4338ca 50%, #6d28d9 100%);
  --btn-grad: linear-gradient(135deg, #4f46e5, #7c3aed);
  --btn-grad-hover: linear-gradient(135deg, #6366f1, #8b5cf6);
}

* { box-sizing: border-box; }

body {
  background:
    radial-gradient(1100px 500px at 8% -5%, rgba(129,140,248,0.20) 0%, transparent 60%),
    radial-gradient(900px 450px at 95% 5%, rgba(196,181,253,0.28) 0%, transparent 55%),
    radial-gradient(700px 400px at 50% 100%, rgba(233,213,255,0.30) 0%, transparent 60%),
    linear-gradient(180deg, #eef2ff 0%, #f5f3ff 50%, #faf5ff 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  min-height: 100vh;
  margin: 0;
}

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

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-grad);
  color: #e0e7ff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  box-shadow: 4px 0 28px rgba(0,0,0,0.28);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 1.25rem;
  text-decoration: none;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-brand img { width: 34px; height: 34px; display: block; }

.sidebar-brand .brand-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.4px;
  line-height: 1.1;
}

.sidebar-brand .brand-sub {
  display: block;
  font-size: 0.66rem;
  font-weight: 400;
  opacity: 0.6;
  margin-top: 1px;
  letter-spacing: 0.2px;
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.45);
  padding: 0.5rem 0.85rem 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.6rem;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  position: relative;
}

.sidebar-link svg { flex-shrink: 0; opacity: 0.9; }

.sidebar-link:hover { background: rgba(255,255,255,0.10); color: #fff; transform: translateX(2px); }

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.20), rgba(255,255,255,0.07));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.20);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--pop);
}

.sidebar-bottom {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem 0.75rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #f0abfc);
  color: #312e81;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar svg { width: 18px; height: 18px; }

.sidebar-username { color: #fff; font-weight: 700; font-size: 0.85rem; line-height: 1.2; }

.sidebar-status { color: #a5b4fc; font-size: 0.72rem; }
.sidebar-status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; margin-right: 4px; }

.sidebar-lang { display: flex; gap: 0.4rem; margin: 0 0.5rem 0.65rem; }
.sidebar-lang a {
  flex: 1;
  text-align: center;
  padding: 0.32rem;
  border-radius: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #c7d2fe;
  border: 1px solid rgba(255,255,255,0.18);
  text-decoration: none;
  transition: all 0.15s;
}
.sidebar-lang a:hover { background: rgba(255,255,255,0.12); color: #fff; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 1030;
}

/* ─── Main content ─── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.5rem;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-title {
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--text);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

.topbar-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.content > * { animation: fadeUp 0.4s ease both; }

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

/* ─── Hero banner (dashboard) ─── */
.hero-banner {
  border-radius: 1rem;
  padding: 2rem 2.25rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: 0 12px 32px rgba(124,58,237,0.35);
  background:
    radial-gradient(circle at 90% 15%, rgba(240,171,252,0.40) 0%, transparent 42%),
    radial-gradient(circle at 8% 100%, rgba(129,140,248,0.35) 0%, transparent 45%),
    linear-gradient(135deg, #4338ca 0%, #6d28d9 55%, #8b5cf6 100%);
}

.hero-banner::before,
.hero-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.hero-banner::before { right: -50px; top: -50px; width: 220px; height: 220px; background: rgba(255,255,255,0.08); }
.hero-banner::after { right: 110px; bottom: -90px; width: 200px; height: 200px; background: rgba(255,255,255,0.05); }

.hero-title { font-size: 1.85rem; font-weight: 800; margin: 0 0 0.3rem; letter-spacing: -0.4px; }
.hero-sub { color: rgba(255,255,255,0.85); font-size: 0.95rem; margin: 0; }
.hero-date { display: inline-block; margin-top: 1rem; font-size: 0.78rem; font-weight: 600; color: #fff; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.22); border-radius: 999px; padding: 0.3rem 0.85rem; }

/* ═══════════════ COMPONENTS ═══════════════ */

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0;
  color: var(--text);
  position: relative;
  padding-left: 0.85rem;
  letter-spacing: -0.3px;
}

.page-header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  bottom: 14%;
  width: 5px;
  border-radius: 4px;
  background: linear-gradient(180deg, #6366f1, #a855f7);
}

.page-header .page-sub { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Cards */
.card-custom {
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 1rem;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.10), 0 1px 4px rgba(99,102,241,0.06);
  transition: box-shadow 0.25s, transform 0.25s;
}

.card-custom:hover {
  box-shadow: 0 8px 28px rgba(99,102,241,0.18);
  transform: translateY(-2px);
}

.card-custom .card-header {
  background: transparent;
  border-bottom: 2px solid var(--accent);
  font-weight: 700;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-custom .card-header .head-icon { color: var(--accent); display: flex; }

.card-custom .card-body { padding: 1.25rem; }

.card-report {
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(99,102,241,0.10);
  border-top: 4px solid var(--accent);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.card-report .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  padding: 1rem 1.25rem;
}

/* Stat cards */
.stat-card {
  border: none;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(99,102,241,0.25);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  color: #fff;
}

.stat-card:hover { transform: translateY(-4px); box-shadow: 0 14px 36px rgba(124,58,237,0.4); }

.stat-card::before {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.stat-card .stat-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 0.65rem;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 1;
}

.stat-card .stat-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 0.25rem;
  position: relative;
  letter-spacing: -1px;
}

.stat-card .stat-label {
  color: rgba(255,255,255,0.85);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  position: relative;
}

.stat-card-primary { background: linear-gradient(135deg, #4338ca, #6366f1); }
.stat-card-accent  { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.stat-card-info    { background: linear-gradient(135deg, #4338ca, #7c3aed); }

/* Tables */
.table-custom { border-collapse: separate; border-spacing: 0; width: 100%; }

.table-custom thead th {
  background: linear-gradient(135deg, #eef2ff, #faf5ff);
  border-bottom: 2px solid var(--accent);
  color: #6d28d9;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.8rem 1rem;
  white-space: nowrap;
}

.table-custom tbody td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.table-custom tbody tr { transition: background 0.12s; }
.table-custom tbody tr:hover { background: rgba(237,233,254,0.5); }
.table-custom tbody tr:last-child td { border-bottom: none; }

.table-custom thead th:first-child { border-top-left-radius: 0.6rem; }
.table-custom thead th:last-child { border-top-right-radius: 0.6rem; }

/* Badges */
.badge-type {
  font-weight: 600;
  padding: 0.25em 0.75em;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-consultation { background: #ede9fe; color: #6d28d9; }
.badge-review { background: #fae8ff; color: #a21caf; }
.badge-meeting { background: #e0e7ff; color: #4338ca; }
.badge-training { background: #d1fae5; color: #047857; }
.badge-presentation { background: #fef3c7; color: #b45309; }
.badge-status-update { background: #e0e7ff; color: #4338ca; }
.badge-planning-session { background: #ede9fe; color: #7c3aed; }
.badge-de-briefing { background: #fce7f3; color: #be185d; }

.badge-status-active { background: #d1fae5; color: #047857; }
.badge-status-inactive { background: #e9e9f5; color: #64748b; }

/* Buttons */
.btn-accent {
  background: var(--btn-grad);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 0.45rem 1.15rem;
  border-radius: 0.5rem;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-size: 0.9rem;
  box-shadow: 0 4px 14px rgba(124,58,237,0.35);
}

.btn-accent:hover {
  background: var(--btn-grad-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.45);
}

.btn-outline-accent {
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: rgba(255,255,255,0.5);
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-outline-accent:hover {
  background: var(--btn-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}

.btn-outline-accent.active {
  background: var(--btn-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124,58,237,0.3);
}

.btn-action { padding: 0.25rem 0.6rem; font-size: 0.78rem; border-radius: 0.4rem; font-weight: 600; }

/* Filter bar */
.filter-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }

/* Forms */
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.form-label { font-weight: 600; font-size: 0.82rem; margin-bottom: 0.3rem; color: var(--text); }

.required::after { content: " *"; color: var(--danger); font-weight: 600; }

.section-header {
  font-weight: 700;
  color: var(--text);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 1.25rem;
  margin-top: 0.5rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-header .sec-icon { color: var(--accent); }

/* Timezone chip */
.timezone-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef2ff;
  color: #6d28d9;
  border: 1px solid #c7d2fe;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.25; }
.empty-state .empty-text { font-size: 0.9rem; }

/* Appointment cards */
.appt-card {
  border: 1px solid rgba(255,255,255,0.65);
  border-radius: 0.6rem;
  box-shadow: 0 2px 8px rgba(99,102,241,0.10);
  border-left: 4px solid var(--accent);
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: box-shadow 0.15s, transform 0.15s;
}

.appt-card:hover { box-shadow: 0 6px 16px rgba(124,58,237,0.2); transform: translateY(-2px); }
.appt-card .card-body { padding: 0.85rem 1rem; }
.appt-card .card-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.35rem; }
.appt-card .card-text { font-size: 0.8rem; color: var(--text-muted); }

/* Alerts */
.alert-custom {
  border: none;
  border-left: 4px solid;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}
.alert-success.alert-custom { border-left-color: var(--success); }
.alert-danger.alert-custom { border-left-color: var(--danger); }
.alert-warning.alert-custom { border-left-color: var(--warning); }

/* Footer */
.footer-custom {
  margin-top: auto;
  padding: 0.9rem 1.5rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.6);
  border-top: 1px solid var(--border);
}

/* ═══════════════ LOGIN ═══════════════ */
.login-page {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #8b5cf6 100%);
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.login-page::before {
  width: 420px; height: 420px; background: #818cf8; top: -120px; left: -120px;
  animation: blobFloat 16s ease-in-out infinite;
}

.login-page::after {
  width: 360px; height: 360px; background: #d946ef; bottom: -90px; right: -90px;
  animation: blobFloat 18s ease-in-out infinite reverse;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.1); }
  66% { transform: translate(-30px,20px) scale(0.95); }
}

.login-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 1.25rem;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.login-card .card-body { padding: 2.5rem; }

.login-card .form-control {
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }

.login-brand { text-align: center; margin-bottom: 2rem; }

.login-brand .brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--btn-grad);
  padding: 8px;
  box-shadow: 0 8px 20px rgba(124,58,237,0.4);
  margin-bottom: 0.9rem;
}

.login-brand .brand-logo svg { width: 100%; height: 100%; display: block; }

.login-brand .brand-title { font-weight: 800; color: var(--text); font-size: 1.5rem; letter-spacing: -0.4px; }
.login-brand .brand-subtitle { color: var(--text-muted); font-size: 0.85rem; }

.demo-credentials {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  color: #6d28d9;
  text-align: center;
  margin-top: 1.25rem;
}

.demo-credentials code { color: #4338ca; background: transparent; font-weight: 700; }

.lang-toggles { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1rem; }
.lang-toggles a {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.lang-toggles a:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,0.4); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; }
  .menu-btn { display: inline-flex; }
}

@media (max-width: 575.98px) {
  .content { padding: 1rem; }
  .hero-title { font-size: 1.5rem; }
  .topbar { padding: 0.6rem 1rem; }
  .topbar-date { display: none; }
}
