/* =====================================================================
   MASSI design system — purple / pink / violet + green earnings + gold rewards
   Uses logical properties (inline-start/end) so RTL & LTR share one sheet.
   ===================================================================== */
:root {
  --bg: #f7f5fc;
  --surface: #ffffff;
  --surface-2: #faf8ff;
  --line: #ece8f5;
  --text: #1f1638;
  --text-2: #5d5478;
  --muted: #8d86a3;

  --violet-50: #f5f1ff; --violet-100: #ebe3ff; --violet-500: #8b5cf6; --violet-600: #7c3aed; --violet-700: #6d28d9; --violet-900: #2e1065;
  --pink-50: #fdf2f8; --pink-100: #fce7f3; --pink-500: #ec4899; --pink-600: #db2777;
  --green-50: #ecfdf5; --green-100: #d1fae5; --green-500: #10b981; --green-600: #059669; --green-700: #047857;
  --gold-50: #fffbeb; --gold-100: #fef3c7; --gold-400: #fbbf24; --gold-500: #f59e0b; --gold-600: #d97706;
  --orange-500: #f97316; --red-50: #fef2f2; --red-500: #ef4444; --red-600: #dc2626;
  --blue-50: #eff6ff; --blue-600: #2563eb;

  --brand: var(--violet-600);
  --brand-2: var(--pink-500);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 22, 56, .04), 0 6px 20px rgba(76, 29, 149, .06);
  --shadow-lg: 0 12px 40px rgba(76, 29, 149, .16);
  --sidebar: #1e1438;
  --font: "Plus Jakarta Sans", "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[dir="rtl"] { --font: "Cairo", "Plus Jakarta Sans", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
