/*
  ===========================================================================
  Redesign — "Design modernization guidance" (design_handoff_banovici_redesign)
  ===========================================================================
  Loaded after style.css (partials/header.ejs) and built up phase by phase,
  so each phase is a reviewable block here instead of edits scattered
  through style.css's 3,000 lines of earlier passes. Where a rule here
  supersedes one in style.css, this file wins by load order at equal
  specificity.

  Phase 1 — foundation: design tokens (light + dark), Public Sans only,
  the sidebar/top bar/tab bar app shell, toast, base controls.
*/

/* --- Tokens ----------------------------------------------------------------
   The guidance's palette mapped onto the existing token names (so every
   older rule that reads --brand-* / --bs-* / --dash-* picks it up), plus
   the new surface/line/ink scale the redesigned screens use directly. */
:root {
  --font-display: var(--font-body);

  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #16201a;
  --ink2: #464c48;
  --muted: #6b716d;
  --line: #e3e7e4;
  --line2: #eef1ef;
  --line3: #c7ccd1;
  --soft: #f0f3f1;
  --soft2: #f8faf9;
  --track: #eef0ec;
  --header: rgba(244, 246, 245, 0.88);
  --sel: #f2f8f4;
  --switch-off: #d5dad7;
  --unassessed: #dcd8ce;

  --green: #178c40;
  --green-hover: #13793a;
  --green-dark: #0d5c29;
  --green-ink: #0d5c29;
  --green-tint: #eaf5ee;
  --blue: #1f5ea3;
  --blue-ink: #1f5ea3;
  --blue-tint: #e5edf7;
  --red: #c22630;
  --red-ink: #a01f28;
  --red-tint: #f8e8e7;
  --gold: #c9a227;
  --gold-ink: #7a5f0e;
  --gold-tint: #f7f2e1;

  --radius-card: 16px;
  --radius-control: 10px;
  --shadow-float: 0 8px 24px rgba(16, 24, 20, 0.06);
  --shadow-modal: 0 24px 60px rgba(16, 24, 20, 0.28);
  --shadow-menu: 0 12px 32px rgba(16, 24, 20, 0.16);
  --shadow-primary: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 2px 6px rgba(23, 140, 64, 0.28);

  /* Existing names, retinted to the guidance's values. */
  --brand-body-bg: var(--bg);
  --brand-gold-tint: var(--gold-tint);
  --bs-body-bg: var(--surface);
  --bs-body-color: var(--ink);
  --bs-emphasis-color: var(--ink);
  --bs-border-color: var(--line3);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--soft2);
  --bs-card-bg: var(--surface);
  --dash-card-border: var(--line);
  --dash-track: var(--track);
  --dash-muted: var(--muted);
  --dash-body-text: var(--ink2);
  --dash-unassessed: var(--unassessed);
  --md-shape-medium: var(--radius-card);
}

[data-bs-theme="dark"] {
  --bg: #1a1d20;
  --surface: #22262a;
  --ink: #e9ecea;
  --ink2: #c6ccc8;
  --muted: #98a09b;
  --line: #2f3532;
  --line2: #2a2f2c;
  --line3: #3f454b;
  --soft: #2b302d;
  --soft2: #1e2124;
  --track: #2b302d;
  --header: rgba(26, 29, 32, 0.86);
  --sel: #1c2a22;
  --switch-off: #3f454b;
  --unassessed: #4a514c;

  --green-ink: #7fd39a;
  --green-tint: #12351f;
  --blue-ink: #5b93cf;
  --blue-tint: #16232f;
  --red-ink: #e05a63;
  --red-tint: #2e1a1c;
  --gold-ink: #d4b23f;
  --gold-tint: #332c17;

  --brand-body-bg: var(--bg);
  --brand-gold-tint: var(--gold-tint);
  --bs-body-bg: var(--surface);
  --bs-body-color: var(--ink);
  --bs-emphasis-color: var(--ink);
  --bs-border-color: var(--line3);
  --bs-secondary-color: var(--muted);
  --bs-tertiary-bg: var(--soft2);
  --bs-card-bg: var(--surface);
  --dash-card-border: var(--line);
  --dash-track: var(--track);
  --dash-muted: var(--muted);
  --dash-body-text: var(--ink2);
  --dash-unassessed: var(--unassessed);
}

/* --- Typography --------------------------------------------------------------
   Public Sans only; Fraunces is dropped (--font-display now resolves to
   the body face, so every older heading rule follows). Figures are
   tabular everywhere they line up in columns. */
body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-body);
  letter-spacing: -0.01em;
}

table, .badge, .pagination, .dash-chip-count, time,
[class*="count"], [class*="-value"], [class*="-figure"] {
  font-variant-numeric: tabular-nums;
}

/* --- Base controls ------------------------------------------------------------ */
.btn {
  border-radius: var(--radius-control);
  font-weight: 600;
}

.btn-sm {
  border-radius: 8px;
}

.btn-primary {
  --bs-btn-bg: var(--green);
  --bs-btn-border-color: var(--green);
  --bs-btn-hover-bg: var(--green-hover);
  --bs-btn-hover-border-color: var(--green-hover);
  --bs-btn-active-bg: var(--green-hover);
  --bs-btn-active-border-color: var(--green-hover);
  --bs-btn-disabled-bg: var(--green);
  --bs-btn-disabled-border-color: var(--green);
  box-shadow: var(--shadow-primary);
}

.btn-primary:disabled,
.btn-primary.disabled {
  box-shadow: none;
}

.form-control,
.form-select {
  border-radius: var(--radius-control);
  border-color: var(--line3);
  background-color: var(--surface);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.form-check-input:checked {
  background-color: var(--green);
  border-color: var(--green);
}

.form-check-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

/* Cards (.md-surface) went flat in style.css itself — see the note
   there. */
.app-card {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--radius-card);
}

.modal-content {
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-modal);
  background: var(--surface);
}

/* --- App shell -----------------------------------------------------------------
   partials/header.ejs + footer.ejs. Sidebar >= 980px, tab bar below. */
body.has-shell {
  display: block;
  min-height: 100vh;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 252px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.app-sidebar-band.tricolor-band {
  height: 4px;
  flex-shrink: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  color: var(--ink);
  text-decoration: none;
}

.app-brand:hover {
  color: var(--ink);
}

.app-brand img {
  height: 30px;
  width: auto;
}

.app-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.app-brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-brand-place {
  font-size: 12px;
  color: var(--muted);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
}

.app-nav-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 18px 12px 6px;
}

.app-nav-group:first-child {
  padding-top: 10px;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink2);
  text-decoration: none;
  transition: background-color 0.15s;
}

.app-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-nav-item > span:not(.app-nav-badge) {
  flex: 1;
}

.app-nav-item:hover {
  background: var(--soft);
  color: var(--ink);
}

.app-nav-item.active {
  background: var(--green-tint);
  color: var(--green-ink);
  font-weight: 600;
}

.app-nav-badge {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.app-sidebar-foot {
  margin-top: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-sync {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--ink2);
  padding: 0 4px;
}

.app-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

body.is-offline .app-sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-tint);
}

.app-sync-pending {
  font-weight: 600;
  color: var(--gold-ink);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.app-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green-dark);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}

.app-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-user-name:hover,
.app-user-name.active {
  color: var(--green-ink);
}

.app-user-role {
  font-size: 12px;
  color: var(--muted);
}

.app-icon-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.app-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-icon-btn span {
  display: inline-flex;
}

.app-icon-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

.app-icon-btn-danger:hover {
  color: var(--red);
}

.app-icon-btn-boxed {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  border-radius: 10px;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-election-strip {
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}

.app-election-pill {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  white-space: nowrap;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: var(--header);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.app-topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-topbar-logo {
  display: none;
}

.app-topbar-logo img {
  height: 26px;
  width: auto;
}

.app-search {
  flex: 1;
  min-width: 0;
  max-width: 460px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  margin: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.app-search:hover {
  border-color: var(--line3);
}

.app-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.app-search svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.app-search input::placeholder {
  color: var(--muted);
}

.app-search-kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  box-shadow: none;
}

.app-topbar-spacer {
  flex: 1;
}

.app-topbar-theme {
  display: none;
}

.app-topbar-new {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 14px;
  white-space: nowrap;
}

.app-topbar-new svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.app-topbar .sync-chip {
  flex-shrink: 0;
}

.app-content {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 32px 48px;
  animation: redesign-fade-up 0.25s ease-out;
}

.app-content-wide {
  max-width: none;
}

@keyframes redesign-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Tab bar: the guidance's spec (22px icons, >= 48px targets) on the
   existing markup; hidden wherever the sidebar is showing. */
.app-tabbar-item {
  color: var(--muted);
  min-height: 48px;
  justify-content: center;
}

.app-tabbar-item.active,
[data-bs-theme="dark"] .app-tabbar-item.active {
  color: var(--green-ink);
}

@media (min-width: 980px) {
  .app-tabbar {
    display: none !important;
  }
}

@media (max-width: 979.98px) {
  .app-sidebar {
    display: none;
  }

  .app-topbar-inner {
    padding: 10px 16px;
    gap: 10px;
  }

  .app-topbar-logo,
  .app-topbar-theme {
    display: flex;
  }

  .app-search-kbd {
    display: none;
  }

  /* Icon-only on phones — the label doesn't fit beside the search. */
  .app-topbar-new {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .app-topbar-new span {
    display: none;
  }

  .app-content {
    padding: 20px 16px 32px;
  }

  body.has-shell {
    padding-bottom: 76px;
  }

  .app-tabbar {
    position: fixed;
    inset: auto 0 0 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 0.35rem 0 0.9rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 1035;
  }

  .app-tabbar-election {
    border-top: 3px solid var(--red);
  }
}


/* --- Toast -------------------------------------------------------------------
   Bottom centre, ink background, green dot (public/js/toast.js markup). */
.toast-stack {
  left: 50%;
  right: auto;
  bottom: 24px;
  transform: translateX(-50%);
  align-items: center;
  max-width: min(92vw, 420px);
}

.app-toast {
  background: #16201a;
  color: #fff;
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow-menu);
  padding: 10px 14px;
  gap: 10px;
  font-size: 13px;
}

.app-toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3aab5f;
  flex-shrink: 0;
}

.app-toast-success,
.app-toast-error {
  border-left: 0;
}

.app-toast-error::before {
  background: #e05a63;
}

.app-toast-message {
  font-size: 13px;
}

[data-bs-theme="dark"] .app-toast {
  background: #e9ecea;
  color: #16201a;
}

@media (max-width: 979.98px) {
  .toast-stack {
    bottom: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-content {
    animation: none;
  }
}

@media print {
  .app-sidebar,
  .app-topbar,
  .app-tabbar,
  .app-election-strip {
    display: none !important;
  }

  .app-content {
    max-width: none;
    padding: 0;
  }
}

/* Coloured hero surfaces keep their own fill — no card border on them. */
.dash-masthead.md-surface,
.page-masthead.md-surface {
  border-color: transparent;
}

/* ===========================================================================
   Phase 2 — shared pieces (page head, buttons, switch, labels) and the
   people list + person side panel (people/index.ejs, people/_panel.ejs,
   public/js/people-list.js).
   =========================================================================== */
.rd-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.rd-page-title {
  margin: 4px 0 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.rd-page-count {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rd-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.rd-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.rd-btn:hover {
  border-color: var(--line3);
  background: var(--soft2);
  color: var(--ink);
}

.rd-btn svg,
.rd-btn-ghost svg,
.pp-nav-btn svg,
.pl-search svg,
.pl-filter-btn svg,
.pl-sort svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rd-btn-sm {
  height: 32px;
  border-radius: 8px;
}

.rd-btn-icon {
  width: 36px;
  padding: 0;
  justify-content: center;
  color: var(--ink2);
}

.rd-btn-danger-hover:hover {
  color: var(--red);
}

.rd-btn-ghost {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.rd-btn-ghost:hover {
  background: var(--soft);
  color: var(--ink);
}

/* 40x24 switch with a 20px white knob, per the guidance. */
.rd-switch {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  border: none;
  padding: 2px;
  background: var(--switch-off);
  display: flex;
  justify-content: flex-start;
  cursor: pointer;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

.rd-switch > span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  display: block;
  transition: transform 0.15s;
}

.rd-switch.on {
  background: var(--green);
}

.rd-switch.on > span {
  transform: translateX(16px);
}

.rd-switch:disabled {
  cursor: default;
  opacity: 0.6;
}

.rd-switch-sm {
  width: 34px;
  height: 20px;
}

.rd-switch-sm > span {
  width: 16px;
  height: 16px;
}

.rd-switch-sm.on > span {
  transform: translateX(14px);
}

.rd-select {
  width: 100%;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
}

.rd-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

/* --- People list ------------------------------------------------------------ */
.pl-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pl-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pl-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.pl-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  container: plmain / inline-size;
}

.pl-filter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}

.pl-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.pl-search {
  flex: 1 1 260px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg);
  border-radius: 9px;
  color: var(--muted);
  margin: 0;
}

.pl-search:focus-within {
  box-shadow: 0 0 0 2px var(--green);
}

.pl-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--ink);
}

