/* ============================================================
   QRBurn — Main Stylesheet
   Font: Nunito | Primary: #FF4B1F | Dark BG: #1a1a1a
   ============================================================ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary:    #FF4B1F;
  --color-primary-dk: #e0360e;
  --color-bg:         #1a1a1a;
  --color-bg2:        #242424;
  --color-bg3:        #2e2e2e;
  --color-surface:    #2a2a2a;
  --color-surface2:   #333333;
  --color-border:     rgba(255,255,255,0.08);
  --color-text:       #f2f2f7;
  --color-text2:      #ababab;
  --color-text3:      #6e6e73;
  --color-success:    #30d158;
  --color-warn:       #ffd60a;
  --color-danger:     #ff453a;
  --color-light-bg:   #F2F2F7;
  --radius-sm:        8px;
  --radius-md:        14px;
  --radius-lg:        20px;
  --radius-xl:        28px;
  --shadow-card:      0 2px 16px rgba(0,0,0,0.35);
  --shadow-sheet:     0 -4px 40px rgba(0,0,0,0.6);
  --font:             'Nunito', system-ui, -apple-system, sans-serif;
  --nav-h:            56px;
  --safe-bottom:      env(safe-area-inset-bottom, 0px);
}

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }

/* ─── Typography ──────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

/* ─── #app ────────────────────────────────────────────────── */
#app { min-height: 100dvh; }

/* ─── Nav Bar ─────────────────────────────────────────────── */
.nav-bar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h);
  padding: 0 16px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-bar__logo {
  font-size: 1.4rem; font-weight: 900; color: var(--color-primary);
  letter-spacing: -0.5px;
}
.nav-bar__right { display: flex; align-items: center; gap: 4px; position: relative; }

.nav-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--color-text);
  transition: background 0.15s;
}
.nav-btn:active { background: var(--color-surface); }
.nav-btn--scan { color: var(--color-primary); }

/* ─── Dropdown Menu ───────────────────────────────────────── */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  min-width: 180px;
  box-shadow: var(--shadow-card);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.dropdown-item {
  display: block; width: 100%;
  padding: 13px 16px;
  text-align: left;
  font-size: 0.95rem; font-weight: 600;
  color: var(--color-text);
  transition: background 0.1s;
}
.dropdown-item:hover { background: rgba(255,255,255,0.06); }
.dropdown-item--danger { color: var(--color-danger); }
.dropdown-divider { border: none; border-top: 1px solid var(--color-border); margin: 4px 0; }
.hidden { display: none !important; }

/* ─── Summary Banner ──────────────────────────────────────── */
.summary-banner {
  display: flex; align-items: center; gap: 0;
  padding: 16px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  gap: 12px;
}
.summary-banner__stat { flex-shrink: 0; }
.summary-banner__value { display: block; font-size: 1.6rem; font-weight: 900; line-height: 1; }
.summary-banner__label { font-size: 0.75rem; color: var(--color-text2); text-transform: uppercase; letter-spacing: .5px; }
.summary-banner__plan { margin-left: auto; flex-shrink: 0; text-align: right; }
.summary-banner__links { font-size: 0.75rem; color: var(--color-text2); display: block; margin-top: 4px; }

/* ─── Links progress bar ──────────────────────────────────── */
.links-bar {
  height: 4px; width: 100px; background: var(--color-bg3);
  border-radius: 4px; margin-top: 4px; overflow: hidden;
}
.links-bar__fill {
  height: 100%; background: var(--color-primary); border-radius: 4px;
  transition: width 0.4s ease;
}

/* ─── Plan Badge ──────────────────────────────────────────── */
.plan-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .7px;
}
.plan-badge--free    { background: var(--color-bg3); color: var(--color-text2); }
.plan-badge--starter { background: #3B82F620; color: #60a5fa; }
.plan-badge--pro     { background: var(--color-primary)22; color: var(--color-primary); }

/* ─── Search + Sort Bar ───────────────────────────────────── */
.search-sort-bar {
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--color-bg);
  position: sticky; top: var(--nav-h); z-index: 90;
  border-bottom: 1px solid var(--color-border);
}
.search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.search-input:focus { outline: none; border-color: var(--color-primary); }

