.flush { margin-top: 0; }
.card { margin-bottom: 20px; overflow-wrap: anywhere; }
.top-gap { margin-top: 16px; }
.top-gap-sm { margin-top: 10px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 4px; overflow-wrap: anywhere; }
textarea { resize: vertical; }
label.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; text-align: center; }
.pill { max-width: 100%; overflow-wrap: anywhere; }
.subhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; margin-bottom: 12px; }

.crit-row, .opt-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.crit-rm, .opt-rm { justify-self: start; }

.score-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.score-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg);
  min-width: 0;
}
.score-opt-head { margin-bottom: 8px; }
.score-opt-title { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.score-opt-note { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.score-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 10px;
}

.ballot-panel { border-top: 1px solid var(--line); padding-top: 14px; }
.ballot-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ballot-name { flex: 1 1 200px; min-width: 0; }

.brief-meta { margin-bottom: 12px; }
.brief-title { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; margin-bottom: 4px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.winner-banner {
  background: var(--chip);
  border-left: 4px solid var(--accent);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 17px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}

.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; margin: 12px 0; }
.rank-table th, .rank-table td { padding: 6px 5px; font-size: 14px; vertical-align: middle; }
.rank-table th { font-weight: 600; }
.rank-table .opt-cell { overflow-wrap: anywhere; min-width: 72px; font-weight: 600; }
.rank-table .opt-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.num { text-align: right; font-family: var(--mono); white-space: nowrap; }

.sens-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.sens-list { margin: 6px 0 0; padding-left: 18px; }
.sens-list li { margin-bottom: 4px; }

.chart-wrap { width: 100%; max-width: 100%; margin-top: 8px; overflow: hidden; }
.chart-svg { width: 100%; max-width: 100%; height: auto; display: block; }
.chart-svg .bar-track { fill: var(--chip); stroke: var(--line); stroke-width: 1; }
.chart-svg .bar-fill-lead { fill: var(--accent); }
.chart-svg .bar-fill-rest { fill: var(--muted); opacity: 0.72; }
.chart-svg .bar-label { fill: var(--ink); font-family: var(--font); font-weight: 600; }
.chart-svg .bar-val { fill: var(--ink); font-family: var(--mono); font-weight: 600; }

input[aria-invalid="true"] { border-color: var(--warn); }
.err-msg { color: var(--warn); font-weight: 600; margin: 10px 0; overflow-wrap: anywhere; }
.warn-box { background: var(--chip); border: 1px solid var(--warn); color: var(--warn); padding: 10px 12px; border-radius: 8px; }

.list { list-style: none; padding: 0; margin: 12px 0 0; }
.list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.list .title { font-weight: 600; overflow-wrap: anywhere; flex: 1 1 150px; min-width: 0; }
.list .meta { flex: 1 1 100%; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
code { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }

@media (min-width: 540px) {
  .crit-row { grid-template-columns: 2.4fr 1fr auto; align-items: end; }
  .opt-row { grid-template-columns: 1.8fr 1.6fr auto; align-items: end; }
}

@media print {
  .no-print, header.top, footer { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: none; padding: 0; }
  section[hidden], [hidden] { display: none !important; }
  .chart-svg .bar-track { fill: #eee; stroke: #bbb; }
  .chart-svg .bar-fill-lead { fill: #0b6e4f; }
  .chart-svg .bar-fill-rest { fill: #666; opacity: 1; }
  .chart-svg .bar-label, .chart-svg .bar-val { fill: #000; }
}
