:root {
    color-scheme: light;
    --bg: #f7f3ef;
    --ink: #17151f;
    --muted: #7d7887;
    --soft: #f1edf7;
    --card: rgba(255, 255, 255, 0.78);
    --card-strong: #ffffff;
    --line: rgba(32, 28, 45, 0.10);
    --pink: #ff5f82;
    --coral: #ff8c5f;
    --violet: #8f5cff;
    --blue: #3e8cff;
    --mint: #59d2bd;
    --green: #24b47e;
    --red: #ec4963;
    --nav: #181725;
    --shadow: 0 24px 70px rgba(38, 32, 58, 0.16);
    --shadow-soft: 0 12px 35px rgba(38, 32, 58, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 5%, rgba(255, 95, 130, 0.24), transparent 24rem),
        radial-gradient(circle at 84% 4%, rgba(89, 210, 189, 0.22), transparent 23rem),
        linear-gradient(135deg, #fff8f2 0%, #f8f3ff 48%, #eef8ff 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    background-image:
        linear-gradient(rgba(23, 21, 31, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 21, 31, 0.028) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 70%);
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 26px 0 96px;
}

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

.eyebrow {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2.4rem, 9vw, 6.8rem);
    font-weight: 950;
    line-height: 0.86;
}

h2 {
    margin-bottom: 12px;
    font-size: clamp(1.35rem, 3vw, 2.15rem);
    line-height: 1.05;
}

.muted {
    color: var(--muted);
}

.icon-button {
    display: grid;
    width: 48px;
    height: 48px;
    min-height: 48px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--nav);
    box-shadow: var(--shadow-soft);
}

.icon-button span {
    display: block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 50%;
    color: #fff;
}

.icon-button span::before {
    display: block;
    width: 2px;
    height: 10px;
    margin: -6px auto 0;
    border-radius: 999px;
    background: currentColor;
    content: "";
}

.login-panel {
    position: relative;
    width: min(440px, 100%);
    margin: 9vh auto 0;
    padding: 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.64)),
        var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.login-orb {
    width: 78px;
    height: 78px;
    margin-bottom: 28px;
    border-radius: 26px;
    background:
        linear-gradient(135deg, var(--pink), var(--coral));
    box-shadow: 0 18px 42px rgba(255, 95, 130, 0.34);
}

.login-orb::before {
    display: block;
    width: 32px;
    height: 32px;
    margin: 24px;
    border: 5px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    content: "";
}

.stack,
.log-form {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
}

input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--ink);
}

input:focus {
    outline: 4px solid rgba(143, 92, 255, 0.18);
    border-color: rgba(143, 92, 255, 0.7);
}

button,
.text-link {
    min-height: 46px;
    border: 0;
    border-radius: 16px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 900;
    text-decoration: none;
}

.app-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 16px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.52);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.app-tabs a {
    display: grid;
    min-height: 42px;
    place-items: center;
    border-radius: 18px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
}

.app-tabs a.active {
    background: var(--nav);
    color: #fff;
}

.primary {
    background: linear-gradient(135deg, var(--ink), #2d2942);
    color: #fff;
    box-shadow: 0 14px 30px rgba(23, 21, 31, 0.18);
}

.ghost {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    color: var(--ink);
}

.alert {
    border-radius: 16px;
    padding: 12px 14px;
    background: #ffe3e8;
    color: var(--red);
    font-weight: 850;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 184px;
    align-items: center;
    gap: 18px;
    min-height: 220px;
    margin-bottom: 16px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 34px;
    background:
        radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.54), transparent 13rem),
        linear-gradient(135deg, #ff5f82 0%, #ff9364 42%, #8f5cff 100%);
    box-shadow: var(--shadow);
    color: #fff;
}

.hero-copy h2 {
    max-width: 630px;
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 4.7rem);
    font-weight: 950;
}

.hero-copy p:not(.eyebrow) {
    max-width: 420px;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 760;
}

.hero-panel .eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.progress-orbit {
    display: grid;
    width: 168px;
    height: 168px;
    place-items: center;
    border-radius: 50%;
    background:
        conic-gradient(#fff var(--progress), rgba(255, 255, 255, 0.22) 0),
        rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.12);
}

.progress-core {
    display: grid;
    width: 118px;
    height: 118px;
    place-items: center;
    border-radius: 50%;
    background: rgba(23, 21, 31, 0.82);
    text-align: center;
}

