:root {
    --ink: #151518;
    --muted: #6b6b72;
    --canvas: #f2f2f7;
    --surface: #ffffff;
    --surface-secondary: #f7f7fa;
    --line: #dedee3;
    --brand: #1675d1;
    --brand-dark: #0d5da9;
    --brand-soft: #e8f2fc;
    --done: #278943;
    --danger: #d13b34;
    --warning: #b86409;
    --today: #d67b13;
    --tomorrow: #167c8c;
    --upcoming: #347a47;
    --goal: #6554a3;
    --manual: #725b39;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    --radius: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--canvas);
}

button,
input,
select,
textarea {
    font: inherit;
}

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

a {
    color: inherit;
}

[hidden] {
    display: none !important;
}

.site-shell {
    width: min(100%, 920px);
    margin: 0 auto;
    padding: 0 16px 48px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    gap: 16px;
    border-bottom: 1px solid rgba(20, 37, 31, 0.1);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px 12px 12px 4px;
    color: white;
    background: var(--brand);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 0.95rem;
    letter-spacing: -0.02em;
}

.brand small,
.account-name {
    color: var(--muted);
    font-size: 0.72rem;
}

.account-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.account-nav a {
    border-radius: 999px;
    padding: 7px 10px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    text-decoration: none;
}

.account-nav a:hover {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.account-nav a[aria-current="page"] {
    color: var(--brand-dark);
    background: var(--brand-soft);
}

.compact-heading {
    margin-bottom: 18px;
}

.data-control-grid {
    display: grid;
    gap: 14px;
}

.data-control-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    background: rgba(255, 254, 249, 0.96);
    box-shadow: 0 6px 22px rgba(31, 55, 45, 0.045);
}

.data-control-card h2 {
    margin-bottom: 5px;
}

.data-control-card p {
    max-width: 66ch;
}

.data-control-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 12px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 1.15rem;
    font-weight: 900;
}

.danger-card {
    border-color: #edcbc6;
}

.danger-icon {
    color: var(--danger);
    background: #fae9e7;
}

.delete-account-form {
    display: grid;
    max-width: 520px;
    gap: 10px;
    margin-top: 16px;
}

.delete-account-form label:not(.check-row) {
    color: var(--ink);
    font-size: 0.83rem;
    font-weight: 700;
}

.delete-account-form input[type="text"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--ink);
    background: white;
    font: inherit;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--muted);
    font-size: 0.8rem;
}

.check-row input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

.danger-button {
    justify-self: start;
    border: 0;
    border-radius: 10px;
    padding: 11px 14px;
    color: white;
    background: var(--danger);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 800;
    cursor: pointer;
}

.danger-button:hover {
    filter: brightness(0.92);
}

.field-error {
    margin: -4px 0 0;
    color: var(--danger);
    font-size: 0.78rem;
}

