:root {
  color-scheme: light;
  --background: #f2f2f7;
  --surface: rgba(255, 255, 255, 0.94);
  --text: #111113;
  --secondary: #6e6e73;
  --separator: rgba(60, 60, 67, 0.17);
  --yellow: #ffd60a;
  --yellow-dark: #8a6500;
  --blue: #007aff;
  --danger: #ff3b30;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { display: flex; min-height: 100vh; min-height: 100dvh; margin: 0; flex-direction: column; background: var(--background); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { display: flex; width: min(100%, 720px); min-height: 0; margin: 0 auto; padding: env(safe-area-inset-top) 18px 28px; flex: 1; flex-direction: column; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; padding: 22px 2px 18px; }
.eyebrow { margin: 0 0 2px; color: var(--yellow-dark); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 8vw, 40px); line-height: 1; letter-spacing: -.035em; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--yellow); color: #151000; font-size: 30px; line-height: 1; box-shadow: 0 4px 14px rgba(0,0,0,.09); }

.push-card { display: flex; gap: 11px; align-items: center; margin-bottom: 18px; padding: 12px 13px; border: 1px solid rgba(255, 214, 10, .5); border-radius: var(--radius); background: #fff9d9; box-shadow: 0 2px 10px rgba(0,0,0,.035); }
.push-icon { font-size: 22px; }
.push-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.push-copy strong { font-size: 14px; }
.push-copy span { color: var(--secondary); font-size: 12px; line-height: 1.3; }
.small-button { border: 0; border-radius: 9px; padding: 8px 10px; background: var(--yellow); color: #191400; font-size: 13px; font-weight: 700; white-space: nowrap; }

.reminder-list { overflow: hidden; border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.025); }
.reminder-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; min-height: 82px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--separator); }
.reminder-item:last-child { border-bottom: 0; }
.reminder-item.is-off { opacity: .55; }
.reminder-main { min-width: 0; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; }
.bell { font-size: 22px; filter: grayscale(1); }
.is-on .bell { filter: none; }
.reminder-title { overflow: hidden; margin: 0 0 4px; font-size: 16px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.reminder-meta { margin: 2px 0; color: var(--secondary); font-size: 13px; line-height: 1.25; }
.item-actions { display: flex; align-items: center; gap: 8px; }
.delete-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid rgba(255, 59, 48, .22); border-radius: 50%; background: #ffe9e7; color: var(--danger); font-size: 20px; font-weight: 700; line-height: 1; transition: transform .12s, background .12s; }
.delete-button:hover { background: #ffd8d4; }
.delete-button:active { transform: scale(.92); }
.delete-button:focus-visible { outline: 3px solid rgba(255, 59, 48, .28); outline-offset: 2px; }

.empty-state { display: flex; width: 100%; min-height: 220px; flex: 1; flex-direction: column; align-items: center; justify-content: center; padding: 24px 0; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-bell { font-size: 44px; filter: grayscale(1); opacity: .5; }
.empty-state h2 { margin: 12px 0 6px; font-size: 21px; }
.empty-state p { margin: 0; color: var(--secondary); }

.editor-dialog { overflow: hidden; width: min(100% - 20px, 620px); max-height: min(92dvh, 880px); margin: auto; padding: 0; border: 0; border-radius: 20px; background: var(--background); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.editor-dialog::backdrop { background: rgba(0,0,0,.34); backdrop-filter: blur(3px); }
.editor-dialog form { display: flex; height: 100%; max-height: inherit; min-height: 0; flex-direction: column; }
.sheet-header { position: relative; z-index: 1; display: grid; flex: 0 0 auto; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 13px 12px; border-bottom: 1px solid var(--separator); background: rgba(249,249,249,.97); }
.sheet-header h2 { margin: 0; font-size: 16px; text-align: center; }
.sheet-header .text-button:last-child { justify-self: end; }
.text-button { border: 0; padding: 7px 4px; background: transparent; color: var(--blue); }
.text-button.strong { font-weight: 700; }
.form-scroll { overflow-x: hidden; overflow-y: auto; min-height: 0; padding: 18px 14px calc(22px + env(safe-area-inset-bottom)); flex: 1 1 auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.form-section { margin-bottom: 22px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 14px 7px; }
.section-heading .section-label { margin: 0; }
.section-label { margin: 0 14px 7px; color: var(--secondary); font-size: 12px; letter-spacing: .025em; text-transform: uppercase; }
.required-note { margin: 0; color: var(--secondary); font-size: 11px; white-space: nowrap; }
.required-note span, .required-mark { color: var(--danger); font-weight: 700; }
.form-row { display: flex; min-height: 48px; align-items: center; gap: 14px; padding: 9px 14px; border-bottom: 1px solid var(--separator); background: white; }
.form-row:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.form-row:last-of-type { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.single-section .form-row { border: 0; border-radius: var(--radius); }
.form-row > span:first-child { flex: 0 0 auto; }
.form-row input:not(.switch), .form-row textarea, .form-row select { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); text-align: right; }
.form-row textarea { resize: vertical; text-align: left; line-height: 1.35; }
.form-row-stack { align-items: flex-start; flex-direction: column; }
.form-row-stack textarea { padding: 4px 0; }
.inline-control { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.inline-control input { max-width: 70px; }
.inline-control small { color: var(--secondary); }
.section-note { margin: 7px 14px 0; color: var(--secondary); font-size: 12px; line-height: 1.35; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 9px; background: #e5e5ea; }
.segmented button { min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 13px; }
.segmented button.selected { background: white; box-shadow: 0 1px 4px rgba(0,0,0,.15); font-weight: 600; }
.weekday-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.weekday-picker button { aspect-ratio: 1; min-width: 0; border: 0; border-radius: 50%; background: #e5e5ea; color: var(--text); font-size: 12px; font-weight: 650; }
.weekday-picker button.selected { background: var(--yellow); color: #171200; }
.add-row-button { width: 100%; min-height: 48px; border: 0; border-radius: var(--radius); background: white; color: var(--blue); text-align: left; padding: 0 14px; }
.fixed-row { display: flex; align-items: center; min-height: 48px; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--separator); background: white; }
.fixed-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.fixed-row:last-child { margin-bottom: 8px; border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.fixed-row label { display: flex; flex: 1; align-items: center; justify-content: space-between; }
.fixed-row input { border: 0; outline: 0; background: transparent; }
.remove-time { border: 0; background: transparent; color: var(--danger); font-size: 20px; }
.switch { appearance: none; width: 51px; height: 31px; margin-left: auto; border-radius: 17px; background: #e5e5ea; transition: .18s; }
.switch::after { display: block; width: 27px; height: 27px; margin: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.3); content: ""; transition: .18s; }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.form-error { z-index: 1; margin: 0; padding: 11px 14px; flex: 0 0 auto; border-bottom: 1px solid rgba(162,29,23,.16); background: #ffe5e3; color: #a21d17; font-size: 13px; font-weight: 650; line-height: 1.35; text-align: center; }
.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 10; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 11px 15px; border-radius: 12px; background: rgba(20,20,20,.9); color: white; font-size: 13px; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.site-footer { width: min(100% - 36px, 720px); margin: 0 auto; padding: 22px 12px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--separator); color: var(--secondary); font-size: 12px; line-height: 1.4; text-align: center; }
.developer-credit { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 8px 6px; color: var(--secondary); font-weight: 600; text-decoration: none; transition: color .15s; }
.developer-credit:hover { color: var(--text); }
.developer-credit:focus-visible { border-radius: 5px; outline: 3px solid rgba(255, 214, 10, .55); outline-offset: 3px; }
.developer-credit-icon { flex: 0 0 auto; color: #ffa500; }
.developer-credit-link { color: var(--text); text-decoration: underline; text-decoration-color: #ffa500; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.site-footer p { margin: 7px 0 0; }

@media (max-width: 520px) {
  .app-shell { padding-right: 12px; padding-left: 12px; }
  .site-footer { width: calc(100% - 24px); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .editor-dialog { width: 100%; height: calc(100dvh - env(safe-area-inset-top)); max-height: none; margin-top: env(safe-area-inset-top); margin-bottom: 0; border-radius: 22px 22px 0 0; }
  .editor-dialog form { max-height: none; }
  .push-card { align-items: flex-start; }
  .push-icon { display: none; }
  .weekday-picker { gap: 5px; }
}

@media (display-mode: standalone) and (max-width: 520px) {
  .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .push-card { flex-wrap: wrap; }
  .push-copy { flex-basis: 100%; }
  .push-card .small-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
