/* VPN Shop admin — RTL, Vazirmatn, light/dark */
@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; }

:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f8f9fc; --border: #e4e8f0; --border-strong: #cfd6e3;
  --text: #1b2333; --text-2: #4a5568; --muted: #8592a6;
  --primary: #3b5bdb; --primary-2: #324fc4; --primary-soft: #e8edff;
  --success: #12936b; --success-soft: #e3f6ef; --warning: #b7791f; --warning-soft: #fdf3e1;
  --danger: #d63a4a; --danger-soft: #fde8ea; --info: #1c7ed6; --info-soft: #e5f2fd;
  --sidebar: #141b2d; --sidebar-text: #aab4c8; --sidebar-active: #ffffff;
  --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420; --surface: #171e2e; --surface-2: #1c2436; --border: #263049; --border-strong: #34405e;
    --text: #e7ebf3; --text-2: #b8c1d4; --muted: #7d89a1;
    --primary: #6c8cff; --primary-2: #5a7cf2; --primary-soft: #1f2a4d;
    --success-soft: #11372c; --warning-soft: #3a2d14; --danger-soft: #3d1a20; --info-soft: #14304a;
    --sidebar: #0b0f19; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: "Vazirmatn", Tahoma, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; direction: rtl; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6rem; line-height: 1.4; font-weight: 700; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