.pl-segmented {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 9px;
  padding: 3px;
  flex-wrap: wrap;
}

.pl-seg {
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.pl-seg:hover {
  color: var(--ink);
}

.pl-seg.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 20, 0.12);
}

.pl-seg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.pl-filter-btn {
  height: 38px;
  padding: 0 12px;
  border: 1px dashed var(--line3);
  border-radius: 9px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pl-filter-btn:hover {
  border-color: var(--green);
  color: var(--green-ink);
}

.pl-sort {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 10px;
  border-radius: 9px;
  color: var(--ink2);
  margin: 0;
}

.pl-sort:hover {
  background: var(--bg);
}

.pl-sort select {
  border: none;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 18px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23898f8b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  outline: none;
}

.pl-filter-more {
  flex-basis: 100%;
}

.pl-filter-more.show,
.pl-filter-more.collapsing {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 12px;
  padding: 10px 2px 2px;
  border-top: 1px solid var(--line2);
  margin-top: 4px;
}

.pl-filter-more .person-field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.pl-chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pl-result-count {
  font-size: 13px;
  color: var(--muted);
  margin-right: 4px;
}

.pl-chips-spacer {
  flex: 1;
}

.pl-chip {
  height: 30px;
  padding: 0 10px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.pl-chip:hover {
  border-color: var(--line3);
  color: var(--ink);
}

.pl-chip-active {
  border-color: var(--green);
  background: var(--green-tint);
}

.pl-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.pl-chip-count {
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.pl-list {
  --pl-cols: 32px minmax(0, 2fr) minmax(0, 1fr) 110px 210px 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.pl-list-no-assessment {
  --pl-cols: 32px minmax(0, 2fr) minmax(0, 1fr) 64px;
}

.pl-list-head,
.pl-row {
  display: grid;
  grid-template-columns: var(--pl-cols);
  gap: 16px;
  align-items: center;
}

.pl-list-head {
  padding: 10px 18px;
  background: var(--soft2);
  border-bottom: 1px solid var(--line2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.pl-row {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line2);
  cursor: pointer;
  transition: background-color 0.12s;
}

.pl-row:hover {
  background: var(--soft2);
}

.pl-row:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.pl-row.selected {
  background: var(--sel);
  box-shadow: inset 3px 0 0 var(--green);
}

.pl-row.is-deceased {
  opacity: 0.55;
}

.pl-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--soft);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--party, var(--line3));
  flex-shrink: 0;
}

.pl-person {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-name-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.pl-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-name:hover {
  color: var(--green-ink);
  text-decoration: underline;
}

.pl-nick {
  font-weight: 500;
  color: var(--bs-link-color);
}

.pl-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  background: var(--soft);
  padding: 1px 6px;
  border-radius: 999px;
}

.pl-secondary,
.pl-street {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-street {
  font-size: 13px;
  color: var(--ink2);
}

.pl-party {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.pl-party-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pl-conf {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pl-conf-dots {
  display: flex;
  gap: 4px;
}

.pl-conf-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--c);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s, background-color 0.12s;
  flex-shrink: 0;
}

.pl-conf-dot.on {
  background: var(--c);
}

.pl-conf-dot:not(:disabled):hover {
  transform: scale(1.15);
}

.pl-conf-dot:disabled {
  cursor: default;
}

.pl-conf-label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-voted {
  display: flex;
  justify-content: flex-end;
}

.pl-empty {
  padding: 48px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  font-size: 14px;
}

.pl-empty a {
  font-size: 13px;
  font-weight: 600;
}

.pl-list-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--muted);
  background: var(--soft2);
}

.pl-pager {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.pl-pager-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.pl-pager-btn.disabled {
  color: var(--muted);
  font-weight: 400;
  pointer-events: none;
}

.pl-pager-num {
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.pl-pager-num:hover {
  background: var(--soft);
  color: var(--ink);
}

.pl-pager-num.active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.pl-pager-gap {
  padding: 0 4px;
}

/* Narrower list (panel open beside it, or a smaller screen): street goes
   first, then the party column; phones keep avatar, name, dots, switch. */
@container plmain (max-width: 820px) {
  .pl-list { --pl-cols: 32px minmax(0, 1fr) 110px 190px 52px; }
  .pl-list-no-assessment { --pl-cols: 32px minmax(0, 1fr) 52px; }
  .pl-list-head > :nth-child(3),
  .pl-street { display: none; }
}

@container plmain (max-width: 600px) {
  .pl-list { --pl-cols: 32px minmax(0, 1fr) 100px 44px; }
  .pl-list-head { display: none; }
  .pl-party,
  .pl-conf-label { display: none; }
  .pl-row { gap: 12px; padding: 12px 14px; }
  .pl-seg-wide-only { display: none; }
}

/* --- Person side panel ---------------------------------------------------------- */
.pl-panel {
  width: 380px;
  flex-shrink: 0;
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.pl-panel[hidden] {
  display: none;
}

.pl-panel-body {
  overflow-y: auto;
  flex: 1;
}

.pl-panel-hint {
  padding: 40px 20px;
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.pp-head {
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid var(--line2);
}

.pp-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pl-avatar.pp-avatar {
  width: 52px;
  height: 52px;
  font-size: 17px;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--party, var(--line3));
}

.pp-head-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pp-nav {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 32px;
  margin-right: 4px;
}

.pp-nav-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  cursor: pointer;
}

.pp-nav-btn:not(:disabled):hover {
  background: var(--soft);
}

.pp-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.pp-nav-label {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
  white-space: nowrap;
}

.pp-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pp-title h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pp-nick {
  font-weight: 500;
  color: var(--bs-link-color);
  font-size: 16px;
}

.pp-place {
  font-size: 13px;
  color: var(--muted);
}

.pp-full-link {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
  text-decoration: none;
}

.pp-voted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft2);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
}

.pp-voted.on {
  background: var(--green-tint);
  color: var(--green-ink);
}

.pp-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pp-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pp-section-head a {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.pp-conf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pp-opt,
.pp-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}

.pp-opt {
  height: 36px;
  border-radius: 9px;
}

.pp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pp-chip {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
}

.pp-opt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

.pp-opt:not(:disabled):hover,
.pp-chip:not(:disabled):hover {
  border-color: var(--line3);
}

.pp-opt.on,
.pp-chip.on {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
}

.pp-opt:disabled,
.pp-chip:disabled {
  cursor: default;
  opacity: 0.7;
}

.pp-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--soft2);
}

.pp-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pp-fact span {
  font-size: 11px;
  color: var(--muted);
}

.pp-fact strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-inline-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink2);
}

.pp-muted {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.pp-rel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.pp-rel:hover {
  border-color: var(--line3);
  color: var(--ink);
}

.pp-rel-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pp-rel-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.pp-sugg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--soft2);
  border: 1px dashed var(--line3);
}

.pp-sugg-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
}

.pp-sugg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pp-sugg-row form {
  margin: 0;
}

