/* Valmier panel — "Vormir at dusk", 3x-ui-style console.
   Crimson→violet gradient is the brand (sidebar active item, primary buttons, hero cards, gauges).
   Amber (--soul) means money. Everything else is quiet stone. */
@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: "Lalezar"; src: url(fonts/Lalezar-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }

:root {
  /* ground */
  --abyss: #0C0608; --stone: #120709; --night: #1A0C12; --night-2: #211019; --night-3: #2A1520;
  --line: rgba(244, 236, 230, .07); --line-2: rgba(244, 236, 230, .12);
  /* sky */
  --dusk: #4A1E3A; --violet: #7A2C66; --crimson: #B3122E; --ember: #E0382B; --soul: #F2862A;
  --sky: linear-gradient(135deg, #C4163A 0%, #8E1B45 45%, #4A1E3A 100%);
  --sky-soft: linear-gradient(135deg, rgba(196, 22, 58, .22), rgba(74, 30, 58, .18));
  /* text */
  --bone: #F4ECE6; --ash: #C9B8B0; --ash-dim: #8C7774;
  /* status */
  --ok: #3FB27F; --ok-bg: rgba(63, 178, 127, .12); --bad: #F0544A; --bad-bg: rgba(240, 84, 74, .12);
  --warn: #F2862A; --warn-bg: rgba(242, 134, 42, .13); --vio: #C77DDB; --vio-bg: rgba(199, 125, 219, .13);
  --side: 252px; --r: 14px; --r-sm: 10px;
  --display: "Lalezar", "Vazirmatn", Tahoma, sans-serif;
  --text: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--bone); font: 14.5px/1.7 var(--text); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 420px at 100% -8%, rgba(179, 18, 46, .30), transparent 65%),
    radial-gradient(700px 380px at 20% -12%, rgba(74, 30, 58, .45), transparent 70%),
    var(--abyss);
  background-attachment: fixed;
}
a { color: var(--soul); text-decoration: none; }
a:hover { color: #ffad66; }
:focus-visible { outline: 2px solid var(--soul); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(224, 56, 43, .45); }
.num, .mono { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); font-size: 12px; color: var(--ash-dim); }
.muted { color: var(--ash); }
.dim { color: var(--ash-dim); }
.small { font-size: 12.5px; }
.money { color: var(--soul); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden], .nomatch { display: none !important; }

/* ================= shell ================= */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40;
  background: linear-gradient(180deg, rgba(26, 12, 18, .96), rgba(18, 7, 9, .98)); border-inline-start: 1px solid var(--line);
  padding: 18px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; color: var(--bone); }
.brand:hover { color: var(--bone); }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 8px 24px -8px rgba(224, 56, 43, .8); }
.brand span { display: flex; flex-direction: column; font: 24px/1.1 var(--display); }
.brand small { font: 500 11.5px/1.6 var(--text); color: var(--ash-dim); }
.side nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-inline: -4px; padding-inline: 4px; }
.nav-group { font-size: 11.5px; font-weight: 500; color: var(--ash-dim); padding: 14px 12px 6px; letter-spacing: .02em; }
.side nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--ash);
  font-weight: 500; transition: background .15s, color .15s;
}
.side nav a:hover { color: var(--bone); background: rgba(255, 255, 255, .035); }
.side nav a.on { color: #fff; background: var(--sky); box-shadow: 0 10px 26px -12px rgba(196, 22, 58, .9), inset 0 1px 0 rgba(255, 255, 255, .12); }
.side nav a.on .ico { color: #fff; }
.count { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--ember); color: #fff; font: 700 11px/20px var(--text); text-align: center; }
.side nav a.on .count { background: rgba(255, 255, 255, .22); }
.me { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--night-2); border: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--sky); font-weight: 700; color: #fff; }
.me-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; font-weight: 500; line-height: 1.4; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.me-name small { font-size: 11px; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 3vw, 32px); min-height: 72px;
  background: rgba(12, 6, 8, .62); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { margin: 0; font: 400 25px/1.25 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ash-dim); }
