@font-face { font-family: "Alva Sans"; src: local("Aptos"), local("Segoe UI Variable"), local("Segoe UI"); }
@font-face { font-family: "Alva Display"; src: local("Georgia Pro"), local("Georgia"); }

:root {
    color-scheme: light;
    --background: #f4f0e8;
    --surface: #fffdf8;
    --surface-raised: #ffffff;
    --surface-muted: #f7f4ed;
    --text: #22312a;
    --text-soft: #42534b;
    --muted: #718078;
    --border: #dddcd2;
    --border-strong: #c9cec8;
    --primary: #3f6756;
    --primary-strong: #294a3d;
    --primary-soft: #dfece5;
    --food: #b86e35;
    --food-strong: #7f441e;
    --food-soft: #f7e4ce;
    --symptom: #ad5f63;
    --symptom-strong: #824348;
    --symptom-soft: #f7e2e1;
    --info-soft: #e5edf2;
    --danger: #a53d3d;
    --danger-soft: #fae8e5;
    --focus: rgba(63, 103, 86, .32);
    --shadow-sm: 0 6px 20px rgba(42, 53, 47, .06);
    --shadow: 0 18px 50px rgba(42, 53, 47, .10);
    --radius-sm: .7rem;
    --radius-md: 1rem;
    --radius-lg: 1.35rem;
    --radius-xl: 1.8rem;
    --font-display: "Alva Display", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--background); color: var(--text); font-family: "Alva Sans", system-ui, sans-serif; overflow-x: hidden; scroll-behavior: smooth; }