code, .mono { font-family: var(--mono); font-size: .86em; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; text-align: left; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.right { text-align: left; }

/* layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset: 0 0 0 auto; overflow-y: auto; z-index: 40; transition: transform .2s ease; scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior: contain; }
.sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar .brand { padding: 1.1rem 1.25rem; font-weight: 700; color: #fff; font-size: 1.05rem; display: flex; gap: .55rem; align-items: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #5b7cff, #22b8cf); display: inline-grid; place-items: center; font-size: .9rem; }
.nav { padding: .6rem .6rem 2rem; }
.nav-title { font-size: .72rem; color: #66718a; padding: .9rem .7rem .3rem; letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: .6rem; color: var(--sidebar-text); padding: .5rem .75rem; border-radius: 8px; font-size: .92rem; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: rgba(108,140,255,.16); color: var(--sidebar-active); }

/* collapsible groups */
.nav-group { margin-bottom: .2rem; }
.nav-group-head { width: 100%; display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border: 0; border-radius: 10px; background: transparent; color: #c3cbdc; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-align: right; }
.nav-group-head:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-group-head:focus-visible, .nav a:focus-visible { outline: 2px solid #6c8cff; outline-offset: -2px; }
.nav-group-icon { width: 1.5rem; text-align: center; font-size: 1.05rem; }
.nav-group-title { flex: 1; }
.nav-group-badge { margin: 0; }
.nav-group:not(.is-collapsed) .nav-group-badge { display: none; }
.nav-chevron { width: 1rem; height: 1rem; flex: none; color: #7d89a1; }
.nav-ready .nav-chevron { transition: transform .22s ease; }
.nav-group.is-collapsed .nav-chevron { transform: rotate(90deg); }
.nav-group-panel { display: grid; grid-template-rows: 1fr; }
.nav-ready .nav-group-panel { transition: grid-template-rows .24s ease; }
.nav-group.is-collapsed .nav-group-panel { grid-template-rows: 0fr; }
.nav-group-inner { overflow: hidden; min-height: 0; position: relative; margin: .1rem .9rem .3rem 0; padding-right: .55rem; border-right: 1px solid rgba(255,255,255,.08); }
.nav-ready .nav-group-inner { transition: visibility .24s; }
.nav-group.is-collapsed .nav-group-inner { visibility: hidden; }
.nav-group-inner a { padding: .45rem .7rem; font-size: .88rem; }
.nav-group-inner a.active { box-shadow: inset -3px 0 0 #6c8cff; }
.nav-ico { width: 1.3rem; text-align: center; }
.nav-label { flex: 1; min-width: 0; }
.nav-group-inner a .count { margin-right: 0; }
@media (prefers-reduced-motion: reduce) { .nav-ready .nav-chevron, .nav-ready .nav-group-panel, .nav-ready .nav-group-inner { transition: none; } }
.nav .count { margin-right: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .45rem; line-height: 1.5rem; min-width: 1.5rem; text-align: center; }
.main { flex: 1; margin-right: 250px; min-width: 0; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 30; }
.topbar .title { font-weight: 700; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text); cursor: pointer; }
.content { padding: 1.5rem; max-width: 1760px; margin-inline: auto; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-right: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

/* cards & grid */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 1rem; }
.card-head .actions { margin-right: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.card-body { padding: 1.1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat .label { color: var(--muted); font-size: .82rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: .2rem; }
.stat .hint { font-size: .78rem; color: var(--text-2); }
.stat.accent-success .value { color: var(--success); } .stat.accent-danger .value { color: var(--danger); } .stat.accent-warning .value { color: var(--warning); } .stat.accent-primary .value { color: var(--primary); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; word-break: break-word; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .65rem .8rem; border-bottom: 1px solid var(--border); text-align: right; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: .8rem; background: var(--surface-2); white-space: nowrap; }
.table th a { color: inherit; }
.table tbody tr:hover { background: var(--surface-2); }
.table td.actions { white-space: nowrap; text-align: left; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .icon { font-size: 2rem; display: block; margin-bottom: .3rem; }

/* badges */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.dot { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; margin-left: .35rem; background: var(--muted); }
.dot-online { background: var(--success); } .dot-offline { background: var(--danger); } .dot-degraded { background: var(--warning); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .48rem .95rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; text-decoration: none; line-height: 1.4; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: .85em; height: .85em; border: 2px solid currentColor; border-left-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
form.inline { display: inline; }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: .85rem; color: var(--text-2); margin-bottom: .3rem; font-weight: 500; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }
.field .error { font-size: .8rem; color: var(--danger); margin-top: .25rem; }
.input, select, textarea { width: 100%; padding: .52rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; }
textarea { min-height: 110px; resize: vertical; }
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field.has-error .input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.check { display: flex; gap: .5rem; align-items: center; font-size: .92rem; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.filters .input, .filters select { width: auto; min-width: 150px; }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem .8rem; }

/* alerts & toasts */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.toasts { position: fixed; bottom: 1.2rem; left: 1.2rem; display: grid; gap: .5rem; z-index: 90; max-width: 380px; }
.toasts .alert { box-shadow: 0 8px 24px rgba(0,0,0,.12); margin: 0; }

/* misc */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); padding: 0 1rem; overflow-x: auto; }
.tabs a { padding: .7rem .9rem; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.pagination { display: flex; gap: .3rem; justify-content: center; padding: 1rem; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span { padding: .3rem .7rem; border-radius: 6px; border: 1px solid var(--border); font-size: .85rem; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); min-width: 90px; }
.progress > span { display: block; height: 100%; background: var(--primary); width: 0; }
.progress.warn > span { background: var(--warning); } .progress.full > span { background: var(--danger); }
.receipt-img { max-width: 100%; max-height: 620px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; margin: auto; background: var(--surface-2); }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem; overflow: auto; max-height: 360px; font-size: .8rem; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0 .5rem; border-bottom: 1px dashed var(--border); font-size: .88rem; }
.chat { display: grid; gap: .7rem; }
.chat .msg { max-width: 75%; padding: .6rem .9rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; }
.chat .msg.admin { margin-right: auto; background: var(--primary-soft); border-color: transparent; }
.chat .meta { font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.chart-box { position: relative; height: 280px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,14,25,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 440px; padding: 1.3rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); border: 1px solid var(--border); }
.modal h3 { margin-bottom: .5rem; }
.modal .form-actions { justify-content: flex-start; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 100% 0, var(--primary-soft), transparent), var(--bg); }
.auth .card { width: 100%; max-width: 400px; }
.auth .brand { display: flex; gap: .6rem; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; margin-bottom: 1rem; }

/* responsive */
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  .main { margin-right: 0; }
  .menu-toggle { display: inline-block; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .filters .input, .filters select { min-width: 0; flex: 1 1 140px; }
  dl.kv { grid-template-columns: 1fr; gap: .1rem; } dl.kv dd { margin-bottom: .5rem; }
}
.mt { margin-top: 1rem; } .text-danger { color: var(--danger); } tr.unread { background: var(--warning-soft); }
fieldset { border: 0; padding: 0; margin: 0; }

/* connection details (subscription page) */
.conn-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.5rem; }
.conn-fields .field { margin-bottom: 1rem; }
.conn-radix { border-right: 1px solid var(--border); padding-right: 1.5rem; }
.copy-row { display: flex; gap: .4rem; align-items: stretch; }
.copy-row .input { flex: 1; min-width: 0; font-size: 1rem; letter-spacing: .02em; }
.copy-row .input[readonly] { background: var(--surface-2); }
.radix-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
@media (max-width: 960px) { .conn-grid { grid-template-columns: 1fr; } .conn-radix { border-right: 0; padding-right: 0; border-top: 1px solid var(--border); padding-top: 1rem; } }

/* Jalali date picker */
.jdp-wrap { position: relative; display: block; }
.filters .jdp-wrap { display: inline-block; }
.jdp-wrap > .input { padding-left: 2.5rem; }
.jdp-toggle { position: absolute; left: .3rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.jdp-toggle:hover, .jdp-toggle:focus-visible { color: var(--primary); background: var(--primary-soft); outline: none; }
.jdp-toggle svg { width: 1.15rem; height: 1.15rem; }
.jdp-human { font-size: .78rem; color: var(--text-2); margin-top: .25rem; min-height: 1.15em; }
.input.jdp-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.jdp { position: absolute; z-index: 120; width: 316px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 48px rgba(16,24,40,.18), 0 2px 6px rgba(16,24,40,.08); padding: .75rem; direction: rtl; font-size: .9rem; user-select: none; animation: jdp-in .12s ease-out; }
@keyframes jdp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.jdp-head { display: flex; align-items: center; justify-content: space-between; gap: .3rem; margin-bottom: .55rem; }
.jdp-title { display: flex; gap: .15rem; }
.jdp-title button { border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700; font-size: .95rem; padding: .3rem .6rem; border-radius: 8px; cursor: pointer; }
.jdp-nav { width: 2.1rem; height: 2.1rem; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.jdp-nav svg { width: 1.1rem; height: 1.1rem; }
.jdp-title button:hover, .jdp-nav:hover { background: var(--surface-2); }
.jdp-week, .jdp-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.jdp-days { row-gap: 2px; }
.jdp-week span { text-align: center; font-size: .74rem; color: var(--muted); padding: .15rem 0 .4rem; font-weight: 500; }
.jdp-week span:last-child { color: var(--danger); }
.jdp-day { height: 2.35rem; border: 0; background: transparent; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; border-radius: 9px; cursor: pointer; padding: 0; }
.jdp-day:hover { background: var(--primary-soft); }
.jdp-day.out { color: var(--muted); opacity: .5; }
.jdp-day.fri { color: var(--danger); }
.jdp-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); font-weight: 700; }
.jdp-day.in-range { background: var(--primary-soft); border-radius: 0; }
.jdp-day.in-range.rs { border-radius: 0 9px 9px 0; }
.jdp-day.in-range.re { border-radius: 9px 0 0 9px; }
.jdp-day.in-range.rs.re { border-radius: 9px; }
.jdp-day.sel, .jdp-day.sel:hover { background: var(--primary); color: #fff; font-weight: 700; }
.jdp-day:disabled { opacity: .28; cursor: not-allowed; background: transparent; box-shadow: none; }
.jdp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.jdp-cell { padding: .7rem .3rem; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.jdp-cell:hover { background: var(--primary-soft); }
.jdp-cell.today { box-shadow: inset 0 0 0 1.5px var(--primary); }
.jdp-cell.sel, .jdp-cell.sel:hover { background: var(--primary); color: #fff; }
.jdp-cell:disabled { opacity: .3; cursor: not-allowed; }
.jdp button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.jdp-time { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.jdp-hm { display: inline-flex; align-items: center; gap: .3rem; direction: ltr; }
.jdp-hm select { width: auto; padding: .3rem .5rem; font-variant-numeric: tabular-nums; }
.jdp-foot { display: flex; align-items: center; gap: .4rem; margin-top: .65rem; }
.jdp-foot .spacer { flex: 1; }
.jdp-backdrop { position: fixed; inset: 0; background: rgba(10,14,25,.45); z-index: 119; }
.jdp.jdp-sheet { position: fixed; inset: auto 0 0 0; width: auto; border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); animation: jdp-up .16s ease-out; }
.jdp-sheet .jdp-day { height: 2.75rem; font-size: 1rem; }
@keyframes jdp-up { from { transform: translateY(100%); } to { transform: none; } }
.jdp-presets { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
@media (prefers-reduced-motion: reduce) { .jdp, .jdp.jdp-sheet { animation: none; } }

/* customer services (user page) */
.svc-chips { gap: .35rem; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.svc-card { position: relative; display: flex; flex-direction: column; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem 0; box-shadow: var(--shadow); overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.svc-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--svc-accent, var(--border-strong)); }
.svc-card:hover { border-color: var(--border-strong); box-shadow: 0 6px 18px rgba(16,24,40,.08); transform: translateY(-1px); }
.svc-active { --svc-accent: var(--success); }
.svc-depleted, .svc-disabled { --svc-accent: var(--warning); }
.svc-expired, .svc-failed { --svc-accent: var(--danger); }
.svc-pending { --svc-accent: var(--info); }
.svc-card.is-dim { opacity: .62; }
.svc-card.is-dim:hover { opacity: 1; }
.svc-top { display: flex; align-items: center; gap: .75rem; }
.svc-icon { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--primary-soft); }
.svc-icon-wireguard { background: var(--success-soft); }
.svc-icon-openvpn { background: var(--warning-soft); }
.svc-icon-v2ray { background: var(--info-soft); }
.svc-title { flex: 1; min-width: 0; }
.svc-name { display: block; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-name:hover { color: var(--primary); text-decoration: none; }
.svc-user { display: flex; align-items: center; gap: .15rem; color: var(--text-2); font-size: .85rem; }
.svc-copy { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 .3rem; font-size: .95rem; border-radius: 6px; line-height: 1.4; }
.svc-copy:hover { color: var(--primary); background: var(--primary-soft); }
.svc-body { display: grid; gap: .85rem; }
.svc-meter-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--text-2); margin-bottom: .35rem; gap: .5rem; }
.svc-meter-head b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.svc-bar { height: 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.svc-bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--info)); transition: width .5s ease; }
.svc-bar.is-warn > span { background: linear-gradient(90deg, var(--warning), #e6a23c); }
.svc-bar.is-full > span { background: linear-gradient(90deg, var(--danger), #ef6a77); }
.svc-meter-foot { margin-top: .3rem; font-size: .76rem; color: var(--muted); }
.svc-expiry { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.svc-cal { font-size: 1.15rem; }
.svc-date { font-weight: 600; font-size: .92rem; }
.svc-left { margin-right: auto; }
.svc-foot { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 -1.1rem; padding: .7rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface-2); font-size: .82rem; color: var(--text-2); }
.svc-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.svc-open { margin-right: auto; }
@media (max-width: 860px) { .svc-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .svc-card, .svc-bar > span { transition: none; } .svc-card:hover { transform: none; } }

/* quick search (top bar) */
.gsearch { position: relative; flex: 1 1 340px; max-width: 580px; min-width: 0; margin-inline: auto; }
.gsearch-box { display: flex; align-items: center; gap: .55rem; height: 2.5rem; padding: 0 .8rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); color: var(--muted); cursor: text; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.gsearch-box:hover { border-color: var(--muted); }
.gsearch-box:focus-within, .gsearch-box.is-open { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); color: var(--text); }
.gsearch-ico { width: 1.1rem; height: 1.1rem; flex: none; }
.gsearch-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: .92rem; padding: 0; }
.gsearch-box input::placeholder { color: var(--muted); }
.gsearch-kbd { flex: none; font: inherit; font-size: .75rem; line-height: 1; padding: .2rem .45rem; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); color: var(--muted); }
.gsearch-box:focus-within .gsearch-kbd { display: none; }
.gsearch-spin { display: none; width: 1rem; height: 1rem; flex: none; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
.gsearch-box.is-loading .gsearch-spin { display: block; }
.gsearch-box.is-loading .gsearch-kbd { display: none; }
.gsearch-panel { position: absolute; top: calc(100% + 8px); inset-inline: 0; z-index: 60; max-height: min(72vh, 540px); overflow-y: auto; scrollbar-width: thin; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 48px rgba(16,24,40,.2), 0 2px 6px rgba(16,24,40,.08); padding: .35rem; animation: jdp-in .12s ease-out; }
.gsearch-panel[hidden] { display: none; }
.gs-group { display: flex; align-items: center; gap: .45rem; padding: .55rem .6rem .25rem; font-size: .76rem; font-weight: 600; color: var(--muted); }
.gs-group-title { flex: 1; letter-spacing: .01em; }
.gs-more { font-weight: 500; color: var(--primary); }
.gs-item { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 10px; color: var(--text); text-decoration: none; }
.gs-item:hover { text-decoration: none; }
.gs-item.is-active { background: var(--primary-soft); }
.gs-ico { flex: none; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); font-size: 1.05rem; }
.gs-main { flex: 1; min-width: 0; display: grid; }
.gs-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-dim { color: var(--muted); }
.gs-tg { display: inline-flex; width: 1rem; height: 1rem; flex: none; }
.gs-tg svg { width: 100%; height: 100%; }
.gs-mark { background: var(--warning-soft); color: inherit; border-radius: 3px; padding: 0 .1rem; }
.gs-exact { flex: none; font-size: .68rem; padding: .05rem .4rem; border-radius: 999px; background: var(--success-soft); color: var(--success); font-weight: 600; }
.gs-empty { padding: 1.6rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
.gs-empty.is-error { color: var(--danger); }
.gs-foot { display: flex; gap: 1rem; justify-content: center; padding: .55rem .5rem .3rem; margin-top: .25rem; border-top: 1px solid var(--border); font-size: .72rem; color: var(--muted); }
@media (max-width: 720px) {
  .topbar { gap: .6rem; padding: 0 .8rem; }
  .topbar .title { display: none; }
  .gsearch { flex-basis: 0; }
  .gsearch-kbd { display: none; }
  .gsearch-panel { position: fixed; top: 64px; inset-inline: .5rem; max-height: calc(100vh - 80px); }
}

/* ---------- tables: centered, single-line rows ---------- */
.table th, .table td { text-align: center; white-space: nowrap; vertical-align: middle; }
.table th { font-weight: 600; }
.table .cell-start { text-align: right; }
.table .cell-clip { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }
.table td > div.small { display: inline-block; margin-inline-start: .45rem; vertical-align: middle; }
.table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table tbody tr:hover { background: var(--primary-soft); }
.table td .badge + .badge { margin-inline-start: .25rem; }
.table td.empty { white-space: normal; }
.lm-row { display: flex; justify-content: center; align-items: center; gap: .6rem; padding: .75rem; border-top: 1px solid var(--border); }
.lm-row .muted { font-size: .8rem; }
.is-lm-hidden { display: none !important; }
ul.timeline.lm-list + .lm-row { border-top: 0; }

/* Telegram identity */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.tg-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .12rem .6rem .12rem .5rem; border-radius: 999px; background: color-mix(in srgb, #2aabee 12%, transparent); color: var(--text); font-size: .85rem; line-height: 1.6; text-decoration: none; white-space: nowrap; }
.tg-chip:hover { background: color-mix(in srgb, #2aabee 22%, transparent); text-decoration: none; }
.tg-chip .ico { width: 1.15rem; height: 1.15rem; }

/* ---------- log retention (settings) ---------- */
.ret-intro { display: flex; gap: 1rem 1.5rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .5rem; }
.ret-intro p { flex: 1 1 420px; margin: 0; }
.ret-last { padding: .55rem .9rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: .86rem; }
.ret-group { margin: 1.3rem 0 .5rem; font-size: .95rem; color: var(--text-2); }
.ret-table td { padding-block: .8rem; }
.ret-name { display: flex; align-items: center; gap: .75rem; }
.ret-ico { width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 1.15rem; flex: none; }
.ret-hint { white-space: normal; max-width: 34rem; }
.ret-input { display: inline-flex; gap: .4rem; align-items: center; }
.ret-input .input { width: 6rem; text-align: center; }
.ret-input select { width: auto; min-width: 5.5rem; }
.ret-table tr.has-error td { background: var(--danger-soft); }
.ret-table .error { color: var(--danger); font-size: .8rem; white-space: normal; margin-top: .25rem; }

/* ---------- dashboard ---------- */
:root { --violet: #7048e8; --violet-soft: #efeaff; --amber: #d9822b; --amber-soft: #fdf0e0; --slate: #64748b; --slate-soft: #eef1f6; }
@media (prefers-color-scheme: dark) { :root { --violet: #9775fa; --violet-soft: #2a2147; --amber: #f0a04b; --amber-soft: #3a2a14; --slate: #94a3b8; --slate-soft: #222b3d; } }
.tone-blue { --k: var(--primary); --k-soft: var(--primary-soft); }
.tone-green { --k: var(--success); --k-soft: var(--success-soft); }
.tone-amber { --k: var(--amber); --k-soft: var(--amber-soft); }
.tone-violet { --k: var(--violet); --k-soft: var(--violet-soft); }
.tone-slate { --k: var(--slate); --k-soft: var(--slate-soft); }
.dash-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-hello h1 { margin: 0; font-size: 1.5rem; }
.seg { margin-right: auto; display: inline-flex; gap: .15rem; padding: .25rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.seg a { padding: .42rem 1rem; border-radius: 9px; color: var(--text-2); font-size: .88rem; text-decoration: none; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.seg a:hover { background: var(--surface); text-decoration: none; }
.seg a.is-active { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: var(--shadow); }
.dash-alerts { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.15rem; }
.alert-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .9rem; border-radius: 999px; font-size: .86rem; border: 1px solid transparent; text-decoration: none; }
a.alert-pill:hover { text-decoration: none; filter: brightness(.97); }
.alert-pill.tone-warning { background: var(--warning-soft); color: var(--warning); }
.alert-pill.tone-danger { background: var(--danger-soft); color: var(--danger); }
.alert-pill.tone-info { background: var(--info-soft); color: var(--info); }
.alert-pill.tone-ok { background: var(--success-soft); color: var(--success); }
.amt { display: inline-flex; align-items: baseline; gap: .4rem; white-space: nowrap; }
.amt b { font-weight: 800; font-variant-numeric: tabular-nums; }
.amt small { font-size: .72em; font-weight: 500; opacity: .75; }
.dash-hero { display: grid; grid-template-columns: minmax(300px, 4fr) 7fr; gap: 1rem; margin-bottom: 1.5rem; }
.hero-card { position: relative; overflow: hidden; border-radius: 18px; padding: 1.5rem 1.6rem; color: #fff; background: radial-gradient(120% 90% at 100% 0%, #6d5bff 0%, transparent 60%), linear-gradient(135deg, #3b5bdb 0%, #5f3dc4 100%); box-shadow: 0 10px 30px rgba(59,91,219,.28); display: flex; flex-direction: column; gap: .85rem; }
.hero-card::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -70px; bottom: -90px; background: rgba(255,255,255,.08); }
.hero-label { font-size: .95rem; opacity: .85; }
.hero-value .amt b { font-size: 2.4rem; letter-spacing: -.01em; }
.hero-value .amt small { font-size: 1rem; }
.hero-delta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .85rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.chip-glass { background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(2px); }
.chip-glass.is-up { background: rgba(46,204,150,.3); }
.chip-glass.is-down { background: rgba(255,99,115,.35); }
.hero-compare { opacity: .8; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: .3rem 0 0; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.18); position: relative; z-index: 1; }
.hero-stats dt { font-size: .76rem; opacity: .75; margin-bottom: .15rem; }
.hero-stats dd { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-stats dd small { font-size: .7em; font-weight: 500; opacity: .8; }
.hero-note { font-size: .78rem; opacity: .75; position: relative; z-index: 1; }
.chart-card { margin: 0; display: flex; flex-direction: column; }
.chart-card .card-body { flex: 1; }
.chart-card .chart-box { height: 100%; min-height: 250px; }
.sec-title { display: flex; align-items: baseline; gap: .5rem; margin: 1.6rem 0 .8rem; font-size: 1.02rem; }
.sec-title .muted { font-size: .82rem; font-weight: 400; }
.kpi-grid { display: grid; gap: 1rem; margin-bottom: .6rem; }
.kpi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .55rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.2rem 1.15rem; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--k); }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.09); border-color: var(--border-strong); }
.kpi-head { display: flex; align-items: center; gap: .65rem; }
.kpi-head h3 { margin: 0; font-size: .98rem; flex: 1; }
.kpi-ico { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border-radius: 12px; background: var(--k-soft); font-size: 1.25rem; flex: none; }
.kpi-share-n { font-size: .85rem; font-weight: 700; color: var(--k); white-space: nowrap; }
.kpi-share-n small { font-weight: 400; color: var(--muted); }
.kpi-value .amt b { font-size: 1.75rem; }
.kpi-value .amt small { font-size: .85rem; }
.kpi-sub { font-size: .86rem; color: var(--text-2); }
.kpi-sub b { color: var(--text); font-size: 1rem; }
.bar { height: 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--k); transition: width .6s ease; }
.mini { width: 100%; border-collapse: collapse; margin-top: .3rem; font-size: .84rem; }
.mini th { font-weight: 500; font-size: .74rem; color: var(--muted); padding: .35rem .3rem; text-align: center; border-bottom: 1px solid var(--border); }
.mini td { padding: .42rem .3rem; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; border-bottom: 1px dashed var(--border); }
.mini tr:last-child td { border-bottom: 0; }
.mini .mini-k { text-align: right; color: var(--text-2); }
.mini small { color: var(--muted); }
.mini tr.is-zero td { color: var(--muted); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tile { display: flex; align-items: center; gap: .9rem; padding: .95rem 1.05rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); color: inherit; transition: transform .15s ease, border-color .15s ease; }
a.tile:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--border-strong); }
.tile-ico { width: 2.8rem; height: 2.8rem; display: grid; place-items: center; flex: none; border-radius: 13px; background: var(--k-soft); font-size: 1.35rem; }
.tile-label { font-size: .8rem; color: var(--muted); }
.tile-value { font-size: 1.35rem; font-weight: 800; line-height: 1.35; font-variant-numeric: tabular-nums; }
.tile-money .amt b { font-size: 1.2rem; }
.tile-hint { font-size: .76rem; color: var(--text-2); }
.dash-bottom .card { margin-bottom: 0; }
@media (max-width: 1180px) { .dash-hero { grid-template-columns: 1fr; } .kpi-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kpi-3 { grid-template-columns: 1fr; } .hero-stats { grid-template-columns: 1fr 1fr; } .hero-value .amt b { font-size: 2rem; } .seg { margin-right: 0; width: 100%; overflow-x: auto; } }
@media (prefers-reduced-motion: reduce) { .kpi, .tile, .bar > span, .seg a { transition: none; } .kpi:hover, a.tile:hover { transform: none; } }

/* ---------- no visible scrollbars anywhere (page, tables, panels, code, textareas) ----------
   Scrolling itself is untouched: wheel, touch, keyboard, middle-click and (for tables) mouse drag all work. */
html, body, * { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, *::-webkit-scrollbar { display: none; width: 0; height: 0; background: transparent; }
body { overflow-x: clip; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* wide tables: edge fade shows that there is more, the table can be dragged, and cells are compact enough to rarely overflow */
.table-wrap { position: relative; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.table-wrap.is-scrollable { cursor: grab; }
.table-wrap.is-scrollable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 10px; }
.table-wrap.is-dragging { cursor: grabbing; user-select: none; scroll-behavior: auto; }
.table-wrap.is-dragging a, .table-wrap.is-dragging button { pointer-events: none; }
.table-wrap.fade-l { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px); mask-image: linear-gradient(to right, transparent 0, #000 44px); }
.table-wrap.fade-r { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 44px); mask-image: linear-gradient(to left, transparent 0, #000 44px); }
.table-wrap.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 44px, #000 calc(100% - 44px), transparent 100%); }
@media (max-width: 1500px) {
  .table th, .table td { padding: .6rem .6rem; font-size: .87rem; }
  .sidebar { width: 232px; } .main { margin-right: 232px; }
}
@media (max-width: 860px) { .main { margin-right: 0; } }
