/* Тёмно-зелёная тема. Фон — живой холст со светящимися кубиками (js/bg.js),
   карточки полупрозрачные, чтобы свечение читалось позади них. */
:root {
    --bg: #08120c;
    --bg-soft: #0e1b13;
    --surface: rgba(33, 59, 44, .90);
    --surface-2: rgba(27, 49, 37, .78);
    --text: #e9f5ec;
    --text-soft: #bcd4c3;
    --hint: #89a793;
    --label: #9cc0a6;
    --accent: #8fe3a2;
    --accent-strong: #b7f0c3;
    --accent-soft: rgba(143, 227, 162, .14);
    --accent-text: #06170d;
    --border: rgba(180, 232, 194, .30);
    --border-lit: rgba(143, 227, 162, .45);
    --danger: #ff9189;
    --danger-soft: rgba(255, 145, 137, .14);
    --shadow: 0 6px 20px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .055);
    --shadow-lift: 0 8px 26px rgba(20, 90, 45, .35);
    --radius: 18px;
    --radius-sm: 12px;
    --tabbar-h: 66px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

/* холст с кубиками */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 75% 55% at 15% 0%, rgba(34, 90, 54, .55) 0%, transparent 60%),
        radial-gradient(ellipse 65% 45% at 90% 8%, rgba(28, 78, 48, .45) 0%, transparent 62%),
        radial-gradient(ellipse 85% 55% at 50% 105%, rgba(24, 70, 42, .5) 0%, transparent 65%),
        var(--bg);
}

/* вуаль поверх кубиков: свечение остаётся видно, но текст читается */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg,
        rgba(8, 18, 12, .58) 0%,
        rgba(8, 18, 12, .30) 26%,
        rgba(8, 18, 12, .18) 60%,
        rgba(8, 18, 12, .34) 100%);
}

.app {
    padding: 22px 16px calc(var(--tabbar-h) + 28px);
    max-width: 620px;
    margin: 0 auto;
}
.app.no-tabbar { padding-bottom: 40px; }

.loader, .center-note { text-align: center; color: var(--hint); padding: 60px 16px; }

/* текст лежит поверх светящегося фона, поэтому ему нужен тёмный ореол */
h1, h2, p, label, .hint, .loader, .center-note, .scale-legend, .steps {
    text-shadow: 0 1px 4px rgba(4, 10, 6, .85), 0 0 12px rgba(4, 10, 6, .6);
}
.card, .hero-card, .stat, .row-link, .tile, .report-text, .tabbar {
    text-shadow: none;
}

h1 { font-size: 24px; line-height: 1.22; margin: 0 0 6px; font-weight: 750; letter-spacing: -.01em; }
h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .11em;
    color: var(--label);
    margin: 26px 0 10px;
    font-weight: 700;
}
p { margin: 0 0 12px; }
.hint { color: var(--hint); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.error:empty { margin: 0; }

.screen-head { margin-bottom: 18px; }

button { font: inherit; cursor: pointer; }

/* ---------- кнопки ---------- */

.btn {
    display: block;
    width: 100%;
    padding: 15px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: var(--accent-text);
    font-weight: 680;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lift);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.985); filter: brightness(1.06); }
