/* The customer panel. Tokens and the anatomy of a row (a logo tile, a title, a
   quiet second line, a price block) are the deploy wizard's own
   (templates/webapp/deploy.html); the light palette and English are new.

   The shape of the page: a navigation rail beside one content column on a
   desktop, a top bar and a bottom tab bar on a phone. Lists are one surface
   with rows, not a wall of cards, and a section's title lives inside its
   surface. Served under /pstatic/<version>/, so a change needs no rename. */
@font-face { font-family: "Shabnam"; font-weight: 400; font-display: swap;
  src: url("/static/miniapp/fonts/Shabnam.woff2") format("woff2"); }
@font-face { font-family: "Shabnam"; font-weight: 500 600; font-display: swap;
  src: url("/static/miniapp/fonts/Shabnam-Medium.woff2") format("woff2"); }
@font-face { font-family: "Shabnam"; font-weight: 700; font-display: swap;
  src: url("/static/miniapp/fonts/Shabnam-Bold.woff2") format("woff2"); }

:root {
  /* light: new. Neutrals lean toward the accent's blue. */
  --bg: #f2f5f9; --card: #ffffff; --text: #0f1b2a; --hint: #5d6f84;
  --accent: #0e7fdb; --accent-text: #ffffff; --link: #0b6cc0;
  --ok: #1a9b47; --danger: #d63a31; --warn: #b36b00;
  --shadow: 0 1px 2px rgba(15,27,42,.06), 0 12px 32px -12px rgba(15,27,42,.22);
  /* derived, exactly as deploy.html derives them */
  --card-hi: color-mix(in srgb, var(--card) 90%, var(--text) 10%);
  --border: color-mix(in srgb, var(--text) 12%, transparent);
  --border-strong: color-mix(in srgb, var(--text) 22%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --ok-soft: color-mix(in srgb, var(--ok) 16%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 15%, transparent);
  --warn-soft: color-mix(in srgb, var(--warn) 16%, transparent);
  --hover: color-mix(in srgb, var(--text) 4%, transparent);
  --r-lg: 18px; --r-md: 14px; --r-sm: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;
  --sans: "Shabnam", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --sans-en: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, "Shabnam", sans-serif;
}
/* dark: the Mini App's fallback palette, unchanged */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1621; --card: #1a2433; --text: #eaf1f8; --hint: #8597ab;
    --accent: #2ea6ff; --accent-text: #ffffff; --link: #62b0f6;
    --ok: #34c759; --danger: #ff5b52; --warn: #ffb020;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1621; --card: #1a2433; --text: #eaf1f8; --hint: #8597ab;
  --accent: #2ea6ff; --accent-text: #ffffff; --link: #62b0f6;
  --ok: #34c759; --danger: #ff5b52; --warn: #ffb020;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -12px rgba(0,0,0,.7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14.5px; line-height: 1.6;
  overscroll-behavior-y: none; }
html[lang="en"] body { font-family: var(--sans-en); }
#app { min-height: 100%; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.ic { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.mono { font-family: var(--mono); direction: ltr; unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
.muted { color: var(--hint); font-size: 13px; }
.inl { display: inline-flex; align-items: center; gap: 6px; }
.linklike { color: var(--link); background: none; border: 0; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.flag { width: 20px; height: 14px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.1);
  display: inline-block; vertical-align: -2px; flex: none; }
/* A system's mark, in its own colours (static/panel/logos/). MikroTik's is a
   wordmark, so it is a one-colour glyph drawn as a mask in the text colour. */
.osic { width: 16px; height: 16px; object-fit: contain; display: inline-block; vertical-align: -3px; flex: none; }
.oslogo { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; background: var(--text);
  -webkit-mask: var(--logo-file) center / contain no-repeat; mask: var(--logo-file) center / contain no-repeat; }
.oslogo[data-os="mikrotik"] { --logo-file: url("logos/mikrotik.svg"); }
/* a flag or a logo with its name: one unit, never broken across two lines */
.place { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; white-space: nowrap; vertical-align: middle; }
.place > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ the shell */
.shell { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); }
.rail { display: none; }
/* The column beside the rail. Its class is `column`, not `main`: a label span
   in a row is `.k.main`, and a shared name gave every switch row a viewport of height. */
