/* =========================================================
   Master Amoozesh — Design System (ds.css)
   Palette: #5E1B8A #7B2CBF #9D4EDD #C05AD6 #E16BAE #F88D5A #F7B733 #FCD34D #FDE68A #FFF24D
   Every page uses these tokens + components. Page CSS lives in css/pages/*.css
   ========================================================= */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-VF.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Estedad";
  src: url("../fonts/Estedad-VF.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* brand palette (from the supplied swatch) */
  --c-1: #5E1B8A; --c-2: #7B2CBF; --c-3: #9D4EDD; --c-4: #C05AD6; --c-5: #E16BAE;
  --c-6: #F88D5A; --c-7: #F7B733; --c-8: #FCD34D; --c-9: #FDE68A; --c-10: #FFF24D;

  --grad-brand: linear-gradient(115deg, var(--c-1) 0%, var(--c-3) 28%, var(--c-5) 55%, var(--c-6) 78%, var(--c-7) 100%);
  --grad-primary: linear-gradient(120deg, var(--c-2), var(--c-4));
  --grad-hot: linear-gradient(120deg, var(--c-4), var(--c-5) 45%, var(--c-6));
  --grad-sun: linear-gradient(120deg, var(--c-6), var(--c-7) 55%, var(--c-8));

  --font: "Vazirmatn", "Estedad", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 68px;
  --bar-h: 68px;
  --maxw: 1180px;

  /* light theme */
  --bg: #fbf8ff;
  --bg-soft: #f3ecfb;
  --surface: #ffffff;
  --surface-2: #f6f0fc;
  --surface-3: #ece1f8;
  --ink: #1a0b2a;
  --ink-2: #463758;
  --muted: #6f6082;
  --line: rgba(94, 27, 138, .13);
  --line-strong: rgba(94, 27, 138, .26);
  --accent: var(--c-2);          /* readable accent text on bg */
  --accent-soft: rgba(123, 44, 191, .10);
  --on-grad: #ffffff;
  --shadow-1: 0 1px 2px rgba(60, 20, 90, .06), 0 8px 24px -12px rgba(60, 20, 90, .18);
  --shadow-2: 0 2px 6px rgba(60, 20, 90, .08), 0 28px 60px -24px rgba(94, 27, 138, .38);
  --glass: rgba(255, 255, 255, .72);
  --ok: #17803d; --ok-bg: rgba(23, 128, 61, .12);
  --warn: #a45a00; --warn-bg: rgba(247, 183, 51, .22);
  --bad: #c2234a; --bad-bg: rgba(225, 107, 174, .18);
  --info: #5E1B8A; --info-bg: rgba(157, 78, 221, .14);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0d0617;
  --bg-soft: #140a24;
  --surface: #170b27;
  --surface-2: #1f1035;
  --surface-3: #2a1747;
  --ink: #f7f1ff;
  --ink-2: #d3c5e8;
  --muted: #a18fbd;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .22);
  --accent: var(--c-3);
  --accent-soft: rgba(157, 78, 221, .18);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .5), 0 30px 70px -24px rgba(157, 78, 221, .5);
  --glass: rgba(23, 11, 39, .72);
  --ok: #5fd68a; --ok-bg: rgba(95, 214, 138, .14);
  --warn: #FCD34D; --warn-bg: rgba(247, 183, 51, .16);
  --bad: #ff8fbf; --bad-bg: rgba(225, 107, 174, .18);
  --info: #d7b0ff; --info-bg: rgba(157, 78, 221, .22);
  color-scheme: dark;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.85; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip; /* clip (not hidden) so position: sticky scenes keep working */
}
main { overflow-x: clip; } /* rotated/scaled decorations must never widen the page; clip keeps sticky working */
img, svg, video { max-width: 100%; }
img { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 800; letter-spacing: -.01em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--c-4); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--c-8); color: #2a0f40; }
[hidden] { display: none !important; }
.svg-icon { flex: none; vertical-align: middle; }
.svg-arrow-left, .svg-arrow-up-left { /* RTL: arrows already point left */ }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; white-space: nowrap; }
.skip-link { position: fixed; top: -80px; right: 12px; z-index: 999; background: var(--c-1); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); transition: top .2s; }
.skip-link:focus { top: 12px; }

