/* Fraternity Voting System — member portal styles.
 * Everything is scoped under .fv-portal and prefixed .fv- so it does not
 * fight with theme CSS. Brand colours come from --fv-primary / --fv-accent
 * (set from plugin settings) with sensible fallbacks.
 */
:root {
	--fv-primary: #0F4C3A;
	--fv-accent: #C9A227;
	--fv-paper: #F7F8F5;
	--fv-card: #FFFFFF;
	--fv-ink: #1B1F1A;
	--fv-muted: #5B6660;
	--fv-line: #D8DED9;
	--fv-error: #B23A2E;
	--fv-ok: #2E7D4F;
	--fv-warn: #9A6B00;
	--fv-radius: 14px;
	--fv-radius-sm: 8px;
	--fv-font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--fv-font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.fv-portal { font-family: var(--fv-font); color: var(--fv-ink); line-height: 1.5; max-width: 980px; margin: 0 auto; padding: 16px; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
.fv-portal *, .fv-portal *::before, .fv-portal *::after { box-sizing: border-box; }
.fv-portal h1, .fv-portal h2, .fv-portal h3 { margin: 0; font-family: var(--fv-font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.fv-h1 { font-size: 1.85rem; }
.fv-h2 { font-size: 1.3rem; margin-bottom: 12px; }
.fv-kicker { margin: 0 0 4px; font-size: 0.85rem; color: var(--fv-primary); font-weight: 600; }
.fv-meta { color: var(--fv-muted); font-size: 0.9rem; margin: 4px 0; }
.fv-meta__tz { font-size: 0.8em; }
.fv-hint { color: var(--fv-muted); font-size: 0.9rem; margin: 8px 0; }
.fv-prose p { margin: 0 0 1em; }
.fv-portal code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--fv-paper); padding: 2px 6px; border-radius: 4px; font-size: 0.95em; }
.fv-portal a { color: var(--fv-primary); }

/* Nav */
.fv-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0 18px; border-bottom: 1px solid var(--fv-line); margin-bottom: 22px; }
.fv-nav__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--fv-font-display); font-weight: 700; font-size: 1.1rem; color: var(--fv-ink); }
.fv-nav__logo { height: 36px; width: auto; }
.fv-nav__links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.95rem; }
.fv-nav__links a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.fv-nav__links a:hover, .fv-nav__links a:focus-visible { border-bottom-color: var(--fv-accent); }
.fv-nav__logout { color: var(--fv-muted) !important; }

