/* Ава Лайф — тёмная тема: брутально, стильно, строго.
   Чёрный фон, без скруглений, тонкие линии, Oswald капсом, цифры JetBrains Mono,
   один акцент #d4ff00, красный — только для пропусков/недобора. */

/* ── Шрифты (свои файлы, OFL) ─────────────────────────────────────────── */
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/oswald-cyrillic-400.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/oswald-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/oswald-cyrillic-600.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/oswald-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/oswald-cyrillic-700.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Oswald'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/oswald-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/jetbrains-mono-cyrillic-400.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/jetbrains-mono-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+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/jetbrains-mono-cyrillic-700.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/jetbrains-mono-latin-700.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ── Токены ───────────────────────────────────────────────────────────── */
:root {
  --bg: #000;
  --fg: #e8e8e8;
  --mut: #666;
  --dim: #555;
  --line: #1d1d1d;
  --line2: #2a2a2a;
  --field: #0a0a0a;
  --acc: #d4ff00;
  --red: #ff3b30;
  --head: 'Oswald', 'Arial Narrow', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --pad: 16px;
  --tabs-h: 52px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--acc); color: #000; }

.acc { color: var(--acc); }
.red { color: var(--red); }

/* ── Шапка ────────────────────────────────────────────────────────────── */
.hd {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--sat) + 18px) var(--pad) 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line2);
}
.hd-text { min-width: 0; }
.hd-title {
  margin: 0;
  font-family: var(--head);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hd-date {
  margin-top: 6px;
  font-size: 11px;
  color: var(--mut);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.hd-gear {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  color: var(--mut);
}
.hd-gear svg { display: block; }
.hd-gear .gear-outer, .hd-gear .gear-inner { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: miter; }
.hd-gear.on, .hd-gear:active { color: var(--acc); }

/* ── Нижние вкладки ───────────────────────────────────────────────────── */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--line2);
  padding: 0 env(safe-area-inset-right, 0px) var(--sab) env(safe-area-inset-left, 0px);
}
.tab {
  flex: 1;
  min-width: 0;
  height: var(--tabs-h);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -1px;
  border-top: 2px solid transparent;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.tab.on { color: var(--acc); border-top-color: var(--acc); }
.tab:active { color: var(--fg); }

.main { padding-bottom: calc(var(--tabs-h) + var(--sab) + 24px); }

/* экран входа — без шапки и вкладок */
body.is-login .hd, body.is-login .tabs { display: none; }
body.is-login .main { padding-top: calc(var(--sat) + 8px); padding-bottom: calc(var(--sab) + 24px); }

/* ── Блоки ────────────────────────────────────────────────────────────── */
.blk { border-bottom: 1px solid var(--line); padding: 16px var(--pad); }
.blk.last { border-bottom: 0; }
.lb {
  display: block;
  font-size: 10px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: 8px;
}
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row > .lb { margin-bottom: 8px; }
.sub { font-size: 12px; color: var(--mut); margin-top: 6px; }
.more { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--mut); white-space: nowrap; }
.more:active { color: var(--acc); }
.arr { font-family: var(--mono); }
.tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mut);
  border: 1px solid var(--line2);
  padding: 2px 6px;
  white-space: nowrap;
}
.tag.acc { color: var(--acc); border-color: var(--acc); }
.tag.red { color: var(--red); border-color: var(--red); }
.tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.big {
  font-family: var(--head);
  font-weight: 600;
  font-size: 52px;
  line-height: 1;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.big small { font-size: 16px; color: var(--mut); font-weight: 400; letter-spacing: .1em; text-transform: uppercase; }
.big .delta { font-family: var(--mono); font-size: 18px; font-weight: 700; margin-left: 12px; vertical-align: 6px; letter-spacing: 0; }
.big.none { font-size: 32px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; padding: 6px 0; }

.blk-link { display: block; }
.blk-link:active .more { color: var(--acc); }
.blk-weight .inline-form { margin-top: 16px; }

.tip { font-size: 12px; color: #000; background: var(--acc); padding: 8px 10px; margin-bottom: 12px; line-height: 1.4; }

.stub-title { font-family: var(--head); font-weight: 600; font-size: 22px; text-transform: uppercase; letter-spacing: .04em; line-height: 1.15; }

/* ── Кнопки ───────────────────────────────────────────────────────────── */
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  background: transparent;
  color: var(--acc);
  border: 1px solid var(--acc);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.btn.f { background: var(--acc); color: #000; }
.btn.ghost { color: var(--fg); border-color: var(--line2); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.s { min-height: 34px; padding: 0 10px; font-size: 10px; letter-spacing: .1em; }
.btn.wide { width: 100%; }
.btn:active { filter: brightness(.8); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, .tab:focus-visible, a:focus-visible { outline: 1px solid var(--acc); outline-offset: 2px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ── Поля ─────────────────────────────────────────────────────────────── */
input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  background: var(--field);
  color: var(--fg);
  border: 1px solid var(--line2);
  font-family: var(--mono);
  font-size: 16px; /* меньше 16px — iPhone увеличивает страницу при вводе */
  outline: none;
}
input:focus { border-color: var(--acc); }
input::placeholder { color: #444; }
input[type="time"] { width: auto; min-width: 110px; color-scheme: dark; }
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) brightness(.5); }

.form { display: flex; flex-direction: column; gap: 12px; }
.form .btn { align-self: flex-start; }
.form .btn.wide { align-self: stretch; }
.fld { display: block; }
.fld .lb { margin-bottom: 6px; }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form > input, .inline-form > .input-unit { flex: 1; }
.inline-form > input[type="time"] { flex: 0 1 auto; }
.inline-form.wrap { flex-wrap: wrap; }
.input-unit .num-input::placeholder { font-weight: 400; font-size: 16px; letter-spacing: .05em; }
.input-unit { position: relative; display: flex; min-width: 0; }
.input-unit .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; pointer-events: none; }
.num-input { font-size: 20px; font-weight: 700; letter-spacing: .02em; }
.input-unit .num-input { padding-right: 44px; }

.msg { font-size: 12px; margin-top: 8px; min-height: 0; }
.msg:empty { display: none; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--acc); }

/* ── Списки ───────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.li {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #161616;
  font-variant-numeric: tabular-nums;
}
.li:last-child { border-bottom: 0; }
.li-date { color: var(--fg); font-size: 13px; }
.li-date .wd { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.li-val { font-size: 15px; font-weight: 700; text-align: right; }
.li-val .unit { color: var(--mut); font-weight: 400; font-size: 11px; }
.li-delta { font-size: 12px; min-width: 40px; text-align: right; }
.li .btn.ghost { color: var(--mut); border-color: var(--line); }
.li .btn.danger { color: var(--red); border-color: var(--red); }

.user { padding: 12px 0; border-bottom: 1px solid #161616; }
.user:last-child { border-bottom: 0; }
.user-name { font-family: var(--head); font-weight: 600; font-size: 18px; text-transform: uppercase; letter-spacing: .04em; line-height: 1.2; }
.user-login { font-size: 12px; color: var(--mut); margin-top: 2px; }
.user .btns { margin-top: 10px; }
.user.off .user-name { color: var(--mut); }
.user .reset { margin-top: 8px; }
.user .reset input { height: 34px; font-size: 16px; }

.nav-row { display: flex; align-items: center; justify-content: space-between; }
.nav-row .lb { margin-bottom: 4px; }
.nav-title { display: block; font-family: var(--head); font-weight: 600; font-size: 20px; text-transform: uppercase; letter-spacing: .05em; }
.nav-row .arr { color: var(--acc); font-size: 18px; }
.nav-row:active .nav-title { color: var(--acc); }

/* ── График ───────────────────────────────────────────────────────────── */
.chart { display: block; width: 100%; height: auto; margin-top: 16px; overflow: visible; max-height: 320px; }
.chart .ax { stroke: var(--line2); stroke-width: 1; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ch-lb { fill: var(--dim); font-family: var(--mono); font-size: 9px; }
.chart .ch-empty { fill: var(--mut); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .2em; }
.chart .line { fill: none; stroke: var(--acc); stroke-width: 1.5; stroke-linejoin: miter; }
.chart .pt { fill: var(--bg); stroke: var(--acc); stroke-width: 1; }
.chart .pt.last { fill: var(--acc); }

/* ── Вход ─────────────────────────────────────────────────────────────── */
.brand { padding: 64px var(--pad) 32px; border-bottom: 1px solid var(--line2); }
.brand-mark {
  display: inline-block;
  font-family: var(--head);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .04em;
  color: #000;
  background: var(--acc);
  padding: 2px 8px;
  margin-bottom: 20px;
}
.brand-name { font-family: var(--head); font-weight: 700; font-size: 48px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; }
.brand-sub { margin-top: 10px; font-size: 11px; color: var(--mut); letter-spacing: .25em; text-transform: uppercase; }
.view-login .blk { border-bottom: 0; padding-top: 24px; }

/* широкий экран (ПК): колонка по центру */
@media (min-width: 640px) {
  .hd, .main, .tabs { max-width: 560px; margin-left: auto; margin-right: auto; }
  .tabs { border-left: 1px solid var(--line2); border-right: 1px solid var(--line2); }
  .main { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
}
