/* =============================================================================
   Fonts
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* =============================================================================
   Design tokens
   ========================================================================== */
:root {
  /* Brand ramp — #4f46e5 (existing brand primary) is --primary-600 */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-300: #a5b4fc;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #372f9e;
  --primary-900: #2d2777;

  --primary: var(--primary-600);
  --primary-dark: var(--primary-700);
  --primary-light: var(--primary-50);
  --primary-ring: rgba(79, 70, 229, 0.28);

  --success: #17c653;
  --success-dark: #0f9d43;
  --success-light: #e9fbf0;

  --danger: #e11d48;
  --danger-dark: #be123c;
  --danger-light: #fef1f4;

  --warning: #d97706;
  --warning-dark: #92400e;
  --warning-light: #fef6e7;

  --info: var(--primary-600);
  --info-dark: var(--primary-800);
  --info-light: var(--primary-50);

  /* Neutral scale — slight cool/indigo undertone rather than flat gray */
  --gray-25: #fbfbfe;
  --gray-50: #f6f6fb;
  --gray-100: #eef0f6;
  --gray-200: #e1e3ee;
  --gray-300: #c9cce0;
  --gray-400: #9a9fc0;
  --gray-500: #6c7093;
  --gray-600: #4c4f6f;
  --gray-700: #34364f;
  --gray-800: #202138;
  --gray-900: #131425;

  --border: var(--gray-200);
  --border-light: var(--gray-100);
  --bg: var(--gray-50);
  --card: #ffffff;
  --surface-alt: var(--gray-50);

  --text: var(--gray-900);
  --text-muted: var(--gray-500);
  --text-faint: var(--gray-400);

  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-xs: 0 1px 2px rgba(19, 20, 37, 0.05);
  --shadow-sm: 0 1px 2px rgba(19, 20, 37, 0.04), 0 2px 8px rgba(19, 20, 37, 0.05);
  --shadow-md: 0 6px 16px rgba(19, 20, 37, 0.08), 0 2px 4px rgba(19, 20, 37, 0.04);
  --shadow-lg: 0 20px 48px rgba(19, 20, 37, 0.16), 0 6px 16px rgba(19, 20, 37, 0.08);
  --shadow-focus: 0 0 0 4px var(--primary-ring);

  --sidebar-width: 272px;
  --topbar-height: 72px;
}

/* =============================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" 1;
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; color: var(--gray-900); }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 17px; line-height: 1.35; letter-spacing: -0.01em; }
h3 { font-size: 14.5px; }

a { color: var(--primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: 6px; }

img, svg { display: block; }

/* =============================================================================
   App shell — sidebar + topbar layout
   ========================================================================== */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  background: var(--card);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 22px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-brand .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(150deg, var(--primary-500), var(--primary-800));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3);
}
.sidebar-brand .name {
  font-weight: 800;
  font-size: 14.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.sidebar-brand .role-tag {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
}

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 10px;
  margin: 18px 0 8px;
}
.nav-section:first-child .nav-section-label { margin-top: 2px; }

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 13.8px;
  transition: background 0.15s ease, color 0.15s ease;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--gray-50); color: var(--text); text-decoration: none; }
.sidebar-link .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  color: var(--gray-400);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-link .nav-icon svg { width: 17px; height: 17px; }
.sidebar-link.active {
  background: var(--primary-50);
  color: var(--primary-800);
}
.sidebar-link.active .nav-icon { background: #fff; color: var(--primary-600); box-shadow: var(--shadow-xs); }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--primary-600);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-footer .sidebar-link { color: var(--text-muted); }
.sidebar-footer .sidebar-link:hover { background: var(--danger-light); color: var(--danger-dark); }
.sidebar-footer .sidebar-link:hover .nav-icon { color: var(--danger-dark); }

.main-wrap {
  margin-inline-start: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  background: rgba(251, 251, 254, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar .page-title { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: -0.01em; }
.topbar .page-eyebrow { font-size: 11.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.25; }
.user-chip .who .uname { font-weight: 700; font-size: 13px; color: var(--text); }
.user-chip .who .urole { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.user-chip .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--primary-400), var(--primary-700));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}
.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}
.logout-link span.label { display: none; }
.logout-link:hover { background: var(--danger-light); color: var(--danger-dark); border-color: #fbd4de; text-decoration: none; }
.logout-link svg { width: 16px; height: 16px; }

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 30, 0.5);
  backdrop-filter: blur(1px);
  z-index: 35;
}

/* =============================================================================
   Containers, cards
   ========================================================================== */
