/* ============================================================
   ERP Lite — design tokens
   ============================================================ */
:root {
  --brand: #E07A5F;
  --brand-600: #D26A4F;
  --brand-700: #B85A40;
  --brand-soft: #FBE9E2;
  --brand-softer: #FDF4F0;
  --accent: #F2CC8F;
  --accent-soft: #FBEFD6;
  --ink: #3D405B;
  --ink-2: #4A4D69;

  --success: #4CAE7A;
  --success-soft: #E4F3EA;
  --warning: #E0A23B;
  --warning-soft: #FBEED4;
  --danger: #D95C5C;
  --danger-soft: #FBE3E3;
  --info: #5A88C0;
  --info-soft: #E4ECF6;

  /* light theme (default) */
  --bg: #FAF8F5;
  --surface: #FFFFFF;
  --surface-2: #F4F1EC;
  --surface-3: #ECE7DE;
  --border: #E7E1D6;
  --border-strong: #D6CFC0;
  --text: #1F2128;
  --text-2: #5E6271;
  --text-3: #8E92A1;
  --shadow-sm: 0 1px 2px rgba(31,33,40,.04), 0 0 0 1px rgba(31,33,40,.04);
  --shadow-md: 0 6px 24px -8px rgba(31,33,40,.12), 0 2px 6px rgba(31,33,40,.04);
  --shadow-lg: 0 24px 60px -20px rgba(31,33,40,.25), 0 8px 20px -8px rgba(31,33,40,.08);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-full: 999px;
}

[data-theme="dark"] {
  --bg: #14151B;
  --surface: #1B1D26;
  --surface-2: #232633;
  --surface-3: #2C3041;
  --border: #2B2E3D;
  --border-strong: #3B3F52;
  --text: #ECEEF4;
  --text-2: #A4A8B5;
  --text-3: #6B6F7E;
  --brand: #E88A72;
  --brand-600: #D97A60;
  --brand-soft: #3A2620;
  --brand-softer: #271A17;
  --accent-soft: #2E2920;
  --success-soft: #1E2D24;
  --warning-soft: #2E261A;
  --danger-soft: #2E1F1F;
  --info-soft: #1E2530;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--brand-soft); color: var(--brand-700); }
[data-theme="dark"] ::selection { color: var(--text); }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .22s cubic-bezier(.32,.72,0,1);
}
.app-shell.collapsed { grid-template-columns: 72px 1fr; }
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-content {
  flex: 1;
  padding: 24px 32px 64px;
  min-width: 0;
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-content { padding: 16px 16px 80px; }
}

/* ============================================================
   Sidebar (style 2: white sidebar with soft highlight pill)
   ============================================================ */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .22s cubic-bezier(.32,.72,0,1);
}
.sidebar-collapse-btn {
  position: absolute;
  top: 18px; right: -12px;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transition: opacity .15s, background .12s, color .12s, transform .22s cubic-bezier(.32,.72,0,1);
  box-shadow: var(--shadow-sm);
}
.sidebar:hover .sidebar-collapse-btn, .sidebar.collapsed .sidebar-collapse-btn { opacity: 1; }
.sidebar-collapse-btn:hover { background: var(--surface-2); color: var(--text); }
.sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }

/* Collapsed state — icon-rail */
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand-text { display: none; }
.sidebar.collapsed .sidebar-head { padding: 18px 0 14px; justify-content: center; }
.sidebar.collapsed .sidebar-section { display: none; }
.sidebar.collapsed .sidebar-nav { padding: 16px 10px; align-items: center; }
.sidebar.collapsed .nav-item {
  width: 44px; height: 44px;
  padding: 0;
  justify-content: center;
  position: relative;
}
.sidebar.collapsed .nav-item > span:not(.nav-icon):not(.nav-badge) { display: none; }
.sidebar.collapsed .nav-item .nav-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  font-size: 9.5px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
}
.sidebar.collapsed .sidebar-foot { padding: 10px; justify-content: center; }
.sidebar.collapsed .sidebar-foot .me-info,
.sidebar.collapsed .sidebar-foot > button:last-child { display: none; }

