/* =============================================
   DMPR Licence Verification Portal — styles.css
   ============================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy: #1b6b2f;
  --navy-dark: #134d22;
  --gold: #ffffff;
  --gold-light: #d4edda;
  --gold-dim: #ffffff18;
  --white: #ffffff;
  --off-white: #f2f9f4;
  --surface: #ffffff;
  --border: #c3dfc9;
  --text: #0f2d18;
  --muted: #4a7058;
  --danger: #c0392b;
  --danger-dim: #c0392b12;
  --warn: #b45309;
  --warn-dim: #fef3c7;
  --warn-border: #fcd34d;
  --valid: #1b6b2f;
  --valid-dim: #1b6b2f12;
  --mono: "IBM Plex Mono", monospace;
  --sans: "Inter", sans-serif;
}

body {
  background: var(--off-white);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.site-footer {
  width: 100%;
  margin-top: auto;
  padding: 42px max(24px, calc((100% - 1120px) / 2)) 22px;
  background: var(--navy-dark);
  color: var(--white);
}
.site-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(220px, 1fr) minmax(
      150px,
      0.7fr
    );
  gap: 42px;
}
.site-footer h2 {
  margin-bottom: 14px;
  color: var(--white);
  font-size: 16px;
  line-height: 1.3;
}
.site-footer p,
.site-footer address,
.site-footer a {
  color: #d4edda;
  font-size: 13px;
  line-height: 1.7;
}
.site-footer address {
  margin-bottom: 10px;
  font-style: normal;
}
.site-footer a {
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--white);
  text-decoration: underline;
}
.site-footer nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.site-footer-copyright {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #a8d4b0 !important;
  font-size: 12px !important;
}

@media (max-width: 760px) {
  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
}

/* ── TOP BAR ── */
.topbar {
  width: 100%;
  background: var(--white);
  padding: 12px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-dept {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.topbar-dept strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-flag {
  height: 90px;
  width: auto;
  display: block;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.topbar-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-decoration: none;
}
.topbar-link:hover {
  color: var(--text);
}
.topbar-qr-btn {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--white);
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 5px;
  padding: 4px 10px;
  text-decoration: none;
  transition: background 0.15s;
}
.topbar-qr-btn:hover {
  background: var(--navy-dark);
}

/* ── HERO BANNER ── */
.hero {
  width: 100%;
  background: var(--navy);
  padding: 36px 24px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-bottom: 4px solid var(--gold);
}
.hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(22px, 4vw, 34px);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 10px;
}
.hero-sub {
  font-size: 14px;
  color: #a8d4b0;
  font-weight: 300;
  max-width: 480px;
}

/* ── MAIN CONTENT ── */
.main {
  width: 100%;
  max-width: 680px;
  padding: 40px 16px 80px;
}

/* ── SEARCH CARD ── */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 28px;
}
.search-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.search-row {
  display: flex;
  gap: 10px;
}
.search-input {
  flex: 1;
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search-input::placeholder {
  color: #9aaabb;
}
.search-input:focus {
  border-color: var(--navy);
  background: var(--white);
}

.search-btn {
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 7px;
  color: var(--white);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 13px 26px;
  transition: background 0.15s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.search-btn:hover {
  background: var(--navy-dark);
}

.search-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ── RESULT PANEL ── */
#result-panel {
  display: none;
  margin-bottom: 20px;
}

.result-card {
  border-radius: 10px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

/* VALID */
.result-card.is-valid .result-header {
  background: var(--valid-dim);
  border-bottom: 2px solid var(--valid);
}
.result-card.is-valid .status-icon {
  color: var(--valid);
}
.result-card.is-valid .status-title {
  color: var(--valid);
}

/* EXPIRED */
.result-card.is-expired .result-header {
  background: var(--warn-dim);
  border-bottom: 2px solid var(--warn-border);
}
.result-card.is-expired .status-icon {
  color: var(--warn);
}
.result-card.is-expired .status-title {
  color: var(--warn);
}

/* INVALID / FAKE */
.result-card.is-invalid .result-header {
  background: var(--danger-dim);
  border-bottom: 2px solid var(--danger);
}
.result-card.is-invalid .status-icon {
  color: var(--danger);
}
.result-card.is-invalid .status-title {
  color: var(--danger);
}

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
}
.status-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}
.status-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 3px;
}
.status-desc {
  font-size: 13px;
  color: var(--muted);
}
.status-checked-at {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.result-body {
  background: var(--white);
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 600;
}
.field value {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.type-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  background: #d4edda;
  color: var(--navy);
  border: 1px solid #a8d4b0;
}

/* ── EXPIRY BADGES ── */
.expiry-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.expiry-badge.active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.expiry-badge.expiring-soon {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.expiry-badge.expired {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.result-footer {
  background: var(--off-white);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── DIVIDER ── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 8px 0 24px;
}

/* ── INFO NOTE ── */
.info-note {
  background: #d4edda;
  border: 1px solid #a8d4b0;
  border-left: 4px solid var(--navy);
  border-radius: 7px;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.6;
}
.info-note strong {
  font-weight: 600;
}

.form-introduction {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  padding: 2px 2px 0;
}
.form-introduction h2 {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
}
.form-introduction p {
  max-width: 760px;
  margin: 0;
  color: #53685a;
  line-height: 1.6;
}

/* ── QR PAGE STYLES ── */
.qr-page-main {
  width: 100%;
  max-width: 900px;
  padding: 40px 16px 80px;
}

.qr-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.qr-page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.qr-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  text-align: center;
}
.qr-card canvas {
  border-radius: 6px;
  margin-bottom: 16px;
}
.qr-company {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.qr-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.qr-type-badge {
  font-family: var(--sans);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  background: #d4edda;
  color: var(--navy);
  border: 1px solid #a8d4b0;
  margin-bottom: 12px;
  display: inline-block;
}
.qr-expiry-row {
  margin-bottom: 14px;
}
.qr-download-btn {
  width: 100%;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  transition: background 0.15s;
}
.qr-download-btn:hover {
  background: var(--navy-dark);
}

.print-btn-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}
.print-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  padding: 10px 20px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.print-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

@media print {
  .topbar,
  .hero,
  .print-btn-row {
    display: none;
  }
  .qr-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .qr-download-btn {
    display: none;
  }
}

/* =============================================
   INTERNAL ADMIN PORTAL
   ============================================= */
.admin-body {
  align-items: stretch;
}

.admin-login-wrap {
  width: 100%;
  min-height: calc(100vh - 76px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 16px;
  background:
    radial-gradient(
      circle at top left,
      rgba(27, 107, 47, 0.13),
      transparent 34%
    ),
    var(--off-white);
}

.admin-login-card {
  width: 100%;
  max-width: 460px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 45, 24, 0.12);
  padding: 34px;
}

.admin-lock {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--valid-dim);
  display: grid;
  place-items: center;
  font-size: 24px;
  margin-bottom: 18px;
}

.admin-eyebrow {
  color: var(--navy);
  margin-bottom: 8px;
}

.admin-login-card h1 {
  color: var(--text);
  font-size: 30px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.admin-login-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.admin-login-form,
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-login-form label,
.form-group label,
.standalone-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  font-weight: 700;
}

.admin-login-form input,
.form-group input,
.form-group select,
.form-group textarea,
#licenseSearch {
  width: 100%;
  border: 1.5px solid var(--border);
  background: var(--off-white);
  border-radius: 9px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.admin-login-form input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
#licenseSearch:focus {
  border-color: var(--navy);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(27, 107, 47, 0.08);
}

