:root {
    color-scheme: light;
    --ink: #172b3a;
    --muted: #657480;
    --line: #e2e9ed;
    --paper: #ffffff;
    --canvas: #f4f7f8;
    --brand-blue: #1768c4;
    --brand-blue-dark: #12539d;
    --brand-blue-soft: #e8f2ff;
    --gold: #d5a44c;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
a { color: inherit; }
.topbar { min-height: 88px; height: auto; padding: 8px clamp(20px, 5vw, 76px); background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar-branding { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-branding .brand { white-space: nowrap; }
.topbar-logo { display: block; width: auto; height: 68px; object-fit: contain; }
.topbar-company { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; white-space: nowrap; }
.topbar-company strong { color: var(--ink); font-size: 14px; }
.topbar-company a { color: var(--brand-blue); text-decoration: none; }
.topbar-company a:hover { text-decoration: underline; }
.brand { color: var(--ink); font-size: 21px; font-weight: 800; letter-spacing: .02em; text-decoration: none; }
.brand span { color: var(--brand-blue); }
.account { display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: 14px; }
.account form { margin: 0; }
.account a { color: var(--brand-blue); cursor: pointer; font: inherit; font-weight: 700; padding: 8px 0; text-decoration: none; }
.account a:hover { text-decoration: underline; }
.logout { border: 0; background: transparent; color: var(--brand-blue); cursor: pointer; font: inherit; font-weight: 700; padding: 8px 0; }
.account-link { color: var(--brand-blue); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.account-link:hover { text-decoration: underline; }
.language-switch { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.language-switch a { color: var(--brand-blue); font-weight: 700; text-decoration: none; padding: 8px 0; }
.language-switch a:hover, .language-switch a[aria-current="true"] { text-decoration: underline; }
.page-shell { width: min(1240px, calc(100% - 40px)); margin: 54px auto 80px; }
.site-footer { width: min(1240px, calc(100% - 40px)); margin: -52px auto 20px; color: var(--muted); font-size: 11px; text-align: right; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.company-identity { display: flex; align-items: center; gap: 18px; padding: 16px 20px; margin: 0 0 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px #19344108; }
.company-logo { display: block; flex: 0 0 auto; width: 96px; max-height: 112px; object-fit: contain; }
.company-identity address { color: var(--muted); font-size: 13px; font-style: normal; line-height: 1.6; }
.company-identity address strong { color: var(--ink); font-size: 15px; }
.company-identity address a { color: var(--brand-blue); text-decoration: none; }
.company-identity address a:hover { text-decoration: underline; }
.customer-company { padding: 16px 20px; margin: 0 0 22px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--brand-blue); border-radius: 12px; }
.customer-company-name { display: block; margin-top: 5px; color: var(--ink); font-size: 18px; }
.customer-company-address { margin: 5px 0 0; color: var(--muted); font-size: 13px; font-style: normal; line-height: 1.5; }
.eyebrow { color: var(--brand-blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 10px 0; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.035em; line-height: 1.1; }
.muted { color: var(--muted); margin: 0; }
.uid-chip { color: var(--brand-blue-dark); background: var(--brand-blue-soft); border-radius: 99px; font-size: 13px; font-weight: 700; padding: 10px 15px; white-space: nowrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; width: min(520px, 100%); }
input, select { min-width: 0; width: 100%; border: 1px solid #cad6dc; border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; padding: 12px 14px; }
input:focus, select:focus { border-color: var(--brand-blue); outline: 3px solid #1768c433; }
.secondary-button, .primary-button { border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 700; }
.secondary-button { background: #e8f2ff; color: var(--brand-blue-dark); padding: 0 18px; }
.primary-button { width: 100%; background: var(--brand-blue); color: white; padding: 13px 16px; margin-top: 8px; }
.primary-button:hover { background: var(--brand-blue-dark); }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.table-card, .login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px #19344108; }
.account-dashboard-card { padding: 24px; margin: 22px 0; }
.account-dashboard-card > h2 { margin: 0 0 20px; }
.plant-reactivate-form { display: grid; gap: 8px; min-width: 190px; }
.table-scroll { max-height: 70vh; overflow: auto; overscroll-behavior: contain; }
table { border-collapse: collapse; width: 100%; min-width: 1100px; text-align: left; }
th { position: sticky; top: 0; z-index: 2; background: #f8fafb; color: #667782; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 16px 18px; }
.table-sort { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; cursor: pointer; }
.table-sort:hover, .table-sort:focus-visible { color: var(--brand-blue); }
.sort-indicator { min-width: 1em; font-size: 9px; }
td { border-top: 1px solid var(--line); padding: 17px 18px; font-size: 14px; vertical-align: middle; }
.practice-number { color: var(--brand-blue-dark); font-weight: 800; }
.practice-description { max-width: 360px; white-space: normal; }
.status { display: inline-flex; border-radius: 99px; background: #f0f3f4; color: #63717a; font-size: 12px; font-weight: 700; padding: 6px 10px; white-space: nowrap; }
.status-done { background: var(--brand-blue-soft); color: var(--brand-blue-dark); }
.pdf-link { color: var(--brand-blue); font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.pdf-link:hover { text-decoration: underline; }
.empty-state { padding: 54px 28px; text-align: center; color: var(--muted); }
.empty-state h1, .empty-state h2 { color: var(--ink); margin-top: 0; }
.empty-state h2 { font-size: 21px; }
.privacy-note { color: var(--muted); font-size: 12px; margin: 14px 2px; }
.privacy-detail { line-height: 1.55; }
.privacy-confirmation { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; margin-top: 4px; }
.privacy-confirmation input { width: auto; margin: 3px 0 0; }
.privacy-confirmation label { margin: 0; font-size: 13px; font-weight: 500; line-height: 1.5; }
.login-wrap { min-height: calc(100vh - 206px); display: grid; place-items: center; }
.login-card { width: min(440px, 100%); padding: 38px; }
.login-card .company-identity { padding: 0 0 20px; margin: 0 0 24px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.login-card h1 { font-size: 30px; margin-top: 10px; }
.login-form { display: grid; gap: 10px; margin-top: 28px; }
.login-form label { font-size: 13px; font-weight: 700; margin-top: 4px; }
.login-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 20px 0 0; }
a[href*="AdminSetup" i] { display: none !important; }
.validation { color: #b33131; font-size: 13px; }
.form-feedback { margin: 18px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; color: var(--ink); font-size: 14px; line-height: 1.5; }
.recovery-button { display: inline-block; margin-top: 10px; padding: 11px 16px; text-decoration: none; }
.account-status-form { margin: 0; }
.status-action { border: 0; border-radius: 7px; background: var(--brand-blue-soft); color: var(--brand-blue-dark); cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; padding: 8px 12px; }
.status-action-disable { background: #f8e9e8; color: #a12d2d; }
.user-create-card { padding: 24px; margin-bottom: 28px; }
.user-create-card h2 { margin: 0 0 8px; font-size: 21px; }
.user-create-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 16px; margin-top: 20px; }
.user-create-form label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.user-create-form .primary-button { width: auto; margin: 0; }
.temporary-password-panel { display: grid; gap: 10px; background: var(--brand-blue-soft); border: 1px solid #bdd3ef; border-radius: 12px; margin-bottom: 22px; padding: 18px 22px; }
.temporary-password-panel code { overflow-wrap: anywhere; font-size: 17px; font-weight: 800; }
.temporary-password-panel p { margin: 0; color: var(--muted); font-size: 13px; }
.helpdesk-compose, .helpdesk-thread { padding: 24px; margin: 22px 0; }
.helpdesk-list { margin: 22px 0; }
.helpdesk-compose > h2,
.helpdesk-list > h2 { margin: 0 0 20px; }
.helpdesk-list > h2 { padding: 24px 24px 0; }
.helpdesk-compose h2, .helpdesk-list h2, .helpdesk-thread h2 { margin-top: 0; }
.helpdesk-form { display: grid; gap: 10px; margin-top: 18px; }
.helpdesk-form label { font-size: 13px; font-weight: 700; }
.helpdesk-form textarea, .helpdesk-form select, .search-form select { width: 100%; border: 1px solid #cad6dc; border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; padding: 12px 14px; }
.helpdesk-form textarea:focus, .helpdesk-form select:focus, .search-form select:focus { border-color: var(--brand-blue); outline: 3px solid #1768c433; }
.helpdesk-form .primary-button { width: fit-content; min-width: 190px; }
.helpdesk-status-form { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto; align-items: end; gap: 12px; border-top: 1px solid var(--line); margin: 18px 0; padding: 18px 0; }
.helpdesk-status-form label { font-size: 13px; font-weight: 700; }
.helpdesk-status-form select { border: 1px solid #cad6dc; border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; padding: 12px 14px; }
.helpdesk-thread-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.helpdesk-message { border-top: 1px solid var(--line); padding: 18px 0; }
.helpdesk-message-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.helpdesk-message-meta strong { color: var(--brand-blue-dark); }
.helpdesk-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 0; }
.helpdesk-admin-actions, .helpdesk-message-actions { display: flex; align-items: center; gap: 12px; }
.helpdesk-admin-actions form, .helpdesk-message-actions form { margin: 0; }
.helpdesk-message-actions { margin-top: 12px; flex-wrap: wrap; }
.helpdesk-message-actions summary { color: var(--brand-blue-dark); cursor: pointer; font-size: 13px; font-weight: 700; }
.helpdesk-edited-note { display: block; color: var(--muted); margin-top: 7px; }
.helpdesk-message-deleted { color: var(--muted); font-style: italic; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media print {
    .table-scroll { max-height: none; overflow: visible; }
    th { position: static; }
}

@media (max-width: 700px) {
    .topbar { min-height: 64px; height: auto; padding: 8px 16px; gap: 10px; }
    .topbar-branding { gap: 8px; flex-wrap: wrap; }
    .topbar-branding .brand { font-size: 18px; }
    .topbar-logo { height: 48px; }
    .topbar-company { font-size: 10px; white-space: normal; }
    .topbar-company strong { font-size: 11px; }
    .account { gap: 8px; font-size: 12px; }
    .page-shell { margin-top: 32px; }
    .page-heading { align-items: start; flex-direction: column; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search-form { width: 100%; }
    .login-card { padding: 28px 22px; }
    .company-identity { gap: 14px; padding: 14px 16px; }
    .company-logo { width: 78px; max-height: 94px; }
    .login-card .company-identity { padding: 0 0 18px; }
}
/* Comandi di stampa ed esportazione dell'elenco */
.export-actions { display: flex; align-items: center; gap: 8px; }
.export-link { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.status-download { text-decoration: none; }
.status-download:hover { text-decoration: underline; }
.recovery-exit { margin-top: 14px; }
.recovery-exit .secondary-button { width: 100%; padding: 12px 16px; }

@media (max-width: 700px) {
    .export-actions { flex-wrap: wrap; }
}

@media print {
    body { background: #fff !important; color: #000 !important; }
    .topbar, .toolbar, .privacy-note, .pdf-link, .site-footer { display: none !important; }
    .page-shell { width: 100% !important; margin: 0 !important; }
    .table-card { border: 0 !important; box-shadow: none !important; }
    .table-scroll { overflow: visible !important; }
    table { width: 100% !important; min-width: 0 !important; }
    th, td { padding: 7px 8px !important; color: #000 !important; }
    .admin-document-column { display: none !important; }
    tr { break-inside: avoid; page-break-inside: avoid; }
    a { color: #000 !important; text-decoration: none !important; }
}
