:root {
  --primary-gradient: linear-gradient(135deg, #4f46e5, #3b82f6);
  --sidebar-bg: #0f172a;
  --main-bg: #f8fafc;
  --card-bg: #ffffff;
  --accent: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --muted: #64748b;
  --text-main: #0f172a;
  --surface-border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at top right, #dbeafe 0, #f8fafc 38%, #f1f5f9 100%);
  color: var(--text-main);
  font-size: 14.5px;
}

a {
  text-decoration: none;
}

.fade-in {
  animation: pageFade 0.35s ease;
}

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

.app-layout {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  background: var(--sidebar-bg);
  padding: 1.2rem 1rem;
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: transform 0.3s ease, width 0.3s ease;
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-gradient);
  color: #fff;
}

.brand-title {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-sub {
  color: #94a3b8;
  font-size: 12px;
}

.sidebar-nav {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #e2e8f0;
  padding: 0.68rem 0.75rem;
  border-radius: 0.8rem;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  transform: translateX(4px);
  color: #fff;
  background: rgba(148, 163, 184, 0.16);
}

.sidebar-link.active {
  color: #fff;
  background: var(--primary-gradient);
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.35);
}

.sidebar-divider {
  margin-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  padding-top: 1rem;
}

.mini-title {
  color: #94a3b8;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.8px;
  margin-bottom: 0.5rem;
}

.mini-link {
  display: block;
  color: #cbd5e1;
  padding: 0.45rem 0.55rem;
  border-radius: 0.65rem;
  font-size: 13px;
}

.mini-link:hover,
.mini-link.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.24);
}

.mini-empty {
  color: #94a3b8;
  font-size: 12px;
  margin: 0;
}
.sidebar-clock-card {
  margin-top: auto;
  padding: 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.2), rgba(15, 23, 42, 0.65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(2, 6, 23, 0.25);
}

.sidebar-clock-title {
  color: #cbd5e1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.35rem;
}

.sidebar-clock-time {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: #f8fafc;
  letter-spacing: 0.4px;
}

.sidebar-clock-date {
  margin-top: 0.2rem;
  font-size: 12px;
  color: #bfdbfe;
}

.sidebar-clock-zone {
  margin-top: 0.35rem;
  display: inline-block;
  font-size: 11px;
  color: #e2e8f0;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
}

.main-shell {
  margin-left: 270px;
  transition: margin-left 0.3s ease;
}

.top-navbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.2rem;
  z-index: 100;
}

.btn-icon {
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #1e293b;
  background: #fff;
}

.nav-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-sub {
  color: var(--muted);
  font-size: 12px;
}

.btn-surface {
  background: #fff;
  border: 1px solid var(--surface-border);
  color: #1e293b;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.hero-banner {
  padding: 2.5rem;
  border-radius: 1.2rem;
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 16px 34px rgba(59, 130, 246, 0.28);
}

.hero-banner h2 {
  font-size: 1.9rem;
  font-weight: 800;
}

.hero-banner p {
  color: rgba(255, 255, 255, 0.86);
  margin: 0;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 1.1rem;
  padding: 1.1rem;
  border: 1px solid #eef2ff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin-bottom: 0.65rem;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.16); color: #4f46e5; }
.stat-icon.success { background: rgba(16, 185, 129, 0.14); color: #059669; }
.stat-icon.warning { background: rgba(245, 158, 11, 0.17); color: #d97706; }
.stat-icon.danger { background: rgba(239, 68, 68, 0.14); color: #dc2626; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

.surface-card {
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.table-modern {
  margin: 0;
}

.table-modern thead th {
  background: #f1f5f9;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 11px;
  border: 0;
}

.table-modern tbody tr {
  border-bottom: 1px solid #eef2ff;
  transition: background 0.2s ease;
}

.table-modern tbody tr:hover {
  background: #f8fafc;
}

.table-modern td,
.table-modern th {
  padding: 0.82rem 0.9rem;
  border: 0;
  vertical-align: middle;
}

.badge.rounded-pill {
  padding: 0.42rem 0.62rem;
  font-weight: 600;
}

.btn-primary-gradient {
  background: var(--primary-gradient);
  color: #fff;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

.btn-soft-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 0;
  border-radius: 999px;
}

.btn-primary-gradient,
.btn-surface,
.btn-soft-danger,
.btn-outline-secondary,
.btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-gradient:hover,
.btn-surface:hover,
.btn-soft-danger:hover,
.btn-outline-secondary:hover,
.btn:hover {
  transform: scale(1.02);
}

.form-control,
.form-select {
  border-radius: 0.85rem;
  border: 1px solid #dbe2ea;
  min-height: 46px;
}

.form-control:focus,
.form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.22rem rgba(59, 130, 246, 0.2);
}

.form-floating > label {
  color: #64748b;
}

.form-card-divider {
  margin: 1.1rem 0;
  border-top: 1px solid #e2e8f0;
}

.form-switch .form-check-input {
  width: 2.6rem;
  height: 1.3rem;
}

.chart-box {
  padding: 1rem;
}

.chart-wrap {
  height: 290px;
}

.nav-pills .nav-link {
  border-radius: 999px;
  color: #334155;
  font-weight: 600;
}

.nav-pills .nav-link.active {
  background: var(--primary-gradient);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.28);
}

.page-link {
  border-radius: 999px !important;
  margin-right: 0.4rem;
}

.toast.app-toast {
  border: 0;
  border-left: 4px solid #4f46e5;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}

.auth-card {
  width: 100%;
  max-width: 460px;
}

.response-pre {
  white-space: pre-wrap;
  max-height: 280px;
  overflow: auto;
}

.toast-success { border-left-color: var(--success); }
.toast-warning { border-left-color: var(--warning); }
.toast-error, .toast-danger { border-left-color: var(--danger); }

.sidebar-overlay {
  display: none;
}

.app-layout.sidebar-collapsed .app-sidebar {
  width: 88px;
}

.app-layout.sidebar-collapsed .main-shell {
  margin-left: 88px;
}

.app-layout.sidebar-collapsed .sidebar-link span,
.app-layout.sidebar-collapsed .mini-title,
.app-layout.sidebar-collapsed .mini-link,
.app-layout.sidebar-collapsed .mini-empty,
.app-layout.sidebar-collapsed .sidebar-clock-card,
.app-layout.sidebar-collapsed .brand-sub,
.app-layout.sidebar-collapsed .brand-title {
  display: none;
}

.app-layout.sidebar-collapsed .sidebar-link {
  justify-content: center;
}

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

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

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

  .app-layout.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    z-index: 1049;
  }

  .hero-banner {
    padding: 1.5rem;
  }
}
