/* Votum - one stylesheet, no inline styles anywhere, so the Content-Security-
   Policy can stay at default-src 'self' with no unsafe-inline.
   The per-exercise accent colour arrives as /e/<uuid>/theme.css, which only
   redefines --accent. */

:root {
  --accent: #14539C;
  --ink: #1d2330;
  --muted: #5a6577;
  --line: #d8dee9;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #1a7f4b;
  --warn: #9a6200;
  --bad: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- top bar ---------- */
.topbar { background: var(--accent); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 52px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; letter-spacing: .5px; text-decoration: none; font-size: 18px; }
.topbar .who { font-size: 13px; opacity: .92; }
.topbar a { color: #fff; }
.topbar form { display: inline; }
.topbar .linkish { background: none; border: 0; color: #fff; text-decoration: underline;
  cursor: pointer; font: inherit; font-size: 13px; padding: 0; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 16px 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
h1 { font-size: 24px; line-height: 1.25; margin: 20px 0 6px; }
h2 { font-size: 18px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > * { flex: 1 1 200px; }
.grow { flex: 3 1 320px; }

/* ---------- exercise header ---------- */
.ex-head { background: var(--accent); color: #fff; border-radius: var(--radius);
  padding: 20px; margin: 16px 0; }
.ex-head h1 { margin: 0 0 4px; color: #fff; }
.ex-head p { margin: 0; opacity: .92; font-size: 14px; }
.ex-head img.logo { max-height: 52px; max-width: 220px; display: block; margin-bottom: 12px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=number], input[type=color],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; color: var(--ink); background: #fff;
}
input[type=color] { padding: 2px; height: 40px; }
textarea { min-height: 110px; resize: vertical; font-family: inherit; }
textarea.code { font-family: Consolas, Menlo, monospace; font-size: 13px; }
input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 12px 14px; }
legend { font-weight: 600; padding: 0 6px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; margin: 8px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; }
.otp { font-size: 28px; letter-spacing: 10px; text-align: center; font-family: Consolas, Menlo, monospace; }

button, .btn {
  display: inline-block; border: 1px solid transparent; border-radius: 6px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none; text-align: center;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
button.danger, .btn.danger { background: var(--bad); }
button.small, .btn.small { padding: 6px 11px; font-size: 13px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* ---------- messages ---------- */
.flash { border-radius: 8px; padding: 11px 14px; margin: 14px 0; font-size: 14px;
  border: 1px solid var(--line); background: #fff; }
.flash.ok { border-color: #bfe3cd; background: #eefaf2; color: #11512f; }
.flash.err { border-color: #f0c4c1; background: #fdeeed; color: #7d1c16; }
.flash.warn { border-color: #f0dcae; background: #fdf6e6; color: #6b4600; }

/* ---------- badges ---------- */
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px;
  font-weight: 700; letter-spacing: .3px; border: 1px solid var(--line); background: #fff; }
.badge.draft { color: var(--muted); }
.badge.open { color: #0b5c35; border-color: #bfe3cd; background: #eefaf2; }
.badge.closed { color: #4a2b7a; border-color: #d6cbe9; background: #f4effc; }
.badge.passed { color: #0b5c35; border-color: #bfe3cd; background: #eefaf2; }
.badge.failed { color: #7d1c16; border-color: #f0c4c1; background: #fdeeed; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left;
  vertical-align: top; }
th { background: #eef1f7; font-size: 13px; }
tbody tr:hover { background: #f7f9fd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- motions & ballot ---------- */
.motion { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  margin: 14px 0; background: #fff; }
.motion .text { font-size: 15px; }
.options { margin-top: 10px; }
.option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line);
  border-radius: 8px; padding: 12px 14px; margin: 8px 0; cursor: pointer; background: #fff;
  font-weight: 500; }
.option input { width: 20px; height: 20px; margin: 1px 0 0; flex: 0 0 auto; }
.option:hover { border-color: var(--accent); }
.option:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

.receipt-id { font-family: Consolas, Menlo, monospace; font-size: 22px; font-weight: 700;
  letter-spacing: 2px; word-break: break-all; }
.hash { font-family: Consolas, Menlo, monospace; font-size: 12px; word-break: break-all; }

.site-footer { color: var(--muted); font-size: 12px; padding: 24px 16px 32px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .card, .motion { padding: 14px; }
  h1 { font-size: 21px; }
  .actions button, .actions .btn { flex: 1 1 100%; }
}

@media print {
  .topbar, .actions, .site-footer { display: none; }
  body { background: #fff; }
  .card { border: 0; }
}
