:root {
  --background: #fcf9f8;
  --surface: #ffffff;
  --surface-soft: #f6f3f2;
  --surface-muted: #f0eded;
  --border: #e5e2e1;
  --border-strong: #bfcaba;
  --text: #1c1b1b;
  --text-muted: #40493d;
  --text-subtle: #5d5f5f;
  --primary: #176d25;
  --primary-strong: #00400e;
  --primary-soft: #e5f5e5;
  --danger: #ba1a1a;
  --danger-soft: #ffdad6;
  --warning: #7a5a00;
  --warning-soft: #fff0c2;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --shadow-float: 0 16px 32px rgba(28, 27, 27, 0.08);
}

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

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

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(23, 109, 37, 0.06), transparent 22rem),
    linear-gradient(180deg, #fcf9f8 0%, #f8f5f4 100%);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-7) var(--space-5);
  background: rgba(246, 243, 242, 0.92);
  border-right: 1px solid var(--border);
}

.header-leading {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.mobile-menu-toggle,
.mobile-menu-close,
.mobile-menu-backdrop {
  display: none;
}

.mobile-menu-toggle {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-menu-toggle span + span {
  margin-top: 5px;
}

.mobile-menu-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.sidebar-brand {
  display: grid;
  gap: var(--space-3);
}

.brand-link {
  display: grid;
  gap: var(--space-2);
}

.brand-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
  object-fit: contain;
}

.brand-kicker,
.eyebrow,
.header-kicker,
.meta-label,
.field-key,
.kv-key,
.record-key {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-subtle);
}

