:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --ink: #202225;
  --muted: #666b73;
  --placeholder: #a8aca6;
  --line: #dedbd2;
  --accent: #0f6f68;
  --accent-dark: #084f4a;
  --accent-soft: #e2f2ef;
  --warn: #8b5a00;
  --warn-soft: #fff3cf;
  --shadow: 0 18px 45px rgba(37, 34, 26, 0.10);
  --input-bg: #ffffff;
  --footer-bg: rgba(255, 255, 255, 0.96);
  --focus-ring: rgba(15, 111, 104, 0.18);
  --danger: #b42318;
  --danger-soft: #fff1f0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141715;
  --panel: #1f2421;
  --panel-soft: #252b28;
  --ink: #f0f3ef;
  --muted: #aeb8b2;
  --placeholder: #6f7a74;
  --line: #3a433e;
  --accent: #65c8b8;
  --accent-dark: #9be1d5;
  --accent-soft: #183d38;
  --warn: #f4c46b;
  --warn-soft: #3d2f13;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.30);
  --input-bg: #171b19;
  --footer-bg: rgba(20, 23, 21, 0.96);
  --focus-ring: rgba(101, 200, 184, 0.22);
  --danger: #ff9b93;
  --danger-soft: #3f1f1d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 111, 104, 0.08), rgba(246, 245, 241, 0) 320px),
    var(--bg);
}

.version-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(15, 111, 104, 0.28);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  transform: translateX(-50%);
}

.version-banner[hidden] {
  display: none;
}

.version-banner span {
  flex: 1;
  font-weight: 800;
}

.version-reload-button {
  flex: 0 0 auto;
  padding: 9px 12px;
  font-size: 0.95rem;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  min-height: calc(100vh - 48px);
}

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

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1.05;
}

.title-subtitle {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

h2 {
  font-size: 1.1rem;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(360px, 1fr) minmax(340px, 440px);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.source-list {
  display: grid;
  gap: 8px;
  min-width: 0;
  position: sticky;
  top: 20px;
}

.source-button,
.ghost-button,
.icon-button,
.primary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
}

.source-button {
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.source-copy,
.source-copy span,
.source-copy small {
  display: block;
}

.source-copy {
  min-width: 0;
}

.source-copy span {
  font-weight: 750;
}

.source-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.source-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  object-fit: contain;
}

.source-button.start-button {
  background: var(--accent-soft);
}

.source-button.start-button small {
  color: var(--accent-dark);
}

.source-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.source-button.start-button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.source-separator {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

.source-button.feedback-button {
  margin-top: 0;
}

.ghost-button,
.icon-button,
.primary-button {
  align-items: center;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  padding: 0 13px;
  font-weight: 700;
  text-decoration: none;
}

.theme-button {
  width: 42px;
  padding: 0;
}

.theme-button img {
  width: 21px;
  height: 21px;
  object-fit: contain;
  transition: filter 160ms ease, transform 160ms ease;
}

.theme-button:hover img {
  transform: scale(1.05);
}

:root[data-theme="dark"] .theme-button img,
:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .source-icon {
  filter: invert(1);
}

.ghost-button:hover,
.icon-button:hover,
.primary-button:hover,
.source-button:hover {
  border-color: var(--accent);
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

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

.form-stack {
  grid-column: 2;
  display: grid;
  gap: 16px;
  align-self: start;
  min-width: 0;
}

.form-stack-wide {
  grid-column: 2 / 4;
}

.form-stack .form-panel-wide {
  grid-column: auto;
}

.form-panel {
  padding: 20px;
}

.form-panel.start-mode .panel-heading {
  display: none;
}

.form-panel.feedback-mode .heading-side {
  display: none;
}

.source-actions-panel {
  padding: 18px;
}

.source-actions-panel .panel-heading {
  margin-bottom: 12px;
}

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

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

.form-panel-wide {
  grid-column: span 2;
}

[hidden] {
  display: none !important;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.heading-side {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.form-panel .panel-heading .eyebrow {
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 850;
  line-height: 1.15;
  text-transform: none;
}

.source-subtitle {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
}

.source-subtitle span {
  display: block;
}

.form-tool-buttons {
  display: flex;
  gap: 6px;
}

.compact-tool-button {
  display: grid;
  align-content: center;
  gap: 0;
  height: 36px;
  min-width: 72px;
  padding: 3px 9px;
  line-height: 1.05;
  text-align: center;
}

.compact-tool-button span,
.compact-tool-button small {
  display: block;
}

.compact-tool-button span {
  font-size: 0.78rem;
}

.compact-tool-button small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.panel-heading.compact {
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  white-space: nowrap;
}

#sourceParagraph {
  min-height: 20px;
  padding: 2px 6px;
  font-size: 0.64rem;
  font-weight: 700;
}

#citationForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
}

.form-actions[hidden] {
  display: none;
}

#citationForm > .form-actions {
  grid-column: 1 / -1;
  margin-top: 0;
}

#caseLookupActions {
  align-items: stretch;
  border-top: 0;
  margin-top: -12px;
  padding-top: 0;
}

#caseLookupActions #lookupEcliButton {
  justify-self: start;
}

