:root {
  --bg: #f4efe6;
  --bg-2: #efe6d6;
  --surface: #fffaf3;
  --ink: #2a1c16;
  --muted: #6d5c52;
  --line: #e4d5c4;
  --brand: #6b1d2a;
  --brand-dark: #4a121c;
  --accent: #c45c1a;
  --accent-2: #2f6b4f;
  --warn-bg: #f8ead8;
  --ok: #2f6b4f;
  --danger: #9b1c1c;
  --shadow: 0 10px 28px rgba(74, 18, 28, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Figtree", "Noto Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 400px at 10% -10%, #fbe7c8 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 220px);
  min-height: 100vh;
  line-height: 1.5;
}

.site-head {
  background: linear-gradient(145deg, var(--brand-dark) 0%, var(--brand) 70%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(74, 18, 28, .18);
}
.topbar {
  background: rgba(0,0,0,.18);
  color: #f3d9b8;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: .02em;
}
.brand {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.emblem {
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f4d48a, #c45c1a 62%, #6b1d2a);
  display: grid; place-items: center;
  font-weight: 800; color: #3a1608; font-size: 12px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.brand-text { flex: 1; min-width: 0; }
.brand h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(18px, 4.4vw, 26px);
  font-weight: 600;
  color: #fff;
}
.brand p { margin: 4px 0 0; color: #f0d8c0; font-size: 13px; }

.nav-wrap { position: relative; }
.nav-toggle {
  display: none;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}
.main-nav { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.main-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 999px;
}
.main-nav a:hover { background: rgba(255,255,255,.14); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 36px; }
.notice {
  background: var(--warn-bg);
  border: 1px solid #e8c9a0;
  border-left: 5px solid var(--accent);
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 12px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 20px;
  color: var(--brand);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.auth-card { max-width: 440px; margin: 0 auto; }

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
}
.tile:nth-child(2) { border-top-color: var(--brand); }
.tile:nth-child(3) { border-top-color: var(--accent-2); }
.tile strong {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  color: var(--brand-dark);
  font-size: 18px;
  margin-bottom: 6px;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #efc9a4;
  border-color: var(--accent);
}
textarea { min-height: 80px; resize: vertical; }
.help { font-size: 12px; color: var(--muted); margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 16px; font-weight: 700; cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.btn.saffron { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--line); }

.scorebox {
  position: sticky; top: 12px;
  background: var(--brand-dark);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
}
.scorebox h3 { margin: 0 0 8px; font-size: 15px; color: #f4d48a; font-family: "Fraunces", Georgia, serif; }
.scorebox table { width: 100%; font-size: 13px; border-collapse: collapse; }
.scorebox td { padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.scorebox .big { font-size: 26px; font-weight: 800; margin-top: 8px; color: #f4d48a; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 14px; align-items: start; }

.steps {
  display: flex; gap: 6px; margin-bottom: 14px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px;
}
.step {
  flex: 0 0 auto;
  font-size: 12px; padding: 8px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--brand);
  text-decoration: none; white-space: nowrap;
}
.step.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.step.done { border-color: var(--accent-2); color: var(--accent-2); }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 8px; }
table.data { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; background: #fff; }
table.data th, table.data td { border: 1px solid var(--line); padding: 8px; vertical-align: top; }
table.data th { background: #f3e4d2; color: var(--brand-dark); font-weight: 700; }
table.data .num { text-align: center; white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input, .filters select { width: 100%; min-width: 0; flex: 1 1 160px; }
.ok { color: var(--ok); font-weight: 700; }
.no { color: var(--danger); font-weight: 700; }
.muted { color: var(--muted); }

.report-header { text-align: center; margin-bottom: 10px; }
.report-header h1 { font-family: "Fraunces", Georgia, serif; font-size: 18px; margin: 0 0 4px; color: var(--brand); }
.meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; margin: 8px 0 12px; }
.site-foot { text-align: center; padding: 22px 16px 30px; font-size: 12px; color: var(--muted); }
.site-foot a { color: var(--brand); }

@media (max-width: 900px) {
  .home-grid, .layout, .grid, .grid-3 { grid-template-columns: 1fr; }
  .scorebox { position: static; }
  .topbar { display: none; }
  .nav-toggle { display: inline-flex; }
  .main-nav {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    z-index: 20;
    flex-direction: column;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px;
    min-width: 210px;
    box-shadow: var(--shadow);
  }
  .main-nav a { color: var(--brand-dark); }
  .main-nav.open { display: flex; }
  .actions .btn, .actions a.btn { flex: 1 1 100%; }
}

@media (max-width: 640px) {
  .wrap { padding: 14px 12px 28px; }
  .card { padding: 14px; }
  input, select, textarea, .btn { font-size: 16px; }
}

@media print {
  .topbar, .site-head, .no-print, .site-foot, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  table.data { font-size: 10px; min-width: 0; }
  @page { size: A3 landscape; margin: 10mm; }
}
