:root {
  color-scheme: light;
  --page: #f2f2f7;
  --surface: #ffffff;
  --surface-raised: #fbfbfd;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d9dbe3;
  --blue: #007aff;
  --blue-soft: #e7f1ff;
  --red: #ff3b30;
  --red-soft: #fff0ef;
  --green: #34c759;
  --green-soft: #ecfaef;
  --orange: #ff9500;
  --orange-soft: #fff4e2;
  --purple: #af52de;
  --purple-soft: #f8edff;
  --gray: #8e8e93;
  --gray-soft: #eeeeef;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(242, 242, 247, .86);
  border-bottom: 1px solid rgba(217, 219, 227, .72);
  display: flex;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 max(14px, env(safe-area-inset-left));
  position: sticky;
  top: 0;
  z-index: 4;
}

.brand {
  color: var(--blue);
  font-size: .98rem;
  font-weight: 700;
}

.topnav {
  align-items: center;
  display: flex;
  gap: 16px;
}

.topnav a,
.link-button,
.text-action {
  background: transparent;
  border: 0;
  color: var(--blue);
  font-weight: 650;
  padding: 0;
}

.page {
  margin: 0 auto;
  max-width: 760px;
  padding: 22px 14px 92px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.02;
  margin-bottom: 0;
}

h2 {
  font-size: 1.08rem;
  line-height: 1.25;
}

.eyebrow,
.muted,
dt {
  color: var(--muted);
}

.eyebrow {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 3px;
}

.reminder-hero,
.editor-head,
.toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.editor-head {
  min-height: 44px;
  text-align: center;
}

.editor-head > div {
  min-width: 0;
}

.editor-head h1 {
  font-size: 1.3rem;
  line-height: 1.16;
}

.submit-proxy {
  font-weight: 750;
}