.form-group small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}

.demo-note,
.template-note {
  margin-top: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7fcf8;
  padding: 13px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.template-note {
  margin-top: 0;
  margin-bottom: 22px;
  color: var(--navy-dark);
  background: #d4edda;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  line-height: 1.4;
}

.primary-action,
.secondary-action,
.ghost-action {
  border: none;
  border-radius: 9px;
  padding: 12px 18px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.14s,
    box-shadow 0.14s,
    background 0.14s,
    border-color 0.14s;
  text-decoration: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.primary-action {
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 8px 18px rgba(27, 107, 47, 0.22);
}

.primary-action:hover {
  background: var(--navy-dark);
  transform: translateY(-1px);
}

.secondary-action {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border);
}

.secondary-action:hover,
.ghost-action:hover {
  border-color: var(--navy);
  transform: translateY(-1px);
}

.ghost-action {
  color: var(--navy-dark);
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid var(--border);
}

.ghost-action:disabled,
.primary-action:disabled,
.secondary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.danger-action {
  color: var(--danger);
}

.admin-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.admin-hero-panel {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: var(--white);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  box-shadow: 0 18px 40px rgba(15, 45, 24, 0.18);
}

.admin-hero-panel h1 {
  font-size: clamp(26px, 4vw, 42px);
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 12px;
}

.admin-hero-panel p {
  max-width: 680px;
  color: #d4edda;
  line-height: 1.6;
  font-size: 15px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.045);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 8px;
}

.stat-card strong {
  font-family: var(--mono);
  color: var(--navy-dark);
  font-size: 30px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.option-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  text-align: left;
  cursor: pointer;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  transition:
    border-color 0.16s,
    transform 0.16s,
    box-shadow 0.16s;
}

.option-card:hover,
.option-card.active {
  border-color: var(--navy);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(27, 107, 47, 0.13);
}

.option-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--valid-dim);
  font-size: 22px;
}

.option-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.option-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.admin-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.045);
  margin-bottom: 20px;
}

.form-section {
  display: none;
}

.active-section {
  display: block;
}

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

.section-heading h2 {
  color: var(--text);
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 5px;
}

.section-heading p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group-wide,
.preview-field.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.request-preview {
  margin-top: 24px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.preview-header {
  background: var(--off-white);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-header span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-bottom: 4px;
}

.preview-header h3 {
  color: var(--navy-dark);
  font-size: 18px;
}

.preview-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.preview-field {
  background: #f7fcf8;
  border: 1px solid #dcefe1;
  border-radius: 10px;
  padding: 13px 14px;
}

.preview-field label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.preview-field p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
}

.qr-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.admin-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin: 8px 0 14px;
}

.license-result-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.license-result-item {
  width: 100%;
  text-align: left;
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.license-result-item strong,
.license-result-item span {
  display: block;
}

.license-result-item strong {
  color: var(--text);
  margin-bottom: 4px;
}

.license-result-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.license-result-item:hover,
.license-result-item.selected {
  background: var(--white);
  border-color: var(--navy);
}

.compact-form {
  background: #f7fcf8;
  border: 1px solid #dcefe1;
  border-radius: 14px;
  padding: 18px;
}

.qr-preview-panel {
  position: sticky;
  top: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--off-white);
  padding: 20px;
}

.qr-preview-panel h3 {
  color: var(--text);
  margin-bottom: 14px;
}

.selected-license-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.selected-license-card span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.muted-card {
  color: var(--muted);
  font-family: var(--sans);
}

.qr-preview-box {
  display: grid;
  place-items: center;
  min-height: 280px;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
  padding: 15px;
  overflow: auto;
}

.qr-preview-box canvas {
  max-width: 100%;
  height: auto !important;
}

.issuer-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.35fr);
  gap: 22px;
  align-items: start;
}

.issuer-panel,
.assignment-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--off-white);
  padding: 20px;
}

.subsection-heading {
  margin-bottom: 16px;
}

.subsection-heading h3 {
  color: var(--text);
  font-size: 17px;
  margin-bottom: 4px;
}

.subsection-heading p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.one-column-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.issuer-list-wrap {
  margin-top: 18px;
}

.issuer-list-wrap h4 {
  color: var(--text);
  font-size: 14px;
  margin-bottom: 10px;
}

.issuer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow: auto;
  padding-right: 4px;
}

.issuer-card {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}

.issuer-card:hover,
.issuer-card.selected {
  border-color: var(--navy);
  box-shadow: 0 8px 18px rgba(27, 107, 47, 0.12);
  transform: translateY(-1px);
}

.issuer-card strong,
.issuer-card span,
.issuer-card small {
  display: block;
}

.issuer-card strong {
  color: var(--text);
  font-size: 14px;
  margin-bottom: 4px;
}

.issuer-card span {
  color: var(--navy-dark);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.issuer-card small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
}

.issuer-assignment-history {
  margin-top: 22px;
}

.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-pagination {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.audit-pagination span {
  min-width: 90px;
  text-align: center;
}

.history-user-heading {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  margin: 18px 0 0;
  padding: 10px 0 7px;
}

.history-user-heading small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
}

.history-user-group {
  border-bottom: 1px solid var(--line);
}

.history-user-group summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  padding: 14px 4px;
}