.pp-sugg-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pp-sugg-text .pp-muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-sugg-name {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pp-sugg-add {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--green);
  background: var(--surface);
  color: var(--green-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.pp-sugg-add:hover {
  background: var(--green);
  color: #fff;
}

.pp-task {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.pp-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--ink2);
}

.pp-history-row {
  display: flex;
  gap: 8px;
}

.pp-history-row .pp-muted {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pl-panel-back {
  display: none;
}

/* Phones: the panel becomes a full-screen overlay opened by a row tap. */
@media (max-width: 979.98px) {
  .pl-panel-back {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line2);
  }

  .pl-panel-back button {
    height: 44px;
    padding: 0 12px 0 6px;
    border: none;
    background: transparent;
    color: var(--bs-link-color);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px;
  }

  .pl-panel-back button:hover {
    background: var(--green-tint);
  }

  .pl-panel-back svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .pl-panel {
    position: fixed;
    inset: 0;
    width: auto;
    max-height: none;
    top: 0;
    border: 0;
    border-radius: 0;
    z-index: 1050;
  }

  body.pl-panel-overlay-open {
    overflow: hidden;
  }

  .pl-page-head .rd-page-title {
    font-size: 26px;
  }
}

/* ===========================================================================
   Phase 3 — the person page (people/show.ejs, partials/tree_node.ejs,
   partials/relationship_suggestions.ejs, public/js/person-page.js).
   =========================================================================== */
.ps-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.ps-crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.ps-crumbs a {
  font-weight: 600;
  text-decoration: none;
}

.ps-crumb-current {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ps-nav-btn {
  height: 36px;
  max-width: 220px;
  padding: 0 12px 0 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.ps-nav-btn[data-nav="next"],
.ps-nav-btn:last-child {
  padding: 0 8px 0 12px;
}

.ps-nav-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-nav-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a.ps-nav-btn:hover {
  background: var(--soft2);
  border-color: var(--line3);
  color: var(--ink);
}

.ps-nav-btn.disabled {
  opacity: 0.4;
  cursor: default;
}

.ps-nav-label {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
}

.ps-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 20px;
}

.ps-header-body {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.ps-header .tricolor-band {
  height: 3px;
}

.pl-avatar.ps-avatar {
  width: 64px;
  height: 64px;
  font-size: 21px;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--party, var(--line3));
}

.ps-header-main {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ps-name {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.ps-nick {
  font-weight: 500;
  color: var(--bs-link-color);
  font-size: 20px;
}

.ps-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.ps-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--soft);
  color: var(--ink2);
}

.ps-chip[hidden] {
  display: none;
}

.ps-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
}

.ps-chip-tinted {
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  color: var(--ink);
}

.ps-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ps-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ps-btn svg {
  width: 16px;
  height: 16px;
}

.rd-btn.rd-btn-icon.ps-btn {
  width: 38px;
  padding: 0;
  justify-content: center;
  color: var(--muted);
}

.ps-btn-delete:hover {
  color: var(--red) !important;
  border-color: var(--red);
}

.ps-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.ps-col-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.ps-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ps-card-flush {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.ps-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ps-card-head-pad {
  padding: 16px 20px;
}

.ps-card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ps-card-head a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ps-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ps-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
}

.ps-conf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.pp-opt.ps-opt {
  height: 40px;
  border-radius: 10px;
}

.ps-assessment .pp-chip {
  height: 32px;
  padding: 0 12px;
}

.ps-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.ps-voted {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--soft2);
}

.ps-voted.on {
  background: var(--green-tint);
}

.ps-voted-text {
  display: flex;
  flex-direction: column;
}

.ps-voted-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
}

.ps-voted.on .ps-voted-text strong {
  color: var(--green-ink);
}

.rd-switch.ps-switch {
  width: 44px;
  height: 26px;
  padding: 3px;
}

.rd-switch.ps-switch.on > span {
  transform: translateX(18px);
}

.ps-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px 20px;
}

.ps-fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ps-fact span {
  font-size: 12px;
  color: var(--muted);
}

.ps-fact strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ps-empty {
  margin: 0;
  padding: 4px 20px 18px;
  font-size: 13px;
  color: var(--muted);
}

.ps-task {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line2);
}

.ps-task-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line3);
  color: #fff;
}

.ps-task-box.done {
  border-color: var(--green);
  background: var(--green);
}

.ps-task-box svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ps-task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ps-task-text {
  font-size: 14px;
  line-height: 1.45;
}

.ps-task-text.done {
  color: var(--muted);
}

.ps-task-feedback {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink2);
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--soft2);
  margin-top: 2px;
}

.ps-link-danger {
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--red-ink);
}

.ps-status {
  font-size: 11px;
  font-weight: 600;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  align-self: flex-start;
}

.ps-status-open { background: var(--gold-tint); color: var(--gold-ink); }
.ps-status-stale { background: var(--red-tint); color: var(--red-ink); }
.ps-status-done { background: var(--green-tint); color: var(--green-ink); }

.ps-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 18px;
}

.ps-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.ps-timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 0;
  font-size: 13px;
}

.ps-timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--blue);
}

/* --- Family tree (HTML, replaces the canvas) ----------------------------- */
.ps-tree {
  padding: 4px 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ps-tree-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.ps-tree-self-row {
  gap: 0;
  align-items: center;
}

.ps-tree-v {
  width: 2px;
  height: 18px;
  background: var(--line3);
}

.ps-tree-h {
  width: 18px;
  height: 2px;
  background: var(--line3);
}

.ps-tree-self {
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.ps-tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 12px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.ps-tree-node form {
  margin: 0;
}

.ps-tree-node-link {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  padding-right: 4px;
}

.ps-tree-node-link:hover {
  color: var(--green-ink);
}

.ps-tree-node-name {
  font-size: 13px;
  font-weight: 600;
}

.ps-tree-node-rel {
  font-size: 11px;
  color: var(--muted);
}

.ps-tree-node-remove {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.ps-tree-node-remove:hover {
  background: var(--red-tint);
  color: var(--red);
}

/* --- Relationship suggestions, restyled to the guidance: a soft2 band
   under the tree, white cards, pill strength, outline-green add. -------- */
.ps-family .rel-suggest {
  border-top: 1px solid var(--line2);
  padding: 16px 20px 20px;
  background: var(--soft2);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.ps-family .rel-suggest-head {
  margin: 0;
}

.ps-family .rel-suggest-title {
  font-size: 14px;
  font-weight: 700;
}

.rel-suggest .rel-tier {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
}

.rel-tier-strong { --rel-color: var(--green-ink); }
.rel-tier-medium { --rel-color: var(--gold-ink); }
.rel-tier-weak { --rel-color: var(--muted); }

.ps-family .rel-suggest-search {
  margin: 0;
}

.ps-family .rel-suggest-search .form-control {
  height: 40px;
  border-radius: 10px;
  border-color: var(--line);
  font-size: 13px;
}

.ps-family .rel-search-results {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
}

.ps-family .rel-search-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  flex-wrap: wrap;
}

.ps-family .rel-suggest-section + .rel-suggest-section {
  margin-top: 0;
}

.ps-family .rel-suggest-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ps-family .rel-suggest-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.ps-family .rel-sug,
.ps-family .rel-sug-strong,
.ps-family .rel-sug-medium,
.ps-family .rel-sug-weak {
  border: 1px solid var(--line);
  border-left: 3px solid var(--rel-color);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  margin: 0;
  flex-wrap: wrap;
}

.ps-family .rel-sug-strong { --rel-color: var(--green); }
.ps-family .rel-sug-medium { --rel-color: var(--gold); }
.ps-family .rel-sug-weak { --rel-color: var(--line3); }

.ps-family .rel-sug-name a {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.ps-family .rel-sug-name a:hover {
  color: var(--green-ink);
}

.ps-family .rel-reason {
  border: 0;
  background: var(--soft);
  color: var(--ink2);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
}

.rel-add-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--green);
  background: var(--surface);
  color: var(--green-ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}

.rel-search-actions .rel-add-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
}

.rel-add-btn:hover:not(:disabled) {
  background: var(--green);
  color: #fff;
}

.rel-add-btn:disabled {
  opacity: 0.5;
}

/* Phones: one column, and the family card moves up right after
   Procjena so the suggestions are never buried (CSS order). */
@media (max-width: 979.98px) {
  .ps-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .ps-col-left {
    display: contents;
  }

  .ps-assessment { order: 1; }
  .ps-family { order: 2; }
  .ps-later { order: 3; }

  .ps-nav-btn {
    max-width: 130px;
  }

  .ps-name {
    font-size: 24px;
  }

  .ps-header-body {
    padding: 18px;
  }
}

/* ===========================================================================
   Phase 4 — the dashboard (views/dashboard.ejs, lib/weeklyProgress.js).
   The hero is a fixed brand-green surface in both themes.
   =========================================================================== */
.db-hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: #0d5c29;
  color: #fff;
  margin-bottom: 24px;
}

.db-hero-emblem {
  position: absolute;
  right: -40px;
  top: -30px;
  height: 300px;
  opacity: 0.07;
  pointer-events: none;
}

.db-hero-grid {
  position: relative;
  padding: 30px 32px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 28px;
  align-items: end;
}

.db-hero-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.db-hero-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.db-hero-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
}

.db-hero-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
  max-width: 440px;
}

.db-hero-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.db-hero-figure {
  font-size: 56px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.db-hero-total-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
}

.db-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.db-tile {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.db-tile-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.db-tile-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.db-tile-meter {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  display: block;
}

.db-tile-meter .dash-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.db-tile-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.db-tile-note-alert {
  color: #ffb4b8;
}

.db-hero-band.tricolor-band {
  height: 4px;
}

.db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
  align-items: start;
}

.db-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.db-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.db-card-flush {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.db-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.db-card-head-pad {
  padding: 18px 20px 14px;
}

.db-card-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.db-card-head h2.db-h-sm {
  font-size: 15px;
}

.db-card-head a {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.db-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-count-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  background: var(--soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.db-card-sub {
  margin: -8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.db-task {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line2);
  transition: background-color 0.12s;
}

.db-task:hover {
  background: var(--soft2);
}

.db-task-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.db-tone-green { background: var(--green-tint); color: var(--green-ink); }
.db-tone-gold { background: var(--gold-tint); color: var(--gold-ink); }
.db-tone-red { background: var(--red-tint); color: var(--red-ink); }

.db-task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.db-task-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.db-task-title a {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.db-task-title a:hover {
  color: var(--green-ink);
}

.db-task-title span {
  font-size: 12px;
  color: var(--muted);
}

.db-task-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink2);
}

.db-pill {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
}

.db-complete-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.db-complete-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.db-complete-btn:hover:not(:disabled) {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.db-empty {
  padding: 36px 20px 40px;
  border-top: 1px solid var(--line2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.db-empty strong {
  font-size: 14px;
  color: var(--ink);
}

.db-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.db-empty-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.db-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.db-quick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.db-quick-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.db-quick-card:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  color: var(--ink);
}

.db-quick-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.db-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.db-quick-row svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.db-quick-count {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.db-weekly-head {
  align-items: baseline;
  flex-wrap: wrap;
}

.db-weekly-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink2);
}

.db-weekly-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.db-weekly-legend strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.db-sq {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.db-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  height: 120px;
}

.db-week-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.db-week-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  flex: 1;
}

.db-bar {
  flex: 1;
  border-radius: 4px 4px 2px 2px;
  min-height: 2px;
}

.db-bar-a {
  background: #9fd3b0;
}

.db-week-day.is-today .db-bar-a {
  background: #178c40;
}

.db-bar-t {
  background: #1f5ea3;
  opacity: 0.85;
}

[data-bs-theme="dark"] .db-bar-a {
  background: #2f6b44;
}

[data-bs-theme="dark"] .db-week-day.is-today .db-bar-a {
  background: #3aab5f;
}

.db-week-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
}

.db-week-day.is-today .db-week-label {
  color: var(--ink);
}

.db-coverage {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: -4px;
}

.db-coverage-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  column-gap: 12px;
  row-gap: 6px;
  padding: 8px;
  margin: 0 -8px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.db-coverage-row:hover {
  background: var(--soft2);
  color: var(--ink);
}

.db-coverage-name {
  font-size: 13px;
  font-weight: 500;
}

.db-coverage-pct {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.db-ink-green { color: var(--green-ink); }
.db-ink-gold { color: var(--gold-ink); }
.db-ink-red { color: var(--red-ink); }

.db-meter {
  grid-column: 1 / span 2;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  display: block;
}

.db-meter .dash-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.db-fill-green { background: var(--green); }
.db-fill-gold { background: var(--gold); }
.db-fill-red { background: var(--red); }

.db-stacked {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
  background: var(--track);
}

.db-stacked .dash-stacked-segment {
  display: block;
  height: 100%;
}

.db-legend {
  display: flex;
  flex-direction: column;
}

.db-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line2);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.db-legend-row:hover {
  color: var(--green-ink);
}

.db-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.db-legend-label {
  flex: 1;
}

.db-legend-pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 52px;
  text-align: right;
}

