@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&display=swap");

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --card: #ffffff;
  --line: #cfcfcf;
  --accent: #82bbaf;
  --accent-strong: #6ea89d;
  --highlight: #fcc140;
  --muted: #5c5c5c;
  --error: #8f1d1d;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #ffffff;
  line-height: 1.55;
}

main {
  max-width: 1120px;
  margin: 2rem auto;
  padding: 1.25rem 1.15rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

h1 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  font-size: clamp(1.45rem, 2vw, 2.05rem);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.meta {
  margin: 0.2rem 0;
  color: var(--text);
}

.instruction {
  margin: 0.6rem 0;
  color: var(--muted);
}

.alternative-queries {
  margin: 0.4rem 0 0.8rem 1.2rem;
}

.alternative-queries li {
  margin: 0.2rem 0;
}

a {
  color: var(--accent-strong);
}

a:hover {
  color: var(--text);
}

.search-form {
  margin: 1rem 0 1.15rem;
}

.search-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text);
}

.search-input-row {
  display: flex;
  gap: 0.5rem;
  max-width: 520px;
}

.search-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  padding: 0.5rem 0.7rem;
  color: var(--text);
  background: #fff;
}

.search-input-row button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--accent-strong);
  font-family: "Montserrat", sans-serif;
  font-size: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.search-input-row button:hover {
  background: var(--highlight);
  color: var(--text);
  border-color: #d6d6d6;
}

.action-button {
  display: inline-block;
  border: 1px solid #bcbcbc;
  border-radius: 12px;
  background: #fff;
  color: var(--accent-strong);
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.action-button:hover {
  background: var(--highlight);
  color: var(--text);
  border-color: #d6d6d6;
}

.cache-actions {
  white-space: nowrap;
  word-break: normal;
}

.cache-actions .action-button {
  display: block;
  width: max-content;
  margin: 0 0 0.35rem 0;
}

.cache-actions .action-button:last-child {
  margin-bottom: 0;
}

.log-table th:first-child,
.log-table td:first-child {
  white-space: nowrap;
  word-break: normal;
  width: 4ch;
  min-width: 4ch;
}

.error {
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--error);
  color: var(--error);
  background: #ffecec;
}

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

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.details-actions-row {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.details-actions-row .meta {
  margin: 0;
}

.details-source-line {
  margin-left: auto;
  text-align: right;
}

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

.violation-table {
  min-width: 0;
  table-layout: fixed;
}

.violation-table th,
.violation-table td {
  white-space: normal;
}

.violation-table th:first-child,
.violation-table td:first-child:not([colspan]) {
  width: 4ch;
  min-width: 4ch;
  max-width: 4ch;
  white-space: nowrap;
}

.violation-table th:nth-child(2),
.violation-table td:nth-child(2) {
  width: 30%;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.violation-table th:nth-child(3),
.violation-table td:nth-child(3) {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.violation-table td:nth-child(3) * {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.violation-table .inspector-comments-row td {
  width: auto !important;
  max-width: 100%;
  min-width: 0;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.violation-table .inspector-comments-row td * {
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.violation-table tr.violation-section-row td {
  font-weight: 700;
  letter-spacing: 0.02em;
  border-top: 2px solid #9cbfb4;
}

.violation-table tr.violation-section-rfi td {
  background: #FCC140;
}

.violation-table tr.violation-section-grp td {
  background: #BEDBA4;
}

.summary-table {
  min-width: 0;
}

.summary-table th:first-child,
.summary-table td:first-child {
  width: 12ch;
  max-width: 12ch;
}

.summary-table th:nth-child(4),
.summary-table td:nth-child(4) {
  width: 14ch;
  max-width: 14ch;
}

th,
td {
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  padding: 0.6rem;
  font-size: 1rem;
  line-height: 1.35;
  word-break: break-word;
}

th {
  background: #f4faf8;
  color: var(--text);
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  word-break: normal;
  overflow-wrap: normal;
}

.source-meta {
  margin-top: 1rem;
}

.footnote {
  margin-top: 0.8rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.footnote .meta {
  margin: 0.35rem 0;
}

.footer-logo-wrap {
  margin-top: 1rem;
  text-align: center;
}

.footer-logo {
  display: block;
  width: clamp(180px, 46vw, 420px);
  max-width: 88vw;
  height: auto;
  margin: 0 auto;
}

.footer-page-links {
  margin-top: 0.65rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-page-links a {
  color: #1f5f54;
  text-decoration: none;
}

.footer-page-links a:hover {
  color: #17443c;
  text-decoration: underline;
}

.footer-page-links span {
  margin: 0 0.35rem;
  color: #7a7a7a;
}

.site-footer {
  margin-top: 1.3rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: #2f2f2f;
  font-size: 0.95rem;
}

.site-footer a {
  color: #1f5f54;
}

.site-footer a:hover {
  color: #17443c;
}

tbody tr:nth-child(even) {
  background: #fcfefd;
}

.doc-page h1 {
  margin-bottom: 1rem;
}

.doc-page h2,
.doc-page h3 {
  margin-top: 1.1rem;
  margin-bottom: 0.45rem;
  color: var(--accent-strong);
  font-family: "Montserrat", sans-serif;
  letter-spacing: 0.01em;
}

.doc-page p,
.doc-page li {
  font-size: 1rem;
}

.doc-page ul {
  margin-top: 0.35rem;
  margin-bottom: 0.65rem;
}

.doc-page hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

.regulation-embed-wrap {
  margin-top: 0.9rem;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  max-width: 100%;
}

.regulation-embed {
  width: 100%;
  height: 74vh;
  border: 0;
  display: block;
}

@media (max-width: 700px) {
  td {
    font-size: 0.88rem;
    padding: 0.5rem;
  }

  th {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
    padding: 0.45rem 0.5rem;
  }

  .summary-table th {
    white-space: nowrap;
  }

  .summary-table th:first-child {
    white-space: normal;
  }

  .summary-table th:nth-child(4) {
    white-space: normal;
  }

  .violation-table {
    table-layout: fixed;
  }

  .violation-table th:first-child,
  .violation-table td:first-child {
    width: 4ch;
    min-width: 4ch;
    max-width: 4ch;
  }

  .violation-table th:nth-child(2),
  .violation-table td:nth-child(2) {
    width: 14ch;
    min-width: 14ch;
    max-width: 14ch;
  }

  .violation-table th:nth-child(3),
  .violation-table td:nth-child(3) {
    width: auto;
  }

  .violation-table th:nth-child(3),
  .violation-table td:nth-child(3) {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .footer-page-links {
    font-size: 0.86rem;
  }

  .details-actions-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .details-source-line {
    margin-left: 0;
    text-align: left;
  }

  .regulation-embed {
    height: 70vh;
  }
}