.progress-core strong {
    display: block;
    margin-top: 12px;
    font-size: 2rem;
    line-height: 0.8;
}

.progress-core span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.78rem;
    font-weight: 850;
}

.day-strip {
    display: grid;
    grid-auto-columns: minmax(58px, 1fr);
    grid-auto-flow: column;
    gap: 10px;
    margin-bottom: 22px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}

.day-strip::-webkit-scrollbar {
    display: none;
}

.day-chip {
    display: grid;
    min-height: 82px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.64);
    box-shadow: var(--shadow-soft);
}

.day-chip span,
.day-chip small {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
}

.day-chip strong {
    font-size: 1.28rem;
}

.day-chip.today {
    background: var(--nav);
    color: #fff;
}

.day-chip.today span,
.day-chip.today small {
    color: rgba(255, 255, 255, 0.68);
}

.section-title,
.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin: 24px 0 12px;
}

.section-title h2,
.section-head h2 {
    margin-bottom: 0;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: end;
    gap: 8px;
}

.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--violet);
    background: rgba(143, 92, 255, 0.10);
}

.today-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 14px;
}

.empty-state,
.habit-card,
.history,
.manage {
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.66)),
        var(--card);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.empty-state {
    padding: 22px;
}

.empty-state p,
.habit-head p {
    margin-bottom: 0;
    color: var(--muted);
}

.habit-card {
    position: relative;
    padding: 0;
    overflow: hidden;
}

.habit-card::before {
    position: absolute;
    inset: auto 16px 0 16px;
    height: 5px;
    border-radius: 999px 999px 0 0;
    background: var(--accent);
    content: "";
}

.habit-card.done {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, #fff), color-mix(in srgb, var(--accent) 58%, #fffbff));
    color: #fff;
}

.habit-tap,
.habit-head,
.habit-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.habit-tap {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 188px;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    border: 0;
    border-radius: 28px;
    padding: 16px;
    background: transparent;
    color: inherit;
    text-align: left;
}

.habit-tap:active {
    transform: scale(0.992);
}

.habit-head {
    justify-content: space-between;
}

.habit-copy {
    display: grid;
    min-width: 0;
    flex: 1;
    gap: 4px;
}

.habit-title {
    overflow-wrap: anywhere;
    font-size: 1.15rem;
    font-weight: 950;
}

.habit-description {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 760;
}

.habit-head > div {
    min-width: 0;
    flex: 1;
}

.habit-head h2 {
    margin-bottom: 4px;
    overflow-wrap: anywhere;
    font-size: 1.15rem;
}

.habit-card.done .habit-description,
.habit-card.done .habit-head p {
    color: rgba(255, 255, 255, 0.76);
}

.habit-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 14%, #fff);
}

.habit-icon svg {
    width: 23px;
    height: 23px;
    color: var(--accent);
}

.habit-card.done .habit-icon {
    background: rgba(255, 255, 255, 0.92);
}

.status {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 7px 10px;
    background: rgba(23, 21, 31, 0.07);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 950;
    text-transform: uppercase;
}

.status.done {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

.status.skipped {
    background: #fff1d9;
    color: #9a5d00;
}

.check-button {
    position: relative;
    display: grid;
    width: min(100%, 132px);
    min-height: 84px;
    place-items: center;
    justify-self: center;
    border-radius: 30px;
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28), transparent 36%),
        var(--nav);
    color: #fff;
    box-shadow: 0 20px 40px rgba(23, 21, 31, 0.24);
}

.check-button svg {
    width: 42px;
    height: 42px;
}

.check-button::after {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    font-weight: 950;
    line-height: 1;
    content: "";
}

.check-button.checked {
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    box-shadow: 0 18px 34px rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.check-button.checked::after {
    background: var(--green);
    color: #fff;
    content: "✓";
}

.check-button:active {
    transform: scale(0.98);
}

.history,
.manage {
    margin-top: 18px;
    padding: 18px;
}

.stats-hero,
.page-hero,
.stats-panel,
.ai-panel,
.settings-card,
.metric-grid article {
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.66)),
        var(--card);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.page-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    padding: 22px;
    background:
        radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.48), transparent 13rem),
        linear-gradient(135deg, #ff8c5f 0%, #8f5cff 100%);
    color: #fff;
}

