:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --accent: #1f4e79; --accent-2: #163a5c;
  --yes: #1e7f4f; --yes-bg: #def4e7; --maybe: #9a6400; --maybe-bg: #fdf0d3; --no: #b42318; --no-bg: #fde4e1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 1.6rem; margin: 0 0 .3em; }
h2 { font-size: 1.1rem; margin: 0 0 .8em; }

.top { background: var(--accent); color: #fff; }
.top .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 56px; }
.brand, .brand a { color: #fff; text-decoration: none; font-weight: 600; }
.brand small { display: block; font-weight: 400; opacity: .8; font-size: .8rem; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: #fff; opacity: .85; font-size: .9rem; text-decoration: none; }
.nav a:hover { opacity: 1; text-decoration: underline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; margin-bottom: 20px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.vote { max-width: 760px; margin-left: auto; margin-right: auto; }
.card.empty { text-align: center; color: var(--muted); padding: 40px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.meta { color: var(--muted); margin: 0; }
.crumb { margin: 0 0 8px; font-size: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.muted { color: var(--muted); }
.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--muted); margin: 0 0 4px; }

label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 12px; }
input, textarea, select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: inherit;
  border: 1px solid #c9ced6; border-radius: 6px; background: #fff; }
input:focus, textarea:focus, select:focus { outline: 2px solid #9cc0e3; border-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 24px; }
legend { font-weight: 600; font-size: 1.05rem; margin-bottom: 10px; padding: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span2 { grid-column: span 2; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 10px 0; }
label.check input { width: auto; margin: 0; }

.slots { display: grid; gap: 8px; }
.slot-row { display: flex; align-items: center; gap: 10px; }
.slot-row input { margin: 0; max-width: 200px; }
.slot-row .num { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: .85rem; flex: none; }

table { border-collapse: collapse; width: 100%; }
.parts th { text-align: left; font-size: .85rem; color: var(--muted); font-weight: 500; padding: 0 6px 4px 0; }
.parts td { padding: 0 6px 6px 0; }
.parts input { margin: 0; }

.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid #c9ced6; background: #fff; color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--no); border-color: #f2b8b0; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.block { width: 100%; margin-bottom: 8px; text-align: left; }
.actions { display: flex; gap: 10px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: .8rem; text-decoration: underline; }
form { margin: 0; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--yes-bg); border-color: #a9dfc0; color: #145c38; }
.flash.warn { background: var(--maybe-bg); border-color: #f2d48f; color: #6d4700; }
.flash.err { background: var(--no-bg); border-color: #f4b4ab; color: #8a1a10; }
.final { background: var(--yes-bg); border: 1px solid #a9dfc0; color: #145c38; padding: 12px 16px; border-radius: 8px; margin: 12px 0 16px; font-size: 1.05rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.badge.open { background: #dbeafe; color: #1e40af; }
.badge.draft { background: #eceef1; color: #4b5563; }
.badge.closed { background: #eceef1; color: #4b5563; }
.badge.late { background: var(--maybe-bg); color: var(--maybe); }
.badge.done { background: var(--yes-bg); color: var(--yes); }
.status { margin: 0 0 12px; color: var(--muted); }

.table-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; }
.card .table-scroll { border: 0; margin: 0; }
.grid th, .grid td, .list th, .list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.grid thead th { font-size: .82rem; font-weight: 600; white-space: nowrap; }
.grid thead th span { font-size: 1rem; }
.grid th:first-child, .grid td:first-child { text-align: left; }
.grid tfoot th, .grid tfoot td { border-bottom: 0; background: #fafbfc; }
.grid .best { background: #eaf6ef; }
.who strong { display: block; }
.who small, .list small { display: block; color: var(--muted); font-size: .8rem; }
.who em { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
td.ans { font-weight: 600; font-size: .85rem; }
.ans.yes { background: var(--yes-bg); color: var(--yes); }
.ans.maybe { background: var(--maybe-bg); color: var(--maybe); }
.ans.no { background: var(--no-bg); color: var(--no); }
.ans.none { color: #b3b8c0; }
span.ans { padding: 1px 8px; border-radius: 4px; }
.c { display: inline-block; min-width: 24px; padding: 1px 6px; border-radius: 4px; font-weight: 600; font-size: .85rem; }
.c.yes { background: var(--yes-bg); color: var(--yes); }
.c.maybe { background: var(--maybe-bg); color: var(--maybe); }
.c.no { background: var(--no-bg); color: var(--no); }
.pstatus { font-size: .8rem; text-align: left !important; white-space: nowrap; }
.pstatus .ok { color: var(--yes); }
.row-actions { display: flex; gap: 10px; margin-top: 2px; }
tr.me td { box-shadow: inset 0 0 0 9999px rgba(31, 78, 121, .04); }

.list th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 500; }
.list td { text-align: left; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f8f9fb; }
.list a { text-decoration: none; }

.panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.panels .card { margin: 0; }

.infos { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 12px 0 16px; }
.infos dt { color: var(--muted); }
.infos dd { margin: 0; font-weight: 500; }
.message { background: var(--bg); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.hello { margin-top: 20px; }
.choices .choice { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.choices .choice:first-child { border-top: 1px solid var(--line); }
.choices .when { font-weight: 600; }
.opts { display: flex; gap: 6px; }
.opt { margin: 0; cursor: pointer; position: relative; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt span { display: inline-block; padding: 7px 14px; border: 1px solid #c9ced6; border-radius: 6px; font-weight: 500; min-width: 92px; text-align: center; background: #fff; }
.opt input:focus-visible + span { outline: 2px solid #9cc0e3; }
.opt.yes input:checked + span { background: var(--yes); border-color: var(--yes); color: #fff; }
.opt.maybe input:checked + span { background: #d18b00; border-color: #d18b00; color: #fff; }
.opt.no input:checked + span { background: var(--no); border-color: var(--no); color: #fff; }
.choices > label { margin-top: 16px; }
.mine { padding-left: 18px; }

@media (max-width: 760px) {
  .grid2, .panels { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .parts thead { display: none; }
  .parts tr { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .slot-row input { max-width: none; }
  .opts { width: 100%; }
  .opt { flex: 1; }
  .opt span { min-width: 0; width: 100%; padding: 8px 4px; }
}

textarea.tpl { font: 14px/1.5 ui-monospace, Consolas, monospace; }
.vars summary, .preview summary { cursor: pointer; font-weight: 500; }
.vars table { margin-top: 10px; }
.vars td { padding: 3px 12px 3px 0; vertical-align: top; }
.preview { margin-top: 10px; }
.preview pre { white-space: pre-wrap; background: var(--bg); padding: 12px 14px; border-radius: 8px; font: 14px/1.5 system-ui, sans-serif; }

.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.foot { color: var(--muted); font-size: .8rem; padding: 0 0 32px; }
.foot .wrap { border-top: 1px solid var(--line); padding-top: 16px; }
.legal h2 { margin-top: 1.4em; }
.legal p { margin: .4em 0; }
