:root {
    --norma-blue: #2563eb;
    --norma-blue-dark: #1d4ed8;
    --norma-blue-soft: #eff6ff;
    --norma-ink: #111827;
    --norma-muted: #6b7280;
    --norma-line: #e5e7eb;
    --norma-surface: #ffffff;
    --norma-canvas: #f8fafc;
    --norma-radius: 14px;
    --norma-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.normativa-page {
    background: var(--norma-canvas);
}

.normativa-page main {
    flex: 1 0 auto;
}

.normativa-page [hidden] {
    display: none !important;
}

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

.norma-search-section {
    padding: 52px 0 48px;
    background:
        radial-gradient(circle at 15% 0%, rgba(37, 99, 235, 0.08), transparent 32rem),
        linear-gradient(180deg, #ffffff 0%, var(--norma-canvas) 100%);
}

.norma-search-width {
    max-width: 1020px;
}

.norma-intro {
    max-width: 760px;
    margin: 0 auto 28px;
    text-align: center;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--norma-blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    line-height: 1.4;
    text-transform: uppercase;
}

.norma-intro h1 {
    margin: 0 0 10px;
    color: var(--norma-ink);
    font-size: clamp(34px, 5vw, 48px);
    letter-spacing: -0.035em;
    line-height: 1.1;
}

.norma-intro > p:last-child {
    max-width: 700px;
    margin: 0 auto;
    color: var(--norma-muted);
    font-size: 17px;
    line-height: 1.55;
}

.norma-search-card {
    padding: 22px;
    border: 1px solid var(--norma-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: var(--norma-shadow);
}

.query-field {
    position: relative;
}

.norma-query {
    display: block;
    width: 100%;
    height: 78px;
    min-height: 78px;
    max-height: 78px;
    padding: 15px 20px;
    resize: none;
    border: 2px solid var(--norma-line);
    border-radius: 14px;
    outline: none;
    background: #ffffff;
    color: var(--norma-ink);
    font: inherit;
    font-size: 16px;
    line-height: 1.55;
    transition: border-color 0.18s, box-shadow 0.18s, min-height 0.2s;
}

.norma-query:focus {
    border-color: var(--norma-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.source-picker,
.mode-picker,
.compact-fieldset {
    min-width: 0;
    border: 0;
}

.source-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.source-picker legend,
.mode-picker legend,
.compact-fieldset legend {
    margin-bottom: 8px;
    color: #4b5563;
    font-size: 13px;
    font-weight: 700;
}

.source-picker legend {
    float: left;
    margin: 0 4px 0 0;
    padding: 8px 2px;
}

.check-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    background: #f8fafc;
    color: #374151;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

.check-chip:has(input:checked) {
    border-color: #bfdbfe;
    background: var(--norma-blue-soft);
    color: #1e40af;
}

.check-chip input,
.scope-option input,
.mode-option input,
.inline-check input,
.compact-fieldset input {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    accent-color: var(--norma-blue);
}

.scope-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 14px;
    color: #374151;
    cursor: pointer;
    font-size: 13px;
}

.scope-option input {
    margin-top: 2px;
}

.scope-option span {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
}

.scope-option small,
.mode-option small {
    color: var(--norma-muted);
    font-weight: 400;
}

.source-picker.is-disabled,
.scope-option.is-disabled {
    opacity: 0.52;
}

.source-picker.is-disabled .check-chip,
.scope-option.is-disabled {
    cursor: not-allowed;
}

.mode-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.mode-picker legend {
    grid-column: 1 / -1;
}

.mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--norma-line);
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
}

.mode-option:has(input:checked) {
    border-color: var(--norma-blue);
    background: var(--norma-blue-soft);
    box-shadow: 0 0 0 1px var(--norma-blue);
}

.mode-option input {
    margin-top: 3px;
}

.mode-option span {
    min-width: 0;
}

.mode-option strong,
.mode-option small {
    display: block;
}

.mode-option strong {
    color: var(--norma-ink);
    font-size: 13px;
    line-height: 1.45;
}

.mode-option small {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.45;
}

.advanced-toggle-row {
    margin-top: 12px;
    text-align: center;
}

.advanced-toggle-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--norma-blue);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
}

