/* =====================================================================
   ভোটঘর — styles. Bangla first: Noto Sans Bengali, generous line height.
   Mobile first; breakpoints at 640px and 960px. No inline styles (CSP).
   ===================================================================== */

@font-face {
    font-family: "Noto Sans Bengali";
    src: url("../fonts/noto-sans-bengali-bengali-400-normal.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}
@font-face {
    font-family: "Noto Sans Bengali";
    src: url("../fonts/noto-sans-bengali-bengali-700-normal.woff2") format("woff2");
    font-weight: 600 700; font-style: normal; font-display: swap;
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

:root {
    --brand: #006a4e;          /* deep green */
    --brand-ink: #ffffff;
    --brand-soft: #e6f2ee;
    --accent: #c8102e;         /* used sparingly: live voting, warnings */
    --ink: #17201c;
    --ink-soft: #52605a;
    --line: #dde3df;
    --paper: #ffffff;
    --canvas: #f5f7f5;
    --ok: #1d7a46;
    --ok-soft: #e7f4ec;
    --warn: #8a5a00;
    --warn-soft: #fdf3dc;
    --bad: #b3261e;
    --bad-soft: #fbe9e7;
    --info: #1f5d99;
    --info-soft: #e8f0f9;
    --radius: 12px;
    --font: "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.7;
    color: var(--ink); background: var(--canvas);
    display: flex; flex-direction: column; min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .88rem; }
.muted { color: var(--ink-soft); }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; }
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 560px; }
.container--mid { max-width: 820px; }
.main { flex: 1; outline: none; }
.section { padding: 28px 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* ------------------------------------------------------------------ topbar */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; flex-wrap: wrap; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; min-width: 0; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; flex: none; display: inline-grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.brand__logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.brand__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62vw; }
.nav-toggle { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); display: inline-grid; place-items: center; cursor: pointer; }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 18px; height: 2px; background: var(--ink); position: relative; content: ""; }
.nav-toggle__bars::before { position: absolute; top: -6px; }
.nav-toggle__bars::after { position: absolute; top: 6px; }
.nav { display: none; width: 100%; padding: 4px 0 14px; }
.nav.is-open { display: block; }
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav__list a, .link-button { display: block; padding: 9px 4px; color: var(--ink); text-decoration: none; font: inherit; }
.nav__list a:hover, .link-button:hover { color: var(--brand); }
.nav__list a.button { color: var(--brand-ink); text-align: center; padding: 6px 16px; }
.nav__form { margin: 0; }
.link-button { background: none; border: 0; cursor: pointer; width: 100%; text-align: left; }
@media (min-width: 960px) {
    .nav-toggle { display: none; }
    .nav { display: block; width: auto; padding: 0; }
    .nav__list { flex-direction: row; align-items: center; gap: 18px; }
    .link-button { width: auto; }
}

/* ----------------------------------------------------------------- buttons */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 9px 20px; border-radius: 10px; border: 1px solid var(--brand);
    background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700;
    text-decoration: none; cursor: pointer; text-align: center;
}
.button:hover { filter: brightness(1.07); }
.button[disabled] { opacity: .5; cursor: not-allowed; }
.button--ghost { background: transparent; color: var(--brand); }
.button--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.button--small { min-height: 36px; padding: 4px 14px; font-size: .92rem; font-weight: 600; }
.button--big { min-height: 56px; font-size: 1.1rem; padding: 12px 28px; }
.button--block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------------- forms */
input, select, textarea {
    font: inherit; color: var(--ink); background: var(--paper);
    border: 1px solid #c3cbc6; border-radius: 9px; padding: 9px 12px; min-height: 46px; width: 100%;
}
textarea { min-height: 100px; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; }
input[type="file"] { padding: 8px; }
.form { display: grid; gap: 14px; }
.form--inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.form--inline .field { flex: 1 1 180px; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: .95rem; }
.field__hint { color: var(--ink-soft); font-size: .86rem; margin: 0; }
.field__error { color: var(--bad); font-size: .9rem; margin: 0; }
.field--error input, .field--error select, .field--error textarea { border-color: var(--bad); }
.field--check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.field--check input { margin-top: 6px; width: 20px; height: 20px; }
.search { display: flex; gap: 8px; margin: 12px 0; }
.search input { flex: 1; min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------------------------------------------------------- cards, panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel--soft { background: var(--brand-soft); border-color: #c4e0d6; }
.panel__title { font-size: 1.1rem; margin-bottom: 10px; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .cards--2 { grid-template-columns: 1fr 1fr; } }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card a.card__title { color: var(--ink); text-decoration: none; }
.card__title { font-weight: 700; font-size: 1.08rem; display: block; }
.card__meta { color: var(--ink-soft); font-size: .9rem; }
.stat { display: grid; gap: 2px; }
.stat__value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.stat__label { color: var(--ink-soft); font-size: .9rem; }

.hero { background: var(--paper); border-bottom: 1px solid var(--line); padding: 44px 0 36px; }
.hero__title { font-size: 2rem; max-width: 20ch; }
.hero__lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 52ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 640px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--ink-soft); }

.banner { background: var(--brand); color: var(--brand-ink); padding: 26px 0; }
.banner a { color: inherit; }
.banner__title { font-size: 1.6rem; margin: 0; }
.banner__meta { margin: 4px 0 0; opacity: .9; }

