/* ==========================================================================
   BrightVale Finance Design System — tokens, components, themes
   Premium banking theme (gold / deep violet). Light by default, genuine dark theme.
   Pages should use ONLY the documented classes/tokens below.
   ========================================================================== */

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

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* Light theme (default) */
  --bg: #FAF7F0;
  --bg-soft: #F4EFE3;
  --surface: #FFFFFF;
  --surface-2: #FBF8F1;
  --sidebar-bg: #FFFFFF;
  --border: #EAE3D3;
  --border-soft: #F3EEE2;
  --text: #1B1726;
  --text-2: #5B5668;
  --text-3: #9B94A6;
  --primary: #4C1D95;
  --primary-2: #6D28D9;
  --primary-soft: #F0EAFB;
  --primary-contrast: #FFFFFF;
  --accent: #F5B301;
  --gradient: linear-gradient(135deg, #4C1D95 0%, #6D28D9 55%, #8B5CF6 100%);
  --success: #3F6212;
  --success-soft: #EEF5E2;
  --warning: #B45309;
  --warning-soft: #FBF0DF;
  --danger: #DC2626;
  --danger-soft: #FCEBEB;
  --info: #6D28D9;
  --info-soft: #F0EAFB;
  --shadow-sm: 0 1px 2px rgba(27, 23, 38, .05);
  --shadow: 0 4px 16px rgba(27, 23, 38, .07);
  --shadow-lg: 0 12px 32px rgba(27, 23, 38, .12);
}

[data-theme='dark'] {
  --bg: #0F0E13;
  --bg-soft: #15131B;
  --surface: #1A1722;
  --surface-2: #211D2C;
  --sidebar-bg: #15131B;
  --border: #2C2838;
  --border-soft: #231F2E;
  --text: #F3F1F7;
  --text-2: #B3ADC0;
  --text-3: #6E6880;
  --primary: #A78BFA;
  --primary-2: #8B5CF6;
  --primary-soft: rgba(139, 92, 246, .18);
  --primary-contrast: #1B1726;
  --accent: #F5B301;
  --gradient: linear-gradient(135deg, #7C3AED 0%, #8B5CF6 55%, #A78BFA 100%);
  --success: #84CC16;
  --success-soft: rgba(132, 204, 22, .14);
  --warning: #F5B301;
  --warning-soft: rgba(245, 179, 1, .14);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --info: #A78BFA;
  --info-soft: rgba(167, 139, 250, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

:root {
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 68px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Sora', var(--font);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html, body {
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-2);
}

button {
  font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

::selection {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* --------------------------------------------------------------------------
   3. Layout — main content / page header / container
   -------------------------------------------------------------------------- */

.main-content {
  margin-left: var(--sidebar-w);
  padding: 28px;
  width: calc(100% - var(--sidebar-w));
  max-width: 1440px;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left .25s ease;
}

body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-w-collapsed);
  width: calc(100% - var(--sidebar-w-collapsed));
}

.main-content,
.main-content > *,
.card,
.page-header,
.table-footer,
.pagination {
  min-width: 0;
}

.page-header > div,
.card-header > div,
.card,
.table-footer > * {
  max-width: 100%;
}

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

.page-title {
  font-size: 26px;
  font-weight: 800;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 2px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------------------------
   4. App shell — sidebar / overlay / topbar
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width .25s ease, transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
  overflow: hidden;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: var(--shadow);
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  height: 42px;
  width: auto;
  display: block;
}

.brand-logo-dark {
  display: none;
}

html[data-theme='dark'] .brand-logo-light-img {
  display: none;
}

html[data-theme='dark'] .brand-logo-dark {
  display: block;
}

.sidebar .brand-logo {
  height: 34px;
  max-width: 180px;
  object-fit: contain;
}

.sidebar.collapsed .brand-logo {
  display: none;
}

.sidebar.collapsed .sidebar-brand::after {
  content: none;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}

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

.sidebar-nav::-webkit-scrollbar { width: 4px; }

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: 14px 12px 6px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  transition: background-color .2s ease, color .2s ease;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

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

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gradient);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

.nav-item .badge-dot {
  margin-left: auto;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  white-space: nowrap;
  overflow: hidden;
}

/* Collapsed (desktop) */
@media (min-width: 993px) {
  .sidebar.collapsed {
    width: var(--sidebar-w-collapsed);
  }

  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .nav-section-title,
  .sidebar.collapsed .nav-item .nav-label,
  .sidebar.collapsed .nav-item .nav-badge,
  .sidebar.collapsed .nav-item .badge-dot,
  .sidebar.collapsed .sidebar-footer .theme-label {
    display: none;
  }

  .sidebar.collapsed .sidebar-brand,
  .sidebar.collapsed .sidebar-footer {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
  }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 12, .55);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 500;
  height: var(--topbar-h);
  margin-left: var(--sidebar-w);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  transition: margin-left .25s ease;
}

