@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sidebar-bg: #0d1520;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: #142e23;
  --sidebar-active-text: #ffffff;
  --sidebar-accent: #10b981;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --primary-btn: #0f172a;
  --primary-btn-hover: #1e293b;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.4; }
::selection { background: #bbf7d0; color: #064e3b; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.icon {
  display: inline-block;
  vertical-align: middle;
  width: 17px;
  height: 17px;
  stroke-width: 1.8;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* App Shell */
.app-shell { display: flex; min-height: 100vh; }

/* Dark Sleek Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  z-index: 30;
  color: var(--sidebar-text);
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }

.sidebar-brand {
  height: 68px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-symbol {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
}
.brand-name {
  font-weight: 800;
  letter-spacing: -0.5px;
  font-size: 15px;
  color: #ffffff;
  line-height: 1.1;
}
.brand-name span {
  display: block;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #64748b;
  margin-top: 2px;
}

.sidebar-group-label {
  padding: 16px 20px 8px;
  font-size: 10px;
  letter-spacing: 1px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-group-label svg { width: 13px; height: 13px; color: #475569; }

.sidebar-nav {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  border: 0;
  background: transparent;
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}
.nav-item svg { color: #64748b; width: 17px; height: 17px; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item:hover svg { color: #94a3b8; }

.nav-item.nav-active {
  background: var(--sidebar-active-bg);
  color: #ffffff;
  font-weight: 600;
}
.nav-item.nav-active svg { color: var(--sidebar-accent); }
.nav-item > span:nth-child(2) { flex: 1; }

.nav-counter {
  display: grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  background: #1e293b;
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 600;
}

.sidebar-spacer { flex: 1; min-height: 20px; }

.sidebar-bottom {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-workspace-pill {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-workspace-pill:hover { background: rgba(255, 255, 255, 0.08); }
.workspace-monogram {
  width: 28px;
  height: 28px;
  background: #ffffff;
  color: #0f172a;
  display: grid;
  place-items: center;
  font-weight: 800;
  border-radius: 6px;
  font-size: 13px;
}
.workspace-label {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.workspace-label strong { font-size: 12px; font-weight: 600; color: #ffffff; }
.workspace-label small { color: #64748b; font-size: 10px; }
.sidebar-workspace-pill > svg { color: #64748b; }

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 50;
}
.mobile-overlay.active { display: block; }

.sidebar-close, .mobile-menu { display: none; }

/* Topbar */
.main-column { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.topbar {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 460px;
}
.topbar-search {
  height: 38px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  color: var(--text-muted);
  background: #f8fafc;
  transition: all 0.15s;
}
.topbar-search:focus-within {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}
.topbar-search input {
  flex: 1;
  width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
}
.topbar-search input::placeholder { color: #94a3b8; }
.topbar-search kbd {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 5px;
  white-space: nowrap;
}

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.notifications-wrap { position: relative; }
.notification-button {
  border: 0;
  background: transparent;
  color: #64748b;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.15s;
}
.notification-button:hover { background: #f1f5f9; color: var(--text-primary); }
.notification-button i {
  width: 7px;
  height: 7px;
  background: #ef4444;
  border: 2px solid #ffffff;
  position: absolute;
  right: 8px;
  top: 7px;
  border-radius: 50%;
}
.notification-popover {
  position: absolute;
  top: 46px;
  right: -20px;
  width: 300px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.15);
  padding: 16px;
  z-index: 45;
}
.popover-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.popover-title button { background: none; border: 0; color: #64748b; }
.notification-popover p { line-height: 1.5; font-size: 11.5px; color: #64748b; margin: 12px 0; }
.notification-popover p strong { color: var(--text-primary); font-weight: 700; }
.popover-link {
  padding: 0; background: none; border: 0; color: #059669;
  display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 11px;
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 4px;
  border-radius: var(--radius-md);
  text-align: left;
}
.header-avatar {
  width: 32px;
  height: 32px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.user-profile-info strong { display: block; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-profile-info small { display: block; font-size: 10px; color: var(--text-muted); }

/* Main Content Area */
.content {
  flex: 1;
  max-width: 1560px;
  width: 100%;
  padding: 24px 32px 60px;
  margin: 0 auto;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.breadcrumbs strong { color: var(--text-secondary); font-weight: 600; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-heading h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.7px;
  margin: 0;
  color: var(--text-primary);
}
.page-heading p { font-size: 12.5px; margin: 4px 0 0; color: var(--text-secondary); }
.heading-actions { display: flex; gap: 10px; align-items: center; }

.button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.15s ease;
  text-decoration: none;
}
.button-dark {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
}
.button-dark:hover { background: #1e293b; border-color: #1e293b; }
.button-outline {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.button-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

/* Metrics Row (4 Cards with Sparklines) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
}
.metric-left { flex: 1; }
.metric-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.metric-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.metric-icon-box.green { background: #ecfdf5; color: #10b981; }
.metric-icon-box.blue { background: #eff6ff; color: #3b82f6; }
.metric-icon-box.purple { background: #f5f3ff; color: #8b5cf6; }
.metric-icon-box.orange { background: #fff7ed; color: #f97316; }

.metric-header span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}
.metric-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 8px;
}
.metric-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}
.metric-trend.up { color: #16a34a; }
.metric-trend.down { color: #dc2626; }
.metric-trend small { color: var(--text-muted); font-weight: 400; margin-left: 3px; }

.metric-sparkline {
  width: 80px;
  height: 38px;
  flex: none;
}
.metric-sparkline svg { width: 100%; height: 100%; overflow: visible; }

/* Two-column layout: Table Area + Customer Insights Widget */
.layout-columns {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
  align-items: start;
}
.layout-single {
  display: block;
}

/* Card Surface */
.surface {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
}

/* Table Toolbar with Filters */
.table-surface { overflow: hidden; }
.table-toolbar-tabs {
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-tabs-row {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 52px;
}
.tab-btn {
  height: 100%;
  position: relative;
  background: transparent;
  border: 0;
  padding: 0 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--text-primary);
  font-weight: 700;
}
.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: #10b981;
}
.tab-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 600;
}
.tab-btn.active .tab-badge {
  background: #dcfce7;
  color: #15803d;
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.table-search-input {
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 10px 0 30px;
  font-size: 11.5px;
  color: var(--text-primary);
  background: #ffffff;
  position: relative;
  outline: 0;
  width: 170px;
}
.table-search-input:focus { border-color: #94a3b8; }
.table-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.table-search-wrap svg {
  position: absolute;
  left: 9px;
  color: #94a3b8;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.table-btn-control {
  height: 32px;
  padding: 0 10px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}
.table-btn-control:hover { background: #f8fafc; }
.table-btn-control select {
  border: 0;
  background: transparent;
  outline: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* Data Table */
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  white-space: nowrap;
}
.data-table thead {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  height: 38px;
  padding: 0 14px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; width: 34px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table td {
  height: 56px;
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  font-size: 12px;
}
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: #f8fafc; }

.customer-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}
.avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.avatar-0 { background: #fed7aa; color: #9a3412; }
.avatar-1 { background: #fecdd3; color: #9f1239; }
.avatar-2 { background: #e0e7ff; color: #3730a3; }
.avatar-3 { background: #bae6fd; color: #075985; }
.avatar-4 { background: #fef08a; color: #854d0e; }
.avatar-5 { background: #dcfce7; color: #166534; }

.customer-cell strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.customer-cell small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.cell-id { color: #64748b; font-weight: 500; font-size: 11.5px; }
.location-cell { display: flex; align-items: center; gap: 7px; color: #334155; font-size: 12px; }
.flag-icon { font-size: 14px; line-height: 1; }

.cell-amount { font-weight: 700; color: var(--text-primary); font-size: 12px; }

/* Segment Pills */
.segment-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.segment-pill.VIP { background: #f3e8ff; color: #7e22ce; }
.segment-pill.Returning { background: #e0f2fe; color: #0369a1; }
.segment-pill.New { background: #dcfce7; color: #15803d; }

/* Status Badges */
.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-pill.Active { background: #dcfce7; color: #15803d; }
.status-pill.Inactive { background: #f1f5f9; color: #64748b; }

.cell-date { color: #64748b; font-size: 11.5px; }

.btn-actions-more {
  border: 0;
  background: transparent;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.btn-actions-more:hover { background: #f1f5f9; color: var(--text-primary); }

/* Pagination */
.pagination {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  font-size: 11.5px;
}
.pagination select {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  margin-left: 6px;
}
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.pagination-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #64748b;
}
.pagination-controls button:not(:disabled):hover { background: #f8fafc; color: var(--text-primary); }

/* Right Sidebar: Customer Insights Widget */
.insights-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02);
}
.insights-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.insights-head h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.insights-period {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  border: 1px solid var(--border-color);
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.insights-section { margin-bottom: 24px; }
.insights-subhead {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.location-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 11.5px;
}
.loc-name {
  width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}
.loc-track {
  flex: 1;
  height: 6px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
}
.loc-fill {
  height: 100%;
  border-radius: 10px;
}
.loc-fill.bar-0 { background: #334155; }
.loc-fill.bar-1 { background: #10b981; }
.loc-fill.bar-2 { background: #34d399; }
.loc-fill.bar-3 { background: #64748b; }
.loc-count {
  width: 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-primary);
}

/* Donut Chart */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
}
.donut-svg-box {
  width: 96px;
  height: 96px;
  position: relative;
  flex: none;
}
.donut-svg-box svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-center strong { font-size: 17px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.donut-center small { font-size: 9.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; margin-top: 2px; }

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}
.legend-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.vip { background: #a855f7; }
.legend-dot.returning { background: #3b82f6; }
.legend-dot.new { background: #10b981; }
.legend-val { font-weight: 600; color: #1e293b; }

/* Growth Banner at Bottom of Insights */
.growth-banner {
  background: #fffbeb;
  border: 1px solid #fef08a;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.growth-icon {
  font-size: 20px;
  flex: none;
}
.growth-text { flex: 1; min-width: 0; }
.growth-text strong {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #92400e;
}
.growth-text p {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: #b45309;
}
.growth-arrow { color: #d97706; }

/* Drawer & Modals */
.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(2px); z-index: 60;
}
.detail-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(500px, 100vw);
  background: #ffffff; z-index: 70; display: flex; flex-direction: column;
  box-shadow: -15px 0 45px rgba(15, 23, 42, 0.15); animation: drawer-slide 0.2s ease-out;
}
@keyframes drawer-slide { from { transform: translateX(40px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }

.drawer-top {
  height: 64px; flex: none; border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.drawer-top h2 { font-size: 15px; font-weight: 700; margin: 0; }
.drawer-scroll { overflow-y: auto; flex: 1; padding: 20px 24px; }
.profile-intro { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.profile-intro h3 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text-primary); }
.profile-intro p { font-size: 11.5px; color: var(--text-muted); margin: 3px 0 6px; }

.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #f8fafc; border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 12px; margin-bottom: 20px; text-align: center;
}
.profile-stats small { display: block; font-size: 9.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.profile-stats strong { display: block; font-size: 13px; color: var(--text-primary); font-weight: 700; margin-top: 4px; }

.drawer-tabs {
  display: flex; gap: 18px; border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
}
.drawer-tabs button {
  padding: 8px 0; border: 0; background: transparent; color: var(--text-secondary);
  font-size: 12px; font-weight: 600; position: relative;
}
.drawer-tabs button.active { color: var(--text-primary); font-weight: 700; }
.drawer-tabs button.active::after {
  content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: #10b981;
}

.detail-group { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #f1f5f9; }
.detail-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.detail-group-head h4 { font-size: 12px; font-weight: 700; margin: 0; color: var(--text-secondary); }
.detail-group-head button { border: 0; background: none; color: #64748b; }
.info-row { display: flex; justify-content: space-between; font-size: 12px; margin: 6px 0; }
.info-row span { color: var(--text-muted); }
.info-row strong { font-weight: 600; color: var(--text-primary); }

.drawer-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-color); background: #ffffff; flex: none;
}
.drawer-footer .button { width: 100%; height: 38px; }

/* Modal */
.modal-card {
  width: min(480px, 95vw); background: #ffffff; border-radius: var(--radius-lg);
  padding: 24px; box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.modal-head h2 { font-size: 17px; font-weight: 800; margin: 0; }
.modal-head p { font-size: 12px; color: var(--text-muted); margin: 4px 0 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.field-wide { grid-column: span 2; }
.field-grid input, .field-grid select, .field-grid textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  outline: 0; font-size: 12px; background: #ffffff;
}
.field-grid textarea { height: 70px; padding: 8px; }
.field-grid input:focus, .field-grid select:focus, .field-grid textarea:focus { border-color: #0f172a; }
.modal-footer {
  border-top: 1px solid var(--border-color); margin-top: 20px; padding-top: 16px;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 90;
  background: #0f172a; color: #ffffff; border-radius: var(--radius-md);
  padding: 12px 16px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
}
.toast svg { color: #10b981; }
.toast button { border: 0; background: none; color: #94a3b8; margin-left: 6px; }

/* Cute Virtual Credit Card & BIN Component */
.virtual-card-widget {
  background: linear-gradient(135deg, #182234 0%, #0a101d 100%);
  border-radius: 16px;
  color: #ffffff;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px -8px rgba(10, 15, 29, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  margin-bottom: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.virtual-card-widget:hover {
  box-shadow: 0 20px 42px -8px rgba(10, 15, 29, 0.8), inset 0 1px 1px rgba(255, 255, 255, 0.22);
}
.virtual-card-widget::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.28) 0%, transparent 70%);
  pointer-events: none;
}
.virtual-card-widget::after {
  content: "";
  position: absolute;
  bottom: -50px;
  left: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, transparent 70%);
  pointer-events: none;
}

.vcard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.vcard-bank-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vcard-chip-container {
  display: flex;
  align-items: center;
  gap: 6px;
}
.vcard-chip {
  width: 38px;
  height: 27px;
  background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  border-radius: 5px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5), 0 2px 4px rgba(0,0,0,0.3);
  position: relative;
}
.vcard-chip::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(0,0,0,0.25);
  border-radius: 2px;
}
.vcard-contactless {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.65);
}
.vcard-bank-title-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vcard-bank-fullname {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f8fafc;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vcard-flag {
  font-size: 14px;
  line-height: 1;
}
.vcard-bin-tag {
  font-size: 9.5px;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Card Brand Slot */
.vcard-brand-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.vcard-mc-wrap {
  display: flex;
  align-items: center;
  position: relative;
  width: 42px;
  height: 26px;
}
.mc-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  position: absolute;
}
.mc-dot.red {
  background: #eb001b;
  left: 0;
  z-index: 1;
}
.mc-dot.orange {
  background: #f79e1b;
  right: 0;
  opacity: 0.95;
  mix-blend-mode: hard-light;
}
.vcard-visa-logo {
  font-size: 20px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.5px;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.vcard-amex-logo {
  background: #007bc1;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.vcard-brand-txt {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
}

/* Card Number Surface: Full 16-Digit Monospace Display */
.vcard-number-surface {
  background: rgba(10, 16, 29, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.vcard-digits-display {
  font-family: 'Space Mono', 'Consolas', 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #f8fafc;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  user-select: all;
  display: flex;
  align-items: center;
  gap: 12px;
}
.vcard-group {
  display: inline-block;
}
.vcard-copy-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vcard-copy-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

/* Card Bottom Metadata */
.vcard-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}
.vcard-holder {
  display: flex;
  flex-direction: column;
}
.vcard-holder small,
.vcard-meta-item small {
  font-size: 8.5px;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.8px;
  font-weight: 700;
}
.vcard-holder strong {
  font-size: 12.5px;
  color: #ffffff;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 3px;
  letter-spacing: 0.6px;
  white-space: nowrap;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vcard-meta-right {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}
.vcard-meta-item {
  text-align: right;
}
.vcard-meta-item strong {
  font-size: 12.5px;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 1px;
  display: block;
  margin-top: 2px;
}

/* BIN Table Badges */
.bin-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.bin-badge {
  background: #0f172a;
  color: #38bdf8;
  font-family: monospace;
  font-weight: 700;
  font-size: 11px;
  padding: 2.5px 7px;
  border-radius: 5px;
  letter-spacing: 0.5px;
  border: 1px solid #1e293b;
}
.card-brand-tag {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-expiry-pill {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}
.card-cvv-pill {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  letter-spacing: 0.5px;
}
.table-card-full {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 8px;
}
.table-card-mono {
  font-family: 'Space Mono', 'Consolas', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  color: #0f172a;
}
.table-btn-copy {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.table-btn-copy:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.table-btn-copy svg {
  width: 13px;
  height: 13px;
}

/* Modal Form Grid Helpers */
.field-row-3 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.field-row-2 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.input-with-lookup {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bin-lookup-status {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}


/* Analytics View Cards & Charts */
.analytics-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.chart-box-surface {
  padding: 20px;
}
.chart-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chart-box-head h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}
.bar-chart-flex {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 180px;
  padding-top: 10px;
  border-bottom: 1px solid var(--border-color);
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.bar-track {
  width: 100%;
  max-width: 38px;
  background: #10b981;
  border-radius: 6px 6px 0 0;
  transition: height 0.3s ease;
}
.bar-col span {
  font-size: 10.5px;
  color: #64748b;
  white-space: nowrap;
}

/* Responsive */
@media (max-width: 1280px) {
  .layout-columns { grid-template-columns: 1fr; }
  .insights-card { margin-top: 20px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform 0.25s ease; z-index: 55;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-close, .mobile-menu { display: grid; }
  .content { padding: 16px 16px 50px; }
  .topbar { padding: 0 16px; }
}
@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .table-toolbar-tabs { flex-direction: column; align-items: flex-start; height: auto; padding: 12px; }
  .filter-tabs-row { height: auto; flex-wrap: wrap; }
  .table-controls { width: 100%; justify-content: space-between; }
  .page-heading { flex-direction: column; align-items: flex-start; }
}
