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

:root {
  --bg: #000000;
  --bg-secondary: #0A0A0A;
  --surface: #121212;
  --surface-secondary: #1A1A1A;
  --surface-hover: #212121;
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #F5F7FA;
  --text-secondary: #9198A1;
  --text-tertiary: #5C6470;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --accent-muted: rgba(59, 130, 246, 0.16);
  --success: #10B981;
  --success-muted: rgba(16, 185, 129, 0.14);
  --warning: #F59E0B;
  --warning-muted: rgba(245, 158, 11, 0.14);
  --danger: #EF4444;
  --danger-muted: rgba(239, 68, 68, 0.14);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px; --radius-xl: 12px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fs-page-title: 28px;
  --fs-section-title: 19px;
  --fs-body: 14.5px;
  --fs-secondary: 13.5px;
  --fs-meta: 12.5px;
  --lh-tight: 1.25;
  --lh-normal: 1.5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);

  --nav-h: 56px;
  --hdr-h: 52px;
  --sidebar-w: 240px;

  --ease: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --ease-fast: 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --surface: #FFFFFF;
  --surface-secondary: #F5F5F6;
  --surface-hover: #EDEEF0;
  --border: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text-primary: #14161A;
  --text-secondary: #62666E;
  --text-tertiary: #93979E;
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  --accent-muted: rgba(59, 130, 246, 0.10);
  --success: #059669;
  --success-muted: rgba(5, 150, 105, 0.10);
  --warning: #D97706;
  --warning-muted: rgba(217, 119, 6, 0.10);
  --danger: #DC2626;
  --danger-muted: rgba(220, 38, 38, 0.10);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

html, body, #app, #shell, #hdr, .app-sidebar, .metric-card, .list-card, .table-wrap, .revenue-card,
.info-box, .plan-card, .modal-card, .type-card, .preset-chip, #nav, #toast {
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}

@font-face {
  font-family: 'Inter';
  src: url('/fonts/InterVariable.woff2') format('woff2-variations'), url('/fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font-family: inherit; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.icon { display: inline-block; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Loading & Screen States */
#loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
}
.ld-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ld-name { font-size: 16px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.2px; }
.ld-sub { font-size: var(--fs-meta); color: var(--text-secondary); }

#err-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 190;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-8);
  text-align: center;
}

/* Shell & Header */
#shell { display: none; height: 100%; flex-direction: column; overflow: hidden; }
#hdr {
  height: var(--hdr-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  flex-shrink: 0;
  z-index: 10;
  gap: var(--sp-2);
}
.hdr-back, .hdr-act {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
  flex-shrink: 0;
}
.hdr-back:hover, .hdr-act:hover { background: var(--surface-hover); }
.hdr-back:active, .hdr-act:active { background: var(--surface-hover); }
#hdr-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  padding: 0 var(--sp-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.mode-pill {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px;
  min-height: 32px;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  transition: background var(--ease), border-color var(--ease);
}
.mode-pill:hover { background: var(--surface-hover); }
.mode-pill .icon { width: 14px; height: 14px; }
.mode-pill .mp-switch { opacity: 0.6; }

#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--sp-6) + env(safe-area-inset-bottom, 0px));
}

/* App shell (desktop, owner mode only) */
.app-shell { display: flex; height: 100%; }
.app-sidebar {
  display: none;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  flex-direction: column;
  padding: var(--sp-5) var(--sp-3);
  overflow-y: auto;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-2) var(--sp-6);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}
.sidebar-group { margin-bottom: var(--sp-5); }
.sidebar-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-tertiary);
  padding: 0 var(--sp-2);
  margin-bottom: var(--sp-2);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-2);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-secondary);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--ease), color var(--ease);
}
.sidebar-link:hover { background: var(--surface-hover); color: var(--text-primary); }
.sidebar-link.active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.sidebar-link .icon { width: 18px; height: 18px; }
.sidebar-footer { margin-top: auto; padding-top: var(--sp-4); border-top: 1px solid var(--border); }

@media (min-width: 960px) {
  .app-sidebar { display: flex; }
  #nav { display: none !important; }
  #content { padding-bottom: var(--sp-8); }
}

