/* Graduate Constituency Electoral Roll 2026 - theme */
  :root {
    --primary: #FF6B35;
    --primary-light: #fff3ef;
    --primary-dark: #e55a24;
    --primary-2: #ff9a5c;          /* gradient partner of --primary */
    --primary-rgb: 255,107,53;     /* --primary as r,g,b for rgba() */
    --secondary: #392C7D;
    --accent: #00C9A7;
    --bg: #F8F9FC;
    --sidebar-bg: #fff;
    --card-bg: #fff;
    --text-dark: #1a1a2e;
    --text-mid: #4b5563;
    --text-light: #9ca3af;
    --border: #e9ecef;
    --grid: #f3f4f6;
    --shadow: 0 4px 24px rgba(0,0,0,0.07);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --radius: 14px;
    --radius-sm: 8px;
    --sidebar-w: 260px;
    --header-h: 68px;
    --safe-top: env(safe-area-inset-top, 0px);
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --primary-light:#3a2218; --bg:#13141c; --sidebar-bg:#1a1c28; --card-bg:#1a1c28;
      --text-dark:#eef0f8; --text-mid:#b3b9cc; --text-light:#7f8799; --border:#2a2d3f; --grid:#242739;
      --shadow:0 4px 24px rgba(0,0,0,.4); --shadow-sm:0 2px 8px rgba(0,0,0,.3);
    }
  }
  :root[data-theme="dark"] {
    --primary-light:#3a2218; --bg:#13141c; --sidebar-bg:#1a1c28; --card-bg:#1a1c28;
    --text-dark:#eef0f8; --text-mid:#b3b9cc; --text-light:#7f8799; --border:#2a2d3f; --grid:#242739;
    --shadow:0 4px 24px rgba(0,0,0,.4); --shadow-sm:0 2px 8px rgba(0,0,0,.3);
  }
  html { scroll-padding-top: calc(var(--header-h) + var(--safe-top)); }
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text-dark); min-height: 100vh; }
  .ico { width: 1em; height: 1em; fill: currentColor; display: inline-block; vertical-align: -.125em; flex-shrink: 0; }

  /* TOP NAV */
  .topnav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: calc(var(--header-h) + var(--safe-top)); padding-top: var(--safe-top);
    background: var(--card-bg); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding-left: 28px; padding-right: 28px; box-shadow: var(--shadow-sm);
  }
  .topnav-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
  .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
  .logo-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .logo-icon svg { width: 20px; height: 20px; fill: #fff; }
  .logo-text { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 1.1rem; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo-text span { color: var(--primary); }
  .hamburger { background: none; border: none; cursor: pointer; width: 38px; height: 38px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; transition: background .2s; flex-shrink: 0; }
  .hamburger:hover { background: var(--bg); }
  .hamburger span { display: block; width: 20px; height: 2px; background: var(--text-mid); border-radius: 2px; }
  .topnav-right { display: flex; align-items: center; gap: 12px; }
  .nav-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; }
  .nav-search input { border: none; background: none; outline: none; font-size: .875rem; color: var(--text-dark); width: 180px; font-family: inherit; }
  .nav-search .ico { color: var(--text-light); font-size: .95rem; }
  .nav-icon-btn { position: relative; width: 40px; height: 40px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-mid); transition: background .2s; }
  .nav-icon-btn:hover { background: var(--primary-light); }
  .nav-badge { position: absolute; top: -4px; right: -4px; background: var(--primary); color: #fff; font-size: .65rem; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--card-bg); }
  .user-pill { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 40px; cursor: pointer; transition: background .2s; }
  .user-pill:hover { background: var(--primary-light); }
  .user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),#392C7D); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; }
  .user-name { font-size: .82rem; font-weight: 600; }

  /* LAYOUT */
  .layout { display: flex; padding-top: calc(var(--header-h) + var(--safe-top)); min-height: 100vh; }

  /* SIDEBAR */
  .sidebar { width: var(--sidebar-w); position: fixed; top: calc(var(--header-h) + var(--safe-top)); left: 0; bottom: 0; background: var(--sidebar-bg); border-right: 1px solid var(--border); overflow-y: auto; z-index: 50; transition: transform .3s ease; }
  .sidebar-profile { margin: 20px 16px 16px; background: linear-gradient(135deg, var(--secondary) 0%, #6a3de8 100%); border-radius: var(--radius); padding: 22px 18px 18px; color: #fff; position: relative; overflow: hidden; }
  .sidebar-profile::before { content: ''; position: absolute; top: -20px; right: -20px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.08); }
  .sidebar-profile::after { content: ''; position: absolute; bottom: -30px; right: 20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.06); }
  .sp-avatar { width: 54px; height: 54px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--primary-2)); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 800; color: #fff; border: 3px solid rgba(255,255,255,.3); margin-bottom: 10px; position: relative; z-index: 1; }
  .sp-name { font-weight: 700; font-size: 1rem; margin-bottom: 2px; position: relative; z-index: 1; }
  .sp-role { font-size: .75rem; opacity: .75; margin-bottom: 14px; position: relative; z-index: 1; }
  .sp-btns { display: flex; gap: 8px; position: relative; z-index: 1; }
  .sp-btn { flex: 1; padding: 7px 6px; border-radius: 8px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: .72rem; font-weight: 600; text-align: center; text-decoration: none; display: block; font-family: inherit; transition: background .2s; }
  .sp-btn:hover { background: rgba(255,255,255,.3); }
  .sp-btn.primary { background: var(--primary); border-color: var(--primary); }
  .sp-btn.primary:hover { background: var(--primary-dark); }
  .sidebar-section { padding: 10px 16px 4px; }
  .sidebar-section-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; color: var(--text-light); text-transform: uppercase; margin-bottom: 6px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text-mid); font-size: .875rem; font-weight: 500; transition: all .2s; margin-bottom: 2px; cursor: pointer; }
  .nav-item .ico { width: 18px; font-size: 1rem; }
  .nav-item:hover, .nav-item.active { background: var(--primary-light); color: var(--primary); }
  .nav-item.active { font-weight: 600; }
  .nav-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-left: auto; animation: pulse 2s infinite; }
  @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
  .sidebar-divider { height: 1px; background: var(--border); margin: 10px 16px; }

  /* MAIN */
  .main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); padding: 28px 28px 60px; }
  .breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
  .breadcrumb a { text-decoration: none; color: var(--text-light); font-size: .82rem; }
  .breadcrumb a:hover { color: var(--primary); }
  .breadcrumb .ico { font-size: .7rem; color: var(--text-light); }
  .breadcrumb span { font-size: .82rem; font-weight: 600; }
  .page-title { font-size: 1.5rem; font-weight: 800; font-family: 'Nunito', sans-serif; margin-bottom: 24px; }
  .page-title a { color: inherit; text-decoration: none; }
  .page-title a:hover { color: var(--primary); }
  a:focus-visible, button:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

  /* STAT CARDS */
  .stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
  .stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; transition: transform .25s, box-shadow .25s; min-width: 0; }
  .stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
  .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
  .stat-icon.purple { background: #f0ecff; color: #7c5cbf; }
  .stat-icon.blue   { background: #e8f4ff; color: #3b82f6; }
  .stat-icon.pink   { background: #ffeef5; color: #e91e8c; }
  .stat-icon.orange { background: var(--primary-light); color: var(--primary); }
  .stat-icon.green  { background: #e6faf7; color: var(--accent); }
  .stat-label { font-size: .78rem; color: var(--text-light); font-weight: 500; margin-bottom: 4px; }
  .stat-value { font-size: clamp(1.15rem, 1.9vw, 1.7rem); font-weight: 800; font-family: 'Nunito', sans-serif; line-height: 1.15; }
  .stat-trend { display: flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 600; margin-top: 6px; color: #10b981; }

  /* CARDS */
  .bottom-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; margin-bottom: 22px; }
  .card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); min-width: 0; }
  .card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
  .card-title { font-size: 1rem; font-weight: 700; font-family: 'Nunito', sans-serif; }
  .card-action { font-size: .78rem; font-weight: 600; color: var(--primary); background: none; border: 0; font-family: inherit; display: flex; align-items: center; gap: 4px; cursor: pointer; transition: opacity .2s; }
  .card-action:hover { opacity: .75; }
  .chart-wrap { padding: 18px 22px; position: relative; height: 300px; }
  canvas { width: 100% !important; }
  .donut-wrap { padding: 18px 22px 6px; position: relative; height: 270px; }
  .chart-summary { display: flex; gap: 16px; padding: 0 22px 20px; }
  .cs-pill { flex: 1; background: var(--bg); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
  .cs-pill-val { font-size: 1.15rem; font-weight: 800; font-family: 'Nunito', sans-serif; }
  .cs-pill-label { font-size: .7rem; color: var(--text-light); margin-top: 2px; }
  .cs-pill.m .cs-pill-val { color: #3b82f6; } .cs-pill.f .cs-pill-val { color: #e91e8c; }

  .footer-note { margin-top: 30px; text-align: center; font-size: .78rem; color: var(--text-light); }
  .footer-note a { color: var(--primary); text-decoration: none; }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 6px; }

  /* DETAILS DIALOG */
  dialog { border: 0; border-radius: var(--radius); padding: 0; max-width: 520px; width: calc(100% - 32px); background: var(--card-bg); color: var(--text-dark); box-shadow: 0 30px 70px rgba(0,0,0,.35); margin: auto; }
  dialog::backdrop { background: rgba(20,20,40,.5); }
  .dlg-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
  .dlg-head h3 { font-family: 'Nunito', sans-serif; font-size: 1.05rem; }
  .dlg-x { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--text-light); line-height: 1; }
  .dtable { width: 100%; border-collapse: collapse; }
  .dtable thead tr { background: var(--bg); }
  .dtable th { padding: 11px 22px; text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); }
  .dtable td { padding: 13px 22px; font-size: .86rem; color: var(--text-mid); border-top: 1px solid var(--border); }
  .dtable .n { text-align: right; font-variant-numeric: tabular-nums; }

  /* Header menu button: on wide screens it hides / shows the sidebar */
  .main { transition: margin-left .3s ease; }
  @media (min-width: 769px) {
    .layout.nav-collapsed .sidebar { transform: translateX(-100%); }
    .layout.nav-collapsed .main { margin-left: 0; }
  }

  /* RESPONSIVE */
  @media (max-width: 1100px) { .stat-card { padding: 16px 14px; gap: 10px; } .stat-icon { width: 40px; height: 40px; font-size: 1.2rem; } }
  @media (max-width: 1100px) { .bottom-grid { grid-template-columns: 1fr; } }
  @media (max-width: 768px) {
    .topnav { padding-left: 14px; padding-right: 14px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
    .main { margin-left: 0; padding: 18px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stats-grid .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; } /* 5th card spans the full row */
    .stat-card { padding: 14px 12px; gap: 10px; min-width: 0; }
    .stat-icon { width: 38px; height: 38px; font-size: 1.15rem; }
    .stat-label { font-size: .74rem; }
    .stat-value { font-size: 1.35rem; overflow-wrap: anywhere; }
    .stat-trend { font-size: .68rem; flex-wrap: wrap; }
    .nav-search, .user-name, .hide-sm { display: none; }
    .user-pill { padding: 5px; }
  }
  @media (max-width: 480px) { .logo-text { font-size: .95rem; } }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== PHP app additions ===== */
.stat-card .stat-trend .ico { font-size: .8rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: 600 .85rem 'Plus Jakarta Sans', sans-serif; cursor: pointer; text-decoration: none; transition: background .2s, opacity .2s; }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--bg); color: var(--text-mid); border-color: var(--border); }
.btn.secondary:hover { background: var(--primary-light); color: var(--primary); }
.btn.danger { background: #ef4444; border-color: #ef4444; }
.btn.danger:hover { background: #dc2626; }
.btn.sm { padding: 6px 12px; font-size: .75rem; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 16px; border: 1px solid; }
.alert.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert.info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .alert.error { background:#3a1a1a; color:#fca5a5; border-color:#5b2323; }
  :root:not([data-theme="light"]) .alert.success { background:#12302a; color:#6ee7b7; border-color:#1d5a49; }
  :root:not([data-theme="light"]) .alert.info { background:#172544; color:#93c5fd; border-color:#24407a; }
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.field input[type=text], .field input[type=password], .field input[type=number] { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem 'Plus Jakarta Sans', sans-serif; }
.field input:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.field small { display: block; margin-top: 4px; font-size: .72rem; color: var(--text-light); }
.field.check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.section-title { font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .95rem; color: var(--primary); grid-column: 1 / -1; padding-top: 6px; }
.card-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.center-card { width: 100%; max-width: 440px; }
.center-card.wide { max-width: 760px; }
.center-card .brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 0; }
.center-card .brand h1 { font-family: 'Nunito', sans-serif; font-size: 1.15rem; font-weight: 800; line-height: 1.25; }
.center-card .brand p { font-size: .78rem; color: var(--text-light); }
.center-card form.stack { padding: 22px; display: grid; gap: 16px; }
.center-card .pad { padding: 22px; }

.req-list { list-style: none; padding: 0 22px 8px; display: grid; gap: 8px; }
.req-list li { display: flex; gap: 10px; align-items: center; font-size: .85rem; color: var(--text-mid); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: #10b981; } .dot.bad { background: #ef4444; }
.log { background: #0f1020; color: #cfd3ea; font: .78rem/1.6 ui-monospace, Menlo, Consolas, monospace; padding: 16px; border-radius: 10px; overflow-x: auto; max-height: 320px; white-space: pre-wrap; margin: 0 22px 16px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-orange { background: var(--primary-light); color: var(--primary); }
.table-wrap { overflow-x: auto; }
.mtable { width: 100%; border-collapse: collapse; }
.mtable th { padding: 11px 22px; text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); background: var(--bg); }
.mtable td { padding: 13px 22px; font-size: .85rem; color: var(--text-mid); border-top: 1px solid var(--border); }
.mtable td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 18px 22px; }
.actions-row form { display: inline; }
.empty { padding: 28px; text-align: center; color: var(--text-light); font-size: .9rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

button.nav-item { width: 100%; background: none; border: 0; font-family: inherit; text-align: left; }
.nav-form { margin: 0; }
.user-pill a, .user-pill { text-decoration: none; color: inherit; }
.danger-zone { border-color: #fecaca; }
.danger-zone .card-title { color: #dc2626; }
.inline-field { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-field input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .85rem 'Plus Jakarta Sans', sans-serif; width: 140px; }
.page-sub { color: var(--text-light); font-size: .85rem; margin: -16px 0 22px; }

/* ===== Data Upload ===== */
.upload-card { margin-bottom: 22px; }
.upload-intro { padding: 16px 22px 4px; font-size: .86rem; color: var(--text-mid); line-height: 1.6; }
.pad-x { padding: 0 22px; }
.step { display: flex; align-items: center; gap: 10px; padding: 18px 22px 10px; font: 800 .92rem 'Nunito', sans-serif; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .75rem; display: inline-flex; align-items: center; justify-content: center; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 30px 18px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg); cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-light); }
.dropzone .ico { font-size: 2rem; color: var(--primary); }
.dropzone.has-file { border-style: solid; border-color: var(--primary); }
.dz-main { font-weight: 700; font-size: .95rem; word-break: break-all; }
.dz-main u { color: var(--primary); }
.dz-sub { font-size: .76rem; color: var(--text-light); }
.progress-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .82rem; color: var(--text-mid); margin: 16px 0 8px; }
.progress { height: 10px; border-radius: 10px; background: var(--grid); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .25s ease; }
#msgBox:not(:empty) { margin-top: 16px; }
#msgBox .alert, #warnBox .alert { margin-bottom: 0; }
.sum-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.sum-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.sum-val { font: 800 1.15rem 'Nunito', sans-serif; }
.sum-label { font-size: .7rem; color: var(--text-light); margin-top: 2px; }
#warnBox:not(:empty) { margin-bottom: 14px; }
.preview { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.preview .mtable th, .preview .mtable td { padding: 9px 12px; white-space: nowrap; font-size: .78rem; }
.preview .mtable td.cell-addr { white-space: normal; min-width: 220px; max-width: 320px; }
.hint { font-size: .75rem; color: var(--text-light); margin-top: 8px; }
.field select { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem 'Plus Jakarta Sans', sans-serif; }
.field select:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.field.check input { margin-top: 3px; accent-color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
#doneBox:not(:empty) { padding-bottom: 6px; margin-top: 16px; }
.done-actions { padding: 14px 0 12px; }
.howto { list-style: none; padding: 16px 22px 20px; display: grid; gap: 10px; font-size: .84rem; color: var(--text-mid); line-height: 1.5; }
.howto li { padding-left: 16px; position: relative; }
.howto li::before { content: ''; position: absolute; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.mtable form { display: inline; }
@media (max-width: 900px) { .sum-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .sum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- Reports page ---- */
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px 22px; }
.filter-grid .wide { grid-column: span 2; }
.field input[type=search] { width: 100%; }
.report-table th, .report-table td { padding: 10px 12px; white-space: nowrap; font-size: .8rem; }
.report-table td.cell-addr { white-space: normal; min-width: 220px; max-width: 320px; }
.muted { color: var(--text-light); font-weight: 500; font-size: .82rem; }
.pager { justify-content: space-between; }
@media (max-width: 900px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .filter-grid { grid-template-columns: 1fr; } .filter-grid .wide { grid-column: auto; } }

/* GEOGRAPHICAL VOTER ANALYSIS */
#geo-card { margin-bottom: 22px; }
#geo-card .card-title { display: inline-flex; align-items: center; gap: 10px; }
#geo-card .card-title svg { width: 20px; height: 20px; }
.geo-toggle { display: flex; gap: 8px; flex-wrap: wrap; }
.geo-toggle .btn { background: transparent; color: var(--primary); }
.geo-toggle .btn:hover { background: var(--primary-light); }
.geo-toggle .btn.active { background: var(--primary); color: #fff; }
.geo-note { padding: 0 22px 16px; font-size: .75rem; min-height: 1em; }

/* GEOGRAPHICAL VOTER DETAILS */
#geo-detail-card { margin-bottom: 22px; }
#geo-detail-card .card-title { display: inline-flex; align-items: center; gap: 10px; }
#geo-detail-card .card-title svg { width: 20px; height: 20px; }
.gd-tabs { display: flex; gap: 4px; padding: 14px 22px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.gd-tab { background: none; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; padding: 10px 20px; margin-bottom: -1px; font: 500 .95rem 'Plus Jakarta Sans', sans-serif; color: var(--primary); cursor: pointer; }
.gd-tab:hover { background: var(--primary-light); }
.gd-tab.active { background: var(--card-bg); border-color: var(--border); color: var(--text-mid); cursor: default; }
.gd-body { padding: 8px 22px 22px; }
.gd-scroll { max-height: 520px; overflow: auto; }
.gd-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.gd-table th { position: sticky; top: 0; background: var(--card-bg); text-align: left; padding: 14px 12px; font-size: .9rem; font-weight: 700; color: var(--text-dark); border-bottom: 2px solid var(--text-dark); white-space: nowrap; }
.gd-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); font-size: .95rem; color: var(--text-dark); vertical-align: middle; }
.gd-table td.empty { text-align: center; color: var(--text-light); }
.gd-name small { display: block; margin-top: 2px; font-size: .72rem; font-weight: 500; color: var(--text-light); }
.gd-link { color: #0d6efd; text-decoration: none; font-variant-numeric: tabular-nums; }
.gd-link:hover { text-decoration: underline; }
.gd-cov { display: inline-block; vertical-align: middle; width: min(220px, 70%); height: 22px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.gd-cov span { display: block; height: 100%; min-width: 2px; background: #198754; border-radius: 6px; }
.gd-pct { margin-left: 8px; font-size: .75rem; color: var(--text-light); font-variant-numeric: tabular-nums; }
.gd-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.gd-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px 12px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; cursor: pointer; font-family: inherit; transition: box-shadow .2s, transform .2s; }
.gd-tile:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.gd-num { font-size: 2rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.gd-lbl { font-size: 1rem; color: var(--text-light); }
.c-blue { color: #0d6efd; } .c-green { color: #198754; } .c-yellow { color: #ffc107; } .c-cyan { color: #0dcaf0; }
@media (max-width: 700px) { .gd-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gd-tab { padding: 9px 12px; font-size: .85rem; } .gd-body, .gd-tabs { padding-left: 14px; padding-right: 14px; } }

/* ---- Public Voter Search ---- */
.pub-page { background: var(--bg); }
.pub-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + var(--safe-top)) 20px 12px; background: var(--card-bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.pub-top .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.pub-admin { font-size: .8rem; font-weight: 600; color: var(--text-mid); text-decoration: none; padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg); }
.pub-admin:hover { color: var(--primary); background: var(--primary-light); }
.pub-main { max-width: 900px; margin: 0 auto; padding: 28px 18px 60px; padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
.pub-card { padding: 18px; margin-bottom: 20px; }
.pub-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pub-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pub-chip span { display: inline-block; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); color: var(--text-mid); font-size: .8rem; font-weight: 600; cursor: pointer; }
.pub-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pub-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.pub-inputrow { display: flex; gap: 8px; align-items: stretch; }
.pub-inputrow input[type=search] { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: 1rem 'Plus Jakarta Sans', sans-serif; }
.pub-inputrow input[type=search]:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.pub-mic { flex: 0 0 auto; width: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-mid); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pub-mic .ico { width: 22px; height: 22px; fill: currentColor; }
.pub-mic:hover { background: var(--primary-light); color: var(--primary); }
.pub-mic.on { background: #ef4444; border-color: #ef4444; color: #fff; animation: pubpulse 1.2s infinite; }
@keyframes pubpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }
.pub-hint { margin-top: 10px; font-size: .75rem; color: var(--text-light); min-height: 1em; }
.pub-count { font-size: .85rem; color: var(--text-mid); margin: 0 0 12px; }
.pub-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pub-item { padding: 16px; }
.pub-name { font-weight: 800; font-size: 1rem; color: var(--text-dark); overflow-wrap: anywhere; }
.pub-rel { font-size: .82rem; color: var(--text-mid); margin: 2px 0 10px; overflow-wrap: anywhere; }
.pub-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-place { margin-top: 10px; font-size: .78rem; color: var(--text-light); }
@media (max-width: 640px) { .pub-results { grid-template-columns: 1fr; } .pub-inputrow .btn { padding-left: 14px; padding-right: 14px; } }
.pub-page .mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
.pub-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 12px 0 0; }
.pub-details dt { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); }
.pub-details dd { margin: 1px 0 0; font-size: .85rem; color: var(--text-dark); overflow-wrap: anywhere; }
.pub-addr { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-mid); overflow-wrap: anywhere; }
.pub-addr span { display: block; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); margin-bottom: 2px; }

/* ---- Multi-tenant: Admins page ---- */
.inline-field select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .85rem 'Plus Jakarta Sans', sans-serif; max-width: 260px; }
.badge-red { background: #fee2e2; color: #991b1b; }
.tenant-cell strong { display: block; color: var(--text-dark); }
.tenant-cell small { color: var(--text-light); font-size: .74rem; }
.tenant-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 210px; }
.tenant-actions details { width: 100%; }
.tenant-actions summary { cursor: pointer; font-size: .75rem; font-weight: 700; color: var(--primary); }
.tenant-actions details form { margin-top: 8px; }
.tenant-actions details .inline-field input { width: 150px; }
.tenant-link { font-size: .78rem; word-break: break-all; }

/* ---- reports.php: copy protection ---- */
body.protect-data { -webkit-touch-callout: none; }
body.protect-data .report-table,
body.protect-data .report-table * {
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
body.protect-data input, body.protect-data textarea, body.protect-data select {
  -webkit-user-select: text; user-select: text;
}
body.protect-data .report-table img { -webkit-user-drag: none; pointer-events: none; }
@media print {
  body.protect-data .table-wrap, body.protect-data .report-table { display: none !important; }
  body.protect-data::after { content: "Printing is disabled on this page."; display: block; padding: 24px; font-size: 1.2rem; }
}

/* ---- settings.php ---- */
.settings-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.settings-tab-btn { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text-mid); font: 600 .82rem 'Plus Jakarta Sans', sans-serif; cursor: pointer; transition: background .2s, color .2s; }
.settings-tab-btn:hover { background: var(--primary-light); color: var(--primary); }
.settings-tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }
.field input[type=email], .field input[type=tel] { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem 'Plus Jakarta Sans', sans-serif; }
.field input[type=email]:focus, .field input[type=tel]:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.sim-status { padding: 16px 22px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.settings-tab-panel code { background: var(--bg); padding: 1px 6px; border-radius: 6px; font-size: .78rem; }

/* ---- domain.php: WhatsApp share ---- */
.wa-share { align-items: flex-end; }
.btn.wa-btn { background: #25d366; border-color: #25d366; color: #fff; }
.btn.wa-btn:hover { background: #1ebe5b; border-color: #1ebe5b; }

/* ===== Banner & Video ===== */
.media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
.field input[type=file] { width: 100%; padding: 9px 12px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .85rem 'Plus Jakarta Sans', sans-serif; }
.media-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.media-thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); flex: 0 0 auto; }
.media-link { font-size: .72rem; overflow-wrap: anywhere; max-width: 260px; }
.media-actions { display: flex; gap: 8px; justify-content: flex-end; }
.media-actions form { margin: 0; }
@media (max-width: 900px) { .media-grid { grid-template-columns: 1fr; } }
dialog.pub-pop { position: fixed; inset: 0; margin: auto; width: calc(100% - 28px); max-width: 640px; max-height: calc(100% - 40px); overflow: visible; background: transparent; box-shadow: none; padding: 0; }
.pub-pop::backdrop { background: rgba(20,20,40,.65); }
.pub-pop-body { display: grid; gap: 12px; max-height: calc(100vh - 40px); overflow-y: auto; border-radius: var(--radius); }
.pub-pop-item { display: block; border-radius: var(--radius); overflow: hidden; background: var(--card-bg); box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.pub-pop-item img { display: block; width: 100%; height: auto; }
.pub-pop-x { position: absolute; top: -14px; right: -6px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 2px solid #fff; background: #ef4444; color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.pub-pop-x:hover { background: #dc2626; }
.pub-pop-x:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pub-videos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 26px; }
.pub-video { margin: 0; padding: 14px; }
.pub-video figcaption { font-weight: 700; font-size: .9rem; margin-bottom: 10px; overflow-wrap: anywhere; }
.pub-video-box { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; }
.pub-video-box img, .pub-video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.pub-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pub-play svg { width: 64px; height: 64px; padding: 16px 14px 16px 18px; border-radius: 50%; background: rgba(0,0,0,.65); fill: #fff; transition: transform .2s, background .2s; }
.pub-video-box:hover .pub-play svg { transform: scale(1.08); background: #ef4444; }
.pub-video-box:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) { .pub-videos { grid-template-columns: 1fr; } }

.pub-banners { display: grid; gap: 14px; margin: 0 0 22px; }
.pub-banner { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); background: var(--card-bg); }
.pub-banner img { display: block; width: 100%; height: auto; }

/* ===== Public EPIC update ===== */
.pub-epic { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.pub-epic summary { cursor: pointer; font-size: .78rem; font-weight: 700; color: var(--primary); list-style: none; }
.pub-epic summary::-webkit-details-marker { display: none; }
.pub-epic summary::before { content: '\270E\00a0'; }
.pub-epic form { margin-top: 10px; display: grid; gap: 6px; }
.pub-epic label { font-size: .74rem; font-weight: 600; color: var(--text-mid); }
.pub-epic-row { display: flex; gap: 8px; }
.pub-epic-row input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem ui-monospace, Menlo, Consolas, monospace; }
.pub-epic-row input:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.pub-epic small { font-size: .7rem; color: var(--text-light); }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.pub-epic { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.pub-epic summary { cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--primary); list-style: none; }
.pub-epic summary::-webkit-details-marker { display: none; }
.pub-epic summary::before { content: "+ "; }
.pub-epic[open] summary::before { content: "\2212  "; }
.pub-epic form { display: flex; gap: 8px; margin-top: 10px; }
.pub-epic input[type=text] { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font-size: .9rem; text-transform: uppercase; }
.pub-epic input[type=text]:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.pub-epic small { display: block; margin-top: 6px; font-size: .72rem; color: var(--text-light); }

/* Get it on WhatsApp (public voter search) */
.pub-item { position: relative; }
.pub-item.has-wa .pub-name { padding-right: 150px; }
.pub-wa { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 0; border-radius: 999px; background: #25d366; color: #fff; font-family: inherit; font-weight: 700; font-size: .72rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(37,211,102,.35); }
.pub-wa:hover { background: #1ebe5b; }
.pub-wa:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pub-wa svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
@media (max-width: 380px) { .pub-item.has-wa .pub-name { padding-right: 0; margin-top: 30px; } }
dialog.wa-dlg { margin: auto; width: calc(100% - 28px); max-width: 380px; padding: 20px; border: 0; border-radius: var(--radius); background: var(--card-bg); color: var(--text-dark); box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.wa-dlg::backdrop { background: rgba(20,20,40,.65); }
.wa-dlg h2 { margin: 0 0 4px; font-size: 1.05rem; }
.wa-dlg p { margin: 0 0 14px; font-size: .8rem; color: var(--text-mid); }
.wa-row { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); overflow: hidden; }
.wa-row span { display: flex; align-items: center; padding: 0 10px; font-size: .9rem; font-weight: 700; color: var(--text-mid); border-right: 1px solid var(--border); }
.wa-row input { flex: 1; min-width: 0; padding: 11px 12px; border: 0; background: transparent; color: var(--text-dark); font-size: 1rem; }
.wa-row input:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.wa-err { min-height: 1.1em; margin-top: 8px; font-size: .75rem; color: #dc2626; }
.wa-actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.field textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem 'Plus Jakarta Sans', sans-serif; resize: vertical; }
.field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }

/* On/off switch (Banner & Video page) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; }
.switch { position: relative; flex: 0 0 auto; display: inline-block; width: 50px; height: 28px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: background .2s; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .switch-track { background: #22c55e; }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--primary); outline-offset: 2px; }
.pub-banners-results { margin: 18px 0 0; }

/* Sign-in card: icon sits above a centred title */
.center-card.brand-center .brand { flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding-top: 28px; }
.center-card.brand-center .brand .logo-icon { width: 64px; height: 64px; border-radius: 18px; box-shadow: var(--shadow-sm); }
.center-card.brand-center .brand .logo-icon svg { width: 34px; height: 34px; }
.center-card.brand-center .brand h1 { font-size: 1.3rem; }
.center-card.brand-center .brand p { margin-top: 4px; }

/* ===== Public voter search: fully responsive (all phones, tablets, desktop) ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.pub-page img { max-width: 100%; }
.pub-page button, .pub-page .btn, .pub-chip span { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pub-top { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
.pub-top .logo { flex: 1 1 auto; min-width: 0; }
.pub-top .logo-text { min-width: 0; }
.pub-admin { flex: 0 0 auto; white-space: nowrap; }
.pub-main { width: 100%; min-width: 0; padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }

/* WhatsApp button: stays in the top-right corner, and the name wraps around it instead of being squeezed */
.pub-item.has-wa .pub-name { padding-right: 0; margin-top: 0; }
.pub-wa { position: static; float: right; margin: 0 0 8px 10px; padding: 8px 12px; }
.pub-item::after { content: ''; display: block; clear: both; }
.pub-item { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .pub-top { gap: 10px; padding-top: calc(10px + var(--safe-top)); padding-bottom: 10px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .pub-top .logo { gap: 8px; }
  .pub-top .logo-icon { width: 34px; height: 34px; }
  .pub-top .logo-text { font-size: .9rem; line-height: 1.15; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .pub-admin { padding: 8px 12px; font-size: .76rem; }
  .pub-main { padding-top: 18px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
  .pub-main .page-title { font-size: 1.25rem; margin-bottom: 20px; }
  .pub-main .page-sub { font-size: .8rem; line-height: 1.5; margin: -14px 0 16px; }
  .pub-card { padding: 14px; margin-bottom: 16px; }

  /* four search modes in one tidy row */
  .pub-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
  .pub-chip span { display: block; width: 100%; text-align: center; padding: 10px 2px; font-size: .75rem; white-space: nowrap; }

  /* input on its own line, mic + Search below it */
  .pub-inputrow { flex-wrap: wrap; gap: 8px; }
  .pub-inputrow input[type=search] { flex: 1 1 100%; min-height: 48px; }
  .pub-mic { flex: 0 0 52px; width: 52px; min-height: 48px; }
  .pub-inputrow .btn[type=submit] { flex: 1 1 0; min-height: 48px; font-size: .95rem; }
  .pub-mic[hidden] + .btn[type=submit] { flex-basis: 100%; }

  .pub-count { font-size: .8rem; line-height: 1.45; }
  .pub-results { gap: 12px; }
  .pub-item { padding: 14px; }
  .pub-name { font-size: 1rem; line-height: 1.3; }
  .pub-wa { padding: 9px 12px; font-size: .72rem; }
  .pub-epic summary { display: block; padding: 8px 0; font-size: .82rem; }
  .pub-epic input[type=text] { font-size: 16px; min-height: 44px; }
  .pub-epic form .btn { min-height: 44px; }

  .pub-videos { margin-top: 20px; gap: 12px; }
  .pub-video { padding: 12px; }
  .pub-banners { gap: 10px; margin-bottom: 16px; }
  .footer-note { margin-top: 24px; padding: 0 6px; }

  dialog.pub-pop { width: calc(100% - 24px); max-height: calc(100dvh - 32px); }
  .pub-pop-body { max-height: calc(100dvh - 32px); }
  dialog.wa-dlg { width: calc(100% - 24px); padding: 18px; max-height: calc(100dvh - 24px); overflow-y: auto; }
  .wa-row input { font-size: 16px; padding: 13px 12px; }
  .wa-actions .btn { min-height: 44px; flex: 1; }
}
@media (max-width: 400px) {
  .pub-details { gap: 8px 10px; }
  .pub-meta .badge { font-size: .7rem; padding: 3px 9px; }
}
@media (max-width: 340px) {
  .pub-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pub-details { grid-template-columns: 1fr; }
  .pub-top .logo-text { font-size: .82rem; }
}
/* very short landscape phones: keep the header from eating the screen */
@media (max-height: 460px) and (orientation: landscape) { .pub-top { position: static; } }
.pub-mic[hidden] { display: none; }

/* Dashboard "Banner & Video on your public page": 3 boxes per row on mobile (3 + 2) */
@media (max-width: 768px) {
  #media-card .chart-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px 14px 16px !important; }
  #media-card .cs-pill { grid-column: span 2; min-width: 0; padding: 10px 4px; }
  #media-card .cs-pill:nth-child(n+4) { grid-column: span 3; }
  #media-card .cs-pill-val { font-size: 1.05rem; }
  #media-card .cs-pill-label { font-size: .66rem; line-height: 1.25; }
}

/* Super admin dashboard: Live voter activity */
.act-head-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.act-live { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .08em; padding: 4px 10px; border-radius: 20px; background: #fee2e2; color: #991b1b; }
.act-live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.act-live.on { background: #d1fae5; color: #065f46; }
.act-live.on::before { animation: act-pulse 1.4s ease-in-out infinite; }
.act-live.paused { background: #fef3c7; color: #92400e; }
@keyframes act-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.act-updated { font-size: .75rem; color: var(--text-light); }
.act-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; padding: 18px 22px 4px; }
.act-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.act-kpi b { display: block; font-size: 1.35rem; color: var(--text-dark); line-height: 1.2; }
.act-kpi span { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-light); }
.act-kpi small { display: block; font-size: .7rem; color: var(--text-light); margin-top: 2px; }
.act-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.act-grid .act-cell { border-top: 1px solid var(--border); }
.act-grid .act-cell:nth-child(odd) { border-right: 1px solid var(--border); }
.act-cell h4 { margin: 0; padding: 16px 22px 0; font-size: .85rem; color: var(--text-dark); }
.act-cell .chart-wrap { height: 280px; }
.act-cell { position: relative; }
.act-empty { padding: 28px 22px; text-align: center; color: var(--text-light); font-size: .85rem; list-style: none; }
.act-chart-empty { position: absolute; inset: 50px 0 0; display: flex; align-items: center; justify-content: center; color: var(--text-light); font-size: .85rem; pointer-events: none; }
.act-chart-empty[hidden] { display: none; }
.act-feed-wrap { border-top: 1px solid var(--border); }
.act-feed-wrap h4 { margin: 0; padding: 16px 22px 8px; font-size: .85rem; color: var(--text-dark); }
#act-feed { list-style: none; margin: 0; padding: 0 0 8px; max-height: 420px; overflow-y: auto; }
.act-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 22px; border-top: 1px solid var(--border); }
.act-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.act-body { flex: 1; min-width: 0; }
.act-line { font-size: .85rem; color: var(--text-dark); overflow-wrap: anywhere; }
.act-ref { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .75rem; color: var(--text-light); margin-left: 6px; }
.act-sub { font-size: .76rem; color: var(--text-light); overflow-wrap: anywhere; }
.act-time { flex: none; font-size: .74rem; color: var(--text-light); white-space: nowrap; }
@media (max-width: 1100px) { .act-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) {
  .act-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 14px 2px; }
  .act-grid { grid-template-columns: 1fr; }
  .act-grid .act-cell:nth-child(odd) { border-right: 0; }
  .act-item { padding: 10px 14px; }
}
.act-series { padding-top: 12px; }
.act-ser b { font-size: 1.2rem; }

/* Digital Marketing sidebar group */
.nav-group { margin-bottom: 2px; }
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary .ico:last-child { margin-left: auto; transition: transform .2s; }
.nav-group[open] > summary .ico:last-child { transform: rotate(90deg); }
.nav-sub { margin: 2px 0 4px 14px; padding-left: 8px; border-left: 2px solid var(--border); }
.nav-sub .nav-item { padding: 8px 12px; font-size: .84rem; }
.field textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text-dark); font: .9rem 'Plus Jakarta Sans', sans-serif; resize: vertical; min-height: 110px; }
.field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; background: var(--card-bg); }
.progress { height: 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; min-width: 120px; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; }
@media (max-width: 900px) { .mk-grid { grid-template-columns: 1fr; } }

/* AI Poster Generator */
.page-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head-row .page-title { margin-bottom: 0; }
.page-head-row .btn { flex-shrink: 0; white-space: nowrap; }
dialog.poster-dialog { max-width: 760px; max-height: calc(100vh - 32px); overflow: hidden; }
dialog.poster-dialog > form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.poster-body { overflow-y: auto; padding: 0 0 12px; }
.poster-footer { justify-content: flex-end; background: var(--card-bg); }
.poster-asset-row { display: flex; align-items: center; gap: 10px; }
.poster-asset-row input[type=file] { flex: 1; min-width: 0; font-size: .8rem; }
.poster-thumb { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.poster-thumb[hidden], .poster-remove[hidden] { display: none; }
.poster-url { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.poster-url[hidden] { display: none; }
.poster-url input { flex: 1; min-width: 0; font-size: .72rem; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text-mid); }
.poster-remove { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: .75rem; font-weight: 500; color: var(--text-mid); }
.poster-body .alert, .poster-body .poster-result { margin: 0 22px 14px; }
.poster-result { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.poster-result textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-bg); color: var(--text-dark); font: .78rem ui-monospace, Menlo, Consolas, monospace; resize: vertical; }

/* Social post image */
.post-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); flex-shrink: 0; }
.post-cell { display: flex; gap: 12px; align-items: flex-start; }
.post-preview { max-width: 220px; max-height: 140px; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; object-fit: contain; }
.post-preview[hidden] { display: none; }

.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.head-actions .btn { flex-shrink: 0; white-space: nowrap; }