/* ---------- layout ---------- */
.container { width: min(100% - 32px, var(--maxw)); margin-inline: auto; }
.section { padding-block: clamp(56px, 9vw, 112px); position: relative; }
.section-tight { padding-block: clamp(32px, 5vw, 56px); }
.stack > * + * { margin-top: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.grid { display: grid; gap: var(--gap, 20px); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.text-muted { color: var(--muted); } .text-accent { color: var(--accent); } .text-center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- type ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grad-hot); box-shadow: 0 0 0 4px rgba(225,107,174,.2); }
.display { font-size: clamp(38px, 7.2vw, 84px); font-weight: 900; line-height: 1.18; letter-spacing: -.02em; }
.h1 { font-size: clamp(30px, 4.6vw, 52px); font-weight: 900; }
.h2 { font-size: clamp(26px, 3.6vw, 42px); font-weight: 900; }
.h3 { font-size: clamp(19px, 2vw, 24px); }
.lead { font-size: clamp(16px, 1.7vw, 20px); color: var(--ink-2); line-height: 1.95; max-width: 60ch; }
.grad-text { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: clamp(24px, 4vw, 44px); }
.section-head .lead { margin-top: 10px; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface-2); --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px;
  border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 800; font-size: 15px; line-height: 1; white-space: nowrap; position: relative; isolation: isolate;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { --btn-bg: var(--grad-primary); background: var(--grad-primary); color: #fff; border-color: transparent; box-shadow: 0 10px 28px -10px rgba(123,44,191,.7); }
.btn-primary:hover { box-shadow: 0 16px 34px -10px rgba(192,90,214,.75); border-color: transparent; }
.btn-sun { background: var(--grad-sun); color: #2a0f40; border-color: transparent; box-shadow: 0 10px 28px -12px rgba(247,183,51,.9); }
.btn-sun:hover { border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-dark { background: var(--c-1); color: #fff; border-color: transparent; }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-lg { min-height: 56px; padding: 0 30px; font-size: 17px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 800; }
.link-arrow:hover { gap: 10px; }
.link-arrow { transition: gap .2s; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 2.4vw, 28px); box-shadow: var(--shadow-1); }
.card-flat { box-shadow: none; }
.card-glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); }
.card-hover { transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 20px 0; }

.chip, .badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 12px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
button.chip, a.chip { transition: background .2s, color .2s, border-color .2s; }
button.chip:hover, a.chip:hover { border-color: var(--c-4); color: var(--accent); }
.chip.is-active, .chip.selected, .chip[aria-pressed="true"] { background: var(--grad-primary); color: #fff; border-color: transparent; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge-sun { background: var(--grad-sun); color: #2a0f40; border-color: transparent; }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; overflow: hidden; background: var(--grad-primary); color: #fff; font-weight: 900; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.progress { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); }

.alert, .portal-message, .msg {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; border-radius: var(--r-md);
  background: var(--info-bg); color: var(--info); border: 1px solid var(--line); font-weight: 600; margin-bottom: 16px;
}
.alert.success, .portal-message.success, .msg.success { background: var(--ok-bg); color: var(--ok); }
.alert.error, .alert.danger, .portal-message.error, .msg.error { background: var(--bad-bg); color: var(--bad); }
.alert.warning, .portal-message.warning, .msg.warning { background: var(--warn-bg); color: var(--warn); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty .svg-icon { color: var(--c-4); margin-bottom: 8px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), .field select, .field textarea,
input.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 16px; border-radius: var(--r-md); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); transition: border-color .2s, box-shadow .2s; appearance: none; -webkit-appearance: none;
}
textarea.input, .field textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
select.input, .field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239D4EDD' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center; padding-left: 40px;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-4); box-shadow: 0 0 0 4px rgba(192,90,214,.2); }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .8; }
.field input[type=checkbox], .field input[type=radio], input[type=checkbox], input[type=radio] { accent-color: var(--c-3); width: 18px; height: 18px; }
.field input[type=file] { padding: 10px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); width: 100%; background: var(--surface-2); }
.help { font-size: 12.5px; color: var(--muted); }
.error, .errorlist, .field-error { color: var(--bad); font-size: 13px; font-weight: 600; }
.errorlist { list-style: none; padding: 0; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span-2 { grid-column: 1 / -1; }
.search-field { position: relative; }
.search-field .svg-icon { position: absolute; top: 50%; right: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field .input { padding-right: 46px; border-radius: var(--r-pill); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 14px 16px; background: var(--surface-2); white-space: nowrap; }
.table td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--accent-soft); }

