/* =========================================================
   RIVEL CANDLE — admin.css
   Corporate Ultra SaaS Admin Panel Styles (Premium Light Mode)
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16.5px; /* Perfect balance for readability and data density */
}

:root {
  --rose:        #b85269; /* Primary deep-rose matching brand identity */
  --blush:       #fcdde3;
  --rose-light:  rgba(184, 82, 105, 0.08);
  --gold:        #bfa065;
  --gold-light:  rgba(191, 160, 101, 0.08);
  --purple:      #8059bf;
  --teal:        #3b9687;
  --bg:          #f7f6f3; /* Premium corporate warm light grey */
  --surface:     #ffffff; /* White cards and panels */
  --surface2:    #faf9f6; /* Subtle table/input background */
  --border:      rgba(184, 82, 105, 0.12); /* Subtle branded borders */
  --text:        #150c0e; /* Dark rich brown for high contrast */
  --muted:       rgba(21, 12, 14, 0.6); /* Readable grey/brown */
  --sidebar-w:   260px;
  --topbar-h:    72px;
  
  --font-sans:   'Plus Jakarta Sans', system-ui, sans-serif;
  --font-serif:  'Cormorant Garamond', serif;
  
  --shadow-soft: 0 4px 20px rgba(184, 82, 105, 0.04);
  --shadow-md:   0 10px 30px rgba(184, 82, 105, 0.06);
  --shadow-lg:   0 20px 48px rgba(184, 82, 105, 0.08);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--rose);
  border-radius: 3px;
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: radial-gradient(circle at center, #ffffff 0%, var(--bg) 100%);
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .15;
  animation: orbFloat 10s ease-in-out infinite;
}

.orb1 { width: 450px; height: 450px; background: var(--rose); top: -100px; left: -100px; }
.orb2 { width: 350px; height: 350px; background: var(--purple); bottom: -50px; right: 100px; animation-delay: -3s; }
.orb3 { width: 250px; height: 250px; background: var(--gold); top: 40%; left: 50%; animation-delay: -6s; }

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-flame {
  font-size: 52px;
  display: block;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text);
}

.login-logo h1 span {
  color: var(--rose);
}

.login-logo p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 18px;
  opacity: .6;
}

.input-wrap input, .settings-input {
  width: 100%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 14px 44px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .2s, background .2s, box-shadow .2s;
  outline: none;
}

.input-wrap input:focus, .settings-input:focus {
  border-color: var(--rose);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(184, 82, 105, 0.08);
}

.settings-input {
  padding: 12px 16px;
}

textarea.settings-input {
  resize: vertical;
}

select.settings-input {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23150c0e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

.toggle-pw {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  transition: color .2s;
}

.toggle-pw:hover {
  color: var(--text);
}

.login-error {
  color: #d93838;
  font-size: 0.95rem;
  text-align: center;
  background: #fde8e8;
  border: 1px solid #f8b4b4;
  border-radius: 10px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: padding .3s, max-height .3s;
}

.login-error.visible {
  padding: 12px;
  max-height: 80px;
}

.btn-login {
  position: relative;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 1.05rem;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .2s, box-shadow .2s;
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(184, 82, 105, 0.25);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-loader {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}

.btn-loader.show {
  display: block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 24px;
}

/* =========================================================
   ADMIN SHELL
   ========================================================= */
.admin-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .3s;
  z-index: 100;
}

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

.sidebar-brand strong {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.sidebar-brand small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  transition: background .2s, color .2s;
  width: 100%;
  position: relative;
}

.nav-item:hover {
  background: rgba(184, 82, 105, 0.04);
  color: var(--rose);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(184, 82, 105, 0.08), rgba(191, 160, 101, 0.04));
  color: var(--rose);
  font-weight: 600;
}

.nav-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.nav-badge.new {
  background: var(--rose);
  color: #fff;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.sidebar-footer small {
  color: var(--muted);
  font-size: 0.8rem;
}

.logout-btn {
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s, background .2s;
  box-shadow: var(--shadow-soft);
}

.logout-btn:hover {
  border-color: #d93838;
  color: #d93838;
  background: #fff5f5;
}

/* ── MAIN ── */
.admin-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 1.5rem;
  padding: 6px;
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  flex: 1;
}

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

.topbar-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .2s, box-shadow .2s;
  position: relative;
  box-shadow: var(--shadow-soft);
}

.topbar-btn:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--rose);
  border-radius: 50%;
}

.wp-btn {
  font-weight: 600;
  color: var(--rose);
  border-color: rgba(184, 82, 105, 0.3);
}

/* ── PAGES ── */
.page {
  padding: 36px 32px 80px;
  max-width: 1400px;
}

.page.hidden {
  display: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 16px;
}

