/* ── پنل مدیریت مجموعه ─────────────────────────────────────────────────────
   خنثی و مستقل از برندِ وی‌مال، چون همین پنل برای مال‌های دیگر هم هست.
   رنگِ بخش‌ها (c-*) همان پالتِ لوگوی وی‌مال است چون بخش‌ها رنگِ خودشان را دارند. */
:root {
  --ink: #1E1B2E; --ink-soft: #4B455F; --ink-faint: #7A7391;
  --line: #E6E2F0; --bg: #F5F4FA; --card: #fff;
  --brand: #5B21B6; --brand-d: #3B0F70;
  --ok: #2E7D32; --bad: #C62828;
  --r: 14px;
  --sh: 0 1px 2px rgba(30,27,46,.05), 0 6px 18px rgba(30,27,46,.06);
  color-scheme: light;
}
.c-orange { --c: #FCA009; } .c-red { --c: #EE221C; } .c-green { --c: #81A638; } .c-teal { --c: #04889E; }
.c-purple { --c: #7133C8; } .c-violet { --c: #8B5CF6; } .c-caramel { --c: #D9821A; } .c-pink { --c: #EE4D72; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.8 Vazirmatn, Tahoma, system-ui, sans-serif; }
a { color: var(--brand); }
h1, h2 { line-height: 1.4; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
.muted { color: var(--ink-faint); }
.small { font-size: .82rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.secret { background: #fff; border: 1px dashed var(--brand); padding: 2px 8px; border-radius: 6px; user-select: all; }

/* ── چیدمان ── */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #15121F; color: rgba(255,255,255,.8); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-head { padding: 20px 18px 12px; border-bottom: 1px solid rgba(255,255,255,.08); display: grid; gap: 6px; }
.product { color: #fff; font-size: 1rem; }
.mall-name { font-size: .9rem; color: #CFC6F5; }
.mall-switch select { width: 100%; background: #221D33; color: #fff; border: 1px solid #3A3352; border-radius: 8px; padding: 6px; font: inherit; }
.side nav { display: grid; padding: 10px 8px; gap: 2px; }
.side nav a { color: rgba(255,255,255,.75); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .92rem; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.on { background: var(--brand); color: #fff; }
.side nav a.admin { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.08); border-radius: 0; padding-top: 14px; color: #F5C27A; }
.side-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); display: grid; gap: 2px; font-size: .88rem; }
.side-foot a { color: #fff; text-decoration: none; }
.side-foot small { color: rgba(255,255,255,.5); }
button.link { background: none; border: 0; color: #F28B82; padding: 0; font: inherit; cursor: pointer; text-align: start; }
.burger { display: none; }

.main { padding: 24px clamp(14px, 3vw, 36px) 60px; min-width: 0; }
.main.solo { display: grid; place-items: center; min-height: 100vh; }
.page-title { font-size: 1.45rem; font-weight: 900; margin: 0 0 1rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 0 0 auto; width: 260px; z-index: 20; transform: translateX(100%); transition: transform .25s; }
  .nav-toggle:checked ~ .side { transform: none; box-shadow: -10px 0 40px rgba(0,0,0,.3); }
  .burger { display: grid; gap: 4px; position: fixed; top: 12px; left: 12px; z-index: 30; background: #15121F; padding: 10px; border-radius: 10px; cursor: pointer; }
  .burger span { width: 20px; height: 2px; background: #fff; border-radius: 2px; }
  .main { padding-top: 60px; }
}

/* ── کارت‌ها و شبکه ── */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 18px 20px; margin-bottom: 18px; }
.card.narrow, .narrow { max-width: 720px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2.wide-first { grid-template-columns: 1.6fr 1fr; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .card + .grid-2, .grid-2 + .grid-2 { margin-top: 18px; }
@media (max-width: 1100px) { .grid-2, .grid-2.wide-first { grid-template-columns: 1fr; } .grid-2 > .card { margin-bottom: 0; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 16px 18px; display: grid; border-top: 4px solid var(--brand); }
.kpi span { font-size: .85rem; color: var(--ink-faint); }
.kpi strong { font-size: 1.6rem; font-weight: 900; line-height: 1.4; }
.kpi small { color: var(--ink-faint); font-size: .78rem; }
.kpi.neg { border-top-color: var(--bad); } .kpi.neg strong { color: var(--bad); }

/* ── جدول ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: start; font-weight: 500; color: var(--ink-faint); font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
tr.voided td { text-decoration: line-through; color: var(--ink-faint); }
tr.voided td:last-child { text-decoration: none; }
tr.muted-row td { color: var(--ink-faint); }
td input, td select { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; max-width: 160px; }
.neg { color: var(--bad); } .pos { color: var(--ok); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--brand)); margin-inline-end: 6px; }
.tag { font-size: .75rem; background: var(--bg); padding: 2px 8px; border-radius: 999px; color: var(--ink-faint); }
form.inline { display: inline-flex; gap: 6px; align-items: center; }
form.inline input { width: 120px; }
td.actions { white-space: nowrap; }

/* ── فرم ── */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; min-width: 0; }
.form label > span { font-size: .85rem; font-weight: 700; }
.form label small { font-weight: 400; color: var(--ink-faint); }
.form input, .form select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.form input:focus, .form select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,33,182,.15); }
.form .row, .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.row-4 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 0; }
legend { font-size: .85rem; font-weight: 700; padding: 0 6px; }
.form .btn { justify-self: start; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; border: 1px solid transparent; border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--brand-d); }
.btn-sm { padding: 4px 12px; font-size: .85rem; border-radius: 8px; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--bad); border-color: #F3C4C4; }
.btn-danger:hover { background: #FDECEC; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; background: #EEF; }
.alert.ok { background: #E8F5E9; border: 1px solid #A5D6A7; }
.alert.err { background: #FDECEC; border: 1px solid #F3C4C4; }

.period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.period label { display: flex; gap: 6px; align-items: center; font-size: .88rem; }
.period input, .period select { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; width: 120px; background: #fff; }
.period select { width: auto; }

/* ── نمودارها (فقط CSS) ── */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; direction: ltr; padding-top: 8px; }
.bars span { flex: 1; min-height: 2px; height: var(--h); background: linear-gradient(180deg, #8B5CF6, var(--brand)); border-radius: 4px 4px 0 0; }
.bars span:hover { background: var(--brand-d); }
.bars-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--ink-faint); direction: ltr; margin-top: 4px; }
.stackbar { display: flex; height: 18px; border-radius: 999px; overflow: hidden; margin: 6px 0 14px; direction: ltr; }
.m-cash { background: #81A638; } .m-card { background: #5B21B6; } .m-online { background: #04889E; } .m-credit { background: #FCA009; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend b { margin-inline-start: auto; }
.legend small { color: var(--ink-faint); width: 42px; text-align: end; }

.share-totals { display: grid; gap: 8px; }
.share-total { display: grid; grid-template-columns: 160px 1fr 70px; gap: 12px; align-items: center; font-size: .9rem; }
.meter { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: #FCA009; border-radius: 999px; }
.meter i.full { background: var(--ok); }
ul.plain { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 4px; }

/* ── ورود ── */
.login { width: min(380px, 100%); background: #fff; border-radius: 18px; box-shadow: var(--sh); padding: 28px; }
.login h1 { font-size: 1.2rem; margin: 0 0 1rem; }
.login .btn { width: 100%; justify-content: center; }

/* وضعیت‌ها (سفارش و واحد) */
.tag.st-paid, .tag.st-available { background: #E8F5E9; color: #2E7D32; }
.tag.st-pending, .tag.st-reserved { background: #FFF3E0; color: #E65100; }
.tag.st-failed, .tag.st-cancelled { background: #FDECEC; color: #C62828; }
.tag.st-sold, .tag.st-rented, .tag.st-owner_use { background: #EDE7F6; color: #4527A0; }
details > summary { list-style: none; cursor: pointer; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