.crumb a { color: var(--ash); } .crumb a:hover { color: var(--bone); }
.crumb .ico { width: 13px; height: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px;
  background: var(--night-2); border: 1px solid var(--line); color: var(--ash); cursor: pointer; padding: 0; transition: .15s;
}
.icon-btn:hover { color: var(--bone); border-color: var(--line-2); background: var(--night-3); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; } .icon-btn.sm .ico { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--bad); border-color: rgba(240, 84, 74, .4); }
.icon-btn .count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
.page { width: 100%; max-width: 1320px; padding: 24px clamp(16px, 3vw, 32px) 64px; }

/* ================= cards ================= */
.card { background: linear-gradient(180deg, var(--night-2), var(--night)); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); min-height: 56px; }
.card-head h2 { flex: 1; margin: 0; font: 700 14.5px/1.4 var(--text); display: flex; align-items: center; gap: 10px; }
.card-head h2 .ico { color: var(--ember); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card.hl { border-color: rgba(242, 134, 42, .35); background: linear-gradient(135deg, rgba(242, 134, 42, .1), var(--night) 60%); }
.card.danger { border-color: rgba(240, 84, 74, .35); background: linear-gradient(135deg, rgba(240, 84, 74, .1), var(--night) 60%); }
h2 { font: 700 15px/1.4 var(--text); margin: 0 0 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 18px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.cols-2-1 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); align-items: start; }
.cols-2-1 > *, .cols > * { min-width: 0; }

/* stat cards */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.stat { position: relative; display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: var(--r); border: 1px solid var(--line); background: linear-gradient(180deg, var(--night-2), var(--night)); overflow: hidden; }
.stat .s-ico { width: 46px; height: 46px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--sky-soft); color: var(--ember); border: 1px solid rgba(224, 56, 43, .2); }
.stat .s-ico .ico { width: 22px; height: 22px; }
.stat .s-ico.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(63, 178, 127, .2); }
.stat .s-ico.warn { background: var(--warn-bg); color: var(--soul); border-color: rgba(242, 134, 42, .22); }
.stat .s-ico.vio { background: var(--vio-bg); color: var(--vio); border-color: rgba(199, 125, 219, .2); }
.stat .k { color: var(--ash); font-size: 12.5px; }
.stat .v { font: 700 21px/1.35 var(--text); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ash-dim); margin-inline-start: 4px; }
.stat .v.money { color: var(--soul); }
/* the hero: the one gradient card per page */
.hero {
  position: relative; overflow: hidden; border-radius: 18px; padding: 24px 26px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(420px 220px at 12% 0%, rgba(242, 134, 42, .32), transparent 70%), var(--sky);
  box-shadow: 0 24px 60px -30px rgba(196, 22, 58, .85), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.hero::after { /* Vormir cliff line */
  content: ""; position: absolute; inset: auto 0 0 0; height: 34px; opacity: .35; pointer-events: none;
  background: rgba(12, 6, 8, .9);
  clip-path: polygon(0 100%, 0 62%, 7% 74%, 14% 36%, 21% 66%, 30% 48%, 39% 80%, 50% 22%, 59% 60%, 70% 42%, 79% 72%, 88% 38%, 95% 64%, 100% 50%, 100% 100%);
}
.hero > * { position: relative; z-index: 1; }
.hero .label { font-size: 13px; color: rgba(255, 255, 255, .78); }
.hero .amount { font: 400 clamp(36px, 5vw, 50px)/1.1 var(--display); color: #FFD3A6; text-shadow: 0 0 30px rgba(242, 134, 42, .55); }
.hero .amount small { font: 500 14px var(--text); color: rgba(255, 255, 255, .8); margin-inline-start: 6px; text-shadow: none; }
.hero-grid { display: flex; flex-wrap: wrap; gap: 20px 32px; align-items: flex-end; justify-content: space-between; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-facts > div { padding: 8px 14px; border-radius: 11px; background: rgba(12, 6, 8, .28); border: 1px solid rgba(255, 255, 255, .1); font-size: 12px; color: rgba(255, 255, 255, .75); backdrop-filter: blur(4px); }
.hero-facts b { display: block; font: 700 16px/1.35 var(--text); color: #fff; font-variant-numeric: tabular-nums; }
.hero .btn.light { box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6); }

/* ring gauge */
.rings { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); justify-items: center; }
.ring-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 12.5px; color: var(--ash); }
.ring { position: relative; width: 118px; height: 118px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: rgba(255, 255, 255, .06); }
.ring .fill { stroke: var(--ember); stroke-linecap: round; transition: stroke-dasharray .6s ease; filter: drop-shadow(0 0 6px rgba(224, 56, 43, .45)); }
.ring.ok .fill { stroke: var(--ok); filter: drop-shadow(0 0 6px rgba(63, 178, 127, .4)); }
.ring.warn .fill { stroke: var(--soul); filter: drop-shadow(0 0 6px rgba(242, 134, 42, .45)); }
.ring.vio .fill { stroke: var(--vio); filter: drop-shadow(0 0 6px rgba(199, 125, 219, .4)); }
.ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25; }
.ring-in b { font: 700 19px var(--text); color: var(--bone); }
.ring-in span { font-size: 11px; color: var(--ash-dim); }
.ring.lg { width: 150px; height: 150px; } .ring.lg .ring-in b { font-size: 24px; }