.new-button {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.9rem;
  font-weight: 360;
  height: 42px;
  justify-content: center;
  line-height: 1;
  width: 42px;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.summary-tile {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  min-height: 86px;
  padding: 12px;
}

.summary-tile span {
  color: var(--muted);
  font-weight: 750;
}

.summary-tile strong {
  font-size: 2rem;
  line-height: 1;
}

.summary-tile.blue strong {
  color: var(--blue);
}

.summary-tile.red strong {
  color: var(--red);
}

.summary-tile.green strong {
  color: var(--green);
}

.summary-tile.gray strong {
  color: var(--gray);
}

.summary-tile.active {
  border-color: rgba(0, 122, 255, .42);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, .18);
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filters a {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-weight: 700;
  min-height: 34px;
  padding: 6px 12px;
}

.filters a.active {
  background: var(--blue-soft);
  border-color: rgba(0, 122, 255, .34);
  color: var(--blue);
}

.reminder-list,
.settings-list,
.task-list {
  background: var(--surface);
  border: 1px solid rgba(217, 219, 227, .88);
  border-radius: var(--radius);
  overflow: hidden;
}

.date-section {
  margin-bottom: 14px;
}

.date-section h2 {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
  margin: 0 0 7px 4px;
}

.reminder-row {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 62px;
  padding: 12px 14px;
}

.reminder-row.occurrence-row {
  grid-template-columns: 78px 28px minmax(0, 1fr);
}

.reminder-row + .reminder-row {
  border-top: 1px solid var(--line);
}

.reminder-row.overdue {
  background: var(--red-soft);
}

.circle-complete {
  display: flex;
  margin: 1px 0 0;
}

.date-chip {
  align-self: center;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.date-chip.today {
  color: var(--blue);
}

.circle-complete button,
.done-circle {
  background: white;
  border: 2px solid #c7c7cc;
  border-radius: 50%;
  display: block;
  height: 22px;
  min-height: 22px;
  padding: 0;
  width: 22px;
}

.circle-complete button:hover {
  border-color: var(--blue);
}

.done-circle {
  background: var(--blue);
  border-color: var(--blue);
  position: relative;
}

.done-circle::after {
  border: solid white;
  border-width: 0 2px 2px 0;
  content: "";
  height: 9px;
  left: 6px;
  position: absolute;
  top: 3px;
  transform: rotate(45deg);
  width: 5px;
}

.reminder-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.reminder-title {
  font-size: 1rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.reminder-note,
.reminder-meta {
  color: var(--muted);
  font-size: .86rem;
  overflow-wrap: anywhere;
}

.task-badges {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
}

.flag-badge,
.priority-badge,
.tag-chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1;
  max-width: 100%;
  min-height: 22px;
  padding: 5px 8px;
}

.flag-badge {
  background: var(--orange-soft);
  color: #9a5a00;
}

.priority-badge {
  background: var(--red-soft);
  color: var(--red);
  letter-spacing: 0;
}

.tag-chip {
  background: var(--gray-soft);
  color: #4f535c;
  overflow-wrap: anywhere;
}

.tag-blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag-green {
  background: var(--green-soft);
  color: #176b2c;
}

.tag-orange {
  background: var(--orange-soft);
  color: #9a5a00;
}

.tag-red {
  background: var(--red-soft);
  color: var(--red);
}

.tag-purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.reminder-row.overdue .reminder-meta {
  color: var(--red);
  font-weight: 700;
}

.floating-add {
  align-items: center;
  background: rgba(242, 242, 247, .9);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(217, 219, 227, .7);
  bottom: 0;
  color: var(--blue);
  display: flex;
  gap: 8px;
  left: 0;
  min-height: 58px;
  padding: 9px max(16px, env(safe-area-inset-left)) calc(9px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 5;
}

.floating-add span {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  font-size: 1.45rem;
  font-weight: 380;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

.floating-add strong {
  font-size: 1rem;
}

.reminder-form {
  display: grid;
  gap: 14px;
}

.field-stack,
.auth-panel,
.form-panel,
.detail-card,
.completion-sheet,
.note,
.danger-zone {
  background: var(--surface);
  border: 1px solid rgba(217, 219, 227, .88);
  border-radius: var(--radius);
  padding: 14px;
}

.title-stack {
  padding: 4px 12px;
}

.title-stack input {
  border: 0;
  font-size: 1.25rem;
  font-weight: 650;
  min-height: 50px;
  padding-left: 0;
  padding-right: 0;
}

.settings-list {
  display: grid;
}

.settings-list label,
.settings-list.readonly > div {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 52px;
  padding: 0 14px;
}

.settings-list label + label,
.settings-list.readonly > div + div {
  border-top: 1px solid var(--line);
}

.settings-list span,
.settings-list dt {
  color: var(--ink);
  font-size: .96rem;
  font-weight: 600;
}

.settings-list dd {
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

label {
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 42px;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(0, 122, 255, .45);
  outline-offset: 2px;
}

.settings-list input,
.settings-list select {
  border: 0;
  color: var(--muted);
  min-height: 44px;
  padding-right: 0;
  text-align: right;
}

.settings-list .checkbox-setting input {
  justify-self: end;
  min-height: 22px;
  width: 22px;
}

.stack-label {
  color: var(--ink);
  display: block;
  margin-bottom: 10px;
}

.choice-chips > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-chips label {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-weight: 800;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
}

.choice-chips input {
  min-height: 16px;
  width: 16px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.field-stack textarea,
.completion-sheet textarea {
  border: 0;
  padding: 0;
}

.completion-sheet {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.primary,
.secondary,
.danger,
.danger-zone button,
.occurrence button,
.quick-complete button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
}

.primary {
  background: var(--blue);
  color: white;
}

.secondary {
  background: white;
  border-color: var(--line);
}

.danger,
.danger-zone button {
  background: var(--red-soft);
  border-color: rgba(255, 59, 48, .26);
  color: var(--red);
  width: 100%;
}

.detail-card {
  display: grid;
  gap: 14px;
}

.detail-card.overdue {
  border-color: rgba(255, 59, 48, .38);
}

.detail-title-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
}

.detail-title-row h2 {
  font-size: 1.25rem;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.detail-title-row p {
  color: var(--muted);
  margin-bottom: 0;
  white-space: pre-wrap;
}

.detail-status {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 750;
}

.detail-status.open {
  color: var(--blue);
}

.detail-status.completed {
  color: var(--green);
}

.note {
  color: var(--muted);
  margin: 14px 0 0;
  white-space: pre-wrap;
}

.done-note {
  background: var(--green-soft);
  color: #176b2c;
}

.danger-zone {
  margin-top: 14px;
  padding: 0;
}

.occurrences {
  margin-top: 24px;
}

.occurrences h2 {
  color: var(--muted);
  font-size: .84rem;
  margin: 0 0 8px 4px;
}

.occurrence {
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(217, 219, 227, .88);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 12px 14px;
}

.occurrence.missed {
  background: var(--red-soft);
  border-color: rgba(255, 59, 48, .3);
}

.occurrence small {
  color: var(--muted);
  display: block;
}

.occurrence form {
  min-width: 76px;
}

.occurrence button {
  background: var(--blue);
  color: white;
  width: 100%;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.message,
.form-errors,
.errorlist {
  background: var(--red-soft);
  border: 1px solid rgba(255, 59, 48, .25);
  border-radius: var(--radius);
  color: var(--red);
  margin: 0;
  padding: 10px 12px;
}

.message {
  background: var(--green-soft);
  border-color: rgba(52, 199, 89, .25);
  color: #176b2c;
}

.errorlist {
  list-style-position: inside;
  margin-bottom: 8px;
}

.empty {
  color: var(--muted);
  padding: 18px 14px;
}

.task-list {
  display: grid;
  gap: 0;
}

.task-card {
  background: var(--surface);
  padding: 14px;
}

.task-card + .task-card {
  border-top: 1px solid var(--line);
}

.task-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.badge {
  border-radius: 999px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  padding: 4px 8px;
}

.badge.open {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.completed {
  background: var(--green-soft);
  color: var(--green);
}

.quick-complete {
  margin-top: 10px;
}

.quick-complete button {
  background: var(--blue);
  color: white;
  width: 100%;
}

.form-panel p,
.auth-panel p {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.ai-status-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.compact-meta {
  display: grid;
  gap: 0;
  margin: 4px 0 14px;
}

.compact-meta > div {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 42px;
  padding: 10px 0;
}

.compact-meta dd {
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.inline-actions,
.paste-form,
.oauth-box {
  display: grid;
  gap: 10px;
}

.inline-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-link {
  text-align: center;
}

.oauth-box {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 12px;
}

.oauth-box summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 750;
  margin-bottom: 8px;
}

.oauth-box textarea[readonly] {
  color: var(--muted);
  font-size: .82rem;
  min-height: 82px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (min-width: 720px) {
  .page {
    padding-top: 34px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .floating-add {
    border: 1px solid rgba(0, 122, 255, .18);
    border-radius: 999px;
    bottom: 22px;
    left: calc(50% - 380px + 14px);
    min-height: 48px;
    padding: 9px 16px;
    right: auto;
  }
}

@media (max-width: 420px) {
  .settings-list label,
  .settings-list.readonly > div {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .inline-actions {
    grid-template-columns: 1fr;
  }
}
