:root {
  --night: #07131f;
  --petrol: #0f3f4a;
  --warm-white: #f7f3ec;
  --paper: #fffaf1;
  --graphite: #252b31;
  --muted: #6f7880;
  --line: rgba(217, 196, 152, 0.28);
  --line-dark: rgba(7, 19, 31, 0.13);
  --champagne: #d8bd83;
  --copper: #b9815f;
  --container: min(1120px, calc(100% - 40px));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--graphite);
  background: var(--warm-white);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 50;
  padding: 10px 14px;
  color: var(--night);
  background: var(--champagne);
}

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

.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;
}

.site-top {
  background: var(--night);
  border-bottom: 1px solid rgba(216, 189, 131, 0.18);
}

.top-nav {
  width: var(--container);
  min-height: 66px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

.brand-mark {
  padding: 5px 8px;
  border: 1px solid var(--line);
  color: var(--champagne);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  gap: 18px;
  color: rgba(255, 250, 241, 0.72);
  font-size: 0.84rem;
}

.nav-links a:hover { color: var(--paper); }

.home-shell,
.results-shell {
  width: var(--container);
  margin: 0 auto 52px;
}

.home-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 42px 0 20px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--copper);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  color: var(--night);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 8px;
  color: var(--night);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 400;
}

.home-hero p:last-child {
  max-width: 600px;
  margin: 0 auto;
  color: var(--muted);
}

.search-box {
  max-width: 680px;
  margin: 0 auto 20px;
  text-align: center;
}

.search-box.compact {
  max-width: none;
  margin-top: 34px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-dark);
  text-align: left;
}

.search-form {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  margin-top: 12px;
  border: 1px solid rgba(7, 19, 31, 0.18);
  background: #fffdf8;
}

.search-form input {
  min-height: 44px;
  border: 0;
  background: transparent;
  padding: 0 96px 0 16px;
  color: var(--night);
  font-size: 0.9rem;
  outline: 0;
}

.search-form button {
  border: 0;
  background: var(--petrol);
  color: var(--paper);
  cursor: pointer;
  font-size: 0;
}

.search-form button::before {
  content: "⌕";
  font-size: 1.2rem;
}

.search-form button:hover { background: var(--night); }

.search-options {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-box.compact .search-options {
  justify-content: flex-start;
}

.search-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.search-options input {
  accent-color: var(--petrol);
}

.content-access {
  margin: 18px auto 16px;
  text-align: center;
}

.content-access p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.content-pills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.content-pills button {
  min-height: 34px;
  border: 1px solid rgba(7, 19, 31, 0.14);
  background: var(--night);
  color: var(--paper);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.content-pills button:nth-child(2) { background: var(--petrol); }
.content-pills button:nth-child(3) { background: #8b5f3d; }
.content-pills button:nth-child(4) { background: #586b2d; }
.content-pills button:nth-child(5) { background: #68406b; }

.content-pills button:hover {
  transform: translateY(-1px);
  filter: brightness(0.94);
}

.quick-links {
  display: flex;
  justify-content: center;
  gap: 34px;
  margin: 16px 0 26px;
  color: var(--night);
  font-size: 0.84rem;
  font-weight: 800;
}

.quick-links a:hover { color: var(--copper); }

.latest-section,
.filters-panel {
  border-top: 1px solid var(--line-dark);
  padding-top: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.source-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-line a {
  color: var(--petrol);
  font-weight: 800;
}

.source-filter-button {
  min-width: 146px;
}

.source-line .is-error {
  color: #9a3c32;
}

.source-line [hidden] {
  display: none;
}

.latest-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 26px;
}

.latest-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(7, 19, 31, 0.11);
}

.norm-label {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 24px;
  border: 1px solid rgba(216, 189, 131, 0.5);
  border-radius: 5px;
  background: var(--night);
  color: var(--champagne);
  padding: 0 6px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.latest-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--petrol);
  font-size: 0.82rem;
  font-weight: 900;
}

.latest-card strong {
  display: block;
  color: var(--night);
  font-size: 1rem;
  line-height: 1.28;
}

.latest-card a:hover strong { color: var(--petrol); }

.empty {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
}

.filters-panel {
  margin: 18px 0;
}

.outline-button {
  border: 1px solid rgba(7, 19, 31, 0.18);
  background: transparent;
  color: var(--night);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.filters label {
  display: grid;
  gap: 6px;
  color: var(--night);
  font-size: 0.8rem;
  font-weight: 800;
}

.filters input,
.filters select {
  min-height: 38px;
  border: 1px solid rgba(7, 19, 31, 0.14);
  background: #fffdf8;
  padding: 7px 9px;
  color: var(--graphite);
}

.results-table {
  overflow: auto;
  border: 1px solid rgba(7, 19, 31, 0.12);
  background: #fffdf8;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0ebe1;
  color: var(--night);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.norma-code {
  color: #9f2f35;
  font-weight: 900;
}

.pdf-link {
  color: var(--petrol);
  font-weight: 900;
}

.footer {
  width: var(--container);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: 0.78rem;
}

.document-layout {
  width: var(--container);
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 30px;
  margin: 34px auto 52px;
}

.document-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
}

.document-menu-card,
.document-info-card {
  border: 1px solid rgba(7, 19, 31, 0.08);
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.74);
  padding: 16px;
}

.document-menu-card {
  background: transparent;
  border: 0;
  padding: 0 0 14px;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--night);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  line-height: 1;
}

.document-menu-card a {
  display: block;
  border-bottom: 1px solid rgba(7, 19, 31, 0.16);
  padding: 10px 8px;
  color: var(--night);
  font-size: 0.88rem;
}

.document-menu-card a:hover {
  color: var(--petrol);
}

.document-info-card {
  background: #efefef;
}

.document-info-card h2 {
  margin-bottom: 12px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
}

.document-info-card p,
.document-info-card a,
.tree-line {
  color: var(--muted);
  font-size: 0.82rem;
}

.document-info-card a {
  color: var(--petrol);
  font-weight: 900;
}

.tree-line {
  margin-bottom: 6px;
}

.tree-line.is-open {
  color: var(--petrol);
  font-weight: 900;
}

.document-info-card dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.document-info-card dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
}

.document-info-card dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.document-info-card dd {
  margin: 0;
  color: var(--graphite);
  font-size: 0.78rem;
  font-weight: 800;
}

.document-content {
  min-width: 0;
}

.document-search {
  max-width: none;
  margin: 0 0 18px;
}

.document-tab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.14);
}