.sort-tabs { display: flex; gap: 8px; }
.sort-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem; font-weight: 700;
  color: var(--color-text2);
  background: var(--color-surface);
  transition: all 0.15s;
}
.sort-tab--active {
  background: var(--color-primary);
  color: #fff;
}

/* ─── Home Main ───────────────────────────────────────────── */
.home-main { padding: 16px; padding-bottom: calc(80px + var(--safe-bottom)); }

/* ─── Group Cards ─────────────────────────────────────────── */
.groups-list { display: flex; flex-direction: column; gap: 12px; }

.group-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  position: relative;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column;
}
.group-card:active { transform: scale(0.98); box-shadow: none; }

.group-card__color-bar {
  height: 4px;
  background: var(--group-color, var(--color-primary));
  width: 100%;
}
.group-card__body {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}
.group-card__info { flex: 1; min-width: 0; }
.group-card__name {
  font-size: 1rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.group-card__url { font-size: 0.78rem; color: var(--color-text2); }

.group-card__stats { display: flex; gap: 16px; flex-shrink: 0; }
.group-card__stat { text-align: right; }
.group-card__stat-val { display: block; font-size: 1.1rem; font-weight: 900; color: var(--color-text); }
.group-card__stat-lbl { font-size: 0.68rem; color: var(--color-text3); text-transform: uppercase; }

.group-card__delete {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px;
  background: var(--color-danger)22;
  color: var(--color-danger);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.group-card:hover .group-card__delete { opacity: 1; }

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  padding: 48px 24px; text-align: center;
  background: var(--color-surface); border-radius: var(--radius-lg);
}
.empty-state__icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state__text { color: var(--color-text2); font-weight: 600; }

/* ─── Ranking ─────────────────────────────────────────────── */
.ranking-section { margin-top: 24px; }
.section-title { font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--color-text2); margin-bottom: 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.ranking-list { display: flex; flex-direction: column; gap: 8px; }
.ranking-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--color-surface); border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.1s;
}
.ranking-item:active { background: var(--color-surface2); }
.ranking-item__pos { font-size: 0.8rem; font-weight: 900; color: var(--color-text3); width: 18px; }
.ranking-item__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ranking-item__name { flex: 1; font-weight: 700; font-size: 0.9rem; }
.ranking-item__count { font-weight: 900; color: var(--color-primary); }