/* ---------- tabs / segmented ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); max-width: 100%; overflow-x: auto; }
.tabs a, .tabs button { padding: 8px 18px; border: 0; background: transparent; border-radius: var(--r-pill); font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.tabs .is-active { background: var(--grad-primary); color: #fff; }

/* ---------- stat tile ---------- */
.stat { display: grid; gap: 2px; }
.stat b { font-size: clamp(26px, 3vw, 34px); font-weight: 900; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13.5px; }
.icon-tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--grad-primary); color: #fff; flex: none; }
.icon-tile.hot { background: var(--grad-hot); } .icon-tile.sun { background: var(--grad-sun); color: #2a0f40; }
.icon-tile.soft { background: var(--accent-soft); color: var(--accent); }

/* ---------- page head (inner pages) ---------- */
.page-head { padding-block: clamp(32px, 6vw, 72px) clamp(20px, 3vw, 36px); position: relative; }
.page-head .lead { margin-top: 12px; }
.page-head::before {
  content: ""; position: absolute; inset: -20% 0 auto 0; height: 340px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 80% at 80% 0%, rgba(192,90,214,.22), transparent 70%), radial-gradient(50% 70% at 10% 0%, rgba(248,141,90,.16), transparent 70%);
}
.breadcrumb { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13.5px; margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- site header ---------- */
.site-header { position: sticky; top: 0; z-index: 100; padding: 10px 0; transition: padding .3s var(--ease); }
.site-header .bar {
  display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 6px 10px 6px 8px;
  border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); box-shadow: var(--shadow-1);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; flex: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; background: var(--grad-brand); flex: none; display: grid; place-items: center; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name b { background: var(--grad-hot); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-name small { display: none; }
.main-nav { display: flex; align-items: center; gap: 2px; margin-inline: auto 0; flex: 1; justify-content: center; }
.main-nav a { padding: 8px 14px; border-radius: var(--r-pill); font-weight: 700; font-size: 14.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s; }
.main-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.main-nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-inline-start: auto; }
.theme-toggle, .icon-button, .menu-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  display: grid; place-items: center; position: relative; transition: transform .2s var(--ease), background .2s;
}
.theme-toggle:hover, .icon-button:hover, .menu-btn:hover { transform: translateY(-2px); background: var(--accent-soft); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }
.theme-toggle-floating { position: fixed; bottom: 90px; left: 16px; z-index: 90; }
.cart-trigger i { position: absolute; top: -4px; left: -4px; min-width: 20px; height: 20px; border-radius: 10px; padding: 0 5px; background: var(--grad-hot); color: #fff; font: 800 11px/20px var(--font); text-align: center; font-style: normal; }
.menu-btn { display: none; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: absolute; transition: transform .3s var(--ease); }
.menu-btn span:first-child { transform: translateY(-4px); } .menu-btn span:last-child { transform: translateY(4px); }
.menu-btn[aria-expanded="true"] span:first-child { transform: rotate(45deg); } .menu-btn[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
.nav-login-icon { display: none; }

@media (max-width: 960px) {
  .site-header .bar { gap: 8px; }
  .menu-btn { display: grid; }
  .main-nav {
    position: fixed; inset: calc(var(--header-h) + 4px) 12px auto 12px; flex-direction: column; align-items: stretch; gap: 4px; padding: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
    opacity: 0; transform: translateY(-12px) scale(.98); pointer-events: none; transition: opacity .25s, transform .3s var(--ease); max-height: calc(100vh - 160px); overflow: auto;
  }
  .main-nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .main-nav a { padding: 14px 16px; font-size: 16px; }
  .login-button { display: none; }
  .nav-login-icon { display: grid; }
}

/* ---------- footer ---------- */
.site-footer { margin-top: 40px; padding: 56px 0 28px; background: var(--c-1); color: #f2e9fb; position: relative; overflow: hidden; }
html[data-theme="dark"] .site-footer { background: #090411; border-top: 1px solid var(--line); }
.site-footer::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 520px; height: 520px; background: radial-gradient(closest-side, rgba(225,107,174,.35), transparent); pointer-events: none; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 32px; position: relative; }
.footer-grid h4 { font-size: 14px; color: var(--c-9); margin-bottom: 12px; }
.footer-grid a, .footer-grid span, .footer-grid p { color: #e6d6f5; font-size: 14.5px; display: block; padding-block: 3px; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 36px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.14); font-size: 13.5px; color: #cbb6e3; position: relative; }
.footer-bottom a { display: inline-flex; margin-inline-start: 16px; color: #e6d6f5; }
.news-form { display: flex; gap: 8px; margin-top: 8px; }
.news-form input { flex: 1; min-width: 0; min-height: 44px; border-radius: var(--r-pill); border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; padding: 0 16px; }
.news-form input::placeholder { color: #cbb6e3; }
.news-form button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--grad-sun); color: #2a0f40; display: grid; place-items: center; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- mobile quick bar ---------- */
.bottom-bar { display: none; }
@media (max-width: 768px) {
  body { padding-bottom: calc(var(--bar-h) + 22px + env(safe-area-inset-bottom, 0px)); }
  .bottom-bar {
    display: block; position: fixed; z-index: 140; right: 12px; left: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    height: var(--bar-h); border-radius: 26px; background: var(--glass); border: 1px solid var(--line-strong);
    backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); box-shadow: var(--shadow-2);
  }
  .bottom-bar-inner { height: 100%; display: flex; align-items: stretch; justify-content: space-around; padding: 6px; gap: 2px; }
  .bottom-bar-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 20px; color: var(--muted); font-size: 11px; font-weight: 700; position: relative; transition: color .2s, background .2s, transform .2s var(--ease); -webkit-tap-highlight-color: transparent; }
  .bottom-bar-item:active { transform: scale(.92); }
  .bottom-bar-item .svg-icon { width: 22px; height: 22px; }
  .bottom-bar-item.active { color: var(--accent); background: var(--accent-soft); }
  .bottom-bar-item.active::after { content: ""; position: absolute; top: 4px; width: 18px; height: 3px; border-radius: 3px; background: var(--grad-hot); }
  .bottom-bar-item.bottom-bar-hero { flex: 0 0 62px; }
  .bottom-bar-hero .bar-fab { width: 52px; height: 52px; border-radius: 18px; margin-top: -26px; display: grid; place-items: center; background: var(--grad-hot); color: #fff; box-shadow: 0 12px 26px -8px rgba(225,107,174,.9), 0 0 0 5px var(--bg); transition: transform .3s var(--ease); }
  .bottom-bar-hero.active { background: transparent; }
  .bottom-bar-hero.active::after { display: none; }
  .bottom-bar-hero span.lbl { margin-top: -2px; color: var(--accent); }
  .theme-toggle-floating { bottom: calc(var(--bar-h) + 40px); }
}

/* ---------- cart drawer + toast ---------- */
.cart-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(13,6,23,.55); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.cart-backdrop.open { opacity: 1; pointer-events: auto; }
.cart-drawer { position: fixed; z-index: 210; top: 0; bottom: 0; left: 0; width: min(420px, 100%); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; transform: translateX(-102%); transition: transform .45s var(--ease); box-shadow: var(--shadow-2); }
.cart-drawer.open { transform: none; }
.cart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px; border-bottom: 1px solid var(--line); }
.cart-head h3 { font-size: 20px; }
.close-button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; }
.cart-items { flex: 1; overflow: auto; padding: 16px 22px; }
.cart-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item b { display: block; font-size: 15px; } .cart-item small { color: var(--muted); }
.remove-item { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bad-bg); color: var(--bad); font-size: 18px; line-height: 1; }
.cart-empty { text-align: center; padding: 56px 12px; display: grid; gap: 8px; justify-items: center; color: var(--muted); }
.cart-empty svg { width: 44px; height: 44px; fill: none; stroke: var(--c-4); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cart-empty b { color: var(--ink); }
.cart-footer { padding: 20px 22px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: grid; gap: 12px; }
.cart-footer > div { display: flex; justify-content: space-between; font-weight: 800; font-size: 18px; }
.cart-footer small { color: var(--muted); text-align: center; }
.cart-footer a.button, .cart-footer a.btn { width: 100%; }
.toast { position: fixed; z-index: 300; right: 50%; bottom: calc(var(--bar-h) + 40px); transform: translate(50%, 30px); opacity: 0; pointer-events: none; padding: 12px 22px; border-radius: var(--r-pill); background: var(--ink); color: var(--bg); font-weight: 700; display: inline-flex; gap: 8px; align-items: center; transition: opacity .3s, transform .4s var(--ease); box-shadow: var(--shadow-2); }
.toast.show { opacity: 1; transform: translate(50%, 0); }
@media (min-width: 769px) { .toast { bottom: 32px; } }

/* legacy hook used by app.js */
.add-cart { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--grad-primary); color: #fff; font-size: 22px; line-height: 1; display: grid; place-items: center; transition: transform .25s var(--ease); }
.add-cart:hover { transform: rotate(90deg) scale(1.08); }
.add-cart.added { transform: scale(1.25); }

/* ---------- course card (shared) ---------- */
.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-1); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.course-card:hover { transform: translateY(-6px) rotateX(2deg); box-shadow: var(--shadow-2); }
.course-cover { position: relative; min-height: 168px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; overflow: hidden; background: var(--grad-primary); }
.course-cover::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -70px; bottom: -110px; background: rgba(255,255,255,.14); }
.cover-mint { background: linear-gradient(135deg, var(--c-2), var(--c-4)); }
.cover-lilac { background: linear-gradient(135deg, var(--c-1), var(--c-3)); }
.cover-peach { background: linear-gradient(135deg, var(--c-5), var(--c-6)); }
.cover-blue { background: linear-gradient(135deg, var(--c-3), var(--c-5)); }
.cover-pink { background: linear-gradient(135deg, var(--c-4), var(--c-6)); }
.cover-tag { align-self: flex-start; padding: 4px 12px; border-radius: var(--r-pill); background: rgba(255,255,255,.22); backdrop-filter: blur(8px); font-size: 12px; font-weight: 800; position: relative; z-index: 1; }
.cover-tag.tag-free { background: var(--c-10); color: #2a0f40; }
.cover-label { font-weight: 900; font-size: 20px; position: relative; z-index: 1; }
.cover-label b { opacity: .75; font-weight: 700; margin-inline-start: 6px; }
.cover-shape { position: absolute; left: 14px; top: 14px; font-size: 40px; font-weight: 900; opacity: .22; z-index: 1; }
.cover-bottom { position: relative; z-index: 1; display: grid; }
.cover-bottom small { opacity: .8; font-size: 12px; }
.course-info { padding: 18px; display: grid; gap: 12px; flex: 1; align-content: start; }
.course-info h3 { font-size: 17px; line-height: 1.6; }
.course-meta { font-size: 13px; color: var(--muted); }
.course-details { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.course-details span { display: inline-flex; align-items: center; gap: 5px; }
.course-buy { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.course-buy b { font-size: 19px; font-weight: 900; } .course-buy small { color: var(--muted); margin-inline-start: 4px; }
.course-buy del { color: var(--muted); font-size: 13px; display: block; }
.free-label { font-weight: 900; color: var(--ok); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- portal shell ---------- */
.portal-body { background: var(--bg); }
.portal-top { position: sticky; top: 0; z-index: 90; padding: 10px 0; }
.portal-top .bar { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 8px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow-1); }
.portal-user { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.portal-user .avatar { width: 34px; height: 34px; font-size: 14px; }
.portal-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 24px; width: min(100% - 32px, 1320px); margin: 12px auto 40px; align-items: start; }
.portal-sidebar { position: sticky; top: 84px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); display: grid; gap: 4px; }
.sidebar-caption { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--muted); padding: 6px 12px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; font-weight: 700; font-size: 14.5px; color: var(--ink-2); transition: background .2s, color .2s, transform .2s var(--ease); }
.side-link:hover { background: var(--accent-soft); color: var(--accent); transform: translateX(-3px); }
.side-link.is-active { background: var(--grad-primary); color: #fff; box-shadow: 0 10px 22px -10px rgba(123,44,191,.7); }
.side-link .svg-icon { flex: none; }
.support-badge { margin-inline-start: auto; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px; display: inline-grid; place-items: center; background: var(--grad-hot); color: #fff; font-size: 11px; font-weight: 800; }
.sidebar-bottom { margin-top: 10px; padding: 16px; border-radius: var(--r-md); background: var(--grad-brand); color: #fff; display: grid; gap: 2px; }
.sidebar-bottom small { opacity: .9; }
.portal-main { min-width: 0; }
.portal-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 28px 0 8px; }
.portal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.portal-head h1 { font-size: clamp(24px, 3.2vw, 34px); font-weight: 900; }
@media (max-width: 900px) {
  .portal-shell { grid-template-columns: 1fr; gap: 14px; }
  .portal-sidebar { position: static; display: flex; overflow-x: auto; gap: 6px; padding: 8px; border-radius: var(--r-pill); scrollbar-width: none; }
  .portal-sidebar::-webkit-scrollbar { display: none; }
  .sidebar-caption, .sidebar-bottom { display: none; }
  .side-link { white-space: nowrap; padding: 9px 16px; border-radius: var(--r-pill); }
  .side-link:hover { transform: none; }
  .portal-user span.name { display: none; }
}

/* ---------- auth pages ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px calc(var(--bar-h) + 40px); position: relative; overflow: hidden; }
.auth-body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(50% 50% at 85% 10%, rgba(192,90,214,.35), transparent 70%), radial-gradient(50% 50% at 10% 90%, rgba(248,141,90,.28), transparent 70%), var(--bg); }
.auth-card { width: min(100%, 460px); }
.auth-card.wide { width: min(100%, 620px); }
.auth-back { position: fixed; top: 16px; right: 16px; display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--ink-2); padding: 8px 14px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 5; }

/* ---------- misc helpers ---------- */
.gradient-border { position: relative; }
.gradient-border::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: var(--grad-brand); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.prose { max-width: 72ch; color: var(--ink-2); line-height: 2.05; }
.prose h2 { font-size: 22px; margin: 28px 0 8px; color: var(--ink); }
.prose p + p { margin-top: 12px; }
.prose ul { list-style: disc; padding-right: 22px; margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 640px) { .hide-sm { display: none; } }
