:root {
  color-scheme: light;
  --page: #edf2fc;
  --ink: #1d2944;
  --muted: #566681;
  --accent: #3763d5;
  --accent-strong: #244bb7;
  --line: #5876a526;
  --glass: #ffffff8f;
  --glass-strong: #ffffffc4;
  --solid: #f4f7ff;
  --highlight: #ffffffeb;
  --shadow: 0 12px 40px #384d7e0d, inset 0 1px 0 #ffffffdb;
  --sober: #176457;
  --sober-bg: #c3edddbf;
  --drinks: #8b432d;
  --drinks-bg: #f6d8c7bf;
  --danger: #a32f46;
  --danger-bg: #fff0f3ed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 30px; }
body { margin: 0; background: var(--page); color: var(--ink); }
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 8% 12%, #d6e5ff 0%, transparent 49%),
    radial-gradient(ellipse at 87% 14%, #dcd6fa 0%, transparent 47%),
    radial-gradient(ellipse at 95% 65%, #c9e9f5 0%, transparent 45%),
    radial-gradient(ellipse at 12% 87%, #d7d7f4 0%, transparent 48%),
    linear-gradient(145deg, #f4f6ff, #e6eff8 60%, #e7edf9);
}
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
a { color: var(--accent); }
[hidden] { display: none !important; }
svg { display: block; flex-shrink: 0; }
.app-shell { max-width: 1180px; padding: max(22px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) 0 max(32px, env(safe-area-inset-left)); margin: auto; }
.topbar, .intro, .stat, .card, .setup-panel, .tab-bar, dialog {
  background: var(--glass);
  border: 1px solid var(--highlight);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(28px) saturate(155%);
  backdrop-filter: blur(28px) saturate(155%);
}
.topbar { min-height: 82px; padding: 15px 20px; border-radius: 28px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 700; letter-spacing: -.7px; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; background: linear-gradient(145deg, #91b1ff, #567bdd 55%, #7567cb); color: white; width: 48px; height: 48px; border-radius: 16px; border: 1px solid #ffffffb0; box-shadow: inset 0 1px 3px #ffffff99, 0 5px 12px #4c67c32b; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-caption { display: block; margin-top: 5px; font-size: 8px; font-weight: 650; letter-spacing: 2px; color: var(--muted); }
.account-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.account-label { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.connection-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; }
.connection-pill i { width: 5px; height: 5px; background: #8997ad; border-radius: 50%; }
.connection-pill[data-state="connected"] { color: var(--sober); }
.connection-pill[data-state="connected"] i { background: var(--sober); }
.connection-pill[data-state="working"] i { background: var(--accent); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; padding: 11px 17px; border: 1px solid var(--highlight); border-radius: 999px; color: var(--ink); background: var(--glass); box-shadow: inset 0 1px 1px #ffffff66, 0 3px 8px #35548b08; font-size: 12px; font-weight: 650; transition: background .18s, transform .18s, box-shadow .18s; }
.button:hover:not(:disabled) { background: var(--glass-strong); box-shadow: 0 4px 12px #35548b14; }
.button:active:not(:disabled), .icon-button:active:not(:disabled), .tab-bar a:active { transform: scale(.97); }
.button-dark, .button-primary { color: #fff; background: linear-gradient(145deg, #6088eb, #4166cd); border-color: #6b91f3; box-shadow: inset 0 1px 0 #ffffff59, 0 5px 13px #4169ce29; }
.button-dark:hover:not(:disabled), .button-primary:hover:not(:disabled) { background: var(--accent-strong); }
.button-quiet { box-shadow: none; border: 0; background: transparent; color: var(--muted); padding: 10px; }
.button-small { min-height: 44px; padding: 9px 14px; font-size: 11px; }
.button-full { width: 100%; margin-top: 20px; min-height: 50px; font-size: 14px; }
.intro { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 35px 40px; border-radius: 34px; min-height: 292px; background: linear-gradient(115deg, #ffffff94, #ffffff38); }
.intro-text { position: relative; z-index: 1; }
.today-label { color: var(--muted); font-size: 12px; margin-bottom: 15px; font-weight: 550; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 9px; letter-spacing: 1.6px; font-weight: 650; line-height: 1.6; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(38px, 4.4vw, 56px); line-height: 1.06; font-weight: 750; letter-spacing: -2.8px; margin-bottom: 17px; }
h1 span { color: #496dc3; }
.intro-copy { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 0; }
.privacy-note { display: inline-flex; align-items: center; gap: 7px; margin-top: 19px; padding: 8px 12px; border: 1px solid var(--highlight); background: var(--glass); border-radius: 999px; color: var(--muted); font-size: 10px; }
.privacy-note svg { width: 14px; height: 14px; }
.hero-art { position: relative; width: 310px; height: 250px; display: grid; place-items: center; flex-shrink: 0; }
.hero-art::before { content: ""; position: absolute; width: 195px; height: 195px; border-radius: 50%; background: radial-gradient(circle at 30% 25%, #f7fbff, #a1c7ee88 55%, #b4a1e74d); box-shadow: inset 1px 3px 10px #ffffffcc, 0 25px 35px #6488c121; }
.glass-drop { width: 134px; height: 162px; position: relative; filter: drop-shadow(0 10px 14px #3c6bd02b); }
.glass-drop svg { width: 100%; height: 100%; }
.orbit { position: absolute; width: 264px; height: 174px; border: 1px solid #ffffffd9; border-radius: 50%; transform: rotate(-28deg); box-shadow: 0 1px 0 #94b4df30; }
.orbit-two { width: 230px; height: 222px; transform: rotate(35deg); border-color: #ffffff8c; }
.art-spark { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: linear-gradient(145deg, white, #b2c9f0); box-shadow: 0 4px 10px #6991d32b; }
.spark-one { top: 33px; right: 55px; }
.spark-two { bottom: 58px; left: 33px; width: 10px; height: 10px; }
.art-caption { position: absolute; bottom: -2px; color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.status { color: var(--muted); min-height: 19px; font-size: 11px; line-height: 1.6; margin: 16px 5px 20px; }
.error-panel { background: var(--danger-bg); border: 1px solid #d08698; border-radius: 18px; padding: 15px 18px; margin-bottom: 20px; font-size: 13px; line-height: 1.6; color: var(--danger); overflow-wrap: anywhere; }
.setup-panel { border-radius: 23px; margin-top: 18px; }
summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 17px 21px; font-size: 13px; font-weight: 600; border-radius: 23px; }
summary::-webkit-details-marker { display: none; }
.setup-symbol { width: 33px; height: 33px; display: grid; place-items: center; flex-shrink: 0; border-radius: 12px; background: #7f9df11f; color: var(--accent); font-size: 24px; font-weight: 350; }
summary small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 4px; }
.setup-action { margin-left: auto; color: var(--accent); font-size: 11px; white-space: nowrap; }
.setup-content { padding: 2px 23px 22px; font-size: 12px; line-height: 1.9; }
.setup-content p { margin-bottom: 12px; }
.setup-content ol { margin: 0; padding-left: 19px; }
code { overflow-wrap: anywhere; font-size: .95em; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 20px; border-radius: 25px; }
.stat-heading { display: flex; align-items: center; gap: 8px; }
.stat-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #976034; background: #f2d8b466; }
.stat-icon svg { width: 19px; height: 19px; }
.stat-sober .stat-icon { color: #247260; background: #a9dfcb66; }
.stat-drinks .stat-icon { color: #5f68b2; background: #cccafa66; }
.stat-checkin .stat-icon { color: #3569a1; background: #acd5fa66; }
.stat-label { font-size: 11px; font-weight: 600; line-height: 1.4; }
.stat p { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }
.stat strong { font-size: 38px; letter-spacing: -1.8px; line-height: 1.1; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat p span, .stat small { font-size: 10px; color: var(--muted); line-height: 1.5; }
.stat small { display: block; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.card { border-radius: 29px; padding: 26px; min-width: 0; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 25px; }
h2 { font-size: 22px; font-weight: 650; letter-spacing: -.7px; margin-bottom: 0; }
.calendar-nav { display: flex; gap: 4px; align-items: center; }
.calendar-tools { display: flex; align-items: center; gap: 12px; margin: -6px 0 17px; }
.selection-count { font-size: 11px; color: var(--muted); line-height: 1.5; }
.selection-actions { display: flex; align-items: center; gap: 14px; margin: -7px 0 18px; flex-wrap: wrap; }
.selection-actions .button { margin-left: auto; }
.icon-button { display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--accent); width: 44px; height: 44px; font-size: 20px; transition: background .15s, transform .15s; }
.icon-button:hover:not(:disabled) { background: var(--glass); }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays { margin-bottom: 12px; }
.weekdays span { text-align: center; font-size: 10px; color: var(--muted); font-weight: 550; }
.day { position: relative; min-height: 62px; padding: 9px 2px 7px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid transparent; border-radius: 18px; background: #ffffff45; color: var(--ink); font-size: 13px; transition: background .15s, box-shadow .15s; }
.day:hover:not(:disabled) { background: var(--glass-strong); }
.day:disabled { opacity: .55; }
.day.outside, .day.future { background: transparent; color: var(--muted); }
.day.sober { background: var(--sober-bg); color: var(--sober); }
.day.drinks { background: var(--drinks-bg); color: var(--drinks); }
.day.selected { border-color: #8ba9f7; background: #cfdeffb0; box-shadow: inset 0 1px 0 #ffffff99, 0 3px 10px #6c8de519; }
.day.selected.sober { background: var(--sober-bg); border-color: var(--sober); }
.day.selected.drinks { background: var(--drinks-bg); border-color: var(--drinks); }
.day.selectable::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border: 1px solid var(--muted); border-radius: 50%; opacity: .55; }
.day.selectable.selected::after { background: var(--accent); border-color: var(--accent); opacity: 1; box-shadow: 0 0 0 2px var(--glass-strong); }
.day.today .day-number { font-weight: 750; text-decoration: underline; text-underline-offset: 4px; }
.day-detail { min-height: 11px; font-size: 9px; }
.day-dot { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: .6; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 17px; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.legend-dot.sober { background: #409e82; }
.legend-dot.drinks { background: #bb8264; }
.legend-dot.unlogged { background: #8d9bb1; }
.entry-card { background: linear-gradient(145deg, #ffffffb0, #edf1ff96); }
.entry-date { color: var(--muted); font-size: 12px; margin: 9px 0 22px; line-height: 1.6; }
.check-in-orb { display: grid; place-items: center; width: 94px; height: 94px; border-radius: 33px; margin: 34px auto 22px; background: linear-gradient(145deg, #abc6ff40, #c3b7f047); border: 1px solid var(--highlight); box-shadow: inset 0 1px 1px var(--highlight); color: var(--accent); }
.check-in-orb svg { width: 48px; height: 48px; }
.check-in-summary { text-align: center; font-size: 16px; font-weight: 600; line-height: 1.6; margin-bottom: 15px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 9px; }
input, textarea, select { border: 1px solid var(--highlight); border-radius: 16px; width: 100%; min-width: 0; background: var(--glass); color: var(--ink); padding: 13px 15px; font-size: 16px; box-shadow: inset 0 1px 2px #45649508; }
input:disabled, textarea:disabled { opacity: .7; }
input[type="date"] { margin-bottom: 20px; min-height: 48px; -webkit-appearance: none; appearance: none; }
input[type="number"] { font-size: 34px; font-weight: 600; letter-spacing: -1.5px; padding: 12px 17px; }
textarea { resize: vertical; line-height: 1.6; min-height: 100px; }
textarea::placeholder { color: var(--muted); opacity: .8; font-size: 13px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.label-row label { margin-bottom: 0; }
.label-row { margin-bottom: 9px; }
.text-button { border: 0; background: transparent; padding: 10px 0; min-height: 44px; color: var(--accent); font-size: 11px; font-weight: 550; }
.text-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.field-help { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 10px 0 20px; }
.optional { font-weight: 400; color: var(--muted); }
.delete-button { color: var(--danger); display: block; margin: 8px auto 0; }
.entry-hint { font-size: 10px; text-align: center; color: var(--muted); line-height: 1.7; margin: 15px 0 0; overflow-wrap: anywhere; }
.history-card { margin-top: 22px; }
.history-actions { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; justify-content: flex-end; }
.text-link { font-size: 11px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.text-link:hover { text-decoration: underline; }
.empty-state { padding: 25px 10px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.8; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
th { font-size: 10px; color: var(--muted); font-weight: 550; padding: 0 10px 14px; }
td { padding: 12px 10px; border-top: 1px solid var(--line); }
td:first-child { white-space: nowrap; font-weight: 500; }
td:nth-child(3) { max-width: 370px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); line-height: 1.6; }
.badge { display: inline-block; border-radius: 20px; padding: 6px 10px; white-space: nowrap; font-size: 10px; }
.badge.sober { background: var(--sober-bg); color: var(--sober); }
.badge.drinks { background: var(--drinks-bg); color: var(--drinks); }
.badge.unknown { background: var(--glass); color: var(--muted); }
footer { padding: 27px 10px calc(125px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 10px; line-height: 1.8; }
footer p { margin-bottom: 8px; }
footer strong { font-weight: 550; }
.tab-bar { position: fixed; z-index: 10; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, 1fr); width: min(420px, calc(100% - 36px)); padding: 7px; border-radius: 32px; background: var(--glass-strong); box-shadow: 0 8px 35px #314b8121, inset 0 1px 1px #ffffffc9; }
.tab-bar a { min-height: 57px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; color: var(--muted); text-decoration: none; font-size: 10px; font-weight: 550; border-radius: 25px; transition: background .2s, transform .15s; }
.tab-bar svg { width: 21px; height: 21px; }
.tab-bar a[aria-current] { color: var(--accent); background: #91b1f429; box-shadow: inset 0 1px 1px #ffffff75; }
section[id] { scroll-margin-top: 22px; }
dialog { color: var(--ink); border-radius: 30px; padding: 28px; max-width: min(440px, calc(100% - 30px)); background: var(--glass-strong); }
dialog::backdrop { background: #1a294950; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 15px 0 24px; }
dialog form { display: flex; justify-content: flex-end; gap: 10px; }
.day-dialog, .bulk-dialog { width: 470px; max-width: calc(100% - 28px); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.day-dialog form, .bulk-dialog form { display: block; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.close-button { color: var(--muted); background: var(--glass); font-size: 25px; flex-shrink: 0; }
.saved-outcome { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; margin-bottom: 20px; }
.saved-outcome-label { font-size: 11px; color: var(--muted); }
.saved-outcome .badge { white-space: normal; text-align: right; }
.outcome-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 5px; background: #7d96c51a; border: 1px solid var(--highlight); border-radius: 19px; margin-bottom: 20px; }
.outcome-choice button { min-height: 44px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 14px; font-size: 13px; font-weight: 600; }
.outcome-choice button[aria-pressed="true"] { color: var(--ink); background: var(--glass-strong); border-color: var(--highlight); box-shadow: 0 3px 9px #344a7a15; }
.dialog-status { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 16px 0 0; }
.dialog-status:empty { display: none; }
.bulk-dates { display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; margin-bottom: 22px; padding: 2px; }
.bulk-dates span { font-size: 10px; color: var(--muted); border: 1px solid var(--highlight); background: var(--glass); padding: 7px 10px; border-radius: 99px; }
#bulk-drinks-field { margin-top: 20px; }
.button-danger { background: var(--danger); border-color: var(--danger); color: white; }
.button-danger:hover:not(:disabled) { background: #82243b; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 30; top: -100px; left: 20px; background: var(--solid); padding: 15px; border-radius: 14px; }
.skip-link:focus { top: 10px; }

@media (max-width: 1000px) {
  .app-shell { padding-left: max(22px, env(safe-area-inset-left)); padding-right: max(22px, env(safe-area-inset-right)); }
  .workspace { grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 16px; }
  .card { padding: 22px; }
  .stat { padding: 17px; }
  .stat-heading { gap: 6px; }
  .stat-label { font-size: 10px; }
  .calendar-card .card-heading { align-items: flex-start; flex-wrap: wrap; }
  .calendar-grid, .weekdays { gap: 4px; }
  .hero-art { width: 260px; }
}
@media (max-width: 720px) {
  .app-shell { padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .topbar { padding: 16px; border-radius: 26px; flex-wrap: wrap; gap: 15px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 43px; height: 43px; border-radius: 14px; }
  .brand-caption { font-size: 7px; letter-spacing: 1.8px; }
  .account-controls { justify-content: flex-start; width: 100%; gap: 9px; border-top: 1px solid var(--line); padding-top: 12px; }
  .account-label { align-items: flex-start; flex: 1; font-size: 11px; }
  .account-controls .button { padding: 10px 13px; font-size: 11px; }
  .account-controls .button-quiet { margin-left: auto; padding: 8px; }
  .intro { padding: 27px 23px; margin-top: 16px; border-radius: 29px; min-height: 270px; }
  h1 { font-size: 43px; letter-spacing: -2.1px; }
  .today-label { font-size: 11px; margin-bottom: 15px; }
  .intro-copy { font-size: 12px; max-width: 290px; }
  .hero-art { position: absolute; width: 190px; height: 190px; right: -65px; top: 12px; opacity: .32; pointer-events: none; }
  .hero-art::before { width: 150px; height: 150px; }
  .glass-drop { width: 102px; height: 125px; }
  .orbit { width: 200px; height: 145px; }
  .orbit-two { width: 175px; height: 180px; }
  .art-caption, .art-spark { display: none; }
  .privacy-note { font-size: 9px; margin-top: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-bottom: 16px; }
  .stat { padding: 17px 15px; border-radius: 23px; }
  .stat p { margin: 13px 0 7px; }
  .stat strong { font-size: 34px; }
  .stat-label { font-size: 10px; }
  .stat-icon { width: 26px; height: 26px; border-radius: 9px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat small { font-size: 9px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .card { padding: 22px 17px; border-radius: 26px; }
  .card-heading { margin-bottom: 22px; }
  .calendar-card .card-heading { align-items: center; gap: 8px; }
  .calendar-nav { gap: 0; }
  .calendar-nav .icon-button { width: 36px; }
  .calendar-nav .button-small { padding: 8px 10px; }
  h2 { font-size: 21px; }
  .eyebrow { font-size: 8px; letter-spacing: 1.2px; }
  .day { min-height: 55px; border-radius: 14px; }
  .legend { gap: 12px; font-size: 9px; }
  .history-card { margin-top: 16px; }
  .history-card .card-heading { align-items: flex-start; flex-wrap: wrap; }
  .history-actions { justify-content: flex-start; }
  .setup-panel { border-radius: 22px; margin-top: 15px; }
  summary { padding: 15px; gap: 10px; font-size: 12px; }
  summary small { font-size: 10px; }
  .setup-action { font-size: 10px; }
  .setup-content { padding: 2px 18px 20px; }
  .day-dialog, .bulk-dialog { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); margin: auto; padding: 23px 20px; width: calc(100% - 20px); max-width: 470px; max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); }
  td, th { padding-left: 6px; padding-right: 6px; }
  .tab-bar { bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --page: #10182c; --ink: #edf2ff; --muted: #afbed8; --accent: #a4bfff; --accent-strong: #4565bc; --line: #a4b9e029; --glass: #25324ab8; --glass-strong: #25324ae8; --solid: #202d45; --highlight: #b2c8fc30; --shadow: 0 12px 40px #050b1b26, inset 0 1px 0 #cfddff14; --sober: #98e8c9; --sober-bg: #245e519e; --drinks: #f2c5a4; --drinks-bg: #6843309e; --danger: #ffb2c1; --danger-bg: #432b3be8; }
  body::before { background: radial-gradient(ellipse at 7% 15%, #243b686e, transparent 55%), radial-gradient(ellipse at 95% 30%, #44346166, transparent 50%), radial-gradient(ellipse at 75% 87%, #1c4e676e, transparent 55%), #10182c; }
  .intro { background: linear-gradient(115deg, #293955cc, #2c2f4d8c); }
  h1 span { color: #a8bfff; }
  .hero-art { opacity: .65; }
  .entry-card { background: linear-gradient(145deg, #29384fd9, #272f4cc9); }
  .day { background: #c4d8ff09; }
  .day.selected { background: #3d548e99; }
  .button-dark, .button-primary { color: white; }
  .button-danger { background: #9d3b50; border-color: #b94d63; color: white; }
  .stat-icon { color: #f1c18c; }
  .stat-sober .stat-icon { color: #9ae2c5; }
  .stat-drinks .stat-icon { color: #ccc5ff; }
  .stat-checkin .stat-icon { color: #b3d9ff; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .intro, .stat, .card, .setup-panel, .tab-bar, dialog { background: var(--solid); }
}
@media (prefers-color-scheme: dark) and (max-width: 720px) {
  .hero-art { opacity: .2; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .topbar, .intro, .stat, .card, .setup-panel, .tab-bar, dialog { background: var(--solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  input, textarea, select { background: var(--solid); border-color: var(--muted); }
  .hero-art { display: none; }
  .day { border-color: var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