.column { min-width: 0; display: flex; flex-direction: column; min-height: 100vh;
  padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 16px 28px; }
.page.enter > * { animation: pagein .16s ease-out both; }
.tabbody.enter { animation: pagein .16s ease-out both; }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* phone: who you are and what you have, as in the deploy wizard */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--border); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border: 0; background: none; color: inherit;
  text-align: start; cursor: pointer; padding: 0; border-radius: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; background: var(--accent-soft); display: grid;
  place-items: center; font-weight: 700; font-size: 15px; color: var(--accent); position: relative; overflow: hidden; }
.avatar.lg { width: 56px; height: 56px; font-size: 21px; }
/* Telegram's picture of the account, over the initial: while it loads, or if it never does, the letter shows. */
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* The name and the handle hug the avatar, on the page's own side. The handle is
   Latin and reads left to right, so it keeps direction: ltr, but where it SITS is
   the column's business (align-items follows the page's direction): aligned by
   its own text-align it sat at the far end of the bar on a Farsi page. */
.who { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; }
.who .name, .who .uname { display: block; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .name { font-weight: 650; font-size: 14.5px; line-height: 1.25; }
.who .uname { color: var(--hint); font-size: 12px; direction: ltr; unicode-bidi: isolate; line-height: 1.3; }
.balchip { flex: none; text-align: start; padding: 6px 12px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--border); line-height: 1.25; cursor: pointer; color: inherit; direction: ltr; }
.balchip .usd { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.balchip .irt { color: var(--hint); font-size: 11px; font-family: var(--sans); direction: rtl; }

/* phone: the four places there are */
.tabbar { position: fixed; z-index: 30; inset-inline: 0; inset-block-end: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border); }
.tabbar button { border: 0; background: none; color: var(--hint); cursor: pointer; display: flex; flex-direction: column; transition: color .18s;
  align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; font-size: 11.5px; font-weight: 600; }
.tabbar button .ic { width: 22px; height: 22px; transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
.tabbar button.on { color: var(--accent); }
.tabbar button.on .ic { transform: translateY(-1px) scale(1.08); }

@media (min-width: 960px) {
  .shell { grid-template-columns: 252px minmax(0, 1fr); }
  .rail { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; padding: 18px 14px;
    background: var(--card); border-inline-end: 1px solid var(--border); }
  .topbar, .tabbar { display: none; }
  .column { padding-bottom: 0; }
  .page { padding: 30px 36px 56px; }
}
/* The mark follows the page's direction, as the places under it do: on a Farsi page
   it starts at the right, beside their icons. Only the name reads left to right;
   the whole block set to ltr had put it at the far left, alone. */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 17px;
  font-family: var(--sans-en); }
.brand .brandname { direction: ltr; unicode-bidi: isolate; }
.brand i { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-style: normal; font-size: 16px; }
.railnav { display: flex; flex-direction: column; gap: 2px; }
.navitem { border: 0; background: none; color: var(--hint); cursor: pointer; display: flex; align-items: center; gap: 11px;
  transition: background .18s, color .18s;
  padding: 10px 12px; border-radius: 12px; font-size: 14.5px; font-weight: 600; text-align: start; width: 100%; }
.navitem .ic { width: 20px; height: 20px; }
.navitem:hover { background: var(--hover); color: var(--text); }
.navitem.on { background: var(--accent-soft); color: var(--accent); }
.navitem .count { margin-inline-start: auto; font-family: var(--mono); font-size: 12px; font-weight: 600; opacity: .8; }
.railfoot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.railwallet { border: 1px solid var(--border); background: var(--bg); color: inherit; border-radius: 14px; padding: 12px 14px;
  text-align: start; cursor: pointer; display: block; width: 100%; }
.railwallet:hover { border-color: var(--border-strong); }
.railwallet .lbl { color: var(--hint); font-size: 12px; }
.railwallet .usd { font-family: var(--mono); font-weight: 700; font-size: 20px; direction: ltr; text-align: start; unicode-bidi: plaintext; line-height: 1.35; }
.railwallet .irt { color: var(--hint); font-size: 12px; }
/* The account and the way out are one row: side by side in the footer's column. */
.railme { display: flex; align-items: center; gap: 4px; min-width: 0; }
.railme .iconbtn { flex: none; }
.rail .me { padding: 8px; }
.rail .brand .logo { height: 26px; }
.iconbtn.quiet { color: var(--hint); }
.iconbtn.muted { color: var(--warn); background: var(--warn-soft); }
.iconbtn.quiet:hover { color: var(--danger); }
.rail .me:hover { background: var(--hover); }

