/* ==========================================================================
   Antibuy — design tokens, reset, shell, type, buttons
   Theme "crimson" = client reference (Bahrain / Qatar flag red on warm white)
   Theme "emerald" = our own direction (Gulf emerald + sand gold)
   ========================================================================== */

:root {
  --brand: #C8102E;
  --brand-ink: #8E0A20;
  --brand-soft: #F8E5E8;
  --accent: #C9A227;
  --ink: #17130F;
  --ink-2: #4C433B;
  --muted: #8B8078;
  --paper: #FBF8F3;
  --card: #FFFFFF;
  --sand: #F1E8DA;
  --sand-2: #E7DBC8;
  --line: #EDE3D5;
  --ok: #1F7A4D;
  --warn: #B4721A;
  --danger: #C8102E;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow-1: 0 1px 2px rgba(23, 19, 15, .05);
  --shadow-2: 0 18px 44px -26px rgba(23, 19, 15, .45);
  --shadow-3: 0 10px 30px -18px rgba(23, 19, 15, .28);
  --serif: 'Didot', 'Bodoni MT', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans Arabic', Arial, sans-serif;
  --topbar-h: 58px;
  --tab-h: 68px;
}

[data-theme="emerald"] {
  --brand: #0F5F53;
  --brand-ink: #0A4038;
  --brand-soft: #E2EEE9;
  --accent: #C08A3E;
  --ink: #13201D;
  --ink-2: #45524D;
  --muted: #7E8A84;
  --paper: #F7F3EA;
  --card: #FFFDF8;
  --sand: #EBE2D2;
  --sand-2: #DFD3BE;
  --line: #E4DACA;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #E9E1D5;
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(200, 16, 46, .10), transparent 62%),
    radial-gradient(760px 480px at 96% 104%, rgba(176, 141, 87, .18), transparent 60%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
[data-theme="emerald"] body {
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(15, 95, 83, .13), transparent 62%),
    radial-gradient(760px 480px at 96% 104%, rgba(192, 138, 62, .18), transparent 60%);
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
svg { flex: none; }
/* 兜底：任何没有专门规则的图标都按 18px 线性图标渲染，避免 svg 默认 300x150 撑破布局 */
svg:not(.sprite) {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
svg.sprite { width: 0 !important; height: 0 !important; position: absolute; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ shell */
.stage { height: 100vh; display: flex; align-items: center; justify-content: center; padding: 0; }
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background .35s ease;
}
@media (min-width: 620px) {
  .stage { padding: 20px; }
  .app {
    height: min(900px, calc(100vh - 40px));
    border-radius: 34px;
    box-shadow: 0 40px 90px -40px rgba(23, 19, 15, .55), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  }
}
.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tab-h) + 18px);
  outline: none;
  /* 纵向弹性列：内容不足一屏时，页内结算条仍贴住底部而不是浮在中间 */
  display: flex;
  flex-direction: column;
}
.view > * { flex: 0 0 auto; }
.view > .actionbar { margin-top: auto; }
/* 页内有吸底结算条时：底部只留一点呼吸位，多余留白交给 sticky 处理 */
.view:has(> .actionbar) { padding-bottom: 0; }
/* actionbar 自身留出安全区，避免与 tabbar 之间露出页面底色 */
.view > .actionbar { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.view::-webkit-scrollbar { width: 0; }
/* 有页面级吸底条时，底部留白只需一点点（tabbar 已被吸底条顶上去了） */
body[data-pagebar="1"] .view { padding-bottom: 10px; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 8px 14px;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
}
.topbar.is-stuck { border-bottom-color: var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(14px); }
.brandmark { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; gap: 3px; }
.brandmark .word { font-family: var(--serif); font-size: 21px; letter-spacing: .14em; font-weight: 600; color: var(--ink); }
.brandmark .sub { font-size: 8px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.topbar .grow { flex: 1; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 999px; color: var(--ink);
  position: relative;
  transition: background .18s, transform .18s;
}
.icon-btn:active { transform: scale(.92); background: var(--sand); }
.icon-btn svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot {
  position: absolute; top: 4px; inset-inline-end: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--paper);
}

/* ----------------------------------------------------------------- tabbar */
.tabbar {
  position: relative;
  z-index: 30;
  height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  height: 100%; justify-content: center;
  transition: color .18s;
}
.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--brand); }
.tab.active svg { stroke-width: 2; }
.tab.center { position: relative; }
.tab.center .fab {
  width: 48px; height: 48px; margin-top: -24px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--brand) 65%, transparent);
  transition: transform .2s;
}
.tab.center .fab svg { stroke-width: 1.9; }
.tab.center.active .fab { transform: translateY(-2px) scale(1.03); }
.tab.center span { margin-top: 1px; }

/* ------------------------------------------------------------------- type */
.h1 { font-family: var(--serif); font-size: 26px; line-height: 1.15; letter-spacing: -.01em; font-weight: 600; }
.h2 { font-family: var(--serif); font-size: 21px; line-height: 1.2; font-weight: 600; }
.h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.sec-title { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.center-t { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }

/* ----------------------------------------------------------------- layout */
.pad { padding-inline: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.section { padding-top: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding-inline: 16px; margin-bottom: 12px; }
.link { color: var(--brand); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px;
  border-radius: 999px;
  font-size: 14px; font-weight: 650; letter-spacing: .01em;
  background: var(--sand); color: var(--ink);
  transition: transform .16s, background .2s, opacity .2s;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.975); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-outline { background: transparent; border: 1.4px solid var(--line); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 12.5px; }
.btn-lg { height: 52px; font-size: 15px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-mini {
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-mini svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-mini.alt { background: var(--brand); }