/* Buttons */
.fv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 22px; border-radius: var(--fv-radius-sm); border: 1.5px solid transparent; font: 600 1rem var(--fv-font); cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; -webkit-tap-highlight-color: transparent; }
.fv-btn:active { transform: translateY(1px); }
.fv-btn:disabled { opacity: .5; cursor: not-allowed; }
.fv-btn--primary { background: var(--fv-primary); color: #fff; }
.fv-btn--primary:hover:not(:disabled) { filter: brightness(1.1); }
.fv-btn--secondary { background: var(--fv-card); color: var(--fv-primary); border-color: var(--fv-primary); }
.fv-btn--block { width: 100%; }
.fv-btn--lg { min-height: 54px; font-size: 1.05rem; }
.fv-btn--sm { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.fv-link { background: none; border: 0; padding: 0; color: var(--fv-primary); text-decoration: underline; cursor: pointer; font: inherit; }
.fv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.fv-actions .fv-btn { flex: 1 1 160px; }
.fv-portal :focus-visible { outline: 3px solid var(--fv-accent); outline-offset: 2px; }

/* Forms */
.fv-form { display: flex; flex-direction: column; gap: 14px; }
.fv-field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.fv-field input, .fv-field select, .fv-field textarea { font: 1rem var(--fv-font); padding: 12px 14px; border: 1.5px solid var(--fv-line); border-radius: var(--fv-radius-sm); background: var(--fv-card); color: var(--fv-ink); min-height: 46px; width: 100%; }
.fv-field input:focus { border-color: var(--fv-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fv-primary) 20%, transparent); }
.fv-check { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; }
.fv-check input { width: 20px; height: 20px; }
.fv-hp { position: absolute; left: -9999px; }
.fv-details summary { cursor: pointer; margin: 16px 0 8px; color: var(--fv-muted); }

/* PIN entry */
.fv-pin { display: flex; gap: 10px; }
.fv-pin input { width: 54px; height: 60px; text-align: center; font-size: 1.6rem; letter-spacing: 0; padding: 0; }
.fv-pin--lg { justify-content: center; margin: 18px 0; }
.fv-pin--lg input { width: 62px; height: 72px; font-size: 2rem; border-width: 2px; }

/* Alerts & badges */
.fv-alert { padding: 12px 14px; border-radius: var(--fv-radius-sm); font-size: 0.95rem; margin: 0; background: var(--fv-paper); border-left: 4px solid var(--fv-line); }
.fv-alert--error { background: #FBECEA; border-left-color: var(--fv-error); color: #6E211A; }
.fv-alert--ok { background: #E8F3EC; border-left-color: var(--fv-ok); color: #1F4D33; }
.fv-alert--warn { background: #FBF3DF; border-left-color: var(--fv-warn); color: #5B3F00; }
.fv-alert--info { background: #EAF0EE; border-left-color: var(--fv-primary); }
.fv-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--fv-paper); color: var(--fv-muted); border: 1px solid var(--fv-line); white-space: nowrap; }
.fv-badge--ok, .fv-badge--active { background: #E8F3EC; color: var(--fv-ok); border-color: transparent; }
.fv-badge--suspended, .fv-badge--expelled { background: #FBECEA; color: var(--fv-error); border-color: transparent; }
.fv-status-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; letter-spacing: .02em; background: var(--fv-line); color: var(--fv-ink); }
.fv-status-badge--open { background: var(--fv-ok); color: #fff; }
.fv-status-badge--paused { background: var(--fv-warn); color: #fff; }
.fv-status-badge--scheduled { background: var(--fv-primary); color: #fff; }

/* Layout */
.fv-section { background: var(--fv-card); border: 1px solid var(--fv-line); border-radius: var(--fv-radius); padding: 20px; margin-bottom: 18px; }
.fv-section--narrow { max-width: 520px; }
.fv-grid-2 { display: grid; grid-template-columns: 1fr; gap: 18px; }
.fv-empty { text-align: center; color: var(--fv-muted); padding: 30px 10px; }
.fv-list { list-style: none; margin: 0; padding: 0; }
.fv-list__item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--fv-line); }
.fv-list__item:first-child { border-top: 0; }
.fv-list__item.is-unread strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--fv-accent); margin-right: 8px; vertical-align: middle; }
.fv-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 0.95rem; }
.fv-dl dt { color: var(--fv-muted); }
.fv-dl dd { margin: 0; }
.fv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.fv-stat { background: var(--fv-card); border: 1px solid var(--fv-line); border-radius: var(--fv-radius); padding: 14px; text-align: center; }
.fv-stat__n { display: block; font-family: var(--fv-font-display); font-size: 1.6rem; font-weight: 700; color: var(--fv-primary); }
.fv-stat__l { font-size: 0.8rem; color: var(--fv-muted); }
.fv-table-wrap { overflow-x: auto; }
.fv-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.fv-table th, .fv-table td { padding: 10px 8px; border-bottom: 1px solid var(--fv-line); text-align: left; vertical-align: top; }
.fv-table th { color: var(--fv-muted); font-weight: 600; font-size: 0.8rem; }

/* Auth panel */
.fv-auth { display: flex; justify-content: center; padding: 20px 0; }
.fv-auth__panel { width: 100%; max-width: 420px; background: var(--fv-card); border: 1px solid var(--fv-line); border-radius: var(--fv-radius); padding: 28px 24px; box-shadow: 0 10px 30px -18px rgba(15, 76, 58, .35); }
.fv-auth--wide .fv-auth__panel { max-width: 560px; }
.fv-auth__logo { max-height: 64px; width: auto; display: block; margin: 0 auto 12px; }
.fv-auth__title { text-align: center; font-size: 1.5rem; }
.fv-auth__sub { text-align: center; color: var(--fv-muted); margin: 4px 0 20px; }
.fv-auth .fv-link { display: block; margin: 16px auto 0; }
.fv-steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 22px; display: grid; gap: 8px; }
.fv-steps__item { counter-increment: step; display: flex; align-items: center; gap: 10px; color: var(--fv-muted); font-size: 0.95rem; }
.fv-steps__item::before { content: counter(step); width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--fv-line); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.fv-steps__item.is-current { color: var(--fv-ink); font-weight: 600; }
.fv-steps__item.is-current::before { border-color: var(--fv-primary); background: var(--fv-primary); color: #fff; }
.fv-steps__item.is-done::before { content: "✓"; border-color: var(--fv-ok); background: var(--fv-ok); color: #fff; }

/* Election card */
.fv-election-card { display: grid; grid-template-columns: 1fr; gap: 16px; background: var(--fv-card); border: 1px solid var(--fv-line); border-left: 6px solid var(--fv-primary); border-radius: var(--fv-radius); padding: 20px; margin-bottom: 16px; }
.fv-election-card--paused { border-left-color: var(--fv-warn); }
.fv-election-card__title { font-size: 1.35rem; margin: 8px 0 4px; }
.fv-election-card__actions { display: flex; align-items: center; }
.fv-election-card__actions .fv-btn, .fv-election-card__actions .fv-alert { width: 100%; }
.fv-progress { height: 8px; background: var(--fv-paper); border: 1px solid var(--fv-line); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.fv-progress span { display: block; height: 100%; background: var(--fv-accent); transition: width .3s; }

/* Countdown */
.fv-countdown { margin: 10px 0; }
.fv-countdown__label { display: block; font-size: 0.8rem; color: var(--fv-muted); margin-bottom: 4px; }
.fv-countdown__cells { display: inline-flex; gap: 6px; }
.fv-countdown__cell { display: inline-flex; flex-direction: column; align-items: center; min-width: 46px; padding: 6px 4px; background: var(--fv-paper); border-radius: var(--fv-radius-sm); }
.fv-countdown__cell b { font-family: var(--fv-font-display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.fv-countdown__cell small { font-size: 0.65rem; color: var(--fv-muted); }
.fv-countdown--big .fv-countdown__cell { min-width: 70px; padding: 12px 6px; }
.fv-countdown--big .fv-countdown__cell b { font-size: 2rem; }

/* Ballot */
.fv-ballot__head { margin-bottom: 20px; }
.fv-ballot-position { background: var(--fv-card); border: 1px solid var(--fv-line); border-radius: var(--fv-radius); padding: 18px 16px; margin-bottom: 18px; }
.fv-ballot-position.is-voted { opacity: .7; }
.fv-ballot-position__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fv-ballot-position__head .fv-h2 { margin: 0; }
.fv-candidate-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fv-candidate-card { position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 14px; border: 2px solid var(--fv-line); border-radius: var(--fv-radius); background: var(--fv-card); cursor: pointer; text-align: left; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.fv-candidate-card:hover { border-color: var(--fv-primary); }
.fv-candidate-card.is-selected { border-color: var(--fv-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--fv-accent) 25%, transparent); background: color-mix(in srgb, var(--fv-accent) 6%, var(--fv-card)); }
.fv-candidate-card__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fv-candidate-card:has(.fv-candidate-card__input:focus-visible) { outline: 3px solid var(--fv-accent); outline-offset: 2px; }
.fv-candidate-card__photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--fv-paper); }
.fv-candidate-card__photo--empty { display: flex; align-items: center; justify-content: center; font-family: var(--fv-font-display); font-size: 2rem; color: var(--fv-primary); }
.fv-candidate-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-bottom: 40px; }
.fv-candidate-card__num { font-size: 0.75rem; color: var(--fv-muted); }
.fv-candidate-card__name { font-family: var(--fv-font-display); font-size: 1.15rem; font-weight: 700; }
.fv-candidate-card__bio { margin: 6px 0 0; font-size: 0.92rem; color: var(--fv-ink); }
.fv-candidate-card__links { display: flex; gap: 14px; margin-top: 8px; font-size: 0.88rem; }
.fv-candidate-card__mark { position: absolute; right: 14px; bottom: 12px; padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; border: 1.5px solid var(--fv-line); color: var(--fv-muted); }
.fv-candidate-card__mark-on { display: none; }
.fv-candidate-card.is-selected .fv-candidate-card__mark { background: var(--fv-accent); border-color: var(--fv-accent); color: #1B1F1A; }
.fv-candidate-card.is-selected .fv-candidate-card__mark-idle { display: none; }
.fv-candidate-card.is-selected .fv-candidate-card__mark-on { display: inline; }
.fv-candidate-card--abstain { grid-template-columns: 1fr; border-style: dashed; }
.fv-sticky { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin: 0 -16px; background: var(--fv-card); border-top: 1px solid var(--fv-line); box-shadow: 0 -8px 24px -16px rgba(0,0,0,.35); }
.fv-sticky__progress { flex: 1; font-size: 0.85rem; color: var(--fv-muted); min-width: 0; }
.fv-sticky .fv-progress { margin-top: 6px; }
.fv-skeleton__block { height: 140px; border-radius: var(--fv-radius); background: linear-gradient(90deg, var(--fv-paper), #EDF0EC, var(--fv-paper)); background-size: 200% 100%; animation: fv-shimmer 1.2s infinite; margin-bottom: 14px; }
@keyframes fv-shimmer { to { background-position: -200% 0; } }

/* Modals */
.fv-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(27, 31, 26, .55); display: flex; align-items: flex-end; justify-content: center; padding: 0; overflow-y: auto; }
.fv-modal[hidden] { display: none; }
.fv-modal__box { position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--fv-card); border-radius: var(--fv-radius) var(--fv-radius) 0 0; padding: 26px 20px 22px; }
.fv-modal__box--wide { max-width: 720px; }
.fv-modal__box--receipt { text-align: center; }
.fv-modal__close { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; background: var(--fv-paper); border-radius: 50%; font-size: 1.4rem; cursor: pointer; }
body.fv-modal-open { overflow: hidden; }
.fv-review { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.fv-review dt { padding-top: 10px; color: var(--fv-muted); font-size: 0.85rem; }
.fv-review dd { margin: 0; padding-bottom: 10px; font-weight: 600; border-bottom: 1px solid var(--fv-line); }
.fv-review dd.is-skipped { color: var(--fv-muted); font-weight: 400; font-style: italic; }
.fv-receipt { background: var(--fv-paper); border: 1px dashed var(--fv-primary); border-radius: var(--fv-radius); padding: 16px; margin: 14px 0; text-align: center; }
.fv-receipt__code { font-family: ui-monospace, Menlo, monospace; font-size: 1.3rem; letter-spacing: .08em; font-weight: 700; color: var(--fv-primary); margin: 0; }
.fv-receipt__mark { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--fv-ok); color: #fff; font-size: 2rem; display: flex; align-items: center; justify-content: center; }
.fv-modal__box--receipt .fv-dl { text-align: left; justify-content: center; margin: 14px auto; }

/* Candidate detail */
.fv-cand-detail__photo { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; display: block; margin-bottom: 10px; }
.fv-slogan { font-family: var(--fv-font-display); font-style: italic; font-size: 1.1rem; color: var(--fv-primary); margin: 6px 0; }
.fv-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fv-line); margin: 14px 0; }
.fv-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; font: 600 0.95rem var(--fv-font); color: var(--fv-muted); cursor: pointer; }
.fv-tab.is-active { color: var(--fv-ink); border-bottom-color: var(--fv-accent); }
.fv-tabpanel { display: none; }
.fv-tabpanel.is-active { display: block; }
.fv-video iframe { width: 100%; aspect-ratio: 16/9; height: auto; }
.fv-candidate-profile__photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; }

/* Vote status & results */
.fv-status-list { list-style: none; padding: 0; margin: 0 0 12px; }
.fv-status-list__item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--fv-line); }
.fv-result-block { background: var(--fv-card); border: 1px solid var(--fv-line); border-radius: var(--fv-radius); padding: 18px 16px; margin-bottom: 16px; }
.fv-result-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--fv-line); }
.fv-result-row:first-of-type { border-top: 0; }
.fv-result-row__who { display: flex; align-items: center; gap: 10px; }
.fv-result-row__photo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.fv-result-row__bar { height: 12px; background: var(--fv-paper); border-radius: 999px; overflow: hidden; }
.fv-result-row__bar span { display: block; height: 100%; background: var(--fv-primary); }
.fv-result-row.is-winner .fv-result-row__bar span { background: var(--fv-accent); }
.fv-result-row__n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* State screens */
.fv-state { text-align: center; padding: 40px 16px; }
.fv-state .fv-btn { margin-top: 18px; }

