:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #ded8cc;
  --accent: #177e89;
  --accent-strong: #0f6069;
  --danger: #b9472f;
  --gold: #d99b2b;
  --shadow: 0 16px 40px rgba(55, 48, 40, 0.11);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(23, 126, 137, 0.08), transparent 280px),
    var(--bg);
  color: var(--text);
}

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

button,
a.button,
summary {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

.quick-entry {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 13px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

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

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 126, 137, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(128px, 0.38fr);
  gap: 12px;
}

.form-actions,
.dialog-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.danger {
  color: var(--danger);
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 0 8px;
}

.stats-band div {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  padding: 12px;
}

.stats-band span {
  font-size: 1.6rem;
  font-weight: 850;
  color: var(--accent-strong);
}

.stats-band p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.list-section {
  padding-top: 16px;
}

.section-heading,
summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.section-heading h2,
summary span:first-child {
  color: var(--text);
  font-size: 1rem;
  font-weight: 850;
}

.section-heading > span,
summary span:last-child {
  min-width: 30px;
  border-radius: 999px;
  background: #e8f3f2;
  color: var(--accent-strong);
  padding: 4px 9px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 850;
}

.reminder-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.reminder-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 14px;
}

.reminder-item.overdue {
  border-left-color: var(--danger);
}

.reminder-item.completed {
  border-left-color: var(--gold);
}

.item-main {
  display: grid;
  gap: 8px;
}

.item-content {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.meta-pill {
  border-radius: 999px;
  background: #f1eee6;
  padding: 4px 9px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.65);
  padding: 18px;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.history-section {
  padding-bottom: 20px;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

summary {
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

dialog {
  width: min(440px, calc(100% - 28px));
  border: none;
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(31, 41, 51, 0.32);
}

.dialog-card {
  margin: 0;
  padding: 20px;
  background: var(--surface-strong);
}

.dialog-card p {
  color: var(--muted);
  line-height: 1.55;
}

.shortcut-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  padding: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.setup-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.55;
}

.small-note {
  font-size: 0.88rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .form-grid,
  .stats-band {
    grid-template-columns: 1fr 1fr;
  }

  .quick-entry {
    padding: 15px;
  }
}

@media (max-width: 420px) {
  .form-grid,
  .stats-band {
    grid-template-columns: 1fr;
  }

  .button {
    flex: 1 1 auto;
  }
}