.history-user-group summary small,
.history-user-group summary b {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.history-user-group summary b {
  font-weight: 500;
}

.history-user-activities {
  padding-left: 16px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f7fcf8;
  padding: 16px;
}

.history-type {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 6px;
  background: #d4edda;
  color: var(--navy-dark);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.history-item h3 {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

.history-item p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.history-item small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: #f7fcf8;
  padding: 18px;
  text-align: center;
  font-size: 13px;
}

.error-state {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: #fca5a5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  background: var(--navy-dark);
  color: var(--white);
  border-radius: 12px;
  padding: 13px 16px;
  box-shadow: 0 14px 32px rgba(15, 45, 24, 0.25);
  transform: translateY(16px);
  opacity: 0;
  transition:
    transform 0.22s,
    opacity 0.22s;
  font-size: 13px;
  font-weight: 700;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 860px) {
  .stats-grid,
  .option-grid,
  .form-grid,
  .preview-grid,
  .qr-admin-grid,
  .issuer-layout {
    grid-template-columns: 1fr;
  }

  .admin-hero-panel,
  .section-heading,
  .history-item {
    flex-direction: column;
    align-items: stretch;
  }

  .qr-preview-panel {
    position: static;
  }

  .admin-search-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  .admin-login-wrap,
  .topbar,
  .admin-hero-panel,
  .stats-grid,
  .option-grid,
  .section-heading button,
  .admin-form,
  .history-section,
  .qr-section,
  #issuer-section,
  .toast {
    display: none !important;
  }

  .admin-section,
  .request-preview {
    border: none;
    box-shadow: none;
  }
}

/* =============================================
   ROLE DASHBOARD UPDATE
   ============================================= */
.dashboard-body .topbar-qr-btn[type="button"] {
  font-family: var(--sans);
}

.role-card {
  min-width: 190px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  padding: 16px;
  text-align: right;
}

.role-card span {
  display: block;
  color: #d4edda;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  margin-bottom: 6px;
}

.role-card strong {
  color: var(--white);
  font-size: 18px;
}

.option-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.issuer-account-card {
  cursor: default;
}

.issuer-account-card:hover {
  transform: none;
}

.mini-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mini-actions .ghost-action {
  padding: 8px 10px;
  font-size: 11px;
}

.dashboard-body .history-section.active-section {
  display: block;
}

@media (max-width: 980px) {
  .option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .option-grid {
    grid-template-columns: 1fr;
  }

  .role-card {
    text-align: left;
    width: 100%;
  }
}

/* Additions for SQL-backed notifications */
.portal-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid #a6d4b0;
  border-radius: 10px;
  background: #effaf2;
  box-shadow: 0 10px 30px rgba(0, 55, 24, 0.18);
  color: #0d4d23;
  font:
    600 13px/1.45 Inter,
    sans-serif;
}
.portal-toast-error {
  border-color: #e7b2b2;
  background: #fff2f2;
  color: #8f1d1d;
}

/* ── ADDED PERMIT CAPTURE / DATABASE SOURCE OPTIONS ── */
.option-card-link {
  color: inherit;
  text-decoration: none;
}
.option-card-link:hover {
  color: inherit;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.permit-capture-shell {
  max-width: 1280px;
}
.permit-capture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}
.permit-form-panel {
  display: block !important;
}
.permit-capture-form {
  display: grid;
  gap: 20px;
}
.permit-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  background: var(--white);
}
.permit-fieldset legend {
  padding: 0 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}
.form-span-2 {
  grid-column: 1 / -1;
}
.form-success {
  min-height: 20px;
  color: var(--valid);
  font-size: 13px;
  font-weight: 600;
}
.permit-result-panel {
  position: sticky;
  top: 20px;
}
.stacked-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.stacked-actions button {
  width: 100%;
}
.template-note code,
.admin-hero-panel code {
  font-family: var(--mono);
  font-size: 0.92em;
}
@media (max-width: 980px) {
  .permit-capture-layout {
    grid-template-columns: 1fr;
  }
  .permit-result-panel {
    position: static;
  }
}
@media (max-width: 700px) {
  .form-span-2 {
    grid-column: auto;
  }
  .permit-fieldset {
    padding: 15px;
  }
}

/* ── CLEAN, SCROLLABLE PERMIT PICKER ── */
.permit-picker-shell {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(19, 77, 34, 0.06);
}

.permit-picker-header {
  min-height: 46px;
  padding: 11px 14px;
  background: #f7fcf8;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permit-picker-header strong {
  color: var(--navy-dark);
  font-size: 13px;
}

.permit-picker-header span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.permit-picker-shell .license-result-list {
  max-height: min(52vh, 520px);
  min-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding: 10px;
  margin: 0;
  scrollbar-gutter: stable;
}

.permit-picker-shell .license-result-list:focus {
  outline: 2px solid rgba(27, 107, 47, 0.24);
  outline-offset: -2px;
}

.permit-picker-shell .license-result-item {
  flex: 0 0 auto;
}

.permit-picker-shell .license-result-item.selected {
  position: relative;
  border-color: var(--navy);
  background: #f2f9f4;
  box-shadow: inset 4px 0 0 var(--navy);
}

.qr-backfill-panel {
  margin: 16px 0 20px;
  border: 1px solid #a8d4b0;
  border-radius: 14px;
  background: #f2f9f4;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.qr-backfill-panel strong {
  display: block;
  color: var(--navy-dark);
  font-size: 14px;
  margin-bottom: 4px;
}

.qr-backfill-panel p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.qr-backfill-panel .secondary-action {
  flex: 0 0 auto;
  max-width: 290px;
}

@media (max-width: 760px) {
  .permit-picker-shell .license-result-list {
    max-height: 430px;
  }

  .qr-backfill-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .qr-backfill-panel .secondary-action {
    max-width: none;
    width: 100%;
  }
}