body.sidebar-collapsed .topbar {
  margin-left: var(--sidebar-w-collapsed);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  position: relative;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: scale(.96);
}

.menu-toggle {
  display: none;
}

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .25s ease, box-shadow .25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* --------------------------------------------------------------------------
   6. Charts
   -------------------------------------------------------------------------- */

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-tabs {
  display: flex;
  gap: 6px;
}

.chart-tabs .tab {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s ease;
}

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

.chart-tabs .tab.active {
  background: var(--gradient);
  color: #fff;
}

/* --------------------------------------------------------------------------
   7. Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data-table thead th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-2);
  vertical-align: middle;
}

table.data-table tbody td:first-child {
  color: var(--text);
  font-weight: 500;
}

table.data-table tbody tr {
  transition: background-color .15s ease;
}

table.data-table tbody tr:hover {
  background: var(--surface-2);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 4px 0;
  font-size: 13px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   8. Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--text-2); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   9. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease, filter .2s ease;
}

.btn:active {
  transform: scale(.98);
}

.btn:disabled,
.btn.disabled {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .45);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

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

.btn-danger-soft:hover {
  filter: brightness(.97);
  color: var(--danger);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(1.08);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-lg {
  padding: 14px 26px;
  font-size: 15px;
  border-radius: 14px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.input-error,
.input.error {
  border-color: var(--danger);
}

.input-error:focus,
.input.error:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

/* Safety net: style bare form controls that have no class (legacy pages) */
input[type="text"]:not([class]),
input[type="number"]:not([class]),
input[type="email"]:not([class]),
input[type="password"]:not([class]),
input[type="tel"]:not([class]),
input[type="search"]:not([class]),
input[type="url"]:not([class]),
input[type="date"]:not([class]),
select:not([class]),
textarea:not([class]) {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .2s ease, box-shadow .2s ease;
}

input[type="text"]:not([class]):focus,
input[type="number"]:not([class]):focus,
input[type="email"]:not([class]):focus,
input[type="password"]:not([class]):focus,
input[type="tel"]:not([class]):focus,
input[type="search"]:not([class]):focus,
input[type="url"]:not([class]):focus,
input[type="date"]:not([class]):focus,
select:not([class]):focus,
textarea:not([class]):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="text"]:not([class])::placeholder,
input[type="number"]:not([class])::placeholder,
input[type="email"]:not([class])::placeholder,
input[type="password"]:not([class])::placeholder,
input[type="tel"]:not([class])::placeholder,
input[type="search"]:not([class])::placeholder,
textarea:not([class])::placeholder {
  color: var(--text-3);
}

.form-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 6px;
}

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

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%239BA1B3' d='M8 11L2 5h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.search-input {
  position: relative;
}

.search-input > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}

.search-input .input {
  padding-left: 40px;
}

/* Checkbox / radio defaults keep theme accent */
input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   11. Tabs, filter bar, chips
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s ease;
}

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

.tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.active {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}

