﻿:root {
    color-scheme: dark;
    --background: #101613;
    --surface: #18211c;
    --surface-2: #202b25;
    --border: #334139;
    --text: #f1f5f2;
    --muted: #a8b5ad;
    --accent: #90d8a7;
    --accent-strong: #5eb77b;
    --danger: #f18b84;
    --warning: #e5c36c;
    --radius: 20px;
    --shadow: 0 22px 60px rgba(0, 0, 0, .22);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 70% 0%, rgba(91, 155, 112, .13), transparent 36rem),
        var(--background);
    color: var(--text);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    min-height: 100vh;
}

.side-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    display: flex;
    width: 250px;
    flex-direction: column;
    gap: 28px;
    padding: 28px 20px;
    border-right: 1px solid var(--border);
    background: rgba(16, 22, 19, .92);
    backdrop-filter: blur(20px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 750;
    text-decoration: none;
}

.brand-mark {
    display: inline-grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    color: #102017;
    font-weight: 900;
    box-shadow: 0 10px 28px rgba(94, 183, 123, .22);
}

.side-nav nav {
    display: grid;
    gap: 6px;
}

.side-nav nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
}

.side-nav nav a:hover,
.side-nav nav a.active {
    background: var(--surface-2);
    color: var(--text);
}

.install-button {
    margin-top: auto;
}

.main-content {
    width: min(1320px, calc(100% - 250px));
    min-height: 100vh;
    margin-left: 250px;
    padding: 42px clamp(24px, 4vw, 64px) 80px;
}

.bottom-nav {
    display: none;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}

.page-header h1 {
    margin: 4px 0 8px;
    font-size: clamp(2rem, 5vw, 3.8rem);
    line-height: 1;
    letter-spacing: -.045em;
}

.page-header p {
    margin: 0;
    color: var(--muted);
}

.hero-header {
    min-height: 180px;
}

.eyebrow {
    color: var(--accent) !important;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.panel,
.metric-card,
.goal-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(32, 43, 37, .96), rgba(24, 33, 28, .96));
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(20px, 3vw, 30px);
}

.panel h2 {
    margin: 4px 0 16px;
}

.panel p {
    color: var(--muted);
    line-height: 1.55;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    display: grid;
    min-height: 150px;
    align-content: space-between;
    padding: 22px;
}

.metric-card span {
    color: var(--muted);
}

.metric-card strong {
    font-size: 2rem;
}

.metric-card a {
    color: var(--accent);
    font-size: .9rem;
    text-decoration: none;
}

.progress {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: #101613;
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.dashboard-grid,
.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.readiness-ring {
    --value: 0;
    display: grid;
    width: 142px;
    height: 142px;
    flex: 0 0 142px;
    place-content: center;
    border-radius: 50%;
    background:
        radial-gradient(circle, var(--background) 62%, transparent 64%),
        conic-gradient(var(--accent) calc(var(--value) * 1%), var(--surface-2) 0);
    text-align: center;
}

.readiness-ring strong {
    font-size: 2.2rem;
}

.readiness-ring span,
.score-badge span {
    color: var(--muted);
    font-size: .75rem;
}

.score-badge {
    display: grid;
    min-width: 105px;
    padding: 16px 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
}

.score-badge strong {
    font-size: 1.8rem;
}

.compact-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.compact-stats div {
    padding: 14px;
    border-radius: 14px;
    background: var(--background);
}

.compact-stats dt {
    color: var(--muted);
    font-size: .8rem;
}

.compact-stats dd {
    margin: 6px 0 0;
    font-size: 1.3rem;
    font-weight: 750;
}

.mini-body {
    position: relative;
    width: 100px;
    height: 160px;
    margin: 20px auto 0;
}

.mini-body span {
    position: absolute;
    display: block;
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.mini-head {
    left: 38px;
    width: 24px;
    height: 28px;
    border-radius: 50%;
}

.mini-torso {
    top: 32px;
    left: 26px;
    width: 48px;
    height: 70px;
    border-radius: 20px 20px 14px 14px;
}

.mini-leg {
    top: 96px;
    width: 19px;
    height: 62px;
    border-radius: 0 0 12px 12px;
}

.mini-leg.left {
    left: 28px;
}

.mini-leg.right {
    right: 28px;
}

.body-layout,
.list-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, .8fr);
    gap: 20px;
    margin-bottom: 20px;
}

.body-panel {
    min-width: 0;
}

.mode-switch {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 5px;
    border-radius: 14px;
    background: var(--background);
}

.mode-switch button {
    padding: 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.mode-switch button.active {
    background: var(--surface-2);
    color: var(--text);
}

.body-figures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-top: 18px;
}

.body-figures figure {
    margin: 0;
    text-align: center;
}

