:root {
  --yellow: #f6c64a;
  --ink: #1f2933;
  --muted: #65717e;
  --line: #e6cf87;
  --panel: #ffffff;
  --soft: #f8f8f3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

body:not(.is-authenticated) .sidebar,
body:not(.is-authenticated) main {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #fff;
  border-right: 1px solid #f0e3b3;
  box-shadow: 6px 0 24px #00000008;
  padding: 22px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 4px solid var(--yellow);
}

.brand-mark {
  width: 34px;
  height: 34px;
  background: linear-gradient(180deg, var(--yellow) 0 36%, var(--ink) 36% 100%);
  border-radius: 8px;
}

.brand small { display: block; color: var(--muted); margin-top: 3px; }

nav { display: grid; gap: 8px; margin-top: 20px; }
nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease;
}
nav a.active, nav a:hover {
  background: #fff8dd;
  border-color: var(--line);
}

main { margin-left: 260px; padding: 22px; }

.topbar, .section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-chip, .sync-chip {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff9e7;
  font-size: 13px;
  font-weight: 700;
}

.sync-chip[data-status="ok"],
.inline-status[data-status="ok"] {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.sync-chip[data-status="loading"],
.inline-status[data-status="loading"] {
  border-color: #facc15;
  background: #fefce8;
  color: #854d0e;
}

.sync-chip[data-status="error"],
.inline-status[data-status="error"] {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

h1, h2 { margin: 0 0 8px; letter-spacing: 0; }
p { color: var(--muted); }

button {
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px #00000010;
}

button.secondary, .report-actions button:nth-child(n+2) {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--yellow);
}

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--yellow);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.table-action.secondary {
  border-color: var(--yellow);
  background: #fff;
  color: var(--ink);
}

.table-action.is-download-ready {
  border-color: #15803d;
  background: #16a34a;
  color: #fff;
}

.table-action.is-download-disabled {
  border-color: #d4d9df;
  background: #eceff3;
  color: #7a8592;
  cursor: not-allowed;
}

.table-action.is-current-leader,
.table-action.is-current-leader:disabled {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
  cursor: default;
  opacity: 1;
}

.submission-site-group td {
  background: #fff8dd;
  color: var(--ink);
  font-weight: 800;
  border-top: 2px solid var(--yellow);
  border-bottom: 1px solid var(--line);
}

.submission-locality-group td {
  background: #fffbec;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding-left: 24px;
}

.section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-top: 18px;
  box-shadow: 0 8px 20px #00000008;
}

.section.is-active {
  animation: sectionFadeIn 180ms ease;
}

@keyframes sectionFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.filters, .participant-form, .settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
  margin: 14px 0 8px;
}

.settings-grid input[readonly] {
  background: #f8f8f3;
  color: var(--muted);
}

.leader-assignment-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf0;
}

.leader-assignment-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.leader-assignment-head h3,
.leader-assignment-head p {
  margin: 0;
}

.leader-assignment-head p {
  margin-top: 5px;
}