.container { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; min-width: 0; width: 100%; }
.container.narrow { max-width: 440px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-xs);
}
.card h2 { margin-top: 0; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.card-head h2 { margin-bottom: 4px; }
.card-subtext { color: var(--text-muted); font-size: 13.2px; margin: -2px 0 18px; max-width: 640px; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-main-side { grid-template-columns: 1.6fr 1fr; }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3, .grid.cols-main-side { grid-template-columns: 1fr; } }

/* Page header (greeting row) */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.page-header-row h1 { margin: 0 0 4px; }
.page-header-row .page-lede { color: var(--text-muted); font-size: 14px; margin: 0; }

/* =============================================================================
   Stat cards
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .stat-grid, .stat-grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid, .stat-grid.cols-3 { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-card .stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 19px; height: 19px; }
.stat-card .stat-icon.tone-primary { background: var(--primary-50); color: var(--primary-600); }
.stat-card .stat-icon.tone-success { background: var(--success-light); color: var(--success-dark); }
.stat-card .stat-icon.tone-warning { background: var(--warning-light); color: var(--warning-dark); }
.stat-card .stat-icon.tone-gray { background: var(--gray-100); color: var(--gray-500); }
.stat-card .stat-icon.tone-info { background: var(--primary-50); color: var(--primary-700); }
.stat-card .stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.stat-card .stat-value { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-card .stat-value.small { font-size: 19px; }
.stat-card .stat-sub { font-size: 12.5px; color: var(--text-faint); font-weight: 500; }

/* Compact usage tiles */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .tile-grid { grid-template-columns: 1fr; } }
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface-alt);
}
.tile .tile-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.tile .tile-label svg { width: 14px; height: 14px; }
.tile .tile-value { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

/* =============================================================================
   Quick action cards
   ========================================================================== */
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .action-grid { grid-template-columns: 1fr; } }
.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none !important;
}
.action-card:hover { border-color: var(--primary-200); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.action-card .ac-icon {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--primary-50); color: var(--primary-600);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.action-card .ac-icon svg { width: 20px; height: 20px; }
.action-card .ac-text { flex: 1; min-width: 0; }
.action-card .ac-title { font-weight: 700; font-size: 14px; color: var(--text); }
.action-card .ac-desc { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }
.action-card .ac-arrow { color: var(--text-faint); flex-shrink: 0; }
.action-card .ac-arrow svg { width: 16px; height: 16px; }

/* =============================================================================
   Forms
   ========================================================================== */
label { display: block; font-weight: 700; font-size: 12.8px; margin-bottom: 7px; margin-top: 16px; color: var(--gray-700); }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, textarea:hover, select:hover { border-color: var(--gray-300); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: var(--shadow-focus);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; }

.help-text { color: var(--text-faint); font-size: 12px; margin-top: 6px; }

.checkbox-row { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.checkbox-row input { width: auto; accent-color: var(--primary); }
.checkbox-row label { margin: 0; font-weight: 600; }

.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 140px; }
.form-row label { margin-top: 0; }

/* =============================================================================
   Buttons
   ========================================================================== */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary-600);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.8px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 18px;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.15);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  line-height: 1.3;
}
button:hover, .btn:hover { background: var(--primary-700); text-decoration: none; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }

.btn.secondary { background: #fff; color: var(--gray-700); border: 1.5px solid var(--border); box-shadow: none; }
.btn.secondary:hover { background: var(--gray-50); box-shadow: none; border-color: var(--gray-300); }
.btn.danger { background: var(--danger); box-shadow: 0 1px 2px rgba(225,29,72,.2); }
.btn.danger:hover { background: var(--danger-dark); box-shadow: 0 4px 10px rgba(225,29,72,.3); }

.btn.small, button.small, .small { padding: 7px 13px; font-size: 12.8px; margin-top: 0; border-radius: var(--radius-sm); }

/* =============================================================================
   Tables
   ========================================================================== */
.table-scroll { overflow-x: auto; margin: 0 -2px; }
.table-scroll table { min-width: 640px; }

table { width: 100%; border-collapse: collapse; font-size: 13.6px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-light); }
th {
  color: var(--text-faint);
  font-weight: 700;
  font-size: 10.8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-alt);
}
th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--surface-alt); }
tr:last-child td { border-bottom: none; }