/* Bottom Navigation */
#nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 10;
}
.nav-btn {
  flex: 1;
  min-height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 0;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  transition: color var(--ease);
}
.nav-btn .icon { color: var(--text-secondary); transition: color var(--ease); width: 18px; height: 18px; }
.nav-btn.active { color: var(--accent); font-weight: 600; }
.nav-btn.active .icon { color: var(--accent); }

/* Toast */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--sp-5) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-secondary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 20px;
  font-size: var(--fs-meta);
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast .icon { width: 16px; height: 16px; flex-shrink: 0; }
#toast.toast-ok .icon { color: var(--success); }
#toast.toast-err .icon { color: var(--danger); }
#toast .toast-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dashboard Header Greeting */
.dash-greeting { padding: var(--sp-5) var(--sp-4) var(--sp-3); }
.dash-title { font-size: var(--fs-page-title); font-weight: 600; letter-spacing: -0.4px; color: var(--text-primary); line-height: var(--lh-tight); }
.dash-sub { font-size: var(--fs-secondary); color: var(--text-secondary); margin-top: var(--sp-1); }

/* Metrics Row */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}
@media (min-width: 640px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
}
.metric-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.metric-value {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  line-height: var(--lh-tight);
  font-variant-numeric: tabular-nums;
}
.metric-sub {
  font-size: var(--fs-meta);
  color: var(--text-tertiary);
  margin-top: var(--sp-1);
}

/* Sections */
.section { padding: var(--sp-3) var(--sp-4); }
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.section-title {
  font-size: var(--fs-section-title);
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}
.section-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-secondary);
}

/* Revenue Chart */
.revenue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}
.revenue-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.revenue-total {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-top: var(--sp-1);
  font-variant-numeric: tabular-nums;
}
.period-pill {
  font-size: var(--fs-meta);
  color: var(--text-secondary);
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  padding: 3px var(--sp-2);
  border-radius: 12px;
}
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 64px;
  padding-top: var(--sp-2);
}
.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--surface-secondary);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  width: 100%;
  background: var(--border-strong);
  border-radius: 3px;
  transition: height 0.3s ease;
}
.bar-fill.bar-active { background: var(--accent); }

/* List (compact rows, used where a table is overkill) */
.list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
  cursor: pointer;
  min-height: 44px;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover, .list-item:active { background: var(--surface-hover); }
.list-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: var(--fs-secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-meta {
  font-size: var(--fs-meta);
  color: var(--text-secondary);
  margin-top: 2px;
}
.list-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.amount-positive { font-size: var(--fs-body); font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Tables */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-secondary); }
.data-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th.col-num, .data-table td.col-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr { border-bottom: 1px solid var(--border-subtle); transition: background var(--ease); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table td.cell-secondary { color: var(--text-secondary); }
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-meta);
  color: var(--text-secondary);
}
.table-pagination .pager-btns { display: flex; gap: var(--sp-2); }
@media (max-width: 640px) {
  table.data-table { display: block; }
  table.data-table thead { display: none; }
  .table-wrap .data-table tbody, .table-wrap .data-table tr { display: block; }
  .table-wrap .data-table tr { border-bottom: 1px solid var(--border); padding: var(--sp-3) var(--sp-4); }
  .table-wrap .data-table tr:last-child { border-bottom: none; }
  .table-wrap .data-table td { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 4px 0; border: none; }
  .table-wrap .data-table td[data-label]::before { content: attr(data-label); color: var(--text-secondary); font-size: var(--fs-meta); font-weight: 500; }
}

/* Status badges */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-secondary);
}
.dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--success); }
.dot-orange { background: var(--warning); }
.dot-gray { background: var(--text-tertiary); }
.dot-red { background: var(--danger); }
.dot-blue { background: var(--accent); }