.advanced-toggle-button span {
    transition: transform 0.2s;
}

.advanced-toggle-button[aria-expanded="true"] span {
    transform: rotate(180deg);
}

.norma-advanced {
    margin-top: 10px;
    padding: 6px 16px 14px;
    border-top: 1px solid var(--norma-line);
}

.advanced-section {
    padding: 18px 0;
    border-bottom: 1px solid #edf0f4;
}

.advanced-section[hidden] {
    display: none;
}

.advanced-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.advanced-section-heading h2 {
    color: var(--norma-ink);
    font-size: 15px;
}

.advanced-section-heading p {
    color: var(--norma-muted);
    font-size: 12px;
    text-align: right;
}

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

.advanced-fields label,
.results-limit {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    color: #4b5563;
    font-size: 12px;
    font-weight: 600;
}

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

.advanced-fields input,
.results-limit select,
.dialog-filter input {
    width: 100%;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--norma-ink);
    font: inherit;
    font-size: 13px;
}

.advanced-fields input:focus,
.results-limit select:focus,
.dialog-filter input:focus {
    border-color: var(--norma-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.compact-fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 14px;
}

.compact-fieldset legend {
    float: left;
    margin: 0 14px 0 0;
}

.compact-fieldset label,
.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #4b5563;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.inline-check {
    margin-top: 14px;
}

.results-limit {
    width: 170px;
    margin-top: 14px;
}

.form-message {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    line-height: 1.45;
}

.form-message.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.norma-search-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

.norma-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.norma-button.primary {
    min-width: 112px;
    background: var(--norma-blue);
    color: #ffffff;
}

.norma-button.primary .mini-spinner {
    width: 16px;
    height: 16px;
    border-color: rgba(255, 255, 255, 0.42);
    border-top-color: #ffffff;
}

.norma-button.primary:hover:not(:disabled) {
    background: var(--norma-blue-dark);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.25);
}

.norma-button.secondary {
    border-color: var(--norma-line);
    background: #ffffff;
    color: #374151;
}

.norma-button.secondary:hover:not(:disabled) {
    background: #f3f4f6;
}

.norma-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.norma-results-section {
    min-height: 55vh;
    padding: 28px 0 48px;
    background: var(--norma-canvas);
    border-top: 1px solid var(--norma-line);
}

.norma-workspace-container {
    width: min(1600px, calc(100% - 40px));
    margin: 0 auto;
}

.norma-results-section.has-open-reader {
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
    background: #ffffff;
}

.norma-results-section.has-open-reader .norma-workspace-container {
    width: 100%;
    max-width: none;
}

.norma-results-section.has-open-reader .results-toolbar,
.norma-results-section.has-open-reader .results-tabs {
    margin-right: 22px;
    margin-left: 22px;
}

.results-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}

.results-toolbar h2 {
    margin: 0;
    color: var(--norma-ink);
    font-size: 24px;
    letter-spacing: -0.015em;
}

.results-summary {
    color: var(--norma-muted);
    font-size: 13px;
    text-align: right;
}

.results-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.results-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid var(--norma-line);
    border-radius: 999px;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.results-tabs button[aria-selected="true"] {
    border-color: var(--norma-blue);
    background: var(--norma-blue);
    color: #ffffff;
}

.results-tabs span {
    display: inline-flex;
    min-width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(107, 114, 128, 0.12);
    font-size: 11px;
}

.results-tabs button[aria-selected="true"] span {
    background: rgba(255, 255, 255, 0.2);
}

.norma-workspace {
    display: block;
}

.norma-workspace.has-selection {
    display: grid;
    grid-template-columns: minmax(310px, 38%) minmax(0, 1fr);
    gap: 14px;
    min-height: 660px;
    height: calc(100vh - 190px);
    max-height: 960px;
}