/* ================= tables (ant-ish) ================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th, tr.th th { text-align: start; font: 500 12px var(--text); color: var(--ash-dim); padding: 11px 14px; background: rgba(255, 255, 255, .025); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(255, 255, 255, .022); }
td.name a, td a.name { color: var(--bone); font-weight: 500; }
td.name a:hover, td a.name:hover { color: var(--soul); }
.sub { display: block; font-size: 11.5px; color: var(--ash-dim); }
td.actions { white-space: nowrap; width: 1%; }
td.actions .row { gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.empty { color: var(--ash); text-align: center; padding: 40px 16px !important; }
.empty .ico { display: block; margin: 0 auto 10px; width: 34px; height: 34px; color: var(--ash-dim); stroke-width: 1.4; }
tr.off td { opacity: .45; }

/* toolbar above a table */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--abyss); border: 1px solid var(--line); }
.seg button { border: 0; background: none; color: var(--ash); font: 500 12.5px var(--text); padding: 5px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--bone); }
.seg button.on { background: var(--night-3); color: var(--bone); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.seg .n { font-size: 11px; color: var(--ash-dim); }
.search { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search .ico { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--ash-dim); pointer-events: none; }
.search input { padding-inline-start: 36px; height: 36px; padding-block: 0; }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font: 500 12px/1 var(--text); white-space: nowrap; border: 1px solid transparent; color: var(--ash); background: rgba(255, 255, 255, .05); border-color: var(--line); }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.tag.green { color: var(--ok); background: var(--ok-bg); border-color: rgba(63, 178, 127, .25); }
.tag.red { color: var(--bad); background: var(--bad-bg); border-color: rgba(240, 84, 74, .28); }
.tag.amber { color: var(--soul); background: var(--warn-bg); border-color: rgba(242, 134, 42, .28); }
.tag.violet { color: var(--vio); background: var(--vio-bg); border-color: rgba(199, 125, 219, .25); }
.tag.gray { color: var(--ash); }
.tag.crimson { color: #fff; background: var(--sky); border-color: transparent; }
.flag { display: inline-grid; place-items: center; width: 20px; height: 14px; flex: none; border-radius: 3px; overflow: hidden; font: 700 8px/1 var(--text); color: var(--ash); background: var(--night-3); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1); vertical-align: -2px; }
.f-nl { background: linear-gradient(#AE1C28 33.3%, #fff 0 66.6%, #21468B 0); }
.f-de { background: linear-gradient(#000 33.3%, #DD0000 0 66.6%, #FFCE00 0); }
.f-pl { background: linear-gradient(#fff 50%, #DC143C 0); }
.f-ru { background: linear-gradient(#fff 33.3%, #0039A6 0 66.6%, #D52B1E 0); }
.f-at { background: linear-gradient(#ED2939 33.3%, #fff 0 66.6%, #ED2939 0); }
.f-ir { background: linear-gradient(#239F40 33.3%, #fff 0 66.6%, #DA0000 0); }
.f-fr { background: linear-gradient(90deg, #002395 33.3%, #fff 0 66.6%, #ED2939 0); }
.f-it { background: linear-gradient(90deg, #009246 33.3%, #fff 0 66.6%, #CE2B37 0); }
.f-tr { background: radial-gradient(circle at 52% 50%, #E30A17 17%, transparent 18%), radial-gradient(circle at 44% 50%, #fff 23%, transparent 24%), #E30A17; }
.f-fi { background: linear-gradient(transparent 38%, #003580 0 62%, transparent 0), linear-gradient(90deg, transparent 28%, #003580 0 42%, transparent 0), #fff; }
.f-se { background: linear-gradient(transparent 40%, #FECC00 0 60%, transparent 0), linear-gradient(90deg, transparent 30%, #FECC00 0 44%, transparent 0), #006AA7; }
.f-us { background: linear-gradient(90deg, #3C3B6E 40%, transparent 0) top / 100% 54% no-repeat, repeating-linear-gradient(#B22234 0 7.7%, #fff 0 15.4%); }
.loc { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }

/* usage bar */
.usage { min-width: 150px; }
.usage-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ash); margin-bottom: 5px; }
.usage-pct { color: var(--ash-dim); }
.bar { height: 6px; background: rgba(255, 255, 255, .06); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(270deg, #E0382B, #8E1B45); box-shadow: 0 0 8px rgba(224, 56, 43, .5); }
.usage.hot .bar i { background: linear-gradient(270deg, #F2862A, #E0382B); }
.usage.hot .usage-pct { color: var(--soul); }

/* switch (a submit button that looks like a toggle) */
.switch { position: relative; width: 40px; height: 22px; flex: none; border-radius: 99px; border: 0; padding: 0; cursor: pointer; background: rgba(255, 255, 255, .14); transition: background .2s; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: inset-inline-end .2s; }
.switch.on { background: var(--sky); box-shadow: 0 0 12px -2px rgba(224, 56, 43, .7); }
.switch.on::after { inset-inline-end: 21px; }
.switch[disabled] { opacity: .4; cursor: not-allowed; }

/* ================= forms ================= */
label, .label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ash); margin-bottom: 7px; }
input, select, textarea {
  width: 100%; background: var(--abyss); color: var(--bone); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 10px 13px; font: inherit; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #6d5a58; }
input:hover, select:hover, textarea:hover { border-color: rgba(244, 236, 230, .2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(224, 56, 43, .18); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.fields { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.fields .field { margin: 0; }
.hint { font-size: 12px; color: var(--ash-dim); margin-top: 6px; }
.addon { display: flex; align-items: stretch; }
.addon input { border-start-end-radius: 0; border-end-end-radius: 0; }
.addon span { display: grid; place-items: center; padding: 0 12px; font-size: 12.5px; color: var(--ash); background: var(--night-3); border: 1px solid var(--line-2); border-inline-start: 0; border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--line-2); background: var(--abyss); color: var(--ash); border-radius: 8px; padding: 4px 11px; font: 500 12.5px var(--text); cursor: pointer; transition: .15s; }
.chip:hover { color: var(--bone); border-color: rgba(244, 236, 230, .25); }
.chip.on { color: #fff; border-color: transparent; background: var(--sky); }
.check { display: flex; align-items: center; gap: 10px; color: var(--bone); font-size: 14px; margin: 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--ember); margin: 0; }
/* selectable option cards (radio/checkbox) */
.options { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.option { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin: 0; border-radius: 12px; border: 1px solid var(--line-2); background: var(--abyss); cursor: pointer; color: var(--bone); font-size: 14px; transition: .15s; }
.option:hover { border-color: rgba(244, 236, 230, .25); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .flag { width: 26px; height: 18px; }
.option .o-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.45; }
.option .o-txt small { color: var(--ash-dim); font-size: 11.5px; }
.option .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: transparent; flex: none; }
.option .tick .ico { width: 12px; height: 12px; stroke-width: 3; }
.option:has(input:checked) { border-color: rgba(224, 56, 43, .7); background: linear-gradient(135deg, rgba(196, 22, 58, .16), rgba(74, 30, 58, .12)); box-shadow: 0 0 0 3px rgba(224, 56, 43, .12); }
.option:has(input:checked) .tick { background: var(--sky); border-color: transparent; color: #fff; }
.option:has(input:focus-visible) { outline: 2px solid var(--soul); outline-offset: 2px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; white-space: nowrap;
  background: var(--sky); color: #fff; border-radius: var(--r-sm); padding: 10px 18px; font: 700 14px/1.4 var(--text);
  box-shadow: 0 10px 24px -12px rgba(196, 22, 58, .95), inset 0 1px 0 rgba(255, 255, 255, .15); transition: filter .15s, transform .05s, box-shadow .15s;
}
.btn:hover { color: #fff; filter: brightness(1.12); box-shadow: 0 12px 28px -12px rgba(224, 56, 43, 1), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 17px; height: 17px; }
.btn.ghost { background: var(--night-2); color: var(--bone); box-shadow: none; border: 1px solid var(--line-2); font-weight: 500; }
.btn.ghost:hover { background: var(--night-3); filter: none; border-color: rgba(244, 236, 230, .2); }
.btn.soul { background: linear-gradient(135deg, #F79A3E, #E0682B); color: #2a1206; box-shadow: 0 10px 24px -12px rgba(242, 134, 42, .9); }
.btn.soul:hover { color: #2a1206; }
.btn.danger { background: var(--bad-bg); color: var(--bad); box-shadow: none; border: 1px solid rgba(240, 84, 74, .3); }
.btn.danger:hover { background: rgba(240, 84, 74, .2); color: #ff7a70; filter: none; }
.btn.light { background: #fff; color: #2a0d16; box-shadow: none; }
.btn.light:hover { color: #2a0d16; filter: none; background: #FFEDE0; }
.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
button.link { background: none; border: 0; color: var(--ash); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: var(--ember); }
form.inline { display: inline; }

/* callouts */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 18px; background: var(--warn-bg); border: 1px solid rgba(242, 134, 42, .28); color: #F7D4B4; font-size: 13.5px; }
.note .ico { color: var(--soul); margin-top: 3px; }
.note.info { background: rgba(255, 255, 255, .03); border-color: var(--line-2); color: var(--ash); }
.note.info .ico { color: var(--ash); }
.note.err { background: var(--bad-bg); border-color: rgba(240, 84, 74, .3); color: #FBC2BD; }
.note.err .ico { color: var(--bad); }
.note p { margin: 0; }

/* info list (key → value) */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 10px 0; border-bottom: 1px dashed var(--line-2); margin: 0; font-size: 13.5px; }
.kv dt { color: var(--ash); padding-inline-end: 18px; }
.kv dd { text-align: end; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }

/* QR + copy */
.qr { background: #fff; border-radius: 14px; padding: 10px; width: 200px; flex: none; box-shadow: 0 16px 40px -18px rgba(0, 0, 0, .8); }
.qr svg { width: 100%; height: auto; display: block; }
.copy { display: flex; gap: 8px; }
.copy input { direction: ltr; font: 12.5px var(--mono); color: var(--ash); }
.apps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* toast (flash) */
.toast {
  position: fixed; z-index: 100; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 520px); padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: rgba(33, 16, 25, .96); border: 1px solid rgba(63, 178, 127, .35); box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8);
  backdrop-filter: blur(10px); animation: toast-in .25s ease;
}
.toast .ico { color: var(--ok); }
.toast.err { border-color: rgba(240, 84, 74, .45); } .toast.err .ico { color: var(--bad); }
.toast.out { opacity: 0; transform: translate(-50%, -10px); transition: .35s; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -10px); } }

/* modal */
dialog.modal { border: 1px solid var(--line-2); border-radius: 18px; padding: 18px; background: var(--night-2); color: var(--bone); width: min(92vw, 360px); box-shadow: 0 30px 80px -20px #000; }
dialog.modal::backdrop { background: rgba(8, 3, 5, .72); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; font-size: 15px; }
dialog.modal .qr { width: 100%; margin-bottom: 14px; }
template { display: none; }

/* notifications list */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .f-dot { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .04); color: var(--ash); }
.feed li.new .f-dot { background: var(--sky-soft); color: var(--ember); }
.feed .f-body { flex: 1; min-width: 0; }
.feed time { display: block; font-size: 11.5px; color: var(--ash-dim); margin-top: 2px; }

/* server tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 18px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--abyss); border: 1px solid var(--line); }
.tile .flag { width: 30px; height: 21px; border-radius: 4px; }
.tile .t-txt { flex: 1; display: flex; flex-direction: column; line-height: 1.45; }
.tile .t-txt small { color: var(--ash-dim); font-size: 11.5px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63, 178, 127, .6); animation: pulse 2s infinite; }
.pulse.off { background: var(--bad); animation: none; box-shadow: 0 0 8px var(--bad); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(63, 178, 127, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 178, 127, 0); } }

/* cost summary (new config) */
.summary { position: sticky; top: 90px; }
.summary .total { font: 400 34px/1.2 var(--display); color: var(--soul); }
.summary .total small { font: 500 13px var(--text); color: var(--ash); margin-inline-start: 6px; }

/* ================= login ================= */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 55% at 50% 0%, rgba(196, 22, 58, .55), transparent 70%), radial-gradient(50% 50% at 50% 100%, rgba(74, 30, 58, .5), transparent 70%); pointer-events: none; }
.login::after { content: ""; position: absolute; inset: auto 0 0 0; height: 22vh; background: #08040599; clip-path: polygon(0 100%, 0 55%, 8% 70%, 16% 30%, 24% 62%, 33% 40%, 42% 76%, 52% 18%, 61% 58%, 71% 38%, 80% 70%, 89% 32%, 96% 60%, 100% 46%, 100% 100%); pointer-events: none; }
.login .login-card { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 32px 28px 28px; border-radius: 22px; background: rgba(26, 12, 18, .78); border: 1px solid var(--line-2); backdrop-filter: blur(16px); box-shadow: 0 40px 100px -30px #000; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; font: 32px/1 var(--display); }
.login-brand img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 16px 40px -12px rgba(224, 56, 43, .9); }
.login-brand small { font: 400 13px var(--text); color: var(--ash); }
.input-ico { position: relative; }
.input-ico .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ash-dim); pointer-events: none; }
.input-ico input { padding-inline-start: 40px; height: 46px; }
.login .btn { height: 46px; margin-top: 6px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--ash-dim); }

/* ================= phones ================= */
.tabbar { display: none; }
@media (max-width: 1100px) {
  .cols-2-1 { grid-template-columns: 1fr; }
  .summary { position: static; }
  .first-narrow { order: -1; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(84vw, 300px); transform: translateX(105%); transition: transform .25s ease; box-shadow: -30px 0 60px -20px #000; }
  .side-open .side { transform: none; }
  .side-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(8, 3, 5, .6); backdrop-filter: blur(2px); }
  .topbar { padding: 10px 16px; min-height: 60px; gap: 12px; }
  .topbar-logo { display: block; }
  .topbar-logo img { width: 34px; height: 34px; border-radius: 10px; display: block; }
  .topbar h1 { font-size: 21px; }
  .crumb { display: none; }
  .page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .hero { padding: 20px; border-radius: 16px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .stat .s-ico { width: 36px; height: 36px; border-radius: 10px; } .stat .s-ico .ico { width: 18px; height: 18px; }
  .stat .v { font-size: 17px; }
  .card-head, .card-body, .toolbar { padding-inline: 14px; }
  .tabbar {
    display: flex; position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px; z-index: 30; justify-content: space-around; align-items: flex-end;
    padding: 6px 4px; border-radius: 18px; background: rgba(26, 12, 18, .9); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line-2); box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .9);
  }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ash-dim); font: 500 10.5px var(--text); position: relative; padding: 5px 0; background: none; border: 0; cursor: pointer; border-radius: 12px; }
  .tabbar .ico { width: 21px; height: 21px; }
  .tabbar a.on { color: var(--bone); }
  .tabbar a.on .ico { color: var(--ember); }
  .tabbar a.primary .ico { width: 46px; height: 46px; padding: 12px; margin-top: -24px; margin-bottom: 1px; border-radius: 15px; background: var(--sky); color: #fff; box-shadow: 0 10px 22px -6px rgba(196, 22, 58, .95), 0 0 0 4px var(--abyss); }
  .tabbar .count { position: absolute; top: 0; inset-inline-start: 56%; min-width: 16px; height: 16px; line-height: 16px; font-size: 9.5px; padding: 0 4px; }
  /* tables become stacked cards */
  table.rtable thead { display: none; }
  table.rtable, table.rtable tbody, table.rtable tr, table.rtable td { display: block; width: 100%; }
  table.rtable tr { padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; }
  table.rtable tbody tr:last-child { border-bottom: 0; }
  table.rtable td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  table.rtable td[data-label]::before { content: attr(data-label); color: var(--ash-dim); font-size: 12px; flex: none; }
  table.rtable td.name { padding-bottom: 8px; padding-inline-end: 128px; font-size: 15px; display: block; overflow-wrap: anywhere; }
  table.rtable td.name a { display: inline-block; padding-block: 6px; margin-block: -6px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 8px 10px; }
  table.rtable td .usage { flex: 1; max-width: 70%; }
  table.rtable td.actions { width: 100%; padding-top: 10px; }
  table.rtable td.actions .row { justify-content: flex-start; }
  table.rtable td.lead { position: absolute; top: 12px; inset-inline-end: 14px; width: auto; padding: 0; }
  table.rtable tbody tr:hover td { background: none; }
  .search { max-width: none; }
  .qr { width: 180px; }
}
@media (max-width: 900px) {
  /* iOS Safari zooms into fields under 16px */
  input, select, textarea { font-size: 16px; }
  /* thumb-sized controls */
  .switch { width: 50px; height: 30px; }
  .switch::after { top: 4px; inset-inline-end: 4px; width: 22px; height: 22px; }
  .switch.on::after { inset-inline-end: 24px; }
  .chip { padding: 8px 14px; font-size: 13.5px; }
  .seg { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg button { padding: 8px 12px; white-space: nowrap; }
  .btn.small { padding: 9px 14px; }
  .icon-btn.sm { width: 40px; height: 40px; }
  .check input { width: 22px; height: 22px; }
  .stats > :last-child:nth-child(odd) { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .login-foot a { display: inline-block; padding: 10px 4px; }
}
/* ---- phone density: table cards as a 2-column grid, tabs, folding forms ---- */
.ptabs { display: none; }
.fold-toggle { display: none; }
@media (max-width: 900px) {
  table.rtable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  table.rtable td { padding: 0; }
  table.rtable td[data-label] { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; min-width: 0; }
  table.rtable td[data-label]::before { font-size: 11px; }
  table.rtable td.name, table.rtable td.actions, table.rtable td.empty, table.rtable td:has(.usage) { grid-column: 1 / -1; }
  table.rtable td.name { padding-bottom: 2px; }
  table.rtable td.name .sub { text-align: right; }
  table.rtable td:has(.usage) .usage { width: 100%; max-width: none; }
  table.rtable td.actions { padding-top: 4px; }
  table.rtable td.lead { grid-column: auto; }

  /* section tabs (long admin pages) */
  .ptabs { display: flex; gap: 4px; position: sticky; top: 60px; z-index: 20; margin: 0 -14px 14px; padding: 8px 14px;
    background: rgba(12, 6, 8, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .ptabs button { flex: 1 0 auto; border: 0; border-radius: 10px; padding: 9px 12px; background: none; color: var(--ash); font: 500 13.5px var(--text); cursor: pointer; white-space: nowrap; }
  .ptabs button.on { background: var(--sky); color: #fff; }
  [data-ptabs].tabbed [data-panel]:not(.on) { display: none; }
  [data-ptabs].tabbed .cols { display: block; }

  /* create forms fold into one bar on top */
  .fold { order: -1; }
  .fold .fold-toggle { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--night-3); color: var(--bone); border: 0; transition: transform .2s; }
  .fold.folded .fold-toggle { transform: rotate(-90deg); }
  .fold .card-head { cursor: pointer; }
  .fold.folded .card-head { border-bottom: 0; }
  .fold.folded > :not(.card-head):not(input) { display: none; }

  .hide-narrow { display: none !important; }
}
@media (max-width: 380px) { .stats { grid-template-columns: 1fr; } }
/* animations off: per-user switch on the account page (html.calm), see fx.css */

/* top-up page */
.cardno { font: 700 clamp(20px, 3.4vw, 28px)/1.4 var(--mono); letter-spacing: .06em; padding: 16px 18px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, #2A1520, #170A0F); border: 1px solid var(--line-2); color: var(--bone); }
.steps-v { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.steps-v li { position: relative; padding: 0 40px 16px 0; font-size: 13.5px; color: var(--ash-dim); counter-increment: st; }
.steps-v li::before { content: counter(st); position: absolute; inset-inline-start: 0; top: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line-2); }
.steps-v li.now { color: var(--bone); } .steps-v li.now::before { background: var(--sky); border-color: transparent; color: #fff; }
.steps-v li.done { color: var(--ash); } .steps-v li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok); border-color: rgba(63,178,127,.3); }
input[type=file] { padding: 8px; cursor: pointer; color: var(--ash); }
input[type=file]::file-selector-button { margin-inline-end: 12px; border: 0; border-radius: 8px; padding: 7px 14px; background: var(--night-3); color: var(--bone); font: 500 13px var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--dusk); }

/* admin: website chats */
.chatwrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.chatlist .threads { max-height: 68vh; overflow-y: auto; }
.thread { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--bone); transition: background .15s; }
.thread:hover { background: rgba(255,255,255,.03); color: var(--bone); }
.thread.on { background: linear-gradient(90deg, transparent, rgba(196,22,58,.16)); box-shadow: inset -3px 0 0 var(--ember); }
.thread .t-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.thread .t-txt b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread.unread .t-txt b { font-weight: 700; }
.thread small { font-size: 11.5px; color: var(--ash-dim); }
.new-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 10px var(--ember); flex: none; }
.chatbox { display: flex; flex-direction: column; height: min(74vh, 760px); }
.chatbox .back { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  background: radial-gradient(60% 50% at 50% 0%, rgba(122,44,102,.12), transparent 70%); }
.msg { max-width: 78%; padding: 10px 14px 6px; border-radius: 18px; line-height: 1.7; }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; font-size: 10.5px; opacity: .6; margin-top: 2px; }
.msg.visitor { align-self: flex-start; background: var(--night-3); border-start-start-radius: 6px; }
.msg.owner { align-self: flex-end; background: var(--sky); color: #fff; border-start-end-radius: 6px; box-shadow: 0 10px 24px -14px rgba(196,22,58,1); }
.msg.fresh { animation: msg-in .4s cubic-bezier(.3,1.4,.5,1); }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.composer textarea { resize: none; min-height: 46px; max-height: 160px; }
.composer .btn { height: 46px; width: 52px; padding: 0; flex: none; }
@media (max-width: 900px) {
  .chatwrap { grid-template-columns: 1fr; }
  .chatwrap.picked .chatlist { display: none; }
  .chatwrap:not(.picked) .chatbox { display: none; }
  .chatbox { height: calc(100svh - 190px); }
  .chatbox .back { display: grid; }
}

/* Telegram @username link (admin lists) */
.tg-handle { color: #6FB7E8; font-family: inherit; unicode-bidi: isolate; }
.tg-handle:hover { text-decoration: underline; }