.action-link {
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.action-link:hover { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--fs-body);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), opacity var(--ease), border-color var(--ease);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #ffffff; }
.btn-primary:hover, .btn-primary:active { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover, .btn-secondary:active { background: var(--surface-hover); }
.btn-danger { background: var(--danger-muted); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-text-action {
  background: none; border: none; font-family: inherit; font-size: var(--fs-meta); font-weight: 500; color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-text-action:hover { color: var(--text-primary); }
.btn-sm { height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-meta); border-radius: var(--radius-sm); width: auto; }
.btn-danger.btn-sm { background: var(--danger-muted); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.25); }

/* Floating Action Button */
.fab {
  position: fixed;
  right: var(--sp-5);
  bottom: calc(var(--nav-h) + var(--sp-5) + env(safe-area-inset-bottom, 0px));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 20;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 960px) { .fab { display: none; } }

/* Form Fields */
.form-sec { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-4); }
.fg { display: flex; flex-direction: column; gap: var(--sp-2); }
.fg label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.fg .hint { font-size: var(--fs-meta); color: var(--text-tertiary); margin-top: 2px; }
.input, .fg input, .fg select, .fg textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--fs-body);
  outline: none;
  transition: border-color var(--ease);
  -webkit-appearance: none;
}
.fg input:focus, .fg select:focus, .fg textarea:focus, .input:focus { border-color: var(--accent); }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-1);
  z-index: 50;
  display: none;
}
.dropdown-menu.open { display: block; animation: dropdownIn var(--ease-fast); }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-secondary);
  color: var(--text-primary);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item .icon { width: 16px; height: 16px; }

/* Info Box */
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  font-size: var(--fs-secondary);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.info-box strong { color: var(--text-primary); }

/* Empty States */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}
.empty .icon { color: var(--text-tertiary); width: 24px; height: 24px; margin-bottom: var(--sp-1); }
.empty .et { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.empty .es { font-size: var(--fs-secondary); color: var(--text-secondary); max-width: 280px; }
.empty .btn { width: auto; padding: 0 var(--sp-5); margin-top: var(--sp-2); }

/* Skeleton Loading */
.skel {
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skel-wrap { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Plan Card */
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.plan-name { font-size: var(--fs-body); font-weight: 600; color: var(--text-primary); }
.plan-price { font-size: 18px; font-weight: 600; color: var(--text-primary); margin-top: 2px; font-variant-numeric: tabular-nums; }
.plan-meta { font-size: var(--fs-meta); color: var(--text-secondary); margin-top: 2px; }

/* Toggle Switch */
.tgl { position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.tgl input { opacity: 0; width: 0; height: 0; position: absolute; }
.tgl-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 12px; transition: background var(--ease); }
.tgl input:checked + .tgl-track { background: var(--accent); }
.tgl-thumb { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform var(--ease); }
.tgl input:checked ~ .tgl-thumb { transform: translateX(20px); }

/* Plan type / price preset selectors */
.type-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-2); margin-top: 6px; }
.type-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.type-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.type-card.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent);
}
.type-card .icon { width: 18px; height: 18px; color: var(--text-secondary); }
.type-card.active .icon { color: var(--accent); }
.type-card-title { font-size: 11px; font-weight: 600; color: var(--text-primary); }
.type-card-sub { font-size: 9px; color: var(--text-tertiary); }

.preset-grid { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.preset-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px var(--sp-3);
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--ease);
}
.preset-chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.preset-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.preview-box {
  background: var(--surface-secondary);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
}
.preview-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.link-text {
  font-size: var(--fs-meta);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-icon-sm {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 6px var(--sp-2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.btn-icon-sm:hover { background: var(--surface-hover); }
.btn-icon-sm .icon { width: 14px; height: 14px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  animation: slideUp 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal-card { border-radius: var(--radius-xl); animation: modalPopIn 0.18s var(--ease); }
}
@keyframes modalPopIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
  letter-spacing: -0.2px;
}
.modal-body { display: flex; flex-direction: column; gap: var(--sp-3); font-size: var(--fs-secondary); color: var(--text-secondary); }
.modal-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.modal-actions .btn { flex: 1; }

/* Avatar */
.avatar {
  border-radius: 50%;
  background: var(--surface-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ease), border-color var(--ease);
}
.avatar-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.avatar-btn.active { border-color: var(--accent); }

/* Utility */
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
