/* =====================================================================
   AFODABO DESIGN SYSTEM
   - data-ui="glass" | "classic"   (glassmorphism au muonekano wa kawaida)
   - data-mode="light" | "dark" | "system"
   Rangi kuu (--primary, --accent, --highlight), blur, opacity na radius
   zinatoka Admin Panel → Muonekano (zinawekwa kwenye <head>).
   ===================================================================== */

@font-face { font-family: "Jakarta"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Jakarta"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Jakarta"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Jakarta"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Jakarta"; font-weight: 800; font-display: swap; src: url("../vendor/fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }

/* ---------- Tokens: LIGHT (default) ---------- */
:root {
  --primary: #2f7a38;
  --accent: #7ac142;
  --highlight: #f59e0b;
  --danger: #e11d48;
  --info: #0ea5e9;
  --radius: 18px;
  --radius-sm: calc(var(--radius) * .6);
  --blur: 18px;
  --glass-a: .55;

  --bg: #eef4ef;
  --text: #0f1f17;
  --muted: #5d6d64;
  --faint: #8a998f;
  --surface: rgba(255, 255, 255, var(--glass-a));
  --surface-strong: rgba(255, 255, 255, .82);
  --surface-hover: rgba(255, 255, 255, .7);
  --field: rgba(255, 255, 255, .62);
  --border: rgba(255, 255, 255, .7);
  --line: rgba(15, 31, 23, .09);
  --shadow: 0 10px 40px -12px rgba(20, 60, 35, .22), 0 2px 6px rgba(20, 60, 35, .06);
  --shadow-lg: 0 30px 80px -20px rgba(20, 60, 35, .35);
  --glass-filter: blur(var(--blur)) saturate(170%);
  --primary-soft: color-mix(in srgb, var(--primary) 13%, transparent);
  --on-primary: #fff;
  --topbar-h: 64px;
  color-scheme: light;
}

/* ---------- Tokens: DARK ---------- */
html[data-mode="dark"] {
  --bg: #07130d;
  --text: #e6efe9;
  --muted: #9db1a5;
  --faint: #6f8479;
  --surface: rgba(18, 30, 23, var(--glass-a));
  --surface-strong: rgba(20, 34, 26, .9);
  --surface-hover: rgba(40, 60, 48, .55);
  --field: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .08);
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --primary-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-mode="system"] {
    --bg: #07130d; --text: #e6efe9; --muted: #9db1a5; --faint: #6f8479;
    --surface: rgba(18, 30, 23, var(--glass-a)); --surface-strong: rgba(20, 34, 26, .9);
    --surface-hover: rgba(40, 60, 48, .55); --field: rgba(255, 255, 255, .06);
    --border: rgba(255, 255, 255, .10); --line: rgba(255, 255, 255, .08);
    --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6); --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .8);
    --primary-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    color-scheme: dark;
  }
}