/* Hover tooltip for collapsed nav */
.sidebar.collapsed .nav-item::before {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
  background: var(--ink);
  color: white;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s, transform .12s;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.sidebar.collapsed .nav-item:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.sidebar-head {
  padding: 18px 16px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-size: 16px;
}
.sidebar-brand-mark {
  width: 32px; height: 32px;
  display: block;
}
.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 1px;
}
.sidebar-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.sidebar-nav {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--text-3);
}
.nav-item:hover .nav-icon { color: var(--text-2); }
.nav-item.active {
  background: var(--brand-soft);
  color: var(--brand-700);
  font-weight: 600;
}
[data-theme="dark"] .nav-item.active { color: var(--brand); }
.nav-item.active .nav-icon { color: var(--brand); }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.nav-item.active .nav-badge { background: var(--brand); color: white; }

.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-foot .me-info { flex: 1; min-width: 0; }
.sidebar-foot .me-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .me-role { font-size: 11px; color: var(--text-3); }

/* mobile drawer */
.sidebar-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,15,20,.5);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sidebar-mobile-backdrop.open { opacity: 1; pointer-events: auto; }
.sidebar.mobile {
  position: fixed;
  z-index: 71;
  width: 280px;
  transform: translateX(-100%);
  transition: transform .25s cubic-bezier(.32,.72,0,1);
  box-shadow: var(--shadow-lg);
}
.sidebar.mobile.open { transform: translateX(0); }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.topbar-spacer { flex: 1; }
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px 0 36px;
  outline: none;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.topbar-search input:focus { background: var(--surface); border-color: var(--brand); }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-3);
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
  content: '';
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px;
  background: var(--brand);
  border-radius: 50%;
  border: 2px solid var(--surface);
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-search { display: none; }
}

/* ============================================================
   Buttons + inputs
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }

.btn.primary { background: var(--brand); color: white; }
.btn.primary:hover:not(:disabled) { background: var(--brand-600); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: white; }
.btn.danger:hover:not(:disabled) { background: #C44E4E; }
.btn.dark { background: var(--ink); color: white; }
.btn.dark:hover:not(:disabled) { background: var(--ink-2); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger); display: flex; align-items: center; gap: 6px; }
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 12px;
  outline: none;
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input.error { border-color: var(--danger); }
.input.error:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input-with-icon { position: relative; }
.input-with-icon .input { padding-left: 38px; }
.input-with-icon .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3);
}
.input-with-icon .input-suffix-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-3); padding: 4px;
}
.input-with-icon .input-suffix-btn:hover { color: var(--text); }

/* checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  transition: background .12s, border-color .12s;
}
.check input:checked + .box { background: var(--brand); border-color: var(--brand); }
.check input:checked + .box svg { display: block; }
.check .box svg { display: none; }

/* ============================================================
   Cards, tables, badges
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.card-pad { padding: 20px; }
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .head-sub { font-size: 12px; color: var(--text-3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.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.brand { background: var(--brand-soft); color: var(--brand-700); }
[data-theme="dark"] .badge.brand { color: var(--brand); }
.badge.ghost { background: var(--surface-2); color: var(--text-2); }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-scroll { overflow-x: auto; }
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.t th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.t td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.t tr:last-child td { border-bottom: none; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr:hover { background: var(--surface-2); cursor: pointer; }
table.t .num { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
table.t .cell-stack { display: flex; flex-direction: column; gap: 2px; }
table.t .cell-sub { font-size: 12px; color: var(--text-3); }
.cell-customer { display: flex; align-items: center; gap: 10px; }

.pagination {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-2);
}
.pagination .pages { display: flex; gap: 4px; margin-left: auto; }
.pagination .pg-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 12px; font-weight: 600;
  color: var(--text-2);
}
.pagination .pg-btn:hover { background: var(--surface-2); color: var(--text); }
.pagination .pg-btn.active { background: var(--brand); color: white; }
.pagination .pg-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  letter-spacing: -.01em;
  flex-shrink: 0;
  color: white;
  font-size: 12px;
  width: 32px; height: 32px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 84px; height: 84px; font-size: 26px; }

/* ============================================================
   KPI stat cards
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 980px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpi-row { grid-template-columns: 1fr; } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi-label { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.kpi-delta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi-spark { position: absolute; right: -8px; bottom: -8px; opacity: .35; }

/* ============================================================
   Page heading
   ============================================================ */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0;
}
.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}
.page-actions { display: flex; gap: 8px; align-items: center; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text-3); }

