:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #22d3ee;
  --accent-dark: #0891b2;
  --danger: #f87171;
  --due: #fbbf24;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 3rem;
}

.pull-indicator {
  --pull-dist: -50px;
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--pull-dist));
  left: 50%;
  margin-left: -18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  z-index: 20;
  transition: top 0.25s ease, transform 0.2s ease;
  pointer-events: none;
}

.pull-indicator.dragging {
  transition: none;
}

.pull-indicator.ready {
  transform: rotate(180deg);
}

.pull-indicator.spinning {
  animation: pull-spin 0.7s linear infinite;
}

@keyframes pull-spin {
  to {
    transform: rotate(360deg);
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(env(safe-area-inset-top) + 1rem) 1rem 1rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--surface-2);
}

.app-header h1 {
  font-size: 1.4rem;
  margin: 0;
}

main {
  padding: 0 1rem;
  max-width: 640px;
  margin: 0 auto;
}

.status-line {
  color: var(--text-dim);
  font-size: 0.85rem;
  min-height: 1.2em;
}

h2 {
  font-size: 1.05rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.5rem 0 0.75rem;
}

.btn-block {
  display: block;
  width: 100%;
  flex: none;
  margin-bottom: 1rem;
}

.reminder-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reminder-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.due-list .reminder-card {
  background: var(--surface-2);
  border: 1px solid var(--due);
}

.reminder-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
}

.reminder-title {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.reminder-meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.due-since {
  color: var(--due);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.3rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge.due {
  background: var(--due);
  color: #1c1300;
  font-weight: 600;
}

.badge.disabled {
  background: transparent;
  border: 1px solid var(--text-dim);
}

.reminder-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-hint {
  color: var(--text-dim);
  text-align: center;
  margin-top: 2rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

.btn-primary {
  background: var(--accent);
  color: #04222a;
}

.btn-primary:active {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  flex: 0 0 auto;
}

dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(420px, 92vw);
  padding: 1.25rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0.85rem 0 0.3rem;
}

form input[type='text'],
form input[type='number'],
form input[type='time'],
form input[type='date'],
form select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--surface-2);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

fieldset {
  border: 1px solid var(--surface-2);
  border-radius: 10px;
  margin-top: 0.85rem;
  padding: 0.6rem 0.75rem 0.85rem;
}

fieldset legend {
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0 0.3rem;
}

.row {
  display: flex;
  gap: 0.5rem;
}

.row input,
.row select {
  flex: 1;
  min-width: 0;
}

.inline-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
}

.checkbox-label {
  margin-top: 1rem;
}

.checkbox-label input {
  width: auto;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.snooze-presets {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.field-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 0.2rem 0 0;
}
