/* Admin Dashboard Styles */

:root {
  --bg: #f5f0e8;
  --surface: #ffffff;
  --surface-2: #f8f4ed;
  --surface-3: #eee7dc;
  --border: rgba(26, 24, 9, 0.12);
  --border-2: rgba(26, 24, 9, 0.2);

  --text: #1a1809;
  --text-2: #5f5848;
  --text-3: #8b826f;

  --gold: #b8952f;
  --gold-dim: rgba(184, 149, 47, 0.12);
  --gold-glow: rgba(184, 149, 47, 0.08);

  --green: #1f9d55;
  --green-dim: rgba(31, 157, 85, 0.1);
  --amber: #b7791f;
  --amber-dim: rgba(183, 121, 31, 0.1);
  --red: #c53030;
  --red-dim: rgba(197, 48, 48, 0.1);
  --blue: #2b6cb0;
  --blue-dim: rgba(43, 108, 176, 0.1);
}

/* Base surfaces */
html,
body {
  background: var(--bg);
  color: var(--text);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ── Layout Fix ────────────────────────────────────────────── */
.admin-layout,
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — fixed position */
.admin-sidebar,
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w, 220px);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  flex-shrink: 0;
}

/* Main content — offset by sidebar width */
.admin-main,
.main {
  flex: 1;
  margin-left: var(--sidebar-w, 220px);
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

/* Stats row — ensure it's not cut off */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  width: 100%;
}

/* Stat cards — ensure visibility */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r, 10px);
  padding: 1rem 1.25rem;
  min-width: 0; /* prevent overflow */
}

/* Charts — constrain width */
.charts-primary,
.charts-analytics,
.dashboard-row-3col {
  padding: 0 1.5rem 1.5rem;
  width: 100%;
  max-width: 100%;
}

/* Responsive — collapse sidebar on mobile */
@media (max-width: 900px) {
  .admin-sidebar,
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .admin-sidebar.open,
  .sidebar.open {
    transform: translateX(0);
  }
  
  .admin-main,
  .main {
    margin-left: 0;
  }
  
  .stats-row {
    grid-template-columns: 1fr 1fr;
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.admin-sidebar,
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.admin-sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}

.sidebar-header {
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #e6c54d);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-logo svg {
  width: 20px;
  height: 20px;
  color: #000;
}

.admin-title-group {
  display: flex;
  flex-direction: column;
}

.admin-title {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.admin-subtitle {
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-search {
  margin: 0 0.75rem 0.75rem;
  padding: 0.55rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-3);
  font-size: 0.8rem;
  transition: border-color 0.15s;
}

.sidebar-search:hover {
  border-color: var(--border-hover);
}

.sidebar-search svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sidebar-search span {
  flex: 1;
}

.sidebar-search kbd {
  font-family: inherit;
  font-size: 0.65rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.5rem;
  overflow-y: auto;
}

.nav-section-title {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 1.25rem 0.75rem 0.4rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: all 0.12s;
  font-size: 0.85rem;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 500;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-dot {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.nav-dot.critical {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.admin-user:hover {
  background: var(--surface-2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #e6c54d);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

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

.user-name {
  font-weight: 500;
  font-size: 0.85rem;
  display: block;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-3);
  display: block;
}

.user-menu-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
}

.user-menu-btn svg {
  width: 14px;
  height: 14px;
}

/* Main */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

.admin-sidebar.collapsed ~ .admin-main {
  margin-left: 0;
}

/* Topbar */
.admin-topbar,
.topbar {
  background: rgba(245, 240, 232, 0.9);
  border-bottom: 1px solid var(--border);
}

.admin-topbar {
  height: var(--topbar-h);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(9,9,11,0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}

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

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

.topbar-left h1 {
  font-size: 1.15rem;
  font-weight: 600;
}

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

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 500;
}

.live-indicator.small {
  font-size: 0.7rem;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}

.last-updated {
  font-size: 0.7rem;
  color: var(--text-3);
}

.topbar-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.topbar-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.topbar-btn svg {
  width: 16px;
  height: 16px;
}

.notification-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface-2);
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  width: 100%;
}

.stat-card,
.chart-card,
.dash-card,
.dashboard-section,
.export-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(26, 24, 9, 0.04);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.stat-card-glow {
  border-color: rgba(245,158,11,0.25);
  box-shadow: 0 0 20px rgba(245,158,11,0.05);
}

.stat-card-wide {
  grid-column: span 1;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.stat-icon-wrap.pending {
  background: var(--warning-dim);
  color: var(--warning);
}

.stat-icon-wrap.approved {
  background: var(--success-dim);
  color: var(--success);
}

.stat-icon-wrap.sessions {
  background: var(--info-dim);
  color: var(--info);
}

.stat-icon-wrap.logins {
  background: rgba(139,92,246,0.12);
  color: var(--purple);
}

.stat-icon-wrap.storage {
  background: var(--accent-dim);
  color: var(--accent);
}

.stat-live-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--success);
  background: var(--success-dim);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.stat-label-inline {
  font-size: 0.75rem;
  color: var(--text-3);
}

.sparkline {
  display: block;
}

.stat-body {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 0.15rem;
}

.stat-action {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: auto;
  transition: opacity 0.15s;
}

.stat-action:hover {
  opacity: 0.8;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: auto;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

.stat-subtext {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: auto;
}

.storage-progress {
  margin-top: 0.5rem;
}

.storage-bar-bg {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #e6c54d);
  transition: width 0.6s ease;
}

.storage-breakdown {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-3);
}

.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 0.3rem;
}

.dot-photos {
  background: var(--info);
}

.dot-docs {
  background: var(--accent);
}

.dot-ids {
  background: var(--purple);
}

/* Chart Cards */
.charts-primary,
.charts-analytics {
  display: grid;
  gap: 1rem;
  padding: 0 1.5rem 1.5rem;
}

.charts-primary {
  grid-template-columns: 2fr 1fr;
}

.charts-analytics {
  grid-template-columns: repeat(4, 1fr);
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.chart-card-2x {
  grid-column: span 1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.chart-header h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.chart-subtitle {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 0.1rem;
}

.chart-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px;
}

.chart-tab {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.chart-tab:hover {
  color: var(--text-2);
}

.chart-tab.active {
  background: var(--surface-3);
  color: var(--text);
}

.chart-body {
  position: relative;
  width: 100%;
  min-height: 180px;
  max-height: 280px;
}

.chart-body-donut {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  max-height: 200px;
}

.chart-body canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-2);
}

.legend-color {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

/* Dashboard Cards */
.dashboard-row-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0 1.5rem 1.5rem;
}

.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

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

.card-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-link {
  font-size: 0.75rem;
  color: var(--accent);
}

.card-link:hover {
  text-decoration: underline;
}

/* Alerts */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  animation: fadeSlideIn 0.3s ease;
}

.alert-item.high {
  border-color: var(--danger);
}

.alert-item.medium {
  border-color: var(--warning);
}

.alert-item.low {
  border-color: var(--info);
}

.alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-icon svg {
  width: 14px;
  height: 14px;
}

.alert-item.high .alert-icon {
  background: var(--danger-dim);
  color: var(--danger);
}

.alert-item.medium .alert-icon {
  background: var(--warning-dim);
  color: var(--warning);
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 0.8rem;
  font-weight: 500;
}

.alert-meta {
  font-size: 0.65rem;
  color: var(--text-3);
  margin-top: 0.15rem;
}

/* Applications */
.applications-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 320px;
  overflow-y: auto;
}