.db-legend-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  width: 60px;
  text-align: right;
}

.db-timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 18px;
}

.db-timeline::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}

.db-timeline-item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}

.db-timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--blue);
}

.db-timeline-item.is-done::before {
  border-color: var(--green);
}

.db-timeline-text {
  flex: 1;
  color: var(--ink2);
}

.db-timeline-text a {
  font-weight: 600;
  text-decoration: none;
}

.db-timeline-when {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 979.98px) {
  .db-hero-grid {
    padding: 24px 20px 22px;
  }

  .db-hero-title {
    font-size: 28px;
  }

  .db-hero-figure {
    font-size: 44px;
  }

  .db-task {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .db-task-body {
    flex-basis: calc(100% - 52px);
  }

  .db-task .db-pill {
    margin-left: 52px;
  }

  .db-task form {
    margin-left: auto !important;
  }
}

/* ===========================================================================
   Phase 5 — shared form pieces, the person form, Moji zadaci, Podrška.
   =========================================================================== */
.rd-narrow {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rd-narrow-920 { max-width: 920px; }
.rd-narrow-880 { max-width: 880px; }
.rd-narrow-760 { max-width: 760px; }
.rd-narrow-640 { max-width: 640px; }

.rd-narrow > .pl-page-head {
  margin-bottom: 0;
}

.rd-back {
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  align-self: flex-start;
}

.rd-btn-md {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rd-btn-lg {
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rd-btn-md svg,
.rd-btn-lg svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rd-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.rd-alert-error { background: var(--red-tint); color: var(--red-ink); }
.rd-alert-warn { background: var(--gold-tint); color: var(--gold-ink); }

.rd-alert.d-none {
  display: none;
}

/* Underline tabs (tasks, feedback; admin later). */
.rd-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.rd-tab {
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.rd-tab:hover {
  color: var(--ink);
}

.rd-tab.active {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--green);
}

.rd-tab-count {
  font-size: 12px;
  font-weight: 600;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rd-tab.active .rd-tab-count {
  background: var(--green-tint);
  color: var(--green-ink);
}

/* Fields. */
.rd-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rd-form-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rd-form-title h1,
.rd-form-h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.rd-form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rd-form-card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rd-form-card-hint {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.rd-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.rd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.rd-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
}

.rd-req {
  color: var(--red);
  font-weight: 700;
}

.rd-input,
.rd-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.rd-input {
  height: 46px;
  padding: 0 14px;
}

.rd-textarea {
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

.rd-textarea-soft {
  background: var(--soft2);
  font-size: 14px;
}

.rd-input:focus,
.rd-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
  background: var(--surface);
}

.rd-tabular {
  font-variant-numeric: tabular-nums;
}

.rd-select-chevron {
  padding-right: 36px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23898f8b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* Segmented control of real radios: <div class="rd-seg"><label><input
   type="radio"><span>…</span></label>…</div>. */
.rd-seg {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  min-height: 46px;
}

.rd-seg-wrap {
  flex-wrap: wrap;
}

.rd-seg label {
  flex: 1 1 0;
  margin: 0;
  position: relative;
  display: flex;
}

.rd-seg-wrap label {
  flex: 1 1 120px;
}

.rd-seg input,
.rd-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.rd-seg span {
  flex: 1;
  min-height: 38px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  padding: 0 10px;
  text-align: center;
}

.rd-seg span:hover {
  color: var(--ink);
}

.rd-seg input:checked + span {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 20, 0.14);
}

.rd-seg input:focus-visible + span,
.rd-choice input:focus-visible + span {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

/* Chips / buttons of real radios: <label class="rd-choice" style="--c">
   <input type="radio"><span><i></i>…</span></label>. */
.rd-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rd-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.rd-choice {
  margin: 0;
  position: relative;
  display: flex;
}

.rd-choice span {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}

.rd-choice-block,
.rd-choice-block span {
  width: 100%;
}

.rd-choice-block span {
  height: 42px;
  border-radius: 10px;
  justify-content: center;
}

.rd-choice i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
}

.rd-choice span:hover {
  border-color: var(--line3);
}

.rd-choice input:checked + span {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, var(--surface));
}

/* Switch row around a real checkbox. */
.rd-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  height: 46px;
  border-radius: 10px;
  background: var(--soft2);
  border: 1px solid var(--line);
  align-self: end;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  cursor: pointer;
  position: relative;
}

.rd-switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rd-switch-ui {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  padding: 2px;
  background: var(--switch-off);
  display: flex;
  transition: background-color 0.15s;
  flex-shrink: 0;
}

.rd-switch-ui > span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.rd-switch-input:checked + .rd-switch-ui {
  background: var(--green);
}

.rd-switch-input:checked + .rd-switch-ui > span {
  transform: translateX(16px);
}

.rd-switch-input:focus-visible + .rd-switch-ui {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* Sticky action bar at the bottom of long forms. */
.rd-form-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 0 -12px;
  padding: 12px;
  background: var(--header);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.rd-form-bar > .pp-muted {
  flex: 1;
}

.rd-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 979.98px) {
  .rd-form-bar {
    bottom: 76px;
  }

  .rd-form-bar > .pp-muted {
    display: none;
  }
}

/* --- Moji zadaci -------------------------------------------------------- */
.tk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  gap: 14px;
}

.tk-card-queued {
  border-color: var(--gold);
}

.tk-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}

.tk-avatar svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tk-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tk-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-title a {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.tk-title a:hover {
  color: var(--green-ink);
}

.tk-age {
  margin-left: auto;
}

.tk-content {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.tk-content-done {
  color: var(--ink2);
}

.tk-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.tk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tk-quote {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft2);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
}

.tk-quote span {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.tk-done-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.rd-empty-dashed {
  padding: 48px 20px;
  border: 1px dashed var(--line3);
  border-radius: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* --- Podrška -------------------------------------------------------------- */
.fb-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.fb-empty {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.fb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line2);
  color: var(--ink);
  text-decoration: none;
}

.fb-row:last-child {
  border-bottom: 0;
}

.fb-row:hover {
  background: var(--soft2);
  color: var(--ink);
}

.fb-type,
.fb-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.fb-type-issue { background: var(--red-tint); color: var(--red-ink); }
.fb-type-suggestion { background: var(--blue-tint); color: var(--blue-ink); }
.fb-status { background: var(--gold-tint); color: var(--gold-ink); }
.fb-status.is-resolved { background: var(--green-tint); color: var(--green-ink); }

.fb-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fb-row-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-reply-state {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.fb-reply-state.is-replied {
  color: var(--green-ink);
}

.fb-chevron {
  color: var(--muted);
  display: flex;
}

.fb-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fb-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fb-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.fb-pills {
  display: flex;
  gap: 6px;
}

.fb-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fb-card-reply {
  background: var(--green-tint);
  border-color: transparent;
}

.fb-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fb-avatar-admin {
  background: var(--green-dark);
  color: #fff;
}

.fb-author-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.fb-reply-meta {
  font-size: 12px;
  color: var(--ink2);
}

.fb-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.fb-section-title {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.fb-reply-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.fb-reply-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 575.98px) {
  .fb-reply-state {
    display: none;
  }

  .tk-card {
    padding: 16px;
  }
}

/* ===========================================================================
   Phase 6 — Analitika (views/analytics/index.ejs).
   =========================================================================== */
.an-scope {
  display: flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  flex-wrap: wrap;
}

.an-scope a {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
}

.an-scope a:hover {
  background: var(--soft);
  color: var(--ink);
}

.an-scope a.active {
  background: var(--green);
  color: #fff;
}

.an-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.an-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.an-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.an-kpi-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.an-kpi-meter {
  height: 4px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  display: block;
}

.an-kpi-meter .dash-meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.an-kpi-note {
  font-size: 12px;
  color: var(--muted);
}

.an-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.an-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.an-col + .an-col {
  gap: 16px;
}

.an-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.an-card-pad {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.an-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px 14px;
}

.an-card-head-base {
  align-items: baseline;
}

.an-card-head h2,
.an-h {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.an-h {
  font-size: 15px;
}

.an-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.an-seg {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 9px;
  padding: 3px;
  align-items: center;
}

.an-seg a {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.an-seg a.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 20, 0.12);
}

.an-seg-label {
  font-size: 11px;
  color: var(--muted);
  padding: 0 6px;
}

.an-empty {
  margin: 0;
  padding: 20px;
  font-size: 13px;
  color: var(--muted);
}

.an-party-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--line2);
  color: var(--ink);
  text-decoration: none;
}

.an-party-row:hover {
  background: var(--soft2);
  color: var(--ink);
}

.an-party-name {
  flex: 0 0 150px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
}

.an-party-total {
  flex: 0 0 64px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.an-stacked {
  flex: 1 1 220px;
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  gap: 2px;
  background: var(--track);
}

.an-stacked .dash-stacked-segment {
  display: block;
  height: 100%;
}

.an-party-certain {
  flex: 0 0 52px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.an-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 20px;
  border-top: 1px solid var(--line2);
  background: var(--soft2);
  font-size: 12px;
  color: var(--ink2);
}

.an-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.an-legend-note {
  margin-left: auto;
  color: var(--muted);
}

.an-table {
  --an-cols: minmax(0, 1.4fr) minmax(0, 1fr) 72px minmax(110px, 1fr) minmax(110px, 1fr) minmax(0, 0.9fr);
}

.an-table-no-col2 {
  --an-cols: minmax(0, 1.6fr) 72px minmax(110px, 1fr) minmax(110px, 1fr) minmax(0, 0.9fr);
}

.an-tr {
  display: grid;
  grid-template-columns: var(--an-cols);
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line2);
}

.an-tr:last-child {
  border-bottom: 0;
}

.an-tr:not(.an-th):hover {
  background: var(--soft2);
}

.an-th {
  padding: 10px 20px;
  background: var(--soft2);
  border-top: 1px solid var(--line2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.an-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.an-col2 {
  font-size: 13px;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-total {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.an-meter-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-meter.an-meter {
  flex: 1;
  grid-column: auto;
}

.an-pct {
  width: 38px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.an-pct-muted {
  font-weight: 400;
  color: var(--muted);
}

.an-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.an-card-attention {
  background: var(--red-tint);
  border-color: transparent;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.an-attention-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-attention-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.an-attention-empty {
  margin: 0;
  font-size: 13px;
  color: var(--ink2);
}

.an-attention-list {
  display: flex;
  flex-direction: column;
}

.an-attention-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  border-top: 1px solid rgba(194, 38, 48, 0.14);
  color: var(--ink);
  text-decoration: none;
}

.an-attention-row:hover {
  color: var(--red-ink);
}

.an-attention-row > span:first-child {
  display: flex;
  flex-direction: column;
}

.an-attention-row > span:first-child span {
  font-size: 11px;
  color: var(--ink2);
}

.an-attention-pct {
  font-weight: 700;
  color: var(--red-ink);
  font-variant-numeric: tabular-nums;
}

.an-attention-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--red-ink);
  text-decoration: none;
}

.an-card-progress {
  background: var(--green-tint);
  border-color: transparent;
}

.an-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.an-progress > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--ink2);
}

.an-progress-num {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--green-ink);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1199.98px) {
  .an-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767.98px) {
  .an-table,
  .an-table-no-col2 {
    --an-cols: minmax(0, 1fr) minmax(110px, 1fr) minmax(0, 0.7fr);
  }

  .an-th,
  .an-col2,
  .an-total,
  .an-turnout {
    display: none;
  }

  .an-legend-note {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* ===========================================================================
   Phase 7 — Administracija: the shared header (partials/admin_masthead),
   card grids, users/roles, secret card, audit log, election day, import,
   modals, plus a restyle of the legacy pieces the remaining admin
   sub-pages still use (md-btn, admin tables, alerts, badges, md-field).
   =========================================================================== */
.am-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.am-head .pl-page-head {
  margin-bottom: 0;
}

.am-tabs {
  margin-top: 4px;
}

.am-on {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}

.rd-narrow-480 { max-width: 480px; }

/* Card grids (Mjesne zajednice, Stranke). */
.tl-grid {
  display: grid;
  gap: 16px;
}

.tl-grid-360 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
.tl-grid-280 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }

.tl-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tl-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
}

.tl-h {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.tl-card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tl-card-title a {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.tl-card-title a:hover {
  color: var(--green-ink);
}

.tl-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.tl-card-actions form {
  margin: 0;
}

.rd-btn.tl-icon-sm {
  width: 32px;
}

.tl-card-rows {
  display: flex;
  flex-direction: column;
}

.tl-card-empty {
  margin: 0;
  padding: 4px 18px 14px;
  font-size: 13px;
  color: var(--muted);
}

.tl-station,
.tl-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--line2);
  color: var(--ink);
  text-decoration: none;
}

.tl-user-row:hover {
  background: var(--soft2);
  color: var(--ink);
}

.tl-code {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tl-station-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.tl-station-text .pp-muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tl-station-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
}

.tl-card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line2);
  background: var(--soft2);
}

