:root {
  --party-yellow: #fff200;
  --party-yellow-soft: #fffbd6;
  --party-red: #ef1b16;
  --party-red-dark: #c91511;
  --party-green: #245b35;
  --party-green-dark: #173f25;
  --navy: #245b35;
  --navy-dark: #173f25;
  --red: #ef1b16;
  --red-dark: #c91511;
  --blue-tint: #fffbd6;
  --blue-text: #173f25;
  --border: #e5df9a;
  --row-alt: #fffef0;
  --text: #1e2a20;
  --muted: #667066;
  --green: #245b35;
  --surface: #ffffff;
  --page: #fffef4;
  --amber: #8b5d00;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--surface);
}

.site-header {
  background: var(--party-yellow);
  color: var(--party-green-dark);
  padding: 12px 28px 24px;
  box-shadow: 0 2px 10px rgba(16,38,59,.12);
}

.header-top {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--party-red);
  padding-bottom: 12px;
}

.brand, .login-brand {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  line-height: .83;
  letter-spacing: .04em;
}

.brand-get {
  color: var(--party-green-dark);
  font-size: 2.65rem;
  font-weight: 900;
}

.brand-my {
  color: var(--party-green-dark);
  font-size: 1.45rem;
  font-weight: 900;
  margin-top: 8px;
}

.brand-my strong { color: var(--party-red); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-badge {
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--party-green-dark);
}

.logout-link, .admin-link {
  color: var(--party-green-dark);
  font-weight: 800;
  text-decoration: none;
}

.admin-link {
  padding: 8px 12px;
  border: 1px solid rgba(36,91,53,.38);
  border-radius: 8px;
}

.logout-link:hover,
.admin-link:hover { text-decoration: underline; }

.search-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  padding-top: 20px;
  align-items: end;
}

.search-field {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.search-field > span {
  color: var(--party-green-dark);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.search-field input {
  width: 100%;
  height: 46px;
  border: 1px solid #b8c4d2;
  border-radius: 9px;
  padding: 0 13px;
  font-size: .96rem;
  color: #27364a;
  background: #fff;
  outline: none;
}

.search-field input:focus {
  border-color: #8ea4b9;
  box-shadow: 0 0 0 3px rgba(239,27,22,.13);
}

.search-actions {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.search-btn,
.clear-btn {
  height: 46px;
  border-radius: 9px;
  border: 0;
  font-size: .96rem;
  font-weight: 800;
  cursor: pointer;
}

.search-btn {
  background: var(--red);
  color: #fff;
}

.clear-btn {
  background: #ffffff;
  color: var(--party-green-dark);
  border: 1px solid rgba(36,91,53,.34);
}

.search-btn:hover { background: var(--red-dark); }
.clear-btn:hover { background: var(--party-yellow-soft); }

.content { padding: 16px 28px 26px; }

.summary-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.data-status {
  font-size: .82rem;
  color: var(--muted);
}

.count-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-dark);
  font-weight: 800;
}

.refresh-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.record-count { font-size: 1rem; }

.table-wrap {
  overflow-x: auto;
  border-radius: 11px 11px 0 0;
  box-shadow: 0 4px 20px rgba(22, 47, 78, .11);
}

table {
  width: 100%;
  min-width: 1580px;
  border-collapse: collapse;
  background: var(--surface);
}

thead th {
  background: var(--blue-tint);
  color: var(--blue-text);
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  padding: 12px 12px;
  font-size: .82rem;
}

tbody tr:nth-child(odd) { background: var(--row-alt); }
tbody tr:nth-child(even) { background: var(--surface); }

tbody td {
  border-top: 1px solid var(--border);
  padding: 13px 12px;
  vertical-align: middle;
  font-size: .9rem;
  line-height: 1.3;
}

.whatsapp-btn {
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--green);
  color: var(--green);
  text-decoration: none;
}

.whatsapp-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.whatsapp-btn:hover { background: #edfff2; }

.mobile-results { display: none; }

.voter-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(18,40,70,.08);
}

.voter-card + .voter-card { margin-top: 12px; }

.voter-card h3 {
  margin: 0 0 3px;
  color: var(--navy);
  font-size: 1.08rem;
}

.voter-id {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .9rem;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 13px;
  margin-bottom: 13px;
}