/* --------------------------------------------------------------------------
   12. Modal
   -------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 12, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(.98);
  transition: transform .25s ease;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { width: 720px; }
.modal-sm { width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 0;
}

.modal-header .modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .2s ease, color .2s ease;
}

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

.modal-body {
  padding: 18px 24px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   13. Toast
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  animation: toastIn .3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.success > span:first-child { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error > span:first-child { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning > span:first-child { color: var(--warning); }
.toast.info { border-left-color: var(--info); }
.toast.info > span:first-child { color: var(--info); }

.toast > span:first-child {
  font-weight: 700;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   14. Dropdown
   -------------------------------------------------------------------------- */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 1500;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

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

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-soft);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 6px 4px;
}

.dropdown-header {
  padding: 10px 12px 6px;
}

/* --------------------------------------------------------------------------
   15. Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}

.page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.pagination > span {
  color: var(--text-3);
  padding: 0 2px;
}

/* --------------------------------------------------------------------------
   16. Avatar
   -------------------------------------------------------------------------- */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  letter-spacing: .02em;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }

/* Larger profile circle in the topbar */
.topbar-actions .avatar { width: 44px; height: 44px; font-size: 15px; }

/* --------------------------------------------------------------------------
   17. Utilities
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

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

.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

.text-muted { color: var(--text-3); }
.text-small { font-size: 13px; }

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.divider {
  height: 1px;
  background: var(--border-soft);
  border: none;
  margin: 16px 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 6px;
}

.empty-state .empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-2);
}

.empty-state .empty-hint {
  font-size: 13px;
  max-width: 340px;
}

/* Skeleton & spinner */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  min-height: 14px;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 75%, transparent), transparent);
  animation: shimmer 1.5s infinite;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  width: 100%;
  animation: ccFadeIn .35s ease;
}

/* Page + content fade-in: no blank flashes, content gently fades in */
@keyframes ccFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
body { animation: ccFadeIn .3s ease; }
.main-content { animation: ccFadeIn .35s ease; }
.card, .stat-card { content-visibility: auto; }

/* --------------------------------------------------------------------------
   18. Marketplace / art
   -------------------------------------------------------------------------- */

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
}

.art-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}

.art-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.art-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.art-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.art-card:hover .art-thumb img {
  transform: scale(1.05);
}

.art-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.art-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-artist {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.art-artist .artist-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.art-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.art-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.art-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

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

.art-badge.featured {
  background: var(--gradient);
  color: #fff;
}

.favorite-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all .2s ease;
}

.favorite-btn:hover {
  color: var(--danger);
  transform: scale(1.1);
}

.favorite-btn.active {
  color: var(--danger);
}

.favorite-btn.active i {
  font-weight: 900;
}

/* Artwork detail */
.art-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: start;
}

.art-preview {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.art-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.artist-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.artist-strip .artist-info {
  flex: 1;
  min-width: 180px;
}

.artist-strip .artist-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.artist-strip .artist-username {
  font-size: 13px;
  color: var(--text-3);
}

.artist-strip .artist-bio {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artist-strip .artist-social {
  display: flex;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   19. Landing (theme-aware namespace)
   -------------------------------------------------------------------------- */

.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 18px 0;
  transition: background-color .25s ease, border-color .25s ease, padding .25s ease;
  border-bottom: 1px solid transparent;
}

.landing-nav.scrolled {
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border-soft);
  padding: 12px 0;
}

.landing-nav .container {
  display: flex;
  align-items: center;
  gap: 24px;
}

.landing-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.landing-nav .nav-links a {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  transition: color .2s ease;
}

.landing-nav .nav-links a:hover {
  color: var(--text);
}

.hero {
  padding: 160px 0 90px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.02em;
}

.hero-title .gradient-text,
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-2);
  margin: 18px 0 28px;
  max-width: 480px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-visual {
  position: relative;
}

.hero-visual .mockup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: float 6s ease-in-out infinite;
}

.float-chip {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: float 5s ease-in-out infinite;
}

.float-chip .stat-icon {
  width: 34px;
  height: 34px;
  font-size: 14px;
  border-radius: 10px;
}

