:root {
  --bg: #f2f0e9;
  --surface: #ffffff;
  --ink: #141414;
  --muted: #686868;
  --line: #d9d5cb;
  --accent: #ff5a1f;
  --accent-dark: #d84410;
  --soft: #f8f7f2;
  --danger: #a02a20;
  --shadow: 0 18px 50px rgba(20, 20, 20, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

a { color: inherit; }

.page, .admin-page, .detail-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.page { max-width: 800px; padding: 56px 0 80px; }
.admin-page, .detail-page { padding: 32px 0 72px; }

.hero {
  border-top: 12px solid var(--ink);
  padding: 28px 0 34px;
}

.brand {
  display: inline-block;
  font-weight: 950;
  letter-spacing: -0.06em;
  font-size: 1.35rem;
  border: 3px solid var(--ink);
  padding: 4px 10px;
  transform: skew(-4deg);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--accent-dark);
  margin: 18px 0 6px;
}

h1, h2, p { margin-top: 0; }

h1 {
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  letter-spacing: -0.055em;
  line-height: 0.98;
  margin-bottom: 18px;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.lead {
  font-size: 1.1rem;
  max-width: 680px;
  color: #343434;
}

.form-card, .panel, .login-card, .message-card, .answer-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.form-card { padding: clamp(22px, 5vw, 44px); }

.question {
  padding: 0 0 28px;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--line);
}

.question:last-of-type { border-bottom: 0; }

label {
  display: block;
  font-weight: 800;
  margin-bottom: 9px;
}

.hint, .muted {
  color: var(--muted);
  font-size: 0.9rem;
}

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: 13px 14px;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  box-shadow: 4px 4px 0 var(--accent);
}

textarea { resize: vertical; min-height: 110px; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 500;
  margin: 10px 0 24px;
}

.consent input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.button {
  appearance: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 2px solid var(--ink);
  padding: 13px 20px;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
}

.button:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.button.primary { background: var(--accent); color: #111; }
.button.secondary { background: #fff; }
.button.ghost { background: transparent; box-shadow: none; }
.button.small { padding: 9px 13px; font-size: 0.9rem; }

.alert {
  padding: 14px 16px;
  border: 2px solid var(--danger);
  background: #fff0ed;
  color: var(--danger);
  font-weight: 700;
  margin-bottom: 20px;
}

.site-footer {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.center-page {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card, .message-card {
  width: min(520px, 100%);
  padding: 38px;
}

.login-card form {
  display: grid;
  gap: 10px;
}

.login-card .button { margin-top: 14px; }

.admin-header {
  min-height: 86px;
  padding: 18px max(16px, calc((100vw - 1120px) / 2));
  background: var(--ink);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.admin-header .brand {
  border-color: #fff;
}

.admin-subtitle {
  display: block;
  color: #cfcfcf;
  margin-top: 7px;
  font-size: 0.84rem;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-actions form { margin: 0; }
.admin-header .button { border-color: #fff; box-shadow: none; }
.admin-header .button.secondary { color: #111; }
.admin-header .button.ghost { color: #fff; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--surface);
  border: 2px solid var(--ink);
  padding: 20px;
}

.stat-card span { color: var(--muted); display: block; }
.stat-card strong { font-size: 2.4rem; letter-spacing: -0.05em; }

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

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 18px;
  margin-bottom: 22px;
}

.chart-panel h2 { margin-bottom: 22px; }
.chart-empty { padding: 30px 0; }
.bar-chart { display: grid; gap: 16px; }
.bar-heading { display: flex; justify-content: space-between; gap: 14px; font-size: 0.88rem; }
.bar-track { height: 15px; margin-top: 7px; background: var(--soft); border: 1px solid var(--ink); }
.bar-fill { display: block; height: 100%; min-width: 3px; background: var(--accent); }
.line-chart-wrap { width: 100%; overflow-x: auto; }
.line-chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart-grid-line { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: var(--surface); stroke: var(--ink); stroke-width: 3; }
.chart-label { fill: var(--muted); font-size: 11px; font-weight: 700; }
.chart-caption { margin: 8px 0 0; color: var(--muted); font-size: 0.84rem; }

.panel { padding: 24px; box-shadow: 6px 6px 0 var(--ink); }

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}

.filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr auto auto;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th, td {
  padding: 14px 12px;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  background: var(--soft);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge {
  display: inline-block;
  background: #fff1e9;
  border: 1px solid var(--accent);
  padding: 5px 8px;
  font-size: 0.78rem;
  font-weight: 750;
}

.text-link {
  font-weight: 800;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
}

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

.detail-header { margin-bottom: 20px; }
.detail-header h1 { font-size: clamp(2rem, 5vw, 3.8rem); }

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.answer-card { padding: 24px; }
.answer-card p { white-space: pre-wrap; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .page { padding-top: 28px; }
  .form-card, .login-card, .message-card { padding: 22px; }
  .stats-grid, .answers-grid, .filters { grid-template-columns: 1fr; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .button { width: 100%; }
  .header-actions .button { width: auto; }
}
