/* Voting app layout, layered on the Abundance brand stylesheet. */

:root {
  --ink: #363635;
  --ink-soft: #4d4a46;
  --muted: #71716e;
  --bg: #faf8f8;
  --paper: #ffffff;
  --line: #e9e4e3;
  --accent: #c1658b;
  --accent-dark: #a24d71;
  --accent-tint: #f7d9e8;
  --teal-tint: #dff3f6;
  --sun-tint: #ffeecd;
  --red: #b02525;
  --red-tint: #f9e3e1;
  --ok: #176f1d;
  --ok-tint: #e3f1e2;
  --for: #c1658b;
  --against: #4d4a46;
  --not-voted: #e9e4e3;
  --radius: 16px;
}

html { background: var(--bg); }
body {
  margin: 0;
  padding: 0 !important;
  background: var(--bg);
  color: var(--ink);
  font-family: "Sohne Buch", system-ui, -apple-system, "helvetica neue", arial, sans-serif;
  line-height: 1.55;
}
h1, h2, h3 { font-family: "New Kansas", Georgia, serif; font-weight: 600; color: var(--ink); line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 0 0 .75rem; }
h3 { font-size: 1.15rem; margin: 0 0 .25rem; }
a { color: var(--accent); }
strong, b { font-family: "Sohne Kraftig", system-ui, sans-serif; font-weight: 600; }
[hidden] { display: none !important; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar__inner { max-width: 960px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar img { display: block; height: 30px; width: auto; }
.topbar__tag { font-size: .875rem; color: var(--muted); }

.page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.page--wide { max-width: 1120px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.panel--tint { background: var(--accent-tint); border-color: transparent; }
.panel > :last-child { margin-bottom: 0; }

.lede { font-size: 1.05rem; color: var(--ink-soft); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.voter { font-size: .95rem; color: var(--ink-soft); margin-bottom: 24px; }

.intro ul { padding-left: 1.2rem; }
.intro li { margin-bottom: .35rem; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 16px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-family: "Sohne Kraftig", sans-serif; font-size: .9rem;
}

.doc-link { display: inline-flex; align-items: center; gap: 8px; font-family: "Sohne Kraftig", sans-serif; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.doc-link svg { flex: none; }

/* Buttons follow the brand .si-btn shape. */
.btn-app {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 2px solid var(--accent); background: var(--accent); color: #fff;
  font-family: "Sohne Kraftig", sans-serif; font-weight: 600; font-size: 1rem;
  padding: .7rem 1.5rem; cursor: pointer; text-decoration: none; line-height: 1.2; margin: 0;
}
.btn-app:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-app:disabled { opacity: .5; cursor: not-allowed; }
.btn-app--ghost { background: transparent; color: var(--accent); }
.btn-app--ghost:hover { background: var(--accent-tint); color: var(--accent-dark); }
.btn-app--sm { font-size: .85rem; padding: .4rem .9rem; }
.btn-app--danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn-app--danger:hover { background: var(--red-tint); color: var(--red); border-color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 20px; }

/* Ballot cards */
.ballot-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; background: var(--paper); }
.ballot-card.is-chosen { border-color: var(--accent); }
.ballot-card.is-done { background: var(--bg); }
.ballot-card__head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }
.ballot-card__holding { font-size: .9rem; color: var(--muted); }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; border: 0; padding: 0; }
.choice legend { font-size: .9rem; color: var(--ink-soft); margin-bottom: 8px; float: none; width: auto; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px;
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; font-family: "Sohne Kraftig", sans-serif;
  font-size: 1.05rem; background: var(--paper); transition: border-color .15s, background .15s; margin: 0;
}
.choice label:hover { border-color: var(--accent); }
.choice input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice input:checked + label { border-color: var(--accent); background: var(--accent-tint); }
.choice input:checked + label .tick { opacity: 1; }
.tick { opacity: 0; }

.voted { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ok-tint); color: var(--ok); }
.voted svg { flex: none; margin-top: 2px; }

.declare { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 0; cursor: pointer; }
.declare input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }

.review-list { list-style: none; padding: 0; margin: 0 0 16px; }
.review-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-list li:last-child { border-bottom: 0; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-family: "Sohne Kraftig", sans-serif; white-space: nowrap; }
.pill--for { background: var(--accent-tint); color: var(--accent-dark); }
.pill--against { background: #ecebea; color: var(--ink); }
.pill--none { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.pill--admin { background: var(--sun-tint); color: #964300; }

.alert { padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert--error { background: var(--red-tint); color: var(--red); }
.alert--ok { background: var(--ok-tint); color: var(--ok); }
.alert--warn { background: var(--sun-tint); color: #964300; }
.alert ul { margin: 6px 0 0; padding-left: 1.2rem; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .9rem; margin-bottom: 4px; color: var(--ink-soft); }
.input, select.input, textarea.input {
  width: 100%; box-sizing: border-box; border: 1px solid #cfc9c7; border-radius: 10px; padding: .6rem .75rem;
  font: inherit; color: var(--ink); background: #fff;
}
.input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Dashboard */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.stat { border-left: 3px solid var(--line); padding-left: 12px; }
.stat__label { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat__value { font-family: "New Kansas", Georgia, serif; font-size: 1.5rem; line-height: 1.2; }
.stat__sub { font-size: .8rem; color: var(--muted); }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.bar { position: relative; margin: 28px 0 8px; }
.bar__track { display: flex; gap: 2px; height: 28px; border-radius: 6px; overflow: hidden; background: var(--paper); }
.bar__seg { height: 100%; min-width: 0; position: relative; }
.bar__seg:first-child { border-radius: 6px 0 0 6px; }
.bar__seg:last-child { border-radius: 0 6px 6px 0; }
.bar__seg--for { background: var(--for); }
.bar__seg--against { background: var(--against); }
.bar__seg--none { background: var(--not-voted); }
.bar__marker { position: absolute; top: -22px; bottom: -6px; width: 0; border-left: 2px dashed var(--ink); }
.bar__marker span { position: absolute; top: 0; left: 6px; font-size: .75rem; white-space: nowrap; color: var(--ink); }
.bar__tip {
  position: fixed; pointer-events: none; background: var(--ink); color: #fff; font-size: .8rem; padding: 6px 10px;
  border-radius: 8px; z-index: 10; white-space: nowrap;
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; font-family: "Sohne Kraftig", sans-serif; }
.status--passed { color: var(--ok); }
.status--defeated { color: var(--red); }
.status--open { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-family: "Sohne Kraftig", sans-serif; font-weight: 600; font-size: .8rem; color: var(--muted); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.is-clickable { cursor: pointer; }
table.data tr.is-clickable:hover td { background: var(--bg); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; cursor: pointer; color: var(--muted); margin: 0; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-family: "Sohne Kraftig", sans-serif; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input { max-width: 320px; }

dialog.app-modal { border: 0; border-radius: var(--radius); padding: 0; max-width: 640px; width: calc(100% - 32px); color: var(--ink); }
dialog.app-modal::backdrop { background: rgba(54, 54, 53, .45); }
.app-modal__body { padding: 24px; }
.app-modal__close { float: right; background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); margin: 0; }

.app-footer { text-align: center; font-size: .8rem; color: var(--muted); padding: 24px 16px 40px; }

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .panel { padding: 18px; }
  .actions .btn-app { width: 100%; }
}
dialog.app-modal:focus { outline: none; }
.ballot-card.is-missing { border-color: var(--red); }
.ballot-card.is-missing .choice legend { color: var(--red); }
table.data th button.sort { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; text-align: left; }
table.data th button.sort:hover { color: var(--ink); }
table.data th[aria-sort="ascending"], table.data th[aria-sort="descending"] { color: var(--ink); }
.sort__arrow { font-size: .75rem; opacity: .7; }

/* Admin vote list */
a.campaign-link { display: block; color: inherit; text-decoration: none; }
a.campaign-link:hover { border-color: var(--ink); }
a.campaign-link h2 { margin-bottom: 6px; }