/* ============================================================
   Auth pages
   ============================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  background: var(--bg);
}
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } }

.auth-form-side {
  display: flex;
  flex-direction: column;
  padding: 28px 48px;
}
@media (max-width: 520px) { .auth-form-side { padding: 20px; } }
.auth-form-side .auth-head {
  display: flex; align-items: center; justify-content: space-between;
}
.auth-form-side .auth-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-form {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.auth-form h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.025em;
}
.auth-form .sub {
  margin-top: 6px;
  color: var(--text-3);
  font-size: 14px;
}
.auth-form .form-fields { display: flex; flex-direction: column; gap: 14px; }
.auth-form .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-form .link { color: var(--brand); font-weight: 600; font-size: 13px; }
.auth-form .link:hover { color: var(--brand-600); text-decoration: underline; }
.auth-form .divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.auth-form .divider::before, .auth-form .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.auth-form-side .auth-foot {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-poster-side {
  background:
    radial-gradient(circle at 15% 20%, rgba(242,204,143,.35) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(224,122,95,.35) 0%, transparent 55%),
    linear-gradient(140deg, #2A2C3E 0%, #3D405B 60%, #4E5078 100%);
  color: #F4F1EC;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
@media (max-width: 900px) { .auth-poster-side { display: none; } }
.auth-poster-side .poster-marks { position: absolute; inset: 0; pointer-events: none; opacity: .15; }
.auth-poster-mascot {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-poster-side h2 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 0;
  max-width: 480px;
}
.auth-poster-side h2 .em { color: var(--accent); }
.auth-poster-side .quote-card {
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(244,241,236,.9);
  max-width: 440px;
}
.auth-poster-side .quote-card .quote-by {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  font-size: 12px;
  color: rgba(244,241,236,.7);
}
.auth-poster-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 440px;
  margin-top: 32px;
}
.auth-poster-stats .stat {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 12px;
}
.auth-poster-stats .stat-v { font-size: 18px; font-weight: 800; }
.auth-poster-stats .stat-l { font-size: 11px; color: rgba(244,241,236,.65); letter-spacing: .04em; text-transform: uppercase; }

/* OTP code inputs */
.otp-row { display: flex; gap: 10px; justify-content: space-between; }
.otp-row input {
  width: 52px; height: 60px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.otp-row input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.otp-row input.filled { border-color: var(--ink); }
@media (max-width: 380px) {
  .otp-row input { width: 44px; height: 54px; font-size: 18px; }
}

/* ============================================================
   Lion logo — animation + loader
   ============================================================ */
.lion { display: block; }

/* mane shimmer — each facet brightens in sequence, like a pride turning */
.lion--animated .lion-mane {
  transform-origin: 24px 24px;
  animation: lion-mane-pulse 1.8s ease-in-out infinite;
}
.lion--animated .lion-mane-1 { animation-delay: 0.00s; }
.lion--animated .lion-mane-2 { animation-delay: 0.15s; }
.lion--animated .lion-mane-3 { animation-delay: 0.30s; }
.lion--animated .lion-mane-4 { animation-delay: 0.45s; }
.lion--animated .lion-mane-5 { animation-delay: 0.60s; }
.lion--animated .lion-mane-6 { animation-delay: 0.75s; }
@keyframes lion-mane-pulse {
  0%, 70%, 100% { filter: brightness(1); transform: scale(1); }
  35%           { filter: brightness(1.35) saturate(1.15); transform: scale(1.04); }
}

/* eye blink at the end of each cycle */
.lion--animated .lion-eye {
  transform-origin: center;
  animation: lion-eye-blink 1.8s ease-in-out infinite;
}
@keyframes lion-eye-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96%           { transform: scaleY(.15); }
}

