:root {
    color-scheme: dark;
    --background: #0B1018;
    --surface: #1C2432;
    --accent: #168BFF;
    --text: #fff;
    --muted: #a8b6ca;
    --line: #354358;
    --top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
    --bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
    --left: max(16px, env(safe-area-inset-left, 0px), var(--tg-content-safe-area-inset-left, 0px));
    --right: max(16px, env(safe-area-inset-right, 0px), var(--tg-content-safe-area-inset-right, 0px));
    font: 16px/1.48 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: var(--tg-viewport-stable-height, 100dvh);
    color: var(--text);
    background: radial-gradient(ellipse 24rem 17rem at 50% 0, #102137, transparent), var(--background);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #84c7ff; outline-offset: 3px; }
h1 { margin: 4px 0 18px; font-size: clamp(1.5rem, 5.8vw, 2rem); line-height: 1.15; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 1.08rem; }
p { margin: 0; }
small { display: block; color: var(--muted); font-size: .85rem; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.app { max-width: 620px; margin: 0 auto; padding: calc(16px + var(--top)) var(--right) calc(99px + var(--bottom)) var(--left); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-size: 1.14rem; font-weight: 750; }
.brand-icon, .tile { display: grid; place-items: center; flex: none; color: #8cc8ff; background: #163a62; border-radius: 12px; width: 42px; height: 42px; }
.brand-icon { border: 1px solid #2467a5; }
.brand-icon svg { width: 25px; height: 25px; }
.accent { color: #8cc8ff; }
.muted, .status, .list-state { color: var(--muted); }
.surface, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.status, .form, .settings, .identity { padding: 15px; }
.screen, .list { display: grid; gap: 10px; }
.card-button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; text-align: left; gap: 12px; width: 100%; padding: 12px; }
.card-button span { overflow-wrap: anywhere; }
.card-button:hover, .secondary:hover, .text-button:hover { border-color: var(--accent); }
.arrow { color: var(--muted); width: 16px; height: 16px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-input { position: relative; min-width: 0; }
.search-input svg { position: absolute; inset-inline-start: 11px; top: 12px; color: var(--muted); width: 17px; }
.search-input input { width: 100%; padding-inline-start: 34px; }
input, select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px; min-height: 44px; min-width: 0; }
.primary, .secondary, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; }
.primary { background: var(--accent); color: #0b1420; font-weight: 700; border-color: var(--accent); }
.secondary { background: var(--surface); }
.text-button { width: fit-content; background: none; border-color: transparent; color: #8cc8ff; }
.form { display: grid; gap: 12px; }
.form label:not(.checkbox) { display: grid; gap: 5px; }
.checkbox { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.checkbox input { width: 20px; min-height: initial; height: 20px; accent-color: var(--accent); }
.history-row { display: grid; gap: 3px; padding: 12px; overflow-wrap: anywhere; }
#live-chat-messages small { white-space: pre-wrap; }
.item-button { width: 100%; text-align: start; min-height: 44px; }
a { color: #8cc8ff; }
.list-state:empty, [role="status"]:empty { display: none; }
.details { margin: 0; padding: 0 12px; }
.details div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; padding: 11px 0; }
.details div + div { border-top: 1px solid var(--line); }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: end; overflow-wrap: anywhere; }
.identity, .settings { display: flex; align-items: center; gap: 12px; overflow-wrap: anywhere; }
.settings { justify-content: space-between; flex-wrap: wrap; }
.tab-bar { position: fixed; inset: auto 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 auto; max-width: 620px; border-top: 1px solid var(--line); background: #111a28; padding: 4px var(--right) calc(4px + var(--bottom)) var(--left); }
.tab-bar button { display: flex; flex-direction: column; justify-content: center; align-items: center; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; padding: 6px 2px; min-height: 53px; gap: 3px; font-size: .76rem; }
.tab-bar button[aria-current="page"] { color: #8cc8ff; border-color: var(--accent); font-weight: 700; }