/* ─── FAB ─────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: calc(24px + var(--safe-bottom)); right: 20px;
  width: 58px; height: 58px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(255,75,31,0.45);
  z-index: 150;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:active { transform: scale(0.93); box-shadow: none; }

/* ─── Group Hero ──────────────────────────────────────────── */
.group-hero {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, var(--group-color, var(--color-primary))22 0%, transparent 100%);
  border-bottom: 2px solid var(--group-color, var(--color-primary));
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  background-color: var(--color-bg);
}
.back-btn {
  width: 38px; height: 38px;
  background: var(--color-surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text);
  flex-shrink: 0;
}
.group-hero__info { flex: 1; min-width: 0; }
.group-hero__name { font-size: 1.1rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-hero__url { font-size: 0.75rem; color: var(--color-text2); }
.group-hero__edit {
  width: 38px; height: 38px;
  background: var(--color-surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text2);
  flex-shrink: 0;
}

/* ─── Period Tabs ─────────────────────────────────────────── */
.period-tabs {
  display: flex; gap: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tab {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 0.85rem; font-weight: 700;
  white-space: nowrap;
  color: var(--color-text2);
  background: var(--color-surface);
  transition: all 0.15s;
  flex-shrink: 0;
}
.period-tab--active { background: var(--color-primary); color: #fff; }

/* ─── Stats Bar ───────────────────────────────────────────── */
.stats-bar {
  display: flex; gap: 0;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin: 0 16px;
  overflow: hidden;
}
.stats-bar__item {
  flex: 1; padding: 14px 10px; text-align: center;
  border-right: 1px solid var(--color-border);
}
.stats-bar__item:last-child { border-right: none; }
.stats-bar__val { display: block; font-size: 1.2rem; font-weight: 900; }
.stats-bar__lbl { font-size: 0.65rem; color: var(--color-text3); text-transform: uppercase; letter-spacing: .4px; }
.stats-bar__item--warn .stats-bar__val { color: var(--color-danger); }

/* ─── Promoters Section ───────────────────────────────────── */
.promoters-section { padding: 16px; }

.promoters-list { display: flex; flex-direction: column; gap: 10px; }

.promoter-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.1s;
}
.promoter-row:active { background: var(--color-surface2); }

.promoter-row__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.9rem; color: #fff;
  flex-shrink: 0;
}
.promoter-row__avatar--lg { width: 48px; height: 48px; font-size: 1rem; }

.promoter-row__info { flex: 1; min-width: 0; }
.promoter-row__info strong { display: block; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.promoter-row__slug { font-size: 0.75rem; color: var(--color-text3); font-family: monospace; }

.promoter-row__stats { flex-shrink: 0; text-align: right; }
.promoter-row__count { font-size: 1.1rem; font-weight: 900; color: var(--color-primary); }

.promoter-row__actions { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-surface2);
  border-radius: var(--radius-sm);
  color: var(--color-text2);
  transition: background 0.1s, color 0.1s;
}
.icon-btn:active { background: var(--color-primary)33; color: var(--color-primary); }

/* ─── Charts ──────────────────────────────────────────────── */
.charts-section { padding: 16px; padding-bottom: calc(24px + var(--safe-bottom)); }
.chart-wrap { height: 180px; background: var(--color-surface); border-radius: var(--radius-md); padding: 12px; }

/* ─── Bottom Sheets ───────────────────────────────────────── */
.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  z-index: 400;
  max-height: 90dvh;
  overflow-y: auto;
  padding-bottom: var(--safe-bottom);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.bottom-sheet--open { transform: translateY(0); }

.bottom-sheet__handle {
  width: 36px; height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  margin: 10px auto 6px;
}
.bottom-sheet__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 16px;
  border-bottom: 1px solid var(--color-border);
}
.bottom-sheet__title { font-weight: 800; font-size: 1.05rem; }
.bottom-sheet__close {
  width: 30px; height: 30px;
  background: var(--color-bg3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text2); font-size: 0.8rem;
}
.bottom-sheet__actions {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
}

/* ─── QR Sheet ────────────────────────────────────────────── */
.qr-sheet__body {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px 8px;
  gap: 12px;
}
.qr-canvas-wrap {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.qr-canvas-wrap img, .qr-canvas-wrap canvas { display: block !important; }
.qr-sheet__url { font-size: 0.8rem; color: var(--color-text2); word-break: break-all; text-align: center; }

/* ─── Promoter Detail Sheet ───────────────────────────────── */
.promoter-detail-header {
  display: flex; align-items: center; gap: 12px;
}
.promoter-detail-stats {
  display: flex;
  padding: 16px;
  gap: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

/* ─── Scanner Overlay ─────────────────────────────────────── */
.scanner-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: #000;
  display: flex; align-items: stretch;
}
.scanner-overlay.hidden { display: none; }

.scanner-container {
  width: 100%; display: flex; flex-direction: column;
}
.scanner-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
  color: #fff;
}
.scanner-title { font-weight: 800; font-size: 1.1rem; }
.scanner-close-btn {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  color: #fff; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}

.scanner-viewport {
  flex: 1; position: relative; overflow: hidden; background: #000;
}
#scanner-video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.scanner-reticle {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scanner-reticle::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%,
    25% 20%, 25% 80%, 75% 80%, 75% 20%, 25% 20%
  );
}
.scanner-corner {
  position: absolute;
  width: 24px; height: 24px;
  border-color: var(--color-primary); border-style: solid;
}
.scanner-corner.tl { top: calc(50% - 90px); left: calc(50% - 90px); border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; }
.scanner-corner.tr { top: calc(50% - 90px); right: calc(50% - 90px); border-width: 3px 3px 0 0; border-radius: 0 3px 0 0; }
.scanner-corner.bl { bottom: calc(50% - 90px); left: calc(50% - 90px); border-width: 0 0 3px 3px; border-radius: 0 0 0 3px; }
.scanner-corner.br { bottom: calc(50% - 90px); right: calc(50% - 90px); border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; }