/* whole-body subtle breathe */
.lion--animated {
  animation: lion-breathe 2.4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes lion-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lion--animated, .lion--animated .lion-mane, .lion--animated .lion-eye { animation: none; }
}

/* ---- loader wrapper ---- */
.lion-loader-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lion-loader-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.lion-loader-ring::before,
.lion-loader-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  border-top-color: var(--brand);
  animation: lion-ring-spin 1.4s linear infinite;
}
.lion-loader-ring::after {
  inset: 6px;
  border-top-color: var(--accent);
  animation-duration: 2.2s;
  animation-direction: reverse;
  opacity: .6;
}
@keyframes lion-ring-spin {
  to { transform: rotate(360deg); }
}
.lion-loader-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .01em;
}

/* full-screen overlay variant */
.lion-loader-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .18s ease;
}
[data-theme="dark"] .lion-loader-overlay {
  background: color-mix(in oklab, var(--bg) 75%, transparent);
}

/* ============================================================
   Sync pill + popover (replaces notifications bell)
   ============================================================ */
.sync-pill-wrap { position: relative; }
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
  cursor: pointer;
}
.sync-pill:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.sync-pill .sp-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--success) 25%, transparent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in oklab, var(--success) 25%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in oklab, var(--success) 10%, transparent); }
}
@media (max-width: 720px) {
  .sync-pill .sp-label { display: none; }
  .sync-pill { padding: 0 10px; }
}

.sync-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: pop .15s cubic-bezier(.3,.7,.4,1);
  overflow: hidden;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.sync-pop-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.sync-rows {
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.sync-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
}
.sync-row .sr-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sync-row .sr-body { flex: 1; min-width: 0; }
.sync-row .sr-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.sync-row .sr-time { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.sync-row .sr-meta { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.sync-pop-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
}

/* ============================================================
   API docs page
   ============================================================ */
.api-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: flex-start;
}
@media (max-width: 900px) { .api-grid { grid-template-columns: 1fr; } }

