:root {
  --bg: #f6f3ea;
  --panel: #ffffff;
  --line: #d9d4c7;
  --text: #1d2a22;
  --muted: #617065;
  --brand: #1c6a4d;
  --queued: #a16912;
  --fetching: #0f5b8d;
  --ready: #17603f;
  --failed: #972d20;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbf8f1, var(--bg));
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.home-shell {
  max-width: 900px;
}

.admin-shell {
  width: min(1360px, calc(100% - 28px));
}

.auth-shell {
  max-width: 860px;
}

.authorities-shell {
  width: min(1360px, calc(100% - 28px));
}

.interested-shell {
  width: min(1480px, calc(100% - 28px));
}

.interested-notices-shell {
  width: min(1520px, calc(100% - 28px));
}

.header,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(47, 41, 23, 0.08);
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.top-nav a,
.top-nav button,
.top-nav .top-nav-user {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.top-nav a:hover:not([aria-current='page']) {
  background: #faf7f0;
  border-color: rgba(28, 106, 77, 0.25);
  text-decoration: none;
}

.top-nav .top-nav-user {
  background: #f3eee2;
  color: var(--muted);
}

.top-nav button {
  cursor: pointer;
  border: 1px solid var(--line);
}

.top-nav button:hover:not(:disabled) {
  background: #faf7f0;
  border-color: rgba(28, 106, 77, 0.25);
}

.top-nav a[aria-current='page'] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

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

.eyebrow,
.status,
.sync-meta,
.panel-head > p,
.panel-head > div > p:first-child,
button,
label,
th {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.65rem, 3.5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.2rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 700;
}

.lede {
  margin-top: 10px;
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.93rem;
}

.actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.progress {
  width: min(280px, 100%);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid rgba(28, 106, 77, 0.15);
  background: linear-gradient(90deg, #efe7d6, #f7f3ea);
  box-shadow: inset 0 1px 2px rgba(29, 42, 34, 0.08);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1c6a4d, #3c8f6f 55%, #7eb191);
  box-shadow: 0 0 18px rgba(28, 106, 77, 0.22);
  transition: width 0.35s ease;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  background: var(--brand);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
  background: #155c42;
}

.button-danger {
  background: #a33d2e;
}

.button-danger:hover:not(:disabled) {
  background: #8c3124;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status,
.sync-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.status-error {
  color: var(--failed);
}

.status-success {
  color: var(--ready);
}

.panel {
  margin-top: 20px;
  padding: 22px 24px 24px;
}

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

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

.nav-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fcfbf7;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.nav-card:hover {
  border-color: rgba(28, 106, 77, 0.35);
  background: #faf8f2;
  box-shadow: 0 4px 16px rgba(47, 41, 23, 0.07);
  text-decoration: none;
}

.nav-card strong {
  font-size: 1.05rem;
}

.nav-card p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.nav-label {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--brand);
}

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

.panel-head > p:first-child,
.panel-head > div > p:first-child {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.admin-header-aside {
  min-width: min(420px, 100%);
}

.admin-summary-grid {
  display: grid;
  gap: 12px;
}

.admin-summary-card {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfbf7;
}

.admin-summary-card strong {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.admin-summary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-hero {
  margin-bottom: 20px;
}

.auth-header-actions {
  align-self: center;
}

.auth-panel {
  width: min(680px, 100%);
  margin: 0 auto;
}

.auth-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.user-form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.auth-field,
.auth-checkbox-field {
  display: grid;
  gap: 8px;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

.auth-field input,
.auth-field select,
.user-table-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease;
}

.auth-field input:focus,
.auth-field select:focus,
.user-table-input:focus {
  outline: none;
  border-color: rgba(28, 106, 77, 0.5);
  box-shadow: 0 0 0 3px rgba(28, 106, 77, 0.08);
}

.auth-checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.auth-button-row {
  justify-content: flex-start;
}

.user-page-actions {
  min-width: min(340px, 100%);
}

.users-table th,
.users-table td {
  vertical-align: top;
}

.users-table input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 8px;
}

.authorities-summary-panel {
  display: grid;
  gap: 18px;
}

.authorities-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.authorities-summary-card {
  display: grid;
  gap: 5px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbf7;
}

.authorities-summary-card strong {
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.authorities-summary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

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

.match-entry {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfbf7;
}

.match-entry strong {
  font-size: 0.92rem;
  line-height: 1.45;
}

.match-entry span {
  color: var(--muted);
  font-size: 0.84rem;
}

.interested-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
}

.plans-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

.plans-table th,
.plans-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.88rem;
  line-height: 1.45;
}

.plans-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: #f6f3ec;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}

.plans-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--line);
}

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

.plans-table tbody tr:hover {
  background: #faf7f0;
}

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

a:hover {
  text-decoration: underline;
}

.empty-row td,
.empty-row {
  color: var(--muted);
  padding: 32px 16px;
  text-align: center;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.86rem;
}

.detail-meta {
  display: grid;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #efe7d6;
  color: var(--text);
}

.status-badge.status-not-fetched {
  background: #efe7d6;
  color: #6b5a3f;
}

.status-badge.status-queued {
  background: #f8ead1;
  color: var(--queued);
}

.status-badge.status-fetching {
  background: #dcecf7;
  color: var(--fetching);
}

.status-badge.status-ready {
  background: #dff2e8;
  color: var(--ready);
}

.status-badge.status-failed {
  background: #f8dfdb;
  color: var(--failed);
}

.detail-meta-lines {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.detail-actions {
  display: grid;
  gap: 8px;
}

.button-secondary {
  background: #284f41;
}

.button-secondary:hover:not(:disabled) {
  background: #1e3d32;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 11px 20px;
  background: #efe7d6;
  color: var(--text);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: background 0.15s ease;
}

.button-link:hover {
  background: #e0d4b8;
  text-decoration: none;
}

.button-link.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.button-link-primary {
  background: var(--brand);
  color: #fff;
}

.button-link-primary:hover {
  background: #14533c;
}

.detail-shell {
  width: min(1280px, calc(100% - 32px));
}

.detail-header-actions {
  min-width: 240px;
}

.detail-overview-panel {
  display: grid;
  gap: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbf7;
}

.detail-card-label {
  color: var(--muted);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  line-height: 1.4;
}

.detail-card-value {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}

.detail-card strong {
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.detail-items-table {
  min-width: 900px;
}

.detail-report-shell {
  width: min(1440px, calc(100% - 24px));
}

.report-summary-panel,
.report-filters-panel,
.report-table-panel {
  display: grid;
  gap: 18px;
}

.report-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-field,
.filter-toggle {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}

.filter-field-wide {
  grid-column: span 2;
}

.filter-field input,
.filter-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 14px;
  font: inherit;
  font-size: 0.88rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease;
}

.filter-field input:focus,
.filter-field select:focus {
  outline: none;
  border-color: rgba(28, 106, 77, 0.5);
  box-shadow: 0 0 0 3px rgba(28, 106, 77, 0.08);
}

.filter-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
}

.filter-toggle input {
  margin: 0;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  grid-column: span 2;
}

.filter-actions button {
  padding: 11px 18px;
}

.report-table-head {
  align-items: flex-start;
}

.report-head-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2ece0;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.report-table-wrap {
  max-height: 76vh;
  overflow: auto;
}

.detail-report-table {
  min-width: 1680px;
}

.detail-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f6f3ec;
  box-shadow: 0 1px 0 var(--line);
}