.row-avatar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.mini-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-50); color: var(--primary-700);
  font-size: 11px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* =============================================================================
   Badges, alerts
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.green { background: var(--success-light); color: var(--success-dark); }
.pill.red { background: var(--danger-light); color: var(--danger-dark); }
.pill.yellow { background: var(--warning-light); color: var(--warning-dark); }
.pill.gray { background: var(--gray-100); color: var(--gray-600); }
.pill.blue { background: var(--primary-light); color: var(--primary-800); }

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13.8px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.alert::before {
  content: "";
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-position: center; mask-position: center;
}
.alert.error { background: var(--danger-light); color: var(--danger-dark); border-color: #fbd4de; }
.alert.error::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
}
.alert.success { background: var(--success-light); color: var(--success-dark); border-color: #bdf0d1; }
.alert.success::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
}
.alert.info { background: var(--primary-light); color: var(--primary-800); border-color: var(--primary-200); }
.alert.info::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
}
.alert.warning { background: var(--warning-light); color: var(--warning-dark); border-color: #f8dfa6; }
.alert.warning::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

.muted { color: var(--text-muted); font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 12.6px; }
code { background: var(--gray-100); padding: 2px 6px; border-radius: 5px; font-size: 12.6px; font-family: var(--font-mono); }

/* =============================================================================
   Segmented control (filters)
   ========================================================================== */
.segmented {
  display: inline-flex;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 10px;
  gap: 2px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.segmented a {
  padding: 7px 15px;
  border-radius: 7px;
  font-size: 12.8px;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none !important;
}
.segmented a:hover { color: var(--text); }
.segmented a.active { background: #fff; color: var(--gray-900); box-shadow: var(--shadow-xs); }

/* =============================================================================
   Empty states
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 52px 24px;
}
.empty-state .icon-circle {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gray-50); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; color: var(--text-faint);
}
.empty-state .icon-circle svg { width: 24px; height: 24px; }
.empty-state h3 { margin: 0 0 6px; font-size: 15px; }
.empty-state p { color: var(--text-muted); font-size: 13.4px; max-width: 360px; margin: 0 auto; }
.empty-state .btn { margin-top: 18px; }

/* =============================================================================
   Misc components
   ========================================================================== */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 20px; }
.pagination a, .pagination strong {
  min-width: 32px; text-align: center; padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 12.6px; font-weight: 700;
}
.pagination a { color: var(--text-muted); }
.pagination a:hover { background: var(--surface-alt); text-decoration: none; }
.pagination strong { background: var(--primary-600); color: #fff; }

.pricing-group-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  background: var(--surface-alt);
}
.pricing-group-card .pgc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.pricing-group-card .pgc-actions { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.pricing-group-card input[type=number] { width: 140px; }

.deposit-address-box {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--gray-900);
  color: #d7f9df;
  border: 1px solid var(--gray-800);
  padding: 15px 17px;
  border-radius: var(--radius-sm);
  word-break: break-all;
}

.result-box { margin-top: 22px; padding: 18px; background: var(--surface-alt); border-radius: var(--radius); border: 1px solid var(--border); }
.result-box pre { background: #fff; padding: 12px; border-radius: 8px; border: 1px solid var(--border); overflow-wrap: anywhere; white-space: pre-wrap; margin: 8px 0; font-family: var(--font-mono); font-size: 12.6px; }

/* =============================================================================
   Deposit "invoice" flow (customer/deposit.php) — amount presets, the live
   waiting/polling panel, and the payment-confirmed receipt.
   ========================================================================== */
.amount-preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.amount-preset-btn.is-selected { background: var(--primary-600); color: #fff; border-color: var(--primary-600); box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25); }

.invoice-amount-row { margin-top: 6px; }
.invoice-amount-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 22px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--primary-50), #fff);
  border: 1.5px solid var(--primary-200);
  text-align: center;
}
.invoice-amount-label { font-size: 12.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.invoice-amount-value { font-size: 34px; font-weight: 800; color: var(--primary-800); font-variant-numeric: tabular-nums; line-height: 1.2; }
.invoice-amount-hint { font-size: 12.5px; color: var(--gray-500); }

.invoice-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.4px;
  color: var(--gray-700);
}
.invoice-spinner {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2.5px solid var(--primary-200);
  border-top-color: var(--primary-600);
  border-radius: 50%;
  animation: invoice-spin .8s linear infinite;
}
@keyframes invoice-spin { to { transform: rotate(360deg); } }

.invoice-success-panel { text-align: center; padding: 8px 0 4px; }
.invoice-success-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--success-light); color: var(--success-dark);
  margin-bottom: 12px;
  animation: invoice-pop .35s ease-out;
}
.invoice-success-check svg { width: 28px; height: 28px; }
@keyframes invoice-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.invoice-success-panel h3 { margin: 0 0 4px; font-size: 19px; }
.invoice-receipt {
  margin: 18px auto 0; max-width: 360px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.invoice-receipt > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; font-size: 13.2px; }
.invoice-receipt > div:not(:last-child) { border-bottom: 1px solid var(--border-light); }
.invoice-receipt > div span { color: var(--text-muted); }
.invoice-receipt > div strong { text-align: right; overflow-wrap: anywhere; }

.section-divider { border: none; border-top: 1px solid var(--border-light); margin: 22px 0; }

/* =============================================================================
   Auth pages
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 460px at 12% -8%, var(--primary-100), transparent 60%),
    radial-gradient(700px 380px at 100% 100%, var(--primary-50), transparent 55%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 408px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 34px 32px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(150deg, var(--primary-500), var(--primary-800));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}
.auth-card h2 { font-size: 20px; margin-bottom: 4px; }
.auth-card .auth-subtitle { color: var(--text-muted); font-size: 13.5px; margin-bottom: 6px; font-weight: 500; }
.auth-footer-note { margin-top: 20px; text-align: center; font-size: 13px; }

/* =============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .main-wrap { margin-inline-start: 0; }
  .menu-toggle { display: inline-flex; }
  .container { padding: 22px 18px 44px; }
  .topbar { padding: 0 16px; }
  .user-chip .who { display: none; }
}

@media (max-width: 480px) {
  .card { padding: 20px; }
  .stat-card .stat-value { font-size: 23px; }
  .topbar .page-title { font-size: 15.5px; }
}