/* ------------------------------------------------------------------ alerts */
.alert { border-radius: 10px; padding: 12px 16px; margin: 16px 0 0; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert--success { background: var(--ok-soft); border-color: #bfe0cb; color: #124d2c; }
.alert--error { background: var(--bad-soft); border-color: #f2c5bf; color: #7d1a14; }
.alert--info { background: var(--info-soft); border-color: #c5d8ee; color: #173f69; }
.alert--warning { background: var(--warn-soft); border-color: #f0dca6; color: #5e3e00; }

.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: #eef0ee; color: #3b4440; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--live { background: var(--accent); color: #fff; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; background: #f8faf9; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-muted td { color: var(--ink-soft); }

/* ---------------------------------------------------------- election tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 12px 0 20px; scrollbar-width: thin; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-soft); white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.steps li::before { counter-increment: step; content: counter(step); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #eef0ee; font-weight: 700; }
.steps li.is-done::before { content: "✓"; background: var(--ok); color: #fff; }
.steps li.is-current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.schedule { display: grid; gap: 0; margin: 0; }
.schedule div { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.schedule dt { color: var(--ink-soft); }
.schedule dd { margin: 0; font-weight: 600; text-align: right; }

.meter { height: 12px; border-radius: 999px; background: #e8ece9; overflow: hidden; }
.meter__bar { height: 100%; background: var(--brand); width: 0; }
.bars { display: grid; gap: 6px; }
.bars__row { display: grid; grid-template-columns: 110px 1fr 54px; gap: 8px; align-items: center; font-size: .9rem; }

/* ------------------------------------------------------------------ ballot */
.ballot { display: grid; gap: 18px; }
.ballot__position { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 0; overflow: hidden; }
.ballot__head { padding: 14px 16px; background: #f4f8f6; border-bottom: 1px solid var(--line); }
.ballot__title { font-size: 1.2rem; margin: 0; }
.ballot__rule { margin: 2px 0 0; color: var(--ink-soft); font-size: .92rem; }
.ballot__count { font-weight: 700; color: var(--brand); }
.ballot__list { list-style: none; margin: 0; padding: 0; }
.choice { border-bottom: 1px solid var(--line); }
.choice:last-child { border-bottom: 0; }
.choice label { display: grid; grid-template-columns: 30px 64px 1fr; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; min-height: 84px; }
.choice input { width: 26px; height: 26px; accent-color: var(--brand); }
.choice:has(input:checked) { background: var(--brand-soft); }
.choice__symbol { width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; overflow: hidden; font-size: .78rem; text-align: center; color: var(--ink-soft); }
.choice__symbol img { width: 100%; height: 100%; object-fit: contain; }
.choice__name { font-weight: 700; font-size: 1.08rem; display: block; }
.choice__meta { color: var(--ink-soft); font-size: .9rem; }
.choice__photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; float: right; margin-left: 8px; }
.ballot__unopposed { padding: 14px 16px; }
.ballot__actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--canvas) 30%); padding: 18px 0 12px; }

.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.review-list li { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.review-list .abstain { color: var(--warn); font-weight: 600; }

.receipt { text-align: center; background: var(--paper); border: 2px dashed var(--brand); border-radius: 14px; padding: 22px 16px; }
.receipt__code { font-size: 1.5rem; font-weight: 700; letter-spacing: .08em; margin: 8px 0; font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 2rem; margin: 0 auto 10px; }

.winner { font-weight: 700; }
.winner-badge { color: var(--ok); font-weight: 700; }
.tie-badge { color: var(--warn); font-weight: 700; }
.thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); vertical-align: middle; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.pagination a, .pagination span { padding: 4px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--paper); }
.pagination span[aria-current] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

.secret-link { background: var(--warn-soft); border: 1px solid #f0dca6; border-radius: 10px; padding: 12px; overflow-wrap: anywhere; }
.danger-zone { border-color: #f2c5bf; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* ------------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--line); background: var(--paper); padding: 18px 0; margin-top: 32px; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.footer__note { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.locale-form { margin: 0; }
.locale-form select { width: auto; min-height: 38px; padding: 4px 10px; }
.error-page { text-align: center; padding: 48px 0; }
.error-page__code { font-size: 3rem; font-weight: 700; color: var(--line); margin: 0; }
.debug { text-align: left; white-space: pre-wrap; background: #111; color: #eee; padding: 12px; border-radius: 8px; font-size: .8rem; overflow-x: auto; }

/* ---------------------------------------------------------- printed notices */
.paper { background: #fff; max-width: 210mm; margin: 16px auto; padding: 18mm 16mm; border: 1px solid var(--line); position: relative; }
.paper__head { text-align: center; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 16px; }
.paper__org { font-size: 1.35rem; font-weight: 700; margin: 0; }
.paper__title { font-size: 1.15rem; margin: 6px 0 0; }
.paper table { font-size: .92rem; }
.paper th, .paper td { border: 1px solid #999; padding: 5px 8px; }
.paper tr:last-child td, .paper tr:last-child th { border-bottom: 1px solid #999; }
.paper table { margin-bottom: 6px; }
.paper__sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; margin-top: 48px; text-align: center; }
.paper__sign div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: .9rem; }
.paper__foot { margin-top: 24px; font-size: .78rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.watermark { position: absolute; top: 40%; left: 0; right: 0; text-align: center; font-size: 5rem; font-weight: 700; color: rgba(200, 16, 46, .12); transform: rotate(-18deg); pointer-events: none; }
.print-bar { text-align: center; margin: 12px 0; }

@media print {
    body { background: #fff; font-size: 12pt; }
    .topbar, .footer, .print-bar, .skip-link, .no-print, .alert { display: none !important; }
    .paper { border: 0; margin: 0; padding: 0; max-width: none; }
    a { color: inherit; text-decoration: none; }
    @page { size: A4; margin: 14mm; }
    tr { break-inside: avoid; }
}
