/* Geexon admin panel — phone first, right to left, dark by default. */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/vazirmatn-extrabold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #0E0F12; --surface: #1A1C21; --surface2: #24262C; --chip: #1E2026; --border: #2A2D34; --nav: #15161A;
  --text: #F2F2F4; --text2: #C9CCD4; --muted: #A9ADB7; --faint: #8A8F99;
  --accent: #FF6B3D; --accent-text: #FF8A63; --accent-soft: rgba(255,107,61,.16); --on-accent: #1A0E08;
  --ok: #4CD48A; --ok-soft: rgba(76,212,138,.12); --warn: #F5B83D; --warn-soft: rgba(245,184,61,.12); --err: #FF6B6B; --err-soft: rgba(255,107,107,.12);
  --switch-off: #3A3D45; --knob-off: #A9ADB7;
  --radius: 16px; --gap: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F4F4F6; --surface: #FFFFFF; --surface2: #ECEDF1; --chip: #ECEDF1; --border: #DCDEE4; --nav: #FFFFFF;
  --text: #15161A; --text2: #3C3F47; --muted: #5C606B; --faint: #6B707B;
  --accent: #E8552A; --accent-text: #C2441C; --accent-soft: rgba(232,85,42,.12); --on-accent: #FFFFFF;
  --ok: #138A4C; --ok-soft: rgba(19,138,76,.10); --warn: #A86A00; --warn-soft: rgba(168,106,0,.10); --err: #C93434; --err-soft: rgba(201,52,52,.10);
  --switch-off: #C9CCD4; --knob-off: #FFFFFF;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #F4F4F6; --surface: #FFFFFF; --surface2: #ECEDF1; --chip: #ECEDF1; --border: #DCDEE4; --nav: #FFFFFF;
    --text: #15161A; --text2: #3C3F47; --muted: #5C606B; --faint: #6B707B;
    --accent: #E8552A; --accent-text: #C2441C; --accent-soft: rgba(232,85,42,.12); --on-accent: #FFFFFF;
    --ok: #138A4C; --ok-soft: rgba(19,138,76,.10); --warn: #A86A00; --warn-soft: rgba(168,106,0,.10); --err: #C93434; --err-soft: rgba(201,52,52,.10);
    --switch-off: #C9CCD4; --knob-off: #FFFFFF;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Vazirmatn", system-ui, sans-serif; font-size: 14px; line-height: 1.6; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ic { flex: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ltr { direction: ltr; unicode-bidi: plaintext; text-align: left; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: plaintext; }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Shell ------------------------------------------------------------------------------------------- */