.api-toc {
  position: sticky;
  top: 76px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.api-toc a {
  display: block;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 6px;
  font-weight: 500;
}
.api-toc a:hover { background: var(--surface-2); color: var(--text); }
.api-toc a.active { background: var(--brand-soft); color: var(--brand-700); font-weight: 600; }
[data-theme="dark"] .api-toc a.active { color: var(--brand); }
.api-toc .toc-head {
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px;
  margin-top: 4px;
}

.api-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 16px;
  scroll-margin-top: 80px;
}
.api-section h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.api-section h3 {
  margin: 20px 0 6px;
  font-size: 14px;
  font-weight: 700;
}
.api-section p {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}
.api-section p code, .api-section li code {
  font-family: 'JetBrains Mono', monospace;
  font-size: .88em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--brand-700);
}
[data-theme="dark"] .api-section p code, [data-theme="dark"] .api-section li code { color: var(--brand); }
.api-section ul {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.code-block {
  background: #0F1117;
  color: #ECEEF4;
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0 16px;
  border: 1px solid #1E2230;
}
.code-tabs {
  display: flex;
  align-items: center;
  background: #15171F;
  border-bottom: 1px solid #1E2230;
  padding: 0 8px;
  height: 36px;
}
.code-tabs button {
  height: 36px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(236,238,244,.6);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  cursor: pointer;
}
.code-tabs button.active {
  color: #ECEEF4;
  border-bottom-color: #E07A5F;
}
.code-tabs .copy-btn {
  margin-left: auto;
  color: rgba(236,238,244,.6);
  height: 28px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 6px;
  font-size: 11px;
}
.code-tabs .copy-btn:hover { background: rgba(255,255,255,.08); color: #ECEEF4; }
.code-block pre {
  margin: 0;
  padding: 16px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.code-block .tok-c   { color: #6B7088; font-style: italic; }
.code-block .tok-s   { color: #B8E5A8; }
.code-block .tok-k   { color: #E48B72; font-weight: 600; }
.code-block .tok-n   { color: #F2CC8F; }
.code-block .tok-f   { color: #82B6F0; }
.code-block .tok-p   { color: #C2C7D6; }

.method-pill {
  display: inline-flex;
  height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.method-pill.get    { background: #4CAE7A22; color: #2F9461; }
.method-pill.post   { background: #5A88C022; color: #3A6CA8; }
.method-pill.put    { background: #E0A23B22; color: #B07920; }
.method-pill.delete { background: #D95C5C22; color: #B14040; }
[data-theme="dark"] .method-pill.get    { color: #6FCB94; }
[data-theme="dark"] .method-pill.post   { color: #82B6F0; }
[data-theme="dark"] .method-pill.put    { color: #E0B25C; }
[data-theme="dark"] .method-pill.delete { color: #E07A7A; }

.endpoint-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.endpoint-row:last-child { border-bottom: none; }
.endpoint-row code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--text);
}
.endpoint-row .ep-desc { color: var(--text-3); font-size: 12px; }
@media (max-width: 600px) {
  .endpoint-row { grid-template-columns: 70px 1fr; }
  .endpoint-row .ep-desc { display: none; }
}
.acc-tree { display: flex; flex-direction: column; }
.acc-row {
  display: grid;
  grid-template-columns: 1fr 140px 100px 120px 120px 120px 36px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.acc-row:hover { background: var(--surface-2); }
.acc-row:last-child { border-bottom: none; }
.acc-row.is-child { background: var(--bg); padding-left: 32px; }
.acc-row.is-child:hover { background: var(--surface-2); }
.acc-cell-name {
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}
.acc-chevron {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background .12s, transform .15s;
}
.acc-chevron:hover { background: var(--surface-3); color: var(--text); }
.acc-chevron.spacer { visibility: hidden; }
.acc-chevron.open { transform: rotate(90deg); color: var(--text); }
.acc-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: white;
  position: relative;
}
.acc-icon.primary { background: linear-gradient(135deg, #E07A5F, #B85A40); }
.acc-icon.secondary { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.acc-name { min-width: 0; }
.acc-name .nm { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-name .sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-connector {
  width: 14px; height: 1px;
  background: var(--border-strong);
  margin-right: -4px;
  flex-shrink: 0;
}

.acc-row .acc-head-th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  font-weight: 700;
}
.acc-row.head {
  background: var(--surface-2);
  cursor: default;
  padding-top: 10px; padding-bottom: 10px;
}
.acc-row.head:hover { background: var(--surface-2); }

@media (max-width: 980px) {
  .acc-row {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .acc-row > .acc-mb-hide { display: none; }
  .acc-row.head { display: none; }
}

/* Account detail layout */
.acc-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 1080px) { .acc-detail-grid { grid-template-columns: 1fr; } }

/* New compact account detail layout (no tabs, stacked) */
.acc-detail {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.acc-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.acc-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}
.acc-hero-text { min-width: 0; flex: 1; }
.acc-hero-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.acc-hero-row .page-title { font-size: 22px; }
.acc-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .acc-hero-main { gap: 12px; }
  .acc-hero-actions { width: 100%; }
  .acc-hero-actions .btn { flex: 1; }
}

.acc-parent-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--brand-soft), var(--brand-softer));
  border: 1px solid color-mix(in oklab, var(--brand) 25%, transparent);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform .08s, box-shadow .15s, border-color .15s;
}
.acc-parent-banner:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--brand) 50%, transparent);
}
.acc-parent-banner:active { transform: translateY(1px); }
.acc-parent-banner.soft {
  background: var(--surface-2);
  border-color: var(--border);
}
.acc-parent-banner .apb-arrow {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.acc-parent-banner.soft .apb-arrow { display: none; }
.acc-parent-banner .apb-body { flex: 1; min-width: 0; }
.acc-parent-banner .apb-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-700);
}
[data-theme="dark"] .acc-parent-banner .apb-eyebrow { color: var(--brand); }
.acc-parent-banner .apb-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-parent-banner .apb-id { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 6px; }
.acc-parent-banner .apb-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.acc-facts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
@media (max-width: 980px) { .acc-facts { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .acc-facts { grid-template-columns: repeat(2, 1fr); } }
.acc-fact {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.acc-fact:last-child { border-right: none; }
@media (max-width: 980px) {
  .acc-fact:nth-child(3n) { border-right: none; }
  .acc-fact:nth-child(n+4) { border-bottom: none; }
}
@media (max-width: 520px) {
  .acc-fact { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .acc-fact:nth-child(2n) { border-right: none; }
  .acc-fact:nth-last-child(-n+2) { border-bottom: none; }
}
.acc-fact-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.acc-fact-value {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-top: 4px;
  color: var(--text);
}
.acc-fact-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.acc-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.acc-section.tone-muted { background: transparent; border-style: dashed; }
.acc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
}
.acc-section.tone-muted .acc-section-head { padding-bottom: 10px; }
.acc-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.acc-section-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.acc-section-body { border-top: 1px solid var(--border); }
.acc-section.tone-muted .acc-section-body { border-top: none; padding: 0 18px 18px; }

.acc-owner-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.acc-owner-row:hover { background: var(--surface-2); }
.acc-owner-text { flex: 1; min-width: 0; }
.acc-owner-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.acc-owner-meta {
  font-size: 12.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.acc-children {
  display: flex; flex-direction: column;
}
.sub-acc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background .12s;
}
.sub-acc-row:last-child { border-bottom: none; }
.sub-acc-row:hover { background: var(--surface-2); }
.sub-acc-body { flex: 1; min-width: 0; }
.sub-acc-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub-acc-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.sub-acc-meta .sep { color: var(--border-strong); }
@media (max-width: 480px) {
  .sub-acc-row { gap: 10px; padding: 12px 14px; }
}

.acc-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0;
}
.acc-controls .btn { flex: 1; min-width: 160px; }
@media (max-width: 520px) {
  .acc-controls .btn { flex-basis: 100%; }
}

/* ============================================================
   Voucher card + modal
   ============================================================ */
.voucher-card {
  width: 100%;
  background: linear-gradient(135deg, var(--brand-softer) 0%, var(--accent-soft) 100%);
  border: 1px solid color-mix(in oklab, var(--brand) 22%, transparent);
  border-radius: 14px;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: transform .08s, box-shadow .15s, border-color .15s;
}
[data-theme="dark"] .voucher-card {
  background: linear-gradient(135deg, var(--brand-softer) 0%, var(--surface-2) 100%);
}
.voucher-card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in oklab, var(--brand) 45%, transparent);
}
.voucher-card:active { transform: translateY(1px); }
.voucher-card-head { display: flex; align-items: center; gap: 14px; }
.voucher-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.voucher-card-big {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.15;
  margin: 2px 0;
}
.voucher-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-700);
  flex-shrink: 0;
}
[data-theme="dark"] .voucher-card-cta { color: var(--brand); }
@media (max-width: 480px) {
  .voucher-card-cta { display: none; }
}
.voucher-bar {
  height: 8px;
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  min-width: 80px;
}
[data-theme="dark"] .voucher-bar { background: rgba(255,255,255,.06); }
.voucher-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: 999px;
  transition: width .4s ease;
}

.voucher-balance {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
@media (max-width: 520px) {
  .voucher-balance { grid-template-columns: 1fr; }
  .voucher-balance > div:last-child { text-align: left !important; }
}
.voucher-big-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; }

.voucher-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.voucher-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.voucher-row:last-child { border-bottom: none; }
.voucher-code { display: flex; align-items: center; gap: 8px; min-width: 0; }
@media (max-width: 600px) {
  .voucher-row { grid-template-columns: 1fr auto; }
  .voucher-row > div:nth-child(2),
  .voucher-row > div:nth-child(3),
  .voucher-row > div:nth-child(4) { display: none; }
}

/* ============================================================
   Profile — identity card + simplified sections
   ============================================================ */
.profile-id-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(242,204,143,.45) 0%, transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(224,122,95,.4) 0%, transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
}
.profile-id-card .avatar.xl {
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.profile-id-text { min-width: 0; flex: 1; }
.profile-id-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}
.profile-id-role {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.profile-id-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px 4px 12px;
}
.profile-id-email .email-hidden {
  letter-spacing: .04em;
  filter: blur(0);
}
@media (max-width: 520px) {
  .profile-id-card { padding: 18px; gap: 14px; flex-wrap: wrap; }
  .profile-id-name { font-size: 18px; }
}

.profile-pw-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .profile-pw-row { grid-template-columns: 1fr; }
}

.profile-key-row {
  display: grid;
  grid-template-columns: 130px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.profile-key-label { display: flex; align-items: center; gap: 6px; flex-direction: column; align-items: flex-start; }
.profile-key-value {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow-x: auto;
  padding: 6px 8px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
}
@media (max-width: 720px) {
  .profile-key-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .profile-key-value { grid-column: 1 / -1; order: -1; }
  .profile-key-label { flex-direction: row; }
}
/* ============================================================
   Voucher chip — VIP gets crown + gold pill
   ============================================================ */
.voucher-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.voucher-chip.md { font-size: 13px; }
.voucher-chip.vip {
  background: linear-gradient(135deg, #F8DCA5, #E2A24A);
  color: #4A2F0E;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 1px 2px rgba(186,123,40,.25);
  text-shadow: 0 1px 0 rgba(255,255,255,.18);
  border: 1px solid rgba(186,123,40,.45);
}
.voucher-chip.vip svg {
  color: #4A2F0E;
}
[data-theme="dark"] .voucher-chip.vip {
  background: linear-gradient(135deg, #F2CC8F, #B8842F);
  color: #1E1305;
  border-color: rgba(255,255,255,.18);
}

/* Transaction tile gets a gold left border when it has a VIP voucher */
.txn-tile.vip {
  border-color: rgba(226,162,74,.55);
  background:
    linear-gradient(180deg, rgba(248,220,165,.12), transparent 60%),
    var(--surface);
  position: relative;
  overflow: hidden;
}
.txn-tile.vip::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #F8DCA5, #E2A24A);
}
[data-theme="dark"] .txn-tile.vip {
  background:
    linear-gradient(180deg, rgba(248,220,165,.06), transparent 60%),
    var(--surface);
}

/* ============================================================
   Transactions (ledger) tile grid
   ============================================================ */
.txn-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  padding: 14px 16px;
}
@media (max-width: 480px) { .txn-tile-grid { padding: 12px; gap: 10px; } }

.txn-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: transform .08s, box-shadow .15s, border-color .15s;
}
.txn-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.txn-tile:active { transform: translateY(0); }
.txn-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.txn-tile-account {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  min-width: 0;
}
.txn-tile-account-text { min-width: 0; flex: 1; }
.txn-tile-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.txn-tile-meta-row { min-width: 0; }
.txn-tile-meta-row .dl-label { margin-bottom: 2px; }
.txn-tile-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Emails list + pull-to-refresh indicator
   ============================================================ */
.emails-shell { position: relative; }
.emails-list-wrap { overflow: hidden; position: relative; }
.ptr-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-3);
  margin-bottom: 6px;
  transition: height .12s, opacity .15s;
}
.ptr-indicator.refreshing { color: var(--text-2); }
.emails-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.email-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  transition: background .12s;
}
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: var(--surface-2); }
.email-row.unread { background: var(--brand-softer); }
.email-row.unread:hover { background: var(--brand-soft); }
[data-theme="dark"] .email-row.unread { background: color-mix(in oklab, var(--brand-soft) 35%, var(--surface)); }
.email-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  margin-top: 9px;
  flex-shrink: 0;
  background: transparent;
}
.email-row.unread .email-dot { background: var(--brand); }
.email-body { flex: 1; min-width: 0; }
.email-meta-line {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}
.email-from { font-size: 13.5px; font-weight: 700; letter-spacing: -.005em; }
.email-acct { font-size: 11.5px; }
.email-time { margin-left: auto; font-size: 11.5px; font-weight: 600; }
.email-subject {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.005em;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-row.unread .email-subject { font-weight: 700; }
.email-preview {
  font-size: 13px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.email-flags {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-top: 3px;
}
@media (max-width: 520px) {
  .email-row { padding: 12px 14px; gap: 10px; }
  .email-time { font-size: 11px; }
}

.tree-mini {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 0;
}
.tree-mini .tm-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  min-width: 0;
}
.tree-mini .tm-row:hover { background: var(--surface-2); }
.tree-mini .tm-row.current { background: var(--brand-soft); }
.tree-mini .tm-row.current .tm-name { color: var(--brand-700); }
[data-theme="dark"] .tree-mini .tm-row.current .tm-name { color: var(--brand); }
.tree-mini .tm-row.indent { padding-left: 32px; position: relative; }
.tree-mini .tm-row.indent::before {
  content: '';
  position: absolute; left: 18px; top: 0; bottom: 50%;
  border-left: 1px solid var(--border-strong);
}
.tree-mini .tm-row.indent::after {
  content: '';
  position: absolute; left: 18px; top: 50%; width: 8px;
  border-top: 1px solid var(--border-strong);
}
.tree-mini .tm-row.indent.last::before { bottom: 50%; }
.tree-mini .tm-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.tree-mini .tm-meta { font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 1080px) { .detail-grid { grid-template-columns: 1fr; } }
.def-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.def-list .dl-label { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 3px; }
.def-list .dl-value { font-size: 14px; color: var(--text); font-weight: 500; }

.tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabbar .tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabbar .tab:hover { color: var(--text-2); }
.tabbar .tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ============================================================
   Product grid
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.product-card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.product-thumb {
  aspect-ratio: 16/10;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.product-thumb .product-tag {
  position: absolute; top: 10px; left: 10px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.product-body { padding: 14px 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.product-name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.product-sub { font-size: 12px; color: var(--text-3); }
.product-foot { margin-top: 10px; display: flex; align-items: flex-end; justify-content: space-between; }
.product-price { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.product-price .currency { font-size: 12px; color: var(--text-3); margin-right: 2px; }

/* ============================================================
   Profile page
   ============================================================ */
.profile-cover {
  height: 140px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 80% 20%, rgba(242,204,143,.5) 0%, transparent 50%),
    radial-gradient(circle at 20% 90%, rgba(224,122,95,.6) 0%, transparent 50%),
    linear-gradient(120deg, #3D405B, #5A5F84);
  position: relative;
  margin-bottom: 56px;
}
.profile-cover .profile-avatar-wrap {
  position: absolute;
  left: 28px;
  bottom: -36px;
  display: flex; align-items: flex-end; gap: 16px;
}
.profile-cover .profile-avatar-wrap .avatar {
  width: 88px; height: 88px; font-size: 28px;
  border: 4px solid var(--surface);
}
.profile-cover .profile-name {
  padding-bottom: 6px;
  font-size: 20px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,15,20,.5);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn .2s cubic-bezier(.3,.7,.4,1);
}
.modal-head { padding: 20px 20px 0; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast {
  background: var(--ink);
  color: white;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.3,.7,.4,1);
  min-width: 240px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Misc helpers
   ============================================================ */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .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-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.flex-1 { flex: 1; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-15 { font-size: 15px; } .fs-18 { font-size: 18px; } .fs-22 { font-size: 22px; }
.txt-right { text-align: right; }
.hide-mobile { } @media (max-width: 720px) { .hide-mobile { display: none !important; } }
.show-mobile { display: none; } @media (max-width: 960px) { .show-mobile { display: inline-flex; } }

/* ============================================================
   Sparkline / bars
   ============================================================ */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
  padding-top: 16px;
}
.bars .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--brand), var(--brand-700));
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
  position: relative;
  transition: opacity .15s;
}
.bars .bar:hover { opacity: .85; }
.bars .bar.muted { background: var(--surface-3); }
.bars-labels { display: flex; gap: 6px; margin-top: 8px; }
.bars-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--text-3); font-weight: 600; }

/* segmented */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* empty state */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty h4 { color: var(--text); font-size: 15px; margin: 12px 0 4px; font-weight: 700; }
.empty p { margin: 0 0 16px; font-size: 13px; }

/* skip-link, hide scrollbar tweaks */
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* drawer-open lock scroll */
body.drawer-open { overflow: hidden; }
