:root {
  --ink: #171717;
  --muted: #6a6a6a;
  --paper: #eeeeee;
  --card: #ffffff;
  --line: #d9d9d9;
  --accent: #c83e49;
  --accent-soft: #fae9eb;
  --danger: #a72f3a;
  --shadow: 0 8px 28px rgba(0, 0, 0, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, input[type="checkbox"] { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(200, 62, 73, .28);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

.center-card {
  width: min(92vw, 520px);
  margin: 14vh auto;
  padding: 36px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.center-card h1 { margin: 4px 0 12px; font: 700 2rem/1.1 Georgia, serif; }
.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  font: 700 18px/1 Georgia, serif;
  letter-spacing: .08em;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted, .optional { color: var(--muted); }
.optional { font-weight: 500; }

.site-header {
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 22px max(22px, env(safe-area-inset-left));
  border-top: 8px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: white;
}
.header-inner, .summary-row, .page-shell {
  width: min(980px, 100%);
  margin-inline: auto;
}
.header-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.site-header h1 { margin: 0; font: 700 clamp(2rem, 5vw, 3.2rem)/1.05 Georgia, serif; letter-spacing: -.025em; }
.subtitle { max-width: 600px; margin: 9px 0 0; color: var(--muted); }
.identity-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.identity-button, .sync-state {
  display: inline-flex;
  min-height: 36px;
  padding: 7px 11px;
  align-items: center;
  border: 1px solid #bdbdbd;
  border-radius: 999px;
  color: var(--ink);
  background: white;
}
.identity-button { font-weight: 750; }
.sync-state { gap: 6px; color: var(--muted); font-size: .8rem; }
.sync-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.sync-state[data-state="saving"]::before { background: #777; }
.sync-state[data-state="offline"]::before { background: var(--danger); }
.text-button { padding: 7px 2px; border: 0; color: var(--muted); background: transparent; text-decoration: underline; }
.summary-row { margin-top: 22px; }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: .86rem; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e5e5e5; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }

.page-shell { padding: 26px 22px 110px; }
.list-section + .list-section { margin-top: 38px; }
.list-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 0 2px 9px;
  border-bottom: 1px solid #c9c9c9;
}
.list-section-heading h2 { margin: 0; font: 700 1.55rem/1.2 Georgia, serif; }
.list-section-heading span { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.item-grid { display: grid; gap: 12px; }
.punch-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .04);
  cursor: pointer;
  transition: border-color .18s, opacity .18s, background .18s;
}
.punch-item:hover { border-color: #bfbfbf; }
.punch-item.is-done { opacity: .62; background: #f7f7f7; }
.punch-item.is-done h3 { text-decoration: line-through; text-decoration-color: #777; }
.item-heading { display: flex; align-items: flex-start; gap: 12px; }
.item-check { flex: 0 0 auto; width: 25px; height: 25px; margin: 1px 0 0; accent-color: var(--accent); }
.item-title-wrap { min-width: 0; }
.item-number { display: block; margin-bottom: 2px; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.item-title-wrap h3 { margin: 0; font: 700 1.2rem/1.28 Georgia, serif; }
.work-notes { margin: 13px 0 0 37px; padding-left: 18px; color: #3e3e3e; }
.work-notes li + li { margin-top: 4px; }
.shared-note { margin: 13px 0 0 37px; padding: 10px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--accent-soft); }
.photo-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 15px 0 0 37px; }
.photo-button { min-height: 110px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #f2f2f2; }
.photo-button img { display: block; width: 100%; height: 145px; object-fit: cover; }
.empty-state { margin: 50px auto; padding: 34px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: white; }
.empty-state h2 { margin-top: 0; font-family: Georgia, serif; }

.add-button {
  position: fixed;
  z-index: 30;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 54px;
  padding: 8px 18px 8px 10px;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 30px rgba(105, 27, 35, .28);
  font-weight: 800;
}
.add-button:hover { background: #aa303c; }
.add-symbol { display: grid; width: 38px; height: 38px; place-items: center; font: 300 2rem/1 sans-serif; }

form label { display: grid; gap: 6px; color: #3f3f3f; font-size: .84rem; font-weight: 750; }
input:not([type="checkbox"]), textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid #c4c4c4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}
textarea { resize: vertical; }
dialog {
  max-width: calc(100vw - 24px);
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 25px 80px rgba(0, 0, 0, .28);
}
dialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.form-dialog { width: min(560px, calc(100vw - 24px)); padding: 0; }
.form-dialog form { display: grid; gap: 16px; padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin: 0; font: 700 1.65rem/1.15 Georgia, serif; }
.primary-button, .secondary-button, .icon-button {
  min-height: 43px;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 750;
}
.primary-button { border: 1px solid var(--accent); color: white; background: var(--accent); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; }
.icon-button { width: 43px; padding: 0; border: 1px solid var(--line); background: white; font-size: 1.5rem; }
button:disabled { cursor: wait; opacity: .58; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 2px; }
.auto-sort-note { margin: -2px 0 0; color: var(--muted); font-size: .8rem; }
.photo-preview { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.photo-preview img { width: 82px; height: 68px; border-radius: 7px; object-fit: cover; }
.lightbox { width: min(1100px, calc(100vw - 20px)); padding: 14px; background: #101010; }
.lightbox img { display: block; max-width: 100%; max-height: 80vh; margin: auto; object-fit: contain; }
.lightbox p { margin: 10px 40px 0; color: white; text-align: center; }
.lightbox-close { position: absolute; z-index: 1; top: 12px; right: 12px; width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.65); font-size: 1.5rem; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px)); max-width: min(360px, calc(100vw - 44px)); padding: 12px 16px; border-radius: 11px; color: white; background: var(--accent); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 650px) {
  input, select, textarea { font-size: 16px; }
  .site-header { padding: max(20px, env(safe-area-inset-top)) 16px 18px; }
  .header-inner { display: block; }
  .site-header h1 { font-size: 2.2rem; }
  .identity-wrap { justify-content: flex-start; margin-top: 17px; }
  .summary-row { margin-top: 18px; }
  .page-shell { padding: 22px 12px 105px; }
  .list-section + .list-section { margin-top: 31px; }
  .list-section-heading { align-items: center; }
  .list-section-heading h2 { font-size: 1.32rem; }
  .punch-item { padding: 15px; }
  .work-notes, .shared-note, .photo-strip { margin-left: 0; }
  .photo-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-button img { height: 118px; }
  .add-button { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 58px; height: 58px; min-height: 58px; padding: 10px; justify-content: center; }
  .add-label { display: none; }
  .form-dialog { width: calc(100vw - 16px); }
  .form-dialog form { padding: 20px 16px; }
  .dialog-actions > button { flex: 1; }
  .center-card { margin-top: 8vh; padding: 28px 20px; }
}

@media print {
  :root { --paper: white; --card: white; }
  body { background: white; font-size: 11px; }
  .identity-wrap, .add-button, .toast { display: none !important; }
  .site-header { padding: 18px 0; border-top: 0; border-bottom: 2px solid black; }
  .header-inner, .summary-row, .page-shell { width: 100%; }
  .page-shell { padding: 18px 0; }
  .list-section { margin-top: 22px; break-inside: avoid; }
  .punch-item { padding: 10px; break-inside: avoid; box-shadow: none; }
  .photo-strip { grid-template-columns: repeat(4, 1fr); }
  .photo-button img { height: 80px; }
}
