/* Mobile-first, one-handed use: big tap targets, generous spacing, high
   contrast. Copied from printapp's stylesheet (this app's starting point)
   and trimmed to what the to-do list UI actually needs — no room buttons,
   no project rows, plus a title-preview and checklist-preview added. */

:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1c1a17;
  --muted: #6b6459;
  --primary: #b5451f;
  --primary-ink: #ffffff;
  --border: #ddd6c9;
  --danger: #b3261e;
  --ok: #2e7d32;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

h1, h2 { line-height: 1.2; }

.muted { color: var(--muted); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--ink); flex: 1; }
.topbar .signout { margin: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn-large { font-size: 1.25rem; min-height: 64px; }
.btn:disabled { opacity: 0.6; }

/* Auth */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.auth-shell { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; margin-bottom: 16px; }
.auth-emoji { font-size: 3rem; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); }
.error-box { background: #fbeae8; color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; }

/* Generic page */
.page { max-width: 640px; margin: 0 auto; padding: 20px 16px 60px; }

/* Inputs */
.text-input, .contents-input {
  width: 100%;
  font-size: 1.1rem;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
}
.text-input:focus, .contents-input:focus { outline: 3px solid var(--primary); outline-offset: 1px; }
.contents-input { resize: vertical; }

/* New-list page — wider than the generic 640px .page: this is a text-entry
   page (the items textarea), and 640px felt cramped on anything wider than
   a phone. The printed-slip preview below stays visually narrow on its own
   (.preview-frame canvas keeps max-width: 300px) since it's a true-to-scale
   representation of a physically narrow receipt, independent of how wide
   the page around it is. */
.list-page { max-width: 960px; margin: 0 auto; padding: 16px 16px 100px; }
.title-preview {
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 16px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.field-block { margin-bottom: 22px; }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }

.autosave-hint { font-size: 0.85rem; color: var(--ok); min-height: 1.2em; text-align: right; }

.urgent-toggle {
  width: 100%;
  min-height: 64px;
  border: 3px solid var(--danger);
  background: var(--card);
  color: var(--danger);
  border-radius: var(--radius);
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
}
.urgent-toggle.active { background: var(--danger); color: #fff; }

.preview-frame {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  justify-content: center;
}
.preview-frame canvas { width: 100%; max-width: 300px; height: auto; border: 1px solid #eee; }

.status-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
}
.status-pending { background: #fff4e0; color: #8a5a00; }
.status-ok { background: #e6f4ea; color: var(--ok); }
.status-error { background: #fbeae8; color: var(--danger); }

/* Public lookup page */
.lookup-page { display: flex; justify-content: center; padding-top: 40px; }
.lookup-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 480px; width: 100%; }
.lookup-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.urgent-banner { background: var(--danger); color: #fff; font-weight: 800; padding: 10px; border-radius: 10px; text-align: center; margin-bottom: 16px; }
.lookup-items { list-style: none; margin: 0; padding: 0; }
.lookup-items li { display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 1.1rem; }
.lookup-items li:last-child { border-bottom: none; }
.lookup-items .box { flex-shrink: 0; width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 4px; }
.lookup-id { margin-top: 16px; }