.leader-assignment-summary {
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.leader-assignment-grid {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1.2fr) minmax(260px, 1.5fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.leader-assignment-grid button {
  min-height: 42px;
}

.location-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
  margin-top: 14px;
}

.location-paste-field {
  grid-column: span 3;
}

.location-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.location-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.checkbox-label input {
  width: auto;
}

.settings-note {
  max-width: 850px;
  margin: 4px 0 14px;
}

.inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.admin-form > input,
.admin-form > select,
.admin-form > label > select,
.admin-form > button {
  min-height: 46px;
}

.admin-form > label {
  align-self: start;
}

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

.admin-field {
  display: grid;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
}

.admin-field select {
  min-height: 46px;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

select[multiple] {
  min-height: 130px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.stat, .panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 16px;
  box-shadow: 0 10px 20px #00000008;
}

.stat strong {
  display: block;
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 4px;
  width: 100%;
  text-align: center;
}

.stat span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  display: block;
}

.stat.stat-wide {
  grid-column: 1 / -1;
  min-height: 118px;
  padding: 20px 24px;
}

.stat.stat-compact strong {
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 38px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.bar {
  height: 12px;
  background: #fff4cf;
  border-radius: 8px;
  overflow: hidden;
}

.bar span { display: block; height: 100%; background: var(--yellow); transition: width 200ms ease; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 850px; background: #fff; }
th, td {
  text-align: left;
  border-bottom: 1px solid #f0e4bc;
  padding: 10px;
  vertical-align: top;
  font-size: 14px;
}
th { background: #fff9e7; }

.payroll-section-head {
  align-items: center;
}

.payroll-section-head p {
  margin: 0;
}

.payroll-save-status {
  max-width: 340px;
}

.payroll-toolbar {
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffef9;
}

.payroll-toolbar label {
  min-width: min(100%, 260px);
}

.payroll-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.payroll-summary-card {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.payroll-summary-card strong {
  font-size: 24px;
}

.payroll-summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payroll-site-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.payroll-site-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #fff8dd;
  border-bottom: 1px solid var(--line);
}

.payroll-site-heading h3,
.payroll-site-heading p {
  margin: 0;
}

.payroll-site-heading p,
.payroll-site-heading > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payroll-table-wrap {
  margin-top: 0;
}

.payroll-table {
  min-width: 1220px;
}

.payroll-table th {
  white-space: nowrap;
  vertical-align: bottom;
}

.payroll-table td {
  vertical-align: top;
}

.payroll-day-column,
.payroll-day-count,
.payroll-check-cell,
.payroll-participant-count {
  text-align: center;
}

.payroll-day-count,
.payroll-participant-count {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.payroll-locality-cell {
  min-width: 190px;
}

.payroll-locality-cell span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.payroll-decision-select {
  min-width: 82px;
}

.payroll-check-cell {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.payroll-check-balanced {
  color: #166534;
}

.payroll-check-warning {
  color: #b42318;
  background: #fff1f0;
}

.payroll-table tfoot th {
  text-align: center;
  color: var(--text);
  background: #f3f4f6;
  border-top: 2px solid #111;
  font-variant-numeric: tabular-nums;
}

.payroll-table tfoot th:first-child {
  text-align: left;
}

.payroll-comments-cell {
  min-width: 390px;
  max-width: 520px;
}

.payroll-comments-list {
  display: grid;
  gap: 8px;
}

.payroll-comment-item {
  display: grid;
  gap: 5px;
  padding: 9px;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
}

.payroll-comment-item > span,
.payroll-comment-item label,
.payroll-general-comment {
  font-size: 12px;
}

.payroll-comment-item textarea,
.payroll-general-comment textarea {
  width: 100%;
  min-height: 54px;
  margin-top: 4px;
  padding: 8px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  line-height: 1.35;
}

.payroll-general-comment {
  display: block;
  margin-top: 9px;
  font-weight: 700;
}

.payroll-awaiting {
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
}

.payroll-complete {
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.payroll-missing-row {
  background: #fafafa;
  color: var(--muted);
}

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

.hidden { display: none; }
.overview-toolbar {
  display: flex;
  justify-content: flex-end;
}
.missing-list { display: grid; gap: 10px; }
.missing-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 16px #00000006;
}
.report-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.import-preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffef9;
  padding: 14px;
}

.import-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.import-preview-head h3 {
  margin: 0;
}

.import-preview-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.import-preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.import-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}

.import-duplicate-note {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff3e0;
  border: 1px solid #f6c64a;
  font-size: 12px;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: #00000052;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 36px #00000026;
  padding: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h3 {
  margin: 0;
}

.login-card {
  width: min(420px, 100%);
  padding: 0;
  overflow: hidden;
}

/* ── Yellow swish header ─────────────────────────────────── */
.login-header {
  background: var(--yellow);
  padding: 32px 24px 60px;
  text-align: center;
  position: relative;
  /* Elliptical bottom creates the swish curve */
  border-radius: 0 0 60% 60% / 0 0 44px 44px;
}

.login-header h3 {
  margin: 0 0 2px;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.login-header p {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  opacity: 0.7;
}

.login-logo-mark {
  width: 52px;
  height: 52px;
  background: linear-gradient(180deg, var(--ink) 0% 40%, rgba(255,255,255,0.18) 40% 100%);
  border-radius: 14px;
  margin: 0 auto 14px;
  border: 3px solid var(--ink);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

/* ── Login form body ─────────────────────────────────────── */
.login-body {
  padding: 28px 24px 24px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-status {
  font-size: 0.82em;
  color: #888;
  margin: 0;
  text-align: center;
}

.login-error {
  font-size: 0.85em;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0;
  text-align: center;
}

/* ── Toast notifications ─────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  max-width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  transform: translateX(110%);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: all;
}

.toast.toast-in {
  transform: translateX(0);
  opacity: 1;
}

.toast-error   { background: #dc2626; }
.toast-success { background: #16a34a; }
.toast-warning { background: #d97706; }
.toast-info    { background: var(--ink); }

.toast-message { flex: 1; }

.toast-close {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.75;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 4px;
  min-width: auto;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
  transform: none;
  box-shadow: none;
}

/* ── Empty-state table rows ──────────────────────────────── */
.empty-state td {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
  font-size: 14px;
}

/* ── Inline loading spinner on buttons ───────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.hidden-for-role {
  display: none !important;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  main { margin-left: 0; padding: 14px; }
  .filters, .participant-form, .stats-grid, .chart-grid, .import-controls, .admin-form, .leader-assignment-grid, .location-form { grid-template-columns: 1fr; }
  .location-paste-field { grid-column: auto; }
  .topbar, .section-head { display: grid; }
  .leader-assignment-head { display: grid; }
  .leader-assignment-summary { max-width: none; }
  .import-preview-head { display: grid; }
  .overview-toolbar { justify-content: stretch; }
  .overview-toolbar button { width: 100%; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-card { max-height: 94vh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
}

.settings-grid-prod {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.connection-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffef8;
  padding: 12px;
  margin: 12px 0;
}

.connection-panel .inline-status {
  flex: 1 1 320px;
}

@media (max-width: 900px) {
  .settings-grid-prod { grid-template-columns: 1fr; }
}

/* ── Reports & Analytics ─────────────────────────────────── */
.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.report-kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 8px 16px #00000008;
}

.report-kpi-value {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 5px;
}

.report-kpi-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.report-full-panel { margin-top: 14px; }

.report-panel-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 12px;
}

.compliance-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.report-export-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px 18px;
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-wrap: wrap;
}

.report-export-strip strong { font-size: 15px; display: block; margin-bottom: 4px; }
.report-export-strip p { margin: 0; font-size: 13px; color: var(--muted); }

.report-export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.report-export-actions button { font-size: 13px; padding: 9px 14px; }

@media (max-width: 900px) {
  .report-grid { grid-template-columns: 1fr; }
  .report-export-strip { display: grid; }
}

/* ── Skeleton shimmer ─────────────────────────────────────── */
@keyframes shimmer {
  from { background-position: -600px 0; }
  to   { background-position:  600px 0; }
}
.skeleton-cell {
  display: block;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0e6b3 25%, #fff8d8 50%, #f0e6b3 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton-stat {
  height: 88px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f0e6b3 25%, #fff8d8 50%, #f0e6b3 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s ease infinite;
  border: 1px solid var(--line);
}

/* ── Confirm modal ────────────────────────────────────────── */
.confirm-card {
  width: min(420px, 100%);
  padding: 24px;
}
.confirm-card h3 { margin: 0 0 10px; }
.confirm-card p  { margin: 0 0 20px; color: var(--muted); }

/* ── Sortable table headers ───────────────────────────────── */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th[data-sort]:hover { background: #fff4cf; }
th[data-sort]::after { content: ' ⇅'; opacity: 0.35; font-size: 11px; }
th[data-sort][aria-sort="ascending"]::after  { content: ' ↑'; opacity: 1; }
th[data-sort][aria-sort="descending"]::after { content: ' ↓'; opacity: 1; }

/* ── Inline table search ──────────────────────────────────── */
.table-search {
  margin: 10px 0 4px;
}
.table-search input {
  max-width: 300px;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
}

/* ── Bulk action bar ──────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin-top: 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  flex-wrap: wrap;
}
.bulk-bar span { font-size: 14px; font-weight: 700; }
.bulk-bar select {
  width: auto;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  color: #fff;
  min-width: 140px;
}
.bulk-bar button { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.bulk-bar .btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* ── Team leader credential editor ────────────────────────── */
.credentials-note {
  margin: 2px 0 8px;
  font-size: 13px;
}

.credential-secret-editor,
.credential-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.credential-edit-cell {
  min-width: 220px;
}

.credential-edit-input {
  min-width: 210px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.credential-secret-editor .credential-secret-input {
  min-width: 180px;
}

.credential-secret-toggle {
  min-width: auto;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.credential-edit-cell small {
  display: block;
  max-width: 270px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.credential-secret-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.credential-secret-status.needs-setup {
  background: #fff7ed;
  color: #9a3412;
}

.credential-actions .table-action {
  white-space: nowrap;
}

.credential-edit-input:disabled,
.credential-actions button:disabled,
.credential-secret-toggle:disabled {
  cursor: wait;
  opacity: 0.65;
}

/* ── Missing history date bar ─────────────────────────────── */
.missing-date-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.missing-date-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
}
.missing-date-bar input[type="date"] {
  width: auto;
  padding: 7px 10px;
  border-radius: 8px;
}

/* ── Audit log panel ──────────────────────────────────────── */
.audit-panel-card {
  width: min(560px, 100%);
  padding: 20px;
}
.audit-panel-card h3 { margin: 0 0 2px; }
.audit-panel-card .audit-name { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.audit-log-list { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; }
.audit-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffef9;
}
.audit-entry-time { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.audit-entry-changes { display: grid; gap: 3px; }
.audit-change-row {
  font-size: 13px;
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}
.audit-field { font-weight: 700; min-width: 110px; }
.audit-from  { color: #dc2626; text-decoration: line-through; font-size: 12px; }
.audit-to    { color: #16a34a; }

/* ── Login lockout warning ────────────────────────────────── */
#loginError:not(:empty) {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #dc2626;
}

/* ── Idle timeout warning modal ───────────────────────────── */
#idleWarningModal .confirm-card {
  border-top: 4px solid #f59e0b;
}
#idleWarningModal strong {
  font-variant-numeric: tabular-nums;
}

/* ── Overview connection bar ──────────────────────────────── */
.overview-connection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid #f0e3b3;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.overview-conn-left, .overview-conn-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.status-dot.ok      { background: #16a34a; }
.status-dot.loading { background: var(--yellow); animation: pulse 1.2s ease-in-out infinite; }
.status-dot.error   { background: #dc2626; }
.overview-status-text { font-weight: 700; font-size: 14px; }
.overview-counts { font-size: 13px; color: var(--muted); }
.overview-last-sync { font-size: 12px; color: var(--muted); }

/* ── Checkbox column ──────────────────────────────────────── */
.cb-col { width: 36px; text-align: center !important; }
.cb-col input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }
tr.row-selected { background: #fffde7; }