.document-tab {
  display: inline-block;
  border-bottom: 2px solid var(--petrol);
  padding: 0 16px 9px 0;
  color: var(--petrol);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.relations-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.relations-label strong {
  border: 1px solid rgba(15, 63, 74, 0.22);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--petrol);
  letter-spacing: 0;
  text-transform: none;
}

.document-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.82rem;
}

.document-breadcrumb a:hover {
  color: var(--petrol);
}

.document-head {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(360px, 1fr);
  gap: 32px;
  align-items: start;
  margin-bottom: 22px;
}

.document-head h1 {
  max-width: 720px;
  margin-bottom: 8px;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.12rem, 1.55vw, 1.42rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.22;
}

.document-head p {
  color: var(--muted);
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  padding-top: 42px;
  text-align: right;
}

.document-actions .outline-button {
  min-height: 38px;
  border-color: rgba(7, 19, 31, 0.2);
  background: rgba(255, 253, 248, 0.62);
  color: var(--night);
  cursor: pointer;
}

.summary-box {
  margin-bottom: 26px;
  border: 1px solid rgba(15, 63, 74, 0.08);
  border-radius: 6px;
  background: #edf3f6;
  padding: 0;
  box-shadow: 0 14px 32px rgba(7, 19, 31, 0.08);
  overflow: hidden;
}

.summary-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 0;
  background: transparent;
  color: var(--night);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
}

.summary-toggle span:first-child {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

.summary-toggle span:last-child {
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--petrol);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-content {
  border-top: 1px solid rgba(7, 19, 31, 0.08);
  padding: 16px 18px 4px;
}

.summary-box h2,
.document-text h2 {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

.summary-box p {
  margin-bottom: 12px;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.58;
  text-align: justify;
}

.summary-box p:last-child {
  margin-bottom: 0;
}

.summary-box small {
  display: block;
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  font-size: 0.74rem;
}

.summary-box.is-collapsed small {
  display: none;
}

.document-text {
  border: 1px solid rgba(7, 19, 31, 0.1);
  border-radius: 4px;
  background: #fffdf8;
  padding: 0;
}

.document-text-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.12);
  padding: 16px 18px;
}

.document-text-head h2 {
  margin: 0;
}

.document-text-head span {
  color: var(--muted);
  font-size: 0.76rem;
}

.document-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(7, 19, 31, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.document-view-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 800 0.78rem/1 Calibri, "Segoe UI", Arial, sans-serif;
  padding: 9px 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.document-view-button.is-active {
  background: var(--night);
  color: #fff;
}

.pdf-text-render {
  max-height: none;
  margin: 0;
  overflow-x: auto;
  color: #2c3035;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.62;
  padding: 24px 28px;
}

.pdf-text-render p {
  max-width: 100%;
  margin: 0 0 1.05rem;
  text-align: justify;
  text-justify: inter-word;
}

.pdf-page-text {
  margin: 0 0 1.4rem;
  border: 1px solid rgba(7, 19, 31, 0.08);
  border-radius: 3px;
  background: #fff;
  padding: 22px 28px;
  color: #24282d;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 0.98rem;
  line-height: 1.48;
  white-space: pre-wrap;
  tab-size: 4;
}

.pdf-copyable-text {
  max-width: none;
  margin: 0 auto;
}

.pdf-copyable-page {
  width: min(100%, 980px);
  margin: 0 auto 1.8rem;
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 4px;
  background: #fff;
  padding: 22px 28px;
  box-shadow: 0 12px 26px rgba(7, 19, 31, 0.06);
}

.pdf-export-paragraph {
  margin: 0 0 1rem;
  color: #20252b;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.48;
  text-align: justify;
  text-justify: inter-word;
  user-select: text;
}

.pdf-export-pre {
  margin: 0 0 1rem;
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 0;
  background: #fff;
  padding: 9px 12px;
  color: #20252b;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 0.94rem;
  font-kerning: none;
  font-variant-numeric: tabular-nums;
  line-height: 1.34;
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
  user-select: text;
}

.pdf-copyable-pre {
  margin: 0;
  color: #20252b;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 0.92rem;
  line-height: 1.42;
  white-space: pre-wrap;
  overflow: visible;
  tab-size: 4;
  user-select: text;
}

.rr-button {
  font-weight: 900;
}

.rr-modal[hidden] {
  display: none;
}

.rr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.rr-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 19, 31, 0.54);
}

.rr-modal__panel {
  position: relative;
  width: min(560px, calc(100% - 32px));
  margin: 8vh auto;
  border: 1px solid rgba(218, 190, 136, 0.32);
  border-radius: 10px;
  background: #fffdf8;
  padding: 26px;
  box-shadow: 0 28px 80px rgba(7, 19, 31, 0.28);
}

.rr-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  color: var(--night);
  font-size: 1.8rem;
  cursor: pointer;
}

.rr-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.rr-form label {
  display: grid;
  gap: 7px;
  color: var(--graphite);
  font-weight: 700;
}

.rr-form select {
  border: 1px solid rgba(7, 19, 31, 0.16);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  font: inherit;
}

.home-source-modal {
  width: min(720px, calc(100% - 32px));
}

.home-source-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.home-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-source-option {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  color: var(--night);
  font-size: 0.92rem;
  font-weight: 700;
}

.home-source-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--petrol);
}

.home-source-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.home-source-save {
  background: var(--night);
  color: var(--paper);
}

.pdf-initial-header {
  margin-bottom: 1.15rem;
  text-align: right;
  line-height: 1.7;
}

.pdf-rule {
  height: 1px;
  margin: 1.1rem 0 1.05rem;
  background: rgba(7, 19, 31, 0.72);
}

.pdf-page-break {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2.2rem 0 1.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pdf-page-break::before,
.pdf-page-break::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(7, 19, 31, 0.18);
}

.pdf-section-label,
.pdf-centered-line {
  margin: 1.35rem 0 0.85rem;
  text-align: center;
  line-height: 1.45;
}

.pdf-page-meta {
  margin: 1.55rem 0 1.7rem;
  border: 1px solid rgba(7, 19, 31, 0.72);
  padding: 8px 12px;
  text-align: center;
  line-height: 1.35;
}

.search-layout {
  width: var(--container);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  margin: 34px auto 52px;
}

.filters-card {
  align-self: start;
  background: #efefef;
  border-radius: 4px;
  padding: 16px 14px;
  color: var(--graphite);
}