.case-soft-panel,
#caseLookupActions .case-name-search {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.lookup-panel {
  align-items: stretch;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  padding: 12px;
}

#bookLookupActions {
  align-self: start;
  align-content: start;
  border-top: 0;
  display: grid;
  gap: 12px;
  justify-content: stretch;
  justify-items: stretch;
  margin-top: 0;
  padding: 12px;
}

.case-name-search {
  flex: 1 1 100%;
  display: grid;
  gap: 8px;
}

.case-name-search label {
  font-weight: 800;
  color: var(--ink);
}

.lookup-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: space-between;
}

.lookup-primary-group {
  display: grid;
  flex: 1 1 280px;
  gap: 8px;
  justify-items: start;
  min-width: 0;
}

.lookup-primary-group input {
  height: 52px;
  max-width: 480px;
}

.hugo-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.hugo-button:hover {
  border-color: var(--accent);
  background: var(--panel-soft);
}

.hugo-button img {
  width: 54px;
  height: 22px;
  object-fit: contain;
}

.compact-hugo-button {
  align-content: center;
  align-self: end;
  display: grid;
  gap: 3px;
  justify-items: center;
  height: 52px;
  min-width: 86px;
  padding: 5px 8px;
  text-align: center;
}

.compact-hugo-button span {
  font-size: 0.68rem;
  line-height: 1.05;
}

.compact-hugo-button img {
  width: 58px;
  height: 22px;
}

.lookup-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.lookup-disclaimer {
  margin: 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.4;
}

