/* پنل مدیریت */
body.admin { background: var(--sage); color: var(--ink); min-height: 100dvh; }
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate-box { background: var(--paper); padding: 28px; border-radius: var(--radius-l); width: min(400px, 100%); display: grid; gap: 14px; border: 1px solid var(--line); }
.gate-brand { font-size: 30px; color: var(--saffron-deep); }
.gate-box h1 { margin: 0; font-size: 20px; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100dvh; }
.side { background: var(--night); color: var(--mist); padding: 20px 14px; display: grid; grid-template-rows: auto 1fr auto; gap: 18px; position: sticky; top: 0; height: 100dvh; }
.side-brand { font-size: 28px; color: var(--saffron); text-decoration: none; padding: 0 10px; }
.side-nav { display: grid; gap: 2px; align-content: start; overflow: auto; }
.side-nav a { text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--mist-2); font-size: 14.5px; }
.side-nav a:hover { background: var(--night-2); color: var(--mist); }
.side-nav a[aria-current="page"] { background: var(--night-3); color: var(--mist); box-shadow: inset -3px 0 0 var(--saffron); }
.side-sep { font-size: 12.5px; color: var(--mist-2); padding: 14px 12px 4px; opacity: .8; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13.5px; color: var(--mist-2); }
.side-foot .btn.ghost { color: var(--mist); border-color: var(--night-line); }