.account-menu {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.account-name {
    max-width: 142px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-button {
    min-height: 28px;
    padding: 0;
    border: 0;
    color: var(--brand);
    background: transparent;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

main {
    padding-top: 28px;
}

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

h1,
h2 {
    letter-spacing: -0.035em;
}

h1 {
    margin-bottom: 7px;
    font-size: clamp(1.85rem, 8vw, 3rem);
    line-height: 1.04;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.lede,
.page-heading p,
.form-heading > p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.primary-button,
.secondary-button,
.complete-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 13px;
    padding: 10px 15px;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 750;
    cursor: pointer;
}

.primary-button {
    border: 1px solid var(--brand);
    color: white;
    background: var(--brand);
    box-shadow: 0 8px 20px rgba(15, 105, 79, 0.18);
}

.primary-button:hover {
    background: var(--brand-dark);
}

.secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: var(--surface);
}

.complete-button {
    border: 1px solid var(--brand);
    color: white;
    background: var(--brand);
    box-shadow: 0 7px 18px rgba(15, 105, 79, 0.16);
}

.complete-button:hover {
    background: var(--brand-dark);
}

.card-actions,
.detail-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.icon-button {
    display: inline-grid;
    width: 42px;
    min-width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0;
    color: var(--muted);
    background: var(--surface);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
}

.icon-button:hover {
    color: var(--brand-dark);
    border-color: #9ec8b6;
}

.danger-text:hover {
    color: var(--danger);
    border-color: #e5b8b3;
}

.flash,
.error-summary {
    margin-bottom: 20px;
    border-radius: 14px;
    padding: 13px 15px;
    font-size: 0.86rem;
}

.flash {
    border: 1px solid #b9ddca;
    color: #155840;
    background: #e7f5ed;
}

.error-summary {
    border: 1px solid #efc0bc;
    color: #792b27;
    background: #fff0ef;
}

.error-summary ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.login-panel {
    width: min(100%, 600px);
    margin: 8vh auto 0;
    border: 1px solid rgba(20, 37, 31, 0.09);
    border-radius: 28px;
    padding: clamp(24px, 6vw, 42px);
    background: rgba(255, 254, 249, 0.92);
    box-shadow: var(--shadow);
}

.account-list {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.account-choice {
    display: grid;
    width: 100%;
    min-height: 64px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 14px;
    color: var(--ink);
    background: white;
    text-align: left;
    cursor: pointer;
}

.account-choice:hover {
    border-color: #9ec8b6;
    background: #f7fbf8;
}

.account-choice strong,
.account-choice small {
    display: block;
}

.account-choice small {
    margin-top: 2px;
    color: var(--muted);
}

.account-avatar {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-weight: 800;
}

.activity-list {
    display: grid;
    gap: 11px;
}

.activity-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 254, 249, 0.96);
    box-shadow: 0 6px 22px rgba(31, 55, 45, 0.045);
}

.activity-card.is-inactive {
    opacity: 0.68;
}

.activity-main {
    padding: 16px;
}

.activity-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.activity-title-row h2 {
    margin-bottom: 2px;
    font-size: 1.08rem;
    line-height: 1.25;
}

.activity-category {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.status-pill {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 6px 9px;
    color: var(--muted);
    background: #edf0ec;
    font-size: 0.7rem;
    font-weight: 800;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-overdue { color: var(--danger); background: #fae9e7; }
.status-today { color: var(--warning); background: #fff0d9; }
.status-tomorrow { color: var(--tomorrow); background: #e2f1f5; }
.status-upcoming { color: var(--upcoming); background: #e6f2e8; }
.status-goal { color: var(--goal); background: #eeeaf8; }
.status-manual { color: var(--manual); background: #f3ede3; }

.activity-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
    border-top: 1px solid #e8ece6;
    padding-top: 12px;
}

.activity-facts span,
.activity-facts small,
.activity-facts strong {
    display: block;
}

.activity-facts small {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.activity-facts strong {
    font-size: 0.8rem;
    line-height: 1.3;
}

.fact-wide {
    grid-column: 1 / -1;
}

.activity-note {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.activity-footer {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 8px 10px 8px 16px;
    background: rgba(242, 245, 238, 0.55);
}

.activity-meta {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.detail-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.detail-hero h1 {
    margin-bottom: 5px;
}

.detail-hero > div > p:last-child,
.completion-heading > p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.detail-title-line,
.history-title-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.detail-title-line .eyebrow {
    margin-bottom: 0;
}

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

.metric-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 12px;
    background: rgba(255, 254, 249, 0.82);
}

.metric-card small,
.metric-card strong {
    display: block;
}

.metric-card small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 750;
    text-transform: uppercase;
}

.metric-card strong {
    overflow: hidden;
    font-size: 0.83rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-grid {
    display: grid;
    gap: 14px;
}

.detail-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px;
    background: rgba(255, 254, 249, 0.96);
    box-shadow: 0 8px 30px rgba(31, 55, 45, 0.04);
}

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

.panel-heading .eyebrow {
    margin-bottom: 3px;
}

.panel-heading h2 {
    margin-bottom: 0;
    font-size: 1.05rem;
}

.panel-count {
    display: grid;
    min-width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 999px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 0.76rem;
    font-weight: 800;
}

.quick-plan-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 9px;
}

.support-copy {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.4;
}

.planned-date-list,
.history-list {
    display: grid;
    gap: 0;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.planned-date-list li,
.history-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    border-top: 1px solid #e8ece6;
    padding: 11px 0;
}

.planned-date-list li:last-child,
.history-list li:last-child {
    padding-bottom: 0;
}

.date-tile {
    display: grid;
    width: 48px;
    min-width: 48px;
    min-height: 53px;
    place-items: center;
    align-content: center;
    border-radius: 12px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    line-height: 1.05;
}

.date-tile strong {
    font-size: 1.05rem;
}

.date-tile small {
    font-size: 0.56rem;
    font-weight: 800;
}

.planned-date-copy,
.history-copy {
    min-width: 0;
    flex: 1;
}

.planned-date-copy strong,
.planned-date-copy small,
.history-copy small {
    display: block;
}

.planned-date-copy strong,
.history-copy strong {
    font-size: 0.8rem;
}

.planned-date-copy small,
.history-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.66rem;
}

.history-marker {
    display: grid;
    width: 34px;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--brand);
    font-size: 0.75rem;
    font-weight: 900;
}

.history-copy p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.feeling-tag {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 7px;
    color: var(--muted);
    background: #edf0ec;
    font-size: 0.62rem;
    font-weight: 800;
}

.feeling-great,
.feeling-good { color: var(--brand-dark); background: var(--brand-soft); }
.feeling-hard { color: var(--warning); background: #fff0d9; }
.feeling-wornOut { color: var(--danger); background: #fae9e7; }

.inline-empty {
    display: flex;
    min-height: 86px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px dashed #c9d2ca;
    border-radius: 14px;
    padding: 18px;
    color: var(--muted);
    background: rgba(242, 245, 238, 0.48);
    text-align: center;
}

.inline-empty p {
    margin: 0;
    font-size: 0.78rem;
}

.calendar-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.calendar-heading h1 {
    margin-bottom: 7px;
}

.calendar-heading > div > p:last-child {
    max-width: 52ch;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.5;
}

.calendar-summary {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.calendar-summary span,
.day-total {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--muted);
    background: rgba(255, 254, 249, 0.8);
    font-size: 0.7rem;
    font-weight: 750;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
}

.legend-done {
    background: var(--brand);
}

.legend-planned {
    background: var(--tomorrow);
}

.legend-suggested {
    background: var(--today);
}

.calendar-panel,
.day-detail-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    background: rgba(255, 254, 249, 0.96);
    box-shadow: 0 8px 30px rgba(31, 55, 45, 0.04);
}

.month-toolbar {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    text-align: center;
}

.month-toolbar h2,
.month-toolbar small {
    display: block;
    margin: 0;
}

.month-toolbar h2 {
    font-size: 1.2rem;
}

.month-toolbar small {
    margin-bottom: 1px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing: 0.08em;
}

.month-button {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--brand-dark);
    background: var(--surface);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 850;
}

.month-button:hover {
    border-color: #9ec8b6;
    background: var(--brand-soft);
}

.weekday-row,
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.weekday-row {
    margin-bottom: 5px;
}

.weekday-row span {
    color: var(--muted);
    text-align: center;
    font-size: 0.64rem;
    font-weight: 800;
}

.calendar-day {
    display: grid;
    min-width: 0;
    min-height: 72px;
    align-content: space-between;
    justify-items: center;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 7px 4px 6px;
    color: var(--ink);
    background: #f5f7f2;
    text-decoration: none;
}

.calendar-day:hover {
    border-color: #b9d6c8;
    background: #eef7f2;
}

.calendar-day.is-outside {
    opacity: 0.38;
}

.calendar-day.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px var(--brand);
}

.calendar-day.is-today .day-number {
    color: white;
    background: var(--brand);
}

.day-number {
    display: grid;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 50%;
    font-size: 0.76rem;
    font-weight: 800;
}

.day-markers {
    display: flex;
    min-height: 17px;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.day-marker {
    display: grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    border-radius: 999px;
    padding: 0 4px;
    color: white;
    font-size: 0.54rem;
    font-weight: 850;
    line-height: 1;
}

.marker-done {
    background: var(--brand);
}

.marker-planned {
    background: var(--tomorrow);
}

.marker-suggested {
    background: var(--today);
}

.day-detail-panel {
    margin-top: 14px;
}

.day-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.day-detail-heading .eyebrow {
    margin-bottom: 3px;
}

.day-detail-heading h2 {
    margin-bottom: 0;
    font-size: 1.15rem;
}

.calendar-empty {
    min-height: 72px;
}

.day-section + .day-section {
    margin-top: 16px;
}

.day-section h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.day-event-list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.day-event-list li {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    border-top: 1px solid #e8ece6;
    padding: 10px 0;
}

.day-event-list li > div:not(.day-event-actions) {
    min-width: 0;
    flex: 1;
}

.day-event-list a:not(.compact-complete-button) {
    font-size: 0.84rem;
    font-weight: 800;
    text-decoration: none;
}

.day-event-list a:not(.compact-complete-button):hover {
    color: var(--brand);
}

.day-event-list small,
.day-event-list p {
    display: block;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.68rem;
}

.day-event-list p {
    margin-top: 5px;
    line-height: 1.4;
}

.day-event-icon {
    display: grid;
    width: 34px;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    color: white;
    font-size: 0.72rem;
    font-weight: 900;
}

.day-event-icon.is-done {
    background: var(--brand);
}

.day-event-icon.is-planned {
    background: var(--tomorrow);
}

.day-event-icon.is-suggested {
    color: #6f3d08;
    background: #f5d8b4;
}

.day-event-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.compact-complete-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    padding: 8px 11px;
    color: white;
    background: var(--brand);
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 800;
}

.compact-plan-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid #d2a66f;
    border-radius: 11px;
    padding: 7px 10px;
    color: #724108;
    background: #fff7eb;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.compact-plan-button:hover {
    background: #f9e7ce;
}

.projection-note {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.45;
}

.calendar-plan-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 9px;
    margin-top: 16px;
    border-top: 1px solid var(--line);
    padding-top: 15px;
}

.completion-heading {
    margin-bottom: 18px;
}

.completion-form {
    display: grid;
    gap: 12px;
}

.compact-form-card {
    padding: 16px;
}

.feeling-picker {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.feeling-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.feeling-option span {
    display: grid;
    min-height: 68px;
    place-items: center;
    align-content: center;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    color: var(--muted);
    background: white;
    cursor: pointer;
}

.feeling-option b {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 0.86rem;
}

.feeling-option small {
    font-size: 0.63rem;
    font-weight: 750;
}

.feeling-option input:checked + span {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: #f3faf6;
    box-shadow: 0 0 0 2px rgba(15, 105, 79, 0.11);
}

.feeling-option input:focus-visible + span {
    outline: 3px solid rgba(15, 105, 79, 0.22);
    outline-offset: 2px;
}

.recovery-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    border-radius: 13px;
    padding: 11px 12px;
    color: #744b13;
    background: #fff3df;
}

.recovery-choice strong,
.recovery-choice small {
    display: block;
}

.recovery-choice strong {
    font-size: 0.78rem;
}

.recovery-choice small {
    margin-top: 2px;
    font-size: 0.67rem;
}

.recovery-choice > div {
    min-width: 0;
}

.switch-control {
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 26px;
}

.switch-control input {
    position: absolute;
    inset: 0;
    width: 44px;
    min-height: 26px;
    margin: 0;
    padding: 0;
    opacity: 0;
}

.switch-control span {
    position: relative;
    display: block;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: #d8c9b4;
    cursor: pointer;
}

.switch-control span::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(20, 37, 31, 0.2);
    content: "";
    transition: transform 160ms ease;
}

.switch-control input:checked + span {
    background: var(--brand);
}

.switch-control input:checked + span::after {
    transform: translateX(18px);
}

.debug-version {
    display: inline-block;
    margin-left: 6px;
    border: 1px solid #cfd6cd;
    border-radius: 6px;
    padding: 1px 5px;
    font-family: ui-monospace, monospace;
    font-size: 0.65rem;
}

.empty-state {
    display: grid;
    min-height: 310px;
    place-items: center;
    align-content: center;
    border: 1px dashed #bcc9c0;
    border-radius: 24px;
    padding: 28px;
    background: rgba(255, 254, 249, 0.6);
    text-align: center;
}

.empty-state.compact {
    min-height: 140px;
}

.empty-state h2 {
    margin: 12px 0 5px;
    font-size: 1.2rem;
}

.empty-state p,
.empty-state span {
    color: var(--muted);
}

.empty-state .primary-button {
    margin-top: 14px;
}

.empty-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 16px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 1.5rem;
}

.form-heading {
    margin-bottom: 22px;
}

.back-link {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    margin-bottom: 20px;
    color: var(--brand);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 750;
}

.activity-form {
    display: grid;
    gap: 14px;
}

.form-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    background: rgba(255, 254, 249, 0.96);
    box-shadow: 0 8px 30px rgba(31, 55, 45, 0.04);
}