body { background: radial-gradient(circle at 88% 2%, rgba(214, 229, 217, .42), transparent 29rem), var(--background); margin: 0; min-width: 320px; overflow-x: clip; }
button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .65; }
img, svg { max-width: 100%; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--text); line-height: 1.12; }
h1 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.025em; }
h1:focus, h2:focus, h3:focus { outline: 0; }
a, button, input, textarea, select, summary { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { box-shadow: 0 0 0 4px var(--focus); outline: 0; }

.primary-button, .secondary-button, .quiet-button, .danger-button { align-items: center; border: 0; border-radius: var(--radius-md); cursor: pointer; display: inline-flex; font-weight: 760; gap: .5rem; justify-content: center; min-height: 3.15rem; padding: .7rem 1.15rem; text-decoration: none; transition: box-shadow .18s ease, transform .18s ease, background .18s ease; }
.primary-button { background: var(--primary); box-shadow: 0 9px 20px rgba(47, 85, 69, .18); color: white; }
.primary-button:hover { background: var(--primary-strong); box-shadow: 0 12px 24px rgba(47, 85, 69, .23); transform: translateY(-1px); }
.secondary-button { background: var(--primary-soft); color: var(--primary-strong); }
.secondary-button:hover { background: #d3e5dc; }
.quiet-button { background: var(--surface-muted); color: var(--text-soft); }
.danger-button { background: var(--danger-soft); color: var(--danger); }

.form-control { background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md); color: var(--text); min-height: 3.35rem; min-width: 0; padding: .78rem .9rem; transition: border .16s ease, box-shadow .16s ease; width: 100%; }
.form-control::placeholder { color: #96a099; }
.form-control:hover { border-color: #aeb8b2; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus); }
.field-label { color: var(--text-soft); display: block; font-size: .8rem; font-weight: 760; margin: 1.2rem 0 .42rem; }
.field-hint { color: var(--muted); display: block; font-size: .73rem; font-weight: 520; margin-top: .25rem; }
.validation-message, .validation-errors, .text-danger { color: var(--danger); font-size: .8rem; margin-top: .35rem; }
.validation-errors { background: var(--danger-soft); border-radius: var(--radius-sm); padding: .7rem 1rem; }

.entry-page { margin: 0 auto; max-width: 47rem; padding-bottom: 1rem; }
.back-link { align-items: center; color: var(--text-soft); display: inline-flex; font-size: .82rem; font-weight: 720; gap: .35rem; margin-bottom: 1.15rem; min-height: 2.6rem; text-decoration: none; }
.back-link .app-icon { font-size: .85rem; }
.entry-heading { margin-bottom: 1.35rem; }
.entry-heading-top { align-items: center; display: flex; gap: .65rem; }
.entry-heading h1 { font-size: clamp(2rem, 7vw, 3.35rem); margin: .45rem 0 .4rem; }
.entry-heading p { color: var(--muted); line-height: 1.55; margin: 0; max-width: 38rem; }
.entry-kind { align-items: center; border-radius: 999px; display: inline-flex; font-size: .7rem; font-weight: 820; gap: .38rem; letter-spacing: .04em; min-height: 2rem; padding: .35rem .72rem; text-transform: uppercase; }
.entry-kind .app-icon { font-size: .8rem; }
.entry-kind.food { background: var(--food-soft); color: var(--food-strong); }
.entry-kind.symptom { background: var(--symptom-soft); color: var(--symptom-strong); }
.now-hint { align-items: center; color: var(--muted); display: inline-flex; font-size: .73rem; gap: .35rem; }
.now-hint .app-icon { font-size: .75rem; }
.entry-form { background: var(--surface); border: 1px solid rgba(206, 207, 197, .85); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); min-width: 0; padding: clamp(1rem, 4.2vw, 1.75rem); }
.large-input { font-size: 1.08rem; font-weight: 580; min-height: 3.85rem; }
.choice-fieldset, .tag-fieldset, .severity-fieldset { border: 0; margin: 1.5rem 0; min-width: 0; padding: 0; }
.choice-fieldset legend, .tag-fieldset legend, .severity-fieldset legend { color: var(--text-soft); font-size: .8rem; font-weight: 760; margin-bottom: .58rem; }
.choice-grid { display: grid; gap: .5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid label { cursor: pointer; min-width: 0; position: relative; }
.choice-grid input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.choice-grid span { align-items: center; background: var(--surface-muted); border: 1px solid transparent; border-radius: var(--radius-md); display: flex; flex-direction: column; font-size: .75rem; font-weight: 710; gap: .4rem; justify-content: center; min-height: 4.5rem; min-width: 0; padding: .55rem .35rem; text-align: center; }
.choice-grid span .app-icon { color: var(--muted); font-size: 1.25rem; }
.choice-grid input:checked + span { background: var(--food-soft); border-color: color-mix(in srgb, var(--food) 44%, transparent); color: var(--food-strong); }
.choice-grid input:checked + span .app-icon { color: var(--food); }
.choice-grid input:focus-visible + span { box-shadow: 0 0 0 4px var(--focus); }
.tag-fieldset small { color: var(--muted); font-weight: 520; }
.tag-grid { display: flex; flex-wrap: wrap; gap: .46rem; }
.tag-choice { align-items: center; background: var(--surface-muted); border: 1px solid transparent; border-radius: 999px; color: var(--text-soft); cursor: pointer; display: inline-flex; font-size: .76rem; font-weight: 660; gap: .35rem; min-height: 2.45rem; padding: .45rem .78rem; }
.tag-choice::before { border: 1.5px solid var(--border-strong); border-radius: 50%; content: ""; height: .78rem; width: .78rem; }
.tag-choice.selected { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--primary-strong); }
.tag-choice.selected::before { background: var(--primary); border: 3px solid var(--primary-soft); box-shadow: 0 0 0 1px var(--primary); }
.template-strip { display: flex; gap: .55rem; margin: -.2rem 0 1rem; overflow-x: auto; padding: .25rem .05rem .45rem; scrollbar-width: none; }
.template-strip::-webkit-scrollbar { display: none; }
.template-strip button { align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm); color: var(--text-soft); cursor: pointer; display: inline-flex; flex: 0 0 auto; font-size: .76rem; font-weight: 700; gap: .4rem; min-height: 2.6rem; padding: .48rem .8rem; white-space: nowrap; }
.detail-panel { border-top: 1px solid var(--border); margin-top: 1.65rem; padding-top: .2rem; }
.detail-panel summary { align-items: center; border-radius: var(--radius-sm); color: var(--primary-strong); cursor: pointer; display: flex; font-size: .82rem; font-weight: 780; gap: .55rem; list-style: none; min-height: 3.4rem; padding: .45rem .15rem; }
.detail-panel summary::-webkit-details-marker { display: none; }
.detail-panel summary::after { border-bottom: 1.7px solid currentColor; border-right: 1.7px solid currentColor; content: ""; height: .45rem; margin-left: auto; margin-right: .25rem; transform: rotate(45deg); transition: transform .2s ease; width: .45rem; }
.detail-panel[open] summary::after { transform: rotate(225deg); }
.detail-content { animation: reveal .2s ease; padding: .15rem 0 .4rem; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
.check-label { align-items: center; background: var(--surface-muted); border-radius: var(--radius-md); cursor: pointer; display: flex; font-size: .82rem; gap: .75rem; margin: 1rem 0; min-height: 3.35rem; padding: .65rem .8rem; }
.check-label input { accent-color: var(--primary); flex: 0 0 auto; height: 1.2rem; width: 1.2rem; }
.date-time-grid { display: grid; gap: .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.date-time-grid label { color: var(--text-soft); font-size: .75rem; font-weight: 710; min-width: 0; }
.date-time-grid .form-control { margin-top: .35rem; }
textarea.form-control { line-height: 1.5; min-height: 7rem; resize: vertical; }
.save-button { font-size: .94rem; margin-top: 1.45rem; width: 100%; }
.delete-button { align-items: center; background: transparent; border: 0; border-radius: var(--radius-md); color: var(--danger); cursor: pointer; display: flex; font-size: .78rem; font-weight: 700; gap: .45rem; justify-content: center; margin-top: .65rem; min-height: 2.8rem; width: 100%; }
.severity-grid { display: grid; gap: .5rem; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.symptom-kind-fieldset, .duration-fieldset { border: 0; margin: 0 0 1.5rem; min-width: 0; padding: 0; }
.symptom-kind-fieldset legend, .duration-fieldset legend { color: var(--text-soft); font-size: .8rem; font-weight: 760; margin-bottom: .58rem; }
.symptom-kind-grid { display: grid; gap: .48rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.symptom-kind { align-items: center; background: var(--surface-muted); border: 1px solid transparent; border-radius: var(--radius-md); color: var(--text-soft); cursor: pointer; display: flex; flex-direction: column; font-size: .7rem; font-weight: 700; gap: .42rem; justify-content: center; min-height: 4.7rem; min-width: 0; padding: .5rem .25rem; }
.kind-mark { align-items: center; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 50%; color: var(--symptom); display: flex; font-size: .65rem; font-weight: 830; height: 1.9rem; justify-content: center; width: 1.9rem; }
.symptom-kind.selected { background: var(--symptom-soft); border-color: color-mix(in srgb, var(--symptom) 42%, transparent); color: var(--symptom-strong); }
.symptom-kind.selected .kind-mark { background: var(--symptom); border-color: var(--symptom); color: white; }
.severity-choice { align-items: center; background: var(--surface-muted); border: 1px solid transparent; border-radius: var(--radius-md); color: var(--muted); cursor: pointer; display: flex; flex-direction: column; gap: .35rem; justify-content: center; min-height: 4.7rem; min-width: 0; padding: .4rem .15rem; }
.severity-choice .face { align-items: center; border: 1.7px solid currentColor; border-radius: 50%; display: flex; height: 1.8rem; justify-content: center; position: relative; width: 1.8rem; }
.severity-choice .face::before { content: "··"; font-size: .7rem; letter-spacing: .27rem; line-height: .4; margin-left: .27rem; position: absolute; top: .35rem; }
.severity-choice .face::after { border-bottom: 1.5px solid currentColor; border-radius: 50%; content: ""; height: .35rem; position: absolute; top: .88rem; width: .72rem; }
.severity-choice:nth-child(4) .face::after, .severity-choice:nth-child(5) .face::after { border-bottom: 0; border-top: 1.5px solid currentColor; top: 1.12rem; }
.severity-choice small { font-size: .65rem; font-weight: 760; }
.severity-choice.selected { background: var(--symptom-soft); border-color: color-mix(in srgb, var(--symptom) 45%, transparent); color: var(--symptom-strong); }
.severity-label { color: var(--symptom-strong); display: block; font-size: .76rem; font-weight: 720; margin-top: .55rem; text-align: center; }
.duration-fieldset { margin-top: 1.35rem; }
.duration-fieldset legend small { color: var(--muted); font-weight: 520; }
.duration-options { display: flex; flex-wrap: wrap; gap: .42rem; }
.duration-options button { background: var(--surface-muted); border: 1px solid transparent; border-radius: 999px; color: var(--text-soft); cursor: pointer; font-size: .72rem; font-weight: 680; min-height: 2.45rem; padding: .42rem .72rem; }
.duration-options button.selected { background: var(--symptom-soft); border-color: color-mix(in srgb, var(--symptom) 40%, transparent); color: var(--symptom-strong); }
.photo-picker { align-items: center; background: var(--surface-muted); border: 1px dashed #aeb9b2; border-radius: var(--radius-lg); cursor: pointer; display: grid; gap: .2rem .75rem; grid-template-columns: 2.8rem minmax(0, 1fr); margin: 1rem 0; padding: .9rem; }
.photo-picker > .app-icon { background: var(--primary-soft); border-radius: .8rem; color: var(--primary); font-size: 1.3rem; grid-row: 1 / 3; height: 2.8rem; padding: .62rem; width: 2.8rem; }
.photo-picker span { color: var(--primary-strong); font-size: .82rem; font-weight: 760; }
.photo-picker small { color: var(--muted); font-size: .7rem; }
.photo-picker input { grid-column: 1 / -1; margin-top: .45rem; max-width: 100%; overflow: hidden; }

.error-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 2rem; }
#blazor-error-ui { background: #fff4cf; bottom: 0; box-shadow: 0 -1px 4px rgba(0, 0, 0, .2); display: none; left: 0; padding: .7rem 1rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.auth-shell { background: radial-gradient(circle at 15% 15%, rgba(220,235,226,.7), transparent 22rem), radial-gradient(circle at 88% 82%, rgba(247,226,206,.65), transparent 25rem), var(--background); min-height: 100dvh; overflow: hidden; position: relative; }
.auth-decoration { inset: 0; pointer-events: none; position: fixed; }
.auth-decoration span { border: 1px solid rgba(63,103,86,.08); border-radius: 50%; position: absolute; }
.auth-decoration span:nth-child(1) { height: 22rem; left: -11rem; top: -9rem; width: 22rem; }
.auth-decoration span:nth-child(2) { bottom: -12rem; height: 28rem; right: -12rem; width: 28rem; }
.auth-decoration span:nth-child(3) { bottom: 12%; height: 5rem; left: 14%; width: 5rem; }
.identity-page { align-items: center; display: flex; justify-content: center; min-height: 100dvh; padding: 1rem; position: relative; z-index: 1; }
.identity-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); max-width: 31rem; padding: clamp(1.4rem, 5vw, 2.6rem); width: 100%; }
.identity-brand { align-items: center; color: var(--primary-strong); display: inline-flex; font-family: var(--font-display); font-size: 1.1rem; font-weight: 650; gap: .5rem; margin-bottom: 2rem; text-decoration: none; }
.identity-card h1 { font-size: 2.15rem; margin: 0 0 .5rem; }
.identity-card > p { color: var(--muted); line-height: 1.5; margin: 0 0 1.6rem; }
.remember-label { align-items: center; color: var(--muted); display: flex; font-size: .82rem; gap: .6rem; margin: 1.1rem 0; }
.remember-label input { accent-color: var(--primary); height: 1.15rem; width: 1.15rem; }
.identity-submit { margin-top: 1.2rem; width: 100%; }

.account-shell { margin: 0 auto; max-width: 66rem; }
.account-header { margin-bottom: 1.5rem; }
.account-header .overline { color: var(--primary); font-size: .72rem; font-weight: 820; letter-spacing: .08em; text-transform: uppercase; }
.account-header h1 { font-size: clamp(2rem, 6vw, 3rem); margin: .35rem 0; }
.account-header p { color: var(--muted); margin: 0; }
.account-layout { align-items: start; display: grid; gap: 1.2rem; grid-template-columns: 13rem minmax(0, 1fr); }
.account-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: .25rem; padding: .45rem; }
.account-nav a { align-items: center; border-radius: .8rem; color: var(--text-soft); display: flex; font-size: .8rem; font-weight: 700; gap: .55rem; min-height: 2.9rem; padding: .6rem .7rem; text-decoration: none; }
.account-nav a.active { background: var(--primary-soft); color: var(--primary-strong); }
.account-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); min-width: 0; padding: clamp(1rem, 4vw, 1.8rem); }
.account-panel h2, .account-panel h3 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; margin: 0 0 .45rem; }
.account-panel > p { color: var(--muted); line-height: 1.5; }
.account-panel form { max-width: 32rem; }
.account-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.3rem; }
.account-email-card { align-items: center; background: var(--surface-muted); border-radius: var(--radius-md); display: flex; gap: .8rem; margin: 1rem 0; padding: .85rem; }
.account-email-card strong, .account-email-card small { display: block; }
.account-email-card small { color: var(--muted); font-size: .72rem; margin-top: .15rem; }
.account-warning { background: var(--danger-soft); border-radius: var(--radius-md); color: #6f3434; line-height: 1.5; padding: .9rem 1rem; }
.status-message { border-radius: var(--radius-md); font-size: .78rem; margin-bottom: 1rem; padding: .75rem .9rem; }
.status-message.success { background: var(--primary-soft); color: var(--primary-strong); }
.status-message.danger { background: var(--danger-soft); color: var(--danger); }
.list-icon { align-items: center; background: var(--primary-soft); border-radius: .75rem; color: var(--primary); display: flex; flex: 0 0 auto; height: 2.5rem; justify-content: center; width: 2.5rem; }
.list-icon .app-icon { font-size: .9rem; }

@media (max-width: 700px) {
    .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .symptom-kind-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .account-layout { grid-template-columns: minmax(0, 1fr); }
    .account-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .account-nav a { font-size: .68rem; gap: .35rem; justify-content: center; min-width: 0; padding: .5rem .25rem; }
}
@media (max-width: 420px) {
    .date-time-grid { grid-template-columns: minmax(0, 1fr); }
    .severity-choice { min-height: 4.25rem; }
    .severity-choice small { font-size: .58rem; }
    .symptom-kind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