.content { padding: clamp(18px, 3vw, 36px); min-width: 0; max-width: 1280px; }
.content h1 { margin: 0 0 4px; font-size: 24px; }
.content > .sub { margin: 0 0 22px; color: var(--ink-2); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 200px; }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 26px; }
.stat { background: var(--paper); padding: 14px 16px; }
.stat b { display: block; font-size: 28px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--ink-2); }
.stat.live b { color: #2F7D4A; }
.two { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 26px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 18px; min-width: 0; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.chart svg { width: 100%; height: 180px; overflow: visible; }
.chart text { font-size: 10px; fill: var(--ink-2); font-family: var(--font); }
.dev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dev-list li { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; }
.dev-list i { height: 8px; background: var(--saffron); border-radius: 4px; display: block; }

.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: start; font-weight: 500; color: var(--ink-2); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--paper); position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--sage-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: #FBFCF9; }
table.t .acts { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.mono { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 99px; background: var(--sage-2); white-space: nowrap; }
.pill.live { background: #D4EDD6; color: #1F5E33; }
.pill.ended { background: #ECEDEA; color: #6A736E; }
.pill.waiting, .pill.warn { background: #F8E8C8; color: #7A4F10; }
.pill.bad { background: #F6D6D1; color: #8A2A1E; }
.pill.ok { background: #D4EDD6; color: #1F5E33; }
.peer-mini { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.qbars { display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; margin-inline-end: 4px; }
.qbars i { width: 3px; background: #C9D3C3; }
.qbars i:nth-child(1) { height: 25%; } .qbars i:nth-child(2) { height: 50%; } .qbars i:nth-child(3) { height: 75%; } .qbars i:nth-child(4) { height: 100%; }
.qbars[data-q="4"] i, .qbars[data-q="3"] i:nth-child(-n+3) { background: #4B9E52; }
.qbars[data-q="2"] i:nth-child(-n+2) { background: #C9A42E; }
.qbars[data-q="1"] i:nth-child(1) { background: #C94B3C; }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }

/* فرم تنظیمات */
.sform { display: grid; gap: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); max-width: 820px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--sage-2); }
.srow:last-of-type { border-bottom: 0; }
.srow .lbl b { font-weight: 600; font-size: 14.5px; display: block; }
.srow .lbl small { color: var(--ink-2); font-size: 12.5px; display: block; line-height: 1.7; }
.srow.wide { grid-template-columns: 1fr; }
.srow .switch { justify-content: flex-end; padding: 0; }
.srow input[type=color] { width: 64px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.sgroup { padding: 14px 18px 4px; font-size: 13px; color: var(--saffron-deep); font-weight: 700; background: var(--sage); border-bottom: 1px solid var(--sage-2); }
.sactions { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 18px; background: var(--sage); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-m) var(--radius-m); position: sticky; bottom: 0; }
.testbox { margin-top: 18px; max-width: 820px; }
.testbox .row { display: flex; gap: 8px; flex-wrap: wrap; }
.testbox .input { flex: 1; min-width: 220px; }
pre.json { direction: ltr; text-align: left; background: var(--night); color: var(--mist); padding: 12px; border-radius: 10px; font-size: 12px; overflow: auto; max-height: 260px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; grid-template-rows: auto auto auto; }
  .side-nav { display: flex; overflow-x: auto; gap: 4px; }
  .side-nav a { white-space: nowrap; }
  .side-sep { display: none; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .two { grid-template-columns: 1fr; }
  .srow { grid-template-columns: 1fr; }
}

/* ───────── نسخه ۲: لاجورد و کاشی ───────── */
body.admin { background: var(--gach); }
.side { background: var(--lapis) var(--girih-dark) center / 90px; border-inline-start: 0; grid-template-rows: auto 1fr auto auto; }
.side-brand { display: flex; align-items: center; gap: 10px; color: var(--gold); text-decoration: none; padding: 0 10px; }
.side-brand .brand { font-size: 26px; }
.side-brand .mark { width: 30px; height: 30px; }
.side-nav a { color: var(--mist-2); }
.side-nav a:hover { background: rgb(255 255 255 / .06); }
.side-nav a[aria-current="page"] { background: var(--lapis-night); color: #fff; box-shadow: inset -3px 0 0 var(--gold); }
.side-sep { color: var(--gold-soft); opacity: .7; }
.side-foot .btn.ghost { color: var(--mist); border-color: var(--lapis-line); }
.content h1 { font-family: var(--display); font-weight: 600; font-size: 30px; color: var(--lapis); }
.content > .sub a { color: var(--firuzeh-deep); }
.panel h2, .content h2 { font-family: var(--display); font-weight: 600; color: var(--lapis); }
.stats { border-top: 3px solid var(--gold); }
.stats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat.live b { color: var(--firuzeh-deep); }
.stat.warn b { color: #9A6A12; }
.stat span a { color: var(--firuzeh-deep); }
.dev-list i { background: var(--gold); }
.dev-list.wide li { grid-template-columns: 170px 1fr auto; }
.feed-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.feed-list li { display: flex; justify-content: space-between; font-size: 13.5px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 14px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--lapis); border-bottom-color: var(--gold); font-weight: 600; }
table.t.kv td:first-child { color: var(--ink-2); width: 34%; white-space: nowrap; }
table.t td.cut { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.t tr.click { cursor: pointer; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.report-sum { background: var(--gach); border-inline-start: 4px solid var(--brick); padding: 12px 14px; border-radius: 8px; line-height: 2; margin: 0 0 14px; }
.modal h3 { font-size: 15px; margin: 16px 0 8px; }
.gate { background: var(--lapis) var(--girih-dark) center / 90px; }
.gate-box { border-top: 4px solid var(--gold); }
.gate-head { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.gate-head .mark { width: 32px; height: 32px; color: var(--gold); }
.gate-brand { color: var(--lapis); font-size: 28px; }
.sgroup { color: var(--brick); }
.btn.primary { background: var(--firuzeh); }
@media (max-width: 960px) { .stats.five { grid-template-columns: repeat(2, 1fr); } .dev-list.wide li { grid-template-columns: 120px 1fr auto; } }
.side-nav { min-height: 0; }

.side-copy { margin: 0; font-size: 11.5px; color: var(--mist-2); opacity: .75; padding: 0 10px; }
#gateVisit .visit-card { padding: 22px 18px 16px; margin-top: 18px; }
#gateVisit .visit-grid { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
#gateVisit .visit-head h2 { font-size: 18px; }
#gateVisit .visit-ip b { font-size: 20px; }
.gate-box { width: min(520px, 100%); }
.update-box { margin-bottom: 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.update-box .pill { font-size: 13px; }
.side { padding-top: max(20px, env(safe-area-inset-top)); }
.ports-h { font-size: 15px; margin: 14px 0 8px; }
table.ports td:first-child { font-weight: 700; }
.side-brand.lockup { padding: 0 6px; gap: 8px; }
.side-brand .lk-mark { height: 38px; }
.side-brand .lk-word { height: 26px; }
.gate-head.lockup { display: flex; justify-content: center; }
.gate-logo { width: 150px; }
.srow[hidden] { display: none !important; }
/* ───────── نسخه ۲.۵: کاربران، پلن‌ها و گزارش‌ها ───────── */
body.is-staff .adm { display: none !important; }
.grow { flex: 1; }
.empty { padding: 30px; text-align: center; color: var(--ink-2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid2 .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--firuzeh); }
.pill.role-admin { background: #F3D9D2; color: #7A2E1C; }
.pill.role-staff { background: #E3D3FF; color: #4B2A7A; }
.pill.role-host { background: #CDEBE8; color: #155A55; }
.plan-badge { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12.5px; color: #fff; background: var(--c); }
.bad-t { color: var(--brick); font-size: 12px; margin-inline-start: 4px; }
td > small.hint { display: block; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: none; padding: 7px 14px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--lapis); color: #fff; }
.stats.kpi8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats.kpi4 { grid-template-columns: repeat(4, minmax(0, 1fr)); border-top-color: var(--firuzeh); }
.stat b small { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.stat span small { display: block; font-size: 11.5px; }
.panel + .panel, .two + .panel, .panel + .two { margin-top: 0; }
.content > .panel { margin-bottom: 20px; }
.table-wrap.flat { border: 0; border-radius: 0; max-height: 420px; }
.back { display: inline-block; margin-bottom: 10px; color: var(--firuzeh-deep); text-decoration: none; font-size: 14px; }
.ud-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ud-head h1 { margin: 0; }
.ud-head .sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13.5px; }
.ud-ava { width: 64px; height: 64px; border-radius: 18px; background: var(--lapis) var(--girih-dark) center / 40px; color: var(--gold); display: grid; place-items: center; font: 700 28px var(--display); flex: none; }
.ud-acts { margin-inline-start: auto; }
.btn.danger { color: var(--brick); }
.meters { display: grid; gap: 12px; margin: 12px 0; }
.note-box { background: #FFF8E6; border: 1px solid #F0D9A6; border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; }
.presence { position: relative; min-width: 120px; height: 20px; background: var(--gach-2); border-radius: 6px; overflow: hidden; }
.presence i { position: absolute; inset: 0 auto 0 0; inset-inline-start: 0; background: rgb(42 157 151 / .35); }
.presence span { position: relative; font-size: 11.5px; padding: 0 6px; line-height: 20px; white-space: nowrap; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-card { background: var(--paper); border: 1px solid var(--line); border-top: 5px solid var(--c); border-radius: var(--radius-m); padding: 16px 18px; display: grid; gap: 10px; align-content: start; }
.plan-card.off { opacity: .6; }
.plan-card header { display: flex; align-items: center; gap: 8px; }
.plan-card h2 { margin: 0; font-size: 20px; color: var(--c) !important; }
.plan-card .hint { margin: 0; min-height: 1.5em; }
.plan-card .price { font: 700 22px var(--font); }
.plan-card .price small { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.plan-card li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.plan-card .feats { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-card .feats span { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--gach-2); color: var(--ink-2); }
.plan-card .feats span.on { background: #D4EDD6; color: #1F5E33; }
.plan-card footer { display: flex; align-items: center; gap: 6px; }
@media (max-width: 960px) { .stats.kpi8, .stats.kpi4 { grid-template-columns: repeat(2, 1fr); } }
@media print { .side, .toolbar, .back, .ud-acts { display: none !important; } .shell { display: block; } }

/* ───────── میت‌بان ───────── */
.side-brand .lk-word { height: 40px; }
.side-tools { display: flex; gap: 8px; align-items: center; }
.gate-head .lk-word.gate-logo { width: 190px; height: auto; margin: 0 auto 4px; }
.stat, .panel { box-shadow: 0 8px 22px -20px rgb(18 32 61 / .6); }
html[data-theme="dark"] .content h1, html[data-theme="dark"] .panel h2, html[data-theme="dark"] .content h2, html[data-theme="dark"] .tabs a[aria-current="page"], html[data-theme="dark"] .gate-brand, html[data-theme="dark"] .block > h2, html[data-theme="dark"] h2.sec { color: var(--mist); }
html[data-theme="dark"] .side { background-color: #08102A; }
html[data-theme="dark"] .note-box { background: rgb(217 164 65 / .1); border-color: rgb(217 164 65 / .35); }
/* گزارش زنده */
.live-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.live-head h1 { margin-bottom: 0; }
.live-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; }
.live-link { display: flex !important; align-items: center; gap: 8px; }
.live-link::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #E8663A; box-shadow: 0 0 0 3px rgb(232 102 58 / .25); margin-inline-start: auto; }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 18px; }
.spark i { flex: 1; background: linear-gradient(to top, var(--firuzeh), var(--firuzeh-bright)); border-radius: 5px 5px 2px 2px; position: relative; min-height: 4px; transition: height .4s; }
.spark i b { position: absolute; top: -17px; inset-inline: 0; text-align: center; font-size: 11px; color: var(--ink-2); font-weight: 600; }
.spark-x { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-2); margin-top: 4px; }
.qbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; gap: 2px; }
.qlegend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; }
.qlegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }
.live-t .lv-row.open td { border-bottom-color: transparent; }
.lv-peers td { background: var(--gach); }
.peer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.peer { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 3px; font-size: 13px; }
.peer small { color: var(--ink-2); }
.peer .flags { display: flex; flex-wrap: wrap; gap: 4px; }
.peer .flags i { font-style: normal; font-size: 11px; background: var(--gach-2); border-radius: 6px; padding: 0 6px; }
.peer .flags i.h { background: rgb(217 164 65 / .25); }
.peer .q { font-size: 12px; color: var(--c); font-weight: 600; }
.warn-text { color: #B7791F; }
.peer .pill { justify-self: start; }
.peer > b { display: flex; align-items: center; gap: 6px; }
.host-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; background: var(--gach); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
.host-box > div { display: grid; gap: 1px; }
.host-box .hint { font-size: 12px; }
.host-box .btn { margin-inline-start: auto; }
.mail-check { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.mail-check li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); }
.mail-check li > b { flex: none; font-size: 12px; padding: 2px 10px; border-radius: 99px; }
.mail-check li.ok > b { background: rgb(42 157 151 / .15); color: var(--firuzeh-deep); }
.mail-check li.bad > b { background: rgb(181 84 58 / .15); color: var(--brick); }
.mail-check li.warn > b { background: rgb(217 164 65 / .2); color: #8a6212; }
.mail-check li div { display: grid; gap: 2px; min-width: 0; }
.mail-check small { color: var(--ink-2); word-break: break-all; }
