/* ============================================================
   Nova AI — design system
   ============================================================ */
@font-face { font-family: Inter; src: url('/static/fonts/inter-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/fonts/inter-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/fonts/inter-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/fonts/inter-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/fonts/inter-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Noto Kufi Arabic'; src: url('/static/fonts/kufi-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto Kufi Arabic'; src: url('/static/fonts/kufi-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Noto Kufi Arabic'; src: url('/static/fonts/kufi-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --brand: #7c5cff;
  --brand-2: #4e8bff;
  --brand-3: #19d3c5;
  --brand-grad: linear-gradient(120deg, #7c5cff 0%, #4e8bff 55%, #19d3c5 100%);
  --brand-soft: rgba(124, 92, 255, .14);
  --bg: #0a0b10;
  --bg-2: #0e1017;
  --surface: #12141d;
  --surface-2: #171a25;
  --surface-3: #1d2130;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #f2f3f8;
  --text-2: #b6bacb;
  --text-3: #7e8399;
  --success: #23c78a;
  --warning: #f5a524;
  --danger: #f2556b;
  --info: #4ea8ff;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, .75);
  --shadow-sm: 0 6px 18px -10px rgba(0, 0, 0, .6);
  --sidebar: 258px;
  --header: 68px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-2: #eef0f7;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f7;
  --border: rgba(16, 20, 40, .08);
  --border-strong: rgba(16, 20, 40, .14);
  --text: #121529;
  --text-2: #4b5169;
  --text-3: #8086a0;
  --shadow: 0 18px 45px -24px rgba(20, 25, 60, .28);
  --shadow-sm: 0 6px 18px -12px rgba(20, 25, 60, .25);
  --brand-soft: rgba(124, 92, 255, .1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html[dir="rtl"] { --font: 'Noto Kufi Arabic', 'Inter', sans-serif; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(700px 420px at 8% -5%, rgba(124, 92, 255, .16), transparent 70%),
    radial-gradient(600px 380px at 100% 0%, rgba(25, 211, 197, .08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(700px 420px at 8% -5%, rgba(124, 92, 255, .1), transparent 70%),
    radial-gradient(600px 380px at 100% 0%, rgba(25, 211, 197, .06), transparent 70%);
}
img, svg, video, canvas { max-width: 100%; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
h1 { font-size: clamp(2rem, 4.2vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul { padding-inline-start: 1.2em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: rgba(124, 92, 255, .4); }

/* ---------- utilities ---------- */
.container { width: min(1200px, calc(100% - 40px)); margin-inline: auto; position: relative; z-index: 1; }
.container-wide { width: min(1440px, calc(100% - 32px)); margin-inline: auto; }
.row { display: flex; gap: 12px; align-items: center; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 18px; }
.grid > *, .dash-grid > *, .dash-2 > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 24px; } .mt4 { margin-top: 36px; }
.mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; } .mb3 { margin-bottom: 24px; }
.w100 { width: 100%; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gradient-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.icon { flex: 0 0 auto; vertical-align: -3px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.brand { background: var(--brand-soft); color: var(--brand); border-color: rgba(124, 92, 255, .3); }
.badge.success { background: rgba(35, 199, 138, .12); color: var(--success); border-color: rgba(35, 199, 138, .3); }
.badge.warning { background: rgba(245, 165, 36, .12); color: var(--warning); border-color: rgba(245, 165, 36, .3); }
.badge.danger { background: rgba(242, 85, 107, .12); color: var(--danger); border-color: rgba(242, 85, 107, .3); }
.badge.info { background: rgba(78, 168, 255, .12); color: var(--info); border-color: rgba(78, 168, 255, .3); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--btn-bg); color: var(--text); font-weight: 600; font-size: 13.5px;
  cursor: pointer; transition: .18s ease; text-decoration: none; line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); color: var(--text); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand-grad); border: none; color: #fff; box-shadow: 0 10px 26px -12px rgba(124, 92, 255, .8); }
.btn.primary:hover { box-shadow: 0 14px 30px -12px rgba(124, 92, 255, .95); }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--brand-soft); color: var(--brand); border-color: rgba(124, 92, 255, .25); }
.btn.success { background: rgba(35, 199, 138, .14); color: var(--success); border-color: rgba(35, 199, 138, .3); }
.btn.danger { background: rgba(242, 85, 107, .12); color: var(--danger); border-color: rgba(242, 85, 107, .3); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.lg { padding: 14px 24px; font-size: 15px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn.icon-only { padding: 9px; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field > label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); outline: none; transition: .16s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: var(--surface); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237e8399' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-inline-end: 36px; }
html[dir="rtl"] .select { background-position: left 12px center; }
.input-group { display: flex; gap: 0; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .btn { border-start-start-radius: 0; border-end-start-radius: 0; }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.error-text { font-size: 12px; color: var(--danger); margin-top: 6px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--brand); width: 16px; height: 16px; margin-top: 2px; }
.switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); top: 2px; inset-inline-start: 2px; transition: .2s; }
.switch input:checked + span { background: var(--brand); border-color: var(--brand); }
.switch input:checked + span::after { background: #fff; transform: translateX(18px); }
html[dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.input-prefix { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 0 12px; }
.input-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-prefix .input { border: none; background: transparent; padding-inline: 0; box-shadow: none !important; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); position: relative;
}
.card.pad { padding: 22px; }
.card.pad-lg { padding: 28px; }
.card.hover:hover { border-color: var(--border-strong); transform: translateY(-2px); transition: .2s; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-body { padding: 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--border); }
.glass { background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(16px); }
.stat { padding: 20px; }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }

/* ---------- public shell ---------- */
.public-nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); border-bottom: 1px solid var(--border);
}
.public-nav .inner { display: flex; align-items: center; gap: 26px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--text); letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand .dot { color: var(--brand); }
.nav-links { display: flex; gap: 4px; align-items: center; margin-inline-start: 8px; }
.nav-links a { padding: 8px 12px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { background: var(--surface-3); color: var(--text); }
.nav-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.icon-btn[data-theme-toggle] { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.icon-btn[data-theme-toggle]:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.lang-switch { position: relative; }
.lang-switch summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover { background: var(--surface-3); color: var(--text); }
.lang-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 150px; z-index: 50; }
.lang-menu a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; }
.lang-menu a:hover, .lang-menu a.active { background: var(--surface-3); color: var(--text); }
.mobile-toggle { display: none; }
.nav-menu-btn { display: none; }

.public-main { min-height: 60vh; position: relative; z-index: 1; }
.hero { padding: 72px 0 40px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: 48px; align-items: center; }
.hero h1 { margin-bottom: 18px; }
.hero .lead { font-size: 17px; color: var(--text-2); max-width: 560px; line-height: 1.65; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-note { display: flex; gap: 18px; margin-top: 26px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.hero-note span { display: inline-flex; align-items: center; gap: 6px; }
.hero-visual { position: relative; }
.hero-media { border-radius: 22px; overflow: hidden; border: 1px solid var(--border-strong); box-shadow: var(--shadow); background: #000; aspect-ratio: 4 / 3; }
.hero-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-float {
  position: absolute; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center;
}
.hero-float.one { inset-inline-start: -18px; bottom: 42px; }
.hero-float.two { inset-inline-end: -14px; top: 32px; }
.hero-float .k { font-size: 11px; color: var(--text-3); }
.hero-float .v { font-weight: 700; font-size: 13px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); border: 1px solid rgba(124, 92, 255, .25); color: var(--brand); font-size: 12px; font-weight: 600; margin-bottom: 20px; }
.eyebrow.plain { background: var(--surface-3); border-color: var(--border); color: var(--text-2); }
.section { padding: 68px 0; }
.section.tight { padding: 44px 0; }
.section-head { max-width: 640px; margin: 0 auto 42px; text-align: center; }
.section-head p { color: var(--text-2); font-size: 15.5px; }
.section-head.left { margin-inline-start: 0; text-align: start; }
.logos { display: flex; gap: 34px; flex-wrap: wrap; justify-content: center; align-items: center; opacity: .65; font-weight: 700; letter-spacing: .04em; font-size: 13px; }
.feature { padding: 24px; }
.feature .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 16px; }
.feature h3 { font-size: 15.5px; margin-bottom: 8px; }
.feature p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.step { display: flex; gap: 16px; }
.step .num { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--brand-grad); color: #fff; }
.step h3 { font-size: 15px; margin-bottom: 4px; }
.step p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.cta-band { border-radius: 24px; padding: 52px; background: var(--brand-grad); color: #fff; position: relative; overflow: hidden; }
.cta-band::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(255, 255, 255, .16); top: -160px; inset-inline-end: -80px; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 560px; }
.cta-band .btn { background: #fff; color: #2a1e70; border: none; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 44px; }
.hero-stats .stat { background: var(--surface); }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary { cursor: pointer; padding: 18px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 16px; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--text-3); font-size: 20px; line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { color: var(--text-2); padding-bottom: 18px; margin: 0; }

/* pricing */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.pack { padding: 24px; display: flex; flex-direction: column; position: relative; transition: .2s; }
.pack:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.pack.highlight { border-color: rgba(124, 92, 255, .55); box-shadow: 0 0 0 1px rgba(124, 92, 255, .25), var(--shadow); }
.pack .pack-badge { position: absolute; top: -11px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--brand-grad); color: #fff; font-size: 10.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
html[dir="rtl"] .pack .pack-badge { transform: translateX(50%); }
.pack h3 { font-size: 15px; margin-bottom: 4px; }
.pack .price { font-size: 32px; font-weight: 800; letter-spacing: -.03em; margin: 10px 0 2px; }
.pack .price small { font-size: 13px; color: var(--text-3); font-weight: 500; }
.pack .credits { font-size: 13px; color: var(--text-2); }
.pack ul { list-style: none; padding: 0; margin: 18px 0; flex: 1; display: grid; gap: 9px; }
.pack li { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.pack li .icon { color: var(--success); margin-top: 1px; }
.compare { text-decoration: line-through; color: var(--text-3); font-size: 13px; margin-inline-start: 6px; }
.price-table { width: 100%; border-collapse: collapse; }
.price-table th, .price-table td { text-align: start; padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.price-table th { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.price-table tr:last-child td { border: 0; }

/* public footer */
.public-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 50px 0 30px; position: relative; z-index: 1; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, .8fr); gap: 32px; }
.footer-grid h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 14px; }
.footer-grid a { display: block; color: var(--text-2); font-size: 13px; padding: 4px 0; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 34px; padding-top: 22px; color: var(--text-3); font-size: 12px; }

/* ---------- auth ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; position: relative; z-index: 1; }
.auth-side { padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(800px 600px at 20% 10%, rgba(124, 92, 255, .25), transparent 65%); border-inline-end: 1px solid var(--border); }
.auth-side .quote { max-width: 460px; }
.auth-side .quote h2 { font-size: 2.2rem; }
.auth-side .quote p { color: var(--text-2); font-size: 15px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 1.8rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 26px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-top: 14px; flex-wrap: wrap; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 20px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }
.auth-features { display: grid; gap: 16px; margin-top: 34px; }
.auth-features div { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 13.5px; }
.auth-features .icon { color: var(--brand-3); margin-top: 2px; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); position: fixed; inset-block: 0; inset-inline-start: 0;
  background: var(--bg-2); border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; z-index: 45;
  transition: transform .22s ease;
}
.sidebar-head { height: var(--header); display: flex; align-items: center; gap: 6px; padding: 0 20px; border-bottom: 1px solid var(--border); }
.sidebar-head .brand { min-width: 0; }
.sidebar-head-badge { font-size: 10px; padding: 2px 7px; letter-spacing: .02em; }
.sidebar-head .brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-nav { padding: 14px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.sidebar-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); padding: 14px 10px 6px; font-weight: 700; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 10px; color: var(--text-2); font-size: 13.5px; font-weight: 500; position: relative; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-link.active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
html[dir="rtl"] .side-link.active::before { border-radius: 3px 0 0 3px; }
.side-link .pill { margin-inline-start: auto; font-size: 10px; padding: 2px 7px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 11px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.avatar.lg { width: 54px; height: 54px; font-size: 19px; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.user-chip .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .em { font-size: 11px; color: var(--text-3); }
.wallet-pill { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(120deg, rgba(124, 92, 255, .16), rgba(25, 211, 197, .1)); border: 1px solid rgba(124, 92, 255, .22); margin-bottom: 10px; }
.wallet-pill .n { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.wallet-pill .l { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

.main { margin-inline-start: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header); display: flex; align-items: center; gap: 14px; padding: 0 26px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px);
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-titles { min-width: 0; flex: 1 1 auto; }
.breadcrumb { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.topbar-actions .icon-btn, .mobile-menu-btn { flex: 0 0 auto; }
.notif-dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.page { padding: 26px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h2 { font-size: 1.5rem; margin-bottom: 4px; }
.page-head .sub { color: var(--text-2); font-size: 13.5px; margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mobile-menu-btn { display: none; position: relative; z-index: 2; touch-action: manipulation; cursor: pointer; }
.hide-sm { display: inline; }
.sidebar-close { display: none; margin-inline-start: auto; }
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 44; background: rgba(5, 6, 12, .58);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s ease;
}
.sidebar-backdrop.open { opacity: 1; visibility: visible; }
body.sidebar-open { overflow: hidden; }

/* flash */
.flash-wrap { position: fixed; top: 16px; inset-inline-end: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 13px; animation: slideIn .25s ease; }
.flash.success { border-color: rgba(35, 199, 138, .4); }
.flash.success .icon { color: var(--success); }
.flash.error { border-color: rgba(242, 85, 107, .4); }
.flash.error .icon { color: var(--danger); }
.flash.warning .icon { color: var(--warning); }
.flash .close { margin-inline-start: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: start; padding: 11px 14px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 700; white-space: nowrap; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .actions { text-align: end; white-space: nowrap; }
.table-wrap.card { overflow: hidden; }

/* dashboard */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.dash-2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.balance-card { background: linear-gradient(125deg, #241d55 0%, #1a2b5c 55%, #103c46 100%); border: 1px solid rgba(124, 92, 255, .25); overflow: hidden; position: relative; }
.balance-card::after { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 92, 255, .4), transparent 65%); top: -90px; inset-inline-end: -60px; }
.balance-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .65); margin-bottom: 12px; }
.balance-card .big { font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: #fff; }
.balance-card .equiv { color: rgba(255, 255, 255, .65); font-size: 12.5px; margin-top: 8px; }
.balance-card .actions { display: flex; gap: 8px; margin-top: 20px; position: relative; z-index: 2; }
.balance-card .btn.ghost { border-color: rgba(255, 255, 255, .25); color: #fff; }
.balance-card .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.mini-row:last-child { border: 0; }
.mini-row .thumb { width: 46px; height: 34px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); flex: 0 0 auto; overflow: hidden; }
.mini-row .thumb video, .mini-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-row .t { font-weight: 600; font-size: 12.5px; }
.mini-row .s { font-size: 11px; color: var(--text-3); }
.bar-chart { width: 100%; height: 190px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px; background: var(--brand-soft); border: 1px solid rgba(124, 92, 255, .22); color: var(--text-2); font-size: 12.5px; margin-bottom: 18px; }
.notice .icon { color: var(--brand); }

/* studio */
.studio-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .85fr); gap: 18px; align-items: start; }
.studio-form { position: relative; }
.studio-step { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.studio-step:last-of-type { border-bottom: 0; margin-bottom: 6px; padding-bottom: 0; }
.step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.step-no { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--brand-soft); border: 1px solid rgba(124, 92, 255, .25); color: var(--brand); font-size: 12px; font-weight: 800; }
.step-copy { min-width: 0; }
.step-copy h3 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.step-copy p { margin: 2px 0 0; }
.template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.template-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; text-align: start; transition: .16s; }
.template-chip:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.template-name { font-size: 12px; font-weight: 700; }
.template-ratio { font-size: 10.5px; color: var(--text-3); }
.template-hint { margin-top: 8px; }
.prompt-input { min-height: 124px; resize: vertical; line-height: 1.65; }
.prompt-meta { margin-top: 6px; gap: 10px; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.model-opt { position: relative; cursor: pointer; }
.model-opt input { position: absolute; opacity: 0; }
.model-opt .box { display: flex; flex-direction: column; min-height: 118px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 12px; height: 100%; transition: .16s; }
.model-opt .box:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.model-opt input:focus-visible + .box { outline: 2px solid var(--brand); outline-offset: 2px; }
.model-opt input:checked + .box { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.model-opt .nm { font-weight: 700; font-size: 12.5px; }
.model-opt .tg { font-size: 10.5px; color: var(--brand-3); font-weight: 600; white-space: nowrap; }
.model-opt .ds { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.model-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--border); }
.model-foot .price { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; color: var(--brand-2); }
.estimate { padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.estimate .big { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.seg { display: inline-flex; width: 100%; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 3px; flex-wrap: wrap; }
.seg label { cursor: pointer; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 6px 9px; border-radius: 7px; font-size: 12px; color: var(--text-2); font-weight: 600; text-align: center; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.toggle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 2px; }
.toggle-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 12px; }
.toggle-card:has(input:checked) { border-color: rgba(124, 92, 255, .4); background: var(--brand-soft); color: var(--text); }
.toggle-card input { accent-color: var(--brand); width: 15px; height: 15px; flex: 0 0 auto; }
.advanced-box { border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; margin-top: 18px; background: var(--surface-2); }
.advanced-box summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); list-style: none; }
.advanced-box summary::-webkit-details-marker { display: none; }
.advanced-body { padding-bottom: 14px; }
.dropzone { display: grid; justify-items: center; gap: 3px; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 22px; text-align: center; color: var(--text-3); font-size: 12.5px; cursor: pointer; transition: .16s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 4px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.drop-title { color: var(--text-2); }
.upload-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--brand-2); }
.spinner-dark { border-color: rgba(124, 92, 255, .2); border-top-color: var(--brand); }
.upload-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.upload-chip { display: flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 8px; background: var(--surface-3); font-size: 11.5px; }
.upload-chip.pending { opacity: .72; }
.upload-chip .upload-icon { display: grid; color: var(--brand); }
.upload-chip .upload-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-chip button { background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; display: grid; }
.upload-chip button:hover { color: var(--danger); }
.studio-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--border); }
.estimate-box { display: grid; gap: 3px; min-width: 180px; }
.action-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.success-text { color: var(--success); }
.danger-text { color: var(--danger); }
.studio-alert { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 11px 13px; border-radius: 10px; background: rgba(242, 85, 107, .1); border: 1px solid rgba(242, 85, 107, .3); color: var(--danger); font-size: 12.5px; }
.studio-alert[hidden] { display: none !important; }
.studio-sidebar { display: grid; gap: 16px; position: sticky; top: 88px; }
.preview-card { display: grid; gap: 14px; }
.preview-frame { width: 100%; aspect-ratio: 16 / 9; min-height: 120px; border-radius: 12px; background: linear-gradient(145deg, #17142c, #0e1726); border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; position: relative; transition: aspect-ratio .2s; }
html[data-theme="light"] .preview-frame { background: linear-gradient(145deg, #efefff, #e6f3f4); }
.preview-placeholder { color: var(--text-3); display: grid; place-items: center; }
.preview-caption { position: absolute; inset-inline: 10px; bottom: 10px; padding: 6px 8px; border-radius: 7px; background: rgba(8, 10, 18, .72); color: var(--text); font-size: 11px; line-height: 1.4; backdrop-filter: blur(4px); }
html[data-theme="light"] .preview-caption { background: rgba(255, 255, 255, .82); }
.summary-list { display: grid; gap: 7px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text-3); }
.summary-row strong { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 600; text-align: end; }
.summary-cost { border-top: 1px solid var(--border); padding-top: 12px; }
.studio-balance .studio-wallet { font-size: 28px; }
@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: 1fr; }
  .studio-sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-card { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toggle-grid { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
  .studio-sidebar { grid-template-columns: 1fr; }
  .studio-actions { align-items: stretch; }
  .action-side { justify-content: space-between; }
}

/* jobs */
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.job-card { overflow: hidden; display: flex; flex-direction: column; }
.job-thumb { aspect-ratio: 16 / 9; background: #05060a; position: relative; display: grid; place-items: center; overflow: hidden; }
.job-thumb video, .job-thumb img { width: 100%; height: 100%; object-fit: cover; }
.job-thumb .placeholder { color: var(--text-3); display: grid; gap: 8px; justify-items: center; font-size: 11px; }
.job-thumb .status-ov { position: absolute; top: 10px; inset-inline-start: 10px; }
.job-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.job-body .p { font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.job-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--text-3); font-size: 11px; margin-top: auto; }
.job-meta span { display: inline-flex; align-items: center; gap: 4px; }
.progress-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: 999px; background: var(--brand-grad); width: 30%; animation: indeterminate 1.4s infinite ease-in-out; }
@keyframes indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.player-wrap { border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--border); }
.player-wrap video { display: block; width: 100%; max-height: 68vh; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 6px; top: 16px; bottom: 0; width: 1px; background: var(--border); }
.tl-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border-strong); margin-top: 4px; flex: 0 0 auto; z-index: 1; }
.tl-item.done .tl-dot { background: var(--success); border-color: var(--success); }
.tl-item.active .tl-dot { background: var(--brand); border-color: var(--brand); animation: pulse 1.5s infinite; }
.tl-item.fail .tl-dot { background: var(--danger); border-color: var(--danger); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, .5); } 50% { box-shadow: 0 0 0 5px rgba(124, 92, 255, 0); } }
.tl-item .tt { font-size: 12.5px; font-weight: 600; }
.tl-item .ts { font-size: 11px; color: var(--text-3); }