.brand-title {
  font-size: 32px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-copy,
.section-copy,
.hero-text,
.feature-copy,
.metric-copy,
.technical-note,
.empty-copy,
.auth-text {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}

.sidebar-nav {
  display: grid;
  gap: var(--space-2);
}

.nav-item {
  position: relative;
  padding: 12px 14px 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-item:hover {
  background: #eeeeee;
  color: var(--text);
}

.nav-item.is-active {
  background: rgba(23, 109, 37, 0.08);
  color: var(--primary-strong);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
}

.nav-label {
  font-size: 14px;
  font-weight: 500;
}

.sidebar-meta {
  margin-top: auto;
  display: grid;
  gap: var(--space-4);
}

.meta-block {
  display: grid;
  gap: var(--space-1);
}

.meta-value {
  font-size: 16px;
  font-weight: 600;
}

.sidebar-button {
  width: 100%;
}

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

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}

.header-title {
  margin: var(--space-2) 0 0;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}

.page-content {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-6) 0 var(--space-7);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

.panel + .panel,
.panel + .technical-note,
.detail-grid + .panel,
.page-actions + .panel {
  margin-top: var(--space-5);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: var(--space-6);
}

.hero-copy,
.section-heading,
.auth-copy,
.auth-card-head {
  display: grid;
  gap: var(--space-3);
}

.hero-title,
.section-title,
.auth-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-title-sm {
  font-size: 24px;
  line-height: 1.33;
}

.hero-actions {
  margin-top: var(--space-2);
}

.hero-metrics,
.feature-grid {
  display: grid;
  gap: var(--space-4);
}

.metric-card,
.feature-card,
.kv-card,
.record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.metric-card {
  padding: var(--space-4);
}

.metric-label {
  display: block;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.metric-value {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 24px;
  line-height: 1.33;
  font-weight: 600;
}

.section-panel {
  display: grid;
  gap: var(--space-5);
}

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

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

.module-card {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.module-card-head {
  display: grid;
  gap: var(--space-2);
}

.module-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  display: grid;
  gap: var(--space-2);
}

.feature-card {
  padding: var(--space-4);
}

.feature-index {
  display: inline-block;
  margin-bottom: var(--space-3);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.feature-title {
  margin: 0 0 var(--space-2);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
}

.search-panel,
.results-panel,
.detail-panel {
  display: grid;
  gap: var(--space-4);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: var(--space-3);
  align-items: end;
}

.search-field input,
.auth-form input,
.form-field input,
.form-field select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field input:focus,
.auth-form input:focus,
.form-field input:focus,
.form-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 109, 37, 0.12);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.button-primary {
  background: var(--primary);
  color: #ffffff;
}

.button-primary:hover {
  background: #12591d;
  transform: translateY(-1px);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--primary);
}

.button-secondary:hover {
  background: var(--surface-soft);
}

.button-compact {
  min-height: 38px;
  padding: 0 14px;
}

.results-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.result-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.data-table th,
.data-table td {
  padding: var(--space-4);
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--surface-soft);
  color: var(--text-subtle);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.tattoo-table-shell {
  margin-top: var(--space-3);
}

.tattoo-table th {
  width: 34%;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.tattoo-table td {
  color: var(--text);
}

.tattoo-table tbody tr:last-child th {
  border-bottom: 0;
}

.gallery-tattoo-block {
  display: grid;
  gap: var(--space-2);
  width: 100%;
}

.gallery-tattoo-table-shell {
  width: 100%;
}

.gallery-tattoo-table th {
  width: 40%;
}

.gallery-tattoo-list {
  display: grid;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.gallery-tattoo-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.gallery-tattoo-item + .gallery-tattoo-item {
  border-top: 1px solid var(--border);
}

.gallery-tattoo-location {
  color: var(--text-subtle);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-tattoo-description {
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.action-col {
  width: 120px;
  text-align: right;
}

.id-cell {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.field-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.field-value,
.kv-value,
.record-value {
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}

.empty-state-cell {
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-6) var(--space-4) !important;
}

.detail-hero {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--space-6);
}

.detail-media {
  display: grid;
  gap: var(--space-3);
}

.photo-frame {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.detail-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.photo-caption {
  display: grid;
  gap: var(--space-1);
}

.detail-summary {
  display: grid;
  gap: var(--space-4);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.kv-card {
  padding: var(--space-4);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.cell-grid,
.person-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  justify-content: center;
  justify-items: stretch;
}

.cell-grid {
  align-items: stretch;
}

.cell-card,
.person-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.cell-card {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: var(--space-3);
  width: 100%;
  min-height: 220px;
  padding: var(--space-4);
}

.cell-card.is-selected {
  border-color: var(--primary);
  background: #f3faf3;
}

.cell-card-head,
.person-body {
  display: grid;
  gap: var(--space-2);
}

.cell-name,
.person-name {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.cell-meta,
.person-meta-list {
  display: flex;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 14px;
}

.cell-meta {
  flex-wrap: wrap;
}

.person-meta-list {
  flex-direction: column;
  align-items: flex-start;
}

.occupancy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.occupancy-badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.occupancy-badge.is-critical {
  background: var(--danger-soft);
  color: #7b0d0d;
}

.cell-copy,
.person-caption {
  color: var(--text-muted);
  font-size: 14px;
}

.person-card {
  width: 100%;
  max-width: 350px;
  min-height: 500px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 392px minmax(108px, 1fr);
}

.person-photo-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.person-photo-link {
  display: block;
  width: 285px;
}

.person-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
}

.person-photo-placeholder,
.detail-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--primary-strong);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background:
    linear-gradient(135deg, rgba(23, 109, 37, 0.1), rgba(0, 64, 14, 0.16)),
    var(--surface-muted);
}

.person-body {
  padding: var(--space-4);
  align-content: start;
}

.person-actions {
  margin-top: auto;
}

.verification-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.verification-form,
.verification-preview {
  display: grid;
  gap: var(--space-3);
}

.camera-panel {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.camera-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.camera-copy,
.camera-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.camera-stage {
  position: relative;
  min-height: 240px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px dashed var(--border);
  overflow: hidden;
}

.camera-video,
.camera-photo {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.camera-placeholder {
  color: var(--text-subtle);
  font-size: 15px;
  font-weight: 500;
}

.verification-photo-shell {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.verification-photo {
  width: min(100%, 320px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.verification-file {
  color: var(--text-muted);
  font-size: 14px;
}

.score-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

.score-pill.is-match,
.notice-success {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: rgba(23, 109, 37, 0.18);
}

.score-pill.is-review {
  background: var(--warning-soft);
  color: #5b4200;
  border-color: rgba(122, 90, 0, 0.15);
}

.is-lightbox-enabled {
  cursor: zoom-in;
}

body.image-lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(3px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-content {
  display: block;
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.image-lightbox-close {
  position: fixed;
  top: 12px;
  right: 18px;
  z-index: 1;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.image-lightbox-close:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.stack-list {
  display: grid;
  gap: var(--space-3);
}

.record-card {
  padding: var(--space-4);
}

.record-line {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: var(--space-3);
  padding: 8px 0;
}

.record-line + .record-line {
  border-top: 1px solid var(--border);
}

.notice {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
}

.notice-warning {
  background: var(--warning-soft);
  border-color: rgba(122, 90, 0, 0.15);
  color: #5b4200;
}

.notice-danger {
  background: var(--danger-soft);
  border-color: rgba(186, 26, 26, 0.18);
  color: #7b0d0d;
}

.notice-success {
  border: 1px solid transparent;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.page-actions-inline {
  margin-bottom: 0;
}

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  
}

/* CONTAINER PAI: Centraliza o bloco inteiro na tela (vertical e horizontal) */
.auth-shell {
  width: min(1080px, 100%);
  margin: 0 auto; /* Centraliza horizontalmente se a tela for maior que 1080px */
  padding: 20px;
  min-height: 100vh; /* Ocupa a altura total da tela */
  display: flex;
  align-items: center; /* Centraliza o painel verticalmente */
  justify-content: center; /* Centraliza o painel horizontalmente */
  box-sizing: border-box;
}

/* PAINEL DOS ELEMENTOS: Comportamento padrão (Mobile / Telas menores que 700px) */
.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  align-items: center;
  justify-content: center;
}

/* Centraliza os textos e logo no mobile */
.auth-copy {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card {
  width: 100%;
  max-width: 450px; /* Evita que o card de login fique gigante no mobile */
}

/* RESPONSIVIDADE: A partir de 700px vira duas colunas */
@media (min-width: 700px) {
  .auth-panel {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Divide em duas colunas idênticas (50% / 50%) */
    gap: 4rem; /* Espaço generoso entre o lado esquerdo e o direito */
    align-items: center; /* Alinha o topo/meio deles */
  }

  .auth-copy {
    text-align: left; /* Alinha os textos à esquerda na tela grande */
    align-items: flex-start;
  }
  
  .auth-card {
    max-width: 100%; /* Deixa o card preencher o lado direito do grid proporcionalmente */
  }
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 440px);
  gap: var(--space-6);
  align-items: stretch;
}

.auth-card {
  padding: var(--space-5);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

.auth-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.form-field {
  display: grid;
  gap: var(--space-2);
}

.unit-combobox {
  position: relative;
}

.unit-combobox-select {
  display: none;
}

.unit-combobox-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.unit-combobox-options.is-open {
  display: grid;
}

.unit-combobox-option,
.unit-combobox-empty {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
}

.unit-combobox-option:last-child,
.unit-combobox-empty:last-child {
  border-bottom: 0;
}

.unit-combobox-option:hover,
.unit-combobox-option[aria-selected="true"] {
  background: var(--surface-soft);
}

.unit-combobox-empty {
  color: var(--text-muted);
}

.form-label {
  color: var(--text-subtle);
  font-size: 14px;
  font-weight: 500;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
}

.auth-submit {
  width: 100%;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

@media (max-width: 1080px) {
  .hero-panel,
  .detail-hero,
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 2500;
    width: min(86vw, 340px);
    height: 100vh;
    height: 100dvh;
    gap: var(--space-4);
    padding: 64px var(--space-5) var(--space-5);
    overflow-y: auto;
    border-right: 1px solid var(--border);
    border-bottom: 0;
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.18);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.24s ease, visibility 0.24s ease;
  }

  .app-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-menu-toggle,
  .mobile-menu-close {
    display: block;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.48);
    cursor: pointer;
  }

  .mobile-menu-backdrop[hidden] {
    display: none;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    align-items: center;
    padding: var(--space-5);
  }

  .page-content {
    width: min(100% - 32px, 960px);
  }

  .detail-grid,
  .feature-grid,
  .module-grid,
  .kv-grid,
  .metric-grid,
  .filter-grid,
  .verification-layout {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 800px) {
  .cell-grid {
    grid-template-columns: repeat(auto-fill, 420px);
  }

  .cell-card {
    width: 420px;
    min-width: 420px;
  }
}

@media (min-width: 600px) and (max-width: 800px) {
  .person-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 801px) {
  .person-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-content {
    width: calc(100% - 24px);
    padding-bottom: var(--space-6);
  }

  .app-header,
  .panel,
  .auth-card {
    padding: var(--space-4);
  }

  .header-title,
  .hero-title,
  .section-title,
  .auth-title,
  .brand-title {
    font-size: 24px;
    line-height: 1.33;
  }

  .search-form,
  .results-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .search-button,
  .action-col {
    width: 100%;
  }

  .action-col {
    text-align: left;
  }

  .record-line {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
}

.form-field {
  display: grid;
  gap: var(--space-2);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 13px;
  font-weight: 600;
}


/* PAD Digital module */
.pad-panel .section-title {
  letter-spacing: 0;
}

.pad-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
}

.pad-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.pad-table {
  margin-bottom: 0;
}

.pad-table th {
  color: var(--text-subtle);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pad-table td,
.pad-table th {
  padding: 12px 14px;
  vertical-align: middle;
}

.pad-panel form p {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.pad-panel form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pad-panel form input,
.pad-panel form select,
.pad-panel form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
}

.pad-panel form input:focus,
.pad-panel form select:focus,
.pad-panel form textarea:focus {
  outline: 2px solid rgba(23, 109, 37, 0.18);
  border-color: var(--primary);
}

.pad-panel pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 420px;
  overflow: auto;
}

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

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


.pad-form-section {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-container-lowest);
}

.pad-section-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: 0;
}

.pad-label {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}

.pad-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 18px;
}

.pad-error-box {
  padding: 12px 14px;
  border: 1px solid var(--danger-soft);
  border-radius: var(--radius-sm);
  background: #fff7f6;
  color: var(--danger);
  font-size: 14px;
}

.pad-upload-zone {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px dashed var(--outline-variant, #bfcaba);
  border-radius: var(--radius-md);
  background: var(--surface-container-lowest);
}

.pad-preview {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-container-lowest);
}

.pad-preview summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 600;
}

.dso-document-type > div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.dso-document-type label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}

.dso-document-type > .dso-radio-group {
  display: flex;
  flex-wrap: wrap;
  width: auto;
  height: auto;
  gap: 10px 16px;
  align-items: center;
  border: 0;
}

.dso-document-type > .dso-radio-group > div {
  display: inline-flex;
  align-items: center;
}

.dso-document-type input.dso-radio-group {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