.ic { flex-shrink: 0; vertical-align: middle; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.muted { color: var(--muted); } .small { font-size: .84rem; } .tiny { font-size: .75rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }
.nowrap { white-space: nowrap; } .right { text-align: end; } .center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------- App shell */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: #d9d2f0; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--violet-500), var(--pink-500)); }
.brand b { display: block; font-size: 1.05rem; } .brand span { font-size: .78rem; color: #a99fcb; }
.nav-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7d73a3; padding: 14px 12px 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #d9d2f0; font-weight: 500; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.on { background: linear-gradient(90deg, var(--violet-600), #9b4dea); color: #fff; box-shadow: 0 6px 16px rgba(124,58,237,.35); }
.nav .count { margin-inline-start: auto; background: var(--pink-500); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 8px; font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { padding-inline-start: 40px; background: var(--surface); border-radius: 99px; }
.topbar .search .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 60px; max-width: 1440px; width: 100%; }
.menu-btn { display: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--text-2); }

/* User chip + bell */
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--pink-500), var(--violet-500)); flex-shrink: 0; }
.user-chip b { display: block; font-size: .9rem; line-height: 1.2; } .user-chip span { font-size: .76rem; color: var(--muted); }
.bell { position: relative; }
.bell > button { position: relative; }
.bell .dot { position: absolute; top: -2px; inset-inline-end: -2px; background: var(--pink-500); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--surface); }
.dropdown { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: min(360px, 92vw); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 1px solid var(--line); z-index: 50; overflow: hidden; }
.dropdown header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dropdown .item { display: block; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--text); font-size: .88rem; }
.dropdown .item.unread { background: var(--violet-50); }
.dropdown .item small { display: block; color: var(--muted); font-size: .74rem; }
.dropdown footer { padding: 10px 16px; text-align: center; }
.lang-switch { display: inline-flex; background: var(--violet-50); border-radius: 99px; padding: 3px; }
.lang-switch a { padding: 4px 12px; border-radius: 99px; font-size: .82rem; font-weight: 700; color: var(--violet-700); }
.lang-switch a.on { background: var(--brand); color: #fff; }
.lang-switch a:hover { text-decoration: none; }

/* ---------------------------------------------------------- Cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 18px; }
.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)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }

/* Metric tiles */
.metric { position: relative; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.metric .label { color: var(--text-2); font-size: .84rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.metric .value { font-size: 1.65rem; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.metric .sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.metric .chip { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.tone-violet .chip { background: var(--violet-100); color: var(--violet-700); }
.tone-pink .chip { background: var(--pink-100); color: var(--pink-600); }
.tone-green .chip { background: var(--green-100); color: var(--green-700); }
.tone-gold .chip { background: var(--gold-100); color: var(--gold-600); }
.tone-blue .chip { background: #dbeafe; color: var(--blue-600); }
.tone-red .chip { background: #fee2e2; color: var(--red-600); }
.tone-green .value { color: var(--green-700); }
.metric.pastel-violet { background: linear-gradient(160deg, var(--violet-50), #fff 70%); }
.metric.pastel-pink { background: linear-gradient(160deg, var(--pink-50), #fff 70%); }
.metric.pastel-green { background: linear-gradient(160deg, var(--green-50), #fff 70%); }
.metric.pastel-gold { background: linear-gradient(160deg, var(--gold-50), #fff 70%); }

/* Earnings hero — the most prominent figure for sellers */
.earn-hero { background: linear-gradient(135deg, #059669 0%, #10b981 60%, #34d399 100%); color: #fff; border-radius: 20px; padding: 22px; box-shadow: 0 14px 32px rgba(5, 150, 105, .28); position: relative; overflow: hidden; }
.earn-hero::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.12); }
.earn-hero .label { opacity: .9; font-weight: 600; font-size: .9rem; }
.earn-hero .big { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 12px; }
.earn-hero .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; position: relative; z-index: 1; }
.earn-hero .cols div { background: rgba(255,255,255,.16); border-radius: 12px; padding: 8px 10px; }
.earn-hero .cols b { display: block; font-size: 1.02rem; }
.earn-hero .cols span { font-size: .74rem; opacity: .9; }

/* Hero banner */
.hero { border-radius: 22px; padding: 26px; color: #fff; background: linear-gradient(120deg, #6d28d9 0%, #a21caf 55%, #ec4899 100%); position: relative; overflow: hidden; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hero h1 { font-size: 1.6rem; margin-bottom: 4px; }
.hero p { margin: 0; opacity: .92; }
.hero .level-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border-radius: 99px; padding: 5px 14px; font-weight: 700; font-size: .85rem; margin-top: 10px; }
.hero-deco { position: absolute; inset-inline-end: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(251,191,36,.35), transparent 70%); pointer-events: none; }

/* Progress */
.progress { height: 10px; background: var(--violet-100); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--violet-500), var(--pink-500)); width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.progress.gold > span { background: linear-gradient(90deg, var(--gold-400), var(--orange-500)); }
.progress.green > span { background: linear-gradient(90deg, var(--green-500), #34d399); }
.progress-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-2); margin-top: 6px; }
.reward-card { border-radius: var(--radius); padding: 16px; background: linear-gradient(150deg, var(--gold-50), #fff 60%); border: 1px solid var(--gold-100); }
.reward-card .title { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.reward-card .medal { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--gold-400), var(--orange-500)); color: #fff; font-size: 1.2rem; }
.level-ring { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: conic-gradient(var(--c, var(--violet-500)) calc(var(--p, 0) * 1%), var(--violet-100) 0); position: relative; }
.level-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.level-ring span { position: relative; }

/* ---------------------------------------------------------- Product cards */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pcard .img { aspect-ratio: 1 / 1; background: linear-gradient(160deg, var(--pink-50), var(--violet-50)); position: relative; display: grid; place-items: center; color: var(--violet-500); }
.pcard .img img { width: 100%; height: 100%; object-fit: cover; }
.pcard .img .badge { position: absolute; top: 10px; inset-inline-start: 10px; }
.pcard .img .promo { position: absolute; top: 10px; inset-inline-end: 10px; background: var(--pink-500); color: #fff; font-weight: 700; font-size: .74rem; padding: 3px 9px; border-radius: 99px; }
.pcard .body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard h3 { font-size: .98rem; margin: 0; }
.pcard .prices { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .84rem; color: var(--text-2); }
.pcard .prices b { color: var(--text); font-size: 1.02rem; }
.pcard .prices s { color: var(--muted); }
.profit { background: var(--green-50); border: 1px solid var(--green-100); border-radius: 12px; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; }
.profit span { font-size: .78rem; color: var(--green-700); font-weight: 600; }
.profit b { color: var(--green-600); font-size: 1.25rem; font-weight: 800; }
.pts { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-600); font-weight: 700; font-size: .82rem; }
.pcard .actions { display: flex; gap: 8px; margin-top: auto; }
.pcard .actions .btn { flex: 1; }

/* ---------------------------------------------------------- Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 18px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; background: var(--brand); color: #fff; text-decoration: none !important; transition: transform .12s, box-shadow .2s, background .2s; white-space: nowrap; min-height: 42px; }
.btn:hover { background: var(--violet-700); box-shadow: 0 6px 16px rgba(124,58,237,.3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.pink { background: var(--pink-500); } .btn.pink:hover { background: var(--pink-600); box-shadow: 0 6px 16px rgba(236,72,153,.3); }
.btn.green { background: var(--green-600); } .btn.green:hover { background: var(--green-700); box-shadow: 0 6px 16px rgba(5,150,105,.3); }
.btn.gold { background: var(--gold-500); color: #3b2300; } .btn.gold:hover { background: var(--gold-600); }
.btn.danger { background: var(--red-500); } .btn.danger:hover { background: var(--red-600); }
.btn.ghost { background: var(--violet-50); color: var(--violet-700); } .btn.ghost:hover { background: var(--violet-100); box-shadow: none; }
.btn.outline { background: transparent; color: var(--text); border: 1px solid var(--line); } .btn.outline:hover { background: var(--surface-2); box-shadow: none; }
.btn.white { background: #fff; color: var(--violet-700); } .btn.white:hover { background: var(--violet-50); }
.btn.sm { padding: 6px 12px; font-size: .8rem; min-height: 32px; border-radius: 9px; }
.btn.lg { padding: 14px 22px; font-size: 1rem; min-height: 52px; border-radius: 14px; }
.btn.block { width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--violet-50); color: var(--brand); }

label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; color: var(--text-2); }
.field { margin-bottom: 14px; }
.field .hint { font-size: .76rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid #ddd6ee; border-radius: 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet-500); box-shadow: 0 0 0 4px rgba(139, 92, 246, .14); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); vertical-align: middle; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters > * { flex: 1 1 150px; } .filters .btn { flex: 0 0 auto; }
.filters input, .filters select { min-height: 42px; padding: 8px 12px; font-size: .9rem; }

/* ---------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: start; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--violet-50); }
.sort { color: inherit; } .sort.on { color: var(--brand); }
.pager { display: flex; gap: 6px; align-items: center; padding: 14px; flex-wrap: wrap; }
.pager a { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .85rem; }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager a:hover { text-decoration: none; background: var(--violet-50); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-amber { background: var(--gold-100); color: #92400e; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-violet { background: var(--violet-100); color: var(--violet-700); }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-gray { background: #efedf4; color: #5b5570; }
.badge-pink { background: var(--pink-100); color: var(--pink-600); }

/* Tabs / chips */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.tabs a { padding: 7px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: .84rem; white-space: nowrap; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs a:hover { text-decoration: none; }
.tabs a .n { opacity: .75; margin-inline-start: 4px; }

/* Lists */
.list { display: flex; flex-direction: column; }
.list .li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list .li:last-child { border-bottom: 0; }
.list .li .grow { flex: 1; min-width: 0; }
.list .li .grow b, .list .li .grow span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .li .grow span { font-size: .8rem; color: var(--muted); }
.list .li .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 16px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--violet-500); box-shadow: 0 0 0 4px var(--violet-100); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 10px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }

/* Alerts, empty, toasts */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; display: flex; gap: 10px; align-items: flex-start; }
.alert.success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.alert.error { background: var(--red-50); color: #b91c1c; border: 1px solid #fecaca; }
.alert.info { background: var(--violet-50); color: var(--violet-700); border: 1px solid var(--violet-100); }
.alert.warn { background: var(--gold-50); color: #92400e; border: 1px solid var(--gold-100); }
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty .art { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(135deg, var(--violet-100), var(--pink-100)); color: var(--violet-600); }
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--text); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: .9rem; animation: toastIn .35s cubic-bezier(.2,.8,.2,1); display: flex; gap: 10px; align-items: center; }
.toast.success { background: var(--green-600); } .toast.error { background: var(--red-600); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(30, 20, 56, .5); display: none; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal.open { display: flex; animation: fade .2s; }
.modal .box { background: var(--surface); border-radius: 20px; padding: 22px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }

/* Celebrate */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: drop 2.4s ease-in forwards; }
@keyframes drop { to { transform: translateY(105vh) rotate(720deg); opacity: .3; } }
.pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Chat (tickets) */
.chat { display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.msg.me { align-self: flex-end; background: var(--violet-50); border-color: var(--violet-100); }
.msg.internal { background: var(--gold-50); border-color: var(--gold-100); }
.msg .meta { font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.msg p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }

/* Order builder (seller) */
.builder-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.builder-line img, .builder-line .ph { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--violet-50); display: grid; place-items: center; color: var(--violet-500); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.qty button { width: 38px; height: 38px; border: 0; background: var(--violet-50); color: var(--violet-700); font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.qty input { width: 48px; border: 0; text-align: center; min-height: 38px; padding: 0; border-radius: 0; }
.picker { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.picker button { display: flex; width: 100%; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; text-align: start; }
.picker button:hover { background: var(--violet-50); }
.picker button:disabled { opacity: .45; cursor: not-allowed; }
.picker img, .picker .ph { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--violet-50); flex-shrink: 0; }
.summary { position: sticky; top: 84px; }
.summary .line { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-2); }
.summary .total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-size: 1.15rem; font-weight: 800; color: var(--text); }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps span { flex: 1; height: 5px; border-radius: 99px; background: var(--violet-100); }
.steps span.on { background: linear-gradient(90deg, var(--violet-500), var(--pink-500)); }

/* Seller mobile bottom nav */
.bottom-nav { display: none; }
.fab { display: none; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #ede4ff, transparent), radial-gradient(900px 500px at 110% 110%, #fde4f2, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card { padding: 28px; }

/* ---------------------------------------------------------- Responsive */
@media (max-width: 1200px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } .summary { position: static; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 80; transform: translateX(-100%); transition: transform .25s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: none !important; box-shadow: var(--shadow-lg); }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .search { display: none; }
  .content { padding: 16px 16px 90px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .user-chip .who { display: none; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { padding: 14px; } .metric .value { font-size: 1.3rem; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .body { padding: 10px; gap: 6px; } .pcard h3 { font-size: .88rem; }
  .profit b { font-size: 1.05rem; } .profit { padding: 6px 8px; }
  .pcard .actions .btn.outline { display: none; }
  .earn-hero .big { font-size: 1.8rem; }
  .hero { padding: 20px; } .hero h1 { font-size: 1.3rem; }
  h1 { font-size: 1.3rem; }
  .table th, .table td { padding: 10px; }
  .msg { max-width: 92%; }
}
/* Seller: bottom navigation on phones */
@media (max-width: 900px) {
  .seller .bottom-nav { display: flex; position: fixed; bottom: 0; inset-inline: 0; background: var(--surface); border-top: 1px solid var(--line); z-index: 60; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .seller .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 10px; flex: 1; }
  .seller .bottom-nav a.on { color: var(--brand); }
  .seller .bottom-nav a:hover { text-decoration: none; }
  .seller .bottom-nav .add { margin-top: -26px; }
  .seller .bottom-nav .add span.circle { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--violet-600), var(--pink-500)); box-shadow: 0 8px 20px rgba(219, 39, 119, .4); border: 4px solid var(--surface); }
}
.backdrop { display: none; }
@media (max-width: 900px) { .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(30,20,56,.45); z-index: 70; } }
@media print { .sidebar, .topbar, .bottom-nav, .btn { display: none !important; } .shell { display: block; } }

/* Level-up celebration banner + gift picker */
.level-banner { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 22px; border-radius: 22px; color: #3b2300;
  background: linear-gradient(120deg, #fff7d6 0%, #fde68a 45%, #fbcfe8 100%); border: 2px solid var(--gold-400); box-shadow: 0 14px 34px rgba(245, 158, 11, .28); }
.level-banner h2 { margin: 0 0 4px; font-size: 1.3rem; }
.level-banner p { margin: 0; }
.level-banner-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 2.6rem; background: #fff;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--lc, #f59e0b) 35%, transparent); animation: glow 1.8s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 12px color-mix(in srgb, var(--lc, #f59e0b) 15%, transparent); } }
.gift-option { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding: 12px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; margin: 0; color: var(--text); }
.gift-option:has(input:checked) { border-color: var(--gold-500); background: var(--gold-50); box-shadow: 0 6px 16px rgba(245, 158, 11, .2); }
.gift-option img, .gift-option .gift-ph { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; font-size: 2rem; background: var(--gold-100); }
.pcard .img .disc { position: absolute; bottom: 10px; inset-inline-start: 10px; background: #fff; color: var(--pink-600); font-weight: 800; font-size: .74rem; padding: 3px 9px; border-radius: 99px; box-shadow: var(--shadow); }
@media print { body.seller .content > *:not(.split), .split > .stack > .card:not(#pack-catalog), .split > aside, #pack-catalog .row, #pack-catalog .field, .alert { display: none !important; } #pack-catalog { box-shadow: none; border: 0; } }
