@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(inter-latin-ext-400.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(inter-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(inter-latin-ext-600.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url(inter-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #eef2f8; --bg-glow: #dbe7fb; --card: #fff; --text: #0f1b2d; --muted: #5a6778; --border: #d3dbe6;
  --accent: #2563eb; --accent-hover: #1d4fd0; --accent-soft: #e4edfd;
  --series-down: #2a78d6; --series-up: #eb6834; --grid: #e3e8ef;
  --ok: #15803d; --ok-soft: #dff5e7; --bad: #c0261c; --bad-soft: #fde6e4; --idle: #64748b; --idle-soft: #e9edf3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111a; --bg-glow: #14233b; --card: #151e2b; --text: #e8edf4; --muted: #9dabbc; --border: #2d3a4c;
    --accent: #3b82f6; --accent-hover: #2f70e0; --accent-soft: #1a2c4a;
    --series-down: #3987e5; --series-up: #d95926; --grid: #2d3a4c;
    --ok: #5fd08f; --ok-soft: #143325; --bad: #f4a29b; --bad-soft: #3a1c1b; --idle: #a4b1c1; --idle-soft: #243042;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  color: var(--text); background: var(--bg) radial-gradient(circle at 50% 0, var(--bg-glow), transparent 65%) no-repeat;
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%;
}
.card { width: 100%; max-width: 380px; padding: 28px 24px 26px; background: var(--card); border-radius: 18px; box-shadow: 0 10px 30px rgba(15, 27, 45, .10); }
.brand { display: flex; justify-content: center; margin-bottom: 18px; }
.brand img { display: block; max-width: 100%; height: auto; }
h1 { margin: 0 0 16px; font-size: 19px; font-weight: 600; text-align: center; }
p { margin: 0; }
.intro { margin-bottom: 18px; color: var(--muted); font-size: 15px; text-align: center; }
.muted { margin-top: 2px; color: var(--muted); font-size: 15px; }
.hint { margin-top: 14px; color: var(--muted); font-size: 13px; }
.error { margin-top: 10px; color: var(--bad); font-size: 15px; }

label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
input[type=text] { width: 100%; padding: 12px 14px; font: inherit; color: inherit; background: transparent; border: 1px solid var(--border); border-radius: 10px; outline: 0; }
input[type=text]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button, .button { display: block; width: 100%; margin-top: 16px; padding: 13px; font: inherit; font-weight: 600; text-align: center; text-decoration: none; color: #fff; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; }
button:hover, .button:hover { background: var(--accent-hover); }
button:disabled { opacity: .6; }

.steps { display: none; counter-reset: step; margin: 4px 0 24px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
[data-state=waiting] .steps, [data-state=approved] .steps, [data-state=denied] .steps, [data-state=expired] .steps { display: flex; }
.steps li { position: relative; flex: 1; text-align: center; counter-increment: step; }
.steps li::before { content: counter(step); position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: 0 auto 6px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--idle-soft); border-radius: 50%; }
.steps li + li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--border); }
[data-state=waiting] .step-sent::before,
[data-state=approved] .step-sent::before, [data-state=denied] .step-sent::before, [data-state=expired] .step-sent::before,
[data-state=approved] .step-wait::before, [data-state=denied] .step-wait::before, [data-state=expired] .step-wait::before { content: "✓"; color: #fff; background: var(--ok); }
[data-state=waiting] .step-wait::before, [data-state=approved] .step-result::before, [data-state=denied] .step-result::before, [data-state=expired] .step-result::before { color: #fff; background: var(--accent); }
[data-state=waiting] .step-wait::after, [data-state=approved] .step-wait::after, [data-state=denied] .step-wait::after, [data-state=expired] .step-wait::after,
[data-state=approved] .step-result::after, [data-state=denied] .step-result::after, [data-state=expired] .step-result::after { background: var(--ok); }
[data-state=waiting] .step-wait, [data-state=approved] .step-result, [data-state=denied] .step-result, [data-state=expired] .step-result { font-weight: 600; color: var(--text); }

.panel { display: none; }
[data-state=form] .panel-form, [data-state=waiting] .panel-waiting, [data-state=approved] .panel-approved, [data-state=denied] .panel-denied, [data-state=expired] .panel-expired { display: block; }
.panel-waiting, .panel-approved, .panel-denied, .panel-expired { text-align: center; }
.result-title { margin-top: 12px; font-size: 18px; font-weight: 600; }

.badge { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; color: var(--idle); background: var(--idle-soft); border-radius: 50%; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.icon { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.dots { display: inline-flex; gap: 6px; padding-top: 4px; }
.dots span { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; animation: pulse 1.4s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }


.usage { margin-top: 20px; padding-top: 18px; text-align: left; border-top: 1px solid var(--border); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.tile { padding: 10px 12px; background: var(--idle-soft); border-radius: 10px; }
.tile dt { color: var(--muted); font-size: 13px; }
.tile dd { margin: 0; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.facts { margin: 0 0 16px; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.chart-title { margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 16px; height: 2px; border-radius: 1px; }
.key-down { background: var(--series-down); }
.key-up { background: var(--series-up); }
.chart { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .series { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .down { stroke: var(--series-down); }
.chart .up { stroke: var(--series-up); }
.chart .end { stroke: var(--card); stroke-width: 2; }
.chart .end.down { fill: var(--series-down); }
.chart .end.up { fill: var(--series-up); }
.chart .hit { fill: transparent; }
.chart-reading { min-height: 20px; margin-top: 4px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.meter { display: block; width: 100%; height: 8px; margin-top: 4px; }
.meter .track { fill: var(--idle-soft); }
.meter .fill { fill: var(--accent); }
.button-danger, .button-danger:hover { color: var(--bad); background: transparent; border: 1px solid var(--bad); }
.usage-link { display: inline-block; margin-top: 10px; color: var(--accent); font-size: 14px; }

[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; } }
