/* =========================================================
   Mehrzad Panels — Manager & Admin dashboards
   Same identity as the site: black, gold, grey, brown, cream
   ========================================================= */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --font-fa: 'Vazirmatn', system-ui, sans-serif;
  --font-en: 'Manrope', system-ui, sans-serif;
  --font-display-en: 'Cormorant Garamond', Georgia, serif;
  --font: var(--font-fa);
  --r: 6px; --r-lg: 10px;
  --side: 264px;
}
html[lang='en'] { --font: var(--font-en); }
[data-theme='dark'] {
  --bg: #0a0a0a; --bg-2: #0f0f0e; --surface: #141312; --surface-2: #1b1917; --surface-3: #22201d; --brown: #2a2119;
  --text: #f5f2ec; --text-2: #bdb6ab; --muted: #8a847b; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.15);
  --gold: #c9a45c; --gold-2: #e2c78c; --gold-soft: rgba(201,164,92,.12); --on-gold: #0a0a0a;
  --ok: #3fb67a; --warn: #d9a23c; --bad: #d0574b; --info: #7f9cc9;
  --shadow: 0 24px 60px -28px rgba(0,0,0,.8); color-scheme: dark;
}
[data-theme='light'] {
  --bg: #f7f5f0; --bg-2: #f1ede5; --surface: #ffffff; --surface-2: #f6f3ed; --surface-3: #ece7de; --brown: #cdb89a;
  --text: #121110; --text-2: #4a453e; --muted: #7a736a; --line: rgba(0,0,0,.08); --line-2: rgba(0,0,0,.16);
  --gold: #9e7a34; --gold-2: #b8914a; --gold-soft: rgba(158,122,52,.1); --on-gold: #ffffff;
  --ok: #23905a; --warn: #b07b16; --bad: #b8443a; --info: #4a6ea5;
  --shadow: 0 20px 50px -30px rgba(40,30,15,.35); color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.7; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; transition: background-color .5s, color .5s; min-height: 100vh; }
body.is-locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums lining-nums; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- curtain (language change) ---------- */
.pcurtain { position: fixed; inset: 0; z-index: 500; background: #070707; display: grid; place-items: center; transform: scaleY(0); transform-origin: bottom; pointer-events: none; }
.pcurtain span { font-family: var(--font-display-en); font-size: 3rem; color: #c9a45c; opacity: 0; transition: opacity .3s; }
.pcurtain.is-in { transform: scaleY(1); transition: transform .38s var(--ease-io); }
.pcurtain.is-in span { opacity: 1; }
.pcurtain.is-out { transform: scaleY(0); transform-origin: top; transition: transform .45s var(--ease-io); }

/* ---------- buttons ---------- */
.pbtn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 42px; padding: 0 1.15rem; border-radius: var(--r); font-size: .86rem; font-weight: 500; white-space: nowrap; transition: transform .3s var(--ease-out), background-color .3s, color .3s, border-color .3s, box-shadow .3s, opacity .3s; isolation: isolate; }
.pbtn svg { width: 17px; height: 17px; flex: none; }
.pbtn:active { transform: scale(.97); }
.pbtn[disabled] { opacity: .45; pointer-events: none; }
.pbtn--primary { background: var(--gold); color: var(--on-gold); }
.pbtn--primary:hover { box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--gold) 80%, transparent); transform: translateY(-1px); }
.pbtn--primary::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.35) 50%, transparent 75%); transform: translateX(-120%); transition: transform .8s var(--ease-out); }
.pbtn--primary:hover::after { transform: translateX(120%); }
.pbtn--ghost { border: 1px solid var(--line-2); }
.pbtn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.pbtn--danger { background: var(--bad); color: #fff; }
.pbtn--danger:hover { box-shadow: 0 12px 30px -12px var(--bad); transform: translateY(-1px); }
.pbtn--ok { background: var(--ok); color: #fff; }
.pbtn--ok:hover { box-shadow: 0 12px 30px -12px var(--ok); transform: translateY(-1px); }
.pbtn--sm { min-height: 36px; padding: 0 .85rem; font-size: .8rem; }
.pbtn--xs { min-height: 30px; padding: 0 .6rem; font-size: .75rem; }
.pbtn--block { width: 100%; }
.pbtn.is-loading { color: transparent !important; }
.pbtn.is-loading::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--on-gold); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.picon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); transition: border-color .3s, color .3s, transform .3s var(--ease-out); font-size: 1.3rem; line-height: 1; }
.picon svg { width: 18px; height: 18px; }
.picon:hover { border-color: var(--gold); color: var(--gold); }
.plink { font-size: .8rem; color: var(--text-2); border-bottom: 1px solid var(--line-2); transition: color .3s, border-color .3s; }
.plink:hover { color: var(--gold); border-color: var(--gold); }
.pseg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.pseg button { padding: .2rem .7rem; border-radius: 99px; font-size: .72rem; font-weight: 600; font-family: var(--font-en); letter-spacing: .06em; color: var(--muted); transition: background-color .3s, color .3s; }
.pseg button.is-active { background: var(--gold); color: var(--on-gold); }