.scanner-hint {
  padding: 12px 16px;
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.scanner-result {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 16px;
  animation: slideUp 0.25s ease;
}
.scanner-result__card {
  display: flex; align-items: center; gap: 12px;
  background: var(--color-bg2);
  padding: 14px; border-radius: var(--radius-md);
  flex-wrap: wrap;
}
.scanner-result__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #fff; font-size: 1rem;
  flex-shrink: 0;
}
.scanner-result__info { flex: 1; min-width: 0; }
.scanner-result__info strong { display: block; font-size: 1rem; }
.scanner-result__info span { font-size: 0.8rem; color: var(--color-text2); display: block; }
.scanner-result__info code { font-size: 0.75rem; color: var(--color-primary); }
.scanner-result__reset {
  width: 100%; margin-top: 10px;
  padding: 10px;
  background: var(--color-primary);
  color: #fff; border-radius: var(--radius-md);
  font-weight: 700;
}

/* ─── Modals (iOS-style) ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: flex-end;
  padding: 0;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal-overlay--active { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 0 0 calc(20px + var(--safe-bottom));
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal__handle {
  width: 36px; height: 5px;
  background: var(--color-border);
  border-radius: 3px;
  margin: 10px auto 0;
}
.modal__title {
  padding: 16px 20px 8px;
  font-size: 1.15rem; font-weight: 900;
}
.modal__desc {
  padding: 0 20px 12px;
  color: var(--color-text2); font-size: 0.9rem;
}
.modal__actions {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 20px 0;
}

/* ─── Settings Modal ──────────────────────────────────────── */
.settings-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex; flex-direction: column; gap: 10px;
}
.settings-section__title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; color: var(--color-text3); }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.95rem;
}
.settings-section--meta { color: var(--color-text3); font-size: 0.8rem; }

/* ─── Profile Modal ───────────────────────────────────────── */
.profile-avatar {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 20px 16px;
  gap: 10px;
}
.profile-avatar__circle {
  width: 72px; height: 72px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900; color: #fff;
}
.profile-avatar__email { color: var(--color-text2); font-size: 0.9rem; }

/* ─── Upgrade Modal ───────────────────────────────────────── */
.upgrade-modal .modal__title { color: var(--color-primary); }