.section-heading {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.section-heading > span {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 10px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 0.68rem;
    font-weight: 850;
}

.section-heading h2 {
    margin-bottom: 2px;
    font-size: 1rem;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.field,
.pause-fields {
    display: grid;
    gap: 7px;
}

.field + .field,
.field + .field-grid,
.field-grid + .field,
.toggle-row + .toggle-row,
.toggle-row + .pause-fields {
    margin-top: 14px;
}

.field > span {
    font-size: 0.78rem;
    font-weight: 750;
}

.field small {
    color: var(--muted);
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbd4cc;
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--ink);
    background: white;
    outline: none;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 105, 79, 0.12);
}

.field-grid {
    display: grid;
    gap: 14px;
}

.mode-explanation {
    margin: 14px 0 0;
    border-radius: 12px;
    padding: 11px 12px;
    color: var(--muted);
    background: #f0f3ee;
    font-size: 0.78rem;
    line-height: 1.45;
}

.toggle-row {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 10px 12px;
}

.toggle-row strong,
.toggle-row small {
    display: block;
}

.toggle-row strong {
    font-size: 0.82rem;
}

.toggle-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.35;
}

.toggle-row input {
    width: 22px;
    min-height: 22px;
    accent-color: var(--brand);
}

.pause-fields {
    grid-template-columns: 1fr;
    border-left: 3px solid var(--brand-soft);
    padding-left: 12px;
}

