:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1d2129;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --danger: #dc2626;
  --due: #b91c1c;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.app-header h1 { font-size: 20px; margin: 0; }
.header-actions { display: flex; gap: 8px; }

/* login screen */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.login-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-box h2 { margin: 0 0 4px; font-size: 22px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.login-box input[type="password"] {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 48px;
}

h2 { font-size: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input[type="file"],
input[type="datetime-local"],
textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

textarea { resize: vertical; }

.preview { margin-bottom: 14px; }
.preview img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}
.extract-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.extract-msg { font-size: 13px; color: var(--muted); }
.extract-msg.success { color: var(--ok); }
.extract-msg.error { color: var(--danger); }

button { cursor: pointer; font: inherit; }

.primary-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
  font-size: 15px;
}
.primary-btn:active { transform: translateY(1px); }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink);
}
.ghost-btn.enabled { border-color: var(--ok); color: var(--ok); }

.form-msg { font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--ok); }

.list-title { margin: 8px 0 12px; }
summary.list-title { cursor: pointer; }

.list { display: flex; flex-direction: column; gap: 12px; }

.reminder {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.reminder.due { border-color: var(--due); box-shadow: 0 0 0 1px var(--due); }
.reminder.done { opacity: 0.6; }

.reminder .thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex-shrink: 0;
  cursor: pointer;
}

.reminder .body { flex: 1; min-width: 0; }
.reminder .note { white-space: pre-wrap; word-break: break-word; margin: 0 0 6px; }
.reminder .when { font-size: 13px; color: var(--muted); }
.reminder .when.due { color: var(--due); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.actions .done-btn { border-color: var(--ok); color: var(--ok); }
.actions .del-btn { border-color: var(--danger); color: var(--danger); }

.snooze-row { display: none; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.snooze-row.open { display: flex; }
.snooze-row input[type="datetime-local"] { width: auto; flex: 1; min-width: 180px; }

.empty { color: var(--muted); font-size: 14px; }
.hidden { display: none !important; }

/* lightbox for viewing the full screenshot */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