.has-open-reader .norma-workspace.has-selection {
    grid-template-columns: minmax(320px, 36%) minmax(0, 1fr);
    gap: 0;
    max-height: none;
    border-top: 1px solid var(--norma-line);
}

.has-open-reader .norma-workspace.has-selection .results-pane {
    padding: 16px 14px 24px 20px;
    border-right: 1px solid var(--norma-line);
    background: var(--norma-canvas);
}

.has-open-reader .norma-workspace.has-selection .reader-pane {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.results-pane,
.reader-pane {
    min-width: 0;
}

.norma-workspace.has-selection .results-pane,
.norma-workspace.has-selection .reader-pane {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.norma-workspace.has-selection .results-pane {
    padding-right: 4px;
}

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

.result-group + .result-group {
    margin-top: 24px;
}

.result-group-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    color: var(--norma-ink);
    font-size: 16px;
}

.result-group-heading span {
    color: var(--norma-muted);
    font-size: 12px;
    font-weight: 500;
}

.result-card {
    display: block;
    width: 100%;
    padding: 17px 18px;
    border: 1px solid var(--norma-line);
    border-radius: 12px;
    background: #ffffff;
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.result-card:hover,
.result-card:focus-visible {
    border-color: #93c5fd;
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.result-card[aria-current="true"] {
    border-color: var(--norma-blue);
    box-shadow: inset 3px 0 0 var(--norma-blue), 0 5px 18px rgba(37, 99, 235, 0.1);
}

.result-card-top,
.result-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 10px;
}

.result-card-top {
    margin-bottom: 7px;
}

.result-type,
.status-badge,
.reader-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--norma-blue-soft);
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.045em;
    line-height: 1.25;
    text-transform: uppercase;
}

.status-badge.is-repealed,
.reader-badge.is-repealed {
    background: #fff7ed;
    color: #9a3412;
}

.result-date {
    color: var(--norma-muted);
    font-size: 12px;
}

.result-card h3 {
    margin: 0;
    color: var(--norma-ink);
    font-size: 16px;
    line-height: 1.35;
}

.result-card .result-unit {
    margin: 3px 0 0;
    color: #374151;
    font-size: 13px;
    font-weight: 650;
}

.result-preview {
    display: -webkit-box;
    margin: 10px 0;
    overflow: hidden;
    color: #4b5563;
    font-size: 13px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.result-card-meta {
    color: var(--norma-muted);
    font-size: 11px;
}

.result-empty,
.result-error {
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #ffffff;
    color: var(--norma-muted);
    font-size: 14px;
    text-align: center;
}

.result-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.results-loading {
    display: flex;
    min-height: 260px;
    padding: 40px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    color: var(--norma-ink);
    font-size: 24px;
    line-height: 1.6;
}

.results-loading-message {
    max-width: 760px;
    text-align: center;
    font-weight: 600;
    transition: opacity 0.3s ease-in-out;
}

.results-loading .spinner {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
    border-width: 3px;
    border-top-width: 3px;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.14);
    animation-duration: 0.85s;
}

.mini-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 2px solid #bfdbfe;
    border-top-color: var(--norma-blue);
    border-radius: 50%;
    animation: norma-spin 0.7s linear infinite;
}

@keyframes norma-spin {
    to { transform: rotate(360deg); }
}

.reader-pane {
    border: 1px solid var(--norma-line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.06);
}

.reader-shell {
    min-height: 100%;
}

.reader-toolbar {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--norma-line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
}

.reader-navigation,
.reader-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-button,
.text-button {
    display: inline-flex;
    min-width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid var(--norma-line);
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.icon-button:hover:not(:disabled),
.text-button:hover:not(:disabled) {
    border-color: #bfdbfe;
    background: var(--norma-blue-soft);
    color: var(--norma-blue-dark);
}

.icon-button:disabled,
.text-button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.mobile-back {
    display: none;
}

.reader-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 20px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--norma-blue-soft);
    color: #1e40af;
    font-size: 12px;
}