/* ── SCAN-ONLY PUBLIC VERIFICATION ── */
.scan-hero .hero-sub {
  max-width: 780px;
}
.scan-guide-main {
  max-width: 1040px;
}
.scan-guide-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 12px 34px rgba(15, 45, 24, 0.09);
}
.scan-guide-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}
.scan-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--valid-dim);
  color: var(--navy-dark);
  font-size: 32px;
  font-weight: 800;
}
.guide-kicker {
  display: block;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.scan-guide-card h2 {
  color: var(--text);
  font-size: 26px;
  margin-bottom: 8px;
}
.scan-guide-card p {
  color: var(--muted);
  line-height: 1.68;
}
.guide-step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.guide-step {
  border: 1px solid #dcefe1;
  background: #f7fcf8;
  border-radius: 14px;
  padding: 18px;
}
.guide-step > span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  font-weight: 800;
  margin-bottom: 12px;
}
.guide-step h3 {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 6px;
}
.guide-step p {
  font-size: 12px;
}
.why-scan-only {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}
.why-scan-only h3 {
  color: var(--navy-dark);
  margin-bottom: 8px;
}
.security-points {
  border-radius: 13px;
  padding: 17px;
  background: #eef7f0;
  color: var(--text);
}
.security-points ul {
  margin: 10px 0 0 19px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}
.scan-progress-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.scan-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #dcefe1;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: scan-spin 0.9s linear infinite;
}
@keyframes scan-spin {
  to {
    transform: rotate(360deg);
  }
}
.scan-result-card {
  margin-top: 0;
}
.result-card.is-warning {
  border-color: #d39a2a;
}
.activity-pill {
  margin-left: auto;
  padding: 7px 11px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}
.activity-pill.active {
  background: #d4edda;
  color: var(--navy-dark);
}
.activity-pill.expired {
  background: #fbe4e4;
  color: #9c2222;
}
.activity-pill.unknown,
.activity-pill.pending {
  background: #f2f2f2;
  color: #626262;
}
.scan-interpretation {
  margin: 0 20px 20px;
  border-radius: 12px;
  padding: 15px 16px;
}
.scan-interpretation strong {
  display: block;
  margin-bottom: 5px;
}
.scan-interpretation p {
  line-height: 1.55;
  font-size: 13px;
}
.active-message {
  background: #eaf7ed;
  color: var(--navy-dark);
}
.expired-message {
  background: #fff3e3;
  color: #6f4510;
}
.scan-support-note {
  margin-top: 22px;
}

/* ── RENEWAL WORKFLOW ── */
.stats-grid-expanded {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.renewal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 22px;
  align-items: start;
}
.renewal-form-panel {
  position: sticky;
  top: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--off-white);
  padding: 20px;
}
.renewal-form-panel h3 {
  color: var(--text);
  margin-bottom: 14px;
}
.renewal-note {
  border-left: 4px solid var(--navy);
}
.renewal-limit-item {
  opacity: 0.68;
}
.form-success {
  line-height: 1.5;
}

@media (max-width: 980px) {
  .guide-step-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .why-scan-only,
  .renewal-layout {
    grid-template-columns: 1fr;
  }
  .renewal-form-panel {
    position: static;
  }
  .stats-grid-expanded {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .scan-guide-card {
    padding: 20px;
  }
  .scan-guide-intro {
    grid-template-columns: 1fr;
  }
  .guide-step-grid {
    grid-template-columns: 1fr;
  }
  .activity-pill {
    margin-left: 0;
  }
  .stats-grid-expanded {
    grid-template-columns: 1fr;
  }
}

/* ── V5.1 public scan page and automatic permit number ── */
.public-verification-main {
  max-width: 920px;
}
.scan-entry-card {
  margin-bottom: 24px;
}
.scan-entry-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 20px;
  align-items: center;
  padding: 6px 0 10px;
}
.scan-entry-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--valid-dim);
  border: 1px solid var(--border);
  color: var(--navy);
  font-family: var(--mono);
  font-size: 42px;
  line-height: 1;
}
.scan-entry-row h2 {
  font-size: 21px;
  color: var(--text);
  margin-bottom: 7px;
}
.scan-entry-row p {
  color: var(--muted);
  line-height: 1.65;
}
.friendly-verification-guide {
  margin-bottom: 26px;
}
.form-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
input[readonly] {
  background: #edf5ef;
  color: var(--navy-dark);
  border-style: dashed;
  cursor: not-allowed;
}
@media (max-width: 620px) {
  .scan-entry-row {
    grid-template-columns: 1fr;
  }
  .scan-entry-icon {
    width: 62px;
    height: 62px;
    font-size: 36px;
  }
}

/* ── V5.2 COMPLETE DATABASE DASHBOARD ───────────────────────────── */
.dashboard-body .admin-shell {
  max-width: 1280px;
}

.dashboard-body .admin-hero-panel {
  padding: 28px 32px;
  border-radius: 20px;
}

.dashboard-body .admin-hero-panel h1 {
  font-size: clamp(28px, 3.4vw, 40px);
}

.dashboard-overview {
  margin: 18px 0 22px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(15, 45, 24, 0.07);
  backdrop-filter: blur(10px);
}

.dashboard-overview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.dashboard-overview-heading h2 {
  color: var(--text);
  margin: 3px 0 5px;
  font-size: 22px;
}

.dashboard-overview-heading p {
  color: var(--muted);
  max-width: 760px;
  font-size: 13px;
  line-height: 1.55;
}

.overview-kicker {
  display: block;
  color: var(--navy);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.overview-refresh {
  flex: 0 0 auto;
  min-width: 145px;
}

.dashboard-overview .stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.dashboard-overview .stat-card {
  min-height: 126px;
  text-align: center;
  padding: 17px;
  border-radius: 15px;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.dashboard-overview .stat-card::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 58px;
  right: -22px;
  bottom: -24px;
  border-radius: 50%;
  background: rgba(27, 107, 47, 0.08);
}

.stat-card-button {
  appearance: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.dashboard-overview .stat-card-button {
  text-align: center;
}

.stat-card-button:hover,
.stat-card-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--navy);
  box-shadow: 0 10px 22px rgba(15, 45, 24, 0.1);
  outline: none;
}

.dashboard-overview .stat-card span {
  margin-bottom: 7px;
  font-size: 10px;
}

.dashboard-overview .stat-card strong {
  display: block;
  font-size: clamp(24px, 2.4vw, 31px);
  line-height: 1.05;
}

.dashboard-overview .stat-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  position: relative;
  z-index: 1;
}