.db-meter.tl-meter {
  flex: 1;
  grid-column: auto;
}

.tl-cov {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tl-party {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.tl-party-tile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tl-party-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tl-party-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tl-party-name:hover {
  color: var(--green-ink);
}

/* Secret (generated password) card. */
.tl-secret {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tl-secret-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line2);
}

.tl-secret-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--gold-tint);
  border: 1px dashed var(--gold);
}

.tl-secret-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  word-break: break-all;
}

/* Audit log. */
.tl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tl-log-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line2);
}

.tl-log-row:last-child {
  border-bottom: 0;
}

.tl-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 92px;
  text-align: center;
}

.tl-tone-green { background: var(--green-tint); color: var(--green-ink); }
.tl-tone-blue { background: var(--blue-tint); color: var(--blue-ink); }
.tl-tone-red { background: var(--red-tint); color: var(--red-ink); }
.tl-tone-gold { background: var(--gold-tint); color: var(--gold-ink); }
.tl-tone-soft { background: var(--soft); color: var(--ink2); }

.tl-log-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tl-log-summary {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tl-log-when {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Election day. */
.ed-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.ed-status {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.ed-status.is-on {
  border-color: var(--red);
}

.ed-status.is-on::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--red);
}

.ed-pill {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink2);
}

.ed-pill.is-on {
  background: var(--red);
  color: #fff;
}

.ed-intro {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.ed-besides {
  font-size: 13px;
  color: var(--ink2);
}

.ed-besides ul {
  margin: 6px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.5;
}

.ed-toggle {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.ed-toggle:hover {
  filter: brightness(0.95);
}

.ed-toggle.is-on {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line3);
}

.ed-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ed-turnout {
  padding: 18px 20px;
  gap: 8px;
}

.ed-turnout-figure {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ed-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  display: block;
}

.ed-meter .dash-meter-fill {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}

/* Import. */
.import-steps {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  margin: 0 0 4px;
  flex-wrap: wrap;
}

.import-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.import-step:not(:last-child)::after {
  content: '';
  width: 40px;
  height: 2px;
  background: var(--line);
  margin: 0 10px;
  position: static;
}

.import-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.import-step.active {
  color: var(--ink);
}

.import-step.active .import-step-num {
  border-color: var(--green);
  color: var(--green-ink);
  background: var(--surface);
}

.import-step.done .import-step-num {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.import-step.done:not(:last-child)::after {
  background: var(--green);
}

.im-step1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin: 0;
}

.im-drop {
  position: relative;
  min-height: 240px;
  border: 2px dashed var(--line3);
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  margin: 0;
}

.im-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.im-drop svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.im-drop.is-over,
.im-drop:hover {
  border-color: var(--green);
}

.im-drop.has-file {
  border-color: var(--green);
  background: var(--green-tint);
  color: var(--green-ink);
}

.im-drop-text {
  font-size: 14px;
  font-weight: 600;
}

.im-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.im-side p,
.im-side ul {
  margin: 0;
}

.im-side ul {
  padding-left: 18px;
  color: var(--ink2);
  font-size: 13px;
}

.im-result {
  align-items: center;
  gap: 18px;
  padding: 28px 24px;
  text-align: center;
}

.im-figures {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.im-figures > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  background: var(--soft2);
}

.im-figures span {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.im-figures small {
  font-size: 12px;
  color: var(--muted);
}

.im-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Modals: the shared edit modal (480px) and the confirm modal (440px). */
.modal-dialog.rd-modal {
  max-width: 480px;
}

#confirmModal .modal-dialog {
  max-width: 440px;
}

.modal-header {
  border-bottom: 1px solid var(--line2);
  padding: 16px 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 18px 20px;
}

.modal-footer {
  border-top: 1px solid var(--line2);
  padding: 12px 20px;
  gap: 8px;
}

.modal-footer > * {
  margin: 0;
}

.modal-footer .btn {
  height: 40px;
  padding: 0 16px;
}

#confirmModal .modal-body {
  font-size: 14px;
  line-height: 1.55;
}

.modal-backdrop.show {
  opacity: 1;
  background: rgba(16, 24, 20, 0.38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* --- Legacy pieces on the remaining sub-pages ---------------------------- */
.md-btn.btn-outline-secondary,
.btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--soft2);
  --bs-btn-hover-border-color: var(--line3);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--soft);
  --bs-btn-active-border-color: var(--line3);
}

.btn-outline-danger {
  --bs-btn-color: var(--red-ink);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--red);
  --bs-btn-hover-border-color: var(--red);
}

.md-btn {
  border-radius: 9px;
  font-weight: 600;
}

.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-menu);
  padding: 6px;
  background: var(--surface);
  font-size: 13px;
}

.dropdown-item {
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--ink);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--soft);
}

.dropdown-divider {
  border-color: var(--line2);
}

.admin-table-card,
.md-surface.table-responsive {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.admin-table-card .table,
.md-surface .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--soft2);
  margin: 0;
}

.admin-table-card thead th,
.md-surface thead th {
  background: var(--soft2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line2);
  padding: 10px 18px;
}

.admin-table-card tbody td,
.md-surface tbody td {
  padding: 12px 18px;
  border-color: var(--line2);
  font-size: 14px;
}

.role-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.role-badge-admin, .admin-row-avatar-admin { background: var(--green-tint); color: var(--green-ink); }
.role-badge-activist, .admin-row-avatar-activist { background: var(--blue-tint); color: var(--blue-ink); }
.role-badge-street, .admin-row-avatar-street { background: var(--gold-tint); color: var(--gold-ink); }
.role-badge-viewer, .admin-row-avatar-viewer { background: var(--soft); color: var(--ink2); }

.admin-row-avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.bm-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--red);
  color: var(--red-ink);
  background: transparent;
}

.alert {
  border: 0;
  border-radius: 12px;
  font-size: 13px;
  padding: 12px 14px;
}

.alert-danger { background: var(--red-tint); color: var(--red-ink); }
.alert-warning { background: var(--gold-tint); color: var(--gold-ink); }
.alert-success { background: var(--green-tint); color: var(--green-ink); }
.alert-info { background: var(--blue-tint); color: var(--blue-ink); }

.badge.text-bg-light {
  background: var(--soft) !important;
  color: var(--ink2) !important;
  border: 0 !important;
  font-weight: 600;
}

.md-surface > .card-header {
  background: transparent;
  border-bottom: 1px solid var(--line2);
  padding: 14px 18px;
}

.md-surface .list-group-item {
  background: transparent;
  border-color: var(--line2);
  padding: 10px 18px;
}

.md-field .form-label,
.modal-body .form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 6px;
}

.md-field .form-control,
.md-field .form-select,
.modal-body .form-control,
.modal-body .form-select {
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  font-size: 15px;
  box-shadow: none;
}

.md-field textarea.form-control,
.modal-body textarea.form-control {
  min-height: 0;
}

.md-field .form-control:focus,
.md-field .form-select:focus,
.modal-body .form-control:focus,
.modal-body .form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.md-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.md-surface .dash-figure {
  color: var(--ink);
  font-size: 26px;
  font-weight: 700;
}

.empty-state {
  border: 1px dashed var(--line3);
  border-radius: 16px;
  background: transparent;
}

@media (max-width: 979.98px) {
  .ed-grid,
  .im-step1 {
    grid-template-columns: minmax(0, 1fr);
  }

  .im-figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tl-log-row {
    flex-wrap: wrap;
  }

  .tl-log-when {
    width: 100%;
    padding-left: 106px;
  }
}

/* ===========================================================================
   Phase 8 — login, password change, error page, Obrisane osobe, the bulk
   edit bar, and the Ctrl+K command palette.
   =========================================================================== */