/* billing */
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pay-method { position: relative; cursor: pointer; }
.pay-method input { position: absolute; opacity: 0; }
.pay-method .box { border: 1px solid var(--border); border-radius: 12px; padding: 13px; display: flex; gap: 9px; align-items: center; background: var(--surface-2); height: 100%; }
.pay-method input:checked + .box { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.pay-method .nm { font-weight: 600; font-size: 12.5px; }
.pay-method .ds { font-size: 10.5px; color: var(--text-3); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a.active, .tabs button.active { color: var(--text); border-bottom-color: var(--brand); }
.ledger-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border: 0; }
.ledger-row .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: 0 0 auto; }
.ledger-row .ic.pos { background: rgba(35, 199, 138, .12); color: var(--success); }
.ledger-row .ic.neg { background: rgba(242, 85, 107, .1); color: var(--danger); }
.ledger-row .amt { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger-row .amt.pos { color: var(--success); }
.ledger-row .amt.neg { color: var(--danger); }

/* code blocks */
.codeblock { position: relative; background: #0b0d14; border: 1px solid var(--border); border-radius: 12px; padding: 16px; overflow-x: auto; max-width: 100%; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.65; color: #c8cde0; }
html[data-theme="light"] .codeblock { background: #14161f; }
.codeblock .copy { position: absolute; top: 8px; inset-inline-end: 8px; }
.code-inline { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-family: ui-monospace, monospace; font-size: .9em; }

/* support */
.ticket-row { display: flex; gap: 14px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.ticket-row:last-child { border: 0; }
.ticket-row .subj { font-weight: 600; font-size: 13px; }
.ticket-row .meta { font-size: 11px; color: var(--text-3); }
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 78%; padding: 13px 15px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.msg.mine { align-self: flex-end; background: var(--brand-soft); border-color: rgba(124, 92, 255, .25); }
.msg .who { font-size: 11px; color: var(--text-3); margin-bottom: 5px; }
.msg .body { font-size: 13px; white-space: pre-wrap; }
.msg .when { font-size: 10px; color: var(--text-3); margin-top: 6px; }

/* pagination */
.pagination { display: flex; gap: 6px; justify-content: center; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 12.5px; border: 1px solid var(--border); color: var(--text-2); }
.pagination a:hover { background: var(--surface-2); }
.pagination .active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }

/* empty state */
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty .ic { width: 54px; height: 54px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 14px; color: var(--text-3); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 12.5px; margin-bottom: 16px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 20px; }
.modal.open { display: grid; }
.modal-bg { position: absolute; inset: 0; background: rgba(5, 6, 12, .7); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; }
.modal-card.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; }
.modal-head h3 { margin: 0; }

/* misc */
.kbd { padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 10.5px; font-family: ui-monospace, monospace; }
.alert { display: flex; gap: 10px; padding: 13px 15px; border-radius: 11px; font-size: 12.5px; border: 1px solid var(--border); background: var(--surface-2); }
.alert.info { border-color: rgba(78, 168, 255, .3); background: rgba(78, 168, 255, .08); }
.alert.success { border-color: rgba(35, 199, 138, .3); background: rgba(35, 199, 138, .08); }
.alert.warning { border-color: rgba(245, 165, 36, .3); background: rgba(245, 165, 36, .08); }
.alert.danger { border-color: rgba(242, 85, 107, .3); background: rgba(242, 85, 107, .08); }
.alert .icon { margin-top: 1px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sep { height: 1px; background: var(--border); margin: 20px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border); }
.kv:last-child { border: 0; }
.kv .k { color: var(--text-3); }
.kv .v { font-weight: 600; text-align: end; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-inline-start: -8px; }
.avatar-stack .avatar:first-child { margin: 0; }
.progress { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-grad); border-radius: 999px; }
.flag { font-size: 15px; }

/* PWA install banner */
.pwa-banner {
  position: fixed; inset-inline-end: 18px; bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 80;
  width: min(440px, calc(100vw - 36px)); display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transform: translateY(18px); opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.pwa-banner.show { opacity: 1; transform: translateY(0); }
.pwa-banner[hidden], .pwa-banner [hidden] { display: none !important; }
.pwa-banner-logo { flex: 0 0 auto; }
.pwa-banner-logo img { display: block; width: 46px; height: 46px; border-radius: 12px; }
.pwa-banner-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pwa-banner-text strong { font-size: 13.5px; line-height: 1.3; }
.pwa-banner-text span { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.pwa-banner-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* ---------- admin responsive ---------- */
.admin-shell .card,
.admin-shell .card-head,
.admin-shell .card-body,
.admin-shell .page-head > *,
.admin-shell .dash-grid > *,
.admin-shell .dash-2 > *,
.admin-shell .grid > * { min-width: 0; }
.admin-shell .card-head { flex-wrap: wrap; }
.admin-shell .card-head > form { flex: 0 0 auto; }
.admin-shell .card-head .row { min-width: 0; flex-wrap: wrap; }
.admin-shell .page-head .row { min-width: 0; flex-wrap: wrap; }
.admin-shell .page-head h2,
.admin-shell .page-head .sub,
.admin-shell .card-head h3,
.admin-shell .kv .v,
.admin-shell .alert { overflow-wrap: anywhere; }
.admin-shell .kv { flex-wrap: wrap; }
.admin-shell .row-between { flex-wrap: wrap; }
.admin-shell .row-between > * { min-width: 0; }
.admin-shell .stat .badge { white-space: normal; max-width: 100%; }
.admin-shell .codeblock { max-width: 100%; }
.admin-shell .codeblock pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-shell .input-group,
.admin-shell .input-group .input { min-width: 0; }
.admin-shell .tabs { -webkit-overflow-scrolling: touch; }

@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-visual { max-width: 620px; }
  .dash-grid, .dash-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-2, .dash-2.even { grid-template-columns: minmax(0, 1fr); }
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 860px) {
  .sidebar { width: min(86vw, var(--sidebar)); transform: translateX(-100%); box-shadow: var(--shadow); }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open,
  body.sidebar-open .sidebar,
  html[dir="rtl"] .sidebar.open,
  html[dir="rtl"] body.sidebar-open .sidebar { transform: translateX(0) !important; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .sidebar-close { display: inline-grid; }
  .sidebar-head-badge { display: none; }
  .main { margin-inline-start: 0; }
  .mobile-menu-btn { display: inline-grid; }
  .nav-links { display: none; }
  .page { padding: 18px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar h1 { font-size: 14.5px; }
  .breadcrumb { font-size: 11px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn.sm:not(.icon-only) { display: none; }
  .topbar-status { display: none; }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .cta-band { padding: 34px 24px; }
  .hero { padding-top: 44px; }
  .section { padding: 48px 0; }
  .pay-methods { grid-template-columns: 1fr; }
  .page-head h2 { font-size: 1.25rem; }
  .hero-float { display: none; }
  .form-grid { grid-template-columns: 1fr; }

  .nav-menu-btn { display: inline-grid; }
  .public-nav .inner { gap: 10px; }
  .public-nav .nav-actions { gap: 4px; }
  .public-nav.open .nav-links {
    display: flex; flex-direction: column; align-items: stretch; gap: 2px;
    position: absolute; top: 100%; inset-inline: 0; margin: 0; padding: 10px 14px 14px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .public-nav.open .nav-links a { padding: 11px 12px; font-size: 14px; }
}
@media (max-width: 560px) {
  .dash-grid, .dash-grid.three, .g4 { grid-template-columns: minmax(0, 1fr); }
  .container { width: calc(100% - 28px); }
  .nav-actions .btn:not(.icon-only) { display: none; }
  .hero-actions .btn { flex: 1; }
  .flash-wrap { inset-inline: 12px; max-width: none; }
  .balance-card .big { font-size: 32px; }
  .hide-sm { display: none; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .breadcrumb { display: none; }
  .topbar h1 { font-size: 14px; }
  .icon-btn { width: 34px; height: 34px; }
  .page { padding: 14px; }
  .page-head { gap: 10px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }
  .card.pad, .card.pad-lg { padding: 16px; }
  .table th, .table td { padding: 10px; }
  .row-between { flex-wrap: wrap; }
  .studio-actions { gap: 12px; }
  .action-side { width: 100%; }
  .action-side .btn { flex: 1 1 auto; justify-content: center; }
  .public-nav .brand span { font-size: 15px; }
  .lang-switch summary { padding: 8px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .cta-band { padding: 28px 20px; }
  .hero-stats { grid-template-columns: minmax(0, 1fr); }
  .auth-main { padding: 64px 18px 32px; }
  .sidebar-head { padding: 0 14px; }
  .pwa-banner { inset-inline: 12px; width: auto; padding: 11px 12px; }
  .pwa-banner-logo img { width: 42px; height: 42px; }
  .pwa-banner-text strong { font-size: 13px; }
  .pwa-banner-text span { font-size: 11.5px; }
  .pwa-banner-actions .btn span { display: none; }
  .pwa-banner-actions .btn { width: 34px; height: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 400px) {
  .public-nav .brand span { display: none; }
  .lang-switch summary { padding: 7px 6px; font-size: 11.5px; }
}

/* Admin: no horizontal page swipe on tablet / phone */
@media (max-width: 860px) {
  .admin-shell .tabs {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px; overflow: visible; border-bottom: 0;
  }
  .admin-shell .tabs a {
    justify-content: center; margin: 0; padding: 9px 8px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  }
  .admin-shell .tabs a.active {
    border-color: rgba(124, 92, 255, .45); background: var(--brand-soft);
  }
  .admin-shell form .row.wrap > .field {
    min-width: 0 !important; flex: 1 1 100% !important;
  }
  .admin-shell form .row.wrap > .btn { flex: 1 1 auto; }
  .admin-shell .page-head .actions > form { display: flex; flex: 1 1 auto; }
  .admin-shell .page-head .actions > form .btn { width: 100%; }
}
@media (max-width: 1024px) {
  .admin-shell .table-wrap { overflow: visible; }
  .admin-shell .table.responsive { display: block; width: 100%; border-collapse: separate; }
  .admin-shell .table.responsive thead { display: none; }
  .admin-shell .table.responsive tbody { display: grid; gap: 10px; padding: 10px; }
  .admin-shell .table.responsive tbody tr {
    display: block; padding: 2px 12px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 12px;
  }
  .admin-shell .table.responsive tbody tr:hover { background: var(--surface-2); }
  .admin-shell .table.responsive td {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 12px; width: 100%;
    max-width: none !important; padding: 9px 0; border-bottom: 1px dashed var(--border);
    text-align: start !important; white-space: normal !important;
    overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere;
  }
  .admin-shell .table.responsive td:last-child { border-bottom: 0; }
  .admin-shell .table.responsive td::before {
    content: attr(data-label); flex: 0 0 36%; max-width: 36%;
    padding-top: 1px; font-size: 10px; line-height: 1.55; letter-spacing: .06em;
    text-transform: uppercase; color: var(--text-3); font-weight: 700; overflow-wrap: anywhere;
  }
  .admin-shell .table.responsive td[data-label=""]::before,
  .admin-shell .table.responsive td[colspan]::before { display: none; }
  .admin-shell .table.responsive td[colspan] {
    display: block; padding: 18px 4px; text-align: center !important;
  }
  .admin-shell .table.responsive td > * { min-width: 0; max-width: 100%; }
  .admin-shell .table.responsive td > form { flex: 1 1 auto; }
  .admin-shell .table.responsive td.actions { flex-wrap: wrap; }
  .admin-shell .table.responsive td .btn-group {
    width: 100%; justify-content: flex-start !important; flex-wrap: wrap;
  }
  .admin-shell .table.responsive td .card {
    min-width: 0 !important; max-width: 100% !important;
  }
  .admin-shell .table.responsive td .codeblock { max-width: 100% !important; }
  .admin-shell .table.responsive td > .row { flex-wrap: wrap; }
  .admin-shell .table.responsive .nowrap { white-space: normal !important; }
  .admin-shell .table.responsive .ellipsis {
    overflow: visible; white-space: normal; text-overflow: clip;
  }
  .admin-shell .table.responsive .badge { white-space: normal; }
}
@media (max-width: 560px) {
  .admin-shell .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell .input-group { flex-direction: column; align-items: stretch; }
  .admin-shell .input-group .input,
  .admin-shell .input-group .btn { border-radius: 11px; }
  .admin-shell .card-head { padding: 14px 16px; }
  .admin-shell .card-body { padding: 16px; }
  .admin-shell .page-head .actions { width: 100%; }
  .admin-shell .page-head .actions > * { flex: 1 1 auto; }
}
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .flash-wrap, .no-print, .public-nav, .public-footer { display: none !important; }
  .main { margin: 0 !important; }
  .page { padding: 0 !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .card { box-shadow: none; border-color: #ddd; }
}
