:root {
  color-scheme: light;
  --paper: #eef1eb;
  --surface: #fffefa;
  --ink: #24322b;
  --muted: #707a70;
  --line: #dce3da;
  --green: #c5e56a;
  --green-dark: #344b27;
  --orange: #dc7857;
  --soft-green: #f0f5e4;
  --mono: "DM Mono", monospace;
  --sans: "Manrope", sans-serif;
  --display: "Space Grotesk", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(#d4ddd2 0.55px, transparent 0.55px);
  background-size: 20px 20px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell { width: min(1200px, calc(100% - 56px)); margin: 0 auto; }
.topbar { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #d7dfd5; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px 4px 12px 4px; background: var(--green); color: #263423; font-family: var(--display); font-weight: 700; font-size: 15px; }
.brand-name { display: grid; gap: 3px; font-family: var(--display); font-size: 14px; font-weight: 700; line-height: 1; }
.brand-name span, .eyebrow, .local-status, .section-count, .completion-foot, .goal-index, .goal-state, .photo-actions, .privacy-mark, .page-footer, .days-caption { font-family: var(--mono); }
.brand-name span { color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 28px; color: var(--muted); }
.local-status { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .4px; }
.status-dot { width: 7px; height: 7px; background: #72a43a; border-radius: 50%; }
.topbar-date { font-size: 12px; }

.page-heading { padding: 48px 0 30px; display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.eyebrow { display: block; margin: 0 0 10px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: 1px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-family: var(--display); font-size: 46px; line-height: 1.08; font-weight: 700; letter-spacing: 0; }
h1 span { color: #6c8c37; }
.heading-note { margin-bottom: 0; color: #667267; font-size: 14px; }
.day-picker { display: flex; align-items: center; gap: 7px; }
.date-step { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: 5px; cursor: pointer; font-family: var(--mono); }
.date-step:hover { border-color: #9db55f; background: var(--soft-green); }
#selected-date { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 11px; }
.challenge-tag { padding: 10px 12px; border: 1px solid #efc9ba; border-radius: 4px; background: #fff8f4; color: #a75c43; font-family: var(--mono); font-size: 10px; letter-spacing: .5px; }
.challenge-overview { margin-bottom: 24px; }
.challenge-overview .day-count strong { display: inline-block; }
.challenge-overview .window-label { font-size: 16px; white-space: nowrap; }
.challenge-overview .window-label span { color: #a7aea2; font-family: var(--mono); font-size: 11px; font-weight: 400; }
.calendar-panel { padding: 29px 31px 22px; border: 1px solid #dfe5dc; border-radius: 8px; background: var(--surface); box-shadow: 0 12px 34px rgba(36, 50, 43, .055); animation: rise-in .4s ease-out both; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.calendar-toolbar .eyebrow { margin-bottom: 5px; }
.calendar-toolbar h2 { font-size: 20px; }
.month-controls { display: flex; gap: 7px; }
.month-controls .date-step { width: 33px; height: 33px; }
.date-step:disabled { opacity: .35; cursor: default; }
.date-step:disabled:hover { border-color: var(--line); background: var(--surface); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-weekdays { margin-bottom: 8px; }
.calendar-weekdays span { padding: 8px 0; color: #6c786b; font-family: var(--mono); font-size: 10px; text-align: center; text-transform: uppercase; }
.calendar-day, .calendar-empty { position: relative; min-width: 0; min-height: 82px; aspect-ratio: 1.18; border-radius: 5px; }
.calendar-day { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px; border: 1px solid #e1e7df; background: #fafbf7; text-align: left; cursor: pointer; transition: border-color .18s ease, background-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.calendar-day:hover { transform: translateY(-2px); border-color: #9bb45f; background: #f5f8ec; box-shadow: 0 5px 13px rgba(52, 75, 39, .08); }
.calendar-day:focus-visible, .back-button:focus-visible { outline: 2px solid #668730; outline-offset: 2px; }
.calendar-date-num { color: #354239; font-family: var(--display); font-size: 14px; font-weight: 600; }
.calendar-day.is-today { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.calendar-day.has-progress:not(.is-complete) { border-color: #cad6b6; background: #f6f8ef; }
.calendar-day.is-complete { border-color: #d4e3b8; background: #f3f8e8; }
.calendar-partial { align-self: flex-end; color: #71845a; font-family: var(--mono); font-size: 10px; }
.calendar-check { display: grid; place-items: center; width: 28px; height: 28px; align-self: flex-end; border-radius: 50%; background: #77a842; color: white; font-size: 16px; font-weight: 800; box-shadow: 0 2px 6px rgba(75, 106, 31, .2); }
.calendar-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 19px; margin-top: 19px; color: #667267; font-size: 11px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 9px; height: 9px; border: 1px solid #bdc6b5; border-radius: 50%; background: white; }
.legend-complete { border-color: #82aa36; background: #82aa36; }
.day-heading { align-items: center; }
.back-button { display: inline-flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: 11px; cursor: pointer; }
.back-button:hover { border-color: #9db55f; background: var(--soft-green); }
.day-view .overview { margin-top: 0; }

.overview { display: grid; grid-template-columns: 190px 1fr 190px; align-items: stretch; min-height: 148px; margin-bottom: 31px; padding: 24px 26px; border: 1px solid rgba(255,255,255,.08); border-radius: 9px; background: linear-gradient(112deg, #25362e 0%, #202b25 58%, #2e3b30 100%); color: #f7f8f2; box-shadow: 0 12px 25px rgba(36, 50, 43, .12); }
.day-count, .days-complete { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.overview .eyebrow { color: #a7aea2; }
.day-count strong { font-size: 44px; line-height: .95; letter-spacing: 0; }
.day-total { margin-top: 4px; color: #9da498; font-family: var(--mono); font-size: 11px; }
.day-count { position: relative; display: block; padding-top: 5px; }
.day-count .eyebrow { margin-bottom: 13px; }
.day-count strong, .day-total { display: inline-block; vertical-align: baseline; }
.day-caption { display: block; margin-top: 9px; color: #a7aea2; font-size: 10px; }
.completion-block { align-self: center; padding: 0 30px; border-left: 1px solid #454a43; border-right: 1px solid #454a43; }
.completion-copy { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; }
.completion-copy .eyebrow { margin-bottom: 6px; }
.completion-copy strong { font-size: 17px; }
.completion-copy strong span { color: #a7aea2; font-size: 12px; font-weight: 500; }
.completion-percent { color: var(--green); font-family: var(--mono); font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #444a40; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s ease; }
.completion-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; color: #a7aea2; font-size: 8px; }
.days-complete { padding-left: 28px; }
.days-complete strong { font-size: 30px; line-height: 1.1; }
.days-complete strong span { color: #a7aea2; font-family: var(--mono); font-size: 11px; font-weight: 400; }
.days-caption { margin-top: 6px; color: #a7aea2; font-size: 9px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.57fr) minmax(300px, .83fr); align-items: start; gap: 40px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading .eyebrow { margin-bottom: 5px; }
h2 { margin-bottom: 0; font-size: 21px; font-weight: 800; letter-spacing: 0; }
.section-count { padding: 6px 8px; border-radius: 3px; background: #e8ebdf; color: #69735d; font-size: 9px; }
.goal-list { margin-top: 17px; border-top: 1px solid var(--line); }
.goal-row { display: grid; grid-template-columns: 27px minmax(0, 1fr) 125px 93px; align-items: center; gap: 12px; min-height: 71px; border-bottom: 1px solid var(--line); transition: background-color .16s ease; }
.goal-row.is-complete { background: linear-gradient(90deg, transparent, rgba(184, 224, 75, .09)); }
.goal-index { color: #879080; font-size: 10px; }
.goal-copy h3 { margin-bottom: 4px; font-size: 13px; font-weight: 800; }
.goal-copy p { margin-bottom: 0; color: #68746a; font-size: 11px; }
.field-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 7px; height: 35px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: #8a9086; font-family: var(--mono); font-size: 10px; }
.field-wrap:focus-within { border-color: #91ad50; box-shadow: 0 0 0 2px rgba(184, 224, 75, .2); }
.field-wrap input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 12px; text-align: right; }
.field-wrap input::placeholder { color: #b0b5ac; }
.field-wrap input::-webkit-inner-spin-button, .field-wrap input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.field-wrap input[type=number] { appearance: textfield; }
.field-wrap.time-field { justify-content: center; }
.time-field input { text-align: center; }
.goal-state { justify-self: end; color: var(--muted); font-size: 10px; text-align: right; white-space: nowrap; }
.is-complete .goal-state { color: var(--green-dark); }
.switch-wrap { justify-self: end; position: relative; width: 42px; height: 25px; cursor: pointer; }
.switch-wrap input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch { position: absolute; inset: 2px 0; border-radius: 99px; background: #dce0d7; transition: background .2s ease; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: white; content: ""; box-shadow: 0 1px 3px #0002; transition: transform .2s ease; }
.switch-wrap input:checked + .switch { background: #91b63a; }
.switch-wrap input:checked + .switch::after { transform: translateX(17px); }
.switch-wrap input:focus-visible + .switch { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.goal-note { margin: 15px 0 0; color: var(--muted); font-size: 11px; }
.calorie-tracker { border-bottom: 1px solid var(--line); }
.calorie-tracker summary { display: flex; min-height: 45px; align-items: center; gap: 9px; padding: 7px 0 7px 39px; color: #58634c; font-size: 10px; font-weight: 700; cursor: pointer; list-style: none; }
.calorie-tracker summary::-webkit-details-marker { display: none; }
.calorie-chevron { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid #cfd7c3; border-radius: 50%; color: var(--green-dark); font-size: 14px; font-weight: 400; transition: transform .16s ease; }
.calorie-tracker[open] .calorie-chevron { transform: rotate(45deg); }
.food-log-summary { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 400; text-align: right; }
.calorie-tracker-body { padding: 3px 0 15px 39px; }
.food-log-help { margin: 0 0 11px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.food-form { display: grid; grid-template-columns: minmax(130px, 1.6fr) minmax(105px, 1fr) minmax(105px, 1fr) auto; align-items: end; gap: 8px; }
.food-input { display: grid; min-width: 0; gap: 5px; color: var(--muted); font-family: var(--mono); font-size: 8px; }
.food-input input { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: var(--surface); color: var(--ink); font-family: var(--sans); font-size: 10px; }
.food-input input:focus { border-color: #91ad50; box-shadow: 0 0 0 2px rgba(184, 224, 75, .2); }
.food-input input::placeholder { color: #a7ada3; }
.add-food-button { height: 34px; padding: 0 11px; border: 1px solid #d4dfbf; border-radius: 4px; background: var(--soft-green); color: var(--green-dark); font-size: 10px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.add-food-button:hover { background: #e5efce; }
.food-empty { margin: 13px 0 0; color: #92998d; font-size: 10px; }
.food-list { display: grid; gap: 0; margin: 11px 0 0; padding: 0; list-style: none; }
.food-entry { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf0e8; }
.food-entry-copy, .food-entry-actions { display: grid; gap: 4px; }
.food-entry-copy strong { overflow-wrap: anywhere; color: var(--ink); font-size: 10px; }
.food-entry-copy span { color: var(--muted); font-family: var(--mono); font-size: 8px; }
.food-entry-actions { justify-items: end; flex: 0 0 auto; }
.food-entry-actions > strong { color: #566d36; font-family: var(--mono); font-size: 9px; }
.remove-food-button { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 8px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.food-total-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.food-total-row strong { color: var(--ink); font-family: var(--mono); font-size: 11px; }
.food-mode-note { margin: 7px 0 0; color: #778266; font-size: 9px; }
.field-wrap input[readonly] { color: #566d36; font-weight: 700; cursor: default; }
.food-name-search-form { display: flex; gap: 7px; }
.food-name-search-form input { width: 100%; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: var(--surface); color: var(--ink); font-size: 11px; }
.food-name-search-form input:focus { border-color: #91ad50; box-shadow: 0 0 0 2px rgba(184, 224, 75, .2); }
.food-name-search-form input::placeholder { color: #9aa294; }
.food-name-search-form button { flex: 0 0 auto; padding: 0 13px; border: 1px solid #344b37; border-radius: 4px; background: #2a3c31; color: #f8faef; font-size: 10px; font-weight: 700; cursor: pointer; }
.food-name-search-form button:hover { background: #3b5540; }
.food-search-results { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.food-search-results button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid #e1e7df; border-radius: 4px; background: #fbfcf8; text-align: left; cursor: pointer; }
.food-search-results button:hover, .food-search-results button:focus-visible { border-color: #9bb45f; background: #f5f8ec; outline: 0; }
.food-match-description { display: grid; min-width: 0; gap: 3px; }
.food-match-description strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.food-match-description small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.food-match-calories { flex: 0 0 auto; color: #526d35; font-family: var(--mono); font-size: 9px; }
.barcode-actions { margin-top: 10px; }
.barcode-actions { display: flex; align-items: center; gap: 9px; }
.scan-barcode-button { flex: 0 0 auto; height: 35px; padding: 0 12px; border: 1px solid #344b37; border-radius: 4px; background: #2a3c31; color: #f8faef; font-size: 10px; font-weight: 700; cursor: pointer; }
.scan-barcode-button:hover { background: #3b5540; }
.barcode-lookup-form { display: flex; flex: 1; min-width: 0; gap: 6px; }
.barcode-lookup-form input { width: 100%; min-width: 0; height: 35px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; outline: 0; background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 10px; }
.barcode-lookup-form input:focus { border-color: #91ad50; box-shadow: 0 0 0 2px rgba(184, 224, 75, .2); }
.barcode-lookup-form button { flex: 0 0 auto; padding: 0 10px; border: 1px solid #d4dfbf; border-radius: 4px; background: var(--soft-green); color: var(--green-dark); font-size: 10px; font-weight: 700; cursor: pointer; }
.barcode-status { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.barcode-status a { color: #526d35; text-underline-offset: 2px; }
.barcode-status.is-error { color: #a14e38; }
.barcode-product { margin: 12px 0; padding: 12px; border: 1px solid #dbe5cc; border-radius: 5px; background: #f7faef; }
.barcode-product-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.barcode-product-heading .eyebrow { margin-bottom: 4px; color: #71805e; font-size: 8px; }
.barcode-product-heading h3 { margin: 0 0 3px; color: var(--ink); font-family: var(--display); font-size: 15px; }
.barcode-product-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 10px; }
.barcode-product-heading > strong { flex: 0 0 auto; color: var(--green-dark); font-family: var(--mono); font-size: 16px; text-align: right; }
.barcode-product-heading small { display: block; margin-top: 3px; color: var(--muted); font-family: var(--sans); font-size: 8px; font-weight: 400; }
.grams-form { display: grid; grid-template-columns: minmax(95px, .7fr) minmax(110px, 1fr) auto; align-items: end; gap: 9px; margin-top: 13px; padding-top: 12px; border-top: 1px solid #e3e9d9; }
.grams-input-wrap { display: flex; align-items: center; gap: 7px; height: 35px; padding: 0 9px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--muted); }
.grams-input-wrap input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--mono); font-size: 12px; text-align: right; }
.grams-estimate { display: grid; gap: 5px; min-height: 35px; align-content: center; color: var(--muted); font-size: 8px; }
.grams-estimate strong { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.custom-food-help { margin-top: 15px; }
.barcode-dialog { width: min(520px, calc(100% - 28px)); max-width: 520px; padding: 22px; border: 1px solid #dce3da; border-radius: 9px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(20, 32, 24, .25); }
.barcode-dialog::backdrop { background: rgba(25, 37, 29, .62); backdrop-filter: blur(3px); }
.barcode-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.barcode-dialog-header .eyebrow { margin-bottom: 4px; }
.barcode-dialog-header h2 { font-family: var(--display); font-size: 21px; }
.barcode-dialog .side-note { max-width: 420px; }
#barcode-reader { width: 100%; overflow: hidden; border-radius: 5px; }
#barcode-reader video { border-radius: 5px; }
.barcode-scan-status { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.reflection-panel { padding-left: 27px; border-left: 1px solid var(--line); }
.photo-section { padding-bottom: 25px; }
.compact-heading { align-items: center; }
.compact-heading h2 { font-size: 17px; }
.compact-heading .goal-index { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #e8ebdf; color: #69735d; }
.side-note { margin: 10px 0 14px; color: #68746a; font-size: 11px; line-height: 1.6; }
.photo-drop { display: grid; place-items: center; min-height: 172px; overflow: hidden; border: 1px dashed #bdc6b5; border-radius: 5px; background: rgba(255,255,255,.55); cursor: pointer; transition: border-color .18s ease, background-color .18s ease; }
.photo-drop:hover { border-color: #84a246; background: #fbfcf6; }
.photo-drop img { width: 100%; max-height: 280px; object-fit: cover; }
.photo-placeholder { display: grid; justify-items: center; gap: 5px; color: #687361; font-size: 11px; }
.photo-plus { display: grid; place-items: center; width: 31px; height: 31px; margin-bottom: 3px; border-radius: 50%; background: var(--soft-green); color: var(--green-dark); font-size: 20px; }
.photo-placeholder small { color: #9a9f96; font-family: var(--mono); font-size: 9px; }
.photo-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--green-dark); font-size: 9px; }
.photo-actions button { padding: 2px 0; border: 0; background: transparent; color: var(--muted); font-family: var(--sans); font-size: 10px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.journal-section { padding-top: 22px; border-top: 1px solid var(--line); }
#journal-entry { display: block; width: 100%; min-height: 126px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 4px; outline: none; background: var(--surface); color: var(--ink); font-size: 11px; line-height: 1.6; }
#journal-entry:focus { border-color: #91ad50; box-shadow: 0 0 0 2px rgba(184, 224, 75, .2); }
#journal-entry::placeholder { color: #a7ada3; }
.journal-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.privacy-note { display: flex; align-items: center; gap: 10px; margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.privacy-mark { padding: 4px 5px; border: 1px solid #ced5c4; border-radius: 2px; color: var(--green-dark); font-size: 8px; }
.page-footer { display: flex; justify-content: space-between; margin-top: 46px; padding: 16px 0 21px; border-top: 1px solid #d7dfd5; color: #778176; font-size: 9px; letter-spacing: .5px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 2; max-width: min(360px, calc(100vw - 36px)); padding: 11px 15px; transform: translateY(12px); border-radius: 4px; background: var(--ink); color: white; font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); border: 0; }
[hidden] { display: none !important; }

.auth-screen { min-height: 100vh; padding: 34px 28px; background-color: #e9eee6; background-image: radial-gradient(#cbd7ca .7px, transparent .7px), linear-gradient(135deg, rgba(255,255,255,.45), transparent 52%); background-size: 20px 20px, 100% 100%; }
.auth-shell { display: grid; width: min(1050px, 100%); min-height: calc(100vh - 68px); grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); grid-template-rows: auto 1fr auto; align-items: center; gap: 24px 70px; margin: 0 auto; }
.auth-brand { grid-column: 1 / -1; align-self: start; }
.auth-intro { grid-column: 1; grid-row: 2; max-width: 500px; padding: 25px 0 50px; }
.auth-intro .eyebrow { color: #657464; }
.auth-intro h1 { margin-bottom: 16px; color: #26382d; font-size: 60px; }
.auth-intro h1 span { color: #698840; }
.auth-intro > p:last-child { max-width: 360px; margin: 0; color: #59695d; font-size: 15px; line-height: 1.7; }
.auth-panel { grid-column: 2; grid-row: 2; padding: 27px; border: 1px solid rgba(255,255,255,.8); border-radius: 8px; background: rgba(255,254,250,.93); box-shadow: 0 18px 50px rgba(35, 52, 39, .12); }
.auth-panel-heading { margin-bottom: 18px; }
.auth-panel-heading .eyebrow { margin-bottom: 5px; color: #74816e; }
.auth-panel-heading h2 { font-family: var(--display); font-size: 23px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; border-radius: 5px; background: #edf1e9; }
.auth-tab { flex: 1; padding: 9px 6px; border: 0; border-radius: 3px; background: transparent; color: #6d786d; font-size: 10px; font-weight: 700; cursor: pointer; }
.auth-tab.is-active { background: white; color: #293b2e; box-shadow: 0 1px 4px rgba(35, 52, 39, .12); }
.auth-form { display: grid; gap: 13px; }
.auth-field { display: grid; gap: 6px; color: #566357; font-size: 10px; font-weight: 700; }
.auth-field input { width: 100%; height: 40px; padding: 0 11px; border: 1px solid #dce3da; border-radius: 4px; outline: 0; background: #fff; color: var(--ink); font-size: 12px; font-weight: 500; }
.auth-field input:focus { border-color: #86a453; box-shadow: 0 0 0 3px rgba(135, 166, 83, .16); }
.auth-submit { min-height: 42px; padding: 0 15px; border: 1px solid #344b37; border-radius: 4px; background: #2a3c31; color: #f8faef; font-size: 11px; font-weight: 700; cursor: pointer; }
.auth-submit:hover { background: #3b5540; }
.auth-submit:disabled { opacity: .55; cursor: progress; }
.auth-status { min-height: 17px; margin: -4px 0 0; color: #566d35; font-size: 10px; line-height: 1.5; }
.auth-status.is-error { color: #a14e38; }
.auth-privacy { margin: 15px 0 0; padding-top: 13px; border-top: 1px solid #e7ebe3; color: #768074; font-size: 9px; line-height: 1.6; }
.auth-footer { display: flex; justify-content: space-between; gap: 15px; grid-column: 1 / -1; align-self: end; margin: 0; padding-top: 14px; border-top: 1px solid #d3ddd1; color: #778176; font-family: var(--mono); font-size: 8px; letter-spacing: .4px; }
.signed-in-name { max-width: 145px; overflow: hidden; color: #566357; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-open-button, .sign-out-button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: #53634f; font-family: var(--mono); font-size: 9px; cursor: pointer; }
.admin-open-button:hover, .sign-out-button:hover { border-color: #9bb45f; background: var(--soft-green); }
.admin-view { padding-bottom: 20px; }
.admin-panel { padding: 25px 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 12px 34px rgba(36, 50, 43, .055); }
.admin-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.admin-panel-heading .eyebrow { margin-bottom: 5px; }
.admin-panel-heading h2 { display: flex; align-items: center; gap: 10px; font-family: var(--display); }
.admin-panel-heading h2 span { display: grid; min-width: 25px; height: 25px; place-items: center; padding: 0 5px; border-radius: 50%; background: #eff4e4; color: #526d35; font-family: var(--mono); font-size: 10px; }
.admin-note { margin: 12px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: left; }
.admin-table th { padding: 11px 12px; background: #f3f5ef; color: #647063; font-family: var(--mono); font-size: 9px; font-weight: 400; text-transform: uppercase; white-space: nowrap; }
.admin-table td { padding: 12px; border-top: 1px solid #e8ece5; color: #334037; vertical-align: middle; }
.admin-table tbody tr:hover { background: #fbfcf8; }
.admin-table .account-email { color: #6c786d; }
.account-status { display: inline-flex; align-items: center; gap: 6px; color: #4b6f3c; font-size: 10px; white-space: nowrap; }
.account-status::before { width: 7px; height: 7px; border-radius: 50%; background: #78a34b; content: ""; }
.account-status.is-disabled { color: #9a5b48; }
.account-status.is-disabled::before { background: #d07b5d; }
.account-actions { display: flex; gap: 6px; }
.account-actions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 3px; background: white; color: #53634f; font-size: 9px; white-space: nowrap; cursor: pointer; }
.account-actions button:hover { border-color: #9bb45f; background: var(--soft-green); }
.account-actions .disable-account { color: #9a5b48; }
.admin-status, .dialog-status { min-height: 16px; margin: 10px 0 0; color: #526d35; font-size: 10px; }
.admin-status.is-error, .dialog-status.is-error { color: #a14e38; }
.admin-reset-dialog { width: min(440px, calc(100% - 28px)); max-width: 440px; padding: 23px; border: 1px solid #dce3da; border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(20, 32, 24, .25); }
.admin-reset-dialog::backdrop { background: rgba(25, 37, 29, .62); backdrop-filter: blur(3px); }
.admin-reset-dialog form { display: grid; gap: 15px; }
.admin-reset-dialog .side-note { margin-bottom: 0; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .auth-submit { min-height: 36px; }

@media (max-width: 850px) {
  .app-shell { width: min(100% - 36px, 680px); }
  .overview { grid-template-columns: 130px 1fr; gap: 0; }
  .completion-block { padding: 0 22px; border-right: 0; }
  .days-complete { grid-column: 1 / -1; flex-direction: row; align-items: baseline; gap: 9px; margin-top: 16px; padding: 14px 0 0; border-top: 1px solid #454a43; }
  .days-complete .eyebrow { margin: 0 auto 0 0; }
  .days-complete strong { font-size: 19px; }
  .days-caption { margin: 0; }
  .content-grid { grid-template-columns: 1fr; gap: 29px; }
  .challenge-overview { grid-template-columns: 115px 1fr; }
  .challenge-overview .days-complete { grid-column: 1 / -1; }
  .calendar-panel { padding: 22px 19px 17px; }
  .calendar-weekdays, .calendar-grid { gap: 6px; }
  .calendar-day, .calendar-empty { min-height: 66px; }
  .reflection-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .photo-section { padding-bottom: 0; }
  .journal-section { padding-top: 0; border-top: 0; }
  .privacy-note { grid-column: 1 / -1; margin-top: 0; }
  .auth-shell { column-gap: 30px; }
  .auth-intro h1 { font-size: 50px; }
}

@media (max-width: 560px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar { height: 64px; }
  .topbar-right { gap: 0; }
  .topbar-date { display: none; }
  .local-status { font-size: 8px; }
  .page-heading { align-items: flex-start; flex-direction: column; padding: 31px 0 20px; }
  .calendar-view .page-heading { gap: 14px; }
  .challenge-tag { align-self: flex-end; margin-top: -2px; font-size: 8px; }
  h1 { font-size: 36px; }
  .day-picker { align-self: flex-end; margin-top: -3px; }
  .overview { grid-template-columns: 94px 1fr; min-height: 132px; padding: 18px 15px; }
  .challenge-overview { grid-template-columns: 90px 1fr; }
  .challenge-overview .day-count strong { font-size: 35px; }
  .challenge-overview .day-caption { max-width: 100px; font-size: 8px; }
  .challenge-overview .window-label { font-size: 13px; }
  .challenge-overview .window-label span { font-size: 9px; }
  .challenge-overview .days-complete { gap: 6px; }
  .calendar-panel { padding: 19px 12px 16px; }
  .calendar-toolbar { margin-bottom: 15px; }
  .calendar-toolbar h2 { font-size: 17px; }
  .calendar-weekdays, .calendar-grid { gap: 4px; }
  .calendar-weekdays span { font-size: 8px; }
  .calendar-day, .calendar-empty { min-height: 49px; aspect-ratio: 1; }
  .calendar-day { padding: 6px; }
  .calendar-date-num { font-size: 12px; }
  .calendar-check { width: 19px; height: 19px; font-size: 12px; }
  .calendar-partial { font-size: 7px; }
  .calendar-legend { gap: 12px; margin-top: 13px; font-size: 9px; }
  .day-heading { align-items: flex-start; flex-direction: row; }
  .day-heading h1 { font-size: 28px; }
  .back-button { padding: 8px 10px; font-size: 10px; }
  .day-count strong { font-size: 37px; }
  .completion-block { padding: 0 0 0 15px; }
  .completion-copy strong { font-size: 14px; }
  .completion-copy strong span { font-size: 10px; }
  .completion-foot { font-size: 7px; }
  .days-complete { gap: 7px; }
  .days-complete .eyebrow { font-size: 8px; }
  .days-caption { display: none; }
  .goal-row { grid-template-columns: 22px minmax(0, 1fr) 91px; gap: 7px; min-height: 74px; }
  .calorie-tracker summary { padding-left: 29px; font-size: 9px; }
  .food-log-summary { max-width: 125px; font-size: 8px; }
  .calorie-tracker-body { padding-left: 29px; }
  .food-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .food-name-input, .add-food-button { grid-column: 1 / -1; }
  .add-food-button { width: 100%; }
  .barcode-actions { align-items: stretch; flex-direction: column; }
  .food-name-search-form button { padding: 0 10px; }
  .food-match-calories { max-width: 95px; font-size: 8px; text-align: right; }
  .scan-barcode-button { width: 100%; }
  .barcode-lookup-form { width: 100%; }
  .barcode-product { padding: 10px; }
  .grams-form { grid-template-columns: minmax(90px, .8fr) 1fr; }
  .grams-form .add-food-button { grid-column: 1 / -1; }
  .barcode-dialog { padding: 17px; }
  .goal-copy h3 { font-size: 12px; }
  .goal-copy p { max-width: 210px; font-size: 10px; }
  .field-wrap { height: 33px; gap: 4px; padding: 0 6px; font-size: 9px; }
  .field-wrap input { font-size: 11px; }
  .goal-state { grid-column: 2 / 4; justify-self: start; align-self: start; margin-top: -18px; margin-left: 0; font-size: 9px; }
  .switch-wrap { grid-column: 3; grid-row: 1; }
  .goal-row[data-goal="cold"] .goal-state { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; margin: 0 0 0 auto; }
  .goal-row[data-goal="wake"] .goal-state { grid-column: 2; }
  .reflection-panel { grid-template-columns: 1fr; gap: 24px; }
  .journal-section { padding-top: 22px; border-top: 1px solid var(--line); }
  .privacy-note { grid-column: auto; }
  .page-footer { margin-top: 32px; font-size: 7px; }
  .page-footer span:last-child { display: none; }
  .auth-screen { padding: 22px 17px; }
  .auth-shell { min-height: calc(100vh - 44px); grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; gap: 16px; }
  .auth-brand { grid-column: 1; }
  .auth-intro { grid-column: 1; grid-row: 2; padding: 8px 0 0; }
  .auth-intro h1 { margin-bottom: 9px; font-size: 40px; }
  .auth-intro > p:last-child { max-width: 340px; font-size: 12px; }
  .auth-panel { grid-column: 1; grid-row: 3; align-self: start; padding: 20px; }
  .auth-tabs { margin-bottom: 16px; }
  .auth-footer { flex-direction: column; gap: 5px; grid-column: 1; grid-row: 4; font-size: 7px; }
  .topbar-right { gap: 6px; }
  .signed-in-name { display: none; }
  .local-status { display: none; }
  .admin-panel { padding: 18px 13px; }
  .admin-table { min-width: 700px; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}