* {
    box-sizing: border-box;
}

/* ============================================================
   Design tokens — unica fonte di verita' (Step 11, Fase 1)
   ============================================================ */
:root {
    --romea-navy: #081b2d;
    --romea-blue: #155a93;
    --romea-light-blue: #4ea3d8;
    --romea-cyan: #63c7e8;
    --romea-ice: #f4f8fb;
    --romea-line: #cbdce9;
    --bg: #06121e;
    --panel: #0c2336;
    --panel-2: #11324b;
    --text: #f4f8fb;
    --muted: #a8bdcc;
    --accent: #8fd4f2;
    --white: #ffffff;
    --success: #27b56f;
    --warning: #e6a63c;
    --danger: #df5a5a;
    --shadow-sm: 0 8px 24px rgba(2, 12, 22, .16);
    --shadow-md: 0 18px 50px rgba(2, 12, 22, .24);
    --ring: 0 0 0 3px rgba(78, 163, 216, .18);
}


body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at 25% 15%, rgba(91,143,198,.22), transparent 35%),
        linear-gradient(135deg, #06111D 0%, #0B2340 48%, #071421 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.brand-header {
    background: linear-gradient(90deg, var(--romea-navy), var(--romea-blue));
    border-bottom: 1px solid rgba(255,255,255,.14);
    box-shadow: 0 14px 45px rgba(0,0,0,.28);
    padding: 20px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--white);
    color: var(--romea-blue);
    font-weight: 900;
    font-size: 30px;
    letter-spacing: -2px;
    box-shadow: 0 8px 24px rgba(0,0,0,.28);
}

.brand-header h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: .06em;
}

.brand-header p {
    margin: 4px 0 0;
    color: #DCEAF6;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 12px;
}

.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px;
}

header {
    margin-bottom: 24px;
}

header h1 {
    margin: 0;
    font-size: 34px;
    letter-spacing: -.02em;
}

header p {
    margin: 6px 0 0;
    color: var(--muted);
}

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

.hero-panel {
    background:
        linear-gradient(120deg, rgba(30,78,140,.94), rgba(11,35,64,.96)),
        linear-gradient(0deg, rgba(255,255,255,.04), rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 22px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 520px);
    gap: 28px;
    align-items: center;
    box-shadow: 0 22px 60px rgba(0,0,0,.30);
}

.hero-panel h2 {
    margin: 0;
    font-size: 34px;
}

.hero-panel p {
    color: #DCEAF6;
    margin: 8px 0 0;
}

.hero-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: rgba(255,255,255,.96);
    color: #0B2340;
    border-radius: 18px;
    padding: 22px;
    border: 1px solid rgba(216,227,238,.9);
    box-shadow: 0 18px 45px rgba(0,0,0,.20);
}

.stat-card span {
    color: #55708A;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 12px;
    margin: 0 0 10px;
}

.stat-card strong {
    font-size: 34px;
    color: var(--romea-blue);
}

.card {
    background: rgba(15,36,53,.92);
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 18px 45px rgba(0,0,0,.25);
    margin-bottom: 22px;
    backdrop-filter: blur(8px);
}

.layout {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 22px;
    align-items: start;
}

.ship-svg {
    width: 100%;
    background: linear-gradient(180deg, #071421, #0A1C2B);
    border-radius: 16px;
    border: 1px solid rgba(158,208,245,.24);
    box-shadow: inset 0 0 40px rgba(91,143,198,.10);
}

.hull {
    fill: rgba(30,78,140,.12);
    stroke: #9ED0F5;
    stroke-width: 3;
}

.centerline {
    stroke: rgba(158,208,245,.35);
    stroke-width: 2;
    stroke-dasharray: 8 8;
}

.innerline {
    fill: none;
    stroke: rgba(158,208,245,.22);
    stroke-width: 2;
    stroke-dasharray: 5 7;
}

.hotspot {
    fill: #1E4E8C;
    stroke: #D9F1FF;
    stroke-width: 2;
    cursor: pointer;
    transition: .15s;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,.35));
}

.hotspot:hover {
    fill: #5B8FC6;
    stroke-width: 3;
    transform: scale(1.025);
}

.label {
    fill: #FFFFFF;
    font-size: 17px;
    font-weight: 700;
    text-anchor: middle;
    pointer-events: none;
}

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

.grid, .mini-grid {
    display: grid;
    gap: 12px;
}

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

.mini-grid {
    grid-template-columns: repeat(2, 1fr);
}

.grid div, .mini-grid div {
    background: rgba(7,20,33,.88);
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 12px;
    padding: 12px;
}

span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 4px;
}

strong {
    color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

th, td {
    padding: 11px 10px;
    border-bottom: 1px solid rgba(158,208,245,.16);
    text-align: left;
}

th {
    color: #BFD2E1;
    font-size: 13px;
    text-transform: uppercase;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: rgba(91,143,198,.14);
}

.vessel-row {
    display: block;
    padding: 14px;
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 12px;
    margin: 10px 0;
    background: rgba(7,20,33,.80);
    position: relative;
    overflow: hidden;
}

.vessel-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--romea-light-blue);
}

.vessel-row:hover {
    background: rgba(91,143,198,.16);
}