@media (min-width: 640px) {
	.fv-portal { padding: 24px; }
	.fv-h1 { font-size: 2.2rem; }
	.fv-grid-2 { grid-template-columns: 1fr 1fr; }
	.fv-candidate-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
	.fv-election-card { grid-template-columns: 1fr auto; align-items: center; }
	.fv-election-card__actions .fv-btn { width: auto; min-width: 200px; }
	.fv-modal { align-items: center; padding: 24px; }
	.fv-modal__box { border-radius: var(--fv-radius); }
	.fv-result-row { grid-template-columns: 240px 1fr 110px; align-items: center; }
	.fv-result-row__n { text-align: right; }
	.fv-sticky { margin: 0 -24px; padding: 14px 24px; }
	.fv-actions .fv-btn { flex: 0 1 auto; }
}

@media (max-width: 639px) {
	.fv-table thead { display: none; }
	.fv-table tr { display: block; border-bottom: 1px solid var(--fv-line); padding: 8px 0; }
	.fv-table td { display: flex; gap: 10px; border: 0; padding: 4px 0; }
	.fv-table td::before { content: attr(data-label); color: var(--fv-muted); min-width: 80px; font-size: 0.8rem; }
	.fv-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
	.fv-stat__n { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
	.fv-portal * { transition: none !important; animation: none !important; }
}
@media print {
	.fv-nav, .fv-sticky, .fv-btn { display: none !important; }
}