/* --- Prijava (views/login.ejs) ------------------------------------------- */
body.lg-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse 900px 600px at 50% -10%, var(--green-tint), var(--bg) 70%);
  position: relative;
  overflow-x: hidden;
}

.lg-watermark {
  position: fixed;
  right: -60px;
  bottom: -80px;
  height: 520px;
  opacity: 0.05;
  pointer-events: none;
}

.lg-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: redesign-fade-up 0.25s ease-out;
}

.lg-card .tricolor-band {
  height: 4px;
}

.lg-body {
  padding: 32px 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.lg-marks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.lg-title {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lg-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lg-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-link-color);
}

.lg-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.rd-input.lg-input {
  height: 52px;
}

.lg-password {
  position: relative;
  display: block;
}

.lg-password .rd-input {
  padding-right: 80px;
}

.lg-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--bs-link-color);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
}

.lg-toggle:hover {
  background: var(--green-tint);
}

.btn.lg-submit {
  height: 52px;
  border-radius: 12px;
  font-size: 15px;
  box-shadow: 0 6px 18px rgba(23, 140, 64, 0.32);
}

.lg-conn {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* --- Promjena lozinke ------------------------------------------------------ */
.ac-alert-success {
  background: var(--green-tint);
  color: var(--green-ink);
}

.ac-strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr) auto;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
}

.ac-strength i {
  height: 4px;
  border-radius: 999px;
  background: var(--track);
}

.ac-strength em {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  min-width: 56px;
  text-align: right;
  color: var(--muted);
}

.ac-strength[data-score="1"] i:nth-child(-n+1) { background: var(--red); }
.ac-strength[data-score="2"] i:nth-child(-n+2) { background: var(--gold); }
.ac-strength[data-score="3"] i:nth-child(-n+3),
.ac-strength[data-score="4"] i:nth-child(-n+4) { background: var(--green); }
.ac-strength[data-score="1"] em { color: var(--red-ink); }
.ac-strength[data-score="2"] em { color: var(--gold-ink); }
.ac-strength[data-score="3"] em,
.ac-strength[data-score="4"] em { color: var(--green-ink); }

.btn.ac-submit {
  height: 48px;
}

/* --- Greška ------------------------------------------------------------------ */
.er-wrap {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 24px 0;
}

.er-code {
  font-size: 88px;
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--line3);
  font-variant-numeric: tabular-nums;
}

.er-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.er-message {
  margin: 0;
  max-width: 440px;
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.55;
}

.er-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

/* --- Obrisane osobe ------------------------------------------------------- */
.tr-explainer {
  margin: -8px 0 16px;
  max-width: 720px;
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.55;
}

.tr-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line2);
}

.tr-row:last-child {
  border-bottom: 0;
}

.tr-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tr-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.tr-when {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 12px;
  color: var(--ink2);
  white-space: nowrap;
}

.tr-restore {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--green);
  background: var(--surface);
  color: var(--green-ink);
  font-size: 13px;
  font-weight: 600;
}

.tr-restore:hover {
  background: var(--green);
  color: #fff;
}

/* --- Masovno uređivanje: clickable rows + the dark sticky bar ------------ */
.be-row {
  cursor: pointer;
}

.be-row.is-selected > td {
  background: var(--sel) !important;
}

.be-row.is-selected > td:first-child {
  box-shadow: inset 3px 0 0 var(--green);
}

.bulk-apply-bar.be-bar {
  display: none;
  position: sticky;
  bottom: 16px;
  z-index: 20;
  max-width: 1000px;
  margin: 0 auto;
  background: #16201a;
  color: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  padding: 14px 16px;
}

.bulk-apply-bar.be-bar.is-active {
  display: block;
  animation: redesign-fade-up 0.16s ease-out;
}

.be-bar .person-field-label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.be-bar .form-select {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 9px;
  height: 38px;
  font-size: 13px;
}

.be-bar .form-select option {
  color: #16201a;
}

.be-bar .text-muted {
  color: rgba(255, 255, 255, 0.6) !important;
}

.be-count {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.be-clear {
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.be-clear:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn.be-apply {
  height: 38px;
  padding: 0 18px;
  border-radius: 9px;
  border: 0;
  background: #3aab5f;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.btn.be-apply:hover {
  background: #2f9a52;
  color: #fff;
}

.btn.be-apply:disabled {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 979.98px) {
  .bulk-apply-bar.be-bar {
    bottom: 88px;
  }
}

/* --- Ctrl+K command palette (public/js/command-palette.js) --------------- */
.app-search input[readonly] {
  cursor: text;
}

body.cp-open {
  overflow: hidden;
}

.cp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(16, 24, 20, 0.38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  animation: cp-fade 0.16s ease-out;
}

.cp-overlay[hidden] {
  display: none;
}

@keyframes cp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cp-card {
  width: 100%;
  max-width: 600px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(16, 24, 20, 0.3);
  overflow: hidden;
}

.cp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line2);
}

.cp-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.cp-kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.cp-list {
  overflow-y: auto;
  padding: 6px;
}

.cp-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 4px;
}

.cp-empty {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}

.cp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.cp-item.is-active {
  background: var(--green-tint);
  color: var(--ink);
}

.cp-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--party, var(--line3));
}

.cp-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cp-name {
  font-size: 14px;
  font-weight: 600;
}

.cp-nick {
  font-weight: 500;
  color: var(--bs-link-color);
}

.cp-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-screen {
  justify-content: space-between;
}

.cp-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-ink);
}

.cp-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  white-space: nowrap;
}

.cp-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--line2);
  background: var(--soft2);
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 575.98px) {
  .cp-overlay {
    padding-top: 8vh;
  }

  .tr-row {
    flex-wrap: wrap;
  }

  .tr-when {
    align-items: flex-start;
    order: 3;
    width: 100%;
    padding-left: 50px;
  }
}

/* style.css stretches body > main to fill the viewport (the old sticky
   footer layout); the login card is that <main>, so it must not grow. */
body.lg-page > main.lg-card {
  flex: 0 0 auto;
}

/* ===========================================================================
/* ===========================================================================
   Raspodjela mandata (views/seats/*, public/js/seats.js) — the workspace
   of README §14: the app nav as a 64px icon rail, the seats rail (sr-),
   the header (sh-), dialogs (sd-), paste card (sp-), votes table (sv-),
   candidates (sc-), results column (sx-), overview (so-) and
   compensatory lists (sk-).
   =========================================================================== */
body.has-seat-rail .app-content {
  max-width: none;
  padding: 0;
}

@media (min-width: 980px) {
  body.has-seat-rail .app-topbar {
    display: none;
  }

  body.has-seat-rail .app-sidebar {
    width: 64px;
    overflow-x: hidden;
  }

  body.has-seat-rail .app-brand {
    justify-content: center;
    padding: 18px 0;
  }

  body.has-seat-rail .app-brand img {
    height: 26px;
  }

  body.has-seat-rail .app-brand-text,
  body.has-seat-rail .app-nav-group,
  body.has-seat-rail .app-nav-item > span,
  body.has-seat-rail .app-sync,
  body.has-seat-rail .app-user-text {
    display: none;
  }

  body.has-seat-rail .app-nav {
    padding: 4px 11px;
    gap: 4px;
  }

  body.has-seat-rail .app-nav-item {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }

  body.has-seat-rail .app-sidebar-foot {
    padding: 14px 0;
    align-items: center;
  }

  body.has-seat-rail .app-user {
    flex-direction: column;
    border: none;
    padding: 0;
    gap: 8px;
  }
}