.page-hero.compact h2 {
    margin-bottom: 8px;
    font-size: clamp(1.9rem, 4vw, 3.4rem);
    font-weight: 950;
}

.page-hero p:not(.eyebrow) {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 760;
}

.page-hero .eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.page-hero-icon {
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.page-hero-icon svg {
    width: 36px;
    height: 36px;
}

.stats-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
    padding: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at 78% 20%, rgba(255, 255, 255, 0.42), transparent 14rem),
        linear-gradient(135deg, #19172a 0%, #315dff 52%, #59d2bd 100%);
    color: #fff;
}

.stats-hero h2 {
    max-width: 680px;
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 4.2rem);
    font-weight: 950;
}

.stats-hero p:not(.eyebrow) {
    max-width: 420px;
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 760;
}

.stats-hero .eyebrow {
    color: rgba(255, 255, 255, 0.72);
}

.stats-score {
    display: grid;
    min-height: 150px;
    place-items: center;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.16);
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.20);
}

.stats-score strong {
    display: block;
    font-size: 3.1rem;
    line-height: 0.85;
}

.stats-score span {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 900;
}

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

.metric-grid article {
    display: grid;
    gap: 8px;
    padding: 18px;
}

.metric-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 16px;
    background: rgba(143, 92, 255, 0.11);
    color: var(--violet);
}

.metric-icon svg {
    width: 22px;
    height: 22px;
}

.metric-grid strong {
    font-size: 2.35rem;
    line-height: 0.92;
}

.metric-grid article > span:last-child {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 850;
}

.ai-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
    padding: 18px;
    background:
        radial-gradient(circle at 94% 0%, rgba(143, 92, 255, 0.18), transparent 14rem),
        linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.66)),
        var(--card);
}

.ai-copy {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ai-copy h2 {
    margin-bottom: 6px;
    font-size: clamp(1.18rem, 2.4vw, 1.72rem);
}

.ai-copy p:not(.eyebrow) {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 760;
}

.ai-button {
    white-space: nowrap;
}

.ai-result {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    margin: 2px 0 0;
    border-radius: 22px;
    padding: 15px;
    background:
        radial-gradient(circle at 95% 0%, rgba(255, 95, 130, 0.12), transparent 10rem),
        rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 720;
    line-height: 1.5;
    box-shadow: inset 0 0 0 1px rgba(23, 21, 31, 0.06);
}

.ai-result p {
    margin: 0;
}

.ai-result-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 95, 130, 0.18), rgba(143, 92, 255, 0.16));
    color: var(--violet);
}

.ai-result-icon svg {
    width: 21px;
    height: 21px;
}

.ai-result.alert {
    display: block;
    background: #ffe3e8;
    color: var(--red);
}

.stats-panel {
    margin-top: 14px;
    padding: 18px;
}

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

.heat-cell {
    display: grid;
    min-height: 52px;
    place-items: center;
    border-radius: 16px;
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--green) var(--level), #f2eef8),
            color-mix(in srgb, var(--blue) var(--level), #ffffff)
        );
    color: var(--ink);
    font-weight: 950;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.heat-cell span {
    font-size: 0.82rem;
}

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

.habit-stat-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    border-radius: 22px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.habit-stat-card h3 {
    margin: 0 0 8px;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.stat-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(23, 21, 31, 0.08);
}

.stat-bar span {
    display: block;
    width: var(--level);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff));
}

.habit-stat-numbers {
    min-width: 76px;
    text-align: right;
}

.habit-stat-numbers strong {
    display: block;
    font-size: 1.2rem;
}

.habit-stat-numbers span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
}

.section-head {
    margin-top: 0;
}

.section-head span {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 850;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 22px;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0 8px;
}

th,
td {
    padding: 10px 8px;
    text-align: center;
    white-space: nowrap;
}

thead th {
    color: var(--muted);
    font-size: 0.74rem;
}

tbody tr {
    filter: drop-shadow(0 8px 16px rgba(38, 32, 58, 0.06));
}

tbody th,
tbody td {
    background: rgba(255, 255, 255, 0.76);
}

tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 180px;
    border-radius: 16px 0 0 16px;
    text-align: left;
}

tbody td:last-child {
    border-radius: 0 16px 16px 0;
}

td.done {
    color: #fff;
    background: linear-gradient(135deg, var(--green), var(--mint));
    font-weight: 950;
}