.detail-report-table th:nth-child(10),
.detail-report-table td:nth-child(10),
.detail-report-table th:nth-child(8),
.detail-report-table td:nth-child(8),
.detail-report-table th:nth-child(9),
.detail-report-table td:nth-child(9) {
  text-align: right;
}

.detail-report-table td {
  line-height: 1.5;
  font-size: 0.86rem;
}

.interested-notices-table {
  min-width: 1520px;
}

.report-rows-shell {
  width: min(1600px, calc(100% - 24px));
}

.report-rows-filters-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.analytics-report-table {
  min-width: 2300px;
}

.report-section-row td {
  position: sticky;
  top: 45px;
  z-index: 4;
  padding: 0;
  background: #fff;
}

.report-section-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, #ebf3eb, #f7f4ed 65%);
  border-top: 1px solid rgba(217, 212, 199, 0.8);
  border-bottom: 1px solid rgba(217, 212, 199, 0.8);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

.report-section-banner strong {
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.report-section-banner span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.report-row.continuation-row {
  background: #fbf9f3;
}

.report-row.continuation-row:hover {
  background: #f7f1e4;
}

.report-row-match {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  padding: 4px 0;
}

.report-row.split-contract-row td:first-child {
  box-shadow: inset 3px 0 0 #2a7c5b;
}

.cell-muted {
  color: transparent;
}

.cell-muted::selection {
  color: transparent;
}

.cell-numeric {
  white-space: nowrap;
}

.article-cell {
  display: grid;
  gap: 6px;
}

.report-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.report-badge-split {
  background: #dff0e5;
  color: #13583a;
}

.report-badge-continuation {
  background: #efe7d6;
  color: #765f2d;
}

.db-shell {
  width: min(1380px, calc(100% - 32px));
}

.db-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.db-sidebar,
.db-main {
  display: grid;
  gap: 20px;
}

.db-card {
  display: grid;
  gap: 18px;
  padding: 0;
}

.db-panel-head {
  align-items: flex-start;
}

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

.table-chip {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fcfbf7;
  color: var(--text);
}

.table-chip.is-active,
.table-chip:hover:not(:disabled) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.db-description,
.db-form,
.db-sql-form {
  padding: 0;
}

.db-form,
.db-sql-form {
  display: grid;
  gap: 14px;
}

.db-form {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
}

.db-form label,
.db-sql-form label,
.db-inline-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.9rem;
}

