:root {
  --bg-page: #f3f6fb;
  --bg-panel: #ffffff;
  --bg-soft: #eef4ff;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: rgb(var(--primary-rgb) / 0.12);
  --secondary: #4f46e5;
  --text: #0f172a;
  --text-soft: #64748b;
  --line: rgba(148, 163, 184, 0.2);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --shadow-soft: 0 16px 38px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.06);
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.btn,
.form-control,
.form-select,
.input-group-text {
  border-radius: 12px;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgb(var(--primary-rgb) / 0.15);
}

.app-body {
  overflow-x: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fbff 0%, var(--bg-page) 100%);
}

.sidebar {
  width: 260px;
  background: rgba(15, 23, 42, 0.96);
  color: #e2e8f0;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 24px rgb(var(--primary-rgb) / 0.35);
  color: white;
  font-size: 1.25rem;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy .brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-copy small {
  color: rgba(226, 232, 240, 0.7);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.75);
  text-transform: uppercase;
  margin: 8px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: rgba(226, 232, 240, 0.82);
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 1.05rem;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(148, 163, 184, 0.12);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.06);
}

.sidebar-footer {
  padding-top: 18px;
}

.mini-card {
  background: linear-gradient(135deg, rgb(var(--primary-rgb) / 0.18), rgb(var(--secondary-rgb) / 0.16));
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-card__label {
  color: rgba(191, 219, 254, 0.85);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mini-card strong {
  font-size: 1.4rem;
  color: #fff;
}

.mini-card small {
  color: rgba(191, 219, 254, 0.82);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px 28px 18px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 15;
}

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

.sidebar-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 1.2rem;
}

.topbar-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.04em;
}

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

.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  min-width: min(100%, 360px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.global-search i {
  color: var(--text-soft);
  font-size: 1rem;
}

.global-search input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.global-search input::placeholder {
  color: rgba(100, 116, 139, 0.8);
}

.icon-button {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  position: relative;
  color: var(--text);
}

.badge-dot {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.8);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-meta strong {
  font-size: 0.9rem;
}

.user-meta small {
  color: var(--text-soft);
}

.content-panel {
  padding: 28px;
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgb(var(--primary-rgb) / 0.1);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.page-header h2,
.page-header h1 {
  margin: 12px 0 0;
  font-size: clamp(1.8rem, 2.4vw, 2.5rem);
  letter-spacing: -0.05em;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 12px 24px rgb(var(--primary-rgb) / 0.22);
}

.primary-btn:hover {
  color: white;
  transform: translateY(-1px);
}

.secondary-btn {
  background: white;
  color: var(--text);
  border-color: var(--line);
}

.ghost-btn {
  background: transparent;
  color: var(--primary);
  border-color: rgb(var(--primary-rgb) / 0.18);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 18px 0 0 18px;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.stat-card.primary .stat-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-card.success .stat-icon {
  background: var(--success-soft);
  color: var(--success);
}

.stat-card.warning .stat-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-card.danger .stat-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-copy {
  flex: 1;
}

.stat-copy p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.stat-copy h3 {
  margin: 7px 0 0;
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  letter-spacing: -0.05em;
}

.trend {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 8px;
}

.trend.positive {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.trend.negative {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.shortcuts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}

.shortcut-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-card);
}

.shortcut-pill i {
  color: var(--primary);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
}

.panel-card {
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.panel-head .muted-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.82rem;
}

.mini-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 180px;
  padding-top: 10px;
}

.chart-bar {
  flex: 1;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #93c5fd 0%, var(--primary) 100%);
  min-height: 40px;
  position: relative;
}

.chart-bar:nth-child(odd) {
  background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
}

.chart-bar span {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-soft);
}

.alert-list,
.list-rows,
.payments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item,
.list-row,
.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.alert-item:last-child,
.list-row:last-child,
.payment-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.alert-guide {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-bubble {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-bubble.danger { background: var(--danger); }
.status-bubble.warning { background: var(--warning); }
.status-bubble.success { background: var(--success); }

.alert-copy h4,
.list-copy h4,
.payment-copy h4 {
  margin: 0;
  font-size: 0.96rem;
}

.alert-copy p,
.list-copy p,
.payment-copy p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.8rem;
}

.badge-soft {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-soft.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-soft.warning {
  background: var(--warning-soft);
  color: #b45309;
}

.badge-soft.success {
  background: var(--success-soft);
  color: var(--success);
}

.list-copy,
.payment-copy {
  flex: 1;
}

.list-value,
.payment-value {
  font-weight: 700;
}

.list-value.warning {
  color: var(--warning);
}

.list-value.success {
  color: var(--success);
}

.payments-list .amount {
  color: var(--text);
  font-weight: 700;
}

.module-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.module-card {
  background: var(--bg-panel);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 32px rgba(15, 23, 42, 0.08);
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.module-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.module-icon.primary { background: var(--primary-soft); color: var(--primary); }
.module-icon.success { background: var(--success-soft); color: var(--success); }
.module-icon.warning { background: var(--warning-soft); color: var(--warning); }
.module-icon.danger { background: var(--danger-soft); color: var(--danger); }
.module-icon.info { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.module-icon.muted { background: rgba(148, 163, 184, 0.12); color: #475569; }

.module-card h3 {
  margin: 0;
  font-size: 1rem;
}

.badge-light {
  display: inline-flex;
  align-items: center;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.module-card p {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.6;
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.module-actions .btn {
  font-size: 0.8rem;
  border-radius: 10px;
  padding: 8px 11px;
}

@media (max-width: 1199px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
  }

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

  .sidebar-toggle {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    padding: 18px 18px 14px;
  }

  .content-panel {
    padding: 18px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .stats-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .global-search {
    min-width: 0;
    flex: 1 1 100%;
  }

  .page-header {
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .primary-btn,
  .header-actions .secondary-btn {
    flex: 1 1 140px;
  }
}