.reader-document {
    max-width: 890px;
    margin: 0 auto;
    padding: 34px clamp(22px, 5vw, 62px) 56px;
}

.reader-document-header {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--norma-line);
}

.reader-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.reader-document-header h2 {
    margin: 0;
    color: var(--norma-ink);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(23px, 3vw, 32px);
    font-weight: 600;
    line-height: 1.25;
}

.reader-unit-title {
    margin: 10px 0 0;
    color: #4b5563;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.5;
}

.reader-version {
    margin: 8px 0 0;
    color: var(--norma-muted);
    font-size: 12px;
}

.official-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--norma-blue);
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.official-link:hover {
    text-decoration: underline;
}

.reader-notice {
    margin-top: 18px;
    padding: 11px 13px;
    border: 1px solid #fde68a;
    border-radius: 9px;
    background: #fffbeb;
    color: #854d0e;
    font-size: 12px;
    line-height: 1.5;
}

.reader-notice.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.reader-notice a {
    color: #92400e;
    font-weight: 700;
    text-underline-offset: 2px;
}

.reader-notice a:hover {
    color: #713f12;
}

.reader-text {
    margin-top: 28px;
    color: #1f2937;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.reader-text.is-preview {
    color: #4b5563;
}

/* Citations inside the text: dense legal prose, so nothing but a blue underline — no badge,
   no icon, no tooltip. They inherit the reader's serif so the line does not reflow. */
.reader-citation {
    color: #1d4ed8;
    text-decoration: underline;
    text-decoration-color: #a8c1fb;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    cursor: pointer;
}

.reader-citation:hover {
    text-decoration-color: #1d4ed8;
}

.reader-citation:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
    border-radius: 2px;
}

.reader-more-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--norma-line);
    color: var(--norma-muted);
    font-size: 11px;
}

.reader-dialog {
    position: fixed;
    inset: 0 0 0 auto;
    display: none;
    width: min(560px, calc(100vw - 32px));
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--norma-line);
    border-radius: 16px 0 0 16px;
    background: #ffffff;
    box-shadow: -18px 0 55px rgba(15, 23, 42, 0.2);
}

.reader-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: reader-drawer-in 0.2s ease-out;
}

.reader-dialog::backdrop {
    background: rgba(15, 23, 42, 0.26);
}

@keyframes reader-drawer-in {
    from { transform: translateX(24px); opacity: 0.75; }
    to { transform: translateX(0); opacity: 1; }
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--norma-line);
}

.dialog-header h2 {
    margin: 0;
    color: var(--norma-ink);
    font-size: 20px;
}

.dialog-filter {
    padding: 12px 20px 0;
}

.dialog-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px 20px;
    color: var(--norma-muted);
    font-size: 13px;
}