.db-form input,
.db-sql-form textarea,
.db-inline-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s ease;
}

.db-form input:focus,
.db-sql-form textarea:focus,
.db-inline-field input:focus {
  outline: none;
  border-color: rgba(28, 106, 77, 0.5);
  box-shadow: 0 0 0 3px rgba(28, 106, 77, 0.08);
}

.db-sql-form textarea {
  min-height: 160px;
  resize: vertical;
}

.db-inline-actions {
  align-items: end;
  justify-content: flex-start;
}

.db-toolbar,
.db-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.db-pagination {
  justify-content: flex-end;
}

.db-schema-grid {
  display: grid;
  gap: 16px;
}

.db-schema-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fcfbf7;
}

.db-schema-block h3 {
  margin: 0 0 12px;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
}

.db-schema-list {
  display: grid;
  gap: 10px;
}

.db-schema-item {
  display: grid;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(217, 212, 199, 0.65);
}

.db-schema-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.db-schema-item strong,
.db-schema-item span,
.db-schema-item em {
  font-style: normal;
}

.db-table-wrap {
  margin-top: 0;
}

.db-results-table {
  min-width: 720px;
}

.batch-shell {
  width: min(1440px, calc(100% - 28px));
}

.batch-actions {
  min-width: 260px;
  justify-items: end;
}

.batch-control-panel,
.batch-summary-panel,
.batch-results-panel {
  display: grid;
  gap: 18px;
}

.batch-section-head {
  align-items: flex-start;
}

.batch-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px)) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
}

.batch-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.flash-message {
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.55;
}

.flash-neutral {
  background: #f5efe3;
  color: #5e5237;
}

.flash-success {
  background: #dff2e8;
  color: var(--ready);
  border-color: rgba(23, 96, 63, 0.2);
}

.flash-error {
  background: #f8dfdb;
  color: var(--failed);
  border-color: rgba(151, 45, 32, 0.2);
}

.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.batch-failure-summary {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fcfbf7;
}

.batch-inline-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
}

.batch-filters-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 150px 150px minmax(220px, 320px);
  gap: 14px;
  align-items: end;
}

.batch-table-wrap {
  max-height: none;
}

.batch-results-table {
  min-width: 1900px;
}

.batch-results-table th:nth-child(1),
.batch-results-table td:nth-child(1),
.batch-results-table th:nth-child(12),
.batch-results-table td:nth-child(12),
.batch-results-table th:nth-child(13),
.batch-results-table td:nth-child(13),
.batch-results-table th:nth-child(14),
.batch-results-table td:nth-child(14) {
  text-align: right;
}

.batch-result-row td {
  font-size: 0.9rem;
}

.batch-detail-row td {
  padding: 0;
  background: #fbf8f1;
}

.batch-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.batch-detail-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.batch-detail-text {
  color: var(--muted);
  line-height: 1.55;
}

.json-block {
  margin: 0;
  padding: 12px 14px;
  min-height: 84px;
  border-radius: 14px;
  background: #f5f1e8;
  color: #33443a;
  overflow: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.batch-inspect-button {
  width: 100%;
  border: 0;
}

.plans2-shell {
  width: min(1480px, calc(100% - 28px));
}

.plans2-toolbar-panel,
.plans2-stats-panel,
.plans2-table-panel {
  display: grid;
  gap: 18px;
}

.plans2-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.plans2-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 180px) auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfbf7;
}

.plans2-table-wrap {
  max-height: none;
}

.plans2-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.plans2-filter-bar .filter-field {
  min-width: 180px;
}

.notices-filter-bar {
  margin-bottom: 16px;
}

.plans2-filter-field-wide {
  flex: 1 1 280px;
}

.plans2-table {
  min-width: 1600px;
}

.plans2-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.plans2-files-list {
  display: grid;
  gap: 6px;
}