.filters-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

.filters-card h2::before {
  content: "▽";
  color: var(--night);
  font-size: 1rem;
  transform: rotate(45deg);
}

.filter-group {
  border-top: 1px solid rgba(7, 19, 31, 0.16);
  padding: 14px 0;
}

.filter-group h3 {
  margin: 0 0 10px;
  color: var(--night);
  font-size: 0.82rem;
  font-weight: 900;
}

.filter-group label {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.filter-group input,
.mini-search input {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(7, 19, 31, 0.15);
  border-radius: 4px;
  background: #fff;
  padding: 6px 8px;
  color: var(--graphite);
  font-size: 0.78rem;
}

.mini-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
}

.mini-search button {
  border: 0;
  border-radius: 4px;
  background: var(--petrol);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 900;
}

.filter-link {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 0 4px 12px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-size: 0.78rem;
}

.filter-link:hover,
.filter-link.is-active {
  color: var(--petrol);
  font-weight: 800;
}

.clear-button {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(7, 19, 31, 0.16);
  background: transparent;
  color: var(--night);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.results-content {
  min-width: 0;
}

.results-search {
  max-width: none;
  margin: 2px 0 28px;
}

.results-options {
  justify-content: flex-start;
  margin-top: -20px;
  margin-bottom: 28px;
}

.results-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.18);
  margin-bottom: 8px;
  padding-bottom: 5px;
}

.results-headline h1 {
  margin-bottom: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0;
}

.results-headline p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.sort-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.75rem;
}

.sort-label strong,
.sort-label select {
  color: var(--petrol);
}

.sort-label select {
  min-height: 32px;
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 4px;
  background: #fff;
  padding: 5px 8px;
  font: inherit;
  font-weight: 800;
}

.source-line.inline {
  align-items: flex-start;
  margin-bottom: 12px;
}

.search-results-list {
  display: grid;
  gap: 20px;
}

.results-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 26px 0 8px;
}

.results-pagination button {
  min-width: 38px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid rgba(7, 19, 31, 0.18);
  border-radius: 4px;
  background: var(--paper);
  color: var(--night);
  cursor: pointer;
}

.results-pagination button:hover:not(:disabled),
.results-pagination button.is-active {
  border-color: var(--petrol);
  background: var(--petrol);
  color: var(--paper);
}

.results-pagination button:disabled { opacity: 0.42; cursor: default; }

.result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.1);
  padding: 8px 0 18px;
}

.result-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--night);
  font-size: 0.84rem;
  font-weight: 900;
}

.result-icon {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 23px;
  border: 1px solid rgba(216, 189, 131, 0.5);
  border-radius: 4px;
  background: var(--night);
  color: var(--champagne);
  padding: 0 7px;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.result-item h2 {
  margin: 0 0 7px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
}

.result-item p {
  margin: 0 0 7px;
  color: #7a828a;
  font-size: 0.78rem;
}

.result-item a {
  color: var(--petrol);
  font-size: 0.78rem;
  font-weight: 900;
}

.result-title-link {
  color: var(--night) !important;
  font-size: inherit !important;
  text-decoration: none;
}

.result-title-link:hover {
  color: var(--petrol) !important;
}

.result-meta {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.tag-row span {
  border-radius: 3px;
  background: #dfded9;
  padding: 2px 5px;
  color: #6a6d70;
  font-size: 0.63rem;
  font-weight: 900;
}

.ordered-layout {
  width: var(--container);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 34px;
  margin: 34px auto 52px;
}

.ordered-sidebar {
  align-self: start;
}

.ordered-back,
.ordered-nav-item {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(7, 19, 31, 0.14);
  background: transparent;
  color: var(--night);
  padding: 12px 10px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 700;
}

.ordered-nav-item {
  cursor: pointer;
}

.ordered-nav-item.is-active {
  border-left: 3px solid var(--petrol);
  background: rgba(15, 63, 74, 0.07);
  padding-left: 12px;
  font-weight: 900;
}

.ordered-tree {
  margin-top: 30px;
  border-radius: 6px;
  background: rgba(7, 19, 31, 0.045);
  padding: 18px 18px 20px;
}

.tree-node {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--petrol);
  padding: 5px 0;
  text-align: left;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.tree-node::before {
  content: "›";
  display: inline-block;
  width: 18px;
  color: var(--petrol);
  font-weight: 900;
}

.tree-node.is-open::before {
  transform: rotate(90deg);
}

.tree-list {
  display: grid;
  gap: 9px;
  margin: 8px 0 0 30px;
  font-size: 0.78rem;
  line-height: 1.45;
}

.tree-list a {
  color: var(--graphite);
}

.tree-group {
  margin-top: 6px;
}

.tree-group summary {
  color: var(--petrol);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.tree-group summary::-webkit-details-marker {
  display: none;
}

.tree-group summary::before {
  content: "›";
  display: inline-block;
  width: 16px;
  color: var(--petrol);
  font-weight: 900;
}

.tree-group[open] summary::before {
  transform: rotate(90deg);
}

.tree-group div {
  display: grid;
  gap: 8px;
  margin: 8px 0 0 18px;
  padding-left: 12px;
  border-left: 1px solid rgba(15, 63, 74, 0.22);
}

.tree-list a:hover {
  color: var(--petrol);
}

.ordered-content {
  min-width: 0;
}

.ordered-heading {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(320px, 1fr);
  align-items: end;
  gap: 28px;
  margin-bottom: 28px;
}

.ordered-heading h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  color: var(--petrol);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0;
}

.ordered-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border-radius: 4px;
  background: var(--night);
  color: var(--champagne);
  font-size: 0.86rem;
  font-weight: 900;
}

.ordered-search {
  margin-top: 0;
}

.ordered-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.13);
  padding-bottom: 8px;
}

.ordered-section-head h2 {
  margin-bottom: 0;
  color: var(--petrol);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0;
}

.ordered-section-head span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.ordered-list {
  display: grid;
  gap: 2px;
}

.ordered-item a {
  display: block;
  border-bottom: 1px solid rgba(7, 19, 31, 0.08);
  padding: 10px 0;
}

.ordered-item strong {
  display: block;
  color: var(--petrol);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.42;
}

.ordered-item a:hover strong {
  color: var(--night);
}

.ordered-group {
  margin-top: 12px;
  border-top: 1px solid rgba(7, 19, 31, 0.13);
  padding-top: 10px;
}