.card-item { font-size: .9rem; }

.card-item b {
  display: block;
  margin-bottom: 2px;
  color: #475467;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.card-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.card-whatsapp svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.message {
  margin: 10px 0 16px;
  padding: 11px 13px;
  border: 1px solid #f5bfc5;
  border-radius: 8px;
  background: #fff5f6;
  color: #a11a27;
  font-size: .9rem;
}

.message.success {
  border-color: #a6e8b8;
  background: #f0fff4;
  color: #176b2d;
}

.hidden { display: none !important; }

.sample-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f3f6f9;
}

.login-shell {
  width: min(100%, 430px);
}

.login-card {
  background: #ffffff;
  border: 1px solid #e1e7ed;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 14px 40px rgba(16,38,59,.12);
}

.login-brand {
  background: var(--party-yellow);
  padding: 15px 18px;
  border-radius: 10px;
  margin-bottom: 24px;
  box-shadow: 0 5px 14px rgba(36,91,53,.14);
}

.login-card h1 {
  margin: 0;
  color: var(--navy-dark);
  font-size: 1.75rem;
  letter-spacing: -.02em;
}

.login-copy {
  margin: 8px 0 24px;
  color: var(--muted);
  line-height: 1.55;
  font-size: .95rem;
}

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

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

.login-form label > span {
  font-size: .82rem;
  font-weight: 800;
  color: #34495e;
}

.login-form input {
  width: 100%;
  height: 48px;
  border-radius: 9px;
  border: 1px solid #cfd8e1;
  padding: 0 14px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.login-form input:focus {
  border-color: #6f8ba5;
  box-shadow: 0 0 0 3px rgba(23,50,77,.09);
}

.login-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
  border: 0;
  border-radius: 9px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
}

.login-btn,
.primary-btn {
  background: var(--red);
  color: #fff;
}

.login-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
}

.login-btn:hover,
.primary-btn:hover {
  background: var(--red-dark);
}

.secondary-btn {
  background: #eef2f5;
  color: var(--navy-dark);
  border: 1px solid #d5dde5;
}

.danger-btn {
  background: #b42318;
  color: #fff;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.login-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff1f2;
  color: #a51d2b;
  border: 1px solid #f0c8cd;
  font-size: .88rem;
}

.login-note {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #edf0f3;
  color: #7a8794;
  font-size: .76rem;
  line-height: 1.45;
}


.render-demo-note {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #ead6a2;
  border-radius: 10px;
  background: #fffaf0;
  color: #7a5720;
  font-size: .88rem;
  line-height: 1.5;
}

.render-demo-note strong {
  color: #5f4215;
}

/* Admin upload */
.admin-body { background: var(--page); }

.admin-header { padding-bottom: 12px; }

.admin-content {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 50px;
}

.admin-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.admin-title h1 {
  margin: 2px 0 8px;
  color: var(--navy-dark);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.admin-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  color: var(--red) !important;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.back-button {
  flex: 0 0 auto;
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 13px;
  font-weight: 800;
  text-decoration: none;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(21,44,72,.06);
  margin-bottom: 16px;
}

.admin-card h2 {
  margin: 0 0 14px;
  color: var(--navy-dark);
  font-size: 1.15rem;
}

.current-info {
  color: #344054;
  line-height: 1.7;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px solid #eef2f6;
}

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

.info-row span { color: var(--muted); }
.info-row strong { text-align: right; }

.required-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.required-columns span {
  background: #eef3ff;
  color: var(--blue-text);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
}

.drop-zone {
  border: 2px dashed #b9c6d5;
  border-radius: 14px;
  padding: 26px;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  background: #f9fbfc;
  transition: .18s ease;
}

.drop-zone.dragover {
  border-color: var(--navy);
  background: #f1f6ff;
}

.upload-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf3fb;
  color: var(--navy);
  font-size: 1.65rem;
  font-weight: 900;
}

.drop-zone > span {
  color: var(--muted);
  font-size: .88rem;
}