.sw {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sw-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sw-body {
  padding: 24px 28px 48px;
  max-width: 1400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sw-split {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.sw-left {
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sw-right {
  flex: 1 1 340px;
  max-width: 440px;
  min-width: 300px;
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Rail ----------------------------------------------------------------------- */
.sr {
  width: 288px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sr svg,
.sh svg,
.sd-modal svg,
.sp-bar svg,
.sv-card svg,
.sx-card svg,
.sx-comp-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sr-top {
  padding: 20px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--line2);
}

.sr-home {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.sr-home svg {
  width: 14px;
  height: 14px;
}

.sr-home:hover {
  color: var(--ink);
}

.sr-bodies {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}

.sr-body {
  flex: 1;
  height: 32px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sr-body:hover {
  color: var(--ink);
}

.sr-body.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 20, 0.12);
}

.sr-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sr-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.sr-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.sr-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  display: flex;
}

.sr-bar-done {
  background: var(--green);
}

.sr-bar-votes {
  background: var(--gold);
}

.sr-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.sr-item:hover {
  background: var(--soft);
  color: var(--ink);
}

.sr-item.is-active {
  background: var(--sel);
  box-shadow: inset 3px 0 0 var(--green);
}

.sr-item.is-active .sr-item-name {
  font-weight: 700;
}

.sr-ov-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green-tint);
  color: var(--green-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sr-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.25;
}

.sr-overview .sr-text {
  gap: 0;
}

.sr-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sr-pool {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 8px 6px;
}

.sr-pool-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sr-code {
  width: 34px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
}

.sr-comp .sr-code {
  color: var(--blue-ink);
}

.sr-strip {
  height: 4px;
  border-radius: 999px;
  background: var(--track);
  display: flex;
  gap: 1px;
  overflow: hidden;
}

.sr-seats {
  width: 18px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

.sr-status {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sr-status-empty::before,
.sr-status-votes::before,
.sr-status-done-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sr-status-empty::before {
  border: 1.5px solid var(--line3);
}

.sr-status-votes::before {
  background: var(--gold);
}

.sr-status-done-dot::before {
  background: var(--green);
}

.sr-status-done {
  width: 16px;
  height: 16px;
  margin: 1px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
}

.sr-status-done svg {
  width: 10px;
  height: 10px;
  stroke-width: 3.5;
}

.sr-legend {
  padding: 12px 16px;
  border-top: 1px solid var(--line2);
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--muted);
}

.sr-legend span {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sr-legend .sr-status {
  width: 12px;
}

.sr-legend .sr-status::before {
  width: 8px;
  height: 8px;
}

/* Narrow rail: codes and status only. */
@media (max-width: 1179.98px) and (min-width: 980px) {
  .sr {
    width: 76px;
  }

  .sr-top {
    padding: 14px 8px 10px;
    gap: 6px;
  }

  .sr-home span,
  .sr-title,
  .sr-text,
  .sr-seats,
  .sr-meta,
  .sr-legend,
  .sr-pool-name {
    display: none;
  }

  .sr-home {
    align-self: stretch;
    justify-content: center;
    height: 30px;
  }

  .sr-bodies {
    flex-direction: column;
    background: none;
    padding: 0;
  }

  .sr-body {
    height: 30px;
    font-size: 11px;
    flex: none;
  }

  .sr-list {
    padding: 8px 6px 16px;
  }

  .sr-pool {
    padding: 0;
    margin: 10px 6px;
    height: 1px;
    background: var(--line2);
  }

  .sr-item {
    flex-direction: column;
    gap: 4px;
    padding: 7px 4px;
  }

  .sr-overview {
    align-items: center;
  }

  .sr-code {
    width: auto;
    text-align: center;
  }
}

/* Phones: the rail becomes a scrolling strip of codes above the page. */
@media (max-width: 979.98px) {
  .sw {
    flex-direction: column;
    min-height: 0;
  }

  .sr {
    width: auto;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sr-top {
    padding: 12px 16px;
  }

  .sr-list {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 12px;
    gap: 4px;
  }

  .sr-pool,
  .sr-text,
  .sr-seats,
  .sr-legend,
  .sr-comp .sr-meta,
  .sr-overview .sr-text {
    display: none;
  }

  .sr-item {
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    flex-shrink: 0;
  }

  .sr-code {
    width: auto;
  }
}

/* --- Header ------------------------------------------------------------------- */
.sh {
  position: sticky;
  top: 0;
  z-index: 1010;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.sh-titles {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sh-eyebrow {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sh-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.sh-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: pretty;
  min-width: 0;
}

.sh-chip {
  flex-shrink: 0;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft2);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.sh-chip svg {
  width: 12px;
  height: 12px;
}

.sh-chip:hover {
  border-color: var(--line3);
}

.sh-save {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sh-save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.sh-save.is-saving .sh-save-dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-tint);
}

.sh-nav {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.sh-nav-btn {
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.sh-nav-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

.sh-nav-btn.is-disabled {
  color: var(--line3);
}

.sh-nav-sep {
  width: 1px;
  background: var(--line);
}

.sh-btn {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sh-btn:hover {
  border-color: var(--line3);
}

.sh-btn-count {
  color: var(--muted);
  font-weight: 500;
}

.sh-ro {
  background: var(--blue-tint);
  color: var(--blue-ink);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 28px;
}

.sh-intro {
  margin: 0;
  max-width: 720px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink2);
  text-wrap: pretty;
}

@media (max-width: 979.98px) {
  .sh {
    position: static;
    padding: 12px 16px;
  }

  .sh-save-label {
    display: none;
  }

  .sh-ro {
    padding: 9px 16px;
  }

  .sw-body {
    padding: 16px 16px 32px;
  }

  .sw-right {
    position: static;
    max-width: none;
    min-width: 0;
  }
}

/* --- Sva tijela cards -------------------------------------------------------------- */
.sh-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.sh-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.sh-card:hover {
  border-color: var(--line3);
  transform: translateY(-1px);
  color: var(--ink);
}

.sh-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sh-card-names {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sh-card-short {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.sh-card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: pretty;
}

.sh-card-seats {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sh-card-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.sh-card-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.sh-card-dots .is-open,
.sx-dots .is-open {
  background: transparent;
  border: 1.5px dashed var(--line3);
}

.sh-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sh-chip-party {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft2);
  border: 1px solid var(--line2);
  font-size: 12px;
  font-weight: 600;
}

.sh-chip-party i,
.so-legend i,
.so-name i,
.so-col i,
.sx-el-head i,
.sx-q-name i,
.so-el-head i,
.sk-tab i,
.sk-head > i,
.sv-name > i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
}

.sh-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line2);
  font-size: 12px;
  color: var(--muted);
}

.sh-card-bar {
  flex: 0 0 80px;
}

.sh-card-progress {
  flex: 1;
}

@media (max-width: 575.98px) {
  .sh-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- Shared bits --------------------------------------------------------------------- */
.sv-card,
.sx-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.sv-card {
  overflow: hidden;
}

.sx-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sx-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.sx-head h2,
.sx-card h2,
.sv-card h2,
.sp-card h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.sx-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.sx-muted {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.sv-input {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  min-width: 0;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sv-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.sv-input[readonly] {
  background: transparent;
  border-color: transparent;
}

.sv-input-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.sv-input-name,
.sc-name,
.sk-name {
  border-color: transparent;
  background: transparent;
}

.sv-input-name:hover,
.sc-name:hover,
.sk-name:hover {
  border-color: var(--line);
}

.sv-btn {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none;
}

.sv-btn:hover {
  border-color: var(--line3);
  color: var(--ink);
}

.sv-btn-primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.sv-btn-primary:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
  color: #fff;
}

.sv-btn-primary:disabled {
  background: var(--line3);
  border-color: var(--line3);
  cursor: default;
}

.sv-btn-sm {
  height: 32px;
  font-size: 12px;
}

.sv-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sv-icon-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

.sv-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
  background: transparent;
}

.sv-icon-sm {
  width: 26px;
  height: 28px;
  border-radius: 6px;
}

.sv-icon-sm svg {
  width: 14px;
  height: 14px;
}

.sp-text {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft2);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.sp-text:focus {
  outline: none;
  border-color: var(--green);
}

/* --- Paste card ------------------------------------------------------------------------ */
.sp-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px dashed var(--line3);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  width: 100%;
}

.sp-bar:hover {
  border-color: var(--green);
  background: var(--sel);
}

.sp-bar[hidden],
.sp-card[hidden] {
  display: none;
}

.sp-bar-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green-tint);
  color: var(--green-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-bar-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}

.sp-bar-text strong {
  font-size: 14px;
  color: var(--ink);
}

.sp-bar kbd {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-family: inherit;
}

.sp-card {
  background: var(--surface);
  border: 1px solid var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-preview {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.sp-preview[hidden],
.sp-note[hidden] {
  display: none;
}

.sp-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border-top: 1px solid var(--line2);
}

.sp-row-head {
  border-top: none;
  background: var(--soft2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.sp-row.is-skipped {
  opacity: 0.45;
}

.sp-raw {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-votes {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
  font-size: 13px;
}

.sp-votes em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.sp-map {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sp-map i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sp-select {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}

.sp-select.is-new {
  border-color: var(--gold);
}

.sp-note {
  font-size: 13px;
  color: var(--gold-ink);
  background: var(--gold-tint);
  padding: 9px 12px;
  border-radius: 10px;
}

.sp-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.sp-summary {
  flex: 1 1 200px;
  font-size: 12px;
  color: var(--muted);
}

/* --- Votes card ------------------------------------------------------------------------- */
.sv-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line2);
}

.sv-head-text {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}

.sv-valid {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.sv-valid span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  text-align: right;
  line-height: 1.25;
}

.sv-valid .sv-input {
  width: 130px;
  height: 38px;
  font-size: 15px;
}

.sv-strip {
  padding: 9px 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sv-strip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.sv-strip-green {
  background: var(--green-tint);
  color: var(--green-ink);
}

.sv-strip-gold {
  background: var(--gold-tint);
  color: var(--gold-ink);
}

.sv-strip-red {
  background: var(--red-tint);
  color: var(--red-ink);
}

.sv-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 112px 52px 46px 112px 32px;
  gap: 8px;
  align-items: center;
  padding: 7px 20px;
}

.sv-row-head {
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line2);
}

.sv-item {
  border-top: 1px solid var(--line2);
}

.sv-item.is-empty .sv-party {
  color: var(--muted);
}

.sv-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sv-name > i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.sv-party {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sv-pill-indep {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  flex-shrink: 0;
}

.sv-share {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.sv-seats {
  display: flex;
  justify-content: center;
}

.sv-seat-pill {
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.sv-below {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: var(--muted);
}

.sv-cand-btn {
  height: 32px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  white-space: nowrap;
}

.sv-cand-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}

.sv-cand-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.sv-cand-btn:hover:not(:disabled) {
  border-color: var(--line3);
}

.sv-cand-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.sv-cand-btn.is-short {
  background: var(--gold-tint);
  border-color: var(--gold);
  color: var(--gold-ink);
}

.sv-empty {
  padding: 36px 24px 40px;
  border-top: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.sv-empty strong {
  font-size: 14px;
  color: var(--ink);
}

.sv-empty > span:not(.sv-empty-icon) {
  max-width: 440px;
  text-wrap: pretty;
}

.sv-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold-tint);
  color: var(--gold-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sv-empty-icon svg {
  width: 20px;
  height: 20px;
}

.sv-empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.sv-add-indep {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 112px auto;
  gap: 8px;
  align-items: center;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: var(--soft2);
}

.sv-add-indep .sv-input {
  height: 36px;
}

/* --- Candidates (inline) ------------------------------------------------------------------- */
.sc {
  margin: 2px 16px 14px 32px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.sc[hidden],
.sc-bulk[hidden] {
  display: none;
}

.sc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--soft2);
  border-bottom: 1px solid var(--line2);
  font-size: 12px;
  color: var(--muted);
}

.sc-head strong {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
}

.sc-warn {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--gold-ink);
  background: var(--gold-tint);
}

.sc-row {
  display: grid;
  grid-template-columns: 24px minmax(110px, 1fr) 92px auto 56px;
  gap: 8px;
  align-items: center;
  padding: 4px 10px 4px 14px;
  border-top: 1px solid var(--line2);
}

.sc-row:first-of-type {
  border-top: none;
}

.sc-pos,
.sk-pos {
  font-size: 12px;
  color: var(--muted);
}

.sc-row .sv-input {
  height: 32px;
  font-size: 13px;
}

.sc-via {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.sc-via-preference {
  background: var(--gold-tint);
  color: var(--gold-ink);
}

.sc-via-order {
  background: var(--green-tint);
  color: var(--green-ink);
}

.sc-actions {
  display: flex;
  justify-content: flex-end;
}

.sc-draft {
  grid-template-columns: 24px minmax(110px, 1fr) 92px auto;
  padding: 8px 10px 8px 14px;
  background: var(--soft2);
}

.sc-draft .sv-input {
  height: 34px;
}

.sc-link {
  height: 34px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--green-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sc-link:hover {
  text-decoration: underline;
}

.sc-bulk {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sc-bulk-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sc-bulk-foot > span {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}

.sc-empty {
  margin: 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
}

/* --- Results column ---------------------------------------------------------------------- */
.sx-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sx-dots span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.sx-dots.is-small span {
  width: 16px;
  height: 16px;
}

.sx-dots.is-tiny {
  gap: 4px;
}

.sx-dots.is-tiny span {
  width: 14px;
  height: 14px;
}

.sx-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sx-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sx-bar-row.is-below {
  opacity: 0.5;
}

.sx-bar-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.sx-bar-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sx-bar-share {
  color: var(--muted);
}

.sx-bar-seats {
  width: 22px;
  text-align: right;
  font-weight: 700;
}

.sx-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  position: relative;
  overflow: hidden;
}

.sx-bar span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}

.sx-foot {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding-top: 10px;
  border-top: 1px solid var(--line2);
}

.sx-warn {
  background: var(--gold-tint);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sx-warn h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-ink);
}

.sx-warn-item {
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  gap: 8px;
}

.sx-warn-item > span:first-child {
  color: var(--gold-ink);
}

.sx-elected {
  gap: 12px;
}

.sx-el-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sx-el-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
}

.sx-el-person {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  font-size: 13px;
}

.sx-el-person > span:first-child {
  flex: 1;
}

.sx-via {
  font-size: 11px;
  font-weight: 600;
}

.sx-via-preference {
  color: var(--gold-ink);
}

.sx-via-order {
  color: var(--green-ink);
}

.sx-via-independent {
  color: var(--muted);
}

.sx-el-missing {
  padding-left: 16px;
  font-size: 12px;
  color: var(--gold-ink);
}

.sx-how {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.sx-how summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.sx-how summary::-webkit-details-marker {
  display: none;
}

.sx-how summary span {
  flex: 1;
}

.sx-how[open] summary svg {
  transform: rotate(180deg);
}

.sx-q {
  padding: 0 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sx-q-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 56px 80px;
  gap: 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sx-q-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-bottom: 4px;
}

.sx-q-row.is-next {
  color: var(--muted);
  border-top: 1px dashed var(--line3);
  padding-top: 6px;
}

.sx-q-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sx-comp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--blue-tint);
  color: var(--blue-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.sx-comp-link:hover {
  color: var(--blue-ink);
  border-color: var(--blue-ink);
}

.sx-comp-link span {
  flex: 1;
}

/* --- Ukupni rezultat ------------------------------------------------------------------------ */
.so-top {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: stretch;
}

.so-dots-card {
  flex: 1 1 420px;
}

.so-table-card {
  flex: 1 1 460px;
  padding: 0;
  overflow: hidden;
}

.so-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--ink2);
}

.so-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.so-partial {
  font-size: 12px;
  color: var(--gold-ink);
  background: var(--gold-tint);
  padding: 8px 12px;
  border-radius: 10px;
}

.so-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.so-table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 8px 8px;
  white-space: nowrap;
}

.so-table td {
  padding: 9px 8px;
  border-top: 1px solid var(--line2);
}

.so-table th:first-child,
.so-table td:first-child {
  padding-left: 22px;
}

.so-table th:last-child,
.so-table td:last-child {
  padding-right: 22px;
}

.so-table tr.is-faded {
  opacity: 0.5;
}

.so-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.so-name i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.so-note {
  display: block;
  padding-left: 18px;
  font-size: 11px;
  color: var(--muted);
}

.so-dim {
  color: var(--ink2);
}

.so-blue {
  color: var(--blue-ink);
}

.so-strong {
  font-weight: 700;
}

.so-zero {
  color: var(--line3);
}

.so-table td.so-strong:last-child {
  font-size: 14px;
}

.so-matrix-card {
  padding: 16px 0 0;
  gap: 6px;
  overflow: hidden;
}

.so-matrix-card > .sx-head {
  padding: 0 22px;
}

.so-scroll {
  overflow-x: auto;
}

.so-col span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink2);
}

.so-matrix th.so-col {
  min-width: 58px;
}

.so-link-row {
  cursor: pointer;
}

.so-link-row:hover {
  background: var(--sel);
}

.so-cell-link {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  color: var(--ink);
  text-decoration: none;
  max-width: 260px;
}

.so-cell-link:hover {
  color: var(--ink);
}

.so-cname {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.so-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.so-status-empty {
  background: var(--soft);
  color: var(--muted);
}

.so-status-votes {
  background: var(--gold-tint);
  color: var(--gold-ink);
}

.so-status-done {
  background: var(--green-tint);
  color: var(--green-ink);
}

.so-comp-row {
  background: var(--blue-tint);
  color: var(--blue-ink);
}

.so-comp-row .so-cell-link,
.so-comp-row .so-cname {
  color: var(--blue-ink);
}

.so-total-row td {
  border-top: 1px solid var(--line);
  background: var(--soft2);
}

.so-pool {
  padding: 16px 0 6px;
  gap: 4px;
  overflow: hidden;
}

.so-pool-head {
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.so-pool-head h2 {
  flex: 1;
}

.so-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.so-pill-green {
  background: var(--green-tint);
  color: var(--green-ink);
}

.so-pill-gold {
  background: var(--gold-tint);
  color: var(--gold-ink);
}

.so-pool-thr {
  margin: 0;
  padding: 4px 22px 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.so-warn {
  margin: 0;
  padding: 8px 22px;
  font-size: 12px;
  color: var(--gold-ink);
}

.so-elected {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.so-elected h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.so-el-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.so-el-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.so-el-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.so-el-head i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.so-el-head strong {
  flex: 1;
}

.so-el-head span {
  font-weight: 700;
}

.so-el-person {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.so-el-person > span:first-child {
  flex: 1;
  min-width: 0;
}

.so-el-via {
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
}

.so-el-via-preference {
  color: var(--gold-ink);
}

.so-el-via-order {
  color: var(--green-ink);
}

.so-el-person.is-comp,
.so-el-via-compensatory {
  color: var(--blue-ink);
}

.so-el-missing {
  font-size: 12px;
  color: var(--gold-ink);
}

/* --- Kompenzacijske liste ---------------------------------------------------------------------- */
.sk-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sk-tab {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.sk-tab:hover {
  border-color: var(--line3);
  color: var(--ink);
}

.sk-tab.is-active {
  border-color: var(--green);
  background: var(--sel);
}

.sk-tab-meta {
  font-size: 12px;
  color: var(--muted);
}

.sk-tab-meta.is-on {
  color: var(--blue-ink);
}

.sk-head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line2);
  flex-wrap: wrap;
}

.sk-head > i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.sk-head-text {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}

.sk-gets {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--blue-tint);
  color: var(--blue-ink);
  white-space: nowrap;
}

.sk-gets.is-none {
  background: var(--soft);
  color: var(--muted);
}

.sk-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.sk-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 60px;
  gap: 8px;
  align-items: center;
  padding: 5px 12px 5px 20px;
  border-top: 1px solid var(--line2);
}

.sk-head + .sk-row {
  border-top: none;
}

.sk-row.is-elected {
  background: var(--sel);
}

.sk-row.is-elected .sk-name {
  font-weight: 700;
}

.sk-row.is-skipped .sk-name {
  text-decoration: line-through;
  color: var(--muted);
}

.sk-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.sk-tag-elected {
  background: var(--blue-tint);
  color: var(--blue-ink);
}

.sk-tag-skipped {
  background: var(--soft);
  color: var(--muted);
}

.sk-draft {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  padding: 8px 12px 8px 20px;
  background: var(--soft2);
}

.sk-draft .sv-input {
  height: 36px;
}

.sk-bulk {
  padding: 10px 20px 16px;
}

.sk-calc {
  padding: 0;
  gap: 0;
  overflow: hidden;
}

.sk-calc-head {
  padding: 16px 20px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.sk-calc-table {
  font-size: 12px;
}

.sk-calc-table th {
  font-size: 10px;
}

.sk-calc-table th:first-child,
.sk-calc-table td:first-child {
  padding-left: 20px;
}

.sk-calc-table th:last-child,
.sk-calc-table td:last-child {
  padding-right: 20px;
}

.sk-calc-foot {
  padding: 12px 20px 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line2);
}

/* --- Dialogs ---------------------------------------------------------------------------------- */
.sd-modal .modal-dialog {
  max-width: 640px;
}

.sd-modal .modal-content {
  border-radius: 18px;
  overflow: hidden;
}

.sd-head {
  padding: 20px 24px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--line2);
}

.sd-head > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sd-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.sd-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.sd-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-close:hover {
  background: var(--soft);
  color: var(--ink);
}

.sd-empty {
  margin: 0;
  padding: 20px 24px;
  font-size: 13px;
  color: var(--muted);
}

.sd-party {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 24px;
  border-bottom: 1px solid var(--line2);
}

.sd-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.sd-swatch:disabled {
  cursor: default;
}

.sd-name {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.sd-name:hover {
  border-color: var(--line);
}

.sd-name:focus {
  outline: none;
  border-color: var(--green);
  background: var(--surface);
}

.sd-usage {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sd-icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sd-icon-btn:hover {
  background: var(--red-tint);
  color: var(--red-ink);
}

.sd-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sd-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  min-width: 0;
}

.sd-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}

.sd-input:disabled {
  background: var(--soft2);
  color: var(--ink2);
}

.sd-foot .sd-input {
  flex: 1;
}

.sd-primary,
.sd-secondary,
.sd-danger {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.sd-primary {
  border: none;
  background: var(--green);
  color: #fff;
}

.sd-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.sd-danger {
  border: none;
  background: var(--red);
  color: #fff;
}

.sd-danger[hidden] {
  display: none;
}

.sd-rules {
  padding: 16px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sd-lock {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--red-tint);
  cursor: pointer;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--red-ink);
}

.sd-lock input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
  flex-shrink: 0;
}

.sd-lock.is-unlocked {
  color: var(--ink);
}

.sd-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.sd-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
}

.sd-pool {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.sd-pool-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--soft2);
  font-size: 13px;
  font-weight: 700;
}

.sd-pool-head > span {
  flex: 1;
}

.sd-pool-head label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
}

.sd-pool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-top: 1px solid var(--line2);
  margin: 0;
}

