/* Bidadari Vote components. Uses the shared Bidadari tokens from site.css / dashboard.css. */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.good { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.stepper { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0 0 1.25rem; counter-reset: step; }
.stepper li { counter-increment: step; }
.stepper a { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: .9rem; min-height: 40px; }
.stepper a::before { content: counter(step); display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--surface-muted); font-size: .8rem; }
.stepper a[aria-current="step"] { color: var(--accent-contrast); background: var(--accent-grad); border-color: transparent; }
.stepper a[aria-current="step"]::before { background: rgb(255 255 255 / 25%); }
.stepper a.done::before { content: "\2713"; background: var(--success-soft); color: var(--success); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.statline { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; }
.statline > div { flex: 1 1 140px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.statline .label { color: var(--text-muted); font-size: .85rem; }
.statline .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.progress { height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent-grad); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.win > span { background: var(--success); }

.problems { margin: 0 0 1rem; padding-left: 1.2rem; }
.problems li { margin: .2rem 0; }
.actions-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; margin: 0; flex-wrap: wrap; }
.row-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.right { text-align: right; }
.panel { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 1rem; margin: .8rem 0; }
details.panel > summary { cursor: pointer; font-weight: 600; }
.pos-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.cand-line { display: flex; justify-content: space-between; gap: .8rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Voter ballot */
.progress-label { color: var(--text-muted); font-size: .9rem; margin: 0 0 .4rem; }
.question h1 { margin-bottom: .25rem; }
.cand-list { display: grid; gap: .7rem; margin: 1rem 0; padding: 0; list-style: none; }
.cand { position: relative; }
.cand input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.cand label { display: flex; gap: .9rem; align-items: center; padding: 1rem; min-height: 64px; margin: 0; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); font-weight: 600; cursor: pointer; }
.cand .mark { flex: none; width: 1.6rem; height: 1.6rem; border: 2px solid var(--text-muted); display: grid; place-items: center; background: var(--surface); }
.cand.single .mark { border-radius: 50%; }
.cand.multi .mark { border-radius: 6px; }
.cand input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.cand input:checked + label .mark { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }
.cand input:checked + label .mark::after { content: "\2713"; font-size: 1rem; line-height: 1; }
.cand input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.cand .meta { display: block; font-weight: 400; color: var(--text-muted); font-size: .9rem; }
.cand details { margin-left: 2.5rem; padding: .3rem 0 0; }
.nav-row { display: flex; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-top: 1rem; }
.nav-row .btn { flex: 1 1 140px; }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { padding: .8rem 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.review-list li:first-child { border-top: 0; }
.receipt { text-align: center; }
.receipt .ok { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--success-soft); color: var(--success); display: grid; place-items: center; font-size: 2rem; }
.receipt .ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.6rem; letter-spacing: .08em; font-weight: 700; }
.code-input { font-size: 1.4rem; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.result-row { padding: .6rem 0; border-top: 1px solid var(--border); }
.result-row:first-of-type { border-top: 0; }
.result-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-weight: 600; }
.table-scroll { overflow-x: auto; }
@media print { .no-print { display: none !important; } }

/* width steps (no inline styles under the strict CSP) */
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain legend { padding: 0; }
.center { text-align: center; }

/* ---- Phone polish (voter flow) ---- */
.site-header.bare nav { width: auto; margin-left: auto; }
.lang-btn { min-height: 40px; padding: .3rem .9rem; font-size: .9rem; }
.code-input { width: 100%; font-size: 1.25rem; letter-spacing: .06em; padding-inline: .6rem; font-variant-numeric: tabular-nums; }
.code-input::placeholder { font-size: 1rem; letter-spacing: .02em; opacity: .55; }
.cand { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cand label { border: 0; border-radius: 0; background: transparent; padding: .9rem 1rem; }
.cand input:checked + label { background: var(--accent-soft); }
.cand:has(input:checked) { border-color: var(--accent); }
.cand:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.cand input:focus-visible + label { outline: 0; }
.cand .name { display: block; min-width: 0; overflow-wrap: anywhere; }
.cand details { margin: 0; padding: 0 1rem .8rem 3.4rem; }
.cand details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; min-height: 32px; }
.cand details p { margin: .4rem 0 0; color: var(--text-muted); font-size: .92rem; }
.counter { text-align: center; color: var(--text-muted); font-weight: 600; margin: .2rem 0 0; }
.counter.full { color: var(--success); }
.review-list li { align-items: flex-start; flex-wrap: nowrap; }
.review-list li > a { flex: none; padding: .5rem .2rem; min-height: 44px; }
@media (max-width: 600px) {
  .nav-row.sticky { position: sticky; bottom: 0; margin: 1rem -16px 0; padding: .75rem 16px calc(.75rem + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border); z-index: 5; }
  .nav-row.sticky .btn { flex: 1 1 100px; }
  .question h1 { font-size: 1.5rem; }
  .receipt .ref { font-size: 1.35rem; }
  .card { padding: 18px; }
}

.cand:has(input:checked) { background: var(--accent-soft); }
.cand details { padding-bottom: .55rem; }
.cand label { padding-bottom: .7rem; }
.counter { margin: .4rem 0 .2rem; text-align: left; }