.selected-file {
  color: #344054;
  font-size: .85rem;
  margin-top: 4px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.preview-summary {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-summary > div {
  background: #f7f9fb;
  border: 1px solid #e5eaf0;
  border-radius: 10px;
  padding: 12px;
}

.preview-summary span {
  display: block;
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.preview-summary strong {
  word-break: break-word;
  color: var(--navy-dark);
}

.warning-box {
  margin-bottom: 14px;
  padding: 11px 13px;
  border: 1px solid #f3ca8c;
  background: #fff8eb;
  color: var(--amber);
  border-radius: 9px;
  font-size: .88rem;
  line-height: 1.5;
}

.preview-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.preview-table {
  min-width: 720px;
  box-shadow: none;
}

.preview-table th,
.preview-table td {
  padding: 10px;
}

.confirmation-box {
  margin-top: 14px;
  padding: 12px 13px;
  border-radius: 9px;
  background: #f7f9fb;
  border: 1px solid #e2e8f0;
}

.confirmation-box label {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  color: #344054;
  line-height: 1.4;
}

.confirmation-box input { margin-top: 2px; }

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

.backup-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid #e5eaf0;
  border-radius: 9px;
  background: #fafbfc;
  font-size: .86rem;
}

.backup-item span { color: var(--muted); }
.backup-empty { color: var(--muted); }

@media (max-width: 1050px) {
  .search-field { grid-column: span 4; }
  .search-actions { grid-column: span 4; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .site-header { padding: 10px 16px 18px; }
  .header-top { min-height: 68px; }
  .brand-get { font-size: 2.15rem; }
  .brand-my { font-size: 1.15rem; margin-top: 6px; }
  .user-badge { display: none; }

  .search-fields {
    grid-template-columns: 1fr 1fr;
    padding-top: 18px;
  }

  .search-field,
  .search-actions {
    grid-column: auto;
  }

  .search-actions {
    grid-column: 1 / -1;
  }

  .content { padding: 12px 14px 24px; }

  .summary-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 5px 0 13px;
  }

  .desktop-results { display: none; }
  .mobile-results { display: block; }

  .admin-content {
    width: min(100% - 22px, 1180px);
    padding-top: 20px;
  }

  .admin-title { flex-direction: column; }
  .preview-summary { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .card-grid { grid-template-columns: 1fr; }
  .header-actions { gap: 8px; }
  .admin-link { font-size: .78rem; }
}

/* V1.7 server-side pagination */
.pagination {
  margin: 18px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.page-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--navy-dark);
  font-weight: 800;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) {
  background: var(--blue-tint);
}

.page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.page-info {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}


/* V1.8 ward user administration */
.admin-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.admin-section-heading h2 {
  margin-bottom: 6px;
}

.admin-section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: .9rem;
}

.ward-user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.ward-user-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ward-status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
}

.ward-status.enabled {
  background: #eaf8ee;
  color: #176b2d;
}

.ward-status.disabled {
  background: #fff0f0;
  color: #9d1c18;
}

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

.ward-user-actions button {
  min-height: 36px;
  font-size: .82rem;
}

.ward-new-password {
  grid-column: 1 / -1;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--party-yellow-soft);
  color: var(--party-green-dark);
  font-weight: 800;
  word-break: break-all;
}

@media (max-width: 700px) {
  .admin-section-heading {
    flex-direction: column;
  }

  .ward-user-row {
    grid-template-columns: 1fr;
  }
}


/* V1.8 authentication hardening */
.ward-password-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.ward-password-editor input {
  min-height: 38px;
  border: 1px solid #cfd8e1;
  border-radius: 8px;
  padding: 0 10px;
  font-size: .86rem;
  background: #fff;
  color: var(--text);
}

.ward-password-editor input:focus {
  outline: none;
  border-color: #8ea4b9;
  box-shadow: 0 0 0 3px rgba(239,27,22,.10);
}

@media (max-width: 900px) {
  .ward-password-editor {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .ward-password-editor {
    grid-template-columns: 1fr;
  }
}


/* Developer credit */
.anagani-credit {
  margin: 18px auto 20px;
  padding: 10px 16px;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .02em;
}

.anagani-credit a {
  color: var(--party-green-dark);
  font-weight: 900;
  text-decoration: none;
}

.anagani-credit a:hover {
  color: var(--party-red);
  text-decoration: underline;
}


.search-results-table th,
.page-info,
.search-results-table td,
.voter-card h3,
.voter-card .voter-id,
.voter-card .card-item,
.voter-card .card-item b {
  font-weight: 700;
}