.stat-total {
  background: linear-gradient(145deg, #f2f9f4, #ffffff);
}
.stat-active {
  border-color: #a8d4b0;
}
.stat-expired {
  border-color: #e6c2b6;
}
.stat-renewable {
  border-color: #d7c98c;
}
.stat-qr {
  border-color: #a8d4b0;
}
.stat-warning {
  border-color: #e7c98d;
}
.stat-card-static {
  background: #fbfcfb;
}

.database-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.database-meta-strip > span {
  padding: 8px 11px;
  background: #f6faf7;
  border: 1px solid #e0ece3;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.database-meta-strip strong {
  margin-left: 4px;
  color: var(--text);
  font-family: var(--mono);
}

.dashboard-body .option-grid {
  gap: 12px;
}

.dashboard-body .option-card {
  min-height: 132px;
  padding: 18px;
  border-radius: 15px;
}

.dashboard-body .option-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 19px;
}

.dashboard-body .option-title {
  font-size: 16px;
}

.dashboard-body .option-text {
  font-size: 12px;
}

.permit-picker-toolbar {
  min-height: 58px;
}

.permit-picker-toolbar > div:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.filter-chip {
  display: inline-flex !important;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  background: #eaf5ed;
  border: 1px solid #cfe4d4;
  border-radius: 999px;
  color: var(--navy-dark) !important;
  font-family: var(--sans) !important;
  font-size: 9px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.result-page-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-page-size label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.result-page-size select {
  width: auto;
  min-width: 76px;
  padding: 7px 28px 7px 9px;
  font-size: 11px;
  border-radius: 9px;
}

.permit-result-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  background: #fcfdfc;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.permit-picker-shell .license-result-list {
  max-height: min(57vh, 590px);
  min-height: 300px;
}

.permit-picker-shell .license-result-item {
  padding: 13px 15px;
  border-radius: 10px;
  background: #fafcfa;
}

.permit-picker-shell .license-result-item strong {
  font-size: 13px;
}

.permit-picker-shell .license-result-item span {
  font-size: 10px;
  line-height: 1.5;
}