.application-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  text-decoration: none;
  animation: fadeSlideIn 0.3s ease;
}

.application-item:hover {
  background: var(--surface-2);
}

.applicant-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-3);
  flex-shrink: 0;
}

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

.applicant-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.applicant-email {
  font-size: 0.7rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.application-meta {
  text-align: right;
  flex-shrink: 0;
}

.application-date {
  font-size: 0.65rem;
  color: var(--text-3);
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.pending {
  background: var(--warning-dim);
  color: var(--warning);
}

.status-badge.approved {
  background: var(--success-dim);
  color: var(--success);
}

.status-badge.declined {
  background: var(--danger-dim);
  color: var(--danger);
}

/* Activity Feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 320px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  animation: fadeSlideIn 0.3s ease;
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.feed-dot.login {
  background: var(--success);
}

.feed-dot.failed {
  background: var(--danger);
}

.feed-dot.signup {
  background: var(--info);
}

.feed-dot.upload {
  background: var(--accent);
}

.feed-dot.alert {
  background: var(--warning);
}

.feed-text {
  flex: 1;
  font-size: 0.8rem;
  line-height: 1.4;
}

.feed-text strong {
  font-weight: 500;
}

.feed-time {
  font-size: 0.65rem;
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
}

/* Export */
.export-card {
  margin: 0 1.5rem 1.5rem;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.btn-export {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-export svg {
  width: 20px;
  height: 20px;
}

.btn-export small {
  font-size: 0.65rem;
  color: var(--text-3);
  font-weight: 400;
}

.btn-export:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* States */
.empty-state {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-3);
  font-size: 0.85rem;
}

/* Animations */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.spin {
  animation: spin 0.8s linear infinite;
}

/* Responsive */
@media (max-width: 1400px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-card-wide {
    grid-column: span 3;
  }

  .charts-analytics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1100px) {
  .charts-primary {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }

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

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

  .sidebar-toggle {
    display: flex;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    padding: 1rem;
  }

  .stat-card-wide {
    grid-column: span 2;
  }

  .charts-primary,
  .charts-analytics,
  .dashboard-row-3col {
    padding: 0 1rem 1rem;
  }

  .export-card {
    margin: 0 1rem 1rem;
  }

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

@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: 1fr;
  }

  .stat-card-wide {
    grid-column: span 1;
  }

  .charts-analytics {
    grid-template-columns: 1fr;
  }

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

/* ── Back to Site link ─────────────────────────────────────── */
.nav-link-home {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--gold);
}

.nav-link-home:hover {
  background: var(--gold-dim);
  color: var(--gold);
}

.nav-link-home svg {
  opacity: 1;
}

/* ── Chart Fixes ───────────────────────────────────────────── */

/* Force charts to respect container */
.chart-card {
  min-height: 0;
  overflow: hidden;
}

.chart-body {
  position: relative;
  width: 100%;
  min-height: 180px;
  max-height: 280px;
}

.chart-body canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

/* Smaller charts in grid */
.charts-analytics .chart-body {
  min-height: 160px;
  max-height: 200px;
}

/* Doughnut/Pie charts need centered flex */
.chart-body-donut {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  max-height: 200px;
}

.chart-body-donut canvas {
  position: relative;
  max-width: 180px;
  max-height: 180px;
}

/* Responsive chart grid */
@media (max-width: 1400px) {
  .charts-analytics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .charts-primary {
    grid-template-columns: 1fr;
  }
  
  .charts-analytics {
    grid-template-columns: 1fr;
  }
  
  .chart-body {
    min-height: 200px;
    max-height: 250px;
  }
}

/* ── Remove overlay/palette remnants ───────────────────────── */
.command-palette,
.palette-backdrop,
.palette-dialog,
.sidebar-search {
  display: none !important;
}
