:root {
  --bg: #f3eeec;
  --panel: #fff9f8;
  --line: #decdca;
  --ink: #181212;
  --muted: #695b59;
  --accent: #9d1f25;
  --accent-strong: #74161b;
  --accent-soft: #f3d7d4;
  --danger: #7f1015;
  --notice: #9a6a00;
  --notice-strong: #6f4a00;
  --notice-soft: #fff7dc;
  --notice-line: #e5bd4d;
  --shadow: 0 18px 40px rgba(24, 18, 18, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(157, 31, 37, 0.12), transparent 30%),
    linear-gradient(180deg, #f8f2f1 0%, var(--bg) 100%);
}

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

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.login-card {
  width: min(100%, 460px);
  background: rgba(255, 249, 248, 0.96);
  border: 1px solid rgba(222, 205, 202, 0.92);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 36px;
  backdrop-filter: blur(10px);
}

.login-logo,
.sidebar-logo,
.hero-brand,
.powered-by img {
  display: block;
  max-width: 100%;
  object-fit: contain;
}

.login-logo {
  width: 250px;
  margin: 0 auto 14px;
}

.sidebar-logo {
  width: 178px;
  margin: 0 auto 14px;
}

.hero-brand {
  width: 220px;
  opacity: 0.98;
}

.brand-chip,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, rgba(21, 17, 18, 0.98) 0%, rgba(34, 22, 23, 0.96) 100%);
  color: #f7efee;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-title {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.15;
}

.sidebar-top {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

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

.nav-list a {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff5f4;
  font-weight: 600;
}

.nav-list a:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
}