.permit-pagination {
  display: grid;
  grid-template-columns: minmax(92px, auto) 1fr minmax(92px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: #f7fcf8;
}

.permit-pagination span {
  color: var(--muted);
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
}

.permit-pagination .ghost-action {
  padding: 8px 12px;
  font-size: 10px;
}

@media (max-width: 1120px) {
  .dashboard-overview .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .dashboard-overview {
    padding: 16px;
  }
  .dashboard-overview-heading {
    flex-direction: column;
  }
  .overview-refresh {
    width: 100%;
  }
  .dashboard-overview .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .permit-picker-toolbar,
  .permit-result-summary {
    align-items: stretch;
    flex-direction: column;
  }
  .result-page-size {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .dashboard-overview .stats-grid {
    grid-template-columns: 1fr;
  }
  .permit-pagination {
    grid-template-columns: 1fr 1fr;
  }
  .permit-pagination span {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

/* V5.3 official QR auto-verification */
.scan-auto-verify-card {
  align-items: flex-start;
}

.scan-progress-content {
  flex: 1;
  min-width: 0;
}

.scanned-permit-label {
  display: block;
  margin-top: 16px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scanned-permit-input {
  width: 100%;
  max-width: 460px;
  border: 1px solid #b9d7c2;
  border-radius: 10px;
  background: #f8fcf9;
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 17px;
  font-weight: 600;
  padding: 13px 14px;
  outline: none;
}

.verified-permit-banner {
  display: grid;
  gap: 4px;
  margin: 18px 22px 0;
  padding: 16px 18px;
  border: 1px solid #9ac9a8;
  border-radius: 12px;
  background: #f0f9f3;
}

.verified-permit-banner span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.verified-permit-banner strong {
  color: #0f5f2b;
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.verified-permit-banner small {
  color: var(--muted);
  line-height: 1.5;
}

.verified-permit-banner.failed {
  border-color: #e2b9b9;
  background: #fff6f6;
}

.verified-permit-banner.failed strong {
  color: #9d2020;
}

@media (max-width: 640px) {
  .verified-permit-banner {
    margin: 14px 14px 0;
  }

  .verified-permit-banner strong {
    font-size: 20px;
  }
}

/* V5.4 minimal public QR verification */
[hidden] {
  display: none !important;
}

.public-minimal-result {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.compact-verification-banner {
  padding-top: 15px;
  padding-bottom: 15px;
}

.compact-verification-banner small {
  display: none;
}

.minimal-result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.minimal-result-grid .field {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fcf9;
  padding: 16px;
}

.minimal-result-grid .field value {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .minimal-result-grid {
    grid-template-columns: 1fr;
  }
}

/* v5.5 automatic dashboard refresh and status-led public verification */
.overview-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.auto-refresh-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2e8b57;
  box-shadow: 0 0 0 5px rgba(46, 139, 87, 0.12);
}
.danger-action {
  border-color: #d6a3a3 !important;
  color: #8b1e1e !important;
}
.danger-action:hover {
  background: #fff3f3 !important;
  border-color: #b42318 !important;
}
.result-card.is-active {
  border-color: #78b98b;
}
.result-card.is-expired {
  border-color: #d98181;
}
.result-card.is-status-unknown {
  border-color: #d7b76a;
}
.result-card.is-active .result-header {
  background: #edf8f0;
}
.result-card.is-expired .result-header {
  background: #fff0f0;
}
.result-card.is-status-unknown .result-header {
  background: #fff8e8;
}
.result-card.is-active .status-icon {
  background: #176b36;
  color: #fff;
}
.result-card.is-expired .status-icon {
  background: #a32020;
  color: #fff;
}
.result-card.is-status-unknown .status-icon {
  background: #8a6400;
  color: #fff;
}
.licence-status-banner.is-active {
  border-color: #78b98b;
  background: #edf8f0;
}
.licence-status-banner.is-expired {
  border-color: #d98181;
  background: #fff0f0;
}
.licence-status-banner.is-status-unknown {
  border-color: #d7b76a;
  background: #fff8e8;
}
.public-status-guidance.is-active {
  background: #edf8f0;
  border: 1px solid #b9dec3;
}
.public-status-guidance.is-expired {
  background: #fff0f0;
  border: 1px solid #edbaba;
}
.public-status-guidance.is-status-unknown {
  background: #fff8e8;
  border: 1px solid #e8d18b;
}
.public-validity-field {
  grid-column: 1 / -1;
}

/* v6 four-stage QR, regional dashboards and pending-renewal workflow */
.overview-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.compact-control {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.compact-control select {
  min-height: 42px;
}
.role-card small {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}
.four-qr-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.qr-tier-card {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fbf9;
  text-align: center;
}
.qr-tier-card > strong {
  font-size: 13px;
}
.qr-tier-card > span {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.compact-qr-box {
  width: 132px;
  min-height: 132px;
  padding: 8px;
}
.compact-qr-box img {
  width: 100%;
  height: auto;
  display: block;
}
.renewal-declaration {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid #d7b76a;
  border-radius: 12px;
  background: #fff8e8;
  font-size: 13px;
  line-height: 1.45;
}
.renewal-declaration input {
  width: auto;
  margin-top: 3px;
}
.qr-tier-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 22px 18px;
}
.qr-tier-summary span {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 12px;
}
.qr-tier-summary strong {
  color: var(--ink);
  font-size: 14px;
}
.result-card.is-superseded {
  border-color: #8aa1b4;
}
.result-card.is-inactive {
  border-color: #a9a9a9;
}
.result-card.is-superseded .result-header {
  background: #eef3f7;
}
.result-card.is-inactive .result-header {
  background: #f4f4f4;
}
.result-card.is-superseded .status-icon {
  background: #48677e;
  color: #fff;
}
.result-card.is-inactive .status-icon {
  background: #666;
  color: #fff;
}
.compact-verification-banner.is-active {
  border-color: #78b98b;
  background: #edf8f0;
}
.compact-verification-banner.is-expired {
  border-color: #d98181;
  background: #fff0f0;
}
.compact-verification-banner.is-superseded {
  border-color: #aabac7;
  background: #eef3f7;
}
.compact-verification-banner.is-inactive {
  border-color: #c4c4c4;
  background: #f4f4f4;
}
.compact-verification-banner.is-status-unknown {
  border-color: #d7b76a;
  background: #fff8e8;
}
.public-status-guidance.is-superseded {
  background: #eef3f7;
  border: 1px solid #c7d3dc;
}
.public-status-guidance.is-inactive {
  background: #f4f4f4;
  border: 1px solid #d2d2d2;
}

@media (max-width: 760px) {
  .four-qr-preview-grid,
  .qr-tier-summary {
    grid-template-columns: 1fr;
  }
  .overview-controls {
    justify-content: stretch;
  }
  .compact-control {
    min-width: 100%;
  }
}

/* V7 permit application workflow */
.workflow-stat-grid .stat-card {
  min-height: 130px;
}
.workflow-option-grid {
  align-items: stretch;
}
.workflow-status {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.08);
}
.status-pending_approval {
  color: #ffd98a;
}
.status-approved_awaiting_signature {
  color: #9fd6ff;
}
.status-rejected {
  color: #ffaaa4;
}
.status-issued {
  color: #9de2b1;
}
.file-upload-action {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--accent, #c7a15a);
  color: #101418;
  font-weight: 700;
  cursor: pointer;
}
.danger-action {
  border: 1px solid rgba(230, 95, 85, 0.5);
  background: rgba(230, 95, 85, 0.1);
  color: #ffb3ad;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  cursor: pointer;
}
.officer-edit-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.9fr) minmax(130px, 0.8fr)
    auto auto auto;
  gap: 0.55rem;
  margin-top: 0.7rem;
  align-items: center;
}
.narrow-shell {
  max-width: 1080px;
}
.permit-form-grid .span-2 {
  grid-column: 1 / -1;
}
.link-action {
  text-decoration: none;
  text-align: center;
}
@media (max-width: 900px) {
  .officer-edit-row {
    grid-template-columns: 1fr 1fr;
  }
  .workflow-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .workflow-stat-grid,
  .officer-edit-row {
    grid-template-columns: 1fr;
  }
  .permit-form-grid {
    grid-template-columns: 1fr;
  }
  .permit-form-grid .span-2 {
    grid-column: auto;
  }
}

/* ================================================================
   V7.1 internal UI controls, role management and notifications
   ================================================================ */
.admin-body input:not([type="checkbox"]):not([type="file"]),
.admin-body select,
.admin-body textarea,
.portal-control {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  border: 1px solid #c5d9cb;
  border-radius: 10px;
  background: #ffffff;
  color: #10291a;
  padding: 11px 13px;
  font:
    500 14px/1.4 Inter,
    sans-serif;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}
.admin-body textarea {
  min-height: 104px;
  resize: vertical;
}
.admin-body input::placeholder,
.admin-body textarea::placeholder {
  color: #82958a;
  opacity: 1;
}
.admin-body input:not([type="checkbox"]):not([type="file"]):focus,
.admin-body select:focus,
.admin-body textarea:focus,
.portal-control:focus {
  border-color: #1f7138;
  box-shadow: 0 0 0 3px rgba(31, 113, 56, 0.12);
  background: #fff;
}
.admin-body select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5 7 7.5 13 1.5' fill='none' stroke='%23165f2d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
.admin-body input[readonly] {
  background: #f1f6f2;
  color: #50675a;
  border-style: dashed;
}
.admin-body label,
.admin-card-form label,
.permit-form-grid label,
.renewal-form-panel label,
.officer-edit-row label {
  display: grid;
  gap: 7px;
  color: #284e36;
  font:
    700 12px/1.35 Inter,
    sans-serif;
  letter-spacing: 0.01em;
}
.permit-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.permit-form-grid label {
  align-content: start;
  padding: 14px;
  border: 1px solid #d8e7dc;
  border-radius: 12px;
  background: #fbfdfb;
}
.permit-form-grid label[hidden] {
  display: none;
}
.permit-form-grid label:focus-within {
  border-color: #9acbaa;
  background: #fff;
  box-shadow: 0 8px 24px rgba(14, 83, 35, 0.07);
}
.permit-form-grid label small {
  color: #718077;
  font:
    400 11px/1.5 Inter,
    sans-serif;
}
.permit-form-grid .reference-field {
  background: #f4fbf5;
  border-color: #a8d4b0;
}
.field-note {
  display: inline-block;
  margin-left: 4px;
  color: #718077;
  font-size: 10px;
  font-weight: 500;
}
.lookup-status {
  min-height: 18px;
  margin: 0;
  color: #53685a;
  font-size: 12px;
  font-weight: 600;
}
.lookup-status[data-state="loading"] {
  color: #8a5a00;
}
.lookup-status[data-state="success"] {
  color: #176b3a;
}
.lookup-status[data-state="error"] {
  color: var(--danger);
}
.permit-form-grid .form-actions {
  padding-top: 4px;
}

.admin-card-form,
.officer-list-panel {
  border: 1px solid #cfe1d4;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 32px rgba(13, 70, 31, 0.07);
  padding: 22px;
}
.admin-card-form {
  display: grid;
  gap: 18px;
}
.management-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.85fr) minmax(520px, 1.4fr);
  gap: 22px;
  align-items: start;
}
.form-card-heading {
  display: grid;
  gap: 5px;
  margin-bottom: 2px;
}
.form-card-heading h3 {
  margin: 0;
  color: #123d22;
  font-size: 20px;
}
.form-card-heading p {
  margin: 0;
  color: #667b6c;
  font-size: 12px;
  line-height: 1.55;
}
.form-card-kicker {
  color: #1e6b37;
  font:
    700 10px/1 IBM Plex Mono,
    monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.admin-form-actions {
  display: flex;
  justify-content: flex-end;
}
.admin-form-actions .primary-action {
  min-width: 150px;
}
.officer-list-panel {
  min-width: 0;
}
.officer-card {
  display: grid;
  gap: 15px;
  padding: 17px;
  margin-top: 12px;
  border: 1px solid #d7e7db;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbf9);
}
.officer-card-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.officer-card-head > div:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.officer-card-head strong {
  color: #103d20;
  font-size: 14px;
}
.officer-card-head span:not(.account-status) {
  color: #6a7d70;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.officer-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #e7f3ea;
  color: #17622f;
  font-weight: 800;
}
.account-status {
  border-radius: 999px;
  padding: 5px 9px;
  font:
    700 10px/1 Inter,
    sans-serif;
}
.account-status.is-active {
  background: #e6f6ea;
  color: #17622f;
}
.account-status.is-disabled {
  background: #f2f2f2;
  color: #6a6a6a;
}
.officer-edit-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(160px, 0.8fr) minmax(
      240px,
      1.15fr
    );
  gap: 12px;
  align-items: end;
  margin-top: 0;
}
.officer-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.officer-actions button {
  min-height: 44px;
}
.password-reset-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.password-reset-row input {
  flex-basis: 100%;
  width: 100%;
  min-width: 100%;
}

.password-field {
  position: relative;
  width: 100%;
}
.password-field input {
  padding-right: 48px !important;
}
.password-toggle {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #3a6548;
  cursor: pointer;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  background: #eaf4ed;
  outline: none;
}
.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle .eye-closed {
  display: none;
}
.password-toggle.is-visible .eye-open {
  display: none;
}
.password-toggle.is-visible .eye-closed {
  display: block;
}

.captcha-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.captcha-image {
  flex: 1;
  height: 70px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f2f4f8;
}
.captcha-refresh {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
}
.captcha-refresh:hover,
.captcha-refresh:focus-visible {
  background: var(--gold-light);
  outline: none;
}
.captcha-refresh svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.access-denied-panel {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  border-left: 4px solid #c79c37;
}
.access-denied-panel[hidden] {
  display: none !important;
}
.access-denied-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #fff4d7;
  font-size: 26px;
}
.access-denied-panel h2 {
  margin: 8px 0 8px;
  color: #183c24;
}
.access-denied-panel p {
  margin: 0 0 18px;
  color: #66786b;
  line-height: 1.6;
}

.notification-shell {
  position: relative;
  display: flex;
  align-items: center;
}
.notification-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--valid-dim);
  color: var(--navy);
  cursor: pointer;
}
.notification-button:hover {
  background: var(--gold-light);
}
.notification-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.notification-badge {
  position: absolute;
  right: -6px;
  top: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 2px solid #165f2d;
  border-radius: 999px;
  background: #d43c35;
  color: #fff;
  font:
    800 10px/15px Inter,
    sans-serif;
  text-align: center;
}
.notification-panel {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 12px);
  right: 0;
  width: min(410px, calc(100vw - 30px));
  overflow: hidden;
  border: 1px solid #cfe0d3;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(5, 50, 20, 0.22);
  color: #183a24;
}
.notification-panel[hidden] {
  display: none !important;
}
.notification-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 17px;
  border-bottom: 1px solid #e0ebe3;
  background: #f7fbf8;
}
.notification-panel-head > div {
  display: grid;
  gap: 2px;
}
.notification-panel-head span {
  color: #6f8074;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.notification-panel-head strong {
  color: #103b20;
  font-size: 16px;
}
.notification-text-button {
  border: 0;
  background: transparent;
  color: #17622f;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.notification-list {
  max-height: 430px;
  overflow-y: auto;
}
.notification-item {
  width: 100%;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 11px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #edf2ee;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.notification-item:hover {
  background: #f4f9f5;
}
.notification-item.is-unread {
  background: #f0f8f2;
}
.notification-item.is-resolved {
  opacity: 0.62;
}
.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: transparent;
}
.notification-item.is-unread .notification-dot {
  background: #1b7138;
  box-shadow: 0 0 0 4px rgba(27, 113, 56, 0.1);
}
.notification-copy {
  display: grid;
  gap: 5px;
}
.notification-copy strong {
  color: #153d22;
  font-size: 12px;
}
.notification-copy > span {
  color: #536b5a;
  font-size: 11px;
  line-height: 1.5;
}
.notification-copy small {
  color: #87968b;
  font-size: 10px;
}
.notification-empty {
  padding: 22px;
}