.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 10px;
    border: 1px solid rgba(20, 37, 31, 0.1);
    border-radius: 17px;
    padding: 9px;
    background: rgba(242, 245, 238, 0.94);
    box-shadow: 0 -10px 30px rgba(31, 55, 45, 0.08);
    backdrop-filter: blur(12px);
}

@media (min-width: 620px) {
    .site-shell {
        padding-inline: 24px;
    }

    .activity-main {
        padding: 18px 20px;
    }

    .activity-facts {
        grid-template-columns: 1fr 1fr 1.5fr;
    }

    .fact-wide {
        grid-column: auto;
    }

    .field-grid,
    .pause-fields {
        grid-template-columns: 1fr 1fr;
    }

    .form-card {
        padding: 22px;
    }

    .form-actions {
        position: static;
        grid-template-columns: auto auto;
        justify-content: end;
        border: 0;
        padding: 4px 0 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
    }

    .detail-grid {
        grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
        align-items: start;
    }

    .completion-form {
        width: min(100%, 680px);
    }
}

@media (max-width: 619px) {
    .site-header {
        flex-wrap: wrap;
        padding: 12px 0 10px;
    }

    .account-nav {
        width: 100%;
        order: 3;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        border-top: 1px solid rgba(20, 37, 31, 0.08);
        padding-top: 8px;
    }

    .account-nav a {
        padding-inline: 6px;
        text-align: center;
    }

    .calendar-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .calendar-summary {
        justify-content: flex-start;
    }

    .calendar-panel,
    .day-detail-panel {
        padding: 12px;
    }

    .weekday-row,
    .month-grid {
        gap: 3px;
    }

    .calendar-day {
        min-height: 57px;
        border-radius: 9px;
        padding: 4px 2px;
    }

    .day-number {
        width: 23px;
        height: 23px;
        font-size: 0.68rem;
    }

    .day-markers {
        gap: 2px;
    }

    .day-marker {
        min-width: 15px;
        height: 15px;
        padding: 0 3px;
        font-size: 0.49rem;
    }

    .calendar-plan-form {
        grid-template-columns: 1fr;
    }

    .calendar-plan-form .secondary-button {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading .primary-button {
        align-self: flex-start;
    }

    .activity-title-row {
        align-items: flex-start;
    }

    .status-pill {
        max-width: 112px;
    }

    .activity-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 10px 12px;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions .complete-button,
    .card-actions .secondary-button {
        flex: 1;
        padding-inline: 10px;
    }

    .detail-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-actions > * {
        flex: 1;
    }

    .metric-card {
        padding: 10px 8px;
    }

    .metric-card small {
        font-size: 0.57rem;
    }

    .metric-card strong {
        font-size: 0.72rem;
    }

    .quick-plan-form {
        grid-template-columns: 1fr;
    }

    .quick-plan-form .secondary-button {
        width: 100%;
    }

    .history-title-line {
        align-items: flex-start;
    }

    .day-event-list li {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .day-event-actions {
        width: 100%;
        justify-content: flex-end;
        padding-left: 44px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .activity-card,
    .form-card,
    .login-panel {
        animation: reveal 320ms ease-out both;
    }

    .activity-card:nth-child(2) { animation-delay: 45ms; }
    .activity-card:nth-child(3) { animation-delay: 90ms; }
    .activity-card:nth-child(4) { animation-delay: 135ms; }

    @keyframes reveal {
        from { opacity: 0; transform: translateY(7px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* iPhone-aligned visual system */
.site-shell {
    width: min(100%, 900px);
    padding-bottom: 44px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 64px;
    border-bottom-color: rgba(60, 60, 67, 0.16);
    background: rgba(242, 242, 247, 0.88);
    backdrop-filter: blur(18px) saturate(1.4);
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--brand);
    font-size: 0.65rem;
}

.brand strong {
    font-size: 0.88rem;
}

.brand small,
.account-name {
    font-size: 0.67rem;
}

.account-nav a {
    border-radius: 9px;
    padding: 7px 11px;
    font-size: 0.75rem;
    font-weight: 650;
}

.account-nav a[aria-current="page"] {
    color: var(--brand);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.app-main {
    padding-top: 24px;
}

.content-column {
    width: min(100%, 760px);
    margin-inline: auto;
}

h1,
h2 {
    letter-spacing: -0.025em;
}

h1 {
    font-size: clamp(1.7rem, 5vw, 2.2rem);
    line-height: 1.08;
}

.eyebrow {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
}

.page-heading,
.calendar-heading {
    align-items: center;
    margin-bottom: 16px;
}

.page-heading p,
.calendar-heading > div > p:last-child,
.form-heading > p:last-child {
    line-height: 1.4;
}

.primary-button,
.secondary-button,
.complete-button {
    min-height: 42px;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 0.8rem;
    font-weight: 650;
    box-shadow: none;
}

.primary-button {
    border-color: var(--brand);
    background: var(--brand);
}

.secondary-button {
    border-color: rgba(60, 60, 67, 0.18);
    background: var(--surface);
}

.complete-button,
.compact-complete-button {
    border-color: var(--done);
    background: var(--done);
    box-shadow: none;
}

.complete-button:hover,
.compact-complete-button:hover {
    background: #1f7137;
}

.icon-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    border-color: transparent;
    border-radius: 10px;
    background: var(--surface-secondary);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.today-focus-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 14px;
    padding: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.focus-icon {
    display: grid;
    width: 30px;
    min-width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    color: var(--done);
    background: rgba(39, 137, 67, 0.13);
    font-size: 0.78rem;
    font-weight: 800;
}

.focus-icon.is-overdue {
    color: var(--danger);
    background: rgba(209, 59, 52, 0.12);
}

.focus-icon.is-today {
    color: var(--today);
    background: rgba(214, 123, 19, 0.13);
}

.today-focus-card div,
.today-focus-card small,
.today-focus-card strong,
.today-focus-card span {
    display: block;
}

.today-focus-card small {
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.67rem;
    font-weight: 650;
}

.today-focus-card strong {
    font-size: 0.9rem;
    line-height: 1.25;
}

.today-focus-card div > span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
}

.activity-list {
    gap: 7px;
}

.activity-card {
    border-color: rgba(60, 60, 67, 0.14);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.activity-main {
    padding: 12px;
}

.activity-title-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
}

.activity-identity {
    min-width: 0;
}

.activity-title-row h2 {
    overflow: hidden;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-category {
    overflow: hidden;
    margin-top: 2px;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-icon {
    display: grid;
    width: 34px;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: #6b6b72;
    background: #ededf1;
    font-size: 0.85rem;
    font-weight: 750;
}

.category-strength { color: #2563b9; background: #e7f0fd; }
.category-cardio { color: #c83a43; background: #fce9eb; }
.category-mobility { color: #2b8551; background: #e6f5eb; }
.category-rehab { color: #167c8c; background: #e3f3f5; }
.category-sport { color: #b9660c; background: #fcf0df; }
.category-daily { color: #5b50a0; background: #eeebfa; }

.status-pill {
    gap: 5px;
    padding: 5px 7px;
    font-size: 0.62rem;
    font-weight: 700;
}

.status-dot {
    width: 5px;
    height: 5px;
}

.activity-schedule-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    border-top: 1px solid rgba(60, 60, 67, 0.1);
    padding-top: 9px;
}

.schedule-symbol,
.calendar-glyph {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 15px;
    border: 1.5px solid currentColor;
    border-radius: 4px;
    color: var(--muted);
}

.schedule-symbol::before,
.calendar-glyph::before {
    position: absolute;
    top: 3px;
    right: 1px;
    left: 1px;
    border-top: 1.5px solid currentColor;
    content: "";
}

.activity-schedule-row > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.activity-schedule-row small,
.activity-schedule-row strong {
    display: block;
}

.activity-schedule-row small {
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 650;
}

.activity-schedule-row strong {
    margin-top: 1px;
    font-size: 0.75rem;
    font-weight: 650;
}

.schedule-detail {
    color: var(--muted);
    font-size: 0.67rem;
    white-space: nowrap;
}

.activity-note {
    margin-top: 8px;
    font-size: 0.72rem;
}

.activity-footer {
    min-height: 50px;
    border-top-color: rgba(60, 60, 67, 0.1);
    padding: 6px 8px 6px 12px;
    background: var(--surface);
}

.activity-meta {
    font-size: 0.68rem;
    font-weight: 500;
}

.card-actions {
    gap: 5px;
}

.card-actions .complete-button,
.card-actions .secondary-button {
    min-height: 38px;
    padding: 7px 11px;
    font-size: 0.72rem;
}

.detail-identity-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon-large {
    width: 44px;
    min-width: 44px;
    height: 44px;
    font-size: 1rem;
}

.detail-hero {
    align-items: center;
}

.detail-hero h1 {
    font-size: 1.7rem;
}

.metric-card,
.detail-panel,
.form-card,
.data-control-card,
.calendar-panel,
.day-detail-panel,
.login-panel {
    border-color: rgba(60, 60, 67, 0.14);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 10px;
}

.detail-panel,
.form-card,
.data-control-card {
    padding: 14px;
}

.section-heading {
    grid-template-columns: 1fr;
    gap: 2px;
    margin-bottom: 14px;
}

.section-heading > span {
    display: none;
}

.section-heading h2 {
    font-size: 0.92rem;
}

.section-heading p {
    font-size: 0.7rem;
}

input,
select,
textarea {
    min-height: 44px;
    border-color: rgba(60, 60, 67, 0.22);
    border-radius: 10px;
    background: var(--surface-secondary);
}

.toggle-row,
.mode-explanation {
    border-radius: 10px;
    background: var(--surface-secondary);
}

.form-actions {
    border-color: rgba(60, 60, 67, 0.14);
    border-radius: 13px;
    background: rgba(242, 242, 247, 0.92);
}

.calendar-panel,
.day-detail-panel {
    padding: 12px;
}

.month-toolbar {
    grid-template-columns: 40px 1fr 40px;
    margin-bottom: 12px;
}

.month-button {
    width: 38px;
    height: 38px;
    border-color: rgba(60, 60, 67, 0.18);
    border-radius: 10px;
    color: var(--brand);
    background: var(--surface-secondary);
}

.weekday-row,
.month-grid {
    gap: 5px;
}

.calendar-day {
    min-height: 54px;
    border-radius: 8px;
    background: var(--surface-secondary);
}

.calendar-day.is-selected {
    border-color: rgba(22, 117, 209, 0.5);
    background: rgba(22, 117, 209, 0.12);
    box-shadow: none;
}

.calendar-day.is-today .day-number {
    background: var(--brand);
}

.day-number {
    width: 23px;
    height: 23px;
    font-size: 0.68rem;
}

.day-marker {
    min-width: 13px;
    height: 13px;
    font-size: 0.43rem;
}

.marker-done,
.legend-done,
.day-event-icon.is-done {
    background: var(--done);
}

.day-detail-heading {
    margin-bottom: 10px;
}

.day-event-list li {
    padding: 9px 0;
}

.day-category-icon {
    width: 32px;
    min-width: 32px;
    height: 32px;
}

.compact-plan-button,
.compact-complete-button {
    min-height: 38px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.mobile-tab-bar {
    display: none;
}

@media (max-width: 619px) {
    .site-shell {
        padding: 0 12px 104px;
    }

    .site-header {
        min-height: 58px;
        padding-block: 8px;
    }

    .brand small,
    .account-nav,
    .account-name {
        display: none;
    }

    .account-menu {
        margin-left: auto;
    }

    .app-main {
        padding-top: 16px;
    }

    .mobile-tab-bar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        min-height: 74px;
        border-top: 1px solid rgba(60, 60, 67, 0.2);
        padding: 7px max(10px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        background: rgba(248, 248, 250, 0.9);
        backdrop-filter: blur(20px) saturate(1.5);
    }

    .mobile-tab-bar a {
        display: grid;
        justify-items: center;
        align-content: center;
        gap: 3px;
        min-height: 48px;
        border-radius: 10px;
        color: var(--muted);
        text-decoration: none;
        font-size: 0.61rem;
        font-weight: 600;
    }

    .mobile-tab-bar a[aria-current="page"] {
        color: var(--brand);
    }

    .mobile-tab-icon {
        display: grid;
        min-width: 24px;
        height: 22px;
        place-items: center;
        font-size: 1rem;
        font-weight: 700;
        letter-spacing: 0.08em;
    }

    .mobile-tab-bar .calendar-glyph {
        width: 20px;
        height: 19px;
        color: currentColor;
    }

    .page-heading,
    .calendar-heading {
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 14px;
    }

    .page-heading .primary-button {
        align-self: auto;
    }

    .calendar-summary {
        gap: 5px;
    }

    .calendar-summary span,
    .day-total {
        min-height: 27px;
        padding: 4px 8px;
        font-size: 0.62rem;
    }

    .activity-title-row {
        align-items: start;
    }

    .status-pill {
        margin-top: 2px;
    }

    .activity-footer {
        align-items: center;
        flex-direction: row;
    }

    .card-actions {
        width: auto;
    }

    .card-actions .complete-button,
    .card-actions .secondary-button {
        flex: none;
    }

    .detail-hero {
        align-items: stretch;
    }

    .calendar-day {
        min-height: 50px;
    }

    .day-event-actions {
        padding-left: 41px;
    }
}

@media (max-width: 374px) {
    .site-shell {
        padding-inline: 10px;
    }

    .activity-meta {
        display: none;
    }

    .activity-footer {
        justify-content: flex-end;
    }

    .card-actions .secondary-button {
        padding-inline: 9px;
    }

    .calendar-panel,
    .day-detail-panel {
        padding: 10px;
    }

    .weekday-row,
    .month-grid {
        gap: 3px;
    }

    .calendar-day {
        min-height: 47px;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #f2f2f4;
        --muted: #a7a7ae;
        --canvas: #000000;
        --surface: #1c1c1e;
        --surface-secondary: #2c2c2e;
        --line: #38383a;
        --brand: #4aa3ff;
        --brand-dark: #75b9ff;
        --brand-soft: rgba(74, 163, 255, 0.16);
        --done: #46a65d;
    }

    .site-header,
    .form-actions {
        background: rgba(0, 0, 0, 0.82);
    }

    .mobile-tab-bar {
        background: rgba(28, 28, 30, 0.9);
    }

    .status-overdue { background: rgba(209, 59, 52, 0.18); }
    .status-today { background: rgba(214, 123, 19, 0.18); }
    .status-tomorrow { background: rgba(22, 124, 140, 0.2); }
    .status-upcoming { background: rgba(52, 122, 71, 0.22); }
    .status-goal { background: rgba(101, 84, 163, 0.24); }
    .status-manual { background: rgba(114, 91, 57, 0.28); }

    .category-strength { background: rgba(37, 99, 185, 0.24); }
    .category-cardio { background: rgba(200, 58, 67, 0.22); }
    .category-mobility { background: rgba(43, 133, 81, 0.24); }
    .category-rehab { background: rgba(22, 124, 140, 0.24); }
    .category-sport { background: rgba(185, 102, 12, 0.24); }
    .category-daily { background: rgba(91, 80, 160, 0.27); }

    .flash { color: #8ee0ad; background: rgba(39, 137, 67, 0.2); }
    .error-summary { color: #ffaaa5; background: rgba(209, 59, 52, 0.18); }
}
