@font-face {
  font-family: Shabnam;
  src: url('/fonts/Shabnam-FD.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Shabnam;
  src: url('/fonts/Shabnam-Bold-FD.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}

:root {
  font-family: Shabnam, Tahoma, sans-serif;
  color: #24233a;
  background: #f5f6fb;
  --surface: #fff;
  --muted: #656881;
  --border: #e6e7f0;
  --primary: #5142d9;
  --primary-dark: #4030bd;
  --soft: #efedff;
  --radius: 20px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); letter-spacing: -.025em; line-height: 1.4; }
h2 { font-size: 1.16rem; }
h3 { font-size: 1.04rem; }
p { line-height: 1.8; }
svg { flex: 0 0 auto; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #8277ef; outline-offset: 3px; }
.initial-loading, .loading { padding: 46px 16px; text-align: center; color: var(--muted); }

.brand { display: flex; align-items: center; gap: 12px; font-size: 1.35rem; font-weight: 700; white-space: nowrap; line-height: 1.2; }
.profile small { display: block; color: var(--muted); font-size: .79rem; font-weight: 400; margin-top: 5px; }
.brand-mark { display: grid; place-items: center; height: 45px; width: 45px; border-radius: 14px; color: white; background: var(--primary); }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; font-weight: 700; }
.button { min-height: 43px; padding: 8px 15px; border: 1px solid transparent; white-space: nowrap; font-size: .91rem; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); }
.button.secondary { background: #fff; border-color: #dbddeb; color: #3e4058; }
.button.secondary:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #f0f0f9; }
.button.soft { background: var(--soft); color: var(--primary-dark); }
.button.soft:hover:not(:disabled) { background: #e3deff; }
.button.wide { width: 100%; }
.button.small { min-height: 38px; }
.icon-button { color: #626583; background: transparent; padding: 0; border: 0; width: 42px; height: 42px; }

.login-layout { display: grid; grid-template-columns: minmax(340px, .87fr) minmax(360px, 1.13fr); min-height: 100svh; background: #fff; }
.login-main { display: grid; grid-template-rows: auto 1fr; gap: 48px; padding: clamp(24px, 5vw, 68px); }
.login-form-wrap { width: min(100%, 390px); align-self: center; justify-self: center; }
.form-emblem { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; color: var(--primary); background: var(--soft); margin-bottom: 19px; }
.login-form-wrap > p { color: var(--muted); margin: 8px 0 27px; }
.login-form-wrap .wide { margin-top: 3px; }
.login-art { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; text-align: center; margin: 19px 0 19px 19px;
  border-radius: 30px; background: radial-gradient(ellipse at 48% 42%, #5f53df 0%, #382a95 46%, #241a67 100%); color: #fff; overflow: hidden; min-height: 540px; }
.login-visual { position: relative; display: grid; place-items: center; width: min(75%, 395px); aspect-ratio: 1; }
.orbit { position: absolute; inset: 0; border: 1px solid #c9c4fc55; border-radius: 50%; }
.orbit-two { inset: 13%; }
.orbit-three { inset: 25%; }
.visual-core { width: 36%; aspect-ratio: 1; border-radius: 30%; display: grid; place-items: center; background: #ada2ff36; color: white;
  border: 1px solid #d5ccff7a; box-shadow: 0 19px 70px #17104475, inset 0 1px 10px #d5ccff42; transform: rotate(-9deg); }
.visual-core svg { width: 60%; height: auto; }
.satellite { position: absolute; display: block; width: 11px; height: 11px; border-radius: 50%; background: #c1b6ff; box-shadow: 0 0 18px #ddd6ff; }
.sat-one { top: 16%; left: 21%; }
.sat-two { top: 54%; right: 12%; width: 8px; height: 8px; }
.sat-three { bottom: 12%; left: 21%; width: 7px; height: 7px; }

form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: .92rem; font-weight: 700; min-width: 0; }
label small { color: var(--muted); font-size: .81rem; font-weight: 400; line-height: 1.65; }
input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; min-height: 45px; border: 1px solid #d9dcea;
  border-radius: 10px; padding: 9px 12px; color: #24233a; background: #fff; font-weight: 400; font-size: 1rem;
}
input[dir="ltr"]::placeholder { text-align: right; }
input::placeholder, textarea::placeholder { color: #73778e; opacity: 1; }
textarea { resize: vertical; }
select { appearance: none; padding-inline-end: 35px; background: url('/assets/chevron.svg') left 13px center / 15px no-repeat #fff; }
.password-field { position: relative; display: block; }
.password-field input { padding-left: 46px; }
.password-field button { position: absolute; left: 3px; top: 2px; height: 41px; }
.form-error { color: #a32643; font-size: .88rem; }

.shell { min-height: 100svh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; padding: 29px 19px 18px; background: #fff; border-inline-end: 1px solid var(--border); }
.sidebar .brand { margin: 0 12px 50px; }
.sidebar nav { display: grid; gap: 7px; }
.sidebar nav button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 47px; border: 0; border-radius: 11px; padding: 9px 13px; background: transparent; color: var(--muted); font-size: .93rem; text-align: start; white-space: nowrap; }
.sidebar nav button:hover { background: #f3f2fb; }
.sidebar nav button[aria-current] { background: var(--soft); color: var(--primary-dark); font-weight: 700; }
.sidebar-bottom { margin-top: auto; padding: 13px 3px 0; display: flex; align-items: center; justify-content: space-between; gap: 7px; border-top: 1px solid var(--border); }
.profile { display: flex; align-items: center; min-width: 0; gap: 10px; }
.profile div { min-width: 0; }
.profile b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.avatar { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; background: var(--soft); color: var(--primary); border-radius: 12px; font-weight: 700; }
.logout { flex: 0 0 auto; }
.workspace { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(20px, 4vw, 50px); height: 72px; border-bottom: 1px solid var(--border); background: #fff; color: #4c4e65; font-size: .94rem; font-weight: 700; }
.today { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .87rem; font-weight: 400; }
.main-content { width: min(100%, 1430px); margin-inline: auto; padding: 36px clamp(20px, 4vw, 50px); display: grid; gap: 23px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.page-heading p { color: var(--muted); margin-top: 5px; overflow-wrap: anywhere; }
.page-heading h1 { overflow-wrap: anywhere; }
.heading-actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.subscriber-grid, .account-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); gap: 19px; }
.account-grid { align-items: start; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.usage-card, .service-card, .configs-card, .account-card { padding: 23px; }
.section-title, .section-title > div { display: flex; align-items: center; gap: 11px; }
.section-title { justify-content: space-between; align-items: flex-start; }
.section-title p { font-size: .87rem; color: var(--muted); margin-top: 4px; }
.glyph { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: var(--primary); background: var(--soft); }
.glyph.green { color: #0a7967; background: #e5f7f1; }
.glyph.blue { color: #2a5bb5; background: #e8f1ff; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 5px 10px; font-size: .82rem; white-space: nowrap; font-weight: 700; line-height: 1.3; }
.badge.good { color: #087761; background: #e6f7f1; }
.badge.neutral { color: #585b72; background: #eff0f5; }
.badge.warn { color: #90530a; background: #fff3d9; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.usage-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-evenly; gap: 16px; margin-top: 22px; }
.ring { width: clamp(134px, 17vw, 190px); aspect-ratio: 1; display: grid; place-items: center; position: relative; text-align: center; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-width: 11; }
.ring-track { stroke: #eceafb; }
.ring-fill { stroke: #6554e8; stroke-linecap: round; }
.ring > div { display: grid; justify-items: center; gap: 1px; }
.ring strong { font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.3; }
.ring span, .ring small { color: var(--muted); font-size: .77rem; }
.traffic { display: grid; gap: 13px; }
.traffic > div { display: flex; align-items: center; gap: 10px; }
.traffic span:not(.glyph), .stat-label { display: block; color: var(--muted); font-size: .87rem; }
.traffic strong { font-size: .95rem; }
.updated { color: var(--muted); font-size: .81rem; margin-top: -13px; }
dl { display: grid; gap: 0; margin: 16px 0 0; }
dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
dl div:last-child { border-bottom: 0; padding-bottom: 1px; }
dt { color: var(--muted); font-size: .89rem; flex-shrink: 0; }
dd { margin: 0; text-align: left; font-weight: 700; font-size: .88rem; overflow-wrap: anywhere; }
.links { display: grid; gap: 9px; margin-top: 18px; }
.link-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; min-width: 0;
  background: #f8f8fc; border: 1px solid var(--border); padding: 8px 11px; border-radius: 12px; }
.link-label, .link-actions { display: flex; align-items: center; gap: 8px; }
.link-label b { font-size: .9rem; }
.protocol { font: 700 .73rem ui-monospace, monospace; color: #5545b8; background: #ece9fa; padding: 5px 7px; border-radius: 6px; }
.link-value { display: block; overflow: auto; white-space: nowrap; color: #555875; min-width: 0; font-size: .83rem; scrollbar-width: thin; }
.notice { display: flex; align-items: center; gap: 9px; background: #fff4de; border: 1px solid #efdfb9; border-radius: 12px; color: #784b0f; padding: 11px 14px; font-size: .91rem; }
.empty { display: grid; gap: 7px; justify-items: center; text-align: center; padding: 32px 12px; }
.empty p { font-size: .91rem; color: var(--muted); }
.empty .glyph { margin-bottom: 3px; }
.account-card form { margin-top: 18px; }
.account-card form .button { justify-self: start; }

.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metrics-grid .stat { align-items: flex-start; }
.metrics-grid .stat-value { font-size: clamp(1.05rem, 1.65vw, 1.5rem); overflow-wrap: anywhere; }
.stat { min-height: 105px; padding: 18px; display: flex; align-items: center; gap: 12px; }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.35; }
.stat-hint { color: var(--muted); font-size: .81rem; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 17px 20px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #d9dcea; border-radius: 11px; color: var(--muted); width: min(52%, 275px); padding: 0 10px; }
.search input { min-width: 0; min-height: 42px; border: 0; padding: 0; }
.search:focus-within { outline: 2px solid #8277ef; }
.search input:focus-visible { outline: 0; }
.table-scroll { overflow-x: auto; }
.overview-table th, .overview-table td { padding-inline: 12px; }
table { width: 100%; border-collapse: collapse; text-align: start; white-space: nowrap; }
th, td { padding: 12px 19px; text-align: start; border-bottom: 1px solid var(--border); font-size: .91rem; }
thead th { background: #f8f8fc; color: var(--muted); font-size: .86rem; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th small { display: block; text-align: start; font-size: .8rem; color: var(--muted); font-weight: 400; margin-top: 4px; }
tbody th small[dir="ltr"] { text-align: right; }
.pending-label { display: block; margin-top: 5px; color: var(--muted); font-size: .79rem; }
dialog { padding: 24px; width: min(calc(100vw - 28px), 545px); max-height: calc(100svh - 28px);
  border: 1px solid var(--border); border-radius: 21px; color: #24233a; box-shadow: 0 22px 85px #17104445; overflow-y: auto; }
dialog::backdrop { background: #19153480; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 18px; }
.modal-heading h2 { font-size: 1.3rem; }
.modal-heading p { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; align-items: center; justify-content: start; gap: 8px; font-weight: 400; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--primary); }
.client-picker { margin: 0; border: 1px solid #d9dcea; border-radius: 12px; padding: 10px 12px; min-width: 0; }
.client-picker legend { padding-inline: 5px; font-size: .92rem; font-weight: 700; }
.client-picker small { display: block; color: var(--muted); font-weight: 400; font-size: .81rem; }
.picker-options { display: grid; gap: 1px; max-height: 200px; overflow: auto; }
.picker-option { display: flex; align-items: center; gap: 8px; padding: 5px 2px; }
.picker-option input { width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.picker-option span { overflow-wrap: anywhere; }
.transfer { display: grid; grid-template-columns: auto 1fr; margin-top: 9px; gap: 2px 6px; font-size: .85rem; }
.transfer small { grid-column: 2; }
.modal-actions { display: flex; align-items: center; gap: 9px; }
[data-dialog-status] { color: var(--muted); font-size: .86rem; }
.credentials-dialog dd { overflow-wrap: anywhere; }
.credentials-dialog .modal-actions, .qr-dialog .modal-actions { margin-top: 17px; }
.qr-dialog { width: min(calc(100vw - 28px), 440px); }
.qr-image { display: block; width: min(100%, 340px); aspect-ratio: 1; margin: auto; }
#toast { display: none; position: fixed; inset-inline-end: 22px; bottom: 22px; z-index: 20; max-width: min(calc(100% - 44px), 370px);
  padding: 12px 17px; border-radius: 12px; background: #271f50; color: #fff; font-size: .9rem; box-shadow: 0 8px 25px #21174838; }
#toast.visible { display: block; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .subscriber-grid, .account-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-main { min-height: 100svh; gap: 34px; padding: 24px; }
  .login-art { display: none; }
  .shell { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 13px 15px 9px; border: 0; }
  .sidebar .brand { margin: 0; font-size: 1.16rem; }
  .sidebar .brand-mark { width: 39px; height: 39px; }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .sidebar nav.admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar nav button { min-height: 42px; justify-content: center; font-size: .87rem; gap: 6px; padding-inline: 5px; }
  .sidebar nav svg { width: 17px; height: 17px; }
  .sidebar-bottom { grid-row: 1; grid-column: 2; margin: 0; padding: 0; border: 0; }
  .profile div { display: none; }
  .topbar { height: 47px; font-size: .86rem; padding-inline: 16px; }
  .main-content { padding: 23px 15px; gap: 17px; }
  .page-heading { align-items: flex-start; }
  .page-heading p { font-size: .91rem; }
  .usage-card, .service-card, .configs-card, .account-card { padding: 16px; }
  .admin-stats { gap: 7px; }
  .stat { display: grid; padding: 11px; gap: 7px; }
  .stat .glyph { width: 32px; height: 32px; border-radius: 9px; }
  .stat-label { font-size: .81rem; }
  .table-toolbar { padding-inline: 12px; }
  th, td { padding-inline: 12px; }
  .link-row { grid-template-columns: 1fr auto; gap: 7px; }
  .link-value { grid-row: 2; grid-column: 1 / -1; padding-inline: 4px; padding-bottom: 4px; }
  .link-actions { gap: 4px; }
  .link-actions .button { padding-inline: 9px; }
  .heading-actions { justify-content: flex-end; }
  .qr-button svg { display: none; }
  .overview-table { border-top: 1px solid var(--border); }
  .overview-table table, .overview-table tbody { display: block; white-space: normal; }
  .overview-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .overview-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start; gap: 8px 12px; padding: 14px; border-bottom: 1px solid var(--border); }
  .overview-table tbody tr:last-child { border-bottom: 0; }
  .overview-table th, .overview-table td { border: 0; padding: 0; overflow-wrap: anywhere; }
  .overview-table td:nth-child(2) { justify-self: end; }
  .overview-table td[data-label] { display: grid; gap: 2px; }
  .overview-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  .overview-table td:last-child { grid-column: 2; grid-row: 4; justify-self: end; align-self: end; }
}
@media (max-width: 380px) {
  .page-heading { flex-wrap: wrap; }
  .form-columns { grid-template-columns: 1fr; }
}