.plan-table {
  width: calc(100% - 40px); margin: 0 20px 16px;
  border-collapse: collapse; font-size: 0.88rem;
}
.plan-table th, .plan-table td {
  padding: 10px 8px; text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.plan-table th { font-weight: 800; color: var(--color-text2); font-size: 0.75rem; text-transform: uppercase; }
.plan-table td:first-child, .plan-table th:first-child { text-align: left; }
.plan-table__highlight { color: var(--color-primary); font-weight: 800; }

/* ─── Forms ───────────────────────────────────────────────── */
.form-group { padding: 0 20px; margin-bottom: 14px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--color-text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--color-bg2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1rem;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: var(--color-primary); }
.form-input::placeholder { color: var(--color-text3); }
.form-input--slug { flex: 1; border-radius: 0 var(--radius-md) var(--radius-md) 0; }

.form-select {
  padding: 8px 12px;
  background: var(--color-bg2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.form-hint { font-size: 0.75rem; color: var(--color-text3); margin-top: 4px; display: block; }
.form-error { font-size: 0.85rem; color: var(--color-danger); margin-top: 6px; }

.slug-preview-wrap { display: flex; align-items: stretch; }
.slug-prefix {
  background: var(--color-bg3);
  border: 1.5px solid var(--color-border); border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  padding: 12px 10px;
  font-size: 0.8rem; color: var(--color-text3);
  white-space: nowrap;
  display: flex; align-items: center;
}

/* ─── Color Picker ────────────────────────────────────────── */
.color-picker-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.color-swatch {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.color-swatch--active { border-color: #fff; transform: scale(1.18); }
.color-custom-input {
  width: 32px; height: 32px;
  padding: 0; border: none; border-radius: 50%;
  cursor: pointer; background: none;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem; font-weight: 800;
  transition: opacity 0.15s, transform 0.12s;
  cursor: pointer;
  border: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dk); }
.btn--ghost {
  background: var(--color-surface2); color: var(--color-text);
  border: 1.5px solid var(--color-border);
}
.btn--danger { background: var(--color-danger)22; color: var(--color-danger); }
.btn--full { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: 0.85rem; border-radius: var(--radius-sm); }

/* ─── Login Screen ────────────────────────────────────────── */
.login-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, #FF4B1F18 0%, transparent 65%), var(--color-bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
}
.login-logo { font-size: 2rem; font-weight: 900; color: var(--color-primary); text-align: center; margin-bottom: 4px; }
.login-tagline { text-align: center; color: var(--color-text3); font-size: 0.85rem; margin-bottom: 28px; font-weight: 700; letter-spacing: .5px; }
.login-form .form-group { padding: 0; margin-bottom: 14px; }
.login-toggle {
  width: 100%; margin-top: 16px;
  color: var(--color-text2); font-size: 0.9rem;
  text-align: center;
  background: none; border: none; cursor: pointer;
}
.login-toggle:hover { color: var(--color-primary); }

/* ─── Onboarding ──────────────────────────────────────────── */
.onboarding-screen {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, #FF4B1F14 0%, transparent 60%), var(--color-bg);
}
.onboarding-card {
  width: 100%; max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: var(--shadow-card);
}
.onboarding-logo { font-size: 1.8rem; font-weight: 900; color: var(--color-primary); text-align: center; margin-bottom: 8px; }
.onboarding-title { text-align: center; margin-bottom: 24px; font-size: 1.3rem; }
.onboarding-form .form-group { padding: 0; margin-bottom: 16px; }

/* ─── Loading Spinner ─────────────────────────────────────── */
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  margin: 48px auto;
  animation: spin 0.7s linear infinite;
}

/* ─── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: calc(20px + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--color-surface2);
  color: var(--color-text);
  padding: 11px 20px;
  border-radius: 20px;
  font-size: 0.9rem; font-weight: 700;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0; transform: translateY(12px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
  white-space: nowrap;
}
.toast--show { opacity: 1; transform: translateY(0) scale(1); }

/* ─── Limit Reached Banner ────────────────────────────────── */
.limit-banner {
  margin: 12px 16px;
  padding: 12px 14px;
  background: var(--color-danger)18;
  border: 1px solid var(--color-danger)44;
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: 0.88rem; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (min-width: 640px) {
  .modal { max-width: 480px; margin: auto; border-radius: var(--radius-xl); }
  .modal-overlay { align-items: center; }
  .bottom-sheet { max-width: 560px; left: 50%; transform: translateX(-50%) translateY(100%); }
  .bottom-sheet--open { transform: translateX(-50%) translateY(0); }
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg:       #F2F2F7;
    --color-bg2:      #FFFFFF;
    --color-bg3:      #E5E5EA;
    --color-surface:  #FFFFFF;
    --color-surface2: #F2F2F7;
    --color-border:   rgba(0,0,0,0.1);
    --color-text:     #1c1c1e;
    --color-text2:    #636366;
    --color-text3:    #aeaeb2;
  }
}
