:root {
  --bg: #0a0c11;
  --bg-2: #10131a;
  --card: rgba(255, 255, 255, 0.035);
  --card-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eceef3;
  --muted: #8a92a6;
  --faint: #5b6275;
  --amber: #ffb547;
  --amber-2: #ff7a2f;
  --night: #8b93ff;
  --night-2: #5b62e8;
  --red: #ff5d5d;
  --green: #3ddc97;
  --radius: 22px;
  --ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
body[data-res='elec'] { --acc: #ffb547; --acc-2: #ff7a2f; --acc-rgb: 255, 181, 71; --acc2-rgb: 255, 122, 47; }
body[data-res='gas'] { --acc: #9aa2ff; --acc-2: #5b62e8; --acc-rgb: 154, 162, 255; --acc2-rgb: 91, 98, 232; }
body[data-res='water'] { --acc: #45e0e6; --acc-2: #1f8fe0; --acc-rgb: 69, 224, 230; --acc2-rgb: 31, 143, 224; }
.r-elec { --c: #ffb547; --c2: #ff7a2f; --c-rgb: 255, 181, 71; }
.r-gas { --c: #9aa2ff; --c2: #5b62e8; --c-rgb: 154, 162, 255; }
.r-water { --c: #45e0e6; --c2: #1f8fe0; --c-rgb: 69, 224, 230; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- фон: сетка + тёплое свечение ---------- */
.bg, .brand-mark, .fab, .primary-btn, .kpi.accent, .pulse { transition: background .4s, color .4s, border-color .4s, box-shadow .4s; }
.bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 30rem at 15% -10%, rgba(var(--acc-rgb), 0.14), transparent 60%),
    radial-gradient(50rem 30rem at 110% 10%, rgba(110, 120, 255, 0.12), transparent 60%),
    var(--bg);
}
.bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 70%);
}

/* ---------- шапка ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1180px; margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  box-shadow: 0 6px 24px rgba(var(--acc-rgb), 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #14100a; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark svg .fill { fill: #14100a; stroke-width: 1; }
.brand-mark.big { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 8px; }
.brand-mark.big svg { width: 34px; height: 34px; }
.brand-name { font-weight: 800; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .3s; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.busy { background: var(--acc); animation: blink 1s infinite; }
.dot.err { background: var(--red); }
@keyframes blink { 50% { opacity: .3; } }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  transition: background .2s, border-color .2s, transform .1s;
}
.icon-btn:hover { background: var(--card-strong); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- сетка ---------- */
.layout {
  max-width: 1180px; margin: 0 auto;
  padding: 8px 16px calc(110px + var(--safe-b));
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'overview' 'hero' 'kpis' 'month' 'rate' 'history';
}
.overview { grid-area: overview; }
.hero { grid-area: hero; }
.kpis { grid-area: kpis; }
.month-card { grid-area: month; }
.rate-card { grid-area: rate; }
.history-card { grid-area: history; }
@media (min-width: 960px) {
  .layout {
    gap: 18px; padding-top: 16px;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-areas: 'overview overview' 'hero kpis' 'month month' 'rate history';
  }
  .history-card { max-height: 520px; display: flex; flex-direction: column; }
  .history-card .history { overflow-y: auto; margin-right: -8px; padding-right: 8px; }
}

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- герой: механический счётчик ---------- */
.hero { overflow: hidden; padding: 20px 18px 18px; }
.hero::before {
  content: ''; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1;
  background: radial-gradient(circle, rgba(var(--acc-rgb), 0.16), transparent 65%);
  pointer-events: none;
}
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.pulse {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  background: rgba(var(--acc-rgb), 0.1); border: 1px solid rgba(var(--acc-rgb), 0.25);
  color: var(--acc); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pulse i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--acc);
  box-shadow: 0 0 0 0 rgba(var(--acc-rgb), .6);
  animation: pulse var(--pulse-speed, 2s) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb), .65); }
  70% { box-shadow: 0 0 0 10px rgba(var(--acc-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb), 0); }
}
.odometers { display: grid; gap: 14px; }
.odo-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px; }
.odo-label {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.odo-label .zone-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--acc); }
.odo {
  --cell-h: clamp(46px, 13vw, 64px);
  display: inline-flex; gap: 4px; padding: 6px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1b1f28, #0c0e13);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6), 0 10px 30px rgba(0, 0, 0, .35);
  width: max-content; max-width: 100%;
}
.odo-cell {
  position: relative; overflow: hidden;
  height: var(--cell-h); width: calc(var(--cell-h) * .66);
  border-radius: 7px;
  background: linear-gradient(180deg, #050608, #17191f 50%, #050608);
  font: 700 calc(var(--cell-h) * .62) / var(--cell-h) var(--mono);
  color: #f6f3ea; text-align: center;
}
.odo-cell::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .75), transparent 32%, transparent 68%, rgba(0, 0, 0, .75));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.odo-cell.frac { background: linear-gradient(180deg, #2a0707, #4a1010 50%, #2a0707); color: #ffd9d9; }
.odo-strip {
  display: flex; flex-direction: column;
  transform: translateY(calc(var(--d, 0) * var(--cell-h) * -1));
  transition: transform 1.4s cubic-bezier(.2, .9, .25, 1);
}
.odo-strip span { height: var(--cell-h); }
.odo-unit { font: 600 13px var(--ui); color: var(--muted); align-self: end; padding-bottom: 6px; }
.hero-foot { margin-top: 16px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.hero-foot b { color: var(--text); font-weight: 700; }

@media (max-width: 420px) {
  .odo { --cell-h: clamp(38px, 12.4vw, 52px); gap: 3px; padding: 5px; }
  .odo-row { grid-template-columns: 1fr; }
  .odo-unit { display: none; }
}

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 14px 14px 12px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-label svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-value { font: 700 clamp(22px, 6vw, 28px) / 1.15 var(--mono); letter-spacing: -0.02em; white-space: nowrap; }
.kpi-value small { font: 600 12px var(--ui); color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub .up { color: var(--red); font-weight: 700; }
.kpi-sub .down { color: var(--green); font-weight: 700; }
.kpi.accent { background: linear-gradient(150deg, rgba(var(--acc-rgb), .16), rgba(var(--acc2-rgb), .05)); border-color: rgba(var(--acc-rgb), .25); }
.kpi.accent .kpi-label { color: var(--acc); }
.goal { margin-top: 8px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); position: relative; overflow: visible; }
.goal > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--acc), var(--acc-2)); transition: width 1s ease; }
.goal > i { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--text); border-radius: 2px; opacity: .7; }
.goal.over > span { background: linear-gradient(90deg, var(--acc-2), var(--red)); }
@media (min-width: 960px) {
  .kpis { align-content: stretch; }
  .kpi { justify-content: center; padding: 16px; }
}

