:root {
  color-scheme: dark;
  --bg: #10121a;
  --surface: #191d2a;
  --surface-raised: #222738;
  --surface-inset: #141824;
  --line: #2c3245;
  --text: #f2f3fb;
  --muted: #a4adc3;
  --faint: #7f8aa6;
  --accent: #b5b5ff;
  --accent-ink: #181636;
  --wl-green: #62efa8;
  --wl-red: #ff7187;
  --warning: #f4cd7b;
  --page-width: 768px;
  --gutter: clamp(12px, 4vw, 28px);
  font: 15px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, body * { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar, body *::-webkit-scrollbar { display: none; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(ellipse 620px 280px at 50% 0, #20223a 0%, transparent 100%), var(--bg);
  -webkit-font-smoothing: antialiased;
}
main {
  width: min(100%, var(--page-width));
  min-height: 100dvh;
  margin-inline: auto;
  padding: clamp(15px, 4vw, 32px) var(--gutter) 24px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 5vw, 32px); line-height: 1.13; letter-spacing: -.04em; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:where(button, a, input, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.ui-icon { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 14px;
}
.summary-metric {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 67px;
  gap: 4px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: center;
}
.summary-metric .summary-label { color: var(--muted); font-size: clamp(10px, 2.8vw, 12px); line-height: 1.2; }
.summary-metric .summary-value { font-size: 21px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.summary-metric.white { position: relative; border-color: #41665a; background: #1b282b; }
.summary-metric.white:hover { background: #233733; }
.summary-metric.white .summary-value { color: var(--wl-green); }
.history-total .summary-value { color: var(--text); }
.history-bought .summary-value { color: var(--wl-green); }
.history-missed .summary-value { color: var(--wl-red); }

.account-groups { display: grid; gap: 20px; }
.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 1px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.group-title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #78849f; }
.searching .group-title { color: #b5efd1; }
.searching .group-title::before { background: var(--wl-green); box-shadow: 0 0 9px #62efa84a; }
.white .group-title { color: #e2e6f4; }
.white .group-title::before { background: #eef1ff; }
.grid, .records {
  display: grid;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.tile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0,1.45fr) minmax(0,.62fr) minmax(0,.95fr);
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 69px;
  padding: 10px clamp(8px, 3vw, 18px);
  border: 0;
  background: none;
  text-align: left;
}
.tile + .tile, .server-row + .server-row { border-top: 1px solid var(--line); }
.tile:first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.tile:last-child { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
@media (hover: hover) { .tile:hover { background: #ffffff08; } }
.tile:active { background: #ffffff0e; }
.tile-account { display: flex; align-items: center; gap: clamp(6px, 2vw, 12px); min-width: 0; }
.tile-field { display: grid; gap: 4px; min-width: 0; text-align: center; }
.tile-account .tile-field { flex: 1; text-align: left; }
.tile-identifier { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tile-title, .tile-value { font-size: clamp(13px, 3.6vw, 16px); line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tile-field > .detail { font-size: clamp(10px, 2.9vw, 12px); white-space: nowrap; }
.tile .account-avatar { width: clamp(27px, 8vw, 40px); height: auto; }
.account-marks { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.own-mark { display: inline-flex; width: fit-content; flex: none; padding: 2px 5px; border-radius: 5px; color: var(--accent); background: #a9abff22; font-size: 10px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.pill { color: var(--muted); font-size: 11px; font-weight: 560; line-height: 1.25; }
.pill.running { color: var(--wl-green); }
.pill.whitelist { color: #e4e7f5; }
.pill.error { color: var(--wl-red); }
.pill.conflict, .pill.unknown, .process-warning { color: var(--warning); }
.tile .process-warning { white-space: normal; }
.support-unread { display: inline-grid; place-items: center; min-width: 17px; height: 16px; padding-inline: 4px; border-radius: 99px; background: #f88098; color: #35101c; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.access-indicator { display: inline-grid; place-items: center; width: 1em; height: 1em; margin-inline-end: 4px; vertical-align: -.12em; line-height: 1; }
.access-indicator .ui-icon, .server-state .ui-icon { width: 1em; height: 1em; }
.access-check, .access-cross { font-size: 1em; font-weight: 780; }
.access-check, .balance-good { color: var(--wl-green); }
.access-cross, .server-count-outside { color: var(--wl-red); }
.server-count { display: flex; flex-wrap: wrap; justify-content: center; }
.server-count-segment { white-space: pre; }
.server-count-white, .lease-white .server-title { color: var(--wl-green); }
.server-count-ending, .server-count-separator, .lease-ending :is(.server-title, .price) { color: var(--muted); }
.server-count-pending, .balance-middle { color: var(--warning); }
.balance-low { color: var(--wl-red); }
.balance-prediction { display: inline-block; color: var(--muted); font-size: .78em; font-weight: 500; white-space: nowrap; }
.account-avatar { display: block; width: 48px; height: 48px; flex: none; }
.avatar-wrap { position: relative; display: inline-flex; flex: none; }
.avatar-own { position: absolute; top: -3px; left: -3px; display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.avatar-own .ui-icon { width: 10px; height: 10px; }
.avatar-check { position: absolute; bottom: -3px; right: -3px; display: grid; place-items: center; width: 17px; height: 17px; border: 2px solid var(--surface); border-radius: 50%; background: #f3f5ff; color: #252742; font: 800 10px/1 system-ui; }

.back, .edit {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}
.back { justify-content: flex-start; margin-bottom: 12px; padding-inline: 3px 10px; color: #c6c9e2; background: transparent; }
.back .ui-icon { width: 17px; height: 17px; }
.back:hover, .back:active { color: var(--text); }
.edit { background: var(--accent); color: var(--accent-ink); }
.edit:hover { background: #c5c4ff; }
.edit:active { background: #a6a5ef; }
.edit:disabled { opacity: .56; cursor: wait; }
.edit.secondary { background: var(--surface-raised); color: var(--text); border-color: var(--line); }
.edit.secondary:hover { background: #2d344a; }
.edit .ui-icon { height: 18px; width: 18px; }
.account-footer { height: calc(64px + env(safe-area-inset-bottom, 0px)); }
.account-toolbar {
  position: fixed;
  z-index: 2;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--page-width));
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, 46px);
  gap: 8px;
  padding: 12px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, #10121a 68%, #10121a00);
}
.add-account { width: 100%; }
.general-settings-button { padding: 0; }
.history-panel, .history-list { display:grid; gap:9px; }
.history-panel > .back { justify-self:start; }
.history-ticket { border:1px solid var(--line); border-radius:12px; background:var(--surface); padding:0 12px; }
.history-ticket.bought { background:#172a25; border-color:#305846; }
.history-ticket.missed { background:#2b1d25; border-color:#57333f; }
.history-head { display:grid; grid-template-columns:28px minmax(0,1fr) auto auto; align-items:center; gap:8px; min-height:60px; cursor:pointer; }
.history-head::-webkit-details-marker { display:none; }
.history-mark { display:grid; place-items:center; border-radius:7px; background:var(--surface-raised); width:26px; height:26px; }
.bought .history-mark, .bought .history-label { color:var(--wl-green); }
.missed .history-mark, .missed .history-label { color:var(--wl-red); }
.history-label { font-size:12px; max-width:9ch; text-align:right; }
.history-head small, .history-steps small { display:block; font-size:12px; color:var(--muted); margin-top:3px; }
.history-steps { list-style:none; margin:0; padding:6px 0 12px; }
.history-steps li { border-top:1px solid var(--line); display:grid; grid-template-columns:90px 1fr; gap:6px; padding:7px 0; font-size:13px; overflow-wrap:anywhere; }
.history-steps time { color:var(--muted); font-variant-numeric:tabular-nums; }
.history-pager { display:flex; justify-content:space-between; gap:8px; }
.settings-heading { font-size: 16px; margin: 0; }
.search-regions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: 0; padding: 0; margin: 0; border: 0; }
.search-regions legend { margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.search-region { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-inset); color: var(--text); font-size: 14px; cursor: pointer; }
.search-region:has(input:checked) { border-color: var(--accent); }
.search-region input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }

.account-overview {
  display: grid;
  gap: 15px;
  padding: clamp(12px, 4vw, 25px);
  border: 1px solid #363d55;
  border-radius: 17px;
  background: radial-gradient(ellipse at top right, #2d2d49, transparent 70%), var(--surface);
}
.profile { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; }
.profile .account-avatar { width: clamp(45px, 13vw, 62px); height: auto; }
.profile-identity { min-width: 0; }
.profile h1 { font-variant-numeric: tabular-nums; }
.profile-name { margin: 4px 0 5px; font-size: clamp(13px, 4vw, 15px); line-height: 1.28; color: #d0d6e9; overflow-wrap: anywhere; }
.profile .pill { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid #ffffff14; border-radius: 6px; background: #11142170; }
.account-controls { display: flex; align-self: start; justify-content: flex-end; gap: 5px; }
.profile-control {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(38px, 10.5vw, 44px);
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: 1px solid #ffffff1c;
  border-radius: 9px;
  color: #d4d6eb;
  background: #171a2a85;
}
.profile-control:disabled { opacity: .55; cursor: wait; }
.profile-control:not(:disabled):hover { background: var(--surface-raised); }
.start-search .ui-icon { color: var(--wl-green); }
.stop-search .ui-icon { color: var(--wl-red); }
.profile-control .ui-icon { width: 18px; height: 18px; }
.account-refresh-menu[open] {
  z-index: 5;
  display: grid;
  gap: 5px;
  padding: 7px;
  border: 1px solid #424a64;
  border-radius: 13px;
  background: #202535;
  box-shadow: 0 12px 28px #080910a8;
}
.account-refresh-menu[open] { position: fixed; inset: 0 auto auto 0; width: min(258px, calc(100vw - 16px)); max-width: none; margin: 0; color: var(--text); }
.account-refresh-menu h2 { margin: 5px 7px 3px; color: var(--muted); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; outline: none; }
.profile-menu-item {
  display: flex;
  width: 100%;
  min-height: 47px;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid #30374d;
  border-radius: 8px;
  background: #282e41;
  text-align: left;
  font-size: 13px;
  font-weight: 570;
}
.profile-menu-item:hover, .profile-menu-item:active { background: #343d55; }
.profile-menu-item:disabled { opacity: .55; cursor: wait; }
.action-icon { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 7px; color: #c2c1ff; background: #b5b5ff15; }
.action-icon .ui-icon { width: 17px; height: 17px; }
.settings-actions { display: grid; gap: 8px; }
.settings-actions .profile-menu-item { min-height: 52px; padding-inline: 11px; }
.account-context { touch-action: pan-y; user-select: none; -webkit-touch-callout: none; }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.record { min-width: 0; }
.record.metric {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  min-height: 72px;
  padding: 8px 5px;
  border: 1px solid #373e54;
  border-radius: 11px;
  background: #11152270;
  text-align: center;
}
.metric strong { font-size: clamp(15px, 4.5vw, 23px); line-height: 1.16; font-variant-numeric: tabular-nums; }
.metric .detail { font-size: clamp(10px, 3vw, 12px); }
.detail, .updated { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.updated { margin-top: 10px; color: var(--warning); }
.refresh-status:empty, .connection-form > [role="status"]:empty { display: none; }
.refresh-status:not(:empty) { margin: 8px 2px 0; }
.account-refresh-menu .refresh-status:not(:empty) { margin: 4px 7px; }
.servers-heading { margin: 25px 0 8px; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.servers-heading ~ .detail:not(:empty) { margin-bottom: 6px; }
.server-row { display: flex; align-items: center; gap: 10px; padding: 12px; }
.server-row > div:not(.server-icon, .server-actions) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.server-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: none; border-radius: 8px; background: #30364b; color: #b3bed9; }
.server-icon .ui-icon { width: 16px; height: 16px; }
.server-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; line-height: 1.25; }
.server-title strong { min-width: 0; font-size: 13px; }
.server-row .detail { margin-top: 3px; font-variant-numeric: tabular-nums; }
.server-state { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 5px; background: #ffffff0e; color: var(--muted); font: 750 12px/1 system-ui; }
.server-state.good { color: var(--wl-green); background: #62efa820; }
.server-state.waiting, .server-state.unknown { color: var(--warning); background: #f4cd7b18; }
.server-state.ending, .server-state.wl-outside { color: var(--wl-red); background: #ff718720; }
.server-state.wl-white { background: #19804f; color: #fff; }
.lease-outside .server-title { color: var(--wl-red); }
.price { white-space: nowrap; font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.server-meta .price { color: var(--text); }
.server-meta .price::before { content: " · "; color: var(--muted); font-weight: 400; }
.white-servers-heading { margin-bottom: 16px; }
.white-sort { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.white-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.white-sort-button:hover { background: var(--surface-raised); }
.white-sort-button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.white-sort-direction { font-size: 15px; line-height: 1; }
.server-row.with-configuration { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; }
.spec-info { grid-column: 1 / -1; display: grid; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-inset); }
.spec-cost {
  display: grid;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid #335047;
  border-radius: 10px;
  background: #1b282b;
}
.spec-cost strong { color: var(--wl-green); font-size: 22px; font-variant-numeric: tabular-nums; }
.spec-cost .detail { margin: 0; }
.spec-components { margin: 0; }
.spec-component { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.spec-component:first-child { padding-top: 2px; }
.spec-component:last-child { border-bottom: 0; }
.spec-component dt { color: var(--muted); }
.spec-component dd { margin: 0; overflow-wrap: anywhere; }
.server-actions { display: flex; flex: none; gap: 5px; }
.server-action {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--accent);
}
.server-action .ui-icon { width: 18px; height: 18px; }
.server-action.danger { color: var(--wl-red); }
.server-action:not(:disabled):hover { background: #343d55; }
.server-action:disabled { opacity: .52; cursor: default; }
.server-state.updating, .access-indicator .activity-spinner { color: var(--accent); }
.activity-spinner { animation: action-spin .85s linear infinite; }
@keyframes action-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .activity-spinner { animation: none; }
}
.app-sheet {
  position: fixed;
  inset: auto 0 0;
  width: min(100%, 520px);
  max-width: 100%;
  max-height: calc(100dvh - 12px);
  margin: 0 auto;
  padding: 12px 18px max(20px, env(safe-area-inset-bottom, 0px));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -16px 46px #0809108f;
  overscroll-behavior: contain;
}
.app-sheet::backdrop { background: #080910a8; backdrop-filter: blur(4px); }
.app-sheet[open] { animation: sheet-enter 220ms cubic-bezier(.22, 1, .36, 1) both; }
@keyframes sheet-enter { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .app-sheet[open] { animation: none; } }
body:has(.app-sheet[open]) { overflow: hidden; }
.sheet-grip { width: 32px; height: 4px; margin: 0 auto 13px; border-radius: 4px; background: var(--faint); }
.sheet-heading { font-size: 20px; }
.sheet-body { margin-top: 8px; }
.sheet-menu-actions { display: grid; gap: 6px; }
.sheet-body .detail { margin-bottom: 8px; }
.sheet-body p:not(.detail) { font-size: 14px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; margin-top: 15px; }
.edit.destructive { background: #ff899a; color: #35101c; }
.edit.destructive:hover { background: #ffadba; }
.operation-toast {
  position: fixed;
  z-index: 10;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(calc(100% - 24px), 460px);
  padding: 10px 14px;
  border: 1px solid #3c584e;
  border-radius: 10px;
  background: #22332e;
  color: #e0f8ed;
  box-shadow: 0 6px 18px #08091075;
  font-size: 13px;
  pointer-events: none;
}
.operation-toast.is-error { border-color: #784759; background: #402834; color: #ffe0e6; }
.empty { padding: 16px; color: var(--muted); font-size: 13px; }
#content > .empty, .account-groups > .empty { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }

.record.connection-form {
  display: grid;
  gap: 14px;
  width: min(100%, 520px);
  padding: clamp(15px, 5vw, 29px);
  border: 1px solid #373e54;
  border-radius: 16px;
  background: linear-gradient(160deg, #23283b, var(--surface) 70%);
}
#content:has(> .connection-form) { width: min(100%, 520px); margin-inline: auto; }
.connection-form h1 + .detail { margin-top: -7px; }
.connection-form > p:not([class]) { color: #d3d8e9; font-size: 14px; }
.connection-form > p[role="status"] { color: #c4caff; }
.input-label { display: grid; gap: 6px; min-width: 0; color: #d8def0; font-size: 13px; font-weight: 600; }
.input-label input, .input-label select {
  width: 100%;
  min-height: 46px;
  padding: 8px 11px;
  border: 1px solid #434b66;
  border-radius: 9px;
  background: var(--surface-inset);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}
.input-label input::placeholder { color: var(--faint); }
.input-label input[type="number"] { appearance: textfield; }
.input-label input[type="number"]::-webkit-inner-spin-button,
.input-label input[type="number"]::-webkit-outer-spin-button { appearance: none; margin: 0; }
.polling-group {
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.polling-group legend { padding-inline: 4px; color: #d8def0; font-size: 13px; font-weight: 650; }
.polling-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.polling-choice { position: relative; min-width: 0; }
.polling-choice.wide { grid-column: span 2; }
.polling-choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.polling-choice span {
  display: grid;
  place-items: center;
  min-height: 39px;
  padding: 4px 3px;
  border: 1px solid #3d4560;
  border-radius: 8px;
  background: var(--surface-inset);
  color: #d8def0;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}
.polling-choice input:hover + span { background: var(--surface-raised); }
.polling-choice input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.polling-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.polling-custom { margin-top: 9px; }
.payment-result { justify-items: stretch; text-align: center; }
.payment-amount { font-size: clamp(28px, 8vw, 40px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.payment-qr { display: block; width: min(100%, 244px); height: auto; padding: 6px; margin: 2px auto 4px; border-radius: 12px; background: #fff; image-rendering: pixelated; }
.payment-result :is(.back, .input-label) { margin: 0; }
.payment-result .back { justify-self: center; }
.payment-result .input-label { text-align: left; }
@media (max-width: 375px) {
  .profile:has(.account-controls > :nth-child(2)) { grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; }
  .profile:has(.account-controls > :nth-child(2)) .account-controls { grid-column: 1 / -1; }
}
@media (min-width: 600px) {
  .spec-info:not(p) { grid-template-columns: minmax(0, 1fr) minmax(168px, .48fr); align-items: start; }
  .tile { min-height: 74px; }
  .tile-field { gap: 5px; }
  .server-row { padding-inline: 16px; }
  .add-account { width: auto; min-width: 192px; }
  .record.connection-form { margin-inline: auto; }
}


.history-title { min-width:0; overflow-wrap:anywhere; }
.history-delay { text-align:right; font-size:12px; font-variant-numeric:tabular-nums; }
.history-delay > span { white-space:nowrap; }
@media (max-width:360px) { .history-head { grid-template-columns:24px minmax(0,1fr) auto auto; gap:5px; } }

.history-day-filters { display:flex; gap:8px; }
.history-day { flex:1; padding:10px 14px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--muted); font:inherit; cursor:pointer; }
.history-day[aria-pressed="true"] { background:var(--surface-raised); border-color:var(--wl-green); color:var(--text); font-weight:600; }

.history-panel { align-content:start; min-height:calc(100dvh - 32px); }
.history-list { align-content:start; }
.history-day { transition:background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
.history-panel .summary-value { font-variant-numeric:tabular-nums; }
@media (prefers-reduced-motion:reduce) { .history-day { transition:none; } }

.history-timeline { overflow-x:auto; margin:2px -2px 0; padding:8px 0 14px; border-top:1px solid #ffffff0c; }
.history-lanes { width:100%; border-collapse:separate; border-spacing:0; table-layout:fixed; font-size:12px; line-height:1.4; }
.history-lanes th, .history-lanes td { padding:4px; text-align:left; vertical-align:top; border:0; overflow-wrap:anywhere; }
.history-lanes th { padding-bottom:10px; color:var(--muted); font-weight:500; }
.history-worker-heading { display:grid; gap:3px; padding:9px 10px; border:1px solid #b5b5ff24; border-radius:10px; background:var(--surface-raised); }
.history-worker-heading > span { font-size:10px; color:var(--muted); }
.history-worker-heading strong { font-size:12px; color:var(--accent); font-weight:600; font-variant-numeric:tabular-nums; }
.history-lanes .history-time { width:81px; padding:12px 6px 4px 0; white-space:nowrap; color:var(--faint); font-size:11px; font-variant-numeric:tabular-nums; }
.history-lanes th.history-time { padding-top:10px; }
.history-lane-cell { background:linear-gradient(#ffffff08,#ffffff08) center / 1px 100% no-repeat; }
.history-lane-event { padding:9px 10px; border:1px solid #ffffff0a; border-radius:9px; background:var(--surface); box-shadow:0 2px 5px #0000000a; }
.history-event-title { display:block; color:var(--text); font-weight:500; }
.history-lane-event.sending { border-color:#b5b5ff30; }
.history-lane-event.sending .history-event-title { color:var(--accent); }
.history-lane-event.success { border-color:#62efa829; }
.history-lane-event.success .history-event-title { color:var(--wl-green); }
.history-lane-event.failure { border-color:#ff71872e; }
.history-lane-event.failure .history-event-title { color:var(--wl-red); }
.history-lanes small { display:block; margin-top:5px; color:var(--muted); font-size:11px; font-weight:400; }
.history-lane-event + .history-lane-event { margin-top:6px; }
.history-shared .history-lane-event { background:#ffffff04; border-color:transparent; box-shadow:none; padding-block:7px; }
.history-shared .history-event-title { color:var(--muted); font-weight:400; }
.history-lanes-many { min-width:550px; }
@media (max-width:380px) {
  .history-lanes .history-time { width:74px; font-size:10px; }
  .history-lane-event, .history-worker-heading { padding:8px; }
  .history-lanes th, .history-lanes td { padding-inline:3px; }
}

.history-filtered { --history-time-width:83px; overflow:visible; }
.history-section-label { margin:0 0 6px; color:var(--muted); font-size:12px; font-weight:500; }
.history-filtered-list { list-style:none; margin:0; padding:0; }
.history-filtered-row { display:grid; grid-template-columns:var(--history-time-width) minmax(0,1fr); gap:6px; align-items:start; }
.history-filtered-row + .history-filtered-row { border-top:1px solid #ffffff0c; }
.history-filtered-row time { padding-top:11px; color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.history-filtered .history-lane-event { min-width:0; padding:10px 0; border:0; border-radius:0; background:none; box-shadow:none; }
.history-filtered .history-event-title { font-size:13px; font-weight:400; overflow-wrap:anywhere; }
.history-filtered-row small { display:block; margin-top:4px; color:var(--muted); font-size:11px; overflow-wrap:anywhere; }
.history-common .history-event-title { color:var(--text); }
.history-actor-section { margin-top:12px; padding-top:14px; border-top:1px solid #ffffff14; }
.history-actor-label { display:grid; grid-template-columns:var(--history-time-width) minmax(0,1fr); align-items:center; gap:6px; margin-bottom:8px; }
.history-actor-label > span { font-size:12px; font-weight:500; color:var(--muted); }
.history-actor-label .history-actor-select { width:100%; max-width:none; min-width:0; min-height:46px; padding:8px 11px; border:1px solid #434b66; border-radius:9px; background:var(--surface-inset); font-size:14px; font-weight:500; cursor:pointer; }
@media (max-width:380px) { .history-filtered { --history-time-width:74px; } .history-filtered-row time { font-size:10px; } .history-actor-label > span { font-size:11px; } }

.record.connection-form.payment-result { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 14px 0; }

.payment-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.payment-preset { min-height: 42px; padding: 8px 3px; border: 1px solid #434b66; border-radius: 9px; background: var(--surface-inset); color: var(--text); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
.payment-preset[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.payment-preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.payment-preset:disabled { opacity: .55; cursor: default; }

.payment-preset { border: 0; border-radius: 0; background: transparent; padding: 8px 0; color: var(--muted); }
.payment-preset[aria-pressed="true"] { background: transparent; color: var(--accent); font-weight: 700; }
.payment-preset:hover:not(:disabled) { color: var(--accent); }
.record.connection-form.payment-result { gap: 16px; align-content: start; padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.payment-result .payment-title { font-size: clamp(16px, 4.3vw, 21px); line-height: 1.3; letter-spacing: -.02em; }
.payment-summary { display: flex; align-items: center; justify-content: center; gap: 16px; }
.payment-summary .payment-amount { font-size: 28px; }
.payment-countdown { font-variant-numeric: tabular-nums; }
.payment-bottom-actions { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(calc(100% - 2 * var(--gutter)), 520px); display: grid; gap: 10px; padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 10; }
.payment-bottom-actions > :is(button, a) { width: 100%; }

.purchase-statistics { display: grid; gap: 12px; max-width: 560px; margin-inline: auto; }
.statistics-title { font-size: 22px; }
.statistics-days { display: grid; gap: 14px; }
.statistics-date { margin: 0 0 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.statistics-compact { width: 100%; table-layout: fixed; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; }
.statistics-compact th { height: 32px; padding: 5px 8px; font-size: 13px; font-weight: 500; background: #28283e; }
.statistics-compact td { height: 30px; padding: 5px 2px; border-top: 1px solid var(--line); text-align: center; white-space: nowrap; }
.statistics-compact td + td { border-left: 1px solid var(--line); }
.statistics-compact td span { color: var(--muted); }
.statistics-compact td strong { font-size: 20px; line-height: 1; font-weight: 700; vertical-align: middle; font-variant-numeric: tabular-nums; }
.statistics-compact .statistics-white strong { color: var(--wl-green); }
.statistics-compact .statistics-unknown strong { color: var(--warning); }
@media(max-width:350px) { .statistics-compact { font-size: 11px; } }

.history-ticket.processing { background: #2b281b; border-color: #675930; }
.processing .history-mark, .processing .history-label, .history-processing .summary-value { color: var(--warning); }
.history-panel > .account-summary { grid-template-columns: repeat(4,minmax(0,1fr)); }
@media(max-width:380px) { .history-panel > .account-summary { grid-template-columns: repeat(2,minmax(0,1fr)); } }

.statistics-period { margin: 0 0 -6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.statistics-totals { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 7px; margin-bottom: 4px; }
.statistics-total { grid-column: span 2; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 9px 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: center; min-width: 0; }
.statistics-total-total, .statistics-total-amountKopecks { grid-column: span 3; }
.statistics-total span { font-size: 11px; color: var(--muted); }
.statistics-total strong { font-size: 28px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.statistics-total-white strong { color: var(--wl-green); }
.statistics-total-unknown strong { color: var(--warning); }

.statistics-total-amountKopecks strong { font-size: clamp(20px, 5.4vw, 28px); }
.statistics-compact td span { font-size: 10px; vertical-align: middle; }

.group-balance { margin-left: auto; color: var(--text); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: normal; text-transform: none; }

.subnet-panel { display:grid; gap:12px; }
.subnet-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.subnet-heading h1 { font-size:23px; }
.subnet-heading button { width:42px; min-height:40px; }
.subnet-table { width:100%; table-layout:fixed; border-spacing:0; border:1px solid var(--line); border-radius:10px; overflow:hidden; background:var(--surface); font-size:12px; }
.subnet-table th { padding:9px 2px; font-size:10px; font-weight:500; background:#28283e; }
.subnet-table th:first-child { width:112px; }
.subnet-table td { padding:12px 2px; text-align:center; border-top:1px solid var(--line); font-variant-numeric:tabular-nums; }
.subnet-table td + td, .subnet-table th + th { border-left:1px solid var(--line); }
.subnet-table .subnet-name { font-size:11px; text-align:left; padding-left:7px; white-space:nowrap; }
.subnet-alive { color:var(--wl-green); }
.subnet-gone { color:var(--wl-green); }
.subnet-toggle { display:flex; align-items:center; gap:9px; font-size:14px; }
.subnet-toggle input { width:18px; height:18px; accent-color:var(--accent); }

.account-toolbar { align-items: center; }
.account-toolbar > .general-settings-button { width: 46px; height: 46px; min-width: 46px; min-height: 46px; max-height: 46px; padding: 0; aspect-ratio: 1; align-self: center; }

.account-toolbar > .add-account { min-width: 0; height: 46px; padding: 4px 6px; line-height: 18px; }

.subnet-owned { color: var(--wl-green); font-weight: 700; }
.subnet-table th:nth-child(n+2) { width: auto; }

.subnet-passive { display:grid; gap:9px; margin-top:10px; }
.subnet-passive h2 { font-size:16px; margin:0; }
.subnet-passive .detail { margin:0; }

.subnet-heading .subnet-scan-button { width:auto; min-height:36px; padding:6px 12px; font-size:12px; }

.statistics-day-change { font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--muted); }

.statistics-compact { border-radius: 11px; }
.statistics-compact th { padding: 11px 10px; font-size: 14px; line-height: 1.5; }
.statistics-compact .statistics-date { margin: 0 0 5px; font-size: 12px; line-height: 1.3; color: var(--muted); }
.statistics-compact td { height: 42px; padding: 8px 4px; }
.statistics-compact td strong { font-size: 22px; }
.statistics-day-change.is-positive { color: #92b5a6; }
.statistics-day-change.is-negative { color: #bea68e; }

.statistics-day-header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.statistics-day-summary { min-width:0; text-align:left; }
.statistics-day-header .statistics-date { flex-shrink:0; margin:0; text-align:right; font-size:11px; font-weight:400; }

.subnet-actions { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.subnet-actions > .general-settings-button { width:36px; height:36px; min-height:36px; padding:0; }