.dialog-content {
    min-height: 0;
    flex: 1 1 auto;
    max-height: none;
    padding: 12px 20px 22px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.outline-group-title {
    position: sticky;
    top: -12px;
    z-index: 1;
    margin: 14px 0 6px;
    padding: 8px 2px 5px;
    background: #ffffff;
    color: var(--norma-muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.outline-row,
.history-row {
    display: block;
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #374151;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.outline-row:hover,
.history-row:hover {
    background: #f3f6fb;
}

.outline-row[aria-current="true"],
.history-row[aria-current="true"] {
    background: var(--norma-blue-soft);
    color: #1e40af;
}

.outline-row strong,
.outline-row span,
.history-row strong,
.history-row span,
.history-row small {
    display: block;
}

.outline-row strong,
.history-row strong {
    font-size: 13px;
    line-height: 1.4;
}

.outline-row span,
.history-row span {
    margin-top: 2px;
    color: var(--norma-muted);
    font-size: 11px;
    line-height: 1.4;
}

.history-row {
    margin-bottom: 5px;
    border: 1px solid var(--norma-line);
}

.history-row small {
    margin-top: 5px;
    color: #4b5563;
    font-size: 11px;
    line-height: 1.45;
}

.dialog-empty {
    padding: 28px 10px;
    color: var(--norma-muted);
    font-size: 13px;
    text-align: center;
}

.norma-footer {
    flex: 0 0 auto;
    padding: 22px 0;
    border-top: 1px solid var(--norma-line);
    background: #ffffff;
    color: var(--norma-muted);
    font-size: 12px;
}

.norma-footer .container,
.norma-footer nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.norma-footer nav {
    padding: 0;
}

.norma-footer a {
    color: #4b5563;
    text-decoration: none;
}

.norma-footer a:hover {
    color: var(--norma-blue);
}

.normativa-page.is-direct-reader .norma-search-section,
.normativa-page.is-direct-reader .results-toolbar,
.normativa-page.is-direct-reader .results-tabs,
.normativa-page.is-direct-reader #site-footer {
    display: none;
}

.normativa-page.is-direct-reader .norma-results-section {
    display: block !important;
    padding: 18px 0;
    border-top: 0;
}

.normativa-page.is-direct-reader .norma-workspace-container {
    width: min(1180px, calc(100% - 32px));
}

.normativa-page.is-direct-reader .norma-workspace {
    display: block;
    height: auto;
    max-height: none;
}

.normativa-page.is-direct-reader .results-pane {
    display: none;
}

.normativa-page.is-direct-reader .reader-pane {
    display: block;
    min-height: calc(100vh - 116px);
    overflow: visible;
}

.normativa-page.is-direct-reader .reader-toolbar {
    top: 70px;
}

.normativa-page.is-direct-reader .reader-close,
.normativa-page.is-direct-reader #reader-full-page {
    display: none;
}

@media (max-width: 1100px) {
    .advanced-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .norma-workspace.has-selection {
        grid-template-columns: minmax(300px, 42%) minmax(0, 1fr);
    }

    .text-button {
        padding: 0 8px;
        font-size: 12px;
    }
}

@media (max-width: 820px) {
    .norma-search-section {
        padding: 34px 0 36px;
    }

    .norma-search-card {
        padding: 16px;
        border-radius: 16px;
    }

    .mode-picker {
        grid-template-columns: 1fr;
    }

    .source-picker legend {
        width: 100%;
        padding-bottom: 0;
    }

    .norma-workspace.has-selection {
        display: block;
        height: auto;
        max-height: none;
    }

    .norma-results-section.has-open-reader .results-toolbar,
    .norma-results-section.has-open-reader .results-tabs {
        display: none;
    }

    .has-open-reader .norma-workspace.has-selection .reader-pane {
        border-top: 1px solid var(--norma-line);
    }

    .norma-workspace.has-selection .results-pane {
        display: none;
    }

    .norma-workspace.has-selection .reader-pane {
        height: auto;
        min-height: 70vh;
        overflow: visible;
    }

    .mobile-back {
        display: inline-flex;
    }

    .reader-navigation {
        margin-right: auto;
    }

    .reader-close {
        display: none;
    }

    .normativa-page.is-direct-reader .mobile-back {
        display: none;
    }
}

@media (max-width: 620px) {
    .norma-search-width,
    .norma-workspace-container {
        width: 100%;
        padding-right: 14px;
        padding-left: 14px;
    }

    .norma-intro h1 {
        font-size: 34px;
    }

    .norma-intro > p:last-child {
        font-size: 15px;
    }

    .advanced-section-heading {
        display: block;
    }

    .advanced-section-heading p {
        margin-top: 2px;
        text-align: left;
    }

    .advanced-fields {
        grid-template-columns: 1fr;
    }

    .advanced-fields .field-wide {
        grid-column: auto;
    }

    .results-toolbar {
        display: block;
    }

    .results-summary {
        margin-top: 5px;
        text-align: left;
    }

    .norma-workspace-container {
        width: 100%;
    }

    .reader-pane {
        border-radius: 11px;
    }

    .reader-toolbar {
        flex-wrap: wrap;
        padding: 7px;
    }

    .reader-tools {
        gap: 4px;
    }

    .text-button {
        min-width: 36px;
        padding: 0 7px;
        font-size: 11px;
    }

    .reader-document {
        padding: 26px 19px 42px;
    }

    .reader-text {
        font-size: 16px;
        line-height: 1.75;
    }

    .reader-dialog {
        inset: auto 0 0 0;
        width: 100vw;
        height: min(82vh, 760px);
        height: min(82dvh, 760px);
        border-radius: 18px 18px 0 0;
    }

    .dialog-content {
        max-height: none;
    }

    .norma-footer .container {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .normativa-page > header,
    .norma-search-section,
    .results-toolbar,
    .results-tabs,
    .results-pane,
    .reader-toolbar,
    .norma-footer {
        display: none !important;
    }

    .norma-results-section {
        display: block !important;
        padding: 0;
        border: 0;
        background: #ffffff;
    }

    .norma-workspace,
    .norma-workspace.has-selection {
        display: block;
        height: auto;
        max-height: none;
    }

    .reader-pane {
        display: block !important;
        overflow: visible !important;
        border: 0;
        box-shadow: none;
    }
}

/* ── Giurisprudenza collegata ─────────────────────────────────────────────────
   Under the reader header, collapsed to a single line. Four legislative units out of
   five are cited by nothing, and on those this whole section stays hidden — so when it
   is there, it means something. The law keeps the page; this asks for one row of it. */

.citation-section {
    margin-top: 18px;
}

.citation-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: var(--norma-blue-soft);
    color: var(--norma-blue-dark);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.citation-toggle:hover {
    border-color: #bfdbfe;
    background: #e6efff;
}

.citation-toggle:focus-visible {
    outline: 2px solid var(--norma-blue-dark);
    outline-offset: 2px;
}

.citation-icon {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1;
}

.citation-count {
    flex: 1 1 auto;
}

.citation-chevron {
    font-size: 13px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.citation-toggle[aria-expanded="true"] .citation-chevron {
    transform: rotate(180deg);
}

/* The list scrolls inside its own box rather than pushing the article down the page:
   twenty cards run past 2.000px, and the law is what the reader came for — it stays one
   short scroll away instead of below all of them. */
.citation-panel {
    display: grid;
    gap: 10px;
    max-height: 420px;
    margin-top: 10px;
    padding-right: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.citation-card {
    padding: 12px 14px;
    border: 1px solid var(--norma-line);
    border-radius: 10px;
    background: var(--norma-surface);
}

.citation-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
}

.citation-authority {
    color: var(--norma-blue-dark);
    font-weight: 700;
}

/* Only where the decision has a public URL — Cassazione has one about 60% of the time,
   and the rest stay plain text rather than becoming links that go nowhere. */
a.citation-authority {
    text-decoration: underline;
    text-decoration-color: #a8c1fb;
    text-underline-offset: 2px;
}

a.citation-authority:hover {
    text-decoration-color: var(--norma-blue-dark);
}

a.citation-authority:focus-visible {
    outline: 2px solid var(--norma-blue-dark);
    outline-offset: 2px;
    border-radius: 2px;
}

.citation-level {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--norma-canvas);
    color: var(--norma-muted);
    font-size: 11px;
}

.citation-date {
    margin-left: auto;
    color: var(--norma-muted);
    font-variant-numeric: tabular-nums;
}

.citation-title {
    margin: 7px 0 0;
    color: var(--norma-ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

/* The motivo is a quotation from a decision, and is set as one: it explains why that
   court reached for this norm, alongside whichever others it cited in the same breath.
   Never styled as a headnote of the article itself. */
.citation-motivo {
    margin: 8px 0 0;
    padding-left: 11px;
    border-left: 2px solid var(--norma-line);
    color: #374151;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13px;
    line-height: 1.65;
}

.citation-note,
.citation-empty {
    margin: 2px 0 0;
    color: var(--norma-muted);
    font-size: 12px;
    line-height: 1.5;
}

@media print {
    .citation-section {
        display: none;
    }
}