@media (max-width: 980px) {
  .management-grid {
    grid-template-columns: 1fr;
  }
  .officer-edit-row {
    grid-template-columns: 1fr 1fr;
  }
  .officer-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
@media (max-width: 680px) {
  .admin-form-grid,
  .permit-form-grid,
  .officer-edit-row {
    grid-template-columns: 1fr;
  }
  .permit-form-grid .span-2 {
    grid-column: auto;
  }
  .access-denied-panel {
    grid-template-columns: 1fr;
  }
  .notification-panel {
    position: fixed;
    top: 74px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* ── INTERNAL BACK NAVIGATION ── */
.portal-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}
.portal-back-button[hidden] {
  display: none !important;
}
.portal-back-button:hover {
  background: rgba(255, 255, 255, 0.19);
  border-color: rgba(255, 255, 255, 0.42);
  transform: translateX(-1px);
}
.portal-back-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.3);
  outline-offset: 2px;
}
.portal-back-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 680px) {
  .portal-back-button span {
    display: none;
  }
  .portal-back-button {
    width: 38px;
    padding: 7px;
  }
  .topbar {
    padding-inline: 12px;
  }
  .topbar-left,
  .topbar-right {
    gap: 8px;
  }
  .topbar-flag {
    height: 60px;
  }
}

