:root {
  --bg: #faf7f1;
  --surface: #ffffff;
  --surface-2: #f3eee5;
  --ink: #1a1814;
  --ink-2: #4a4540;
  --muted: #8a847b;
  --line: #ebe4d7;
  --line-strong: #d8cfbe;
  --brand: #2f5d4f;
  --brand-2: #234539;
  --gold: #a86b1e;
  --rose: #b14771;

  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 22px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10), 0 24px 60px rgba(0,0,0,0.08);

  --topbar-h: 56px;
  --actionbar-h: 64px;

  --container: 980px;
  --container-narrow: 720px;

  --font-body: 'Tajawal', system-ui, -apple-system, 'Segoe UI', 'Cairo', Tahoma, sans-serif;
  --font-serif: 'Amiri', 'Tajawal', Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0c;
    --surface: #141418;
    --surface-2: #1c1c22;
    --ink: #fafafa;
    --ink-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #27272a;
    --line-strong: #3f3f46;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow:    0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5), 0 24px 60px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

h1, h2, h3, h4, h5 { line-height: 1.25; margin: 0; color: var(--ink); }
p { margin: 0 0 0.8em; color: var(--ink-2); }

/* ─── Top bar ────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--container); margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark {
  background: var(--ink); color: var(--bg);
  font-family: var(--font-serif);
  font-weight: 700; font-size: 0.78rem;
  padding: 4px 9px; border-radius: 4px;
  letter-spacing: 0.5px;
}
.brand-title { font-weight: 700; font-size: 0.95rem; color: var(--ink); }

.owner-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 999px; font-size: 0.95rem;
}

/* ─── Toast ──────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 0.88rem; font-weight: 600;
  z-index: 200; opacity: 0; transition: opacity 0.18s, transform 0.18s;
  max-width: 90%; text-align: center;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast.is-error { background: #b91c1c; color: #fff; }

/* ─── Container helper ───────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 16px; }

/* When a plan-detail bottom action bar is showing, pad page bottom */
body.has-actionbar #app { padding-bottom: calc(var(--actionbar-h) + 32px + env(safe-area-inset-bottom)); }

/* Small util classes */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