.sd-code {
  width: 34px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink2);
}

.sd-cname {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-num {
  width: 56px;
  height: 32px;
  padding: 0 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.sd-total {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}

.sd-confirm-title {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

@media (max-width: 767.98px) {
  .sv-row {
    grid-template-columns: minmax(0, 1fr) 104px 46px 96px 32px;
  }

  .sv-row > :nth-child(3) {
    display: none;
  }

  .sc {
    margin: 2px 8px 12px;
  }

  .sc-row {
    grid-template-columns: 22px minmax(0, 1fr) 80px 52px;
  }

  .sc-row > :nth-child(4) {
    display: none;
  }

  .sc-draft {
    grid-template-columns: 22px minmax(0, 1fr) 80px;
  }

  .sc-draft .sc-link {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .sv-row {
    grid-template-columns: minmax(0, 1fr) 88px 36px 66px 28px;
    gap: 6px;
    padding: 7px 12px;
  }

  .sv-cand-btn {
    padding: 0 6px;
    font-size: 11px;
  }

  .sv-cand-btn svg {
    display: none;
  }

  .sv-add-indep {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .sv-add-indep .sv-btn {
    grid-column: 1 / -1;
  }

  .sp-row {
    grid-template-columns: minmax(0, 1fr) 80px;
  }

  .sp-row .sp-map {
    grid-column: 1 / -1;
  }

  .sd-grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
}