/* ---------- CLASSIC (sio glass) ---------- */
html[data-ui="classic"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-hover: #f2f3f5;
  --field: #f0f2f5;
  --border: #e3e6ea;
  --shadow: 0 1px 2px rgba(0, 0, 0, .08);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, .18);
  --glass-filter: none;
}
html[data-ui="classic"][data-mode="dark"] {
  --bg: #18191a; --surface: #242526; --surface-strong: #242526; --surface-hover: #3a3b3c;
  --field: #3a3b3c; --border: #3a3b3c; --line: #3a3b3c; --text: #e4e6eb; --muted: #b0b3b8; --faint: #8a8d91;
}
@media (prefers-color-scheme: dark) {
  html[data-ui="classic"][data-mode="system"] {
    --bg: #18191a; --surface: #242526; --surface-strong: #242526; --surface-hover: #3a3b3c;
    --field: #3a3b3c; --border: #3a3b3c; --line: #3a3b3c; --text: #e4e6eb; --muted: #b0b3b8; --faint: #8a8d91;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.5 "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .85rem; }
.xs { font-size: .75rem; }
.bold { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[x-cloak] { display: none !important; }

/* Background ya glass: mesh ya rangi */
.app-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
html[data-ui="glass"] .app-bg::before, html[data-ui="glass"] .app-bg::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75;
}
html[data-ui="glass"] .app-bg::before {
  width: 60vmax; height: 60vmax; left: -15vmax; top: -20vmax;
  background: radial-gradient(circle, var(--accent), transparent 65%);
}
html[data-ui="glass"] .app-bg::after {
  width: 55vmax; height: 55vmax; right: -18vmax; bottom: -22vmax;
  background: radial-gradient(circle, var(--highlight), transparent 62%); opacity: .5;
}
html[data-ui="glass"] .app-bg .blob {
  position: absolute; width: 42vmax; height: 42vmax; right: 12vmax; top: 8vmax; border-radius: 50%;
  background: radial-gradient(circle, var(--primary), transparent 65%); filter: blur(90px); opacity: .45;
}
html[data-ui="glass"] .app-bg.has-image { background-size: cover; background-position: center; }
html[data-ui="glass"] .app-bg.has-image::before, html[data-ui="glass"] .app-bg.has-image::after, html[data-ui="glass"] .app-bg.has-image .blob { display: none; }
html[data-ui="glass"] .app-bg.plain::before, html[data-ui="glass"] .app-bg.plain::after, html[data-ui="glass"] .app-bg.plain .blob { display: none; }
html[data-ui="classic"] .app-bg .blob { display: none; }

/* ---------- Surfaces ---------- */
.card, .glass {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
}
.card { padding: 18px; }
.card + .card { margin-top: 16px; }
:is(.grid, .grid-2, .grid-3, .grid-4, .row, .row-top, .stack, .stack-sm) > .card + .card { margin-top: 0; }
.stack > * + .card { margin-top: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid transparent; background: var(--field); color: var(--text);
  font-weight: 700; font-size: .92rem; cursor: pointer; transition: transform .12s, background .2s, box-shadow .2s, opacity .2s;
  white-space: nowrap; text-decoration: none; line-height: 1.2;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: scale(.97); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-accent { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
html[data-mode="dark"] .btn-soft { color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-outline { background: transparent; border-color: var(--line); }
.btn-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 1.15rem; }
.btn-icon.sm { width: 32px; height: 32px; font-size: .95rem; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--field); cursor: pointer; font-size: 1.2rem; }
.icon-btn:hover { background: var(--surface-hover); }
.dot-badge { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.help { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--field); outline: none; transition: border .2s, box-shadow .2s;
}
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon > .input { padding-left: 40px; }
.pill-input { border-radius: 999px; }
.error { color: var(--danger); font-size: .8rem; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
input[type="color"] { width: 52px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); cursor: pointer; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--line); border-radius: 26px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Segmented control */
.segmented { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); gap: 2px; }
.segmented label, .segmented a { padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); }
.segmented input { display: none; }
.segmented input:checked + span, .segmented .active { background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow); }
.segmented label span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; margin: -7px -14px; border-radius: 999px; }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--field); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip:hover { background: var(--surface-hover); }
.chip.active { background: var(--primary); color: #fff; border-color: transparent; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent); color: var(--c, var(--primary)); }
html[data-mode="dark"] .tag { background: color-mix(in srgb, var(--c, var(--accent)) 22%, transparent); filter: brightness(1.3); }
.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-active, .status-approved, .status-published, .status-resolved { background: #dcfce7; color: #166534; }
.status-rejected, .status-removed, .status-cancelled { background: #ffe4e6; color: #9f1239; }
.status-expired, .status-hidden, .status-paused, .status-dismissed, .status-completed, .status-open { background: #e2e8f0; color: #334155; }
.status-open { background: #fee2e2; color: #991b1b; }

/* Green Tick */
.tick { display: inline-flex; color: var(--primary); font-size: .95em; vertical-align: -1px; margin-left: 3px; cursor: help; }
html[data-mode="dark"] .tick { color: var(--accent); }
.tick.lg { font-size: 1.3rem; }
.plan-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: .66rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: var(--c, var(--primary)); margin-left: 6px; vertical-align: 2px; }

/* ---------- Avatars ---------- */
.avatar { --size: 40px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center; font-weight: 800; font-size: calc(var(--size) * .38); color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { --size: 28px; } .avatar.sm { --size: 34px; } .avatar.md { --size: 48px; } .avatar.lg { --size: 64px; } .avatar.xl { --size: 128px; }
.ring { padding: 3px; border-radius: 50%; background: conic-gradient(from 210deg, var(--highlight), var(--accent), var(--primary), var(--highlight)); display: inline-grid; }
.ring > .avatar { border: 3px solid var(--bg); }
.ring.seen { background: var(--line); }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
}
html[data-ui="glass"] .topbar { background: color-mix(in srgb, var(--surface-strong) 60%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; flex: none; }
.brand img.logo { height: 30px; width: auto; }
html[data-mode="dark"] .brand img.logo { filter: brightness(1.35) saturate(1.1); }
.brand img.icon { height: 34px; width: 34px; display: none; }
@media (max-width: 600px) {
  .topbar .brand img.logo { display: none; }
  .topbar .brand img.icon { display: block; }
  .topbar .icon-btn { width: 38px; height: 38px; font-size: 1.1rem; }
  .composer-actions button { font-size: .8rem; white-space: nowrap; padding: 8px 4px; gap: 5px; }
  .post-head { padding: 12px 12px 8px; } .post-body { padding: 0 12px 10px; } .trade { margin: 0 12px 10px; }
}
.topbar .search { flex: 1; max-width: 460px; margin: 0 auto; }
.topbar .search .input { border-radius: 999px; background: var(--field); }
.topbar .actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.shell { display: grid; grid-template-columns: 260px minmax(0, 640px) 330px; gap: 28px; justify-content: center; padding: 20px 20px 90px; max-width: 1340px; margin: 0 auto; }
.shell.wide { grid-template-columns: 260px minmax(0, 1fr); }
.side-left, .side-right { position: sticky; top: calc(var(--topbar-h) + 20px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; scrollbar-width: thin; }
.main { min-width: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-radius: 14px; font-weight: 600; color: var(--text); transition: background .15s; }
.nav a i { font-size: 1.3rem; width: 24px; text-align: center; }
.nav a:hover { background: var(--surface-hover); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
html[data-mode="dark"] .nav a.active { color: var(--accent); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.nav .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .72rem; }
.bottom-nav { display: none; }

@media (max-width: 1240px) { .shell { grid-template-columns: 240px minmax(0, 640px); } .side-right { display: none; } }
@media (max-width: 900px) {
  .shell, .shell.wide { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 90px; }
  .side-left { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .search, .topbar .hide-sm { display: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; justify-content: space-around; align-items: center;
    height: 64px; padding-bottom: env(safe-area-inset-bottom); background: var(--surface-strong); border-top: 1px solid var(--border);
    -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  }
  html[data-ui="glass"] .bottom-nav { background: color-mix(in srgb, var(--surface-strong) 70%, transparent); }
  .bottom-nav a { display: grid; place-items: center; width: 52px; height: 48px; font-size: 1.45rem; color: var(--muted); border-radius: 14px; position: relative; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.create { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; width: 48px; height: 40px; border-radius: 14px; font-size: 1.25rem; }
  .bottom-nav .dot-badge { top: 4px; right: 6px; }
}
@media (min-width: 901px) { .show-sm { display: none !important; } }

/* ---------- Dropdown (details) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown .menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 60; padding: 6px;
  background: var(--surface-strong); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
}
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: .9rem; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-hover); }
.menu .danger { color: var(--danger); }
.menu hr { margin: 6px 4px; }

/* ---------- Stories ---------- */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 14px 16px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex: none; cursor: pointer; border: 0; background: none; padding: 0; }
.story .name { font-size: .72rem; font-weight: 600; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story .avatar { --size: 62px; }
.story .add { position: relative; }
.story .add .plus { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .8rem; border: 2px solid var(--bg); }

.story-viewer { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .92); display: grid; place-items: center; }
.story-viewer .frame { position: relative; width: min(420px, 100vw); height: min(760px, 100vh); border-radius: 20px; overflow: hidden; background: #000; }
.story-viewer .frame img { width: 100%; height: 100%; object-fit: contain; }
.story-viewer .bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.story-viewer .bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.story-viewer .bars span i { display: block; height: 100%; width: 0; background: #fff; }
.story-viewer .who { position: absolute; top: 22px; left: 14px; right: 14px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 2; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.story-viewer .caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 22px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); font-weight: 600; }
.story-viewer .nav-l, .story-viewer .nav-r { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 1; cursor: pointer; }
.story-viewer .nav-l { left: 0; } .story-viewer .nav-r { right: 0; }
.story-viewer .close { position: absolute; top: 18px; right: 18px; z-index: 3; color: #fff; font-size: 1.6rem; background: none; border: 0; cursor: pointer; }

/* ---------- Composer ---------- */
.composer { display: flex; align-items: center; gap: 12px; }
.composer .fake-input { flex: 1; padding: 12px 18px; border-radius: 999px; background: var(--field); color: var(--muted); cursor: pointer; border: 1px solid var(--line); }
.composer-actions { display: flex; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer-actions button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; border-radius: 12px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); font-size: .88rem; }
.composer-actions button:hover { background: var(--surface-hover); }
.type-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.type-picker input { display: none; }
.type-picker label span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); font-weight: 600; font-size: .83rem; cursor: pointer; }
.type-picker input:checked + span { background: var(--c, var(--primary)); color: #fff; border-color: transparent; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); text-align: center; }
.dropzone:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Post card ---------- */
.post { padding: 0; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .name { font-weight: 700; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.post-head .meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.post-body { padding: 0 16px 12px; white-space: pre-line; word-wrap: break-word; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.more-link { padding: 0 16px 10px; margin-top: -6px; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; background: none; border: 0; }
.trade { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 16px 12px; }
.trade .item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--primary-soft); font-weight: 700; font-size: .88rem; }
.trade .item small { display: block; font-weight: 600; color: var(--muted); font-size: .7rem; line-height: 1; }
.trade .item i { color: var(--primary); font-size: 1.1rem; }
html[data-mode="dark"] .trade .item i { color: var(--accent); }
.media { position: relative; background: #0b140f; }
.media .track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.media .track::-webkit-scrollbar { display: none; }
.media .track img { flex: none; width: 100%; max-height: 620px; aspect-ratio: 4 / 5; object-fit: cover; scroll-snap-align: center; }
.media .track.single img { aspect-ratio: auto; max-height: 680px; object-fit: contain; background: #0b140f; }
.media .dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; gap: 5px; justify-content: center; }
.media .dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.media .dots span.on { background: #fff; }
.media .count { position: absolute; top: 12px; right: 12px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; font-weight: 700; }
.post-actions { display: flex; align-items: center; gap: 4px; padding: 8px 10px 2px; }
.post-actions .act { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; border: 0; background: none; cursor: pointer; font-size: 1.35rem; color: var(--text); }
.post-actions .act span { font-size: .85rem; font-weight: 700; }
.post-actions .act:hover { background: var(--surface-hover); }
.post-actions .act.liked { color: var(--danger); }
.post-actions .act.saved { color: var(--primary); }
.post-actions .act.liked i { animation: pop .35s ease; }
@keyframes pop { 50% { transform: scale(1.3); } }
.post-actions .spacer { flex: 1; }
.post-stats { padding: 0 16px 6px; font-size: .86rem; font-weight: 700; }
.post-comments { padding: 0 16px 8px; font-size: .9rem; }
.post-comments .c { margin-bottom: 4px; }
.post-comments .c b { margin-right: 6px; }
.comment-form { display: flex; align-items: center; gap: 10px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.comment-form input { flex: 1; border: 0; background: none; outline: none; padding: 6px 0; }
.comment-form button { border: 0; background: none; color: var(--primary); font-weight: 800; cursor: pointer; }
.sponsored-label { font-size: .72rem; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.cta-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--primary-soft); font-weight: 700; }

.comments-list .comment { display: flex; gap: 10px; margin-bottom: 14px; }
.comments-list .bubble { background: var(--field); border-radius: 16px; padding: 8px 14px; }
.comments-list .bubble .n { font-weight: 700; font-size: .86rem; }

/* ---------- Profile ---------- */
.profile-cover { height: 240px; background: linear-gradient(135deg, var(--primary), var(--accent)); background-size: cover; background-position: center; border-radius: var(--radius) var(--radius) 0 0; position: relative; }
.profile-cover::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(transparent 50%, rgba(0,0,0,.25)); }
.profile-head { padding: 0 24px 20px; position: relative; }
.profile-head .avatar-wrap { margin-top: -64px; position: relative; z-index: 2; display: inline-block; border-radius: 50%; padding: 5px; background: var(--surface-strong); }
.profile-head .top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.profile-head .buttons { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.profile-name { font-size: 1.55rem; font-weight: 800; margin: 10px 0 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.profile-stats { display: flex; gap: 26px; margin: 14px 0; }
.profile-stats b { font-size: 1.1rem; display: block; }
.profile-stats span { color: var(--muted); font-size: .82rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 14px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--primary); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.post-grid a { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--field); display: block; }
.post-grid a img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.post-grid a:hover img { transform: scale(1.05); }
.post-grid .text-tile { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 14px; text-align: center; font-weight: 700; font-size: .85rem; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 85%, #000), var(--accent)); color: #fff; overflow: hidden; }
.post-grid .overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 18px; color: #fff; font-weight: 800; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .2s; }
.post-grid a:hover .overlay { opacity: 1; }
.post-grid .multi { position: absolute; top: 8px; right: 8px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
@media (max-width: 600px) { .profile-cover { height: 150px; } .profile-head { padding: 0 16px 16px; } .profile-head .avatar-wrap .avatar { --size: 96px; } .profile-head .avatar-wrap { margin-top: -50px; } }

/* ---------- Side widgets ---------- */
.mini-user { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.mini-user .n { font-weight: 700; font-size: .9rem; display: flex; align-items: center; }
.mini-user .s { font-size: .76rem; color: var(--muted); }
.promo { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 92%, #000), var(--accent)); color: #fff; border: 0; }
.promo .muted { color: rgba(255, 255, 255, .85); }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; color: var(--faint); padding: 8px 4px; }
.footer-links a:hover { text-decoration: underline; }

/* ---------- Lists / tables ---------- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { background: var(--primary-soft); }
.list-item:hover { background: var(--surface-hover); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-hover); }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty i { font-size: 2.6rem; display: block; margin-bottom: 8px; opacity: .6; }

/* ---------- Pricing ---------- */
.price-card { position: relative; display: flex; flex-direction: column; gap: 14px; }
.price-card.hl { border: 2px solid var(--primary); transform: translateY(-6px); }
.price-card .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; padding: 4px 14px; border-radius: 999px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.price { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.price { white-space: nowrap; }
.price small { font-size: .85rem; color: var(--muted); font-weight: 600; }
.price-card .price small { display: block; margin-top: 2px; }
.features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.features li { display: flex; gap: 8px; align-items: flex-start; }
.features li i.bi-check-circle-fill { color: var(--primary); }
.features li i.bi-x-circle { color: var(--faint); }

/* ---------- Messages ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 60px); min-height: 420px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; padding: 9px 14px; border-radius: 18px; background: var(--field); align-self: flex-start; white-space: pre-line; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.them { border-bottom-left-radius: 6px; }
.msg time { display: block; font-size: .66rem; opacity: .7; margin-top: 2px; }
.chat-form { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .chat { height: calc(100vh - var(--topbar-h) - 100px); } }

/* ---------- Modal (native dialog) ---------- */
dialog.modal { border: 0; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border-radius: calc(var(--radius) + 4px); background: var(--surface-strong); color: var(--text); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); border: 1px solid var(--border); }
dialog.modal::backdrop { background: rgba(5, 15, 10, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: rise .22s ease; }
@keyframes rise { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100vh - 200px); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toasts / alerts ---------- */
.toasts { position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; font-weight: 600; animation: rise .25s ease; -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); }
.toast.success i { color: var(--primary); } .toast.error i { color: var(--danger); }
.alert { padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert-info { background: color-mix(in srgb, var(--info) 12%, transparent); }
.alert-warn { background: color-mix(in srgb, var(--highlight) 16%, transparent); }
.alert-success { background: var(--primary-soft); }
.alert-danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; display: grid; place-items: center; background: var(--field); font-weight: 700; font-size: .85rem; }
.pagination .active { background: var(--primary); color: #fff; }
.pagination .disabled { opacity: .45; }

/* ---------- Auth & landing ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; position: relative; overflow: hidden; background: linear-gradient(145deg, color-mix(in srgb, var(--primary) 95%, #000), var(--accent)); }
.auth-side .bg-img { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .28; mix-blend-mode: overlay; }
.auth-side > * { position: relative; }
.auth-side h1 { font-size: 2.6rem; line-height: 1.1; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(460px, 100%); padding: 32px; }
.float-card { position: absolute; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.acct-types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.acct-types input { display: none; }
.acct-types label > span { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); cursor: pointer; height: 100%; transition: .15s; }
.acct-types label > span i { font-size: 1.4rem; color: var(--c); }
.acct-types label > span b { font-size: .9rem; }
.acct-types label > span small { color: var(--muted); font-size: .72rem; line-height: 1.3; }
.acct-types input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

.landing-nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; margin: 12px auto 0; max-width: 1200px; border-radius: 999px; }
.hero { max-width: 1200px; margin: 0 auto; padding: 70px 24px 40px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 540px; }
.hero-visual { position: relative; min-height: 460px; }
.hero-visual .phone { position: absolute; right: 30px; top: 0; width: 300px; padding: 12px; border-radius: 34px; }
.hero-visual .phone img { border-radius: 16px; aspect-ratio: 4/5; object-fit: cover; }
.hero-visual .float-card { color: var(--text); background: var(--surface-strong); border-color: var(--border); box-shadow: var(--shadow-lg); }
.section { max-width: 1200px; margin: 0 auto; padding: 50px 24px; }
.feature-card i { font-size: 1.6rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); color: var(--primary); margin-bottom: 12px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding-top: 40px; } .hero-visual { min-height: 400px; } .hero-visual .phone { right: auto; left: 50%; transform: translateX(-50%); } .landing-nav { margin: 8px; } }

/* ---------- Page content (CMS) ---------- */
.prose { line-height: 1.7; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose .note { padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--highlight) 16%, transparent); }

/* ---------- Admin ---------- */
.admin-shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
.admin-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px; border-right: 1px solid var(--border); background: var(--surface); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); }
.admin-side .nav a { padding: 9px 12px; font-size: .9rem; }
.admin-side .nav a i { font-size: 1.1rem; }
.admin-side .group { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 14px 4px; }
.admin-main { padding: 24px 28px 60px; min-width: 0; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-top h1 { margin: 0; font-size: 1.5rem; }
.stat { display: flex; gap: 14px; align-items: center; }
.stat .ic { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem; background: color-mix(in srgb, var(--c, var(--primary)) 14%, transparent); color: var(--c, var(--primary)); flex: none; }
.stat b { font-size: 1.5rem; display: block; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bar-chart .b { flex: 1; background: linear-gradient(to top, var(--primary), var(--accent)); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; }
.bar-chart .b span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: .65rem; color: var(--muted); white-space: nowrap; }
.perm-matrix td, .perm-matrix th { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.admin-burger { display: none; }
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; z-index: 70; left: 0; width: 280px; transform: translateX(-100%); transition: transform .25s; background: var(--surface-strong); }
  .admin-side.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-main { padding: 16px 14px 60px; }
  .admin-burger { display: inline-grid; }
}

/* Theme switcher preview swatches */
.ui-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ui-choice input { display: none; }
.ui-choice label > span { display: block; padding: 10px; border-radius: 16px; border: 2px solid var(--line); cursor: pointer; }
.ui-choice input:checked + span { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.swatch { height: 86px; border-radius: 12px; position: relative; overflow: hidden; margin-bottom: 8px; }
.swatch.glass { background: radial-gradient(circle at 20% 20%, var(--accent), transparent 55%), radial-gradient(circle at 85% 80%, var(--highlight), transparent 50%), #dfeee2; }
.swatch.classic { background: #f0f2f5; }
.swatch i { position: absolute; left: 14px; right: 14px; height: 18px; border-radius: 6px; }
.swatch i:nth-child(1) { top: 14px; } .swatch i:nth-child(2) { top: 40px; right: 40px; } .swatch i:nth-child(3) { top: 62px; right: 70px; height: 10px; }
.swatch.glass i { background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.8); backdrop-filter: blur(6px); }
.swatch.classic i { background: #fff; border: 1px solid #e3e6ea; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