.component-motore::before { background: #F59E0B; }
.component-generatore::before { background: #FACC15; }
.component-linea-asse::before { background: #3B82F6; }
.component-elica::before { background: #06B6D4; }
.component-timone::before { background: #10B981; }
.component-pompa::before { background: #EF4444; }
.component-invertitore::before { background: #8B5CF6; }
.component-bow-thruster::before { background: #A855F7; }
.component-tenuta-meccanica::before { background: #EC4899; }

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.main-section-title {
    margin: 26px 0 14px;
}

.button {
    display: inline-block;
    background: linear-gradient(180deg, #FFFFFF, #D7EDF8);
    color: #0B2340;
    font-weight: 800;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    cursor: pointer;
    margin-top: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,.20);
}

.button:hover {
    transform: translateY(-1px);
}

.button.full {
    display: block;
    text-align: center;
}

form {
    display: grid;
    gap: 12px;
}

label {
    color: var(--muted);
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    background: rgba(7,20,33,.88);
    color: var(--text);
    border: 1px solid rgba(158,208,245,.22);
    border-radius: 10px;
    padding: 12px;
}

input::placeholder {
    color: #8CA7BA;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.actions .button {
    margin-top: 0;
}

td input {
    padding: 8px;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
}

.badge, .counter {
    display: inline-block;
    background: rgba(255,255,255,.95);
    color: var(--romea-navy);
    border-radius: 999px;
    padding: 7px 11px;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
}

.vessel-row p {
    margin: 8px 0 0;
    color: #b7c7d1;
}

.vessel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
    gap: 12px;
    margin-bottom: 26px;
}

.vessel-card {
    display: block;
    background: rgba(255,255,255,.96);
    color: #0B2340;
    border-radius: 18px;
    padding: 20px;
    min-height: 96px;
    border: 1px solid rgba(216,227,238,.9);
    box-shadow: 0 18px 45px rgba(0,0,0,.20);
    transition: .15s;
}

.vessel-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 60px rgba(0,0,0,.28);
}

.vessel-card-top {
    display: block;
}

.vessel-card h3 {
    margin: 0;
    font-size: 26px;
    letter-spacing: -.02em;
}

.vessel-card-top span {
    background: #E8F2FB;
    color: var(--romea-blue);
    border-radius: 999px;
    padding: 6px 10px;
    white-space: nowrap;
    font-weight: 800;
}

.vessel-card p {
    color: #425B70;
    margin: 12px 0;
}

.vessel-card small {
    color: #64798C;
}

.vessel-card-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.doc-card {
    background: rgba(7,20,33,.80);
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 14px;
    overflow: hidden;
}

.doc-card:hover {
    background: rgba(91,143,198,.16);
}

.doc-open {
    display: block;
}

.doc-preview {
    height: 230px;
    background: #0b1117;
    border-bottom: 1px solid rgba(158,208,245,.18);
    overflow: hidden;
}

.doc-preview iframe {
    width: 100%;
    height: 330px;
    border: 0;
    transform: scale(.72);
    transform-origin: top left;
    width: 139%;
}

.doc-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doc-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: #9fb0bd;
    font-size: 28px;
}

.doc-info {
    padding: 12px;
}

.doc-info strong {
    display: block;
    word-break: break-word;
}

.doc-info p {
    color: #b7c7d1;
    margin: 8px 0 0;
}

.special-fields {
    margin: 18px 0;
    padding: 16px;
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 14px;
    background: rgba(7,20,33,.64);
}

@media (max-width: 900px) {
    .layout, .grid, .stats-grid, .hero-panel {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 700px) {
    .search-form, .hero-search {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 18px;
    }
}


.imo-badge {
    display: inline-block;
    margin-top: 7px;
    background: #E8F2FB;
    color: var(--romea-blue);
    border: 1px solid #CFE4F5;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: .04em;
}

.imo-badge.big {
    margin-top: 0;
    font-size: 14px;
    padding: 8px 12px;
}

.title-line {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.vessel-title-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
}

.vessel-title-photo {
    width: 118px;
    height: 78px;
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid rgba(158,208,245,.38);
    box-shadow: 0 14px 35px rgba(0,0,0,.28);
}

.vessel-card {
    padding: 0;
    overflow: hidden;
}

.vessel-card-photo {
    height: 82px;
    background: linear-gradient(135deg, var(--romea-blue), var(--romea-navy));
    overflow: hidden;
}

.vessel-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: .2s;
}

.vessel-card:hover .vessel-card-photo img {
    transform: scale(1.04);
}

.vessel-card-photo-empty {
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.7);
    font-weight: 900;
    letter-spacing: .18em;
}

.vessel-card-top,
.vessel-card > p,
.vessel-card > small {
    padding-left: 14px;
    padding-right: 14px;
}

.vessel-card-top {
    padding-top: 12px;
    padding-bottom: 34px;
}

.vessel-card > small {
    display: block;
    padding-bottom: 12px;
}

.current-vessel-photo {
    background: rgba(7,20,33,.64);
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 14px;
    padding: 12px;
}

.current-vessel-photo img {
    display: block;
    max-width: 360px;
    max-height: 220px;
    border-radius: 12px;
    margin-top: 8px;
}


.panel-component-photo {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(158,208,245,.24);
    margin: 8px 0 14px;
    display: block;
}

.component-photo-card {
    padding: 0;
    overflow: hidden;
}

.component-photo-card img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.component-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.component-thumb {
    width: 68px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(158,208,245,.28);
    flex: 0 0 auto;
    margin-left: 4px;
}


/* v15 - immagini componente tecniche: non esplodere foto piccole */
.component-photo-card {
    padding: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(15,36,53,.92);
}

.component-photo-card img {
    width: auto;
    height: auto;
    max-width: 520px;
    max-height: 320px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 14px;
    padding: 12px;
    border: 1px solid rgba(158,208,245,.24);
}

.panel-component-photo {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 8px;
}

.component-thumb {
    object-fit: contain;
    background: #f7f7f7;
    padding: 4px;
}


/* v16 - foto identificative in testata, non come banner */
.component-title-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
}

.component-title-photo {
    width: 132px;
    height: 92px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 16px;
    padding: 8px;
    border: 2px solid rgba(158,208,245,.32);
    box-shadow: 0 14px 35px rgba(0,0,0,.24);
    flex: 0 0 auto;
}

.vessel-title-wrap {
    align-items: center;
}

.vessel-title-photo {
    width: 138px;
    height: 88px;
    object-fit: cover;
}

@media (max-width: 700px) {
    .component-title-wrap,
    .vessel-title-wrap {
        align-items: flex-start;
        flex-direction: column;
    }

    .component-title-photo,
    .vessel-title-photo {
        width: 100%;
        max-width: 260px;
        height: auto;
        max-height: 160px;
    }
}


/* v17 - pannello laterale componente: foto a sinistra del titolo */
.panel-component-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-component-header h2 {
    margin: 0;
}

.panel-component-header p {
    margin: 5px 0 0;
    color: var(--muted);
}

.panel-component-header .panel-component-photo {
    width: 116px;
    height: 82px;
    max-width: 116px;
    max-height: 82px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 7px;
    border: 1px solid rgba(158,208,245,.24);
    margin: 0;
    flex: 0 0 auto;
}

@media (max-width: 700px) {
    .panel-component-header {
        align-items: flex-start;
    }

    .panel-component-header .panel-component-photo {
        width: 92px;
        height: 68px;
    }
}


/* v18 - miniature nella scelta multipla dal disegno SVG */
.group-component-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-component-thumb {
    width: 72px;
    height: 54px;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 10px;
    padding: 5px;
    border: 1px solid rgba(158,208,245,.26);
    flex: 0 0 auto;
}

.group-component-thumb-empty {
    display: grid;
    place-items: center;
    color: var(--romea-blue);
    font-weight: 900;
    font-size: 18px;
}


/* v20 - ChatMNR bootstrap */
.chatmnr-layout {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 22px;
    align-items: start;
}

.chatmnr-context {
    position: sticky;
    top: 18px;
}

.chatmnr-chat textarea {
    min-height: 150px;
    font-size: 16px;
}

.chat-answer {
    margin-top: 18px;
    background: rgba(7,20,33,.80);
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 14px;
    padding: 16px;
}

.chat-answer pre {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.45;
    color: var(--text);
}

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

@media (max-width: 900px) {
    .chatmnr-layout {
        grid-template-columns: 1fr;
    }

    .chatmnr-context {
        position: static;
    }
}


/* v21 - Document Intelligence */
.doc-index-status {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(158,208,245,.20);
}

.status-indexed {
    background: rgba(16,185,129,.18);
    color: #B9F8D8;
    border-color: rgba(16,185,129,.35);
}

.status-poor_text {
    background: rgba(245,158,11,.18);
    color: #FFE2A9;
    border-color: rgba(245,158,11,.35);
}

.status-error {
    background: rgba(239,68,68,.18);
    color: #FFCACA;
    border-color: rgba(239,68,68,.35);
}

.status-not_indexed {
    background: rgba(91,143,198,.18);
    color: #D9ECFF;
    border-color: rgba(91,143,198,.35);
}

.mini-button {
    padding: 6px 10px;
    font-size: 12px;
    margin-top: 8px;
}

.doc-index-list {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}


/* v21.2 - indicizzazione solo dentro ChatMNR */
.chat-doc-list {
    display: grid;
    gap: 10px;
}

.chat-doc-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border-radius: 12px;
    background: rgba(7,20,33,.68);
    border: 1px solid rgba(158,208,245,.16);
}

.chat-doc-main {
    display: grid;
    gap: 4px;
    text-decoration: none;
}

.chat-doc-main span {
    color: var(--muted);
}

.chat-doc-row .doc-index-status {
    margin-top: 0;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .chat-doc-row {
        grid-template-columns: 1fr;
    }

    .chat-doc-row .doc-index-status {
        width: fit-content;
    }
}


/* v21.3 - testata pulita con menu azioni */
.header-actions-clean {
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-action {
    font-weight: 900;
}

.actions-menu {
    position: relative;
}

.actions-menu summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(224,245,255,.95);
    color: #082033;
    font-weight: 900;
    border: 1px solid rgba(255,255,255,.45);
    box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.actions-menu summary::-webkit-details-marker {
    display: none;
}

.actions-menu summary::after {
    content: " ▾";
    font-weight: 900;
}

.actions-menu[open] summary::after {
    content: " ▴";
}

.actions-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 50;
    min-width: 230px;
    background: rgba(7,20,33,.98);
    border: 1px solid rgba(158,208,245,.28);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 22px 55px rgba(0,0,0,.42);
    display: grid;
    gap: 5px;
}

.actions-menu-panel a {
    display: block;
    padding: 11px 12px;
    border-radius: 11px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.actions-menu-panel a:hover {
    background: rgba(91,143,198,.26);
}

@media (max-width: 700px) {
    .header-actions-clean {
        align-items: stretch;
        width: 100%;
    }

    .header-actions-clean .button,
    .actions-menu summary {
        width: 100%;
        text-align: center;
    }

    .actions-menu-panel {
        right: auto;
        left: 0;
        width: 100%;
    }
}


/* v21.4 - ricerca documentale ChatMNR */
.chat-answer pre {
    max-height: 520px;
    overflow: auto;
}


/* v21.6 - PDF diagnostics */
.diag-pre {
    white-space: pre-wrap;
    overflow: auto;
    max-height: 360px;
    background: rgba(0,0,0,.22);
    border: 1px solid rgba(158,208,245,.16);
    border-radius: 12px;
    padding: 12px;
    color: var(--text);
}


/* v21.8 - gestione indici documentali */
.doc-actions-inline {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.doc-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.danger-soft {
    background: rgba(255, 221, 221, .95) !important;
    color: #6b1111 !important;
}

.chat-doc-row {
    grid-template-columns: 1fr auto auto;
}

@media (max-width: 900px) {
    .doc-actions-inline,
    .doc-row-actions {
        justify-content: flex-start;
    }
}


/* v22.1 - salute documentale / stato nave */
.health-box {
    margin-top: 14px;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(158,208,245,.18);
    background: rgba(7,20,33,.55);
}

.health-box h3 {
    margin-top: 0;
}

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

.health-grid div {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.07);
}

.health-grid span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.health-grid strong {
    font-size: 20px;
}

.health-good {
    border-color: rgba(16,185,129,.45);
}

.health-warn {
    border-color: rgba(245,158,11,.45);
}

.health-bad {
    border-color: rgba(239,68,68,.45);
}

/* v22.2 - bozze relazioni */
.report-list{margin-top:14px}.report-list h3{margin-bottom:8px}.success-card{border-color:rgba(16,185,129,.45);background:rgba(16,185,129,.12)}

.checkline{display:flex;align-items:center;gap:8px;margin:10px 0;font-weight:600}
.checkline input[type="checkbox"]{width:auto}
.inline-attachment-form{padding:12px;border-top:1px solid #e5e7eb;display:grid;gap:8px}
.badge{display:inline-block;margin-top:6px;padding:3px 8px;border-radius:999px;font-size:12px;font-weight:700}
.badge.success{background:#dcfce7;color:#166534}
.badge.muted{background:#f3f4f6;color:#4b5563}

.subcard{
    margin:18px 0;
    padding:16px;
    border:1px solid rgba(255,255,255,.12);
    border-radius:14px;
    background:rgba(255,255,255,.03);
}
.attachment-select-row{
    margin:12px 0;
    padding:12px;
    border:1px solid rgba(255,255,255,.10);
    border-radius:12px;
    background:rgba(0,0,0,.08);
}
.attachment-select-row input[type="text"],
.attachment-select-row input:not([type]){
    margin-top:8px;
}

/* v22.8 - workspace relazione assistita */
.report-workspace{
    display:grid;
    grid-template-columns:minmax(360px,1.05fr) minmax(320px,.75fr);
    gap:18px;
    align-items:start;
    margin:18px 0;
}
.report-doc-panel,.report-preview-panel,.report-editor-card{
    border:1px solid rgba(158,208,245,.16);
    border-radius:18px;
    background:rgba(8,24,38,.72);
    padding:16px;
    box-shadow:0 10px 30px rgba(0,0,0,.12);
}
.panel-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin-bottom:12px}
.panel-head h2{margin:0 0 4px;font-size:20px}
.report-doc-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:12px;max-height:620px;overflow:auto;padding-right:4px}
.report-doc-card{
    border:1px solid rgba(255,255,255,.11);
    border-radius:16px;
    background:rgba(255,255,255,.045);
    padding:10px;
    cursor:pointer;
    transition:.15s ease;
}
.report-doc-card:hover,.report-doc-card.active{border-color:rgba(158,208,245,.55);background:rgba(158,208,245,.10)}
.doc-preview-button{width:100%;border:0;background:transparent;padding:0;cursor:pointer;text-align:inherit}
.doc-thumb{height:112px;border-radius:12px;background:rgba(0,0,0,.22);border:1px solid rgba(255,255,255,.08);display:flex;align-items:center;justify-content:center;overflow:hidden;margin-bottom:10px}
.doc-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.doc-thumb span{font-size:28px;font-weight:800;letter-spacing:.08em;color:rgba(255,255,255,.72)}
.doc-card-body strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:3px}
.doc-card-body .muted{display:block;font-size:11px;line-height:1.35;min-height:30px}
.doc-card-checks{display:grid;gap:6px;margin-top:10px}
.mini-check{display:flex;align-items:center;gap:7px;font-size:12px;line-height:1.2;color:var(--text);font-weight:600;margin:0}
.mini-check input{width:auto;margin:0}
.caption-input{margin-top:10px;font-size:12px;padding:8px 10px}
.report-preview-panel{position:sticky;top:18px;min-height:520px}
.doc-preview-empty{min-height:470px;border:1px dashed rgba(255,255,255,.16);border-radius:14px;display:flex;align-items:center;justify-content:center;text-align:center;color:var(--muted);padding:18px;background:rgba(0,0,0,.10)}
.doc-preview-box h3{margin:0 0 10px;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.large-preview-frame{width:100%;height:520px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:white}
.large-preview-img{width:100%;max-height:520px;object-fit:contain;border-radius:12px;background:rgba(0,0,0,.18)}
.form-actions.sticky-actions{display:flex;gap:10px;justify-content:flex-end;margin:16px 0;position:sticky;bottom:0;padding:12px;background:linear-gradient(180deg,rgba(9,25,40,.60),rgba(9,25,40,.96));border-radius:16px;border:1px solid rgba(255,255,255,.08)}
.report-editor-card textarea{min-height:560px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;line-height:1.45}
@media (max-width:1100px){.report-workspace{grid-template-columns:1fr}.report-preview-panel{position:relative;top:auto}.report-doc-grid{max-height:none}}

/* V23 ChatMNR AI bootstrap */
.ai-status-box {
    margin: 0 0 14px 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid rgba(15, 23, 42, 0.12);
}
.ai-status-box.ai-on {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.ai-status-box.ai-off {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}
.selectable-doc {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
    align-items: start;
    cursor: pointer;
}
.selectable-doc .chat-doc-main,
.selectable-doc .doc-index-status,
.selectable-doc .doc-row-actions {
    grid-column: 2;
}
.doc-context-check {
    grid-row: 1 / span 3;
    margin-top: 6px;
    transform: scale(1.15);
}
.tiny-help {
    font-size: 12px;
    color: #64748b;
    margin-top: 10px;
}
.ai-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 15, 28, 0.78);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.ai-loading-box {
    background: #102235;
    border: 1px solid #2b4f6d;
    border-radius: 18px;
    padding: 28px;
    width: min(520px, 90vw);
    color: #eaf6ff;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.ai-spinner {
    width: 34px;
    height: 34px;
    border: 4px solid rgba(255,255,255,.18);
    border-top-color: #dff4ff;
    border-radius: 50%;
    animation: aiSpin .8s linear infinite;
    margin-bottom: 16px;
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

.ai-loading-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.ai-loading-step {
    color: #b8d7ec;
    font-size: 14px;
    line-height: 1.5;
}

button[disabled] {
    opacity: .55;
    cursor: wait;
}

.quality-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    margin-right: 8px;
}

.quality-badge.q-good { background: rgba(40, 210, 120, .16); color: #7dffb1; border: 1px solid rgba(40, 210, 120, .35); }
.quality-badge.q-ok { background: rgba(240, 210, 80, .16); color: #ffe58a; border: 1px solid rgba(240, 210, 80, .35); }
.quality-badge.q-mid { background: rgba(255, 150, 60, .16); color: #ffc18f; border: 1px solid rgba(255, 150, 60, .35); }
.quality-badge.q-bad { background: rgba(255, 90, 90, .16); color: #ffaaaa; border: 1px solid rgba(255, 90, 90, .35); }
.quality-badge.q-none { background: rgba(180, 210, 235, .10); color: #bdd8ea; border: 1px solid rgba(180, 210, 235, .20); }

.doc-index-status span {
    margin-right: 6px;
}


/* V24.1 - ChatMNR interfaccia assistente */
.chatgpt-layout {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
    min-height: calc(100vh - 155px);
}

.chatgpt-sidebar {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 110px);
    overflow: auto;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sidebar-head h2 {
    margin: 0 0 12px;
}

.ai-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(255,255,255,.08);
}

.ai-status-dot.is-on {
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34,197,94,.16), 0 0 22px rgba(34,197,94,.7);
}

.ai-status-dot.is-off {
    background: #f97316;
    box-shadow: 0 0 0 4px rgba(249,115,22,.16), 0 0 22px rgba(249,115,22,.55);
}

.context-title {
    border: 1px solid rgba(158,208,245,.18);
    background: rgba(7,20,33,.58);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 14px;
}

.context-title strong {
    display: block;
    font-size: 20px;
}

.context-title span {
    display: block;
    margin-top: 4px;
}

.context-title.compact strong {
    font-size: 17px;
}

.compact-doc-list {
    max-height: 470px;
    overflow: auto;
    padding-right: 4px;
}

.chatgpt-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: calc(100vh - 155px);
    padding: 0;
    overflow: hidden;
}

.chat-thread {
    overflow: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

.assistant-welcome {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: left;
    color: var(--muted);
}

.assistant-welcome h2 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 30px;
}

.assistant-welcome p {
    margin: 0;
    max-width: 580px;
    line-height: 1.5;
}

.assistant-avatar {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dff4ff, #8cccf6);
    color: #082033;
    font-weight: 950;
    box-shadow: 0 18px 45px rgba(0,0,0,.28);
}

.chat-bubble {
    max-width: 900px;
    margin: 0 0 18px;
    display: grid;
    gap: 6px;
}

.user-bubble {
    margin-left: auto;
    max-width: min(760px, 86%);
}

.assistant-bubble {
    margin-right: auto;
    max-width: min(920px, 92%);
}

.bubble-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.user-bubble .bubble-label {
    text-align: right;
}

.bubble-content {
    border-radius: 18px;
    padding: 15px 17px;
    line-height: 1.52;
    box-shadow: 0 12px 35px rgba(0,0,0,.16);
    word-break: break-word;
}

.user-bubble .bubble-content {
    background: linear-gradient(180deg, #ffffff, #dff0fb);
    color: #082033;
    border-top-right-radius: 6px;
}

.assistant-bubble .bubble-content {
    background: rgba(7,20,33,.82);
    border: 1px solid rgba(158,208,245,.18);
    color: var(--text);
    border-top-left-radius: 6px;
}

.error-bubble .bubble-content {
    border-color: rgba(239,68,68,.45);
    background: rgba(127,29,29,.30);
}

.markdown-lite strong {
    color: #ffffff;
}

.chat-composer {
    border-top: 1px solid rgba(158,208,245,.18);
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    background: rgba(7,20,33,.72);
}

.chat-composer textarea {
    min-height: 48px;
    max-height: 180px;
    resize: none;
    line-height: 1.42;
    font-size: 16px;
    border-radius: 16px;
    padding: 14px 15px;
}

.chat-composer .send-button {
    margin-top: 0;
    align-self: end;
    min-height: 48px;
    border-radius: 16px;
}

.thinking-title {
    font-weight: 900;
    margin-bottom: 10px;
}

.thinking-steps {
    display: grid;
    gap: 7px;
}

.thinking-step {
    color: var(--muted);
    position: relative;
    padding-left: 22px;
}

.thinking-step::before {
    content: "";
    position: absolute;
    left: 0;
    top: .45em;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(158,208,245,.28);
}

.thinking-step.active {
    color: #dff4ff;
    font-weight: 800;
}

.thinking-step.active::before {
    background: #9ed0f5;
    box-shadow: 0 0 18px rgba(158,208,245,.85);
}

@media (max-width: 1050px) {
    .chatgpt-layout {
        grid-template-columns: 1fr;
    }

    .chatgpt-sidebar {
        position: relative;
        top: auto;
        max-height: none;
    }

    .chatgpt-panel {
        min-height: 70vh;
    }
}

@media (max-width: 700px) {
    .chat-thread {
        padding: 16px;
    }

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

    .user-bubble,
    .assistant-bubble {
        max-width: 100%;
    }

    .assistant-welcome {
        align-items: flex-start;
        justify-content: flex-start;
        min-height: auto;
        padding-top: 20px;
    }
}

/* V24.1.2 - ChatMNR assistant polish */
.chatmnr-page {
    max-width: 1480px;
    height: 100vh;
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
}

.chatmnr-topbar {
    margin-bottom: 14px;
    flex: 0 0 auto;
}

.chatgpt-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}

.chatgpt-sidebar,
.chatgpt-panel {
    margin-bottom: 0;
    min-height: 0;
}

.chatgpt-sidebar {
    overflow: auto;
    padding: 18px;
}

.chatgpt-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    background: rgba(8, 22, 35, .76);
}

.chat-thread {
    flex: 1 1 auto;
    overflow: auto;
    padding: 24px 26px 18px;
    scroll-behavior: smooth;
}

.assistant-welcome {
    max-width: 760px;
    margin: 60px auto;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 22px;
    border: 1px solid rgba(158,208,245,.20);
    border-radius: 22px;
    background: rgba(255,255,255,.045);
}

.assistant-avatar {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #eaf8ff, #9ed0f5);
    color: #0B2340;
    font-weight: 950;
    flex: 0 0 auto;
}

.chat-bubble {
    max-width: 850px;
    margin: 0 0 18px;
    animation: chatBubbleIn .18s ease-out both;
}

@keyframes chatBubbleIn {
    from { transform: translateY(6px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.user-bubble {
    margin-left: auto;
    max-width: 720px;
}

.assistant-bubble {
    margin-right: auto;
}

.bubble-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.user-bubble .bubble-meta {
    justify-content: flex-end;
}

.bubble-label {
    color: #BFD2E1;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.bubble-action {
    border: 1px solid rgba(158,208,245,.22);
    background: rgba(255,255,255,.06);
    color: #DCEAF6;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.bubble-action:hover {
    background: rgba(158,208,245,.14);
}

.bubble-content {
    border-radius: 20px;
    padding: 16px 18px;
    line-height: 1.5;
    box-shadow: 0 14px 36px rgba(0,0,0,.18);
}

.user-bubble .bubble-content {
    background: linear-gradient(180deg, #eaf8ff, #cfefff);
    color: #0B2340;
    border-top-right-radius: 6px;
}

.assistant-bubble .bubble-content {
    background: rgba(7,20,33,.86);
    border: 1px solid rgba(158,208,245,.16);
    color: var(--text);
    border-top-left-radius: 6px;
}

.error-bubble .bubble-content {
    border-color: rgba(239,68,68,.35);
    background: rgba(80, 18, 22, .72);
}

.markdown-lite h2,
.markdown-lite h3,
.markdown-lite h4 {
    margin: 14px 0 8px;
    line-height: 1.2;
}

.markdown-lite h2:first-child,
.markdown-lite h3:first-child,
.markdown-lite h4:first-child {
    margin-top: 0;
}

.markdown-lite p {
    margin: 0 0 9px;
}

.markdown-lite ul,
.markdown-lite ol {
    margin: 6px 0 12px 22px;
    padding: 0;
}

.markdown-lite li {
    margin: 4px 0;
}

.markdown-lite code {
    padding: 2px 5px;
    border-radius: 6px;
    background: rgba(255,255,255,.09);
    color: #dff4ff;
}

.source-line {
    margin-top: 10px !important;
    padding: 8px 10px;
    border-left: 3px solid rgba(158,208,245,.55);
    background: rgba(158,208,245,.08);
    border-radius: 10px;
    color: #cfe7f7;
    font-size: 13px;
}

.thinking-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.thinking-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #9ED0F5;
    box-shadow: 0 0 0 0 rgba(158,208,245,.6);
    animation: thinkingPulse 1.2s infinite;
}

@keyframes thinkingPulse {
    0% { box-shadow: 0 0 0 0 rgba(158,208,245,.65); }
    70% { box-shadow: 0 0 0 10px rgba(158,208,245,0); }
    100% { box-shadow: 0 0 0 0 rgba(158,208,245,0); }
}

.thinking-steps {
    display: grid;
    gap: 7px;
}

.thinking-step {
    color: var(--muted);
    font-size: 14px;
    padding-left: 22px;
    position: relative;
}

.thinking-step::before {
    content: "○";
    position: absolute;
    left: 0;
    color: rgba(158,208,245,.55);
}

.thinking-step.done::before {
    content: "✓";
    color: #86efac;
}

.thinking-step.active {
    color: #fff;
    font-weight: 800;
}

.thinking-step.active::before {
    content: "●";
    color: #9ED0F5;
}

.chat-composer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
    padding: 16px;
    border-top: 1px solid rgba(158,208,245,.14);
    background: linear-gradient(180deg, rgba(8,22,35,.88), rgba(8,22,35,.98));
}

.chat-composer textarea {
    min-height: 48px;
    max-height: 180px;
    resize: none;
    border-radius: 18px;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.35;
    background: rgba(7,20,33,.94);
}

.send-button {
    margin-top: 0;
    min-height: 48px;
    border-radius: 18px;
}

.compact-doc-list {
    max-height: 42vh;
    overflow: auto;
    padding-right: 3px;
}

.compact-doc-list .chat-doc-row {
    padding: 9px;
}

.compact-doc-list .chat-doc-main strong {
    font-size: 13px;
}

.compact-doc-list .chat-doc-main span,
.compact-doc-list .doc-index-status {
    font-size: 11px;
}

@media (max-width: 1000px) {
    .chatmnr-page {
        height: auto;
        min-height: 100vh;
    }
    .chatgpt-layout {
        grid-template-columns: 1fr;
    }
    .chatgpt-sidebar {
        max-height: none;
    }
    .chat-thread {
        min-height: 58vh;
    }
}

/* V24.9 - UI Relazione Cliente */
.report-ai-page {
    max-width: 1560px;
}

.report-ai-header {
    margin-bottom: 18px;
}

.report-kicker {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 5px;
}

.report-hero {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(520px, 1.1fr);
    gap: 22px;
    align-items: stretch;
    background:
        radial-gradient(circle at 10% 10%, rgba(158,208,245,.18), transparent 35%),
        rgba(15,36,53,.92);
}

.report-hero-main h2 {
    margin: 8px 0 4px;
    font-size: 38px;
    letter-spacing: -.03em;
}

.report-hero-main p {
    color: var(--muted);
    margin: 0;
    font-size: 16px;
}

.report-pill {
    display: inline-block;
    width: fit-content;
    margin: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(158,208,245,.14);
    border: 1px solid rgba(158,208,245,.26);
    color: #dff4ff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.report-pill.success {
    background: rgba(34,197,94,.15);
    color: #bbf7d0;
    border-color: rgba(34,197,94,.35);
}

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

.report-hero-grid div {
    border-radius: 16px;
    background: rgba(7,20,33,.68);
    border: 1px solid rgba(158,208,245,.16);
    padding: 14px;
}

.report-hero-grid span {
    margin: 0 0 7px;
    font-size: 12px;
}

.report-hero-grid strong {
    display: block;
    font-size: 20px;
}

.report-settings-card {
    margin-bottom: 18px;
}

.report-settings-card h2 {
    margin: 0 0 4px;
}

.report-settings-card p {
    margin: 0;
}

.report-settings-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr .8fr .8fr;
    gap: 14px;
    margin-top: 16px;
}

.report-settings-grid label span {
    display: block;
    margin-bottom: 6px;
}

.report-workspace-v249 {
    grid-template-columns: minmax(470px, .92fr) minmax(420px, .78fr);
    margin-top: 18px;
}

.report-doc-panel-v249,
.report-preview-panel-v249 {
    min-height: 660px;
}

.report-doc-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(158,208,245,.14);
}

.report-doc-grid-v249 {
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    max-height: 610px;
}

.report-doc-card-v249 {
    position: relative;
    overflow: hidden;
}

.report-doc-card-v249.active {
    border-color: rgba(34,197,94,.55);
    background: rgba(34,197,94,.08);
    box-shadow: inset 4px 0 0 rgba(34,197,94,.8);
}

.report-doc-card-v249.previewing {
    outline: 2px solid rgba(158,208,245,.75);
    outline-offset: -2px;
}

.report-doc-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 7px;
}

.doc-type-badge,
.doc-index-mini {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0;
}

.doc-type-badge {
    background: rgba(158,208,245,.14);
    color: #dff4ff;
    border: 1px solid rgba(158,208,245,.22);
}

.doc-index-mini {
    background: rgba(255,255,255,.07);
    color: rgba(220,234,246,.78);
    border: 1px solid rgba(255,255,255,.10);
}

.context-check-row,
.client-check-row {
    padding: 7px 8px;
    border-radius: 10px;
    background: rgba(7,20,33,.36);
}

.context-check-row:has(input:checked) {
    background: rgba(34,197,94,.12);
    color: #bbf7d0;
}

.client-check-row:has(input:checked) {
    background: rgba(158,208,245,.12);
    color: #dff4ff;
}

.report-preview-panel-v249 {
    position: sticky;
    top: 18px;
}

.report-preview-panel-v249 .large-preview-frame {
    height: 610px;
}

.report-preview-empty-v249 {
    min-height: 610px;
}

.report-actions-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 18px 0;
    padding: 14px 16px;
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(9,25,40,.82), rgba(9,25,40,.98));
    box-shadow: 0 -8px 32px rgba(0,0,0,.28);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.report-actions-bar strong {
    display: block;
    margin-bottom: 3px;
}

.report-actions-bar span {
    margin: 0;
}

.report-alert {
    border: 1px solid rgba(239,68,68,.35);
    background: rgba(127,29,29,.28);
    border-radius: 14px;
    padding: 14px;
    margin: 14px 0;
}

.report-editor-card-v249 {
    padding: 20px;
}

.report-editor-card-v249 textarea {
    min-height: 640px;
    margin-top: 14px;
    font-size: 14px;
    background: rgba(3,12,22,.92);
    border-radius: 16px;
}

@media (max-width: 1200px) {
    .report-hero,
    .report-settings-grid,
    .report-workspace-v249 {
        grid-template-columns: 1fr;
    }
    .report-preview-panel-v249 {
        position: relative;
        top: auto;
    }
    .report-hero-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .report-actions-bar {
        position: relative;
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 700px) {
    .report-hero-grid {
        grid-template-columns: 1fr;
    }
    .report-doc-grid-v249 {
        grid-template-columns: 1fr;
    }
}

/* V26.2 - Box intervento + indicizzazione automatica */
.intervention-box {
    border-color: rgba(158,208,245,.35);
    box-shadow: 0 18px 46px rgba(0,0,0,.22);
}
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}
.button.secondary {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.18);
}
.muted-small {
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
}
.index-pill {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
}
.index-pill.ok { color: #9FF0C4; }
.index-pill.queue { color: #FFE08A; }
.index-pill.warn { color: #FFD1A1; }
.index-pill.error { color: #FFB3B3; }
.index-pill.idle { color: var(--muted); }

/* V26.3 - gruppi interventi */
.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}


/* V26.3.1 - gruppi interventi semplificati */
.group-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.group-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(7,20,33,.80);
    border: 1px solid rgba(158,208,245,.20);
    text-decoration: none;
}
.group-chip:hover { background: rgba(91,143,198,.16); }
.group-chip-icon { font-size: 22px; }
.group-chip strong { display: block; color: var(--text); }
.group-chip small { display: block; color: var(--muted); margin-top: 2px; }
.empty-visual {
    width: fit-content;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px dashed rgba(158,208,245,.24);
    color: var(--muted);
    background: rgba(255,255,255,.04);
}
.group-link-panel {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(158,208,245,.12);
}
.inline-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-form select { min-width: 300px; flex: 1; }
.compact-section-title { margin-bottom: 0; }


/* V26.3.3 - collegamenti box visuali, niente gruppi visibili */
.linked-boxes-panel {
    border-color: rgba(34,197,94,.32);
}
.linked-box-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.linked-box-card {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 8px;
    border-radius: 15px;
    border: 1px solid rgba(158,208,245,.22);
    background: rgba(7,20,33,.82);
    overflow: hidden;
}
.linked-box-card::before {
    content: "";
    width: 5px;
    background: rgba(34,197,94,.85);
    flex: 0 0 5px;
}
.linked-box-main {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 12px 4px;
    min-width: 0;
    flex: 1;
}
.linked-box-icon {
    font-size: 22px;
    margin: 0;
    color: inherit;
    flex: 0 0 auto;
}
.linked-box-main strong {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.linked-box-main small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.25;
}
.linked-box-remove {
    display: flex;
    align-items: center;
    padding-right: 9px;
}
.linked-box-remove button {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #dceaf6;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}
.linked-box-remove button:hover {
    background: rgba(239,68,68,.22);
    border-color: rgba(239,68,68,.42);
}
.link-box-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(158,208,245,.12);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.link-box-form .button { margin-top: 0; }
@media (max-width: 700px) {
    .link-box-form { grid-template-columns: 1fr; }
}


/* V26.3.4 - navigazione pulita */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.nav-actions .button,
.nav-actions a {
    margin-top: 0;
}
.button.secondary,
a.secondary {
    background: rgba(255,255,255,.08);
    color: #dceaf6;
    border: 1px solid rgba(158,208,245,.25);
    box-shadow: none;
}
.button.ghost,
a.ghost {
    display: inline-block;
    color: #dceaf6;
    border: 1px solid rgba(158,208,245,.18);
    border-radius: 8px;
    padding: 10px 13px;
    background: rgba(7,20,33,.45);
    font-weight: 700;
}
.breadcrumb-line {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}
.breadcrumb-line a {
    color: #dceaf6;
    font-weight: 800;
}
.breadcrumb-line span {
    display: inline;
    margin: 0;
}
@media (max-width: 700px) {
    .nav-actions { justify-content: flex-start; width: 100%; }
    .nav-actions .button, .nav-actions a { width: auto; }
}

/* V26.4 - Navigation v2 unificata */
.mnr-shell-header {
    margin-bottom: 22px;
    display: grid;
    gap: 14px;
    position: relative;
    z-index: 5;
}
.mnr-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
    font-weight: 800;
    color: var(--muted);
}
.mnr-breadcrumb a {
    color: var(--accent);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(143,212,242,.08);
    border: 1px solid rgba(143,212,242,.18);
}
.mnr-breadcrumb a:hover { background: rgba(143,212,242,.16); }
.mnr-breadcrumb .sep {
    color: var(--muted);
    display: inline;
    margin: 0;
}
.mnr-breadcrumb .current {
    display: inline;
    margin: 0;
    color: var(--text);
    padding: 6px 0;
}
/* Barra di sessione (utente + logout, e per gli admin "+ Nuovo utente"),
   correzione di consolidamento Step 10 punto 4, 06/08/2026. Nel breadcrumb
   "Navigation v2" (.mnr-breadcrumb, flex) e nell'header di index.php
   (.brand-header, flex) basta margin-left:auto per spingerla a destra senza
   toccare gli altri figli. Fuori da questi due casi (pagine con header
   .topbar o senza header dedicato) e' invece una barra a se' stante in cima
   alla pagina, allineata a destra. */
.mnr-breadcrumb .mnr-session-bar,
.brand-header .mnr-session-bar {
    margin-left: auto;
    font-weight: 600;
}
.mnr-session-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    padding: 6px 4px;
}
.mnr-session-bar strong { color: var(--text); }
.mnr-session-bar .mnr-session-action {
    color: var(--accent);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(143,212,242,.08);
    border: 1px solid rgba(143,212,242,.18);
    white-space: nowrap;
}
.mnr-session-bar .mnr-session-action:hover { background: rgba(143,212,242,.16); }
/* Menu a tendina "Admin" nella barra di sessione (06/08/2026): riusa la
   struttura .actions-menu/.actions-menu-panel gia' esistente (stesso
   posizionamento/z-index collaudati), ma la levetta (summary) prende lo
   stile discreto .mnr-session-action invece del chip bianco predefinito, per
   restare coerente con gli altri elementi della barra. */
.mnr-session-bar .mnr-session-menu { position: relative; }
.mnr-session-bar .actions-menu summary.mnr-session-action {
    background: rgba(143,212,242,.08);
    color: var(--accent);
    border: 1px solid rgba(143,212,242,.18);
    box-shadow: none;
    font-weight: 600;
}
.mnr-session-bar .actions-menu summary.mnr-session-action:hover { background: rgba(143,212,242,.16); }
.mnr-titlebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    padding: 18px;
    border: 1px solid rgba(143,212,242,.18);
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(13,36,54,.96), rgba(8,27,43,.94));
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}
.mnr-titlebar.compact { padding: 14px 16px; }
.mnr-title-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.mnr-title-photo {
    width: 112px;
    height: 74px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid rgba(143,212,242,.32);
    box-shadow: var(--shadow-sm);
    flex: 0 0 auto;
    background: var(--panel-2);
}
.mnr-title-photo.contain { object-fit: contain; padding: 7px; }
.mnr-title-placeholder {
    width: 112px;
    height: 74px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, rgba(143,212,242,.18), rgba(21,90,147,.28));
    border: 1px solid rgba(143,212,242,.30);
    color: var(--accent);
    font-weight: 950;
    letter-spacing: .14em;
}
.mnr-title-copy { min-width: 0; }
.mnr-title-line {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.mnr-title-line h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.05;
    color: var(--text);
}
.mnr-subtitle {
    margin: 7px 0 0;
    color: var(--muted);
}
.mnr-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 9px;
}
.mnr-chip,
.inactive-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    color: #1E4E8C;
    background: #EAF6FF;
    border: 1px solid #C9E2F5;
    margin: 0;
}
.inactive-pill { color: #607385; background: #F4F8FB; border-color: #D8E6F2; }
.mnr-title-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.mnr-title-actions .button,
.mnr-title-actions a.button { margin-top: 0; }
.mnr-actions-menu summary {
    width: 44px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0 !important;
    font-size: 22px;
    line-height: 1;
}
.mnr-actions-menu summary::after { content: "" !important; }
@media (max-width: 900px) {
    .mnr-titlebar { grid-template-columns: 1fr; align-items: start; }
    .mnr-title-actions { justify-content: flex-start; }
}
@media (max-width: 650px) {
    .mnr-title-main { align-items: flex-start; flex-direction: column; }
    .mnr-title-photo, .mnr-title-placeholder { width: 100%; max-width: 260px; height: 120px; }
    .mnr-title-line h1 { font-size: 28px; }
}

/* V30.4 - Document Management System: i file si gestiscono, non si scaricano */
.dms-actions {
    margin-top: 10px;
    gap: 7px;
}
.dms-actions.compact {
    justify-content: flex-start;
}
.dms-actions form,
.doc-row-actions form,
.pdf-actions form {
    display: inline-block;
    margin: 0;
}
.dms-actions .button,
.doc-row-actions .button,
.pdf-actions .button {
    margin-top: 0;
}
.doc-delete-form button {
    white-space: nowrap;
}
/* .danger-soft gia' definita sopra (v21.8) — duplicato rimosso in Step 11 Fase 1 */

/* V31.1 - Librerie tecniche e browser documentale lazy */
.document-category-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin-top:16px}
.document-category-card{appearance:none;border:1px solid rgba(148,163,184,.35);background:linear-gradient(155deg,#eef3f8,#dde8f0);border-radius:12px;padding:16px;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer;color:inherit;box-shadow:0 6px 20px rgba(15,23,42,.05)}
.document-category-card:hover,.document-category-card.is-active{border-color:#0891b2;box-shadow:0 8px 24px rgba(8,145,178,.14);transform:translateY(-1px)}
.document-category-card>span:nth-child(2){display:flex;flex-direction:column;gap:3px;min-width:0;flex:1}.document-category-card small{color:#64748b}.document-category-icon{font-size:25px}.document-category-arrow{font-size:24px;color:#94a3b8}
.document-browser-results{margin-top:20px;padding-top:18px;border-top:1px solid rgba(148,163,184,.25)}
.document-browser-toolbar,.document-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.document-browser-search{display:flex;gap:8px;flex:1;max-width:620px}.document-browser-search input{margin:0}
.compact-preview{height:120px}.compact-preview .doc-placeholder{height:100%;display:flex;align-items:center;justify-content:center;background:#eef2f7}.lazy-doc-grid .doc-card iframe{display:none}.document-origin{font-size:12px;color:#0e7490;font-weight:700}
.linked-assets-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px;margin:14px 0}.linked-asset-card{display:flex;flex-direction:column;gap:4px;border:1px solid rgba(8,145,178,.3);background:rgba(8,145,178,.07);padding:13px 15px;border-radius:12px;text-decoration:none;color:inherit}.linked-asset-card>span{font-size:10px;letter-spacing:.08em;color:#0e7490;font-weight:800}.linked-asset-card small{color:#64748b}
@media(max-width:700px){.document-browser-toolbar,.document-pagination{align-items:stretch;flex-direction:column}.document-browser-search{max-width:none}.document-category-grid{grid-template-columns:1fr}}

/* Correzioni di consolidamento (Step 11, 06/08/2026) — stato "In Errore" della
   scheda cartella, prima definito solo (in chiaro, con !important) dentro
   component.php e technical_asset.php; qui coerente con la palette --danger
   gia' usata nel resto del tema scuro. */
.document-category-card.has-errors{border-color:rgba(223,90,90,.45);background:linear-gradient(155deg,#fdeeee,#fbdede)}
.document-category-card.has-errors:hover,.document-category-card.has-errors.is-active{border-color:#c94d4d;background:linear-gradient(155deg,#fbdcdc,#f6c6c6)}

/* Correzioni di consolidamento (Step 11, 06/08/2026) — visualizzazione "a
   dettagli" (stile Windows) di una cartella documentale espansa: prima definita
   solo dentro il blocco <style> incorporato di component.php, nel vecchio tema
   chiaro pre-Fase 1 (sfondo bianco fisso, nessun colore esplicito sul testo
   delle celle) — da qui la scarsa leggibilita' segnalata da Claudio: il testo
   semplice delle celle ereditava il quasi-bianco del tema scuro globale
   (var(--text)) su sfondo bianco, e le pillole di stato usavano i pastelli
   pensati per sfondo scuro. Ora e' un componente di prima classe del design
   system, condiviso da component.php e document_browser.php (quindi anche da
   technical_asset.php), con colori propri pensati per il suo sfondo chiaro. */
.folder-toolbar-actions{display:flex;align-items:center;gap:10px;margin-left:auto}
.folder-toolbar-actions form{margin:0}
.windows-details-wrap{overflow:auto;border:1px solid rgba(148,163,184,.35);border-radius:12px;background:linear-gradient(155deg,#eef3f8,#dde8f0);box-shadow:0 6px 20px rgba(15,23,42,.05)}
.windows-details-table{width:100%;border-collapse:collapse;font-size:12px}
.windows-details-table th{position:sticky;top:0;background:#eef3f8;color:#33495a;font-weight:700;text-align:left;padding:8px 10px;border-bottom:1px solid rgba(148,163,184,.4);white-space:nowrap}
.windows-details-table td{padding:7px 10px;border-bottom:1px solid rgba(148,163,184,.22);vertical-align:middle;color:#1c2b3a}
.windows-details-table tbody tr:hover{background:rgba(8,145,178,.08)}
.details-name{min-width:330px}
.details-name a{display:flex;align-items:center;gap:9px;color:#152b40;text-decoration:none}
.details-name a strong{color:inherit}
.details-file-icon{display:inline-flex;align-items:center;justify-content:center;width:36px;height:24px;border:1px solid rgba(148,163,184,.45);border-radius:4px;background:rgba(255,255,255,.55);font-size:9px;font-weight:700;color:#33495a;flex:0 0 auto}
.details-actions{min-width:360px}
.details-actions .dms-actions{display:flex;flex-wrap:nowrap;gap:4px}
.details-actions .mini-button{padding:4px 7px!important;font-size:10px!important;white-space:nowrap}
.details-actions form{margin:0}
.windows-details-wrap .index-pill{background:rgba(15,23,42,.06);border-color:rgba(15,23,42,.12)}
.windows-details-wrap .index-pill.ok{color:#1a7a4c}
.windows-details-wrap .index-pill.queue{color:#a3690b}
.windows-details-wrap .index-pill.warn{color:#b25400}
.windows-details-wrap .index-pill.error{color:#b3261e}
.windows-details-wrap .index-pill.idle{color:#5b6b78}
@media(max-width:900px){.details-actions{min-width:300px}.windows-details-table th:nth-child(4),.windows-details-table td:nth-child(4){display:none}}

/* ========================================================================== 
   ROMEA TECH ARCHIVE — Visual refinement / RC polish (04-08-2026)
   Solo presentazione: nessuna modifica a struttura, flussi o dimensioni logiche.
   ========================================================================== */

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: .002em;
    background:
        linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
        radial-gradient(circle at 14% -8%, rgba(78,163,216,.24), transparent 34%),
        radial-gradient(circle at 92% 8%, rgba(21,90,147,.20), transparent 30%),
        linear-gradient(145deg, #06111c 0%, #092238 52%, #071725 100%);
    background-size: 38px 38px, 38px 38px, auto, auto, auto;
}

::selection {
    background: rgba(99,199,232,.30);
    color: #fff;
}

.brand-header {
    min-height: 82px;
    padding: 15px 32px;
    gap: 17px;
    background:
        linear-gradient(90deg, rgba(8,27,45,.98), rgba(13,55,84,.97)),
        linear-gradient(180deg, rgba(255,255,255,.05), transparent);
    border-bottom: 1px solid rgba(143,212,242,.23);
    box-shadow: 0 14px 42px rgba(1,10,19,.32);
    position: relative;
    /* overflow:hidden rimosso (06/08/2026): tagliava il menu a tendina "Admin"
       della barra di sessione, che deve poter uscire dai bordi dell'header per
       aprirsi sopra il contenuto sottostante (es. .hero-panel). L'unico
       elemento che questa regola doveva contenere e' ::after qui sotto, che e'
       gia' vincolato ai bordi dell'header (inset: auto 0 0, alto 1px) e non ne
       esce mai - overflow:visible non cambia il suo aspetto. */
    overflow: visible;
}

.brand-header::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99,199,232,.75), transparent);
}

.brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    background: linear-gradient(145deg, #f8fcff, #d8edf8);
    color: #0b3b61;
    border: 1px solid rgba(255,255,255,.75);
    box-shadow: 0 10px 28px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.95);
}

.brand-header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: .095em;
    line-height: 1.05;
}

.brand-header p {
    margin-top: 6px;
    color: #a9cee4;
    letter-spacing: .16em;
    font-size: 10px;
    font-weight: 700;
}

.page {
    max-width: 1380px;
    padding: 30px 30px 48px;
}

header h1,
.hero-panel h2,
.section-title h2,
.card h2,
.card h3 {
    text-wrap: balance;
}

header h1 {
    font-weight: 760;
    letter-spacing: -.035em;
}

.hero-panel {
    border-radius: 20px;
    padding: 30px 32px;
    background:
        linear-gradient(112deg, rgba(21,90,147,.94), rgba(8,27,45,.97)),
        radial-gradient(circle at 85% 20%, rgba(99,199,232,.24), transparent 38%);
    border: 1px solid rgba(143,212,242,.30);
    box-shadow: 0 24px 70px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.08);
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -90px;
    top: -150px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 50%;
    box-shadow: 0 0 0 34px rgba(255,255,255,.025), 0 0 0 70px rgba(255,255,255,.018);
    pointer-events: none;
}

.hero-panel > * {
    position: relative;
    z-index: 1;
}

.hero-panel h2 {
    font-size: clamp(28px, 3vw, 38px);
    font-weight: 760;
    letter-spacing: -.035em;
}

.hero-panel p {
    color: #c8deec;
    font-size: 15px;
}

.stats-grid {
    gap: 14px;
}

.stat-card {
    border-radius: 13px;
    padding: 20px 21px;
    background: linear-gradient(155deg, #eef3f8 0%, #dde8f0 100%);
    border: 1px solid rgba(180,205,222,.9);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--romea-cyan), var(--romea-blue));
}

.stat-card span {
    color: #5b7184;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .11em;
}

.stat-card strong {
    font-size: 32px;
    font-weight: 780;
    letter-spacing: -.035em;
    color: #104f80;
}

.card {
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(13,36,54,.96), rgba(8,27,43,.94));
    border: 1px solid rgba(143,212,242,.18);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.035);
    backdrop-filter: blur(10px);
}

.section-title h2,
.card h2 {
    letter-spacing: -.025em;
}

.button {
    min-height: 40px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.30);
    background: linear-gradient(180deg, #f5faff 0%, #d8ecf7 100%);
    color: #0a3555;
    font-weight: 700;
    letter-spacing: .005em;
    box-shadow: 0 3px 10px rgba(0,0,0,.14), inset 0 1px 0 #fff;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0,0,0,.18), inset 0 1px 0 #fff;
    filter: saturate(1.04);
}

.button:active {
    transform: translateY(0);
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

input, textarea, select {
    min-height: 43px;
    border-radius: 10px;
    background: rgba(3,16,27,.74);
    border: 1px solid rgba(143,212,242,.23);
    padding: 11px 13px;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

input:hover, textarea:hover, select:hover {
    border-color: rgba(143,212,242,.38);
}

input:focus, textarea:focus, select:focus {
    background: rgba(3,16,27,.90);
    border-color: rgba(99,199,232,.72);
}

label {
    font-weight: 650;
}

table {
    border-spacing: 0;
}

th {
    color: #b8cfdd;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

th, td {
    padding: 12px 11px;
}

tbody tr {
    transition: background .14s ease;
}

.vessel-card {
    border-radius: 11px;
    background: linear-gradient(155deg, #eef3f8 0%, #dde8f0 100%);
    border: 1px solid #c2d5e2;
    box-shadow: 0 8px 20px rgba(1,14,25,.18);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.vessel-card:hover {
    transform: translateY(-2px);
    border-color: #8fc8e8;
    box-shadow: 0 14px 30px rgba(1,14,25,.24);
}

.vessel-card h3 {
    font-size: 18px;
    font-weight: 780;
    color: #0a2940;
}

.vessel-card-top h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-wrap: nowrap;
}

.vessel-card-top span,
.imo-badge,
.badge,
.counter {
    box-shadow: inset 0 0 0 1px rgba(21,90,147,.08);
}

.vessel-row,
.doc-card,
.special-fields,
.grid div,
.mini-grid div {
    border-color: rgba(143,212,242,.18);
    background: rgba(3,16,27,.62);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.doc-card,
.vessel-row {
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.doc-card:hover,
.vessel-row:hover {
    border-color: rgba(143,212,242,.34);
}

.badge, .counter, .imo-badge {
    font-weight: 760;
}

.active-vessels-panel {
    border-color: rgba(39,181,111,.42) !important;
    background: linear-gradient(145deg, rgba(39,181,111,.12), rgba(8,27,43,.96)) !important;
    box-shadow: 0 18px 48px rgba(2,12,22,.24), inset 0 1px 0 rgba(255,255,255,.04) !important;
}

.active-vessel-card {
    border: 1px solid rgba(39,181,111,.62) !important;
    box-shadow: 0 14px 38px rgba(1,14,25,.24), 0 0 0 3px rgba(39,181,111,.07) !important;
}

.active-pill,
.active-toggle-button.is-active {
    color: #0d6d42 !important;
}

/* Le sezioni chiare inline della Home vengono armonizzate senza toccare il markup. */
.card[style*="background:rgba(255,255,255,.96)"] {
    background: linear-gradient(155deg, #eef3f8, #dde8f0) !important;
    border-color: #c2d5e2 !important;
    box-shadow: var(--shadow-sm) !important;
}

.card[style*="rgba(8,145,178,.12)"] {
    background: linear-gradient(135deg, rgba(14,116,144,.14), rgba(234,242,247,.96)) !important;
    border-color: rgba(14,116,144,.32) !important;
    box-shadow: var(--shadow-sm) !important;
}

@media (max-width: 700px) {
    .brand-header {
        padding: 14px 18px;
    }

    .brand-header h1 {
        font-size: 19px;
        letter-spacing: .07em;
    }

    .brand-mark {
        width: 44px;
        height: 44px;
        font-size: 26px;
    }

    .hero-panel {
        padding: 23px 20px;
    }
}

/* ============================================================
   Portale Tecnico MNR (Roadmap Fase 2, punto 1, sotto-step 2 -
   home tecnico, 26/08/2026). Namespace dedicato .tecnico-*, non
   riusa .vessel-card/.vessel-grid di proposito: superficie
   separata e mobile-first, per scelta esplicita di Claudio del
   06/08/2026 ("non e' Tech Archive rimpicciolito"). Riusa solo i
   design token gia' esistenti sopra (--romea-navy, --romea-blue,
   --shadow-sm/md, --muted, --accent) per restare coerente con lo
   "Stile 1.0" (Step 11), senza introdurre una seconda palette.
   ============================================================ */
.tecnico-shell {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 40px;
}

.tecnico-header {
    background: linear-gradient(90deg, var(--romea-navy), var(--romea-blue));
    padding: 22px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
}

.tecnico-header h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: .05em;
}

.tecnico-header p {
    margin: 4px 0 0;
    color: #DCEAF6;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 11px;
}

.tecnico-empty {
    margin: 40px 20px;
    text-align: center;
    color: var(--muted);
}

.tecnico-vessel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px 16px 0;
}

.tecnico-vessel-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(155deg, #eef3f8 0%, #dde8f0 100%);
    border: 1px solid #c2d5e2;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease;
}

.tecnico-vessel-card:active {
    transform: scale(.98);
    box-shadow: 0 4px 12px rgba(1,14,25,.18);
}

.tecnico-vessel-photo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--romea-blue), var(--romea-navy));
}

.tecnico-vessel-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tecnico-vessel-photo-empty {
    display: grid;
    place-items: center;
    font-size: 24px;
}

.tecnico-vessel-info {
    flex: 1 1 auto;
    min-width: 0;
}

.tecnico-vessel-name {
    font-size: 18px;
    font-weight: 780;
    color: #0a2940;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tecnico-vessel-class {
    font-size: 13px;
    color: #3b5a72;
    margin-top: 2px;
}

.tecnico-vessel-arrow {
    flex: 0 0 auto;
    font-size: 24px;
    color: #7a94a6;
}

@media (min-width: 720px) {
    .tecnico-shell {
        max-width: 720px;
    }
}

/* ------------------------------------------------------------
   tecnico_vessel.php (sotto-step 3 - contesto nave -> apparati,
   26/08/2026). Riusa lo stesso namespace .tecnico-* sopra.
   ------------------------------------------------------------ */
.tecnico-header .tecnico-back {
    display: block;
    color: #DCEAF6;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    opacity: .85;
    margin-bottom: 4px;
}

.tecnico-header .tecnico-back:hover {
    opacity: 1;
}

.tecnico-vessel-summary {
    margin: 16px 16px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tecnico-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.tecnico-pill-active {
    background: rgba(34, 197, 94, .16);
    border: 1px solid rgba(34, 197, 94, .45);
    color: #15803d;
}

.tecnico-pill-customer,
.tecnico-pill-imo {
    background: rgba(143, 212, 242, .10);
    border: 1px solid rgba(143, 212, 242, .25);
    color: var(--accent);
}

.tecnico-section-label {
    margin: 22px 16px 10px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.tecnico-component-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px;
}

.tecnico-component-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(155deg, #eef3f8 0%, #dde8f0 100%);
    border: 1px solid #c2d5e2;
    box-shadow: var(--shadow-sm);
}

.tecnico-component-photo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    overflow: hidden;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--romea-blue), var(--romea-navy));
    display: grid;
    place-items: center;
    font-size: 18px;
}

.tecnico-component-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tecnico-component-info {
    flex: 1 1 auto;
    min-width: 0;
}

.tecnico-component-name {
    font-size: 15px;
    font-weight: 780;
    color: #0a2940;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tecnico-component-meta {
    font-size: 12px;
    color: #3b5a72;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   tecnico_component.php (sotto-step 4, avvio - scheda apparato +
   apertura ChatMNR, 27/08/2026). Riusa lo stesso namespace
   .tecnico-* sopra. Le schede apparato di tecnico_vessel.php sono
   ora un tag <a> (prima <div>, deliberatamente non cliccabile):
   qui solo le proprieta' che un <div> non aveva bisogno di avere.
   ------------------------------------------------------------ */
.tecnico-component-card {
    text-decoration: none;
    color: inherit;
    transition: transform .12s ease, box-shadow .12s ease;
}

.tecnico-component-card:active {
    transform: scale(.98);
    box-shadow: 0 4px 12px rgba(1,14,25,.18);
}

.tecnico-component-arrow {
    flex: 0 0 auto;
    font-size: 22px;
    color: #7a94a6;
}

.tecnico-detail-photo {
    margin: 16px 16px 0;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--romea-blue), var(--romea-navy));
    box-shadow: var(--shadow-sm);
}

.tecnico-detail-photo img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
}

.tecnico-detail-card {
    margin: 16px;
    padding: 16px;
    border-radius: 16px;
    background: linear-gradient(155deg, #eef3f8 0%, #dde8f0 100%);
    border: 1px solid #c2d5e2;
    box-shadow: var(--shadow-sm);
}

.tecnico-detail-card .tecnico-section-label {
    margin: 0 0 12px;
    color: #3b5a72;
}

.tecnico-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tecnico-detail-grid div {
    min-width: 0;
}

.tecnico-detail-grid span {
    display: block;
    color: #6b8398;
    font-size: 12px;
    margin-bottom: 3px;
}

.tecnico-detail-grid strong {
    display: block;
    color: #0a2940;
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: break-word;
}

.tecnico-detail-grid small {
    display: block;
    color: #6b8398;
    font-size: 11px;
    margin-top: 2px;
}

.tecnico-detail-notes {
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px solid #c2d5e2;
    color: #274357;
    font-size: 14px;
    line-height: 1.5;
}

.tecnico-shell .button.full {
    margin: 20px 16px 0;
    width: calc(100% - 32px);
    min-height: 52px;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   tecnico_component.php (sotto-step 4, completamento - documenti,
   foto, cronologia interventi, 27/08/2026). Riusa lo stesso
   namespace .tecnico-* sopra e la stessa .tecnico-detail-card
   introdotta per la scheda apparato.
   ------------------------------------------------------------ */
.tecnico-doc-section {
    border-top: 1px solid #c2d5e2;
    padding-top: 10px;
    margin-top: 10px;
}

.tecnico-doc-section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.tecnico-doc-section summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: #0a2940;
    font-size: 14px;
}

.tecnico-doc-section summary::-webkit-details-marker {
    display: none;
}

.tecnico-doc-section summary::after {
    content: '›';
    margin-left: auto;
    color: #7a94a6;
    font-size: 18px;
    transform: rotate(90deg);
    transition: transform .15s ease;
}

.tecnico-doc-section[open] summary::after {
    transform: rotate(270deg);
}

.tecnico-doc-count {
    color: #6b8398;
    font-weight: 600;
    font-size: 12px;
}

.tecnico-doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.tecnico-doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.55);
    text-decoration: none;
    color: inherit;
}

.tecnico-doc-row:active {
    background: rgba(255,255,255,.9);
}

.tecnico-doc-icon {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    background: var(--romea-blue);
    border-radius: 6px;
    padding: 4px 6px;
    min-width: 30px;
    text-align: center;
}

.tecnico-doc-info {
    min-width: 0;
}

.tecnico-doc-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #0a2940;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tecnico-doc-date {
    display: block;
    font-size: 11px;
    color: #6b8398;
    margin-top: 1px;
}

.tecnico-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tecnico-photo-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--romea-blue), var(--romea-navy));
}

.tecnico-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tecnico-photo-fallback {
    font-size: 22px;
}

.tecnico-intervention-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tecnico-intervention-row {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,.55);
}

.tecnico-intervention-date {
    font-size: 11px;
    font-weight: 800;
    color: #3b5a72;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.tecnico-intervention-title {
    font-size: 14px;
    font-weight: 700;
    color: #0a2940;
    margin-top: 2px;
}

.tecnico-intervention-meta {
    font-size: 12px;
    color: #6b8398;
    margin-top: 2px;
}

/* ==========================================================================
   Portale Tecnico MNR - ChatMNR mobile (tecnico_chatmnr.php), 27/08/2026.
   assets/chat.css resta linkata invariata per lo stile delle bolle/composer
   (.chat-thread/.chat-message/.message-content/.chat-composer/...): qui solo
   gli adattamenti minimi per farla vivere dentro .tecnico-shell invece che
   dentro il layout a due colonne .chatgpt-layout del desktop, che questa
   pagina non usa.
   ========================================================================== */
.tecnico-chatmnr-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tecnico-chatmnr-savedlink {
    text-align: center;
}

.tecnico-chatmnr-shell .chat-thread {
    padding: 6px 2px 14px;
    overflow: visible;
}

.tecnico-chatmnr-shell .chat-message {
    margin: 0 0 16px;
}

.tecnico-chatmnr-shell .message-body {
    max-width: 94%;
}

.tecnico-chatmnr-shell .assistant-welcome {
    min-height: auto;
    padding: 18px 4px;
    border: 0;
    background: transparent;
}

.tecnico-chatmnr-shell .assistant-welcome h2 {
    font-size: 22px;
}

.tecnico-chatmnr-shell .chat-composer {
    position: sticky;
    bottom: 0;
    margin: 4px 0 0;
    border-radius: 16px;
    border: 1px solid #D8E8F4;
    box-shadow: 0 -8px 20px rgba(13,52,78,.08);
    z-index: 5;
}