/* ------------------------------------------------------------ a page's own header */
.pagehead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead .titles { flex: 1 1 200px; min-width: 0; }
.pagehead h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.pagehead .sub { margin: 2px 0 0; color: var(--hint); font-size: 13px; }
.pagehead .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { margin-bottom: 10px; }

/* ------------------------------------------------------------ controls */
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--accent);
  color: var(--accent-text); transition: transform .08s, filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn:active { transform: scale(.98); }
.btn.tonal { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); font-weight: 600; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn .ic { width: 16px; height: 16px; }
.btn[disabled] { opacity: .55; cursor: default; filter: none; }
.btn.is-locked { background: var(--card-hi); color: var(--hint); border: 1px dashed var(--border-strong); }
.btn .spin { border-color: color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor; }
.iconbtn { border: 0; background: var(--card-hi); color: var(--hint); width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn:hover { color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { flex: none; border: 1px solid var(--border-strong); background: var(--card); color: var(--hint); font-size: 12.5px;
  transition: background .18s, color .18s, border-color .18s;
  font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip .n { font-family: var(--mono); opacity: .75; }
.seg-ctrl { display: flex; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 13px; }
.seg-ctrl button { flex: 1; border: 0; background: transparent; color: var(--hint); font-size: 13px; font-weight: 600;
  padding: 9px 4px; border-radius: 10px; cursor: pointer; transition: background .18s, color .18s; }
.seg-ctrl button.on { color: var(--accent-text); background: var(--accent); }
.sw { width: 46px; height: 28px; border-radius: 20px; flex: none; position: relative; border: 0; cursor: pointer; padding: 0;
  background: color-mix(in srgb, var(--text) 22%, transparent); transition: background .2s; }
.sw.on { background: var(--accent); }
.sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .2s cubic-bezier(.3,1.4,.5,1); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
[dir="rtl"] .sw.on::after { transform: translateX(-18px); }
[dir="ltr"] .sw.on::after { transform: translateX(18px); }
.search { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--border-strong); color: var(--hint); min-width: 0; flex: 1 1 200px; max-width: 320px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; background: none; color: var(--text); font-size: 13.5px; min-width: 0; width: 100%; outline: none; }
.search .ic { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { color: var(--hint); font-size: 12.5px; }
.input { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font-size: 14px; }
.input:focus { border-color: var(--accent); outline: none; }
.copychip { border: 0; background: var(--card-hi); color: var(--text); border-radius: 9px; padding: 4px 8px 4px 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 13px; direction: ltr; max-width: 100%; }
.copychip .ic { width: 14px; height: 14px; color: var(--hint); }
.copychip:hover .ic { color: var(--accent); }
.copychip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ surfaces */
.surface { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 4px 18px 6px; }
.card > h2 { margin: 0; padding: 14px 0 6px; font-size: 15.5px; font-weight: 700; }
.card > .lead { margin: 0 0 6px; color: var(--hint); font-size: 13px; line-height: 1.8; }
.card.pad { padding: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; min-height: 48px;
  border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--hint); font-size: 13.5px; min-width: 0; }
.row .k.main { color: var(--text); font-size: 14.5px; font-weight: 600; display: flex; flex-direction: column; gap: 1px; flex: 1 1 0; }
.row .k.main small { color: var(--hint); font-size: 12.5px; font-weight: 400; line-height: 1.6; max-width: 58ch; }
.row .k.main small.warn { color: var(--warn); }
.row > .sw { margin-inline-start: auto; }
.row .v { font-weight: 600; text-align: end; min-width: 0; display: inline-flex; align-items: center; gap: 6px; }
.row.total .k { color: var(--text); font-weight: 700; }
.row.total .v { font-family: var(--mono); font-size: 17px; direction: ltr; }
.grid2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.note { display: flex; gap: 10px; border-radius: var(--r-md); padding: 12px 14px; font-size: 13.5px; line-height: 1.8; align-items: flex-start; }
.note .ic { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.note.info { background: var(--accent-soft); } .note.info > .ic { color: var(--accent); }
.note.warn { background: var(--warn-soft); } .note.warn > .ic { color: var(--warn); }
.note.bad { background: var(--danger-soft); } .note.bad > .ic { color: var(--danger); }
.note.ok { background: var(--ok-soft); } .note.ok > .ic { color: var(--ok); }
.note .grow { flex: 1; min-width: 0; }
.note .btn { flex: none; align-self: center; }
.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.alerts:empty { display: none; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--card-hi); color: var(--hint); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.busy { background: var(--accent-soft); color: var(--accent); }
.meter { height: 6px; border-radius: 4px; background: var(--card-hi); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.meter.high i { background: var(--warn); }
.meter.full i { background: var(--danger); }
.spin { width: 15px; height: 15px; border-radius: 50%; flex: none; border: 2px solid var(--border-strong);
  border-top-color: var(--accent); animation: spin360 .8s linear infinite; display: inline-block; }
@keyframes spin360 { to { transform: rotate(360deg); } }

/* a logo on a light tile, so brand colours always read; the dot is Telegram's own way of saying "online" */
.tile { width: 42px; height: 42px; border-radius: 13px; flex: none; background: color-mix(in srgb, var(--text) 7%, transparent);
  display: grid; place-items: center; position: relative; }
.tile .osic, .tile .oslogo { width: 24px; height: 24px; }
.tile.lg { width: 56px; height: 56px; border-radius: 17px; }
.tile.lg .osic, .tile.lg .oslogo { width: 32px; height: 32px; }
.tile .dot { position: absolute; inset-block-end: -3px; inset-inline-end: -3px; width: 14px; height: 14px; border-radius: 50%;
  border: 2.5px solid var(--card); background: var(--hint); }
.tile .dot.on { background: var(--ok); }
.tile .dot.warn { background: var(--warn); }
.tile .dot.bad { background: var(--danger); }
.tile .dot.busy { background: var(--accent); animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 50% { opacity: .35; } }

/* ------------------------------------------------------------ the fleet: one surface, rows */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .chips { flex: 1 1 auto; }
.lhead, .srow { display: grid; align-items: center; column-gap: 14px;
  grid-template-columns: 42px minmax(0, 1fr) auto; }
.lhead { display: none; }
.srow { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; text-align: start;
  padding: 12px 14px; cursor: pointer; row-gap: 2px; grid-template-areas: "tile name cost" "tile meta renew"; }
.srow:last-child { border-bottom: 0; }
.srow:hover { background: var(--hover); }
.srow .tile { grid-area: tile; }
.srow .c-name { grid-area: name; min-width: 0; display: flex; align-items: center; gap: 8px; }
.srow .c-name b { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: ltr; unicode-bidi: plaintext; }
.srow .c-meta { grid-area: meta; min-width: 0; color: var(--hint); font-size: 12.5px; display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; }
.srow .c-meta .mono { overflow: hidden; text-overflow: ellipsis; }
.srow .c-cost { grid-area: cost; text-align: end; white-space: nowrap; }
.srow .c-cost b { font-family: var(--mono); font-size: 15px; direction: ltr; display: inline-block; }
.srow .c-cost small { color: var(--hint); font-size: 11.5px; }
.srow .c-renew { grid-area: renew; text-align: end; color: var(--hint); font-size: 12.5px; white-space: nowrap; }
.srow .c-renew small { font-size: inherit; }
.srow .c-renew small::before { content: " · "; }
.srow .c-renew.due { color: var(--warn); }
.srow .c-specs, .srow .c-loc, .srow .c-ip, .srow .c-traffic, .srow .c-chev { display: none; }
.srow.attn .c-renew { color: var(--warn); }
.empty-row { padding: 28px 16px; text-align: center; color: var(--hint); }
@media (min-width: 960px) {
  .lhead, .srow { grid-template-columns: 42px minmax(150px, 1.5fr) minmax(110px, 1fr) minmax(140px, 1fr) minmax(150px, 1.1fr)
    minmax(100px, .8fr) minmax(86px, .6fr) 18px; grid-template-areas: none; }
  .lhead { display: grid; padding: 10px 18px; color: var(--hint); font-size: 12.5px; border-bottom: 1px solid var(--border); }
  .srow { padding: 12px 18px; }
  .srow > * { grid-area: auto !important; }
  .srow .c-name { flex-direction: column; align-items: flex-start; gap: 0; }
  .srow .c-name .top { display: flex; align-items: center; gap: 8px; max-width: 100%; }
  .srow .c-specs { display: block; color: var(--hint); font-size: 12.5px; }
  .srow .c-meta { display: none; }
  .srow .c-loc { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13.5px; }
  .srow .c-loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .srow .c-ip { display: block; min-width: 0; }
  .srow .c-traffic { display: block; min-width: 0; font-size: 12.5px; color: var(--hint); }
  .srow .c-traffic .nums { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
  .srow .c-renew, .srow .c-cost { text-align: start; font-size: 13.5px; min-width: 0; }
  .srow .c-renew { white-space: normal; line-height: 1.45; }
  .srow .c-renew small { display: block; font-size: 12px; }
  .srow .c-renew small::before { content: none; }
  .srow .c-chev { display: block; color: var(--hint); }
}
.buildrow { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md);
  border: 1px dashed var(--border-strong); font-size: 13.5px; }
.sectitle { margin: 22px 2px 10px; font-size: 15px; font-weight: 700; }

/* ------------------------------------------------------------ one server */
.hero { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: 16px; }
.hero-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px; }
.hero-id { flex: 1 1 220px; min-width: 0; }
.hero-id h1 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-id h1 span.nm { direction: ltr; unicode-bidi: plaintext; }
.hero-id p { margin: 3px 0 0; color: var(--hint); font-size: 13px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.hero-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--border); }
.fact { padding: 12px 18px; border-inline-end: 1px solid var(--border); min-width: 0; }
.fact:last-child { border-inline-end: 0; }
.fact .k { color: var(--hint); font-size: 12.5px; }
.fact .v { font-weight: 650; font-size: 14.5px; margin-top: 2px; min-width: 0; }
@media (max-width: 640px) { .fact { border-inline-end: 0; border-bottom: 1px solid var(--border); } .fact:last-child { border-bottom: 0; } }
.ptabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 10px 12px; border-top: 1px solid var(--border); }
.ptabs::-webkit-scrollbar { display: none; }
.ptabs button { flex: none; border: 0; background: none; color: var(--hint); font-size: 13.5px; font-weight: 600; padding: 8px 14px;
  border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .18s, color .18s; }
.ptabs button .ic { width: 16px; height: 16px; }
.ptabs button:hover { color: var(--text); background: var(--hover); }
.ptabs button.on { color: var(--accent); background: var(--accent-soft); }
.cred-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); min-height: 48px; }
.cred-row:last-child { border-bottom: 0; }
.cred-row .k { color: var(--hint); font-size: 13px; width: 92px; flex: none; }
.cred-row .val { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13.5px; direction: ltr; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-row .val.plain { font-family: var(--sans); direction: inherit; text-align: start; color: var(--hint); font-size: 12.5px; white-space: normal; }
.copy { flex: none; border: 0; background: var(--card-hi); color: var(--hint); width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; cursor: pointer; }
.copy:hover { color: var(--accent); }
.copy .ic { width: 16px; height: 16px; }
.tool { background: none; border: 0; border-bottom: 1px solid var(--border); padding: 13px 0; display: flex; align-items: center;
  gap: 12px; cursor: pointer; color: inherit; text-align: start; width: 100%; }
.tool:last-child { border-bottom: 0; }
.tool .lead { width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); }
.tool .lead .ic { width: 20px; height: 20px; }
.tool .body { flex: 1; min-width: 0; }
.tool .h { font-weight: 650; font-size: 15px; display: block; }
.tool .s { color: var(--hint); font-size: 12.5px; display: block; }
.tool .trail { color: var(--hint); }
.tool:hover .trail { color: var(--accent); }
.tool[disabled] { opacity: .6; cursor: default; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.item:last-child { border-bottom: 0; }
.item .body { flex: 1 1 160px; min-width: 0; }
.item .h { font-weight: 650; font-size: 14.5px; }
.item .s { color: var(--hint); font-size: 12.5px; line-height: 1.7; max-width: 62ch; }
.item .h .nm { direction: ltr; unicode-bidi: plaintext; }
.item .h .pill { margin-inline-start: 6px; vertical-align: 1px; }
.item .s.warn, .lead-note.warn { color: var(--warn); }
.item .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
/* a figure at the end of a row: what choosing it costs */
.tool .trail.figure { text-align: end; color: var(--text); line-height: 1.35; }
.tool .trail.figure b { display: block; font-size: 15px; direction: ltr; }
.tool .trail.figure small { color: var(--hint); font-size: 11.5px; }
.lead-note { margin: 12px 0 4px; color: var(--hint); font-size: 13px; line-height: 1.8; }
.note .when { margin-top: 4px; font-size: 12.5px; color: var(--hint); }
.note .when .mono { color: var(--text); }
/* a few label and value rows inside a sheet: the figures a decision needs */
.kvs { border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px 14px; }
.kvs .row { padding: 10px 0; }
.tool .lead.plain { background: var(--card); border: 1px solid var(--border); }
.tool .lead.plain .osic, .tool .lead.plain .oslogo { width: 22px; height: 22px; }
.grouptitle { margin: 14px 0 2px; font-size: 12.5px; font-weight: 650; color: var(--hint); }
/* one installed app: its row, what it reported, its log */
.appitem { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.appitem:last-child { border-bottom: 0; padding-bottom: 0; }
.appitem .item { border-bottom: 0; }
pre.log { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--card); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px; line-height: 1.7; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word;
  max-height: 260px; overflow: auto; }
.logwrap { margin-top: 8px; font-size: 13px; color: var(--hint); }
.logwrap summary { cursor: pointer; }
.formcard { display: flex; flex-direction: column; gap: 14px; padding: 18px; }

/* ------------------------------------------------------------ wallet, account */
.balance { padding: 22px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.balance .fig { flex: 1 1 200px; min-width: 0; }
.balance .lbl { color: var(--hint); font-size: 13px; }
.balance .usd { font-family: var(--mono); font-weight: 700; font-size: 36px; line-height: 1.2; direction: ltr; text-align: start;
  unicode-bidi: plaintext; letter-spacing: -.02em; }
.balance .irt { color: var(--hint); font-size: 13.5px; }
.settings { display: grid; gap: 16px; align-items: start; }
.setnav { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.navrow { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: none; color: inherit; display: flex; transition: background .18s;
  align-items: center; gap: 12px; padding: 13px 14px; cursor: pointer; text-align: start; }
.navrow:last-child { border-bottom: 0; }
.navrow:hover { background: var(--hover); }
.navrow.on { background: var(--accent-soft); }
.navrow .lead { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card-hi);
  color: var(--accent); flex: none; }
.navrow .lead .ic { width: 17px; height: 17px; }
.navrow .body { flex: 1; min-width: 0; font-weight: 600; }
.navrow .s { display: block; color: var(--hint); font-size: 12.5px; font-weight: 400; }
.navrow .trail { color: var(--hint); }
.idcard { display: flex; align-items: center; gap: 14px; padding: 18px; }
.idcard .who { min-width: 0; flex: 1 1 120px; display: flex; flex-direction: column; align-items: flex-start; }
.idcard .who .name { font-weight: 700; font-size: 16.5px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idcard .who .uname { color: var(--hint); font-family: var(--mono); font-size: 13px; direction: ltr; unicode-bidi: isolate; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idcard .iconbtn { flex: none; }
@media (min-width: 760px) {
  .settings { grid-template-columns: 280px minmax(0, 1fr); }
  .settings .backrow { display: none; }
}
@media (max-width: 759px) {
  .settings.has-section .setnav, .settings.has-section .idwrap { display: none; }
  .settings:not(.has-section) .setbody { display: none; }
}

/* ------------------------------------------------------------ overlays */
.sheetwrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 0; background: rgba(5,10,18,.5);
  animation: fadein .18s ease-out both; }
.sheet { width: 100%; max-width: 560px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
  max-height: 92vh; overflow-y: auto; animation: sheetup .24s cubic-bezier(.2,.9,.3,1) both; }
.sheetwrap.leaving { animation: fadeout .15s ease-in both; }
.sheetwrap.leaving .sheet { animation: sheetdown .15s ease-in both; }
@media (min-width: 640px) {
  .sheetwrap { place-items: center; padding: 16px; }
  .sheet { width: min(420px, 100%); border-radius: var(--r-lg); padding: 18px; max-height: 100%; animation: pagein .16s ease-out both; }
  .sheetwrap.leaving .sheet { animation: pageout .15s ease-in both; }
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetdown { from { transform: none; } to { transform: translateY(100%); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { from { opacity: 1; } to { opacity: 0; } }
@keyframes pageout { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px); } }
.sheet h4 { margin: 0; font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.sheet p { margin: 0; color: var(--hint); font-size: 13.5px; line-height: 1.8; }
.sheet .row2 { display: flex; gap: 8px; flex-wrap: wrap; }
.sheet .row2 .btn { flex: 1 1 120px; }
.sheet .big { font-family: var(--mono); font-size: 17px; font-weight: 700; direction: ltr; text-align: center; padding: 12px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--border); word-break: break-all; }
.toast { position: fixed; z-index: 60; inset-block-end: calc(84px + env(safe-area-inset-bottom, 0px)); inset-inline: 0;
  margin-inline: auto; width: max-content; max-width: calc(100% - 32px); padding: 9px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
@media (min-width: 960px) { .toast { inset-block-end: 28px; } }

/* ------------------------------------------------------------ the wallet's history */
.hline { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.hline:last-child { border-bottom: 0; }
.hline .lead { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.hline .lead .ic { width: 17px; height: 17px; }
.hline .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hline .h { font-weight: 600; font-size: 14px; }
.hline .s { color: var(--hint); font-size: 12.5px; direction: ltr; unicode-bidi: plaintext; text-align: start; }
.hline .amt { text-align: end; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35; }
.hline .amt b { font-size: 14.5px; direction: ltr; }
.hline .amt.in b { color: var(--ok); }
.hline .amt small { color: var(--hint); font-size: 11.5px; direction: ltr; }
.row.sub .k { padding-inline-start: 14px; font-size: 13px; }
/* the ping card's nodes: a tighter row, the count and time quiet beside the verdict */
.pings .row { padding: 8px 0; min-height: 40px; }
.pings .row .k { color: var(--text); font-size: 13.5px; }
.pings .row .v .mono { color: var(--hint); font-weight: 500; font-size: 12.5px; direction: ltr; }
.pingline { margin: 10px 4px 0; }
.pingline .linklike { margin-inline-start: 6px; }
.row.sub .v { font-weight: 500; color: var(--hint); }

/* ------------------------------------------------------------ the web door's sign-in page */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.loginbox { width: min(440px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 26px 22px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; animation: pagein .2s ease-out both; }
.loginbrand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 2px; font-weight: 800; font-size: 18px; letter-spacing: .01em; }
.logo { height: 28px; width: auto; display: block; }
.logo.lg { height: 72px; }
.loginbox h1 { margin: 0 0 4px; font-size: 20px; text-align: center; }
.loginalt { margin: 2px 0 0; text-align: center; color: var(--hint); font-size: 13.5px; }
.loginalt a { color: var(--link); text-decoration: none; font-weight: 600; }
.loginform { display: flex; flex-direction: column; gap: 16px; }
.checkline { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.checkline input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; margin: 0; }
.loginwait { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 12px 0 4px; }
.loginwait h3 { margin: 0; font-size: 17px; }
.loginwait p { margin: 0; color: var(--hint); font-size: 13.5px; line-height: 1.8; max-width: 40ch; }
.loginwait .note { text-align: start; }
.spin.lg { width: 26px; height: 26px; border-width: 3px; }
.loginfoot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; }
.loginfoot a { text-decoration: none; }

/* ------------------------------------------------------------ states */
.center { min-height: 56vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 24px 18px; }
.center h3 { font-size: 19px; margin: 6px 0 0; text-wrap: balance; }
.center p { color: var(--hint); font-size: 14px; margin: 0; max-width: 340px; line-height: 1.8; }
.badge { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.badge .ic { width: 36px; height: 36px; }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.skel { background: linear-gradient(100deg, var(--card) 30%, var(--card-hi) 50%, var(--card) 70%); background-size: 220% 100%;
  animation: shim 1.3s linear infinite; border-radius: var(--r-md); }
@keyframes shim { to { background-position: -120% 0; } }
.skel.row { height: 66px; border-radius: 0; border-bottom: 1px solid var(--border); }
.skel.block { height: 150px; }
.skel.line { height: 34px; width: 40%; }