.plans2-files-entry {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
}

.plans2-files-label {
  font-weight: 600;
}

.plans2-secondary-text {
  color: var(--muted);
}

.plans2-id-line {
  display: block;
  white-space: nowrap;
}

.plans2-error-cell {
  color: var(--failed);
}

.notices-shell {
  width: min(1440px, calc(100% - 28px));
}

.comparison-shell {
  width: min(1520px, calc(100% - 28px));
}

.comparison-header {
  align-items: stretch;
}

.comparison-actions {
  min-width: 320px;
}

.comparison-editor-panel,
.comparison-summary-panel,
.comparison-plan-panel,
.comparison-matches-panel,
.comparison-notices-panel {
  display: grid;
  gap: 18px;
}

.comparison-form {
  display: grid;
  grid-template-columns: 220px auto;
  gap: 14px;
  align-items: start;
}

.comparison-threshold-field {
  max-width: 220px;
}

.comparison-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: end;
}

.comparison-editor-card {
  display: grid;
  gap: 10px;
}

.comparison-editor-title {
  color: var(--muted);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.comparison-editor-card textarea {
  min-height: 420px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  resize: vertical;
  background: #fcfbf7;
  color: var(--text);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  transition: border-color 0.15s ease;
}

.comparison-editor-card textarea:focus {
  outline: none;
  border-color: rgba(28, 106, 77, 0.4);
  box-shadow: 0 0 0 3px rgba(28, 106, 77, 0.07);
}

.comparison-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.comparison-table-wrap {
  max-height: none;
}

.comparison-table,
.comparison-matches-table {
  min-width: 1120px;
}

.comparison-inline-block {
  min-height: 0;
  white-space: pre-wrap;
}

.comparison-notices-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.comparison-notices-groups {
  display: grid;
  gap: 16px;
}

.comparison-notices-group {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fcfbf7;
}

.comparison-notice-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf7, #f5efe3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.comparison-notice-card p {
  line-height: 1.6;
}

.notices-table {
  min-width: 1480px;
}

.notice-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.notice-title-source {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  font-size: 0.82rem;
}

.notice-detail-row td {
  padding: 0;
  background: #fbf8f1;
}

.notice-detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1.4fr;
  gap: 14px;
  padding: 16px;
}

.notice-detail-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.notice-detail-line {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.notice-detail-line strong {
  color: var(--text);
  font-weight: 600;
}

.notice-documents-list {
  display: grid;
  gap: 12px;
}

.notice-document-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfbf7;
}

.notice-document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.debug-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.debug-notice-card {
  align-content: start;
}

.debug-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
}

.debug-metric-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfbf7;
}

.debug-metric-card strong {
  color: var(--text);
}

.debug-metric-card span {
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.status-badge.status-running,
.status-badge.status-started {
  background: #dcecf7;
  color: var(--fetching);
}

.status-badge.status-pending,
.status-badge.status-warning,
.status-badge.status-partial {
  background: #f8ead1;
  color: var(--queued);
}

.status-badge.status-success,
.status-badge.status-succeeded,
.status-badge.status-finished {
  background: #dff2e8;
  color: var(--ready);
}

.status-badge.status-error,
.status-badge.status-failure {
  background: #f8dfdb;
  color: var(--failed);
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  background: #fcfbf7;
  text-align: center;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 800px) {
  .shell {
    width: min(100% - 20px, 1100px);
    padding-top: 20px;
  }

  .header,
  .panel {
    padding: 20px;
  }

  .header,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-panel {
    grid-template-columns: 1fr;
  }

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

  .authorities-summary-grid {
    grid-template-columns: 1fr;
  }

  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .db-layout {
    grid-template-columns: 1fr;
  }

   .detail-grid {
    grid-template-columns: 1fr;
  }

  .db-form {
    grid-template-columns: 1fr;
  }

  .batch-form,
  .batch-summary-grid,
  .batch-filters-grid,
  .batch-detail-grid,
   .notice-detail-grid,
   .plans2-toolbar-grid,
   .comparison-summary-grid {
    grid-template-columns: 1fr;
  }

  .comparison-form {
    grid-template-columns: 1fr;
  }

  .plans2-inline-form {
    grid-template-columns: 1fr;
  }

  .batch-actions {
    justify-items: start;
  }

  .report-filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-field-wide,
  .filter-actions {
    grid-column: span 1;
  }

  .report-head-meta {
    justify-content: flex-start;
  }

  .actions {
    justify-items: start;
  }

  .button-row {
    justify-content: flex-start;
  }
}