.body-figures figcaption {
    color: var(--muted);
    font-size: .8rem;
}

.body-figures svg {
    width: min(100%, 230px);
    max-height: 590px;
}

.body-region {
    fill: #446053;
    stroke: #101613;
    stroke-width: 2;
    cursor: pointer;
    transition: fill .18s ease, opacity .18s ease, filter .18s ease;
}

.body-region:hover,
.body-region.selected {
    filter: brightness(1.24);
    stroke: var(--accent);
    stroke-width: 4;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    font-size: .8rem;
}

.legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend .good {
    background: #76c893;
}

.legend .medium {
    background: #e5c36c;
}

.legend .bad {
    background: #e56b6f;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.form-grid label {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.form-grid label > span:first-child {
    color: var(--muted);
    font-size: .82rem;
    font-weight: 650;
}

.full {
    grid-column: 1 / -1;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--background);
    color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(94, 183, 123, .16);
}

input[type="range"] {
    padding: 0;
    accent-color: var(--accent);
}

textarea {
    resize: vertical;
}

.button,
.secondary,
.check-button,
.link-button {
    border: 0;
    cursor: pointer;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 11px;
    background: var(--accent);
    color: #102017;
    font-weight: 800;
    text-decoration: none;
}

.button.secondary,
.secondary {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.item-list {
    display: grid;
    gap: 10px;
}

.list-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: rgba(16, 22, 19, .58);
}

.list-item p,
.list-item small {
    display: block;
    margin: 4px 0 0;
    color: var(--muted);
}

.list-item.completed {
    opacity: .62;
}

.list-item.completed strong {
    text-decoration: line-through;
}

.check-button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 2px solid var(--accent-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--accent);
    font-weight: 900;
}

.tag {
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: .72rem;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.link-button {
    padding: 5px;
    background: transparent;
    color: var(--muted);
}

.link-button.danger {
    color: var(--danger);
}

.goal-grid {
    display: grid;
    gap: 14px;
}

.goal-card {
    padding: 18px;
    box-shadow: none;
}

.goal-card strong {
    font-size: 1.08rem;
}

.goal-card.completed {
    opacity: .65;
}

.inline-form {
    display: flex;
    gap: 8px;
}

.inline-form input {
    min-width: 0;
}

.narrow-panel {
    width: min(720px, 100%);
}

.notice {
    margin-top: 28px;
    padding: 16px;
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--background);
}

.notice p {
    margin-bottom: 0;
}

.toast-message {
    position: fixed;
    z-index: 100;
    top: 18px;
    right: 18px;
    max-width: 360px;
    padding: 13px 17px;
    border: 1px solid var(--accent-strong);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: toast-out .4s ease 4.5s forwards;
}

.validation {
    color: var(--danger);
    font-size: .8rem;
}

.offline-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.offline-page .panel {
    text-align: center;
}

code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--background);
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
    }
}

@media (max-width: 1050px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .body-layout,
    .list-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .side-nav {
        display: none;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 24px 16px calc(96px + env(safe-area-inset-bottom));
    }

    .bottom-nav {
        position: fixed;
        inset: auto 0 0;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 8px 7px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
        background: rgba(16, 22, 19, .94);
        backdrop-filter: blur(20px);
    }

    .bottom-nav a {
        padding: 9px 4px;
        border-radius: 10px;
        color: var(--muted);
        font-size: .68rem;
        text-align: center;
        text-decoration: none;
    }

    .bottom-nav a.active {
        background: var(--surface-2);
        color: var(--accent);
    }

    .page-header {
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 2.35rem;
    }

    .readiness-ring {
        width: 104px;
        height: 104px;
        flex-basis: 104px;
    }

    .readiness-ring strong {
        font-size: 1.55rem;
    }

    .metric-grid,
    .dashboard-grid,
    .two-column {
        grid-template-columns: 1fr;
    }

    .body-figures {
        gap: 0;
    }

    .mode-switch {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(90px, 1fr));
    }
}

@media (max-width: 480px) {
    .page-header {
        display: grid;
    }

    .hero-header .readiness-ring {
        position: absolute;
        top: 18px;
        right: 16px;
    }

    .metric-grid {
        grid-template-columns: 1fr 1fr;
    }

    .metric-card {
        min-height: 130px;
        padding: 16px;
    }

    .metric-card strong {
        font-size: 1.45rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full {
        grid-column: auto;
    }

    .list-item {
        grid-template-columns: auto 1fr;
    }

    .list-item > .tag,
    .list-item > .item-actions {
        grid-column: 2;
        justify-self: start;
    }
}

.list-item > form {
    margin: 0;
}

.card-action {
    margin-top: 0.8rem;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
