:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1c2321;
  --ink-muted: #6b7470;
  --line: #e3e1db;
  --accent: #2f6f4f;
  --accent-soft: #e4efe9;
  --warn: #b45309;
  --danger: #b42318;
  --pending: #e3e1db;
  --pending-ink: #4a514d;
  --progress: #fde68a;
  --progress-ink: #78350f;
  --done: #2f6f4f;
  --done-ink: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28,35,33,0.04), 0 4px 12px rgba(28,35,33,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand .mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  display: inline-block;
}

.topbar nav { display: flex; gap: 6px; }
.topbar nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink-muted);
}
.topbar nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.stat-value.small { font-size: 16px; }
.stat-value.muted { color: var(--ink-muted); font-weight: 500; }
.stat-sub { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

.bar {
  margin-top: 8px;
  height: 6px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 10px;
}
.section-head h2 {
  margin: 0 0 2px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.blurb { margin: 0; color: var(--ink-muted); font-size: 13px; }
.section-meta { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }

.items { list-style: none; margin: 0; padding: 0; }

.item {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
}
.item-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 500; }
.item-desc { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
.item-notes-preview {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-muted);
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 6px;
  white-space: pre-wrap;
}
.item-cost {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-muted);
  padding-top: 4px;
}

.status-pill {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform 80ms ease;
}
.status-pill:active { transform: scale(0.97); }
.status-pending  { background: var(--pending); color: var(--pending-ink); }
.status-progress { background: var(--progress); color: var(--progress-ink); }
.status-done     { background: var(--done); color: var(--done-ink); }

.item-toggle {
  margin-top: 8px;
}
.item-toggle summary {
  display: inline-block;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 13px;
  padding: 2px 0;
  list-style: none;
}
.item-toggle summary::-webkit-details-marker { display: none; }
.item-toggle summary::before { content: "+ "; }
.item-toggle[open] summary::before { content: "− "; }

.item-body {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
.inline-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
}
.inline-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inline-form input[type="text"],
.inline-form textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  margin-top: 4px;
}
.inline-form textarea { resize: vertical; }

button {
  align-self: flex-start;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { filter: brightness(1.05); }
button.link-danger {
  background: transparent;
  color: var(--danger);
  border: 0;
  padding: 0;
  margin-top: 6px;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.upload-card h2 { margin: 0 0 4px; font-size: 18px; }

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}
.upload-form input[type="text"] {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.file-picker {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  border: 1px dashed var(--accent);
  color: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  background: var(--accent-soft);
}
.file-picker input { display: none; }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.plan-preview {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--bg);
  overflow: hidden;
}
.plan-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.plan-pdf {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  font-weight: 600; color: var(--ink-muted);
}
.plan-meta {
  padding: 12px;
  border-top: 1px solid var(--line);
}
.plan-name { font-weight: 500; word-break: break-word; }
.plan-caption { font-size: 13px; color: var(--ink); margin-top: 4px; }
.plan-sub { font-size: 12px; color: var(--ink-muted); margin-top: 4px; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-muted);
}

@media (max-width: 720px) {
  .summary { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  main { padding: 16px 14px 56px; }
  .section-head { flex-direction: column; align-items: stretch; gap: 4px; }
}
