:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Helvetica Neue", sans-serif;
  font-synthesis: none;
  color: #14161c;
  background: #e7e9ee;
  --bg: #f3f4f7;
  --card: #fff;
  --ink: #14161c;
  --muted: #6d7280;
  --line: #e6e8ee;
  --good: #0e7a45;
  --danger: #c2414a;
  --shadow: 0 10px 30px rgba(20, 22, 28, .06);
}
* { box-sizing: border-box; }
body { margin: 0; background: #e7e9ee; }
button, input, select { font: inherit; color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; background: transparent; border: 0; border-radius: 16px; min-height: 44px; padding: 0 14px; font-weight: 600; }
button:disabled { opacity: .38; cursor: default; }
button:active:not(:disabled) { transform: scale(.98); }
input, select { width: 100%; max-width: 100%; min-width: 0; min-height: 52px; border: 0; border-radius: 16px; background: var(--card); padding: 12px 16px; font-size: 16px; box-shadow: var(--shadow); }
input::placeholder { color: #9aa0ab; opacity: 1; }
input:focus, select:focus, button:focus-visible, summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { display: flex; align-items: center; font-size: 22px; font-weight: 760; letter-spacing: -.6px; }
h1 small { margin-left: 8px; color: var(--muted); font-size: 13px; font-weight: 550; letter-spacing: 0; }
h2 { font-size: 34px; line-height: 1.1; font-weight: 760; letter-spacing: -1.1px; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 680; }
p { font-size: 15px; line-height: 1.45; }
label { display: block; font-size: 13px; margin: 20px 0 8px; font-weight: 650; color: var(--muted); }
.phone { width: 100%; max-width: 430px; margin: auto; padding: max(18px, env(safe-area-inset-top)) 20px calc(108px + env(safe-area-inset-bottom)); min-height: 100dvh; background: var(--bg); }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-header { margin-bottom: 28px; }
.brand-dot { width: 7px; height: 7px; border-radius: 50%; margin: 8px 0 0 3px; background: var(--ink); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-heading > div { min-width: 0; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.today-button { flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 13px; }
.calendar { margin-bottom: 22px; }
.date-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.date-picker input { flex: 1; width: 0; min-height: 40px; background: transparent; box-shadow: none; text-align: center; padding: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.date-picker button { min-width: 40px; padding: 0; font-size: 28px; font-weight: 400; color: var(--muted); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week-strip button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 64px; padding: 8px 0; border-radius: 18px; background: transparent; }
.week-strip span { color: var(--muted); font-size: 11px; font-weight: 600; }
.week-strip strong { font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; }
.week-strip .selected { background: var(--ink); color: #fff; }
.week-strip .selected span { color: rgba(255,255,255,.72); }
.week-strip .today strong { position: relative; }
.week-strip .today strong::after { content: ''; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--ink); bottom: -7px; left: calc(50% - 2px); }
.week-strip .selected.today strong::after { background: #fff; }
.glyph { width: 24px; height: 24px; display: block; flex: none; }
.glyph * { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-actions { display: flex; flex-direction: column; gap: 12px; }
.log-cta, .checkin { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; margin: 0; border-radius: 22px; font-size: 18px; }
.log-cta { background: var(--ink); color: #fff; box-shadow: 0 12px 28px rgba(20, 22, 28, .16); }
.checkin { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.checkin[aria-pressed="true"] { color: var(--good); }
#day-records { margin-top: 28px; }
#day-records h3 { margin: 0 4px 12px; font-size: 15px; }
.record { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 14px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.record + .record { margin-top: 10px; }
.record-body { min-width: 0; }
.record-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.record-top strong { font-size: 15px; font-weight: 680; overflow-wrap: anywhere; }
.record p { margin-top: 4px; font-size: 14px; color: #3a3e49; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.record .meta { margin-top: 4px; color: var(--muted); font-size: 13px; }
.record-actions { display: flex; flex-shrink: 0; }
.record-actions button { min-height: 32px; padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.change { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.change.positive { color: var(--good); }
.ex-icon, .icon-bubble { display: grid; place-items: center; color: var(--ink); background: var(--bg); }
.ex-icon { width: 44px; height: 44px; border-radius: 14px; }
.icon-bubble { width: 52px; height: 52px; border-radius: 18px; }
.icon-bubble .glyph { width: 26px; height: 26px; }
.photo-card { margin-top: 16px; padding: 6px; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); }
.photo-placeholder { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px; padding: 12px 14px; color: var(--ink); }
.photo-placeholder strong { font-size: 16px; font-weight: 650; }
.photo-placeholder svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.photo-preview { display: block; width: 100%; padding: 0; overflow: hidden; border-radius: 18px; }
.photo-preview img { display: block; width: 100%; height: 180px; object-fit: cover; }
.photo-actions { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 6px; }
.photo-actions p { font-size: 13px; color: var(--muted); }
.photo-actions button { min-height: 36px; font-size: 13px; color: var(--muted); }
.photo-actions .remove { color: var(--danger); }
#history-panel .page-heading { align-items: center; }
.count-badge { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.search-box { position: relative; display: flex; align-items: center; margin: 0 0 8px; }
.search-box svg { position: absolute; left: 16px; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; }
.search-box input { padding-left: 44px; }
.history-group { margin-top: 10px; }
.history-group > summary { display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 12px; list-style: none; cursor: pointer; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.history-group > summary > div { flex: 1; min-width: 0; }
.history-group h3 { font-size: 15px; font-weight: 680; overflow-wrap: anywhere; }
.history-last { display: flex; align-items: baseline; min-width: 0; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-last > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.history-last time { flex-shrink: 0; white-space: pre; }
.chevron { flex-shrink: 0; font-size: 22px; font-weight: 400; color: #9aa0ab; }
.history-group[open] > summary { border-radius: 20px 20px 0 0; }
.history-group[open] > summary > .chevron { transform: rotate(90deg); }
.history-rows { padding: 4px 12px 12px; background: var(--card); border-radius: 0 0 20px 20px; box-shadow: var(--shadow); }
.history-rows .record { box-shadow: none; background: var(--bg); padding: 12px; }
.history-rows .record-top strong { color: var(--muted); font-size: 13px; font-weight: 600; }
.more-records { width: 100%; margin-top: 8px; background: var(--bg); }
.empty { color: var(--muted); padding: 28px 8px; text-align: center; }
summary::-webkit-details-marker { display: none; }
.menu { position: relative; }
.menu summary { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; list-style: none; cursor: pointer; letter-spacing: 1px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.menu > div { position: absolute; right: 0; top: 52px; z-index: 20; width: 196px; padding: 6px; background: var(--card); border-radius: 16px; box-shadow: 0 16px 40px rgba(20, 22, 28, .12); }
.menu button { width: 100%; text-align: left; font-size: 14px; font-weight: 600; }
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 430px); z-index: 15; padding: 8px 28px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(20, 22, 28, .06); background: rgba(243, 244, 247, .92); backdrop-filter: blur(16px); }
.bottom-nav > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bottom-nav button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; font-size: 13px; color: var(--muted); }
.bottom-nav button[aria-selected=true] { color: var(--ink); }
.bottom-nav button[aria-selected=true]::before { content: ''; position: absolute; top: -8px; left: calc(50% - 14px); width: 28px; height: 2px; background: var(--ink); border-radius: 2px; }
.bottom-nav svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary { background: var(--ink); color: #fff; }
.plain { min-width: 44px; padding: 0; color: var(--muted); font-size: 18px; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }
.error:empty { display: none; }
.last-result { margin-top: 16px; padding: 14px 16px; font-size: 14px; color: var(--muted); border-radius: 16px; background: var(--card); }
.last-result:empty { display: none; }
dialog { color: var(--ink); border: 0; border-radius: 24px; background: var(--card); padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); width: min(100% - 32px, 400px); max-width: 100%; max-height: min(90dvh, 720px); margin: auto; box-shadow: 0 24px 80px rgba(20, 22, 28, .18); }
dialog::backdrop { background: rgba(20, 22, 28, .28); }
dialog h2 { font-size: 22px; letter-spacing: -.4px; }
.buttons { display: flex; gap: 10px; margin-top: 22px; }
.buttons button { flex: 1; min-height: 48px; background: var(--bg); }
.danger { color: var(--danger); background: #fdeced; }
#photo-full { display: block; width: 100%; height: auto; border-radius: 16px; margin-top: 14px; }
#login, #loading { padding: max(96px, 18dvh) 28px 40px; }
.login-mark { font-size: 64px; font-weight: 760; line-height: .9; letter-spacing: -3px; color: var(--ink); }
.login-mark span { display: inline-block; width: 10px; height: 10px; margin-left: 4px; border-radius: 50%; background: var(--ink); vertical-align: 18px; }
#login h1 { display: block; margin: 18px 0 0; font-size: 22px; font-weight: 650; letter-spacing: -.4px; }
#login-form, #register-form { margin-top: 36px; }
#login-form .primary, #register-form .primary { width: 100%; min-height: 56px; margin-top: 18px; border-radius: 18px; font-size: 17px; }
.text-button { width: 100%; margin-top: 4px; color: var(--muted); font-weight: 600; }
dialog.logger { width: min(100%, 430px); height: 100dvh; max-height: none; margin: 0 auto; padding: 0; border-radius: 0; background: var(--bg); box-shadow: none; overflow: hidden; }
dialog.logger[open] { display: flex; flex-direction: column; }
#record-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
dialog.logger header { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px; padding: max(10px, env(safe-area-inset-top)) 12px 8px 8px; margin: 0; }
dialog.logger h2 { font-size: 17px; font-weight: 700; text-align: center; letter-spacing: 0; }
dialog.logger #save-record { width: auto; min-height: 40px; margin: 0; padding: 0 16px; border-radius: 999px; font-size: 15px; }
.logger-scroll { flex: 1; min-height: 0; overflow: auto; padding: 8px 20px 24px; }
.cat-list { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.cat-card { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 92px; padding: 16px; border-radius: 24px; background: var(--card); box-shadow: var(--shadow); text-align: left; }
.cat-card strong { display: block; font-size: 20px; letter-spacing: -.3px; }
.cat-card small { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; font-weight: 550; }
.picker-head { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-bottom: 8px; }
.picker-title { font-size: 17px; font-weight: 720; letter-spacing: -.3px; line-height: 1.3; }
.back { width: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-size: 28px; font-weight: 400; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-size: 15px; }
.ex-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; margin-top: 8px; padding: 10px 12px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); text-align: left; font-size: 15px; font-weight: 650; }
.ex-row[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink), var(--shadow); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px; padding: 4px; border-radius: 18px; background: #e7e9ee; }
.seg button { min-height: 48px; border-radius: 14px; background: transparent; font-size: 16px; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: var(--shadow); }
.stepper { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.stepper button { width: 64px; min-width: 64px; height: 64px; min-height: 64px; padding: 0; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-size: 30px; font-weight: 500; line-height: 1; }
.stepper strong, .stepper input { flex: 1; min-width: 0; text-align: center; font-size: 32px; font-weight: 720; font-variant-numeric: tabular-nums; background: transparent; box-shadow: none; min-height: 64px; }
.stepper input { background: var(--card); box-shadow: var(--shadow); border-radius: 20px; }
.stepper strong small { font-size: 15px; font-weight: 600; color: var(--muted); }
.set-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.set-actions button { background: var(--card); box-shadow: var(--shadow); min-height: 48px; }
.logger-search { display: flex; align-items: center; gap: 10px; flex: none; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); color: var(--muted); }
.logger-search input { min-height: 48px; background: var(--bg); box-shadow: none; }
.invite-code { width: 100%; margin-top: 14px; text-align: center; font-size: 20px; letter-spacing: .4px; }
.invite-row { padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; letter-spacing: .2px; }
#create-invite { width: 100%; min-height: 52px; border-radius: 16px; }
#who { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#loading { text-align: center; }
#loading p { color: var(--muted); margin-top: 20px; }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; border-radius: 999px; background: var(--ink); color: #fff; padding: 12px 18px; font-size: 14px; z-index: 50; pointer-events: none; }
@media (max-width: 350px) {
  .phone, .logger-scroll { padding-left: 16px; padding-right: 16px; }
  h2 { font-size: 30px; }
  .cat-card strong { font-size: 18px; }
  .stepper button { width: 56px; min-width: 56px; }
}
@media (min-width: 600px) {
  .phone { box-shadow: 0 0 0 1px rgba(20, 22, 28, .05); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