.shell { min-height: 100vh; display: flex; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.content { width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: var(--gap); }
body.bare .main { padding-bottom: 0; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top-title h1 { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title span { font-size: 12px; color: var(--faint); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.logo { width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; text-decoration: none !important; }
.logo.big { width: 64px; height: 64px; border-radius: 18px; font-size: 32px; }
.icon-btn { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--text); background: transparent; border: none; position: relative; cursor: pointer; }
.icon-btn:hover { background: var(--chip); text-decoration: none; }
.icon-btn .dot { position: absolute; top: 10px; left: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.bottom { position: fixed; bottom: 0; right: 0; left: 0; z-index: 10; display: flex; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); background: var(--nav); border-top: 1px solid var(--border); }
.bottom a { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11px; text-decoration: none; border-radius: 12px; }
.bottom a[aria-current] { color: var(--accent); font-weight: 700; }

.side { display: none; }
@media (min-width: 900px) {
  .bottom { display: none; }
  .main { padding-bottom: 0; }
  .side { display: flex; flex-direction: column; width: 260px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--nav); border-left: 1px solid var(--border); padding: 14px 10px 24px; gap: 2px; }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; font-weight: 800; font-size: 16px; color: var(--text); text-decoration: none; }
  .side .brand .logo { width: 34px; height: 34px; font-size: 17px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: 10px; color: var(--text2); text-decoration: none; font-size: 13.5px; }
  .side nav a:hover { background: var(--chip); }
  .side nav a[aria-current] { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
  .side-group { font-size: 11.5px; color: var(--faint); padding: 14px 10px 4px; }
  .top .logo { display: none; }
  .content { padding: 22px 24px 40px; }
}

/* --- Cards and lists ------------------------------------------------------------------------------- */
.card { background: var(--surface); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.outline { border: 1px solid var(--border); }
.card-h { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.card-h h2 { font-size: 14.5px; font-weight: 700; }
.card-h .hint, .card > .hint { font-size: 12px; color: var(--faint); }
.hint { font-size: 12px; color: var(--faint); line-height: 1.6; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .grid-wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; } .grid-wide > * { min-width: 0; } }

.list { background: var(--surface); border-radius: var(--radius); padding: 0 14px; display: flex; flex-direction: column; }
.list > .li, .list > .row-item { border-bottom: 1px solid var(--surface2); }
.list > :last-child { border-bottom: none; }
.li { display: flex; align-items: center; gap: 12px; min-height: 52px; color: var(--text); text-decoration: none !important; padding: 6px 0; }
.li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li .chev { color: var(--faint); }
.row-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; min-height: 48px; }
.row-item .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-item .t { font-size: 13.5px; font-weight: 700; }
.section-label { font-size: 12px; color: var(--faint); padding: 0 4px; margin-bottom: -6px; }

.stat { background: var(--surface); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; min-width: 0; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 11.5px; color: var(--faint); }
.stat .v.sm { font-size: 16px; white-space: normal; line-height: 1.5; padding: 4px 0; }
.stat .s.ok { color: var(--ok); } .stat .s.warn { color: var(--warn); } .stat .s.err { color: var(--err); }

.barrow { display: flex; flex-direction: column; gap: 5px; }
.barrow-t { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.barrow-t > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 7px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; border-bottom: 1px solid var(--border); padding: 0 2px; direction: ltr; }
.chart .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; position: relative; }
.chart .col i { display: block; width: min(22px, 70%); background: var(--accent); opacity: .55; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .col.last i { opacity: 1; }
.chart .col b { font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.chart .col:hover i { opacity: 1; }
.chart-x { display: flex; gap: 6px; font-size: 10.5px; color: var(--faint); direction: ltr; padding: 0 2px; }
.chart-x span { flex: 1; text-align: center; min-width: 0; overflow: visible; white-space: nowrap; }

table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { text-align: right; font-weight: 500; color: var(--faint); font-size: 11.5px; padding: 6px 4px; border-bottom: 1px solid var(--surface2); }
table.t td { padding: 8px 4px; border-bottom: 1px solid var(--surface2); vertical-align: top; }
table.t tr:last-child td { border-bottom: none; }
.table-box { overflow-x: auto; }

/* --- Badges, status --------------------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 10px; border-radius: 999px; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.acc { background: var(--accent-soft); color: var(--accent-text); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.ok { color: var(--ok); } .status.ok i { background: var(--ok); }
.status.warn { color: var(--warn); } .status.warn i { background: var(--warn); }
.status.err { color: var(--err); } .status.err i { background: var(--err); }
.status.off { color: var(--muted); } .status.off i { background: transparent; border: 2px solid var(--muted); width: 9px; height: 9px; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 13px; text-decoration: none !important; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.banner.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.banner.err { background: var(--err-soft); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 35%, transparent); }
.banner.info { background: var(--surface2); color: var(--text2); }
.banner .grow { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.banner .grow b { color: var(--text); }

.flash { margin: 12px 16px 0; padding: 12px 14px; border-radius: 12px; font-size: 13px; background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.flash.info { background: var(--surface2); color: var(--text2); border-color: var(--border); }
@media (min-width: 900px) { .flash { margin: 16px auto 0; width: calc(100% - 48px); max-width: 932px; } }

/* --- Buttons and form controls --------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--err); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.link { border: none; color: var(--accent-text); padding: 0 8px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; color: var(--text2); }
input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], input[type=search], input[type=tel], input:not([type]), select, textarea {
  width: 100%; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px;
}
textarea { padding: 10px 12px; line-height: 1.7; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input.code { font-size: 22px; letter-spacing: 8px; text-align: center; }
input[dir=ltr], .ltr-input { direction: ltr; text-align: left; }
.dt { display: grid; grid-template-columns: 1.6fr 1fr; gap: 8px; }
.dt input { text-align: center; direction: ltr; }
.counter { font-size: 11px; color: var(--faint); }
.fieldrow { display: flex; justify-content: space-between; align-items: baseline; }

.sw-row { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.sw-row > label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.sw-row .t { font-size: 13.5px; }
.list .sw-row, .card .sw-row + .sw-row { border-top: 1px solid var(--surface2); }
.card .sw-row:first-child { border-top: none; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--switch-off); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--knob-off); transition: right .15s, background .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { right: 23px; background: var(--on-accent); }
input.switch:disabled { opacity: .5; }

.seg { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { min-height: 38px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px 4px; border-radius: 9px; font-size: 12px; color: var(--text2); cursor: pointer; line-height: 1.3; }
.seg input:checked + label { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 380px) { .seg label { font-size: 11px; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px; background: var(--chip); color: var(--text2); font-size: 12.5px; border: none; text-decoration: none !important; cursor: pointer; white-space: nowrap; }
.chip[aria-current], .chip.on { background: var(--text); color: var(--bg); font-weight: 700; }
.chip.ghost { background: transparent; border: 1px solid var(--border); }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { width: 84px; text-align: center; min-height: 40px; }
.stepper .unit { font-size: 12px; color: var(--muted); min-width: 40px; }

.savebar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface2); border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.savebar .grow { flex: 1; font-size: 12px; color: var(--text2); }
.savebar .btn.primary { margin-inline-start: auto; }
@media (min-width: 900px) { .savebar { bottom: 16px; } }
.stepup { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 14px; padding: 12px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 10px; color: var(--faint); text-align: center; font-size: 13px; }
.center-card { max-width: 420px; margin: 10vh auto 0; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.center-card h1 { font-size: 20px; font-weight: 800; }

/* --- Login ---------------------------------------------------------------------------------------- */
.auth { width: 100%; max-width: 400px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 28px 22px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-head h1 { font-size: 22px; font-weight: 800; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.check { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text2); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.qr { background: #fff; padding: 12px; border-radius: 14px; align-self: center; line-height: 0; }
.qr img, .qr svg { width: 190px; height: 190px; }

/* --- Misc pieces --------------------------------------------------------------------------------- */
.kv { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 13px; }
.kv > :first-child { flex: 1; color: var(--muted); }
.thumb { width: 56px; height: 56px; flex: none; border-radius: 10px; background: var(--surface2); object-fit: cover; }
.thumb.wide { width: 72px; height: 40px; border-radius: 6px; }
.poster { width: 40px; height: 58px; flex: none; border-radius: 6px; background: var(--surface2); object-fit: cover; }
.preview-phone { background: var(--surface2); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.preview-phone .app { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.preview-phone .app .logo { width: 18px; height: 18px; border-radius: 5px; font-size: 11px; }
.code-box { direction: ltr; text-align: left; font-family: ui-monospace, monospace; font-size: 11.5px; line-height: 1.6; background: var(--bg); border-radius: 10px; padding: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; color: var(--text2); max-height: 320px; }
.dropzone { border: 1.5px dashed var(--switch-off); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-align: center; }
.diff { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.diff-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.diff-row .k { flex: 1; color: var(--muted); min-width: 120px; }
.diff-row s { color: var(--faint); }
.diff-row b { color: var(--ok); }
details.more > summary { cursor: pointer; color: var(--accent-text); font-size: 13px; list-style: none; padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
.install-tip { display: flex; gap: 12px; align-items: flex-start; }
.install-tip .ic-box { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.rank { width: 22px; flex: none; color: var(--faint); font-size: 12px; text-align: center; }
.sortable .handle { cursor: grab; color: var(--faint); }
.tabs-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs-row::-webkit-scrollbar { display: none; }
.pill-count { font-size: 11px; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-weight: 700; }
@media print {
  .side, .bottom, .top, .savebar, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; }
}
.inline-form { display: inline-flex; margin: 0; }
.rule { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 6px; align-items: center; }
@media (max-width: 520px) { .rule { grid-template-columns: 1fr 1fr; } .rule .icon-btn { justify-self: end; } }
.wrap-anywhere { overflow-wrap: anywhere; }
.est { font-size: 13px; color: var(--text2); }
.est b { color: var(--text); font-size: 15px; }