/* ---------- login ---------- */
.plogin { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.2rem; background: #070707; color: #f5f2ec; transition: opacity .6s var(--ease-out), visibility .6s; overflow-y: auto; }
[data-theme='light'] .plogin { background: #f3efe7; color: #121110; }
.is-authed .plogin { opacity: 0; visibility: hidden; pointer-events: none; }
.plogin__bg { position: absolute; inset: 0; background: radial-gradient(60% 50% at 50% 0%, rgba(201,164,92,.16), transparent 70%), radial-gradient(40% 40% at 90% 100%, rgba(120,90,50,.18), transparent 70%); pointer-events: none; }
.plogin__bg::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(201,164,92,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(201,164,92,.05) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 70%); }
.plogin__tools { position: absolute; top: 1rem; inset-inline: 1.2rem; display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.plogin__tools .plink { margin-inline-end: auto; }
.plogin__tools .plink, .plogin__tools .picon { color: inherit; }
.plogin__card { position: relative; width: min(420px, 100%); display: grid; justify-items: center; gap: .6rem; padding: 2.4rem 2rem 2rem; border: 1px solid rgba(201,164,92,.28); border-radius: 14px; background: rgba(20,19,18,.72); backdrop-filter: blur(14px); box-shadow: 0 40px 90px -40px rgba(0,0,0,.9); text-align: center; opacity: 0; transform: translateY(24px) scale(.98); transition: opacity .9s var(--ease-out) .15s, transform .9s var(--ease-out) .15s; }
[data-theme='light'] .plogin__card { background: rgba(255,255,255,.85); box-shadow: 0 40px 90px -50px rgba(60,40,10,.4); }
.is-ready .plogin__card { opacity: 1; transform: none; }
.plogin__card.shake { animation: shake .45s var(--ease-out); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.plogin__logo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid #c9a45c; margin-bottom: .3rem; }
.plogin__logo path:first-child { stroke-dasharray: 170; stroke-dashoffset: 170; animation: draw 1.6s var(--ease-out) .3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.plogin__brand { font-size: .78rem; letter-spacing: .12em; color: #c9a45c; }
.plogin__title { font-size: 1.5rem; font-weight: 400; line-height: 1.4; }
html[lang='en'] .plogin__title { font-family: var(--font-display-en); font-size: 2rem; font-weight: 500; }
.plogin__sub { font-size: .82rem; color: #a39c90; margin-bottom: .8rem; }
[data-theme='light'] .plogin__sub { color: #6b645a; }
.plogin__field { position: relative; width: 100%; display: flex; align-items: center; gap: .6rem; padding-inline: .9rem .4rem; border: 1px solid rgba(201,164,92,.3); border-radius: var(--r); background: rgba(0,0,0,.25); transition: border-color .3s, box-shadow .3s; }
[data-theme='light'] .plogin__field { background: #fff; }
.plogin__field:focus-within { border-color: #c9a45c; box-shadow: 0 0 0 4px rgba(201,164,92,.14); }
.plogin__field > svg { width: 18px; height: 18px; color: #c9a45c; flex: none; }
.plogin__field input { flex: 1; min-width: 0; height: 48px; background: none; border: 0; outline: 0; letter-spacing: .1em; text-align: start; }
.plogin__eye { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #8a847b; transition: color .3s; }
.plogin__eye svg { width: 18px; height: 18px; }
.plogin__eye.is-on { color: #c9a45c; }
.plogin__err { min-height: 1.3em; font-size: .8rem; color: #e07a6e; }
.plogin__note { font-size: .7rem; color: #7d776e; margin-top: .4rem; }

/* ---------- app shell ---------- */
.papp { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; opacity: 0; transition: opacity .6s var(--ease-out) .1s; }
.is-authed .papp { opacity: 1; }
body:not(.is-authed) .papp { visibility: hidden; height: 0; overflow: hidden; }
.pside { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.2rem; padding: 1.3rem 1rem; background: #0b0b0a; color: #e9e5dd; border-inline-end: 1px solid rgba(255,255,255,.06); z-index: 40; }
[data-theme='light'] .pside { background: #11100f; }
.pside__brand { display: flex; align-items: center; gap: .75rem; padding: .3rem .4rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.pside__brand svg, .pside__brand img { width: 38px; height: 38px; color: #c9a45c; flex: none; }
.pside__brand b { display: block; font-weight: 500; font-size: .95rem; line-height: 1.4; }
.pside__brand small { display: block; font-size: .7rem; color: #c9a45c; letter-spacing: .06em; }
.pnav { display: grid; gap: .2rem; overflow-y: auto; }
.pnav__item { position: relative; display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: var(--r); font-size: .86rem; color: #a39c90; text-align: start; transition: background-color .3s, color .3s; }
.pnav__item::before { content: ''; position: absolute; inset-inline-start: -1rem; top: 20%; bottom: 20%; width: 2px; background: #c9a45c; transform: scaleY(0); transition: transform .4s var(--ease-out); }
.pnav__item:hover { color: #f5f2ec; background: rgba(255,255,255,.04); }
.pnav__item.is-active { color: #f5f2ec; background: rgba(201,164,92,.12); }
.pnav__item.is-active::before { transform: scaleY(1); }
.pnav__ic { width: 20px; height: 20px; display: grid; place-items: center; color: #c9a45c; flex: none; }
.pnav__ic svg { width: 18px; height: 18px; }
.pnav__badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #c9a45c; color: #0a0a0a; font-size: .68rem; font-style: normal; font-weight: 700; display: none; place-items: center; }
.pnav__badge.is-on { display: grid; animation: pop .4s var(--ease-out); }
@keyframes pop { from { transform: scale(.4); } }
.pside__foot { margin-top: auto; padding: .8rem .4rem 0; border-top: 1px solid rgba(255,255,255,.08); }
.pside__foot .plink { color: #a39c90; }
.pmain { min-width: 0; display: flex; flex-direction: column; }
.ptop { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .7rem; padding: .8rem clamp(1rem, .5rem + 2vw, 2rem); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.ptop__title { font-size: 1.15rem; font-weight: 500; margin-inline-end: auto; }
html[lang='en'] .ptop__title { font-family: var(--font-display-en); font-size: 1.6rem; font-weight: 600; }
.ptop__price { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--text-2); padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; }
.ptop__price b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.ptop__price:empty { display: none; }
.pburger { display: none; }
.pscrim { display: none; }
.pview { padding: clamp(1rem, .5rem + 2vw, 2rem); opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease-out), transform .6s var(--ease-out); }
.pview.is-in { opacity: 1; transform: none; }
.pskel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.pskel i { height: 110px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- blocks ---------- */
.pgrid { display: grid; gap: 1rem; }
.pgrid--kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.pgrid--kpi.k6 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1280px) { .pgrid--kpi.k6 { grid-template-columns: repeat(6, 1fr); } }
.pgrid--2 { grid-template-columns: 1.4fr 1fr; }
.pgrid--2e { grid-template-columns: 1fr 1fr; }
.pgrid + .pgrid, .pgrid + .pcard, .pcard + .pgrid, .pcard + .pcard { margin-top: 1rem; }
.pcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.3rem; min-width: 0; animation: rise .6s var(--ease-out) both; }
.pgrid > .pcard:nth-child(2) { animation-delay: .06s; } .pgrid > .pcard:nth-child(3) { animation-delay: .12s; } .pgrid > .pcard:nth-child(4) { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.pcard__head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pcard__title { font-size: .98rem; font-weight: 500; }
.pcard__sub { font-size: .76rem; color: var(--muted); }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.05rem 1.15rem; animation: rise .6s var(--ease-out) both; transition: border-color .3s, transform .4s var(--ease-out); }
.kpi:hover { border-color: var(--line-2); transform: translateY(-2px); }
.pgrid--kpi > .kpi:nth-child(2) { animation-delay: .04s; } .pgrid--kpi > .kpi:nth-child(3) { animation-delay: .08s; } .pgrid--kpi > .kpi:nth-child(4) { animation-delay: .12s; } .pgrid--kpi > .kpi:nth-child(5) { animation-delay: .16s; } .pgrid--kpi > .kpi:nth-child(6) { animation-delay: .2s; }
.kpi__label { font-size: .75rem; color: var(--muted); }
.kpi__value { font-size: 1.45rem; font-weight: 600; line-height: 1.4; margin-top: .25rem; font-variant-numeric: tabular-nums lining-nums; word-break: break-word; }
.kpi__sub { font-size: .72rem; color: var(--text-2); margin-top: .15rem; }
.kpi--accent { background: linear-gradient(140deg, var(--gold-soft), transparent 70%), var(--surface); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.kpi--accent .kpi__value { color: var(--gold); }

/* status pill */
.pstatus { display: inline-flex; align-items: center; gap: .45rem; padding: .18rem .65rem; border-radius: 99px; font-size: .74rem; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pstatus i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pstatus[data-s='ok'] { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pstatus[data-s='ok'] i { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.pstatus[data-s='bad'] { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.pstatus[data-s='warn'] { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pstatus[data-s='info'] { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.pstatus[data-s='gold'] { color: var(--gold); background: var(--gold-soft); }

/* toolbar */
.ptools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.psearch { position: relative; flex: 1 1 240px; max-width: 360px; }
.psearch svg { position: absolute; inset-inline-start: .8rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.psearch input { width: 100%; height: 40px; padding-inline: 2.3rem .9rem; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); outline: 0; transition: border-color .3s, box-shadow .3s; }
.psearch input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.pselect, .pinput, .ptextarea { height: 40px; padding: 0 .8rem; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); outline: 0; transition: border-color .3s, box-shadow .3s; min-width: 0; }
.ptextarea { height: auto; min-height: 84px; padding: .6rem .8rem; resize: vertical; }
.pselect:focus, .pinput:focus, .ptextarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.pinput.is-bad { border-color: var(--bad); }
.pchips { display: flex; gap: .35rem; flex-wrap: wrap; }
.pchip { padding: .3rem .8rem; border: 1px solid var(--line-2); border-radius: 99px; font-size: .76rem; color: var(--text-2); transition: background-color .3s, color .3s, border-color .3s; }
.pchip:hover { border-color: var(--gold); color: var(--text); }
.pchip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.pchip small { opacity: .65; margin-inline-start: .25rem; font-variant-numeric: tabular-nums; }
.pspacer { flex: 1; }

/* table */
.ptable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.ptable { width: 100%; border-collapse: collapse; font-size: .84rem; }
.ptable th { position: sticky; top: 0; text-align: start; font-weight: 500; font-size: .74rem; color: var(--muted); padding: .75rem .9rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.ptable td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tbody tr { transition: background-color .25s; animation: rowIn .45s var(--ease-out) both; }
.ptable tbody tr:hover { background: var(--surface-2); }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
.ptable tr.is-off td:not(:last-child) { opacity: .5; }
.ptable .num { white-space: nowrap; }
.pthumb { width: 46px; height: 46px; border-radius: var(--r); object-fit: cover; background: var(--surface-3); flex: none; }
.pcell { display: flex; align-items: center; gap: .75rem; min-width: 200px; }
.pcell b { display: block; font-weight: 500; line-height: 1.45; }
.pcell small { display: block; font-size: .72rem; color: var(--muted); }
.pacts { display: flex; gap: .3rem; justify-content: flex-end; }
.pacts .picon { width: 34px; height: 34px; }
.pacts .picon svg { width: 16px; height: 16px; }
.picon--bad:hover { border-color: var(--bad); color: var(--bad); }

/* toggle */
.ptoggle { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .84rem; user-select: none; }
.ptoggle input { position: absolute; opacity: 0; pointer-events: none; }
.ptoggle i { position: relative; width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background-color .35s, border-color .35s; flex: none; }
.ptoggle i::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .4s var(--ease-out), background-color .35s; }
.ptoggle input:checked + i { background: var(--gold); border-color: var(--gold); }
.ptoggle input:checked + i::after { background: #fff; transform: translateX(16px); }
html[dir='rtl'] .ptoggle input:checked + i::after { transform: translateX(-16px); }
.ptoggle input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

/* form */
.pform { display: grid; gap: 1rem; }
.pform__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .9rem; }
.pfield { display: grid; gap: .35rem; font-size: .8rem; color: var(--text-2); min-width: 0; align-content: start; }
.pform__row { align-items: start; }
.pfield > span { font-weight: 500; }
.pfield small { font-size: .7rem; color: var(--muted); }
.pfield .pinput, .pfield .pselect, .pfield .ptextarea { width: 100%; color: var(--text); }
.pform__sec { font-size: .78rem; color: var(--gold); letter-spacing: .06em; padding-top: .4rem; border-top: 1px solid var(--line); margin-top: .2rem; }
.pform__err { font-size: .8rem; color: var(--bad); min-height: 1.2em; }
.pradio { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); padding: 3px; gap: 3px; }
.pradio label { position: relative; cursor: pointer; }
.pradio input { position: absolute; opacity: 0; }
.pradio span { display: block; padding: .35rem .8rem; border-radius: 4px; font-size: .8rem; color: var(--text-2); transition: background-color .3s, color .3s; }
.pradio input:checked + span { background: var(--gold); color: var(--on-gold); }
.pradio input:focus-visible + span { outline: 2px solid var(--gold); }

/* image picker */
.pimgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: .5rem; grid-auto-rows: 88px; align-content: start; max-height: 290px; overflow-y: auto; padding: .2rem; }
.pimg { position: relative; height: 88px; padding: 0; display: block; width: 100%; border-radius: var(--r); overflow: hidden; border: 2px solid transparent; background: var(--surface-3); transition: border-color .25s, transform .3s var(--ease-out); }
.pimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-out); }
.pimg:hover img { transform: scale(1.08); }
.pimg.is-on { border-color: var(--gold); }
.pimg em { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 20px; height: 20px; border-radius: 99px; background: var(--gold); color: var(--on-gold); font-size: .68rem; font-style: normal; font-weight: 700; display: none; place-items: center; padding: 0 5px; }
.pimg.is-on em { display: grid; }
.pimg small { position: absolute; bottom: 3px; inset-inline-start: 4px; font-size: .6rem; color: #fff; background: rgba(0,0,0,.55); padding: 0 .3rem; border-radius: 3px; font-family: var(--font-en); }

/* variants editor */
.pvars { display: grid; gap: .5rem; }
.pvar { display: grid; grid-template-columns: 1fr 1fr 110px 36px; gap: .5rem; align-items: center; }

/* price preview */
.pbreak { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.pbreak div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .85rem; font-size: .8rem; color: var(--text-2); border-bottom: 1px solid var(--line); }
.pbreak div:last-child { border-bottom: 0; }
.pbreak b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.pbreak .is-total { background: var(--gold-soft); }
.pbreak .is-total b { color: var(--gold); font-size: .98rem; font-weight: 700; }
.pbreak .is-off b { color: var(--ok); }
.pformula { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-2); }
.pformula span { padding: .25rem .6rem; border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface-2); }
.pformula i { font-style: normal; color: var(--gold); }

/* sources */
.psrc { display: grid; gap: .5rem; }
.psrc__row { display: grid; grid-template-columns: 1.4fr auto 1fr 1fr; gap: .8rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); font-size: .8rem; }
.psrc__row.is-used { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.psrc__name b { display: block; font-weight: 500; }
.psrc__name small { color: var(--muted); font-size: .7rem; }
.psrc__val { font-variant-numeric: tabular-nums; }
.psrc__why { color: var(--muted); font-size: .72rem; }

/* price hero in panel */
.pprice { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pprice__v { font-size: clamp(1.8rem, 1.2rem + 2vw, 2.6rem); font-weight: 300; line-height: 1.2; font-variant-numeric: tabular-nums lining-nums; }
.pprice__v small { font-size: .9rem; color: var(--gold); margin-inline-start: .4rem; }
.pprice__meta { font-size: .76rem; color: var(--muted); display: grid; gap: .1rem; }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; color: var(--gold); }
.chart text { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.cgrid line { stroke: var(--line); stroke-dasharray: 3 4; }
.cbar__bg { fill: var(--surface-2); }
.cbar__v { fill: var(--gold); transform-origin: bottom; transform-box: fill-box; animation: barUp .9s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); transition: fill .3s; }
.cbar:hover .cbar__v { fill: var(--gold-2); }
@keyframes barUp { from { transform: scaleY(0); } }
.cline { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; animation: lineDraw 1.4s var(--ease-out) forwards; vector-effect: non-scaling-stroke; }
@keyframes lineDraw { to { stroke-dashoffset: 0; } }
.cline__area { animation: fadeIn 1s ease .4s both; }
.chart--line circle { fill: var(--surface); stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; animation: fadeIn .5s ease 1s both; }
@keyframes fadeIn { from { opacity: 0; } }
.chart__max { font-size: .7rem; color: var(--muted); margin-top: .3rem; }
.donut { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.donut__svg circle { transition: stroke-width .3s; animation: fadeIn .6s ease both; animation-delay: calc(var(--i, 0) * 90ms); }
.donut__svg circle:hover { stroke-width: 24; }
.donut__n { font-size: 20px; font-weight: 600; fill: var(--text); font-family: var(--font); }
.donut__l { font-size: 10px; fill: var(--muted); font-family: var(--font); }
.donut__legend { list-style: none; display: grid; gap: .35rem; flex: 1; min-width: 150px; font-size: .78rem; }
.donut__legend li { display: flex; align-items: center; gap: .5rem; }
.donut__legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.donut__legend span { flex: 1; color: var(--text-2); }
.donut__legend b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ptabs { display: inline-flex; gap: .2rem; border: 1px solid var(--line); border-radius: 99px; padding: 3px; }
.ptabs button { padding: .25rem .8rem; border-radius: 99px; font-size: .74rem; color: var(--text-2); transition: background-color .3s, color .3s; }
.ptabs button.is-active { background: var(--gold); color: var(--on-gold); }
.ptop-list { display: grid; gap: .6rem; }
.ptop-list li { list-style: none; display: flex; align-items: center; gap: .7rem; font-size: .82rem; }
.ptop-list .rank { width: 22px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.ptop-list .bar { height: 4px; border-radius: 4px; background: var(--gold); margin-top: .3rem; transform-origin: inline-start; animation: grow .9s var(--ease-out) both; }
@keyframes grow { from { transform: scaleX(0); } }
.ptop-list .grow { flex: 1; min-width: 0; }
.ptop-list .grow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* orders */
.pstatus-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.porder-steps { display: flex; gap: .4rem; flex-wrap: wrap; }
.ptimeline { list-style: none; display: grid; gap: .5rem; border-inline-start: 1px solid var(--line-2); padding-inline-start: 1rem; }
.ptimeline li { position: relative; font-size: .78rem; color: var(--text-2); }
.ptimeline li::before { content: ''; position: absolute; inset-inline-start: calc(-1rem - 4px); top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.pdetail { display: grid; grid-template-columns: 140px 1fr; gap: 1.2rem; }
.pdetail img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r); }
.pkv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .82rem; }
.pkv dt { color: var(--muted); }
.pkv dd { font-weight: 500; }

/* hours */
.phours { display: grid; gap: .5rem; }
.phour { display: grid; grid-template-columns: 110px auto 1fr 1fr; gap: .8rem; align-items: center; padding: .65rem .9rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); transition: opacity .3s; }
.phour b { font-weight: 500; }
.phour.is-closed .pinput { opacity: .35; pointer-events: none; }
.phour .pinput { width: 100%; direction: ltr; text-align: center; font-variant-numeric: tabular-nums; }

/* designer control */
.pctrl { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.pctrl__card { position: relative; overflow: hidden; display: grid; gap: .9rem; padding: 1.3rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); animation: rise .6s var(--ease-out) both; transition: border-color .4s; }
.pctrl__card[data-state='off'] { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--bad) 8%, transparent), transparent 60%), var(--surface); }
.pctrl__card[data-state='on'] { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pctrl__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pctrl__head b { display: block; font-size: 1rem; font-weight: 500; }
.pctrl__head small { color: var(--muted); font-size: .74rem; }
.pctrl__big { display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; font-weight: 600; letter-spacing: .02em; }
.pctrl__big i { width: 12px; height: 12px; border-radius: 50%; }
.pctrl__big[data-s='on'] { color: var(--ok); } .pctrl__big[data-s='on'] i { background: var(--ok); animation: pulse 2s infinite; color: var(--ok); }
.pctrl__big[data-s='off'] { color: var(--bad); } .pctrl__big[data-s='off'] i { background: var(--bad); }
.pctrl__rows { display: grid; gap: .5rem; }
.pctrl__row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem .8rem; border-radius: var(--r); background: var(--surface-2); font-size: .8rem; flex-wrap: wrap; }
.pctrl__row > span { color: var(--text-2); }

/* modal */
.pmodal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1rem; }
.pmodal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.pmodal__panel { position: relative; width: min(560px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); opacity: 0; transform: translateY(20px) scale(.97); transition: opacity .35s var(--ease-out), transform .45s var(--ease-out); }
.pmodal__panel--wide { width: min(940px, 100%); }
.pmodal.is-open .pmodal__backdrop { opacity: 1; }
.pmodal.is-open .pmodal__panel { opacity: 1; transform: none; }
.pmodal.is-closing .pmodal__panel { opacity: 0; transform: translateY(10px) scale(.98); transition-duration: .22s; }
.pmodal.is-closing .pmodal__backdrop { opacity: 0; }
.pmodal__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.pmodal__head h3 { font-size: 1.02rem; font-weight: 500; }
.pmodal__body { padding: 1.2rem 1.3rem; overflow-y: auto; }
.pmodal__foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.3rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pconfirm { display: grid; justify-items: center; text-align: center; gap: .9rem; padding: .5rem 0; }
.pconfirm p { font-size: .95rem; line-height: 1.8; max-width: 42ch; }
.pconfirm__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; color: var(--gold); border: 1.5px solid currentColor; animation: pop .5s var(--ease-out); }
.pconfirm--danger .pconfirm__icon { color: var(--bad); box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 10%, transparent); }
.pconfirm .pfield { width: 100%; text-align: start; }

.pempty { display: grid; justify-items: center; gap: .6rem; padding: 2.4rem 1rem; text-align: center; color: var(--muted); font-size: .85rem; }
.pempty span { font-size: 1.6rem; color: var(--gold); opacity: .6; }
.pempty--err span { color: var(--bad); opacity: 1; }
.pnote { font-size: .76rem; color: var(--muted); line-height: 1.8; }
.pnote code { font-family: ui-monospace, monospace; font-size: .74rem; background: var(--surface-2); padding: .05rem .35rem; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
.palert { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r); font-size: .82rem; border: 1px solid; }
.palert[data-s='warn'] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.palert[data-s='bad'] { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.palert[data-s='ok'] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.palert p { color: var(--text-2); }

.ptoast { position: fixed; bottom: 1.2rem; left: 50%; z-index: 300; transform: translate(-50%, 20px); opacity: 0; visibility: hidden; padding: .7rem 1.2rem; border-radius: 99px; background: var(--text); color: var(--bg); font-size: .84rem; box-shadow: var(--shadow); transition: opacity .35s var(--ease-out), transform .45s var(--ease-out), visibility .35s; max-width: calc(100vw - 2rem); text-align: center; }
.ptoast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.ptoast[data-type='warn'] { background: var(--bad); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .pgrid--2, .pgrid--2e { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .papp { grid-template-columns: 1fr; }
  .pside { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(280px, 84vw); transform: translateX(-105%); transition: transform .5s var(--ease-out); }
  html[dir='rtl'] .pside { transform: translateX(105%); }
  .nav-open .pside { transform: none !important; }
  .pscrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.55); opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s; }
  .nav-open .pscrim { opacity: 1; visibility: visible; }
  .pburger { display: grid; }
  .ptop__price { display: none; }
  .psrc__row { grid-template-columns: 1fr auto; }
  .phour { grid-template-columns: 1fr auto; }
  .phour .pinput { grid-column: span 1; }
  .pskel { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .ptop { gap: .45rem; padding-inline: .8rem; }
  .ptop__title { font-size: 1rem; }
  #pLogout span { display: none; }
  #pLogout { padding: 0 .6rem; }
  .pgrid--kpi, .pgrid--kpi.k6 { grid-template-columns: 1fr 1fr; }
  .kpi__value { font-size: 1.12rem; }
  .pvar { grid-template-columns: 1fr 1fr; }
  .pdetail { grid-template-columns: 1fr; }
  .pdetail img { max-width: 160px; }
  .pctrl { grid-template-columns: 1fr; }
  .plogin__card { padding: 2rem 1.3rem 1.6rem; }
  .pmodal { padding: 0; align-items: end; }
  .pmodal__panel { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .ptable { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Enhanced Panel Responsive */
@media (max-width: 768px) {
  .pgrid--kpi, .pgrid--kpi.k6 { grid-template-columns: repeat(2, 1fr); }
  .pgrid--2e { grid-template-columns: 1fr; }
  .pdetail { grid-template-columns: 1fr; }
  .pdetail img { max-width: 140px; }
  .pctrl { grid-template-columns: 1fr; }
  .pvar { grid-template-columns: 1fr 1fr; }
  .pmodal__panel { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .pmodal { padding: 0; align-items: end; }
  .ptable { font-size: .8rem; }
  .ptable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ptop__title { font-size: 1rem; }
  .plogin__card { padding: 1.8rem 1.2rem 1.4rem; }
}

@media (max-width: 400px) {
  .pgrid--kpi, .pgrid--kpi.k6 { grid-template-columns: 1fr; }
  .pvar { grid-template-columns: 1fr; }
  .ptop { gap: .35rem; padding-inline: .6rem; }
  .ptop__title { font-size: .9rem; }
  .pbtn { min-height: 44px; }
  .pinput { font-size: 16px; }
}

/* Safe area insets for panel */
@supports (padding: env(safe-area-inset-top)) {
  .ptop { padding-top: calc(.6rem + env(safe-area-inset-top)); }
  .ptoast { bottom: calc(1.2rem + env(safe-area-inset-bottom)); }
}
.pfield > .pradio { justify-self: start; }
.pstatus--emo > i { display: none; }


/* ================= Site Images panel ================= */
.plogo-manage { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.plogo-preview { display: flex; flex-direction: column; align-items: center; gap: .6rem; flex-shrink: 0; }
.plogo-status { font-size: .8rem; }
.plogo-actions { display: flex; flex-direction: column; gap: .6rem; flex: 1; min-width: 240px; }
.plogo-actions .pbtn { justify-content: flex-start; }