.lookup-disclaimer.danger {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.lookup-disclaimer::before {
  content: "Disclaimer";
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.lookup-results {
  display: grid;
  gap: 8px;
}

.lookup-result {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.lookup-result:hover {
  border-color: var(--accent);
  background: var(--panel-soft);
}

.lookup-result strong,
.lookup-result span {
  display: block;
}

.lookup-result strong {
  font-size: 0.92rem;
}

.lookup-result span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.lookup-result small {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  margin-top: 6px;
}

.field {
  align-content: start;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.compact-after-field .empty-hint {
  display: none;
}

.inline-form-action {
  justify-items: start;
  margin-top: -4px;
}

.inline-form-action .ghost-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.abbreviation-results {
  display: grid;
  gap: 6px;
}

.abbreviation-field {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.abbreviation-results[hidden] {
  display: none;
}

.abbreviation-result {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.abbreviation-result:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.abbreviation-result strong,
.abbreviation-result span {
  display: block;
}

.abbreviation-result span,
.abbreviation-empty {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.abbreviation-empty {
  margin: 0;
}

.extra-authors-panel {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.extra-authors-panel > .ghost-button {
  justify-self: start;
}

.extra-authors-panel > .ghost-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.panel-mini-title {
  margin: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.eu-advanced-panel {
  gap: 12px;
}

.publication-law-panel,
.treaty-panel,
.decentralized-law-panel,
.caribbean-law-panel {
  gap: 14px;
}

.publication-law-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.publication-law-row.two-columns {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.publication-law-extra {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.publication-law-extra > p {
  margin: 0;
  font-weight: 800;
}

.extra-author-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.extra-author-row-primary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.extra-author-remove {
  align-self: start;
  margin-top: 25px;
}

.unknown-helper {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.start-welcome {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 16px;
}

.start-welcome h3,
.start-welcome p {
  margin: 0;
}

.start-welcome h3 {
  color: var(--ink);
  font-size: 0.98rem;
}

.start-welcome p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.42;
}

.unknown-search-button {
  justify-self: start;
}

.feedback-actions {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.feedback-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.feedback-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.eu-guide {
  display: grid;
  gap: 12px;
}

.eu-guide-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.eu-guide-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.eu-guide-card-clickable {
  cursor: pointer;
}

.eu-guide-card-clickable:hover,
.eu-guide-card-clickable:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.eu-guide-card h3 {
  margin: 0 0 5px;
  font-size: 0.92rem;
}

.eu-guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.eu-guide-action {
  justify-self: start;
}

.suggestion-card {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.suggestion-card:not(:disabled) {
  cursor: pointer;
}

.suggestion-card:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.suggestion-card:disabled {
  color: var(--muted);
  cursor: default;
}

.suggestion-card span,
.suggestion-card small {
  display: block;
}

.suggestion-card span {
  font-weight: 800;
}

.suggestion-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

label {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.2;
  min-height: 1.06rem;
  overflow-wrap: anywhere;
}

.label-with-help {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  justify-self: start;
}

.field-help-button {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.field-help-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.empty-hint {
  visibility: hidden;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--input-bg);
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 9px 10px;
}

.checkbox-field input {
  width: 17px;
  min-height: 17px;
  accent-color: var(--accent);
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.feedback-mode .field-message textarea {
  min-height: 180px;
}

.feedback-mode .field-contact input {
  min-height: 40px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--focus-ring);
  border-color: var(--accent);
}

.result-column {
  grid-column: 3;
  grid-row: 1;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.output-panel,
.help-panel,
.checks-panel {
  padding: 18px;
}

.output-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.output-block + .output-block {
  margin-top: 10px;
}

.output-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.output-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.mini-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.citation {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.citation em {
  font-style: italic;
}

.citation strong {
  font-weight: 800;
}

.output-option {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  gap: 7px;
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.output-option-inline {
  margin: 0 0 0 auto;
}

.output-option[hidden] {
  display: none;
}

.output-option input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.validation-message {
  margin: 10px 0 0;
  border-left: 3px solid var(--warn);
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.82rem;
  line-height: 1.35;
}

.global-check {
  margin: 12px 0 0;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.4;
}

.global-check::before {
  content: "Disclaimer";
  display: block;
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

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

.empty {
  color: var(--muted);
  font-style: italic;
}

.help-panel h2,
.checks-panel h2 {
  margin-bottom: 10px;
}

.help-panel h2,
.checks-panel h2 {
  margin-bottom: 0;
}

.help-panel.open h2,
.checks-panel.open h2 {
  margin-bottom: 10px;
}

.help-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
  padding: 0;
  text-align: left;
}

.help-toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 1rem;
  line-height: 1;
}

.help-toggle:hover .help-toggle-icon {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.help-panel p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.5;
}

.help-panel strong {
  color: var(--ink);
}

.help-panel .example-heading {
  margin-top: 14px;
  color: var(--ink);
  font-weight: 800;
}

.help-panel .citation-example {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
}

.help-panel .example-context {
  display: block;
  margin-bottom: 3px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.checks-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.checks-panel li + li {
  margin-top: 7px;
}

.extra-info-actions,
.explanation-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  text-decoration: none;
}

.extra-info-actions {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.extra-info-actions[hidden],
.explanation-action[hidden] {
  display: none;
}

.overheid-button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  max-width: 100%;
  padding: 8px 12px;
}

.overheid-button:hover {
  border-color: var(--accent);
  background: var(--panel-soft);
}

.overheid-button img {
  width: 82px;
  height: 34px;
  object-fit: contain;
}

.overheid-button span {
  font-size: 0.82rem;
  line-height: 1.15;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent-dark);
  color: white;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
}

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

.help-modal {
  position: relative;
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.help-modal h2 {
  margin: 0 38px 8px 0;
  font-size: 1.25rem;
}

.help-modal p {
  margin: 0 38px 14px 0;
  color: var(--muted);
  line-height: 1.45;
}

.text-modal ul {
  margin: 0 38px 12px 18px;
  color: var(--muted);
  line-height: 1.45;
}

.text-modal li + li {
  margin-top: 6px;
}

.text-modal a {
  color: var(--accent-dark);
  font-weight: 750;
}

.text-modal .source-note {
  margin-bottom: 10px;
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 750;
}

.help-modal img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
}

.modal-close:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.legal-disclaimer {
  margin-top: 10px;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: var(--footer-bg);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 12px;
  }

  .source-list {
    grid-row: 1 / span 2;
  }

  .form-panel-wide {
    grid-column: 2;
  }

  .form-stack,
  .form-stack-wide {
    grid-column: 2;
  }

  .result-column {
    grid-column: 2;
    grid-row: auto;
    gap: 12px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 14px;
  }

  .version-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .version-reload-button {
    width: 100%;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-logo {
    width: 40px;
    height: 40px;
    margin-top: 2px;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .ghost-button {
    flex: 1 1 140px;
  }

  .topbar-actions .theme-button {
    flex: 0 0 46px;
  }

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

  .form-stack,
  .form-stack-wide {
    grid-column: auto;
  }

  .panel-heading {
    align-items: start;
    display: flex;
  }

  .heading-side {
    justify-items: end;
    margin-left: auto;
  }

  .form-panel .panel-heading .eyebrow {
    font-size: 1.16rem;
  }

  .compact-tool-button {
    min-width: 64px;
    padding-inline: 7px;
  }

  .lookup-button-row {
    align-items: start;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 78px;
  }

  .lookup-primary-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .lookup-button-row > .primary-button,
  .lookup-primary-group .primary-button {
    min-width: 0;
    padding-inline: 9px;
    width: 100%;
  }

  .lookup-primary-group input {
    grid-column: 1 / -1;
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .compact-hugo-button {
    height: 52px;
    min-height: 52px;
    min-width: 78px;
  }

  .compact-hugo-button span {
    font-size: 0.62rem;
  }

  .compact-hugo-button img {
    height: 18px;
    width: 50px;
  }

  .source-list {
    grid-row: auto;
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
    width: 100%;
  }

  .source-button {
    min-height: 58px;
    padding: 8px 9px;
    box-shadow: none;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    gap: 7px;
  }

  .source-separator,
  .source-button.feedback-button {
    grid-column: 1 / -1;
  }

  .source-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
  }

  .source-copy span {
    font-size: 0.86rem;
    line-height: 1.1;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: normal;
    word-break: normal;
  }

  .source-copy small {
    font-size: 0.72rem;
    line-height: 1.15;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .result-column {
    grid-column: auto;
  }

  .form-panel-wide {
    grid-column: auto;
  }

  #citationForm {
    grid-template-columns: 1fr;
  }

  .extra-author-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .publication-law-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .publication-law-row.two-columns {
    grid-template-columns: 1fr;
  }

  .eu-guide-grid {
    grid-template-columns: 1fr;
  }

  .extra-author-remove {
    align-self: start;
    margin-bottom: 0;
  }

  .empty-hint {
    display: none;
  }

  .legal-disclaimer {
    padding: 9px 14px;
    text-align: left;
  }

  .toast {
    right: 14px;
    bottom: 14px;
    left: 14px;
    text-align: center;
  }
}