.page-header h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
}

.page-header p {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 4px;
}

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
}

.card.mt { margin-top: 32px; }
.card.span2 { grid-column: span 2; }

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

.card-header h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
}

/* ── STATS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}

.stat-card.purple { background: rgba(128,89,191,0.06); border-color: rgba(128,89,191,0.15); }
.stat-card.rose   { background: rgba(184,82,105,0.06); border-color: rgba(184,82,105,0.15); }
.stat-card.gold   { background: rgba(191,160,101,0.06); border-color: rgba(191,160,101,0.15); }
.stat-card.teal   { background: rgba(59,150,135,0.06); border-color: rgba(59,150,135,0.15); }

.stat-icon {
  font-size: 2.5rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--text);
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 2px;
}

.stat-change {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
}

.stat-change.positive { color: #1a7f37; }
.stat-change.neutral  { color: var(--gold); }

/* ── DASHBOARD GRID ── */
.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── TOP PRODUCTS ── */
.top-products {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-product-item {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tp-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.tp-rank.gold-rank {
  background: rgba(191, 160, 101, 0.15);
  color: var(--gold);
  border-color: rgba(191, 160, 101, 0.25);
}

.tp-img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.tp-info {
  flex: 1;
  min-width: 0;
}

.tp-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-cat {
  color: var(--muted);
  font-size: 0.85rem;
}

.tp-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

.tp-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--rose), var(--gold));
}

.tp-price {
  color: var(--rose);
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ── CHART ── */
.chart-area {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding-top: 20px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chart-bar-fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--rose), rgba(184, 82, 105, 0.2));
  transition: height .6s cubic-bezier(.34,1.56,.64,1);
  min-height: 6px;
  cursor: pointer;
  position: relative;
}

.chart-bar-fill:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.chart-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

/* ── TABLE ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.admin-table th {
  text-align: left;
  padding: 14px 16px;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--surface2);
}

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

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: var(--surface2);
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  max-width: 250px;
  line-height: 1.4;
}

.product-id {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

/* ── STATUS BADGES ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.new        { background: rgba(59,150,135,0.12); color: var(--teal); }
.status-badge.processing { background: rgba(191,160,101,0.12); color: var(--gold); }
.status-badge.shipped    { background: rgba(74,164,255,0.12);  color: #2b7fff; }
.status-badge.delivered  { background: rgba(26,127,55,0.12); color: #1a7f37; }
.status-badge.cancelled  { background: rgba(217,56,56,0.1); color: #d93838; }
.status-badge.active     { background: rgba(26,127,55,0.12); color: #1a7f37; }
.status-badge.inactive   { background: rgba(0,0,0,0.06); color: var(--muted); }
.status-badge.sale       { background: rgba(184,82,105,0.12); color: var(--rose); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 240px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 18px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search-input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(184, 82, 105, 0.08);
}

.filter-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 36px 12px 18px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23150c0e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

/* ── BUTTONS ── */
.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--gold));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  opacity: .95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(184, 82, 105, 0.2);
}

.btn-secondary {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
  box-shadow: var(--shadow-soft);
}

.btn-secondary:hover {
  background: var(--surface2);
  transform: translateY(-1px);
}

.btn-sm {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.btn-sm:hover {
  background: var(--surface2);
  color: var(--rose);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.15rem;
  padding: 6px 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}

.btn-icon:hover {
  background: var(--surface2);
  color: var(--text);
}

.btn-icon.danger:hover {
  color: #d93838;
  background: #fff5f5;
}

/* ── MODAL ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(21, 12, 14, 0.4);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}

.modal-bg.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .3s ease;
  box-shadow: var(--shadow-lg);
}

.modal.modal-wide {
  max-width: 760px;
}

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

.modal-head {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface2);
}

.modal-head h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── ANALYTICS ── */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.donut-chart {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-top: 24px;
}

canvas#donutCanvas {
  border-radius: 50%;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

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

.monthly-stats {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 20px;
}

.monthly-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.monthly-label {
  min-width: 80px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

.monthly-bar {
  flex: 1;
  height: 10px;
  background: var(--surface2);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.monthly-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--rose), var(--purple));
  transition: width .6s ease;
}

.monthly-val {
  min-width: 70px;
  text-align: right;
  font-size: 0.9rem;
  font-weight: 600;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 160px;
  margin-top: 24px;
}

.bc-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bc-fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--purple), rgba(128, 89, 191, 0.2));
  min-height: 6px;
}

.bc-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ── SETTINGS ── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 12px 0;
  border-bottom: 1.5px solid var(--border);
  font-size: 1rem;
  font-weight: 500;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .dashboard-grid, .analytics-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .topbar-actions .topbar-btn span { display: none; }
}