/* ── V7.1.4 MANAGE ROLES REGION TABS ── */
.staff-region-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0 6px;
  padding: 4px;
}
.staff-region-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #c8ddce;
  border-radius: 999px;
  background: #f7fbf8;
  color: #245332;
  font:
    700 11px/1 Inter,
    sans-serif;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.staff-region-tab strong {
  min-width: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e5f1e8;
  color: #17622f;
  font-size: 10px;
  text-align: center;
}
.staff-region-tab:hover {
  border-color: #91bf9d;
  background: #eef7f0;
  transform: translateY(-1px);
}
.staff-region-tab:focus-visible {
  outline: 3px solid rgba(24, 105, 49, 0.16);
  outline-offset: 2px;
}
.staff-region-tab.active {
  border-color: #17652f;
  background: #17652f;
  color: #fff;
  box-shadow: 0 8px 18px rgba(17, 91, 43, 0.18);
}
.staff-region-tab.active strong {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}
.officer-edit-row {
  grid-template-columns: minmax(220px, 1fr) minmax(210px, 0.9fr);
  align-items: end;
}
.officer-edit-row > label {
  min-width: 0;
}
.officer-edit-row .portal-control {
  width: 100%;
  min-width: 0;
}
.officer-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 2px;
}
.officer-actions button {
  min-width: 92px;
}

@media (max-width: 980px) {
  .officer-edit-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .officer-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
@media (max-width: 680px) {
  .staff-region-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
  }
  .staff-region-tab {
    flex: 0 0 auto;
  }
  .officer-edit-row {
    grid-template-columns: 1fr;
  }
  .officer-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .officer-actions .danger-action {
    grid-column: 1 / -1;
  }
  .officer-actions button {
    width: 100%;
  }
}

/* ── V7.1.5 DASHBOARD BACK RAIL ── */
.dashboard-back-rail {
  position: fixed;
  top: 94px;
  left: 24px;
  z-index: 35;
  display: flex;
  align-items: center;
  min-height: 42px;
  pointer-events: none;
}
.dashboard-back-rail .portal-back-button {
  pointer-events: auto;
}
.dashboard-rail-back-button {
  min-width: 92px;
  min-height: 42px;
  padding: 9px 14px 9px 10px;
  border-color: #b9d5c1;
  background: #ffffff;
  color: #174f2a;
  box-shadow: 0 8px 22px rgba(21, 79, 42, 0.1);
}
.dashboard-rail-back-button:hover {
  background: #f0f8f2;
  border-color: #7eb18d;
  color: #0f4121;
}
.dashboard-rail-back-button:focus-visible {
  outline: 3px solid rgba(24, 105, 53, 0.22);
}
@media (max-width: 1180px) {
  .dashboard-back-rail {
    position: sticky;
    top: 76px;
    left: auto;
    width: min(100% - 28px, 930px);
    margin: 14px auto -2px;
    padding-left: 0;
    z-index: 30;
  }
}
@media (max-width: 680px) {
  .dashboard-back-rail {
    top: 70px;
    width: calc(100% - 24px);
    margin-top: 10px;
  }
  .dashboard-rail-back-button {
    width: auto;
    min-width: 42px;
    padding: 9px 11px;
  }
  .dashboard-rail-back-button span {
    display: inline;
  }
}

/* ── V7.2 WORKFLOW ── */
.dashboard-primary-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dashboard-operational-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dashboard-stat-divider {
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(
    90deg,
    transparent,
    #b9d5c1 8%,
    #b9d5c1 92%,
    transparent
  );
}
.renewal-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.signing-date-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #c8ddce;
  border-radius: 14px;
  background: #f8fbf9;
}
.signing-date-panel h4 {
  margin: 0;
  color: #173e25;
  font-size: 15px;
}
.signing-date-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 560px;
}
.signing-date-grid label {
  display: grid;
  gap: 7px;
  color: #19452a;
  font-weight: 700;
  font-size: 12px;
}
.signing-date-grid input {
  min-height: 44px;
  border: 1px solid #c7d9cb;
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  background: #fff;
  color: #132c1b;
}
.signing-date-grid input[readonly] {
  background: #eef4f0;
}
.field-guidance {
  display: block;
  color: #516c59;
  line-height: 1.5;
}
.audit-filter-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.audit-filter-row .compact-control {
  min-width: 280px;
}
.capture-back-rail {
  /* Shares the exact dashboard rail placement. */
}
@media (max-width: 980px) {
  .dashboard-primary-stats,
  .dashboard-operational-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .signing-date-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 620px) {
  .dashboard-primary-stats,
  .dashboard-operational-stats,
  .signing-date-grid {
    grid-template-columns: 1fr;
  }
  .audit-filter-row .compact-control {
    min-width: 100%;
  }
}

/* ── V7.2.3 CENTERED DASHBOARD ROWS ──
   Eight shared tracks keep both rows on the same visual centre line.
   Primary cards occupy track pairs 1-2, 3-4, 5-6 and 7-8.
   Operational cards occupy 2-3, 4-5 and 6-7 so the three-card row
   is centred beneath the four-card row with matching card widths. */
.dashboard-overview .dashboard-primary-stats {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: 100%;
}
.dashboard-overview .dashboard-operational-stats {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: 100%;
}

.dashboard-overview .dashboard-primary-stats > .stat-card {
  grid-column: span 2;
}

.dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(1) {
  grid-column: 2 / span 2;
}
.dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(2) {
  grid-column: 4 / span 2;
}
.dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(3) {
  grid-column: 6 / span 2;
}

@media (max-width: 980px) {
  .dashboard-overview .dashboard-primary-stats,
  .dashboard-overview .dashboard-operational-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .dashboard-overview .dashboard-primary-stats > .stat-card,
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(1),
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(2) {
    grid-column: span 2;
  }
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(3) {
    grid-column: 2 / span 2;
  }
}

@media (max-width: 620px) {
  .dashboard-overview .dashboard-primary-stats,
  .dashboard-overview .dashboard-operational-stats {
    grid-template-columns: 1fr;
  }
  .dashboard-overview .dashboard-primary-stats > .stat-card,
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(1),
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(2),
  .dashboard-overview .dashboard-operational-stats > .stat-card:nth-child(3) {
    grid-column: 1;
  }
}