.user-card,
.panel,
.stat-card,
.table-card,
.form-card,
.hero {
  background: var(--panel);
  border: 1px solid rgba(216, 209, 196, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.content {
  padding: 28px;
  display: grid;
  gap: 22px;
}

.powered-by {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.powered-by img {
  width: 130px;
}

.sidebar-powered {
  margin-top: auto;
}

.sidebar .muted {
  color: rgba(247, 239, 238, 0.78);
}

.hero {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.spider-hero {
  background:
    radial-gradient(circle at top center, rgba(157, 31, 37, 0.2), transparent 34%),
    linear-gradient(135deg, #181112 0%, #251416 58%, #341719 100%);
  color: #fff5f4;
  border-color: rgba(116, 22, 27, 0.28);
  padding: 28px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-logo-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.hero-copy {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
}

.spider-hero .muted,
.spider-hero p {
  color: rgba(255, 245, 244, 0.82);
}

.hero-brand-large {
  width: min(100%, 540px);
  filter: drop-shadow(0 20px 38px rgba(0, 0, 0, 0.28));
}

.hero > div,
.split > *,
.reports-split > *,
.import-split > *,
.mobile-access-split > * {
  min-width: 0;
}

.hero h2,
.panel h3,
.login-card h1 {
  margin: 10px 0 8px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.stat-card {
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 249, 248, 0.98) 0%, rgba(252, 242, 241, 0.94) 100%);
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
}

.stat-card strong {
  font-size: 30px;
}

.panel {
  padding: 20px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel h4 {
  margin-top: 0;
  margin-bottom: 14px;
}

.split {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

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

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

.form-card,
.table-card {
  padding: 18px;
}

.form-card.compact {
  max-width: 360px;
}

.form-card.superadmin-locked {
  opacity: 0.72;
  background: #f6f0ed;
}

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

.stack-lg {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

input,
button,
select {
  font: inherit;
}

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

.password-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.password-control input {
  border: 0;
  border-radius: 0;
}

.password-control input:focus {
  outline: none;
}

.password-toggle {
  border: 0;
  align-self: stretch;
  padding: 0 14px;
  background: #f1e4e2;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.password-toggle:hover {
  background: var(--accent-soft);
}

.caps-lock-warning {
  display: inline-flex;
  width: fit-content;
  margin-top: 2px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--notice-soft);
  color: var(--notice-strong);
  border: 1px solid var(--notice-line);
  font-size: 12px;
  font-weight: 700;
}

.caps-lock-warning[hidden] {
  display: none;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-secondary {
  background: #f1e4e2;
  color: var(--ink);
}

.user-card {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255, 250, 249, 0.18) 0%, rgba(255, 255, 255, 0.08) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.user-name {
  color: #fff7f6;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.user-role {
  margin-top: 4px;
  color: rgba(247, 239, 238, 0.82);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.w-full {
  width: 100%;
}

.muted {
  color: var(--muted);
}

.login-note,
.message {
  margin-top: 14px;
  color: var(--muted);
}

.message:not(:empty) {
  color: var(--notice-strong);
  font-weight: 700;
}

.login-alert {
  margin-top: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--notice-line);
  background: var(--notice-soft);
  color: var(--notice-strong);
  font-weight: 700;
  line-height: 1.35;
}

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

.resident-risk-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(116, 22, 27, 0.12);
  background: linear-gradient(180deg, rgba(255, 250, 247, 0.98), rgba(255, 244, 240, 0.96));
  box-shadow: 0 18px 36px rgba(59, 29, 18, 0.08);
}

.resident-risk-card.warning {
  border-color: rgba(212, 154, 33, 0.42);
  background: linear-gradient(180deg, rgba(255, 248, 228, 0.98), rgba(255, 242, 202, 0.96));
}

.resident-risk-value {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  color: #74161b;
}

.resident-risk-card.warning .resident-risk-value {
  color: #8a5a00;
}

.resident-risk-copy {
  margin: 10px 0 0;
  color: #534540;
  line-height: 1.5;
}

.resident-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resident-state-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f4ecec;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resident-state-pill.warning {
  background: var(--notice-soft);
  color: var(--notice-strong);
}

.resident-meter {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  background: rgba(116, 22, 27, 0.08);
  overflow: hidden;
}

.resident-meter span {
  display: block;
  height: 100%;
  width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9d1f25 0%, #cf4b3f 100%);
}

.resident-risk-card.warning .resident-meter span {
  background: linear-gradient(90deg, #c38716 0%, #f1c232 100%);
}

.resident-body {
  min-height: 100vh;
  padding: 18px 14px 28px;
  background:
    radial-gradient(circle at top center, rgba(157, 31, 37, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf7f5 0%, #f2ebe7 100%);
}

.resident-app {
  width: min(100%, 460px);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.resident-hero-card,
.resident-panel {
  background: rgba(255, 249, 248, 0.98);
  border: 1px solid rgba(216, 209, 196, 0.9);
  border-radius: 24px;
  box-shadow: 0 18px 40px rgba(24, 18, 18, 0.08);
  padding: 18px;
}

.resident-hero-top {
  display: grid;
  gap: 14px;
}

.resident-hero-top-rich {
  gap: 18px;
}

.resident-hero-card {
  background:
    radial-gradient(circle at top center, rgba(157, 31, 37, 0.22), transparent 34%),
    linear-gradient(135deg, #181112 0%, #281516 58%, #3a1a1d 100%);
  color: #fff5f4;
  border-color: rgba(116, 22, 27, 0.28);
}

.resident-hero-card .muted {
  color: rgba(255, 245, 244, 0.82);
}

.resident-hero-logo {
  width: min(100%, 230px);
  margin: 14px 0 4px;
  display: block;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.26));
}

.resident-plates {
  margin: 10px 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
}

.resident-access-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}

.resident-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff7f6;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.resident-mode-badge.muted-badge {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 245, 244, 0.8);
}

.resident-exit-form {
  width: 100%;
}

.resident-panel h2,
.resident-hero-card h1 {
  margin: 8px 0;
}

.resident-glance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.resident-glance-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 4px;
}

.resident-glance-card span,
.resident-glance-card small {
  color: rgba(255, 245, 244, 0.8);
}

.resident-glance-card strong {
  font-size: 24px;
  line-height: 1;
  color: #fff;
}

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

.resident-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f3e4df;
  color: var(--accent-strong);
  font-weight: 800;
}

.resident-scroll-stack {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.resident-list-card,
.resident-empty-card {
  border: 1px solid rgba(116, 22, 27, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(253, 247, 246, 0.96));
  padding: 14px;
  box-shadow: 0 12px 24px rgba(24, 18, 18, 0.05);
}

.resident-list-card {
  display: grid;
  gap: 10px;
}

.resident-list-card-compact strong {
  font-size: 20px;
}

.resident-empty-card {
  color: var(--muted);
}

.resident-list-row {
  display: grid;
  gap: 4px;
}

.resident-list-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.resident-status-badge {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.resident-alert-strong {
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(255, 247, 220, 0.98), rgba(255, 238, 191, 0.96));
  border-color: rgba(229, 189, 77, 0.42);
}

.resident-highlight-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.resident-highlight-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.resident-highlight-kicker {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 245, 244, 0.72);
  margin-bottom: 6px;
}

.resident-highlight-card strong {
  color: #ffffff;
  font-size: 16px;
}

.resident-fine-card.pending {
  border-color: rgba(212, 154, 33, 0.28);
  background: linear-gradient(180deg, rgba(255, 251, 241, 0.98), rgba(255, 244, 220, 0.96));
}

.login-meta,
.license-details {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #f6f1e8;
  border: 1px solid #e7dcc9;
  font-size: 14px;
}

.legal-doc-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.legal-content {
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.legal-content h1,
.legal-content h2,
.legal-content h3 {
  margin: 6px 0 0;
}

.legal-content p,
.legal-content ul {
  margin: 0;
  line-height: 1.6;
}

.legal-content ul {
  padding-left: 22px;
}

.checkbox-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.checkbox-field a,
.legal-footer a,
.legal-inline-note a {
  color: var(--accent);
  text-decoration: underline;
}

.legal-inline-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.legal-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #e7dcc9;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.legal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.legal-page-body {
  align-items: start;
}

.legal-page-card {
  width: min(100%, 840px);
}

.license-screen {
  width: min(100%, 680px);
}

.license-banner {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  margin-top: 14px;
  margin-bottom: 6px;
}

.license-banner.ok {
  background: #f4ecec;
  color: #5d171c;
}

.license-banner.warn {
  background: var(--notice-soft);
  color: var(--notice-strong);
  border: 1px solid var(--notice-line);
}

.mobile-access-split {
  grid-template-columns: minmax(0, 1.05fr) minmax(220px, 0.55fr) minmax(280px, 0.8fr);
}

.mobile-access-card {
  display: grid;
  gap: 14px;
}

.mobile-qr-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.mobile-qr-box {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #ead9d7;
}

.mobile-qr-box img {
  width: min(100%, 220px);
  height: auto;
  display: block;
}

.mobile-access-status {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
}

.mobile-access-status.ok {
  background: #f4ecec;
  color: #5d171c;
}

.mobile-access-status.warn {
  background: var(--notice-soft);
  color: var(--notice-strong);
  border: 1px solid var(--notice-line);
}

.mobile-url-box {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1a1213 0%, #62151a 100%);
  color: #fff;
}

.mobile-url-box span {
  font-size: 13px;
  opacity: 0.88;
}

.mobile-url-box strong {
  font-size: 22px;
  line-height: 1.35;
  word-break: break-word;
}

.mobile-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  display: grid;
  gap: 10px;
}

.template-link {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 14px;
}

.import-errors {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.import-error-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--notice-soft);
  border: 1px solid var(--notice-line);
  font-size: 13px;
  color: var(--notice-strong);
}

.table-wrap {
  overflow: auto;
}

.compact-table {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #ece4d7;
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.pagination-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-meta {
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #ece4d7;
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-tools {
  margin-bottom: 12px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  margin-right: 10px;
  font-weight: 700;
}

.link-btn.danger {
  color: var(--danger);
}

.license-bottom-panel {
  margin-top: 2px;
}

.guard-body {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  padding: 18px;
}

.guard-phone {
  width: min(100%, 460px);
  display: grid;
  gap: 16px;
}

.guard-header,
.guard-card {
  background: var(--panel);
  border: 1px solid rgba(216, 209, 196, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.guard-header {
  display: grid;
  gap: 12px;
  text-align: center;
  background:
    radial-gradient(circle at top center, rgba(157, 31, 37, 0.24), transparent 42%),
    linear-gradient(135deg, #181112 0%, #2a1517 100%);
  color: #fff5f4;
}

.guard-header p {
  margin: 0;
  color: rgba(255, 245, 244, 0.82);
}

.guard-header h1,
.guard-card h2,
.guard-card h3 {
  margin: 8px 0;
}

.guard-logo {
  width: min(100%, 280px);
  margin: 0 auto;
}

.guard-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.photo-chip {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px dashed #cfa9a6;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.photo-chip.wide {
  width: 100%;
}

.photo-chip span {
  color: var(--muted);
  font-size: 12px;
}

.photo-chip strong {
  color: var(--accent);
}

.photo-chip.done {
  border-style: solid;
  background: #f4ecec;
}

.spider-evidence-card {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: var(--notice-soft);
  border: 1px solid var(--notice-line);
}

.spider-evidence-card[hidden],
.field-manual[hidden] {
  display: none !important;
}

.field-manual {
  grid-column: 1 / -1;
}

.plate-preview-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: #171111;
  color: #fff5f4;
}

.plate-preview-card[hidden] {
  display: none;
}

.plate-preview-card span {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 245, 244, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plate-preview-card img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 14px;
  background: #000;
}

.guard-list-card {
  margin-top: 16px;
  box-shadow: none;
}

.guard-stays-list {
  display: grid;
  gap: 10px;
}

.guard-stay-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8f1f0;
  border: 1px solid #ead9d7;
}

.guard-stay-item span {
  color: var(--muted);
  font-size: 13px;
}

.color-field {
  grid-column: 1 / -1;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid #e8d8d6;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.62);
}

.color-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(157, 31, 37, 0.18);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.guard-powered {
  justify-content: center;
  padding-bottom: 12px;
}

@media (max-width: 1080px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .stats-grid,
  .split,
  .form-grid,
  .import-split,
  .reports-split,
  .mobile-access-split {
    grid-template-columns: 1fr;
  }

  .form-card.compact {
    max-width: none;
  }
}

@media (max-width: 820px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(157, 31, 37, 0.12), transparent 36%),
      linear-gradient(180deg, #f8f2f1 0%, var(--bg) 100%);
  }

  .content {
    padding: 18px;
    gap: 16px;
  }

  .sidebar {
    padding: 18px 16px;
    gap: 16px;
  }

  .sidebar-title {
    font-size: 22px;
  }

  .nav-list {
    display: grid;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
    margin: 0;
  }

  .nav-list a {
    white-space: normal;
    flex: initial;
  }

  .hero {
    padding: 20px;
    flex-direction: column;
  }

  .hero-brand {
    width: 180px;
  }

  .hero-brand-large {
    width: min(100%, 420px);
  }

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

  .panel,
  .table-card,
  .form-card {
    padding: 16px;
  }

  .mobile-url-box strong {
    font-size: 18px;
  }

  .pagination-bar {
    align-items: stretch;
  }

  .pagination-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pagination-actions .btn {
    flex: 1 1 0;
  }
}

@media (max-width: 640px) {
  .login-body {
    padding: 16px;
  }

  .login-card,
  .license-screen {
    width: 100%;
    padding: 24px 18px;
    border-radius: 24px;
  }

  .legal-page-card {
    width: 100%;
  }

  .portal-shell {
    min-height: auto;
  }

  .content {
    padding: 14px;
    gap: 14px;
  }

  .sidebar {
    padding: 16px 14px;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
  }

  .sidebar-logo {
    width: 128px;
  }

  .sidebar-powered {
    margin-top: 0;
  }

  .powered-by {
    flex-wrap: wrap;
  }

  .hero {
    padding: 18px;
  }

  .hero h2 {
    font-size: 26px;
    line-height: 1.15;
  }

  .hero-actions {
    display: none;
  }

  .hero-brand-large {
    width: min(100%, 360px);
  }

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

  .stat-card {
    padding: 16px;
  }

  .stat-card strong {
    font-size: 26px;
  }

  .panel,
  .table-card,
  .form-card {
    padding: 14px;
    border-radius: 18px;
  }

  .panel-header {
    margin-bottom: 12px;
  }

  .panel h3 {
    font-size: 20px;
  }

  .field span {
    font-size: 12px;
  }

  input,
  select {
    padding: 11px 12px;
    min-height: 44px;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row .btn,
  .action-row a.btn {
    width: 100%;
  }

  .mobile-url-box {
    padding: 14px;
  }

  .mobile-url-box strong {
    font-size: 16px;
  }

  .login-logo {
    width: 210px;
  }

  .login-meta,
  .license-details {
    padding: 12px;
    font-size: 13px;
  }

  .checkbox-field {
    grid-template-columns: 18px 1fr;
    font-size: 12px;
  }

  .legal-footer-links {
    flex-direction: column;
    gap: 6px;
  }

  .compact-table {
    max-height: 340px;
    border-radius: 12px;
  }

  table {
    min-width: 640px;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
  }

  th {
    font-size: 11px;
  }

  .pagination-meta {
    font-size: 12px;
  }

  .pagination-actions {
    gap: 6px;
  }

  .template-link,
  .btn {
    justify-content: center;
  }

  .resident-body {
    padding: 12px 10px 24px;
  }

  .resident-app {
    width: 100%;
    gap: 12px;
  }

  .resident-hero-card,
  .resident-panel,
  .resident-risk-card {
    border-radius: 20px;
    padding: 16px;
  }

  .resident-plates {
    font-size: 24px;
  }

  .resident-glance-grid {
    grid-template-columns: 1fr;
  }

  .resident-highlight-strip {
    grid-template-columns: 1fr;
  }

  .resident-scroll-stack {
    max-height: 320px;
  }

  .resident-risk-value {
    font-size: 30px;
  }
}

@media (max-width: 420px) {
  .content {
    padding: 12px;
  }

  .sidebar,
  .hero,
  .panel,
  .table-card,
  .form-card {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-chip,
  .eyebrow {
    font-size: 11px;
    padding: 5px 10px;
  }

  .hero h2 {
    font-size: 23px;
  }

  .login-logo {
    width: 180px;
  }

  .mobile-steps {
    padding-left: 18px;
    gap: 8px;
    font-size: 14px;
  }
}