/* ---- Phone polish (organizer) ---- */
.statline .value.sm { font-size: 1.15rem; line-height: 1.3; }
.statline { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 700px) {
  .stepper { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; padding-bottom: 4px; }
  .stepper::-webkit-scrollbar { display: none; }
  .stepper li { flex: none; }
  .stack-mobile thead { display: none; }
  .stack-mobile, .stack-mobile tbody, .stack-mobile tr, .stack-mobile td { display: block; width: 100%; }
  .stack-mobile tr { padding: .8rem 1rem; border-top: 1px solid var(--border); }
  .stack-mobile td { padding: .15rem 0; border: 0; text-align: left; }
  .stack-mobile td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: .85rem; }
  .stack-mobile td.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .5rem; }
  .card-head { flex-wrap: wrap; gap: .6rem; }
  .card-head form { width: 100%; }
  .card-head input[type=text] { flex: 1; min-width: 0; }
}
@media (max-width: 700px) {
  .stack-mobile td[data-label="Name"] { font-weight: 700; }
  .stack-mobile td[data-label="Name"]:not([data-label=""])::before, .stack-mobile td[data-label="Email"]:not([data-label=""])::before { content: none; }
  .stack-mobile td[data-label="Email"] { color: var(--text-muted); overflow-wrap: anywhere; margin-bottom: .35rem; }
  .stack-mobile td[data-label="Status"], .stack-mobile td[data-label="Invitation"], .stack-mobile td[data-label="Voted"] { display: inline-block; width: auto; margin-right: .6rem; }
  .actions-row .inline-form, .actions-row .inline-form .btn, .actions-row > .btn { width: 100%; }
  .actions-row .btn { justify-content: center; white-space: normal; }
}

@media (max-width: 700px) { .grid-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { form.stack > .btn.primary, form.stack > button.btn { width: 100%; } }

/* ---- Organizer shell and overview ---- */
.crumbs { margin: 0 0 .2rem; font-size: .88rem; color: var(--text-muted); }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 600; }
.nav-label.nav-election { margin-top: 1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: .82rem; color: var(--text); font-weight: 700; padding-top: .8rem; border-top: 1px solid var(--border); }
.org-link { display: flex; align-items: center; gap: .6rem; padding: .45rem .7rem; border-radius: 10px; color: var(--text-muted); text-decoration: none; min-height: 40px; font-weight: 500; }
.org-link:hover { background: var(--accent-soft); color: var(--text); }
.org-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.org-link span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-dot { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 700; display: grid; place-items: center; border: 1px solid var(--border); }
.side-meta { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .85rem; padding: .2rem .2rem 0; }
.side-meta a { color: var(--text-muted); text-decoration: none; }
.side-meta a:hover { color: var(--accent); }
.side-meta .lang-btn { min-height: 32px; padding: .15rem .65rem; font-size: .8rem; }

.next { display: flex; gap: 1.2rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 1.2rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); margin: 0 0 1.2rem; border-left: 5px solid var(--accent); }
.next.next-good { border-left-color: var(--success); }
.next.next-warn { border-left-color: #e0a100; }
.next h2 { margin: 0 0 .15rem; font-size: 1.2rem; }
.next p { margin: 0; color: var(--text-muted); max-width: 60ch; }
.next .eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--accent); margin: 0 0 .2rem; }
.page-grid { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .page-grid { grid-template-columns: minmax(0, 1fr) 320px; } .col-side { position: sticky; top: 1rem; } }
.col-main > .card, .col-side > .card { margin-top: 0; margin-bottom: 1.2rem; }
.progress.lg { height: 16px; }
.progress.lg > span.min { min-width: 10px; }
.linkbox { background: var(--surface-muted); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; margin: .5rem 0 .8rem; overflow-wrap: anywhere; font-size: .82rem; }
.side-card h2 { font-size: 1rem; margin-bottom: .4rem; }
.side-card .btn.small { margin: 0 .3rem .3rem 0; }
.mini-stats { list-style: none; padding: 0; margin: .4rem 0 .8rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.mini-stats li { background: var(--surface-muted); border-radius: 10px; padding: .6rem .2rem; display: flex; flex-direction: column; font-size: .8rem; color: var(--text-muted); }
.mini-stats .n { font-size: 1.4rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.mini-stats .n.bad { color: var(--danger); }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { padding: .5rem 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; font-size: .9rem; }
.activity li:first-child { border-top: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 25%, var(--border)); }
.danger-zone h2 { color: var(--danger); }
.cand-list.preview { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.nowrap-form { flex-wrap: nowrap; }
.nowrap-form select { min-width: 170px; }
.add-row { display: grid; gap: .8rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; }
.add-row .field { margin: 0; }
@media (max-width: 700px) { .add-row { grid-template-columns: 1fr; } .nowrap-form { flex-wrap: wrap; } }
.turnout-cell { display: flex; flex-direction: column; gap: .25rem; min-width: 130px; }
.table.stack-mobile td strong { font-weight: 700; }
.progress > span.min { min-width: 8px; }

.card-head .inline-form { flex-wrap: nowrap; }
.card-head .inline-form input[type=text] { width: auto; min-width: 240px; }
.pos-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }
.pos-grid > .card { margin: 0; }
td.right { white-space: nowrap; }