.section {
  padding: 80px 0;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 12px;
}

.section-sub {
  font-size: 16px;
  color: var(--text-2);
  max-width: 560px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.feature-card .feature-title {
  font-size: 17px;
  font-weight: 700;
  margin: 16px 0 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-2);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.stats-strip .stat-number {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  color: #fff;
}

.stats-strip .stat-caption {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, .8);
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
}

.step-card .step-number {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-card .step-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 14px;
  color: var(--text-2);
}

.testimonial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.testimonial-card .testimonial-text {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 18px;
}

.testimonial-card .testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.testimonial-card .author-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.testimonial-card .author-role {
  font-size: 12px;
  color: var(--text-3);
}

.cta-band {
  background: var(--gradient);
  border-radius: var(--radius-lg);
  padding: 56px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.cta-band .cta-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.cta-band .cta-sub {
  color: rgba(255, 255, 255, .85);
  font-size: 16px;
  margin-bottom: 26px;
}

.footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border-soft);
  padding: 56px 0 0;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
}

.footer .footer-brand p {
  font-size: 14px;
  color: var(--text-2);
  margin-top: 14px;
  max-width: 280px;
}

.footer .footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  margin-bottom: 16px;
}

.footer .footer-col a {
  display: block;
  font-size: 14px;
  color: var(--text-3);
  padding: 5px 0;
  transition: color .2s ease;
}

.footer .footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  margin-top: 44px;
  border-top: 1px solid var(--border-soft);
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-3);
}

/* --------------------------------------------------------------------------
   20. Auth pages
   -------------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-visual {
  background: var(--gradient);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-visual::after {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  bottom: -160px;
  right: -160px;
}

.auth-visual .brand-mark {
  background: rgba(255, 255, 255, .18);
  box-shadow: none;
}

.auth-visual h2 {
  color: #fff;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  margin-bottom: 14px;
}

.auth-visual p {
  color: rgba(255, 255, 255, .85);
  font-size: 16px;
  max-width: 420px;
}

.auth-testimonial {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius);
  padding: 22px 24px;
  backdrop-filter: blur(8px);
  max-width: 420px;
}

.auth-testimonial p {
  font-size: 14px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 26px;
}

.auth-tabs .auth-tab {
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s ease;
}

.auth-tabs .auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   21. Animations & reveal
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .45s ease, transform .45s ease;
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.85); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* --------------------------------------------------------------------------
   22. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }

  .sidebar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content,
  body.sidebar-collapsed .main-content {
    margin-left: 0;
    width: auto;
  }

  .topbar,
  body.sidebar-collapsed .topbar {
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 120px;
  }

  .hero-visual {
    order: -1;
  }

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

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

@media (max-width: 768px) {
  .main-content {
    padding: 16px clamp(16px, 5vw, 24px);
  }

  .landing-page .container {
    padding-right: clamp(16px, 5vw, 24px);
    padding-left: clamp(16px, 5vw, 24px);
  }

  .topbar {
    width: 100%;
  }

  .topbar {
    padding: 0 16px;
    gap: 10px;
  }

  .topbar-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

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

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

  .art-hero {
    grid-template-columns: 1fr;
  }

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

  .card {
    padding: 16px;
  }

  .page-title {
    font-size: 22px;
  }

  .page-subtitle {
    overflow-wrap: anywhere;
  }

  .pagination,
  .table-footer {
    width: 100%;
  }

  .pagination {
    justify-content: center;
  }

  .table-footer {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 20px;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-title {
    min-width: 0;
    max-width: 38vw;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .icon-btn {
    width: 36px;
    height: 36px;
  }

  .topbar-actions .avatar {
    width: 36px;
    height: 36px;
  }

  .pagination {
    gap: 4px;
  }

  .page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
  }

  table.data-table {
    min-width: 640px;
  }

  .hero {
    padding: 110px 0 60px;
  }

  .stats-strip {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }

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

  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-footer .btn {
    width: 100%;
  }
}
