:root {
  color-scheme: light;
  --text: #202124;
  --muted: #5f6368;
  --bg: #f4f5f6;
  --surface: #ffffff;
  --line: #dadce0;
  --accent: #0f6b75;
  --accent-hover: #0c5860;
  --accent-soft: #e6f3f4;
  --danger: #c5221f;
  --pdf-bg: #ffffff;
  --shadow-focus: 0 1px 6px rgba(32, 33, 36, 0.18);
  --radius: 12px;
  --radius-pill: 28px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --theme-chrome: #ffffff;
}

html[data-resolved="dark"] {
  color-scheme: dark;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --bg: #121314;
  --surface: #1c1d20;
  --line: #3c4043;
  --accent: #7ec8d0;
  --accent-hover: #9ad5db;
  --accent-soft: #1a3336;
  --danger: #f28b82;
  --pdf-bg: #ffffff;
  --shadow-focus: 0 1px 8px rgba(0, 0, 0, 0.45);
  --theme-chrome: #121314;
}

/* Inter (SIL OFL 1.1), self-hosted — do not load Google Fonts on a PII app. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/InterVariable.woff2") format("woff2");
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: auto;
  accent-color: var(--accent);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 30;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
}

.skip-link:focus {
  top: 12px;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
iframe:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px max(20px, env(safe-area-inset-right, 0px)) 10px
    max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  color: var(--accent);
  text-decoration: none;
}
.brand-mark {
  display: block;
  flex-shrink: 0;
  color: var(--accent);
}
.brand:hover .brand-mark {
  color: var(--accent-hover);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px 18px;
}

.topbar-nav a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 0;
}

.topbar-nav a:hover {
  color: var(--text);
  text-decoration: none;
}
.topbar-nav a.is-active {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--text);
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.logout-form {
  margin: 0;
}
.logout-btn {
  color: var(--muted);
  min-height: 36px;
}

.theme-switch button:hover {
  color: var(--text);
}
.theme-switch button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 24px;
  flex: 1;
}

.page-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 1rem;
  max-width: 40rem;
}

.search-form {
  margin-bottom: 8px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  padding: 4px 6px 4px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.search-bar:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-focus);
}

.search-icon {
  display: flex;
  color: var(--muted);
  flex-shrink: 0;
}

.search-bar input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 8px;
  appearance: none;
  -webkit-appearance: none;
}

.search-bar input:focus {
  outline: none;
}
.search-bar input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.search-bar input::-webkit-search-decoration,
.search-bar input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.search-submit {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

html[data-resolved="dark"] .search-submit,
html[data-resolved="dark"] .skip-link {
  color: #102326;
}

.search-submit:hover {
  background: var(--accent-hover);
}

.progress {
  height: 3px;
  margin: 2px 24px 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%;
  animation: progress-slide 1s linear infinite;
}

.search-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 10px;
  min-height: 32px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.search-tools::-webkit-scrollbar {
  display: none;
}
.search-tools .text-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.text-btn:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.text-btn[aria-expanded="true"],
.text-btn.has-filters {
  color: var(--accent);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 16px;
  margin-top: 12px;
  padding: 16px 18px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.filters input,
.filters select,
.batch-panel textarea {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.filters input:focus,
.filters select:focus,
.batch-panel textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.result-meta {
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.state-msg {
  margin: 40px 0 28px;
  text-align: center;
  color: var(--muted);
}

.state-msg.idle {
  font-size: 1rem;
}
.state-msg[data-kind="error"] {
  color: var(--danger);
}
.state-msg[data-kind="error"] p {
  margin: 0 0 12px;
}

.table-panel {
  overflow: hidden;
}
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}
.col-owner {
  width: 34%;
}
.col-decision {
  width: 22%;
}
.col-open {
  width: 2.75rem;
}

th,
td {
  padding: 13px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: 0.925rem;
}

th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
}

tbody tr {
  cursor: default;
}
tbody tr[data-id],
tbody tr[data-href] {
  cursor: pointer;
}
tbody tr[data-id]:hover,
tbody tr[data-href]:hover {
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
}
tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
tbody tr:last-child td {
  border-bottom: none;
}

.person-name {
  font-weight: 500;
  letter-spacing: -0.01em;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}
.person-meta,
.muted {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
.match-chip {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.asset-more {
  margin-top: 4px;
  padding: 0;
  min-height: 0;
  font-size: 0.8rem;
}
tbody tr.is-selected {
  background: var(--accent-soft);
}

.batch-panel {
  padding: 18px;
}
.batch-panel label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 8px;
}
.batch-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 10rem;
}
.batch-panel .search-tools {
  margin-top: 12px;
}
.batch-results {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.batch-group {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.batch-group:last-child {
  border-bottom: 0;
}
.batch-group h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}
.batch-group ul {
  margin: 0;
  padding-left: 1.1rem;
}
.batch-miss {
  color: var(--muted);
}

.pdf-missing {
  flex: 1;
  min-height: 40vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.pdf-missing p {
  margin: 0;
}
.pdf-pane iframe[hidden] {
  display: none !important;
}
.decision-no {
  font-variant-numeric: tabular-nums;
}
.row-actions {
  width: 2.75rem;
  padding-left: 0;
  padding-right: 12px;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.row-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  border-radius: 50%;
}

.row-open:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
  text-decoration: none;
}

mark {
  background: var(--accent-soft);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.btn-secondary {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn-secondary:hover {
  background: var(--bg);
}

.site-footer {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}
.detail:not([hidden]) ~ .site-footer {
  display: none;
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px max(64px, env(safe-area-inset-bottom, 0px));
}

.login-card {
  width: 100%;
  max-width: 22rem;
}

.login-card h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-error {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.9rem;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-form label {
  display: grid;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.login-form input {
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.login-submit {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
}

.cf-turnstile {
  min-height: 65px;
}

.crumb {
  margin: 0 0 8px;
  font-size: 0.875rem;
}
.crumb a {
  font-weight: 500;
}

.report-index {
  display: grid;
  gap: 0;
  margin: 8px 0 24px;
  overflow: hidden;
}

.report-index a {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.report-index a:last-child {
  border-bottom: 0;
}
.report-index a:hover {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  text-decoration: none;
}
.report-index strong {
  display: block;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.report-index span {
  color: var(--muted);
  font-size: 0.9rem;
}

.report-shell {
  padding: 16px 16px 18px;
}
.report-shell .search-form {
  margin-bottom: 0;
}
.report-shell .result-meta {
  margin: 12px 4px 8px;
}
.report-shell .state-msg {
  margin: 24px 0;
}
.report-shell .table-wrap {
  margin: 0 -16px -18px;
  border-top: 1px solid var(--line);
}
.report-shell .load-more-wrap {
  margin-bottom: 4px;
}

.report-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.report-kinds button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.report-kinds button:hover {
  color: var(--text);
  background: var(--bg);
}
.report-kinds button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.detail {
  flex: 1;
}
.detail-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}
.back-link:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-heading {
  margin-bottom: 18px;
}
.detail-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.detail-sub {
  margin: 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}

.detail-meta {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.detail-meta > .panel {
  padding: 14px 16px 16px;
}
.detail-meta .panel-title {
  margin-bottom: 8px;
}

.fields {
  margin: 0;
}
.fields div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.fields div:last-child {
  border-bottom: 0;
}
.fields dt {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.fields dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.asset-card {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.asset-card:last-of-type {
  border-bottom: 0;
}
.asset-card strong {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.tax-table th,
.tax-table td {
  text-align: left;
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  background: transparent;
}
.tax-table tbody tr {
  cursor: default;
}
.tax-table tbody tr:hover {
  background: transparent;
}
.tax-table th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tax-amount {
  white-space: nowrap;
}
.asset-list-more {
  margin-top: 8px;
  padding-left: 0;
}

.pdf-pane {
  min-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
}

.pdf-pane iframe {
  flex: 1;
  width: 100%;
  border: 0;
  min-height: 70vh;
  background: var(--pdf-bg);
  color-scheme: light;
}

@keyframes progress-slide {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}

@media (max-width: 860px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .pdf-pane,
  .pdf-pane iframe {
    min-height: 42vh;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 8px 12px;
  }
  .brand {
    margin-right: auto;
  }
  .theme-switch {
    order: 2;
  }
  .logout-form {
    order: 2;
  }
  .topbar-nav {
    order: 3;
    flex-basis: 100%;
    gap: 8px 16px;
  }
  .topbar-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .container,
  .site-footer,
  .detail-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  .container {
    padding-top: 24px;
  }
  .search-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon query clear" "submit submit submit";
    gap: 4px 2px;
    border-radius: 16px;
    padding: 8px;
  }
  .search-icon {
    grid-area: icon;
    padding-left: 8px;
  }
  .search-bar input[type="search"] {
    grid-area: query;
    font-size: 16px;
  }
  .search-bar .icon-btn {
    grid-area: clear;
  }
  .search-submit {
    grid-area: submit;
    width: 100%;
    min-height: 44px;
    border-radius: 12px;
  }
  .text-btn {
    min-height: 44px;
    padding: 10px 10px;
  }
  .filters input,
  .filters select,
  .batch-panel textarea,
  .login-form input {
    font-size: 16px;
  }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr {
    display: block;
  }
  .table-wrap thead {
    display: none;
  }
  .table-wrap tbody tr {
    margin: 0;
    padding: 14px 44px 14px 16px;
    border-bottom: 1px solid var(--line);
    position: relative;
    cursor: pointer;
  }
  .table-wrap tbody tr:last-child {
    border-bottom: 0;
  }
  .table-wrap tbody tr:hover {
    background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface));
  }
  .table-wrap tbody td {
    padding: 0;
    border: 0;
  }
  .table-wrap tbody td + td {
    margin-top: 10px;
  }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .row-actions {
    position: absolute;
    top: 10px;
    right: 8px;
    width: auto;
    margin: 0;
    padding: 0;
  }
  .report-shell {
    padding: 12px;
  }
  .report-shell .table-wrap {
    margin: 0 -12px -12px;
  }
  .load-more-wrap .btn-secondary {
    min-height: 44px;
    width: 100%;
  }
  .detail-title {
    font-size: 1.3rem;
  }
  .page-title {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .progress {
    animation: none;
    background: var(--accent);
  }
  .search-bar {
    transition: none;
  }
}
