/* DNRPro components — built on tokens.css (Design System v0.1). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--text); font-family: var(--font-sans); font-size: 15px; line-height: 1.45; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Layout */
.appbar { background: var(--bg-appbar); border-bottom: 1px solid var(--border); }
.appbar-inner { padding: 0 20px; min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.appbar-date { flex: 1 1 auto; text-align: center; font-weight: 600; }
.appbar-right { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 14px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.logo-word { font-size: 19px; letter-spacing: -0.02em; }
.logo-word b { font-weight: 700; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--text); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; }
.shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: calc(100vh - 57px); }
.sidebar { flex: 1 1 200px; max-width: 100%; background: var(--bg-surface); border-right: 1px solid var(--border); padding: 12px 0; display: flex; flex-direction: column; }
.sidebar a { display: block; padding: 11px 20px; color: var(--text-secondary); text-decoration: none; border-right: 3px solid transparent; }
.sidebar a:hover { background: var(--bg-sunken); color: var(--text); }
.sidebar a[aria-current="page"] { color: var(--primary); font-weight: 600; background: var(--primary-tint); border-right-color: var(--primary); }
.sidebar .spacer { flex: 1; }
.sidebar form button { width: 100%; text-align: left; padding: 11px 20px; background: none; border: 0; font: inherit; color: var(--text-muted); cursor: pointer; }
.main { flex: 999 1 640px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.crumbs { font-size: 14px; color: var(--text-muted); }
.crumbs a { text-decoration: none; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-side { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .main { padding: 16px; } }

/* Cards */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.card.tight { padding: 16px 18px; gap: 10px; }
.card-flush { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.card-flush > .card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.card-flush > .card-row { padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); }
.card-flush > .card-row:last-child { border-bottom: 0; }
.card.selected, .result.selected { border: 2px solid var(--primary); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.stat { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--font-mono); font-size: 28px; font-weight: 500; }
.stat span { font-size: 14px; color: var(--text-secondary); }

/* Forms */
label, .label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.help { font-size: 12px; color: var(--text-muted); }
.help.ok { color: var(--success-text); }
.error { font-size: 13px; color: var(--dnr-active-text); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  font: inherit; font-size: 15px; color: var(--text); background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-control); height: 46px; padding: 0 14px; width: 100%; }
textarea { height: auto; padding: 12px 14px; resize: vertical; min-height: 96px; }
select { padding: 0 10px; }
input.big { height: 52px; font-size: 22px; font-weight: 500; }
input.big:focus { border: 2px solid var(--primary); outline: none; }
input.mono-input { font-family: var(--font-mono); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: 15px; color: var(--text); cursor: pointer; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-control); overflow: hidden; }
.segmented label { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; color: var(--text); font-size: 15px; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--border-strong); }
.segmented label:has(input:checked) { background: var(--text); color: #fff; font-weight: 600; }
.segmented input { accent-color: #fff; }
.choice { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-control); cursor: pointer; }
.choice:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-tint-2); }
.choice input { margin-top: 3px; flex: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: var(--radius-control);
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.btn-sm { height: 40px; padding: 0 14px; font-size: 14px; }
.btn-xs { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-primary:disabled, .btn-primary[aria-disabled=true] { background: var(--primary-disabled); cursor: not-allowed; }
.btn-secondary { background: var(--bg-surface); color: var(--text); border-color: var(--border-strong); font-weight: 500; }
.btn-secondary:hover { background: var(--bg-sunken); color: var(--text); }
.btn-outline { background: var(--bg-surface); color: var(--primary); border-color: var(--primary); }
.btn-danger { background: var(--bg-surface); color: var(--dnr-active-text); border-color: var(--dnr-active-border); }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; height: auto; font-weight: 500; cursor: pointer; font: inherit; }
.btn-block { width: 100%; }

/* Labels */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill-lg { height: 28px; padding: 0 12px; }
.pill-active { background: var(--dnr-active); color: #fff; }
.pill-review { background: var(--review-tint); color: var(--review-text); }
.pill-neutral { background: var(--neutral-label-bg); color: var(--neutral-label-text); }
.pill-id { background: var(--id-tint); color: var(--id-text); }
.pill-outline { border: 1px solid var(--border-strong); color: var(--text-secondary); font-weight: 500; }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: var(--radius-control); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-neutral { background: var(--neutral-label-bg); color: var(--neutral-label-text); }
.tag-id { background: var(--id-tint); color: var(--id-text); }
.tag-review { background: var(--review-tint); color: var(--review-text); }
.chip-ok { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--success-tint); color: var(--success-text); font-weight: 500; font-size: 14px; }
.chip-alert { background: var(--dnr-active-tint); color: var(--dnr-active-text); border: 1px solid var(--dnr-active-border); }
.chip-neutral { background: var(--neutral-label-bg); color: var(--neutral-label-text); }

/* Banners */
.banner { border-radius: var(--radius-control); padding: 12px 16px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner-active { background: var(--dnr-active-tint); border: 1px solid var(--dnr-active-border); color: #5E0D10; flex-direction: column; gap: 4px; }
.banner-active strong { color: var(--dnr-active-text); font-size: 16px; }
.banner-review { background: var(--review-tint); border: 1px solid var(--review-border); color: #5C3A00; }
.banner-ok { background: var(--success-tint); border: 1px solid var(--success-border); color: var(--success-text); }
.banner-info { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary); }
.banner-neutral { background: var(--bg-sunken); border: 1px solid var(--border); color: var(--text-secondary); flex-direction: column; gap: 4px; }
.messages { display: flex; flex-direction: column; gap: 8px; }

/* Results & lists */
.result { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: var(--text); cursor: pointer; text-align: left; font: inherit; width: 100%; }
.result:hover { border-color: var(--border-strong); }
.result .name { font-size: 19px; font-weight: 600; }
.result .meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--text-muted); }
.result.dim { opacity: 0.85; }
blockquote { margin: 0; padding: 10px 14px; background: var(--bg-sunken); border-radius: var(--radius-control); font-size: 14px; color: var(--text-secondary); white-space: pre-line; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); background: var(--bg-sunken); padding: 10px 14px; border-bottom: 1px solid var(--border); }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list a { text-decoration: none; font-weight: 600; }
.table-wrap { overflow-x: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; }
.compare > div { padding: 8px 12px; border-top: 1px solid var(--border); }
.compare > div.h { background: var(--bg-sunken); font-weight: 600; color: var(--text-muted); border-top: 0; }
.compare > div.k { color: var(--text-muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.timeline li:last-child { border-bottom: 0; }
@media (max-width: 760px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }
dl.facts { margin: 0; display: flex; flex-direction: column; gap: 14px; }
dl.facts dt { font-size: 13px; color: var(--text-muted); }
dl.facts dd { margin: 0; }
.restriction { border: 1px solid var(--border); border-radius: var(--radius-control); overflow: hidden; }
.restriction-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg-page); }
.restriction.is-active { border-color: var(--dnr-active-border); }
.restriction.is-active .restriction-head { background: var(--dnr-active-tint); }
.restriction.is-review { border-color: var(--review-border); }
.restriction.is-review .restriction-head { background: var(--review-tint); }
.restriction-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; font-size: 13px; }
.kv span:first-child { color: var(--text-muted); display: block; }
@media (max-width: 760px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photo { width: 104px; height: 104px; border-radius: var(--radius-card); border: 1px solid var(--border); background: #E9ECF1; object-fit: cover; display: flex; align-items: center; justify-content: center; flex: none; }
.id-image { width: 100%; aspect-ratio: 1.586; object-fit: cover; border-radius: var(--radius-card); border: 1px solid var(--border); background: #EEF1F5; }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.thumbs img { width: 100%; aspect-ratio: 1.586; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); }
.tabs a { height: 42px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text-secondary); border-bottom: 3px solid transparent; font-weight: 500; }
.tabs a[aria-current=true] { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; }
.stickybar { position: sticky; bottom: 0; margin: 0 -24px -24px; padding: 16px 24px; background: var(--bg-surface); border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 14px; }
kbd { font-family: var(--font-mono); padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-sunken); font-size: 13px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.htmx-indicator { opacity: 0; transition: opacity 150ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-card h1 { font-size: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card form p { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.auth-card button[type=submit], .auth-card .btn-primary { display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 20px; border-radius: var(--radius-control); border: 0; background: var(--primary); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; }
.auth-card button[type=submit]:hover { background: var(--primary-hover); }
.auth-card ul.errorlist { margin: 0; padding: 0; list-style: none; color: var(--dnr-active-text); font-size: 13px; }
.auth-card .provider-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 48px; border: 1px solid var(--border-strong); border-radius: var(--radius-control); background: var(--bg-surface); color: var(--text); font-weight: 500; text-decoration: none; width: 100%; font: inherit; cursor: pointer; }
.steps { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; font-size: 14px; color: var(--text-muted); }
.steps li[aria-current=step] { color: var(--text); font-weight: 600; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.checklist li::before { content: "✓"; color: var(--success-text); font-weight: 700; margin-right: 8px; }
.checklist li.no::before { content: "–"; color: var(--text-muted); }
ul.plain { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.inline-form { display: inline; }
.reason-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.reason-row:last-child { border-bottom: 0; }
.reason-row input[type=text] { height: 40px; max-width: 240px; }
.scan-status { display: none; }
.scan-status.show { display: flex; }
.from-id { font-size: 12px; color: var(--success-text); font-weight: 600; }
.panel-empty { color: var(--text-muted); text-align: center; padding: 48px 16px; }
@media (max-width: 760px) {
  .sidebar { flex: 1 1 100%; flex-direction: row; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
  .sidebar a { padding: 12px 14px; border-right: 0; border-bottom: 3px solid transparent; }
  .sidebar a[aria-current="page"] { border-right-color: transparent; border-bottom-color: var(--primary); }
  .sidebar .spacer { display: none; }
  .sidebar form button { padding: 12px 14px; }
  .appbar-date { display: none; }
}
[x-cloak] { display: none !important; }
.usermenu { position: relative; }
.usermenu .avatar { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 240px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: 0 8px 24px rgba(20, 23, 28, 0.12); padding: 6px 0; }
.menu-head { padding: 10px 16px 12px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.menu-head span { font-size: 12px; color: var(--text-muted); }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 10px 16px; background: none; border: 0; font: inherit; font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg-sunken); color: var(--text); }
.menu form { margin: 0; border-top: 1px solid var(--border-subtle); margin-top: 4px; padding-top: 4px; }
/* Phones: compact top bar and a single-line, swipeable menu row */
@media (max-width: 760px) {
  .desktop-only { display: none !important; }
  .shell { flex-direction: column; flex-wrap: nowrap; min-height: 0; }
  .sidebar { flex: 0 0 auto; position: sticky; top: 0; z-index: 20; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar a { flex: 0 0 auto; padding: 10px 14px; font-size: 15px; }
  .main { flex: 1 1 auto; gap: 16px; }
  .appbar-inner { min-height: 52px; padding: 0 16px; flex-wrap: nowrap; gap: 12px; }
  .appbar-right { min-width: 0; gap: 10px; margin-left: auto; }
  .appbar-right > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .logo-word { font-size: 17px; }
  .logo-mark { width: 26px; height: 26px; }
  input.big { height: 48px; font-size: 18px; }
  h1 { font-size: 24px; }
  .card { padding: 16px; }
  .stickybar { margin: 0 -16px -16px; padding: 12px 16px; }
}
@media (max-width: 760px) { .photo { width: 72px; height: 72px; font-size: 11px; } }
.glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) {
  .glance .stat { padding: 12px 14px; }
  .glance .stat b { font-size: 22px; }
  .search-foot:not(:has(.scan-status.show)) { display: none; }
}

/* Keep a scanned ID number off the shared screen unless someone is editing it. */
.masked:not(:focus) { -webkit-text-security: disc; text-security: disc; }
.mobile-only { display: none; }
.menu-group { border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; padding-bottom: 4px; }
/* Phones: Imports, Activity and Settings move into the account menu so the strip fits one screen. */
@media (max-width: 760px) {
  .sidebar .nav-more { display: none; }
  .mobile-only { display: block; }
  .sidebar a { flex: 1 1 0; text-align: center; }
}
[aria-invalid="true"] { border-color: var(--dnr-active-border) !important; box-shadow: 0 0 0 1px var(--dnr-active-border); }
#error-summary ul { margin: 4px 0 0; }
#error-summary a { color: inherit; text-decoration: underline; }
.decide-alt .btn { white-space: normal; height: auto; min-height: 44px; padding: 8px 12px; line-height: 1.25; }
.perm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.perm-row { align-items: flex-start; }
.perm-row input { margin-top: 3px; }
.perm-override { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.perm-override .perm-label { font-weight: 500; color: var(--text); font-size: 14px; }
.perm-override select { max-width: 200px; height: 36px; }
@media (max-width: 760px) { .perm-list { grid-template-columns: 1fr; } .perm-override { flex-direction: column; align-items: stretch; } .perm-override select { max-width: none; } }
.btn-link.small { font-size: 13px; }