/* ---------- графики ---------- */
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.chart { width: 100%; min-height: 200px; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font: 600 11px var(--ui); fill: var(--muted); }
.chart .val { font: 700 11px var(--mono); fill: var(--text); }
.bar-hit { cursor: pointer; }
.bar-group .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .9s cubic-bezier(.2, .9, .25, 1) both; animation-delay: calc(var(--i) * 45ms); }
.bar-group.dim .bar { opacity: .35; }
.bar-group.sel .bar { filter: drop-shadow(0 0 10px rgba(var(--acc-rgb), .45)); }
@keyframes grow { from { transform: scaleY(0); } }
.chart-detail {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); min-height: 42px;
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center;
}
.chart-detail b { color: var(--text); }
.rate-line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.6s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.rate-area { opacity: 0; animation: fade .8s .6s ease forwards; }
@keyframes fade { to { opacity: 1; } }
@media (max-width: 520px) { #rateHint { display: none; } }
.empty-chart { display: grid; place-items: center; min-height: 180px; color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }

/* ---------- история ---------- */
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.h-item {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px 10px 10px; border-radius: 14px;
  background: rgba(255, 255, 255, .025); border: 1px solid transparent;
  cursor: pointer; transition: background .2s, border-color .2s;
  animation: rise .5s ease both; animation-delay: calc(var(--i) * 30ms);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.h-item:hover, .h-item:focus-visible { background: rgba(255, 255, 255, .055); border-color: var(--line); outline: none; }
.h-date { text-align: center; line-height: 1.05; }
.h-date b { display: block; font: 700 20px var(--mono); }
.h-date span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.h-vals { font: 600 13.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-vals .z { color: var(--faint); font-family: var(--ui); font-weight: 700; font-size: 11px; margin-right: 3px; }
.h-note { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-delta { text-align: right; line-height: 1.2; }
.h-delta b { display: block; font: 700 15px var(--mono); color: var(--acc); }
.h-delta b.neg { color: var(--red); }
.h-delta span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.h-first { font-size: 11.5px; color: var(--faint); }
.ghost-btn {
  margin-top: 10px; width: 100%; padding: 11px; border-radius: 12px;
  background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); font-weight: 600;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }
.warn {
  margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(255, 93, 93, .08); border: 1px solid rgba(255, 93, 93, .25); color: #ffc2c2;
}
.warn ul { margin: 4px 0 0; padding-left: 18px; }
.empty-hist { text-align: center; color: var(--muted); padding: 24px 8px; font-size: 14px; }

/* ---------- плавающая кнопка ---------- */
.fab {
  position: fixed; z-index: 20; left: 50%; bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 15px 24px 15px 20px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: #1a1004; font-weight: 800; font-size: 15px; white-space: nowrap;
  box-shadow: 0 12px 36px rgba(var(--acc2-rgb), .45), inset 0 1px 0 rgba(255, 255, 255, .45);
  transition: transform .15s, box-shadow .2s;
}
.fab:hover { box-shadow: 0 14px 44px rgba(var(--acc2-rgb), .6), inset 0 1px 0 rgba(255, 255, 255, .45); }
.fab:active { transform: translateX(-50%) scale(.96); }
.fab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
@media (min-width: 960px) { .fab { left: auto; right: 32px; transform: none; } .fab:active { transform: scale(.96); } }

/* ---------- нижний лист / модалка ---------- */
.sheet {
  padding: 0; border: 0; color: var(--text);
  background: #13161e;
  width: 100%; max-width: 100%; max-height: 92dvh;
  margin: auto 0 0; border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
}
.sheet[open] { animation: sheet-in .35s cubic-bezier(.2, .9, .25, 1); }
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet::backdrop { background: rgba(4, 5, 8, .65); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@media (min-width: 640px) {
  .sheet { margin: auto; width: min(520px, calc(100% - 32px)); border-radius: 24px; border: 1px solid var(--line-strong); }
  .sheet[open] { animation: pop .25s cubic-bezier(.2, .9, .25, 1); }
  .sheet-grip { display: none; }
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.sheet form { display: flex; flex-direction: column; max-height: 92dvh; }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line-strong); margin: 10px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 4px; flex: none; }
.sheet-head h2 { font-size: 19px; }
.sheet-body { padding: 8px 18px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-actions {
  display: flex; gap: 10px; padding: 12px 18px calc(16px + var(--safe-b));
  border-top: 1px solid var(--line); flex: none;
}
.field { display: grid; gap: 6px; margin: 10px 0; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.field input, .wz-input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-strong);
  outline: none; transition: border-color .2s, background .2s;
}
.field input:focus, .wz-input:focus { border-color: var(--acc); background: rgba(var(--acc-rgb), .06); }
.hint { margin: 4px 0 6px; font-size: 12.5px; color: var(--muted); }
.primary-btn {
  flex: 1; padding: 14px 18px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: #1a1004; font-weight: 800;
}
.primary-btn:disabled { opacity: .55; cursor: progress; }
.danger-btn {
  padding: 14px 16px; border-radius: 14px; font-weight: 700;
  background: rgba(255, 93, 93, .08); border: 1px solid rgba(255, 93, 93, .3); color: var(--red);
}

/* ---------- барабаны ввода ---------- */
.wz { margin: 12px 0 16px; }
.wz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.wz-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.wz-label i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); }
.wz-input { width: 140px; padding: 8px 12px; text-align: right; font: 600 14px var(--mono); }
.wheel {
  --ih: 48px;
  position: relative; display: flex; justify-content: center; gap: 4px;
  padding: 6px; border-radius: 16px;
  background: linear-gradient(180deg, #0b0d12, #1a1e27 50%, #0b0d12);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .7);
}
.wheel::before {
  content: ''; position: absolute; left: 6px; right: 6px; top: 50%; height: var(--ih); transform: translateY(-50%);
  border-radius: 9px; border: 1px solid rgba(var(--c-rgb), .5);
  background: rgba(var(--c-rgb), .07); pointer-events: none;
}
.wheel-col {
  height: calc(var(--ih) * 3); flex: 1 1 0; max-width: 52px; min-width: 0;
  overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-block: var(--ih);
  mask-image: linear-gradient(180deg, transparent, black 30%, black 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, black 30%, black 70%, transparent);
  border-radius: 8px; outline: none;
  touch-action: pan-y;
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col:focus-visible { box-shadow: 0 0 0 2px var(--acc); }
.wheel-col.frac { background: rgba(255, 60, 60, .12); }
.wheel-item {
  height: var(--ih); display: grid; place-items: center; scroll-snap-align: center;
  font: 700 26px var(--mono); color: var(--faint); transition: color .15s, transform .15s;
  user-select: none; -webkit-user-select: none;
}
.wheel-item.on { color: #fff; transform: scale(1.12); }
.wheel-col.frac .wheel-item.on { color: #ffb3b3; }
.wheel-sep { align-self: center; font: 700 26px var(--mono); color: var(--muted); }
@media (max-width: 380px) { .wheel { --ih: 42px; gap: 2px; } .wheel-item { font-size: 22px; } }

.preview {
  margin: 8px 0 4px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  font-size: 13.5px; color: var(--muted); display: grid; gap: 4px;
}
.preview:empty { display: none; }
.preview b { color: var(--text); }
.preview .big { font: 700 22px var(--mono); color: var(--acc); }
.preview .bad { color: var(--red); font-weight: 600; }

/* ---------- вход ---------- */
.login {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(40rem 30rem at 50% 0%, rgba(255, 181, 71, .18), transparent 60%), var(--bg);
}
.login-card {
  width: min(360px, 100%); text-align: center; display: grid; gap: 12px;
  padding: 28px 22px; border-radius: 24px; background: var(--card); border: 1px solid var(--line);
}
.login-card h1 { font-size: 24px; }
.login-card p { margin: 0; }
.login-card input {
  padding: 14px; border-radius: 14px; text-align: center; font-size: 16px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong); outline: none;
}
.login-card input:focus { border-color: var(--acc); }
.login-error { color: var(--red); font-size: 13px; min-height: 1.2em; }

/* ---------- тост ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; top: max(16px, env(safe-area-inset-top));
  transform: translate(-50%, -150%); transition: transform .35s cubic-bezier(.2, .9, .25, 1);
  padding: 11px 18px; border-radius: 999px; max-width: calc(100% - 32px);
  background: #1d212b; border: 1px solid var(--line-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  font-weight: 600; font-size: 14px;
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 93, 93, .5); color: #ffc2c2; }

/* ---------- скелетон ---------- */
.layout[aria-busy='true'] .kpis:empty::before,
.layout[aria-busy='true'] .chart:empty::before {
  content: ''; display: block; height: 180px; border-radius: 14px; grid-column: 1 / -1;
  background: linear-gradient(90deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- сводка и переключатель ресурсов ---------- */
.overview { padding: 16px; }
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-total { font: 700 clamp(28px, 8vw, 36px) / 1.1 var(--mono); letter-spacing: -0.02em; margin-top: 4px; }
.ov-total small { font: 600 13px var(--ui); color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.ov-sub { font-size: 12.5px; color: var(--muted); text-align: right; }
.ov-bar { display: flex; gap: 3px; height: 8px; margin: 14px 0; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .06); }
.ov-bar span { height: 100%; background: linear-gradient(90deg, var(--c), var(--c2)); transition: flex-grow .8s cubic-bezier(.2, .9, .25, 1); min-width: 0; }
.res-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.res-tab {
  position: relative; text-align: left; min-width: 0;
  display: grid; gap: 2px; padding: 12px 12px 10px; border-radius: 16px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  transition: background .25s, border-color .25s, transform .1s;
}
.res-tab:active { transform: scale(.97); }
.res-tab:hover { border-color: var(--line-strong); }
.res-tab[aria-selected='true'] {
  background: linear-gradient(150deg, rgba(var(--c-rgb), .2), rgba(var(--c-rgb), .04));
  border-color: rgba(var(--c-rgb), .55);
  box-shadow: 0 8px 28px rgba(var(--c-rgb), .16);
}
.rt-name { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; }
.rt-ico { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: rgba(var(--c-rgb), .16); color: var(--c); flex: none; }
.rt-ico svg { width: 15px; height: 15px; fill: currentColor; }
.rt-val { font: 700 16px var(--mono); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-val small { font: 600 11px var(--ui); color: var(--muted); margin-left: 3px; }
.rt-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .rt-name { font-size: 13px; } .rt-ico { display: none; } .res-tab { padding: 10px; } }
@media (min-width: 960px) {
  .overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 4px 24px; align-items: center; }
  .ov-head { grid-column: 1; }
  .ov-bar { grid-column: 1; margin: 6px 0 0; }
  .res-tabs { grid-column: 2; grid-row: 1 / span 2; }
}

/* ---------- блоки ресурсов в форме ---------- */
.wz { margin: 10px 0 14px; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); transition: background .2s, border-color .2s; }
.wz.on { border-color: rgba(var(--c-rgb), .35); background: rgba(var(--c-rgb), .05); }
.wz .wz-head { margin-bottom: 0; }
.wz.on .wz-head { margin-bottom: 10px; }
.wz:not(.on) .wheel, .wz:not(.on) .wz-input { display: none; }
.wz-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 800; font-size: 15px; }
.wz-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 40px; height: 24px; border-radius: 99px; background: rgba(255, 255, 255, .12); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.wz-toggle input:checked + .switch { background: var(--c); }
.wz-toggle input:checked + .switch::after { transform: translateX(16px); }
.wz-toggle input:focus-visible + .switch { box-shadow: 0 0 0 2px var(--c); }
.wz-unit { font-size: 12px; color: var(--muted); font-weight: 600; }
.wz-off-hint { font-size: 12.5px; color: var(--faint); }
.wz.on .wz-off-hint { display: none; }
.preview .pv-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.preview .pv-line i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); align-self: center; flex: none; }
.preview .pv-total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }
.h-res { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.h-res i { width: 6px; height: 6px; border-radius: 2px; background: var(--c); }
.pv-line .big { font-size: 17px; }
