/* Shared application tokens: mail and training use this same stylesheet. */
:root{--ui-font:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;--ui-primary:#005879;--ui-accent:#00afcc;--ui-bg:#f4f7fb;--ui-surface:#fff;--ui-ink:#203843;--ui-muted:#657b89;--ui-border:#e3eaf0;--ui-radius:12px}
body.portal-shell,.portal-sidebar,[data-testid="stAppViewContainer"],[data-testid="stAppViewContainer"] input,[data-testid="stAppViewContainer"] textarea,[data-testid="stAppViewContainer"] button{font-family:var(--ui-font)!important;color:var(--ui-ink);font-size:14px;line-height:1.5}
.portal-sidebar{color:white}
body.portal-shell,[data-testid="stAppViewContainer"]{background:var(--ui-bg)!important}
.portal-shell>main h1,[data-testid="stAppViewContainer"] h1{font-size:clamp(24px,2vw,32px);line-height:1.25;overflow-wrap:anywhere}
.portal-shell>main h2,[data-testid="stAppViewContainer"] h2{font-size:clamp(19px,1.5vw,24px);line-height:1.3;overflow-wrap:anywhere}
.portal-shell button:not(.window-control):not(.window-grip),.portal-shell .button-link,[data-testid="stAppViewContainer"] button{font-family:var(--ui-font);font-weight:600;border-radius:var(--ui-radius);}
[data-testid="stAppViewContainer"] button[kind="primary"]{background:var(--ui-primary)!important;border-color:var(--ui-primary)!important;color:white!important}
[data-testid="stAppViewContainer"] input,[data-testid="stAppViewContainer"] textarea{background:#f9fbfd!important;color:var(--ui-ink)!important;border-radius:var(--ui-radius)!important}
[data-testid="stForm"],[data-testid="stExpander"]{border-color:var(--ui-border)!important;border-radius:16px!important}
.portal-shell button:focus-visible,.portal-shell a:focus-visible,[data-testid="stAppViewContainer"] button:focus-visible{outline:2px solid var(--ui-accent)!important;outline-offset:3px}
.portal-brand img{height:auto;object-fit:contain}
.portal-shell .chat-fab>svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;flex:none}
.portal-shell .chat-fab{display:flex;align-items:center;justify-content:center;gap:8px}
@media(prefers-reduced-motion:reduce){.portal-shell button,.portal-shell a,[data-testid="stAppViewContainer"] button{transition:none!important;transform:none!important}}
/* Common layouts never hide controls beyond the viewport. */
.portal-shell>main,.portal-shell .card,.portal-shell .page-head{min-width:0;box-sizing:border-box}
.portal-shell .page-head{flex-wrap:wrap}
.ui-table-scroll{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;border-radius:12px;margin:12px 0;scrollbar-gutter:stable}
.ui-table-scroll:focus-visible{outline:2px solid var(--ui-accent);outline-offset:2px}
.ui-table-scroll table{width:100%;margin:0}
.portal-shell>main>form{max-width:100%;min-width:0}
.portal-shell input,.portal-shell textarea,.portal-shell select{max-width:100%}
.portal-shell .card p,.portal-shell .card td{overflow-wrap:anywhere}
[data-testid="stAppViewContainer"] .page-title{font-family:var(--ui-font);font-size:clamp(24px,2vw,32px);line-height:1.25;color:var(--ui-ink)}
[data-testid="stAppViewContainer"] .section-head{font-family:var(--ui-font);font-size:20px;line-height:1.3;color:var(--ui-ink)}
[data-testid="stAppViewContainer"] .page-subtitle,[data-testid="stAppViewContainer"] .section-copy{font-family:var(--ui-font);font-size:14px;color:var(--ui-muted)}
[data-testid="stTable"]{overflow-x:auto;max-width:100%}
@media(min-width:2000px){.portal-shell>main:not(:has(.mail-split)):not(:has(.portal-courses)){max-width:1800px}.portal-shell .page-head h1{font-size:32px}}
@media(max-width:700px){.portal-shell .mail-settings-grid{grid-template-columns:minmax(0,1fr)}.portal-shell .mail-settings-card{padding:16px;gap:12px}.portal-shell .card{padding:16px}.portal-shell .card form{min-width:0}.ui-table-scroll table{min-width:560px}}
/* 1.0.23: shared proportions, preserving the approved type scale and brand. */
:root{--ui-space-1:4px;--ui-space-2:8px;--ui-space-3:12px;--ui-space-4:16px;--ui-space-5:24px;--ui-space-6:32px;--ui-control-height:40px;--ui-radius-card:16px;--ui-shadow:0 4px 18px #1f405406}
.portal-shell>main>:is(.system-page,.course-catalog){width:100%;min-width:0;box-sizing:border-box}
.portal-shell :is(.page-head,.system-head){display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:24px}
.portal-shell :is(.page-head,.system-head) h1{margin:0;line-height:1.3}
.portal-shell :is(.page-head,.system-head) p{margin:8px 0 0;max-width:90ch}
.portal-shell :is(.system-card,.card){box-sizing:border-box;min-width:0;border-radius:var(--ui-radius-card);box-shadow:var(--ui-shadow)}
.portal-shell :is(.system-button,.button-link){box-sizing:border-box;white-space:normal;line-height:1.4;text-align:center;max-width:100%;gap:8px}
.portal-shell :is(button,a,summary)>svg:not(.command-waves){width:20px;height:20px;flex:0 0 auto;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.portal-shell :is(.system-notice,.system-error,.system-empty,.close-error){overflow-wrap:anywhere;line-height:1.55}
.portal-shell :is(.system-notice,.system-error){padding:12px 16px;border-radius:12px}
.portal-shell .system-notice{background:#edf8f3;color:#176d52;border:1px solid #cce9dd}
.portal-shell .system-error{background:#fff4f3;color:#9e3839;border:1px solid #f1d7d5}
.portal-shell table{width:100%;font-variant-numeric:tabular-nums}
.portal-shell th{line-height:1.45;white-space:normal;text-align:left}
.portal-shell td{line-height:1.5;vertical-align:middle}
.portal-shell :is(.system-button,.file-button) svg{object-fit:contain;overflow:visible}
.portal-shell :is(button:disabled,.system-button[aria-disabled=true]){cursor:not-allowed}
.portal-shell :is(button[aria-busy=true],.system-button[aria-busy=true]){cursor:progress}
.portal-shell :is(.card,.system-card) :is(label:has(>input),label:has(>select),label:has(>textarea)){line-height:1.5}
.portal-shell input[type=checkbox],.portal-shell input[type=radio]{accent-color:var(--ui-accent);flex:0 0 auto}
.catalog-search{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:20px}
.catalog-search>input{flex:1 1 240px;max-width:560px!important}
.catalog-check{display:flex!important;flex-direction:row!important;align-items:center;gap:9px;margin:0!important}
.catalog-check input{width:16px!important;height:16px!important;margin:0}
.catalog-table-wrap{padding:0!important;overflow-x:auto}
.catalog-table{min-width:700px;border-collapse:collapse}
.catalog-table th,.catalog-table td{padding:16px!important;white-space:normal}
.catalog-table td:first-child{width:31%}
.catalog-table th:last-child{min-width:170px}
.catalog-table small{display:block;color:var(--medicare-type-muted);margin-top:5px}
.catalog-actions .system-button{display:inline-flex;margin:3px 6px 3px 0}
.catalog-tag{display:inline-block;padding:3px 8px;background:#edf2f6;color:#617687;border-radius:8px;margin-left:8px}
.catalog-pagination{display:flex;gap:12px;align-items:center;justify-content:flex-end;flex-wrap:wrap;margin-top:16px;color:var(--medicare-type-muted)}
.catalog-pagination>span{margin-right:auto}
.catalog-form-card{width:100%;max-width:760px;padding:24px!important}
.catalog-form-card form{display:grid;gap:20px}
.catalog-form-card label:not(.catalog-check){display:grid;gap:7px;margin:0}
.catalog-form-card :is(input,select){width:100%;box-sizing:border-box;min-height:40px}
.catalog-two{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.catalog-hint{margin:0;color:var(--medicare-type-muted);font-size:11px!important;line-height:1.5}
.catalog-form-actions{display:flex;justify-content:flex-end;gap:12px;border-top:1px solid var(--ui-border);padding-top:20px}
.catalog-form-card [data-certificate-fields]{display:grid;gap:14px;align-items:start}
.catalog-form-card [data-certificate-fields][hidden]{display:none}
.catalog-form-card [data-configure-certificate]{justify-self:start}
.catalog-archive{margin:24px 0;max-width:760px;padding:16px;border:1px solid var(--ui-border);border-radius:12px}
.catalog-archive summary{cursor:pointer;color:#9e3839}
.catalog-archive form{display:grid;gap:16px;justify-items:start}
@media(max-width:640px){.catalog-form-card{padding:18px!important}.catalog-two{grid-template-columns:1fr;gap:16px}.catalog-search>input{flex-basis:100%}.catalog-form-actions{flex-wrap:wrap}.portal-shell :is(.page-head,.system-head){gap:12px}.portal-shell>main{padding-bottom:80px}}
@media(forced-colors:active){.portal-shell :is(.system-card,.card){border:1px solid CanvasText}.portal-shell .system-button{border:1px solid ButtonText}}

svg.upload-reference{stroke-width:1.3!important;aspect-ratio:1;object-fit:contain;fill:none}
.hse-upload-icon .upload-reference{width:32px;height:32px}

.catalog-bulk{display:flex;gap:10px;align-items:center;justify-content:flex-end;margin:10px 0 14px;flex-wrap:wrap}.catalog-bulk [data-selected-count]{margin-right:auto;color:var(--medicare-type-muted);font-weight:600}.catalog-select{width:48px!important;text-align:center}.catalog-select input{width:18px;height:18px;accent-color:#007b94}.catalog-inline-delete{display:inline-flex;margin:0}.system-button.danger-outline{border-color:#d9a7a2;color:#a52a22;background:#fff}.system-button.danger-outline:hover{background:#fff6f5}.delete-review-card{padding:22px}.delete-summary{display:flex;gap:18px;margin-bottom:18px}.delete-ready{color:#16764a;font-weight:700}.delete-blocked{color:#a52a22;font-weight:700}.delete-confirm-form{max-width:620px;margin-top:24px}.delete-confirm-form label{display:grid;gap:8px}.delete-confirm-form input[name=confirmation]{max-width:260px;text-transform:uppercase}


/* 1.0.34 - explicit certificate mode in Tipi corso */
.catalog-certificate-choice{border:1px solid var(--ui-border);border-radius:12px;padding:15px 16px;display:flex;flex-wrap:wrap;gap:14px 24px}.catalog-certificate-choice legend{font-weight:650;padding:0 6px}.catalog-certificate-choice label{display:flex!important;align-items:center;gap:8px!important}.catalog-certificate-choice input{width:18px!important;min-height:18px!important;height:18px}.catalog-inline-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}

/* 1.0.43 - eliminazione Tipi corso minimale */
.catalog-trash-button{color:var(--medicare-type-primary)!important;background:#fff!important;border-color:var(--medicare-border)!important;box-shadow:none!important}
.catalog-trash-button:hover:not(:disabled){color:#b63a42!important;border-color:#e7c4c8!important;background:#fff8f8!important}
.catalog-trash-button:disabled{opacity:.38!important;color:var(--medicare-type-muted)!important;background:#fff!important}
.catalog-inline-delete .catalog-trash-button{width:42px!important;min-width:42px!important;height:42px!important;padding:9px!important}
.catalog-bulk .catalog-trash-button{width:42px!important;min-width:42px!important;height:42px!important;padding:9px!important}

/* 1.0.62 - Tipi corso: configurazione manuale attestati e allineamenti coerenti. */
.catalog-header-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.course-type-form-head{max-width:900px}
.course-type-form-card{max-width:900px!important;padding:26px!important}
.course-type-form-card form{gap:0!important}
.course-type-form-card .course-form-section{display:grid;gap:18px;padding:0 0 24px}
.course-type-form-card .course-certificate-section{padding-top:24px;border-top:1px solid var(--ui-border)}
.course-type-form-card .catalog-form-actions{margin-top:0}
.course-type-form-card .catalog-two{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px}
.course-type-form-card .course-category-fields{align-items:start}
.course-type-form-card .course-category-fields>label{min-width:0;align-content:start}
.course-type-form-card .course-category-fields>label:first-child,
.course-type-form-card .course-category-fields>label:last-child{grid-template-rows:auto 42px}
.course-type-form-card .course-category-fields :is(input,select){height:42px;min-height:42px}
.course-type-form-card .course-profile-field{width:100%}
.course-type-form-card .course-certificate-fields{display:grid;gap:16px!important;width:100%}
.course-type-form-card .course-certificate-actions{justify-content:flex-start;margin-top:2px}
.course-type-form-card .catalog-certificate-choice{width:100%;box-sizing:border-box;display:grid;grid-template-columns:max-content max-content;justify-content:start;column-gap:34px;row-gap:10px;padding:17px 18px}
.course-type-form-card .catalog-certificate-choice legend{font-size:12px}
.course-type-form-card .course-category-empty{display:grid;grid-template-columns:auto 1fr auto;gap:10px 14px;align-items:center;padding:13px 14px;border:1px solid #dce6eb;border-radius:10px;background:#f7fbfd;color:#486674}
.course-type-form-card .course-category-empty strong{color:#173b4e}
.course-type-form-card .course-category-empty span{font-size:11px;line-height:1.45}
.course-type-form-card .course-category-empty .system-button{white-space:nowrap}
@media(max-width:760px){
 .catalog-header-actions{width:100%}
 .course-type-form-card{padding:20px!important}
 .course-type-form-card .catalog-two{grid-template-columns:1fr}
 .course-type-form-card .catalog-certificate-choice{grid-template-columns:1fr}
 .course-type-form-card .course-category-empty{grid-template-columns:1fr}
 .course-type-form-card .course-category-fields>label:first-child,
 .course-type-form-card .course-category-fields>label:last-child{grid-template-rows:auto 42px}
}

/* 1.0.64 - Tipi corso: categoria genitore esplicita e campi perfettamente allineati. */
.course-type-form-card .course-category-fields{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:18px!important;align-items:start!important}
.course-type-form-card .course-category-field{display:grid!important;grid-template-rows:18px 42px!important;row-gap:7px!important;align-content:start!important;min-width:0!important;margin:0!important;font-size:11px!important;line-height:18px!important;font-weight:600!important;color:#486674!important}
.course-type-form-card label.course-category-field{gap:7px!important}
.course-type-form-card .course-category-field :is(input,select),
.course-type-form-card .course-category-placeholder{width:100%!important;height:42px!important;min-height:42px!important;box-sizing:border-box!important;margin:0!important;border:1px solid #d8e4ea!important;border-radius:9px!important;background:#fff!important}
.course-type-form-card .course-category-field :is(input,select){padding:0 13px!important}
.course-type-form-card .course-category-placeholder{display:flex;align-items:center;padding:0 13px;color:#7f98a5;background:#f7f9fa!important}
.course-type-form-card .course-category-label{display:block;height:18px;line-height:18px}
.course-type-form-card .course-field-optional{font-weight:500;color:#7f98a5}
.course-type-form-card .course-category-empty{margin-top:0!important}
@media(max-width:760px){.course-type-form-card .course-category-fields{grid-template-columns:1fr!important}}
