:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1c1917;
  --muted: #78716c;
  --line: #e7e0d5;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-soft: #ccfbf1;
  --warn: #b45309;
  --danger: #b91c1c;
  --own: #166534;
  --comp: #9a3412;
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.06);
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #d9f99d33, transparent 40%),
    radial-gradient(circle at top right, #99f6e433, transparent 35%),
    var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 18px 60px; }
.top {
  display: flex; gap: 16px; justify-content: space-between; align-items: center;
  margin-bottom: 28px; flex-wrap: wrap;
}
.brand h1 { margin: 0; font-size: 1.5rem; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav a, button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: white; color: var(--ink);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; font: inherit;
}
.btn-primary, button.btn-primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.stat { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.badge.own { background: #dcfce7; color: var(--own); }
.badge.comp { background: #ffedd5; color: var(--comp); }
.badge.err { background: #fee2e2; color: var(--danger); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
label { display: block; margin: 12px 0 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: white; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.flash, .flash {
  margin-bottom: 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: #115e59;
}
.btn.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.review-text { white-space: pre-wrap; color: #44403c; }
.sources { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.footer-note { margin-top: 28px; color: var(--muted); font-size: 0.9rem; }
.report-card h4 {
  margin: 18px 0 8px;
  font-size: 1.05rem;
}
.report-month:first-of-type h4 { margin-top: 8px; }
.report-lines {
  margin: 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  white-space: pre-wrap;
  font-family: "Cascadia Mono", "Consolas", "Segoe UI", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-x: auto;
}
.collect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.collect-overlay[hidden] { display: none !important; }
.collect-panel {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.collect-panel h3 { margin: 0 0 8px; }
.progress-track {
  height: 12px;
  background: #e7e0d5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  border-radius: 999px;
  transition: width 0.35s ease;
}
body.collecting { overflow: hidden; }
@media (max-width: 700px) {
  .stat { font-size: 1.6rem; }
  th, td { font-size: 0.92rem; }
}