.btn.secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    font-weight: 550;
    box-shadow: none;
    backdrop-filter: blur(12px);
}
.btn.ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-soft);
    font-weight: 550;
    box-shadow: none;
}
.btn.danger { background: var(--danger); color: #2a0b08; box-shadow: none; }
.btn.danger.soft {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(255, 145, 137, .32);
    box-shadow: none;
}
.btn.hero {
    padding: 20px 18px;
    font-size: 18px;
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.btn-row { display: flex; gap: 10px; }

/* ---------- карточки ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.card.flat { background: var(--surface-2); box-shadow: none; }
.card.tappable { transition: transform .12s ease, border-color .12s ease; }
.card.tappable:active { transform: scale(.99); border-color: var(--border-lit); }
.card p:last-child { margin-bottom: 0; }

.hero-card {
    background: var(--surface);
    border: 1px solid var(--border-lit);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(143, 227, 162, .16) 0%, transparent 55%),
        var(--surface);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
    backdrop-filter: blur(14px);
}
.hero-number {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.03em;
    margin-top: 10px;
    color: var(--accent);
    text-shadow: 0 0 24px rgba(143, 227, 162, .35);
}
.hero-caption { color: var(--hint); font-size: 14px; margin-top: 2px; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
}
.status-pill .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.status-pill.muted { background: rgba(255, 255, 255, .06); color: var(--hint); }
.status-pill.muted .dot { box-shadow: none; }

.row-link {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 10px;
    color: var(--text);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    transition: transform .12s ease, border-color .12s ease;
}
.row-link:active { transform: scale(.99); border-color: var(--border-lit); }
.row-link .icon {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
}
.row-link .body { flex: 1; min-width: 0; }
.row-link .title, .row-link .sub { display: block; }
.row-link .title { font-weight: 620; }
.row-link .sub { font-size: 13px; color: var(--hint); }
.row-link .chevron { color: var(--hint); flex: 0 0 auto; display: grid; }
.row-link.danger-row .icon { background: var(--danger-soft); color: var(--danger); }

.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: left;
    color: var(--text);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    transition: transform .12s ease, border-color .12s ease;
}
.tile:active { transform: scale(.98); border-color: var(--border-lit); }
.tile .icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}
.tile .title { font-weight: 620; }
.tile .sub { font-size: 13px; color: var(--hint); }

/* цветовые варианты плашек-иконок: оттенки в пределах зелёно-мятной гаммы */
.icon.tint-teal   { background: rgba(121, 223, 200, .16); color: #79dfc8; }
.icon.tint-lime   { background: rgba(184, 227, 127, .16); color: #b8e37f; }
.icon.tint-sky    { background: rgba(133, 201, 227, .16); color: #85c9e3; }
.icon.tint-amber  { background: rgba(227, 200, 127, .16); color: #e3c87f; }
.icon.tint-rose   { background: rgba(255, 145, 137, .15); color: #ff9189; }

/* ---------- поля ---------- */

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 7px;
    font-weight: 550;
}
input[type="text"], input[type="number"], input[type="time"], input[type="date"],
select, textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(10, 21, 14, .78);
    color: var(--text);
    font: inherit;
    backdrop-filter: blur(10px);
}
input::placeholder, textarea::placeholder { color: var(--hint); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
select option { background: var(--bg-soft); color: var(--text); }
textarea { resize: vertical; min-height: 70px; }
input[type="date"], input[type="time"] { color-scheme: dark; }

/* ---------- чипы и шкалы ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 11px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    transition: transform .12s ease;
    backdrop-filter: blur(10px);
}
.chip:active { transform: scale(.96); }
.chip.selected {
    background: var(--accent);
    border-color: transparent;
    color: var(--accent-text);
    font-weight: 650;
}
.chip.static { color: var(--text-soft); }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale button {
    padding: 15px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-weight: 650;
    transition: transform .12s ease;
}
.scale button:active { transform: scale(.95); }
.scale button.selected {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    border-color: transparent;
    color: var(--accent-text);
}
.scale-legend {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--hint);
    margin-top: 10px;
}

/* ---------- шаги ---------- */

.steps {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--hint);
    margin-bottom: 16px;
}
.progress {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, .10);
    border-radius: 999px;
    overflow: hidden;
}
.progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
    border-radius: 999px;
    box-shadow: 0 0 12px rgba(143, 227, 162, .5);
    transition: width .25s ease;
}

.step-row { display: flex; gap: 14px; margin-bottom: 16px; }
.step-row:last-child { margin-bottom: 0; }
.step-row .num {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
}
.step-row .text { flex: 1; }
.step-row .text b { display: block; margin-bottom: 2px; }

/* ---------- статистика ---------- */

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.stat .value { font-size: 22px; font-weight: 780; letter-spacing: -.02em; }
.stat .label { font-size: 13px; color: var(--hint); margin-top: 3px; }

.bar-row { margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 15px;
    margin-bottom: 7px;
}
.bar-head .num { color: var(--hint); font-variant-numeric: tabular-nums; }
.bar {
    height: 9px;
    background: rgba(255, 255, 255, .07);
    border-radius: 999px;
    overflow: hidden;
}
.bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(143, 227, 162, .4);
}

.report-text {
    white-space: pre-line;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text-soft);
    backdrop-filter: blur(14px);
}

/* ---------- табы периодов ---------- */

.tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
    white-space: nowrap;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    backdrop-filter: blur(10px);
}
.tabs button.selected {
    background: var(--accent);
    border-color: transparent;
    color: var(--accent-text);
    font-weight: 650;
}

/* ---------- прочее ---------- */

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { display: flex; align-items: flex-start; gap: 11px; font-size: 15px; }
.switch input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--accent); }

.info-rows > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.info-rows > div:first-child { padding-top: 0; }
.info-rows > div:last-child { border-bottom: 0; padding-bottom: 0; }
.info-rows .k { color: var(--hint); }
.info-rows .v { text-align: right; }

.list-item-title { font-weight: 620; }
.list-item-meta { font-size: 14px; color: var(--hint); margin-top: 2px; }

.pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}
.pill.muted { background: rgba(255, 255, 255, .06); color: var(--hint); }
.pill.warn { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--accent-soft); color: var(--accent); }

.code-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    letter-spacing: .04em;
    background: rgba(0, 0, 0, .35);
    border: 1px solid var(--border);
    color: var(--accent-strong);
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    word-break: break-all;
}

.divider { height: 1px; background: var(--border); margin: 22px 0; border: 0; }

/* ---------- нижняя панель вкладок ---------- */

.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--tabbar-h);
    display: flex;
    background: rgba(8, 18, 12, .86);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(18px);
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
    flex: 1;
    background: none;
    border: 0;
    color: var(--hint);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    padding: 0;
}
.tabbar button.selected { color: var(--accent); font-weight: 620; }
.tabbar button.selected svg { filter: drop-shadow(0 0 7px rgba(143, 227, 162, .8)); }

.toast {
    position: fixed;
    left: 16px; right: 16px;
    bottom: calc(var(--tabbar-h) + 16px);
    max-width: 588px;
    margin: 0 auto;
    background: rgba(14, 27, 19, .96);
    border: 1px solid var(--border-lit);
    color: var(--text);
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    text-align: center;
    box-shadow: var(--shadow-lift);
    backdrop-filter: blur(18px);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
    z-index: 30;
}
.toast.visible { opacity: 1; transform: translateY(0); }