td.skipped {
    color: #9a5d00;
    background: #fff0d7;
    font-weight: 950;
}

td.empty {
    color: rgba(23, 21, 31, 0.18);
}

.manage {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
}

.manage.dedicated {
    margin-top: 0;
}

.small-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 14px;
}

.small-icon svg {
    width: 20px;
    height: 20px;
}

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

.settings-card {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px;
}

.settings-card h2 {
    margin-bottom: 0;
}

.settings-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 760;
}

input[type="color"] {
    padding: 5px;
}

.habit-list {
    display: grid;
    gap: 8px;
}

.habit-row {
    min-height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 18px;
    padding: 7px 8px;
    background: rgba(255, 255, 255, 0.72);
}

.swatch {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border-radius: 50%;
}

.small {
    min-height: 36px;
    margin-left: auto;
    font-size: 0.78rem;
}

.bottom-nav {
    position: fixed;
    right: 50%;
    bottom: 16px;
    z-index: 10;
    display: none;
    width: min(380px, calc(100vw - 28px));
    transform: translateX(50%);
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 28px;
    padding: 8px;
    background: rgba(24, 23, 37, 0.94);
    box-shadow: 0 20px 55px rgba(23, 21, 31, 0.28);
    backdrop-filter: blur(18px);
}

.bottom-nav a {
    display: grid;
    min-height: 54px;
    place-items: center;
    align-content: center;
    gap: 3px;
    border-radius: 22px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
    font-weight: 850;
    text-decoration: none;
}

.bottom-nav a.active {
    background: #fff;
    color: var(--nav);
}

.bottom-nav svg {
    width: 18px;
    height: 18px;
    color: currentColor;
    stroke-width: 2.4;
}

@media (max-width: 860px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 16px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .progress-orbit {
        width: 132px;
        height: 132px;
        margin-left: auto;
    }

    .progress-core {
        width: 92px;
        height: 92px;
    }

    .progress-core strong {
        font-size: 1.55rem;
    }

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

    .stats-hero,
    .ai-panel,
    .metric-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .stats-score {
        min-height: 112px;
    }

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

@media (max-width: 640px) {
    .app-shell {
        padding-bottom: 112px;
    }

    .topbar {
        align-items: start;
    }

    .hero-panel {
        grid-template-columns: minmax(0, 1fr) 96px;
        align-items: center;
        border-radius: 30px;
        gap: 12px;
        padding: 18px;
    }

    .hero-copy h2 {
        margin-bottom: 6px;
        font-size: 1.86rem;
        line-height: 0.96;
    }

    .hero-copy p:not(.eyebrow) {
        font-size: 0.92rem;
    }

    .progress-orbit {
        width: 94px;
        height: 94px;
        margin-left: 0;
        box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.12);
    }

    .progress-core {
        width: 66px;
        height: 66px;
    }

    .progress-core strong {
        margin-top: 8px;
        font-size: 1.22rem;
    }

    .progress-core span {
        font-size: 0.66rem;
    }

    .day-chip {
        min-height: 70px;
        border-radius: 18px;
    }

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

    .section-title {
        align-items: start;
    }

    .section-actions {
        max-width: 150px;
    }

    .stats-hero {
        border-radius: 30px;
        padding: 18px;
    }

    .stats-hero h2 {
        font-size: 2.12rem;
    }

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

    .heat-cell {
        min-height: 46px;
    }

    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .app-tabs {
        display: none;
    }

    .metric-grid article {
        gap: 7px;
        padding: 11px;
        border-radius: 22px;
    }

    .metric-icon {
        width: 34px;
        height: 34px;
        border-radius: 13px;
    }

    .metric-icon svg {
        width: 18px;
        height: 18px;
    }

    .metric-grid strong {
        font-size: 1.72rem;
    }

    .metric-grid article > span:last-child {
        font-size: 0.67rem;
        line-height: 1.12;
    }

    .ai-panel {
        gap: 12px;
        padding: 16px;
    }

    .ai-copy {
        align-items: start;
    }

    .ai-button {
        width: 100%;
    }

    .ai-result {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
        padding: 13px;
        font-size: 0.94rem;
    }

    .ai-result-icon {
        width: 36px;
        height: 36px;
        border-radius: 14px;
    }

    .habit-stat-card {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .habit-stat-numbers {
        grid-column: 2;
        text-align: left;
    }

    .bottom-nav {
        display: grid;
    }
}
