:root {
    --ink: #101820;
    --muted: #667085;
    --line: #dfe5e8;
    --paper: #f7faf8;
    --panel: #ffffff;
    --brand: #25a56a;
    --brand-dark: #0c6f4c;
    --accent: #ffb84d;
    --danger: #d94b4b;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: linear-gradient(180deg, #edf7f0 0%, #f8faf9 42%, #ffffff 100%);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
    font: inherit;
}

.app-shell {
    width: min(100%, 720px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px 16px 112px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.topbar h1,
.hero-panel h2,
.section-heading h2 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: clamp(1.35rem, 5vw, 2rem);
    font-weight: 800;
}

.eyebrow,
.section-label,
.modal-category {
    display: block;
    color: var(--brand-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.streak {
    min-width: 74px;
    padding: 9px 10px;
    border: 1px solid rgba(16, 24, 32, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.streak strong {
    display: block;
    font-size: 1.15rem;
}

.streak span {
    color: var(--muted);
    font-size: 0.75rem;
}

.status-note {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: #fff7e6;
    color: #6b4a12;
    font-size: 0.92rem;
}

.db-warning {
    border-left-color: var(--danger);
    background: #fff1f1;
    color: #7a2424;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.hero-panel,
.question-card,
.history-card {
    border: 1px solid rgba(16, 24, 32, 0.08);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
}

.hero-panel {
    overflow: hidden;
    padding: 18px;
}

.hero-panel h2 {
    margin-top: 4px;
    font-size: clamp(2rem, 9vw, 3.5rem);
    font-weight: 900;
    line-height: 0.95;
}

.exercise-list {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.exercise-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    text-align: left;
}

.exercise-row:active,
.agenda-card:active,
.library-card:active {
    transform: translateY(1px);
}

.exercise-main {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.exercise-main strong {
    font-size: 1.8rem;
    line-height: 1.15;
}

.exercise-main small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.check {
    display: inline-grid;
    width: 30px;
    height: 26px;
    place-items: center;
    border-radius: 7px;
    background: #e6f6ee;
    color: var(--brand-dark);
    font-size: 0.7rem;
    font-weight: 900;
}

.extras {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.extras span {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.86rem;
}

.extras span.on {
    border-color: rgba(37, 165, 106, 0.32);
    background: #e9f8f0;
    color: var(--brand-dark);
    font-weight: 700;
}

.rest-copy {
    margin: 18px 0 4px;
    color: var(--muted);
}

.training-note {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.question-card {
    margin-top: 16px;
    padding: 16px;
}

.question-card h3,
.history-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 800;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.section-heading {
    margin-bottom: 14px;
}

.section-heading h2 {
    font-size: 2rem;
    font-weight: 900;
}

.agenda-list,
.settings-grid {
    display: grid;
    gap: 10px;
}

.agenda-card {
    display: grid;
    grid-template-columns: 82px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 64px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    text-align: left;
}

.agenda-card span {
    color: var(--muted);
}

.agenda-card strong {
    min-width: 0;
    font-size: 1rem;
}

.agenda-card small {
    color: var(--muted);
    text-align: right;
}

.agenda-card small.done {
    color: var(--brand-dark);
    font-weight: 800;
}

.agenda-card small.missed {
    color: var(--danger);
    font-weight: 800;
}

.day-detail {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 8px 8px;
}

.day-detail.open {
    display: flex;
}

.day-detail span {
    padding: 6px 9px;
    border-radius: 999px;
    background: #eef2f1;
    color: #34403a;
    font-size: 0.84rem;
}

.day-detail span.wide {
    flex-basis: 100%;
    border-radius: 8px;
    background: #fff7e6;
    color: #6b4a12;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.library-card {
    display: grid;
    gap: 8px;
    min-height: 190px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    text-align: left;
}

.library-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 7px;
    background: #eef2f1;
}

.library-card span {
    color: var(--brand-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.library-card strong {
    line-height: 1.15;
}

.library-card small {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.15;
}

.settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.metric-card {
    min-height: 92px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.metric-card span {
    display: block;
    min-height: 38px;
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-card strong {
    display: block;
    font-size: 1.55rem;
    font-weight: 900;
}

.history-card {
    margin-bottom: 14px;
    padding: 16px;
    box-shadow: none;
}

.history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.history-row strong {
    text-align: right;
}

.info-panel {
    padding: 18px;
    border: 1px solid rgba(16, 24, 32, 0.08);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
}

.info-panel p {
    margin: 0 0 14px;
    color: #34403a;
}

.nutrition-grid {
    display: grid;
    gap: 10px;
    margin: 14px 0;
}

.nutrition-grid div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.nutrition-grid span,
.nutrition-grid small {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
}

.nutrition-grid strong {
    display: block;
    color: var(--ink);
    font-size: 1.35rem;
    font-weight: 900;
}

.soft-alert {
    margin: 14px 0 0;
    padding: 12px;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: #fff7e6;
}

.focus-list {
    display: grid;
    gap: 10px;
}

.focus-list span {
    min-height: 46px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
    font-weight: 800;
}

.bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(16, 24, 32, 0.08);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.bottom-nav button {
    display: grid;
    gap: 2px;
    place-items: center;
    min-height: 56px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.64rem;
    font-weight: 700;
}

.bottom-nav button span {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 7px;
    background: #eef2f1;
    font-size: 0.72rem;
    font-weight: 900;
    line-height: 1;
}

.bottom-nav button.active {
    background: #e9f8f0;
    color: var(--brand-dark);
}

.bottom-nav button.active span {
    background: var(--brand);
    color: #ffffff;
}

.modal-content {
    border: 0;
    border-radius: 8px;
}

.modal-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
    background: #eef2f1;
}

#modalDescricao {
    margin: 14px 0;
    color: #39443f;
}

.modal-prescription {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.modal-prescription span {
    padding: 10px;
    border-radius: 8px;
    background: #f0f5f2;
    font-weight: 800;
    text-align: center;
}

@media (min-width: 760px) {
    .app-shell {
        padding-top: 34px;
    }

    .library-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nutrition-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 430px) {
    .agenda-card {
        grid-template-columns: 70px 1fr;
    }

    .agenda-card small {
        grid-column: 2;
        text-align: left;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}