.ordered-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--night);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 900;
  list-style: none;
  padding: 10px 0;
}

.ordered-group summary::-webkit-details-marker {
  display: none;
}

.ordered-group summary::before {
  content: "›";
  color: var(--petrol);
  font-size: 1.15rem;
  font-weight: 900;
}

.ordered-group[open] summary::before {
  transform: rotate(90deg);
}

.ordered-group summary span {
  flex: 1;
}

.ordered-group summary small {
  border: 1px solid rgba(216, 189, 131, 0.42);
  border-radius: 4px;
  color: var(--petrol);
  padding: 2px 7px;
  font-size: 0.72rem;
}

.ordered-sublist {
  margin-left: 24px;
  padding-left: 18px;
  border-left: 1px solid rgba(15, 63, 74, 0.22);
}

.ordered-item-sub a {
  padding: 8px 0;
}

.ordered-item-sub strong {
  font-size: 0.92rem;
  font-weight: 750;
}

.chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 45;
  min-height: 46px;
  border: 1px solid rgba(216, 189, 131, 0.32);
  border-radius: 999px;
  background: var(--night);
  color: var(--paper);
  padding: 0 18px;
  box-shadow: 0 18px 36px rgba(7, 19, 31, 0.24);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-launcher:hover {
  background: var(--petrol);
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 20px;
  background: rgba(7, 19, 31, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.chat-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.chat-panel {
  width: min(560px, calc(100vw - 24px));
  max-height: min(78vh, 720px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  border: 1px solid rgba(7, 19, 31, 0.12);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 28px 60px rgba(7, 19, 31, 0.24);
  overflow: hidden;
}

.chat-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}

.chat-kicker {
  margin-bottom: 6px;
  color: var(--copper);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chat-panel__header h2 {
  margin-bottom: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
}

.chat-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(7, 19, 31, 0.14);
  border-radius: 50%;
  background: transparent;
  color: var(--night);
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.chat-panel__body {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 0 22px;
  overflow: auto;
}

.chat-bubble {
  max-width: 88%;
  border-radius: 18px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-bubble-assistant {
  justify-self: start;
  background: #edf4f6;
  color: var(--graphite);
}

.chat-bubble-user {
  justify-self: end;
  background: var(--petrol);
  color: var(--paper);
}

.chat-panel__form {
  display: grid;
  gap: 10px;
  padding: 0 22px 22px;
}

.chat-panel__form textarea {
  min-height: 96px;
  resize: vertical;
  border: 1px solid rgba(7, 19, 31, 0.14);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fffdf8;
  color: var(--night);
  font: inherit;
}

.chat-panel__form button {
  justify-self: end;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--night);
  color: var(--paper);
  padding: 0 18px;
  cursor: pointer;
  font-weight: 900;
}

.chat-panel__form button:hover {
  background: var(--petrol);
}

body.chat-is-open {
  overflow: hidden;
}

.chat-modal {
  place-items: stretch;
  padding: 0;
  background: #f7f4ed;
  backdrop-filter: none;
}

.chat-workspace {
  width: 100vw;
  height: 100dvh;
  max-height: none;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: 1fr;
  gap: 0;
  border-radius: 0;
  background: #f7f4ed;
  box-shadow: none;
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(180deg, var(--night), #0b2430);
  color: var(--paper);
  min-width: 0;
}

.chat-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-sidebar__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(216, 189, 131, 0.48);
  border-radius: 12px;
  color: var(--champagne);
  font-weight: 900;
}

.chat-sidebar h2,
.chat-panel__header h3 {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  font-size: 1.05rem;
  font-weight: 900;
}

.chat-sidebar .chat-kicker {
  color: var(--champagne);
}

.chat-new {
  min-height: 42px;
  border: 1px solid rgba(216, 189, 131, 0.38);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  cursor: pointer;
  font-weight: 850;
  text-align: left;
  padding: 0 14px;
}

.chat-new:hover {
  background: rgba(255, 255, 255, 0.14);
}

.chat-history {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.chat-history-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.chat-history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.chat-history-item small {
  color: rgba(255, 255, 255, 0.52);
}

.chat-history-item:hover,
.chat-history-item.is-active {
  border-color: rgba(216, 189, 131, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.chat-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background: var(--paper);
}

.chat-main .chat-panel__header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(7, 19, 31, 0.1);
}

.chat-window-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-minimize {
  min-height: 36px;
  border: 1px solid rgba(7, 19, 31, 0.14);
  border-radius: 999px;
  background: transparent;
  color: var(--night);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0 14px;
}

.chat-minimize:hover {
  border-color: rgba(13, 74, 88, 0.35);
  background: rgba(13, 74, 88, 0.06);
}

.chat-main .chat-panel__body {
  padding: 32px clamp(20px, 7vw, 112px);
  gap: 16px;
}

.chat-bubble {
  max-width: min(900px, 92%);
  border-radius: 20px;
  padding: 14px 16px;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.chat-bubble-assistant {
  background: #f0f3f2;
  border: 1px solid rgba(7, 19, 31, 0.08);
}

.chat-bubble-user {
  background: var(--night);
}

.chat-main .chat-panel__form {
  padding: 16px clamp(20px, 7vw, 112px) 22px;
  border-top: 1px solid rgba(7, 19, 31, 0.1);
  background: #fbfaf6;
}

.chat-panel__form textarea {
  min-height: 74px;
  max-height: 180px;
}

.chat-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chat-form-actions span {
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-panel__form .chat-form-actions button {
  flex: 0 0 auto;
}

@media (max-width: 820px) {
  .latest-list,
  .filters,
  .document-layout,
  .ordered-layout,
  .ordered-heading {
    grid-template-columns: 1fr;
  }

  .section-head,
  .footer {
    flex-direction: column;
  }

  .source-line {
    align-items: flex-start;
  }

  .home-source-grid {
    grid-template-columns: 1fr;
  }

  .document-head {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .document-actions {
    justify-content: flex-start;
    padding-top: 0;
    text-align: left;
  }

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

  .chat-panel {
    width: 100%;
    max-height: none;
  }

  .chat-workspace {
    width: 100vw;
    height: 100dvh;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .chat-sidebar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 14px;
  }

  .chat-new {
    align-self: center;
  }

  .chat-history {
    grid-column: 1 / -1;
    grid-auto-flow: column;
    grid-auto-columns: minmax(170px, 220px);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .chat-main {
    min-height: 0;
  }

  .chat-main .chat-panel__header {
    padding: 14px 16px;
  }

  .chat-main .chat-panel__body {
    padding: 18px 16px;
  }

  .chat-main .chat-panel__form {
    padding: 12px 16px 16px;
  }

  .chat-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-panel__form .chat-form-actions button {
    width: 100%;
  }

  .ordered-sidebar {
    order: 2;
  }

  .ordered-content {
    order: 1;
  }

  .result-item,
  .results-headline {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .result-meta {
    justify-items: start;
    white-space: normal;
  }
}

@media (max-width: 620px) {
  :root { --container: min(100% - 28px, 1120px); }

  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 0;
  }

  .quick-links {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .search-form input {
    padding-right: 16px;
  }

  .chat-launcher {
    right: 14px;
    bottom: 14px;
  }

}

/* NORMA chat redesign 2026-06-28 */
.chat-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 80;
  border: 1px solid rgba(222, 201, 158, 0.45);
  background: linear-gradient(135deg, #071d2a, #0d3f4a);
  color: #f7efe2;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 18px 44px rgba(3, 18, 27, 0.3);
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: 0;
  background: rgba(3, 12, 18, 0.78);
  backdrop-filter: blur(8px);
}

.chat-modal.is-open {
  display: block;
}

.chat-workspace {
  width: min(1480px, calc(100vw - 34px));
  height: min(920px, calc(100vh - 34px));
  margin: 17px auto;
  display: grid;
  grid-template-columns: 315px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(222, 201, 158, 0.22);
  border-radius: 26px;
  background: #f8f4ed;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
}

.chat-sidebar {
  min-height: 0;
  padding: 22px;
  background: linear-gradient(180deg, #071b27, #0b2f38 62%, #09212b);
  color: #f8f1e6;
  border-right: 1px solid rgba(222, 201, 158, 0.2);
}

.chat-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.chat-sidebar__mark,
.chat-empty__mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(222, 201, 158, 0.65);
  border-radius: 14px;
  background: rgba(222, 201, 158, 0.1);
  color: #dec99e;
  font-weight: 900;
}

.chat-kicker {
  margin: 0 0 3px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(248, 241, 230, 0.68);
}

.chat-sidebar h2,
.chat-panel__header h3 {
  margin: 0;
  color: inherit;
}

.chat-new {
  width: 100%;
  border: 1px solid rgba(222, 201, 158, 0.42);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(248, 244, 237, 0.08);
  color: #f8f1e6;
  font-weight: 800;
}

.chat-history {
  height: calc(100% - 126px);
  margin-top: 18px;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
}

.chat-history-empty {
  color: rgba(248, 241, 230, 0.64);
  font-size: 0.9rem;
}

.chat-history-item {
  text-align: left;
  border: 1px solid rgba(248, 241, 230, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: transparent;
  color: #f8f1e6;
}

.chat-history-item span,
.chat-history-item small,
.chat-history-item em {
  display: block;
}

.chat-history-item span {
  font-weight: 800;
  line-height: 1.25;
}

.chat-history-item small {
  margin-top: 6px;
  color: rgba(222, 201, 158, 0.86);
}

.chat-history-item em {
  margin-top: 6px;
  color: rgba(248, 241, 230, 0.56);
  font-style: normal;
  font-size: 0.82rem;
  line-height: 1.35;
}

.chat-history-item:hover,
.chat-history-item.is-active {
  background: rgba(248, 244, 237, 0.1);
  border-color: rgba(222, 201, 158, 0.34);
}

.chat-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at top right, rgba(17, 78, 89, 0.08), transparent 34%),
    #fbf8f2;
}

.chat-panel__header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(18, 47, 56, 0.1);
  color: #071b27;
}

.chat-panel__header .chat-kicker {
  color: #63717a;
}

.chat-menu,
.chat-minimize,
.chat-close {
  border: 1px solid rgba(11, 63, 74, 0.18);
  background: #fffaf2;
  color: #092f3a;
  border-radius: 999px;
  padding: 10px 13px;
  font-weight: 800;
}

.chat-close {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.4rem;
}

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

.chat-modebar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(18, 47, 56, 0.08);
}

.chat-modebar > span {
  align-self: center;
  color: #62717a;
  font-size: 0.88rem;
  font-weight: 800;
}

.chat-modebar button {
  border: 1px solid rgba(11, 63, 74, 0.16);
  border-radius: 14px;
  padding: 9px 14px;
  background: #fffaf2;
  color: #0a2a35;
  text-align: left;
}

.chat-modebar button strong,
.chat-modebar button small {
  display: block;
}

.chat-modebar button small {
  color: #66747a;
}

.chat-modebar button.is-active {
  background: #092f3a;
  color: #fff7eb;
  border-color: #092f3a;
}

.chat-modebar button.is-active small {
  color: rgba(255, 247, 235, 0.72);
}

.chat-panel__body {
  min-height: 0;
  overflow: auto;
  padding: 28px min(6vw, 72px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-empty {
  margin: auto;
  max-width: 720px;
  text-align: center;
  color: #092f3a;
}

.chat-empty__mark {
  margin-bottom: 18px;
  background: #092f3a;
  color: #dec99e;
}

.chat-empty h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  letter-spacing: -0.04em;
}

.chat-empty p {
  margin: 0 auto 22px;
  max-width: 560px;
  color: #60717a;
}

.chat-suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.chat-suggestions button {
  border: 1px solid rgba(11, 63, 74, 0.15);
  border-radius: 16px;
  padding: 14px;
  background: #fffaf2;
  color: #0b3440;
  text-align: left;
}

.chat-bubble {
  max-width: min(780px, 88%);
  border-radius: 20px;
  padding: 15px 17px;
  line-height: 1.58;
  box-shadow: 0 12px 28px rgba(7, 27, 39, 0.06);
}

.chat-bubble__role {
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.62;
}

.chat-bubble p {
  margin: 0 0 0.85em;
}

.chat-bubble p:last-child,
.chat-bubble ul:last-child {
  margin-bottom: 0;
}

.chat-bubble ul {
  margin: 0.4em 0 0.85em 1.1em;
  padding: 0;
}

.chat-bubble-user {
  align-self: flex-end;
  background: #082936;
  color: #fff7eb;
  border-bottom-right-radius: 6px;
}

.chat-bubble-assistant {
  align-self: flex-start;
  background: #fffdf8;
  color: #0b2430;
  border: 1px solid rgba(11, 63, 74, 0.1);
  border-bottom-left-radius: 6px;
}

.chat-bubble-assistant.is-pending {
  color: #5f717a;
  font-style: italic;
}

.chat-sources {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(11, 63, 74, 0.12);
  color: #40515a;
  font-size: 0.9rem;
}

.chat-sources ul {
  margin-top: 6px;
}

.chat-panel__form {
  padding: 18px 24px 22px;
  border-top: 1px solid rgba(18, 47, 56, 0.1);
  background: rgba(251, 248, 242, 0.92);
}

.chat-panel__form textarea {
  width: 100%;
  min-height: 58px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid rgba(11, 63, 74, 0.18);
  border-radius: 18px;
  padding: 15px 16px;
  background: #fffdf8;
  color: #081f2a;
  font: inherit;
}

.chat-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.chat-form-actions span {
  color: #66747a;
  font-size: 0.84rem;
}

.chat-form-actions button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: #0b3f4a;
  color: #fff7eb;
  font-weight: 900;
}

body.chat-is-open {
  overflow: hidden;
}

@media (min-width: 821px) {
  .chat-menu {
    display: none;
  }
}

@media (max-width: 820px) {
  .chat-launcher {
    right: 18px;
    bottom: 18px;
  }

  .chat-workspace {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: fixed;
    z-index: 2;
    inset: 0 auto 0 0;
    width: min(86vw, 330px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
  }

  .chat-sidebar.is-open {
    transform: translateX(0);
  }

  .chat-panel__header {
    grid-template-columns: auto 1fr auto;
    padding: 14px;
  }

  .chat-minimize {
    display: none;
  }

  .chat-modebar {
    padding: 12px 14px;
    overflow-x: auto;
  }

  .chat-modebar > span {
    min-width: max-content;
  }

  .chat-modebar button {
    min-width: 124px;
  }

  .chat-panel__body {
    padding: 18px 14px;
  }

  .chat-bubble {
    max-width: 94%;
  }

  .chat-suggestions {
    grid-template-columns: 1fr;
  }

  .chat-panel__form {
    padding: 12px 14px 14px;
  }

  .chat-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-form-actions button {
    width: 100%;
  }
}

/* NORMA chat refinement 2026-06-28 */
.chat-model-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin-top: 7px;
  color: #5f6e76;
  font-size: 0.82rem;
  font-weight: 700;
}

.chat-model-picker span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.chat-model-picker select {
  appearance: none;
  border: 1px solid rgba(11, 63, 74, 0.16);
  border-radius: 999px;
  padding: 8px 34px 8px 13px;
  background:
    linear-gradient(45deg, transparent 50%, #0a3440 50%) right 15px center / 6px 6px no-repeat,
    linear-gradient(135deg, #fffdf8, #f5efe5);
  color: #0a3440;
  font: inherit;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(7, 27, 39, 0.05);
}

.chat-panel__header {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.chat-panel__header h3 {
  font-size: 1.02rem;
}

.chat-empty {
  margin: auto;
  max-width: 760px;
  text-align: left;
  width: 100%;
  padding: 0 min(4vw, 42px);
}

.chat-empty h2 {
  max-width: 680px;
  margin: 0;
  color: #071b27;
  font-size: clamp(2.1rem, 5.2vw, 4.2rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.chat-empty__mark,
.chat-empty p,
.chat-suggestions {
  display: none;
}

.chat-bubble {
  box-shadow: none;
}

.chat-bubble__role {
  display: none;
}

.chat-bubble-assistant {
  background: transparent;
  border: 0;
  padding-left: 0;
  max-width: min(820px, 92%);
}

.chat-bubble-user {
  background: #0b3440;
  border-radius: 18px 18px 4px 18px;
  max-width: min(720px, 88%);
}

.chat-bubble-assistant.is-pending {
  color: #69777e;
  font-style: normal;
}

.chat-panel__form textarea {
  min-height: 54px;
  border-radius: 22px;
  padding-right: 100px;
}

.chat-form-actions {
  position: relative;
  margin-top: -48px;
  padding: 0 8px 8px 0;
  justify-content: flex-end;
  pointer-events: none;
}

.chat-form-actions span {
  display: none;
}

.chat-form-actions button {
  pointer-events: auto;
  padding: 9px 16px;
  min-width: 76px;
}

@media (max-width: 820px) {
  .chat-model-picker select {
    max-width: 118px;
  }

  .chat-empty {
    padding: 0 8px;
  }

  .chat-empty h2 {
    font-size: clamp(2rem, 12vw, 3.4rem);
  }

  .chat-panel__header {
    gap: 10px;
  }

  .chat-form-actions {
    align-items: flex-end;
  }

  .chat-form-actions button {
    width: auto;
  }
}

/* NORMA app chat full redesign 2026-06-28 */
.chat-modal.is-open {
  display: block;
}

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 0 !important;
  background: rgba(4, 18, 25, 0.82);
  backdrop-filter: blur(6px);
}

.chat-workspace {
  width: min(1500px, calc(100vw - 24px)) !important;
  height: min(940px, calc(100vh - 24px)) !important;
  margin: 12px auto !important;
  display: grid !important;
  grid-template-columns: 300px minmax(0, 1fr) !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  border: 1px solid rgba(199, 178, 122, 0.22) !important;
  background: #f7f3ea !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38) !important;
}

.chat-sidebar {
  position: relative !important;
  inset: auto !important;
  width: auto !important;
  transform: none !important;
  min-height: 0 !important;
  padding: 16px !important;
  background: #061a23 !important;
  border-right: 1px solid rgba(199, 178, 122, 0.18) !important;
  color: #f7f3ea !important;
}

.chat-sidebar__brand {
  height: 48px !important;
  margin: 0 0 12px !important;
  gap: 10px !important;
}

.chat-sidebar__mark {
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
  font-size: 0.95rem !important;
}

.chat-sidebar h2 {
  font-size: 1rem !important;
  letter-spacing: 0.08em !important;
}

.chat-kicker {
  font-size: 0.64rem !important;
  letter-spacing: 0.12em !important;
}

.chat-new-sidebar,
.chat-new-top {
  border-radius: 11px !important;
  font-size: 0.88rem !important;
}

.chat-new-sidebar {
  width: 100% !important;
  padding: 10px 12px !important;
  background: rgba(247, 243, 234, 0.08) !important;
  border: 1px solid rgba(199, 178, 122, 0.34) !important;
  color: #f7f3ea !important;
}

.chat-history {
  height: calc(100% - 106px) !important;
  margin-top: 12px !important;
  gap: 7px !important;
}

.chat-history-item {
  min-height: 58px !important;
  max-height: 78px !important;
  padding: 9px 10px !important;
  border-radius: 11px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
}

.chat-history-item span {
  font-size: 0.9rem !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.chat-history-item small {
  margin-top: 6px !important;
  font-size: 0.76rem !important;
  color: rgba(247, 243, 234, 0.58) !important;
}

.chat-history-item em {
  display: none !important;
}

.chat-history-item:hover,
.chat-history-item.is-active {
  background: rgba(247, 243, 234, 0.09) !important;
  border-color: rgba(199, 178, 122, 0.34) !important;
}

.chat-main {
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: 72px minmax(0, 1fr) auto !important;
  background: #f7f3ea !important;
}

.chat-topbar {
  height: 72px !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 0 18px !important;
  border-bottom: 1px solid rgba(7, 27, 36, 0.1) !important;
  background: rgba(247, 243, 234, 0.96) !important;
}

.chat-titleblock h3 {
  margin: 0 !important;
  color: #071b24 !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.chat-titleblock p {
  margin: 3px 0 0 !important;
  color: #6b767b !important;
  font-size: 0.78rem !important;
}

.chat-mode-segment {
  display: inline-flex !important;
  align-items: center !important;
  padding: 3px !important;
  border: 1px solid rgba(7, 27, 36, 0.14) !important;
  border-radius: 999px !important;
  background: #fffdf8 !important;
  gap: 2px !important;
}

.chat-mode-segment button {
  border: 0 !important;
  border-radius: 999px !important;
  padding: 8px 13px !important;
  background: transparent !important;
  color: #45545a !important;
  font-weight: 800 !important;
  font-size: 0.86rem !important;
}

.chat-mode-segment button.is-active {
  background: #073b46 !important;
  color: #fff8ea !important;
}

.chat-new-top,
.chat-menu,
.chat-minimize,
.chat-close {
  border: 1px solid rgba(7, 27, 36, 0.14) !important;
  background: #fffdf8 !important;
  color: #07313c !important;
  box-shadow: none !important;
}

.chat-new-top {
  padding: 9px 13px !important;
  white-space: nowrap !important;
}

.chat-minimize {
  padding: 9px 12px !important;
}

.chat-close {
  width: 36px !important;
  height: 36px !important;
  font-size: 1.25rem !important;
}

.chat-window-actions {
  display: flex !important;
  gap: 7px !important;
}

.chat-scroll {
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 22px 24px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  scroll-behavior: smooth !important;
}

.chat-scroll::before,
.chat-scroll::after {
  content: "";
  flex: 0 0 1px;
}

.chat-empty {
  width: min(820px, 100%) !important;
  margin: auto !important;
  padding: 0 8px !important;
  text-align: center !important;
  color: #071b24 !important;
}

.chat-empty h2 {
  margin: 0 0 8px !important;
  font-size: clamp(1.35rem, 2.4vw, 2rem) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em !important;
}

.chat-empty p {
  display: block !important;
  margin: 0 auto 16px !important;
  max-width: 520px !important;
  color: #68767b !important;
  font-size: 0.94rem !important;
}

.chat-suggestions {
  display: flex !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

.chat-suggestions button {
  border: 1px solid rgba(7, 27, 36, 0.12) !important;
  border-radius: 999px !important;
  padding: 8px 12px !important;
  background: #fffdf8 !important;
  color: #07313c !important;
  font-size: 0.86rem !important;
}

.chat-bubble {
  width: fit-content !important;
  min-height: 0 !important;
  max-width: min(760px, 75%) !important;
  padding: 14px 18px !important;
  border-radius: 18px !important;
  line-height: 1.55 !important;
  box-shadow: none !important;
}

.chat-bubble__role {
  display: none !important;
}

.chat-bubble p {
  margin: 0 0 0.8em !important;
}

.chat-bubble p:last-child,
.chat-bubble ul:last-child {
  margin-bottom: 0 !important;
}

.chat-bubble-user {
  align-self: flex-end !important;
  max-width: min(680px, 60%) !important;
  background: #073b46 !important;
  color: #fff8ea !important;
  border: 0 !important;
  border-bottom-right-radius: 5px !important;
}

.chat-bubble-assistant {
  align-self: flex-start !important;
  max-width: min(760px, 75%) !important;
  background: #fffdf8 !important;
  color: #071b24 !important;
  border: 1px solid rgba(7, 27, 36, 0.1) !important;
  border-bottom-left-radius: 5px !important;
}

.chat-bubble-assistant.is-pending {
  color: #6f7b80 !important;
  background: transparent !important;
  border-color: transparent !important;
  padding-left: 0 !important;
}

.chat-composer {
  padding: 14px 24px 16px !important;
  background: linear-gradient(180deg, rgba(247, 243, 234, 0.2), #f7f3ea 28%) !important;
  border-top: 1px solid rgba(7, 27, 36, 0.08) !important;
}

.chat-composer__box {
  width: min(900px, 100%) !important;
  margin: 0 auto !important;
  position: relative !important;
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  border: 1px solid rgba(7, 27, 36, 0.15) !important;
  border-radius: 22px !important;
  background: #fffdf8 !important;
  padding: 8px 8px 8px 15px !important;
}

.chat-composer textarea {
  flex: 1 !important;
  min-height: 36px !important;
  max-height: 150px !important;
  resize: none !important;
  border: 0 !important;
  outline: 0 !important;
  padding: 8px 6px !important;
  background: transparent !important;
  color: #071b24 !important;
  font: inherit !important;
  line-height: 1.35 !important;
}

.chat-composer button[type="submit"] {
  flex: 0 0 auto !important;
  border: 0 !important;
  border-radius: 16px !important;
  padding: 10px 14px !important;
  background: #073b46 !important;
  color: #fff8ea !important;
  font-weight: 900 !important;
}

.chat-composer > p {
  width: min(900px, 100%) !important;
  margin: 7px auto 0 !important;
  color: #768287 !important;
  font-size: 0.76rem !important;
  text-align: center !important;
}

.chat-panel__header,
.chat-panel__body,
.chat-panel__form,
.chat-modebar,
.chat-model-picker {
  display: none !important;
}

body.chat-is-open {
  overflow: hidden !important;
}

@media (min-width: 821px) {
  .chat-menu {
    display: none !important;
  }
}

@media (max-width: 820px) {
  .chat-workspace {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    grid-template-columns: 1fr !important;
    border-radius: 0 !important;
  }

  .chat-sidebar {
    position: fixed !important;
    z-index: 5 !important;
    inset: 0 auto 0 0 !important;
    width: min(84vw, 310px) !important;
    transform: translateX(-105%) !important;
    transition: transform 180ms ease !important;
    box-shadow: 18px 0 38px rgba(0, 0, 0, 0.28) !important;
  }

  .chat-sidebar.is-open {
    transform: translateX(0) !important;
  }

  .chat-main {
    grid-template-rows: 66px minmax(0, 1fr) auto !important;
  }

  .chat-topbar {
    height: 66px !important;
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
    padding: 0 10px !important;
    gap: 8px !important;
  }

  .chat-titleblock p,
  .chat-new-top,
  .chat-minimize {
    display: none !important;
  }

  .chat-mode-segment button {
    padding: 7px 10px !important;
    font-size: 0.8rem !important;
  }

  .chat-scroll {
    padding: 16px 12px 12px !important;
    gap: 10px !important;
  }

  .chat-bubble,
  .chat-bubble-user,
  .chat-bubble-assistant {
    max-width: 92% !important;
  }

  .chat-composer {
    padding: 10px 10px 12px !important;
  }

  .chat-composer__box {
    border-radius: 19px !important;
  }

  .chat-composer > p {
    display: none !important;
  }
}

/* NORMA requested refinements 2026-06-28 */
.chat-topbar {
  grid-template-columns: auto auto minmax(0, 1fr) auto !important;
  justify-content: start !important;
}

.chat-mode-wrap {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  justify-self: start !important;
  min-width: 0 !important;
}

.chat-mode-wrap > span {
  color: #071b24 !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}

.chat-mode-segment {
  width: auto !important;
  flex: 0 0 auto !important;
}

.chat-mode-segment button {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  padding: 7px 12px !important;
}

.chat-mode-segment button[data-chat-mode="plus"] {
  min-width: 0 !important;
  padding-inline: 12px !important;
}

.chat-window-actions {
  justify-self: end !important;
}

.chat-minimize {
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
}

.chat-bubble {
  display: inline-block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: min(760px, 75%) !important;
  padding: 11px 15px !important;
}

.chat-bubble-user {
  width: fit-content !important;
  max-width: min(680px, 62%) !important;
  padding: 10px 14px !important;
}

.chat-bubble-user .chat-bubble__content,
.chat-bubble-user p {
  display: inline !important;
}

.chat-bubble-user p {
  margin: 0 !important;
}

.chat-empty p {
  margin-bottom: 0 !important;
}

@media (max-width: 820px) {
  .chat-topbar {
    grid-template-columns: auto minmax(0, auto) 1fr auto !important;
  }

  .chat-mode-wrap > span {
    display: none !important;
  }

  .chat-mode-segment button {
    padding: 7px 9px !important;
  }

  .chat-bubble-user,
  .chat-bubble-assistant {
    max-width: 90% !important;
  }
}

/* NORMA composer and bubble fix 2026-06-28 */
.chat-main .chat-scroll {
  align-items: stretch !important;
}

.chat-main .chat-scroll .chat-bubble {
  box-sizing: border-box !important;
  min-height: unset !important;
  height: auto !important;
  line-height: 1.45 !important;
}

.chat-main .chat-scroll .chat-bubble-user {
  display: block !important;
  align-self: flex-end !important;
  width: max-content !important;
  max-width: min(640px, 58%) !important;
  min-width: 0 !important;
  min-height: unset !important;
  height: auto !important;
  padding: 9px 14px !important;
  border-radius: 18px 18px 5px 18px !important;
  background: #073b46 !important;
  color: #fff8ea !important;
}

.chat-main .chat-scroll .chat-bubble-assistant {
  display: block !important;
  align-self: flex-start !important;
  width: fit-content !important;
  max-width: min(760px, 75%) !important;
  min-height: unset !important;
  height: auto !important;
  padding: 14px 18px !important;
}

.chat-main .chat-scroll .chat-bubble__content,
.chat-main .chat-scroll .chat-bubble p {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  white-space: normal !important;
}

.chat-main .chat-scroll .chat-bubble-assistant p + p {
  margin-top: 0.75em !important;
}

.chat-main .chat-composer {
  padding: 12px 22px 14px !important;
  background: #f7f3ea !important;
}

.chat-main .chat-composer__box {
  box-sizing: border-box !important;
  width: min(860px, 100%) !important;
  min-height: 54px !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 8px 8px 18px !important;
  border: 1px solid rgba(7, 27, 36, 0.16) !important;
  border-radius: 28px !important;
  background: #fffdf8 !important;
  box-shadow: 0 10px 24px rgba(7, 27, 36, 0.06) !important;
}

.chat-main .chat-composer textarea {
  box-sizing: border-box !important;
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 24px !important;
  height: 24px;
  max-height: 140px !important;
  margin: 0 !important;
  padding: 2px 0 !important;
  border: 0 !important;
  outline: 0 !important;
  resize: none !important;
  overflow-y: auto !important;
  background: transparent !important;
  color: #071b24 !important;
  line-height: 1.35 !important;
}

.chat-main .chat-composer button[type="submit"] {
  flex: 0 0 auto !important;
  min-width: 70px !important;
  height: 38px !important;
  padding: 0 14px !important;
  border-radius: 20px !important;
  display: inline-grid !important;
  place-items: center !important;
  background: #073b46 !important;
  color: #fff8ea !important;
  border: 0 !important;
  font-size: 0.88rem !important;
  font-weight: 850 !important;
}

.chat-main .chat-composer > p {
  margin-top: 6px !important;
  font-size: 0.74rem !important;
  line-height: 1.2 !important;
}

@media (max-width: 820px) {
  .chat-main .chat-scroll .chat-bubble-user,
  .chat-main .chat-scroll .chat-bubble-assistant {
    max-width: 90% !important;
  }

  .chat-main .chat-composer {
    padding: 9px 10px 11px !important;
  }

  .chat-main .chat-composer__box {
    min-height: 52px !important;
    border-radius: 24px !important;
    padding-left: 14px !important;
  }

  .chat-main .chat-composer button[type="submit"] {
    min-width: 62px !important;
    height: 36px !important;
    padding: 0 12px !important;
  }
}
