:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-alt: #eef3ff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.12);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --purple: #8b5cf6;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --sidebar-width: 265px;
  --sidebar-collapsed: 92px;
  --topbar-height: 88px;
  --bottom-nav-height: 74px;
}

body[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-soft: #0f172a;
  --surface-alt: #111c32;
  --border: rgba(148, 163, 184, 0.12);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --primary-soft: rgba(96, 165, 250, 0.18);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #22d3ee;
  --purple: #a78bfa;
  --shadow: 0 20px 38px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
.dropdown-toggle:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.2rem 1rem;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 20;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.brand-wrap {
  padding: 0.25rem 0.5rem 1rem;
  margin-bottom: 0.8rem;
}

.brand {
  gap: 0.9rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(125deg, var(--primary), #fc3d4d);
  color: white;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.brand-mark2 {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background-color: #fc3d4d !important;
  color: white;
  border-radius: 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 0.95rem;
}

.brand-text small {
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin-top: 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.85rem;
  color: var(--muted);
  border-radius: 14px;
  transition: all 0.25s ease;
  font-weight: 600;
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.nav-item:hover,
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateX(2px);
}

.logout-item {
  margin-top: 0.8rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.page-shell {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

body[data-theme="dark"] .topbar {
  background: rgba(17, 24, 39, 0.75);
}

.breadcrumb-nav .breadcrumb {
  --bs-breadcrumb-divider-color: var(--muted);
}

.breadcrumb-item a {
  color: var(--muted);
}

.page-title {
  margin: 0.15rem 0 0;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  letter-spacing: -0.04em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.btn-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.25s ease;
}

.btn-icon:hover {
  background: var(--surface-alt);
  border-color: transparent;
}

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--danger), #f97316);
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
}

.badge-dot-secondary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  min-width: 260px;
}

.search-box input {
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text);
}

.search-box input:focus {
  outline: none;
}

.user-menu-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 0.35rem 0.6rem;
}

.user-menu-toggle img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 12px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.user-meta strong {
  font-size: 0.85rem;
}

.user-meta small {
  color: var(--muted);
}

.page-content {
  padding: 1.6rem 1.5rem 6rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 700;
  margin: 0;
}

.page-greeting h2 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  letter-spacing: -0.06em;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.1rem;
}

.stat-card,
.panel,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 1.15rem 1.1rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-top,
.stat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  border-radius: 14px;
  font-size: 1.2rem;
  color: white;
}

.stat-icon.primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.success { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.warning { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-icon.info { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

.trend {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.trend.positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.trend.negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.stat-body {
  margin-top: 1rem;
}

.stat-body h3 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw, 2rem);
  letter-spacing: -0.05em;
}

.stat-body p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-weight: 600;
}

.stat-footer {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.2rem;
}

.panel {
  padding: 1.2rem 1.15rem 1rem;
}

.panel-xl {
  min-height: 360px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-label {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap.small {
  height: 230px;
}

.chart-wrap.large {
  height: 300px;
}

canvas {
  width: 100% !important;
  height: 100% !important;
}

.modern-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.modern-table thead th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0.8rem;
}

.modern-table tbody td {
  padding: 0.9rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: middle;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.status-badge.info {
  background: rgba(6, 182, 212, 0.12);
  color: var(--info);
}

.status-badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.action-btn {
  border-radius: 12px;
  box-shadow: 0 12px 20px rgba(59, 130, 246, 0.22);
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.btn-soft {
  background: var(--surface-alt);
  color: var(--primary);
  border: 1px solid transparent;
}

.btn-soft:hover {
  background: rgba(59, 130, 246, 0.15);
}

.page-card {
  padding: 1.5rem;
}

.page-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.page-card-header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.data-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.dt-buttons .btn {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  color: var(--text);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface-soft) !important;
  color: var(--text) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.table-row-actions .dropdown-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
}

.dropdown-menu {
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.dropdown-item {
  color: var(--text);
}

.form-card {
  background: var(--surface);
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.3rem;
}

.form-label {
  font-weight: 600;
  color: var(--text);
}

.form-control,
.form-select,
.form-check-input {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.72rem 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

.input-group-text {
  background: var(--surface-alt);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--muted);
}

.modal-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.modal-header,
.modal-footer {
  border-color: var(--border);
}

.toast {
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  border: none;
}

.toast-header {
  background: transparent;
  border-bottom-color: rgba(255,255,255,0.1);
  color: white;
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 0.8rem 0.7rem;
  z-index: 40;
}

body[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(15, 23, 42, 0.9);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--muted);
  width: 100%;
  height: 100%;
  border-radius: 14px;
  transition: all 0.25s ease;
  font-size: 0.7rem;
  font-weight: 700;
}

.bottom-nav-item i {
  font-size: 1.35rem;
}

.bottom-nav-item.active {
  color: var(--primary);
  background: rgba(59, 130, 246, 0.09);
}

.mobile-more-menu {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--bottom-nav-height) + 1rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 180px;
  z-index: 50;
}

.mobile-more-menu.open {
  display: flex;
}

.mobile-more-menu a {
  padding: 0.8rem 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.mobile-more-menu a:hover {
  background: var(--surface-soft);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 35%), var(--bg);
}

.login-shell {
  width: min(1100px, 92vw);
  min-height: 640px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 3rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2.2rem;
}

.login-brand strong {
  display: block;
  font-size: 1.1rem;
}

.login-brand small {
  color: var(--muted);
}

.login-header h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: -0.06em;
}

.login-form {
  max-width: 420px;
}

.text-link {
  color: var(--primary);
  font-weight: 600;
}

.login-visual {
  position: relative;
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.15));
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-panel {
  width: min(420px, 90%);
  background: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  color: var(--text);
}

.mini-stat strong {
  font-size: 1.8rem;
}

.mini-chart {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  padding-top: 1rem;
}

.mini-chart span {
  flex: 1;
  background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 12px 12px 0 0;
}

.fade-up {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s ease forwards;
}

.delayed-1 { animation-delay: 0.08s; }
.delayed-2 { animation-delay: 0.16s; }
.delayed-3 { animation-delay: 0.24s; }
.delayed-4 { animation-delay: 0.32s; }
.delayed-5 { animation-delay: 0.4s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
