:root {
  --ink: #172033;
  --muted: #657087;
  --line: #d9dee8;
  --surface: #ffffff;
  --canvas: #f3f5f8;
  --navy: #001126;
  --navy-soft: #102743;
  --blue: #0876d1;
  --cyan: #12a9cf;
  --orange: #f07818;
  --green: #16845b;
  --red: #bd3d3d;
  --shadow: 0 14px 36px rgba(15, 27, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; letter-spacing: 0; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(18, 169, 207, 0.3); outline-offset: 2px; }
[hidden] { display: none !important; }
.eyebrow { margin: 0 0 7px; color: var(--orange); font-size: 0.71rem; font-weight: 800; text-transform: uppercase; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 17px; border-radius: 6px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; text-decoration: none; }
.primary-button { color: white; background: var(--blue); }
.primary-button:hover { background: #0565b3; }
.primary-button:disabled, .secondary-button:disabled { border-color: #d8dee7; color: #8894a3; background: #e8ecf1; cursor: not-allowed; }
.secondary-button { color: var(--ink); background: white; border-color: var(--line); }
.secondary-button:hover { border-color: var(--cyan); }
.compact { min-height: 34px; padding: 0 12px; font-size: 0.82rem; }
.full-button { width: 100%; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); font-size: 1.35rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: white; background: var(--blue); font-size: 0.78rem; font-weight: 800; }
.loading-state, .error-state { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; }
.error-state strong { color: var(--red); }
.form-error { min-height: 20px; margin: 0; color: var(--red); font-size: 0.83rem; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 6px; color: white; background: var(--ink); box-shadow: var(--shadow); transition: 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Accesso */
.fisco-access-page { background: var(--navy); }
.access-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.1fr); }
.access-brand-panel { min-height: 100vh; padding: 8vh clamp(34px, 6vw, 90px); display: flex; flex-direction: column; justify-content: center; color: white; background: var(--navy); }
.access-brand-panel img { width: min(520px, 88%); height: auto; object-fit: contain; object-position: left center; }
.access-brand-panel > p { max-width: 600px; margin: 28px 0 34px; color: #c2cede; font-size: clamp(1rem, 1.6vw, 1.28rem); line-height: 1.6; }
.access-signal-list { display: flex; flex-wrap: wrap; gap: 8px; }
.access-signal-list span { padding: 7px 10px; border-left: 3px solid var(--orange); color: #dce6f3; background: rgba(255, 255, 255, 0.06); font-size: 0.79rem; font-weight: 700; }
.access-panel { min-height: 100vh; padding: clamp(34px, 7vh, 90px) clamp(30px, 8vw, 120px); display: flex; flex-direction: column; justify-content: center; background: white; }
.access-panel > header h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.75rem); font-weight: 750; }
.segmented-control { margin: 30px 0 24px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 7px; background: var(--canvas); }
.segmented-control button { min-height: 42px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-weight: 750; }
.segmented-control button.is-active { color: white; background: var(--navy-soft); }
.access-form, .dialog-form { display: grid; gap: 16px; }
.access-form label, .dialog-form label, .choice-editor label, .client-choice-form > label { display: grid; gap: 7px; color: var(--ink); font-size: 0.82rem; font-weight: 700; }
.access-form input, .dialog-form input, .dialog-form select, .dialog-form textarea, .choice-editor input, .choice-editor select, .client-choice-form textarea, .filter-bar input, .filter-bar select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; color: var(--ink); background: white; }
.access-text-button { width: fit-content; margin-top: -8px; padding: 0; border: 0; color: var(--blue); background: transparent; font-size: 0.82rem; font-weight: 750; }
.access-text-button:hover { color: #0565b3; text-decoration: underline; }
textarea { min-height: 92px !important; resize: vertical; }
.activation-strip { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.activation-strip > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.activation-strip button { min-height: 70px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 4px; text-align: left; color: var(--ink); background: white; }
.activation-strip button:hover { border-color: var(--cyan); }
.activation-strip button span { color: var(--muted); font-size: 0.75rem; }
.access-panel > footer { margin-top: 26px; display: flex; justify-content: space-between; color: var(--muted); font-size: 0.72rem; }
.dialog-copy { color: var(--muted); line-height: 1.6; }
.security-setup { margin-bottom: 18px; padding: 14px; border-left: 4px solid var(--cyan); background: #edf8fb; }
.security-setup p { color: var(--muted); line-height: 1.5; }
.security-setup code { display: block; overflow-wrap: anywhere; padding: 10px; color: var(--navy); background: white; border: 1px solid #b9dce5; }
.security-qr { display: block; width: 180px; height: 180px; margin: 12px auto; border: 8px solid white; image-rendering: pixelated; }
.recovery-code-grid { margin: 18px 0; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.recovery-code-grid code { padding: 9px; border: 1px solid #dfe4ec; border-radius: 4px; color: var(--navy); background: white; text-align: center; font-size: 0.85rem; font-weight: 800; }
.recovery-code-actions { margin-top: 18px; }
.security-summary { margin-bottom: 18px; padding: 14px; border-left: 4px solid var(--green); background: #edf8f3; }
.security-summary strong, .security-summary span { display: block; }
.security-summary span { margin-top: 5px; color: var(--muted); font-size: 0.8rem; }
.support-access-shell { width: min(520px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.support-access-shell img { width: min(360px, 90%); margin-bottom: 26px; }
.support-access-shell h1 { margin: 4px 0 10px; font-size: 1.8rem; }
.support-access-shell > p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.55; }
.support-access-progress { width: 180px; height: 4px; margin: 24px 0; overflow: hidden; border-radius: 3px; background: #dfe5ec; }
.support-access-progress i { width: 45%; height: 100%; display: block; background: var(--blue); animation: support-progress 1.1s ease-in-out infinite alternate; }
@keyframes support-progress { from { transform: translateX(0); } to { transform: translateX(220%); } }

/* Layout Studio */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; color: white; background: var(--navy); }
.sidebar-brand { height: 64px; display: flex; align-items: center; overflow: hidden; }
.sidebar-brand img { width: 204px; max-height: 58px; object-fit: contain; object-position: left center; }
.office-label { margin: 10px 4px 22px; display: grid; gap: 3px; }
.office-label strong { font-size: 0.78rem; }
.office-label span { overflow: hidden; color: #93a7c1; font-size: 0.69rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { width: 100%; min-height: 43px; padding: 0 10px; border: 0; border-radius: 6px; display: flex; align-items: center; gap: 10px; text-align: left; color: #aebdd0; background: transparent; }
.nav-item:hover, .nav-item.is-active { color: white; background: var(--navy-soft); }
.nav-item > span:first-child { width: 25px; height: 25px; border: 1px solid #425773; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: #d4deea; font-size: 0.7rem; font-weight: 800; }
.nav-item.is-active > span:first-child { border-color: var(--orange); color: white; background: var(--orange); }
.nav-item b { min-width: 24px; margin-left: auto; padding: 2px 6px; border-radius: 10px; text-align: center; color: white; background: #304b6c; font-size: 0.68rem; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.profile-row { padding: 12px 8px 0; border-top: 1px solid #243b58; display: flex; align-items: center; gap: 10px; }
.profile-row div { min-width: 0; display: grid; }
.profile-row strong, .profile-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row strong { font-size: 0.78rem; }
.profile-row small { color: #93a7c1; font-size: 0.68rem; }
.workspace { min-width: 0; }
.topbar { min-height: 80px; padding: 16px clamp(22px, 3vw, 42px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: white; }
.topbar h1 { margin: 0; font-size: 1.45rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.menu-button { display: none; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.workspace-body { padding: 26px clamp(22px, 3vw, 42px) 44px; }
.daily-strip { min-height: 76px; margin-bottom: 20px; padding: 14px 18px; border: 1px solid var(--line); border-left: 5px solid var(--cyan); border-radius: 6px; display: flex; align-items: center; justify-content: space-between; background: white; }
.support-access-notice { min-height: 78px; margin-bottom: 20px; padding: 14px 18px; border: 1px solid #e0c18f; border-left: 5px solid var(--orange); border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fff8ed; }
.support-access-notice div { display: grid; gap: 4px; }
.support-access-notice span { color: #775b38; font-size: 0.76rem; }
.daily-strip strong { font-size: 0.95rem; }
.daily-strip > span { color: var(--muted); font-size: 0.78rem; }
.dashboard-grid, .client-module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.primary-module-card, .client-primary-card { min-height: 230px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; color: var(--ink); background: white; box-shadow: 0 5px 18px rgba(15, 27, 47, 0.05); }
.primary-module-card:hover, .client-primary-card:hover { border-color: var(--cyan); transform: translateY(-1px); }
.primary-module-card h2, .client-primary-card h2 { margin: 0 0 9px; font-size: 1.85rem; }
.primary-module-card p, .client-primary-card p { max-width: 470px; margin: 0; color: var(--muted); line-height: 1.5; }
.muted-card { border-top: 4px solid var(--orange); }
.primary-module-card:not(.muted-card), .client-primary-card:not(.muted-card) { border-top: 4px solid var(--blue); }
.module-metrics { display: flex; flex-wrap: wrap; gap: 20px; color: var(--muted); font-size: 0.78rem; }
.module-metrics strong { margin-right: 4px; color: var(--ink); font-size: 1.25rem; }
.activity-panel, .table-panel { margin-top: 20px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.activity-panel > header { padding: 18px; border-bottom: 1px solid var(--line); }
.activity-panel h2, .section-heading h2 { margin: 0; font-size: 1.25rem; }
.activity-row { width: 100%; min-height: 66px; padding: 12px 18px; border: 0; border-bottom: 1px solid #edf0f4; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 12px; text-align: left; color: var(--ink); background: white; }
.activity-row:hover { background: #f8fafc; }
.activity-row i { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.activity-row span { min-width: 0; display: grid; gap: 3px; }
.activity-row small, .activity-row time { color: var(--muted); font-size: 0.74rem; }
.empty-state { min-height: 110px; padding: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h1, .section-heading h2 { margin: 0 0 5px; font-size: 1.65rem; }
.section-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.filter-bar { margin-top: 18px; display: grid; grid-template-columns: minmax(240px, 1fr) 220px; gap: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; color: var(--muted); background: #f8f9fb; font-size: 0.71rem; text-transform: uppercase; }
td { padding: 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; font-size: 0.82rem; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); font-size: 0.7rem; }
.money-cell { font-weight: 800; white-space: nowrap; }
.status-badge { display: inline-flex; padding: 4px 8px; border-radius: 4px; font-size: 0.69rem; font-weight: 800; white-space: nowrap; }
.status-bozza { color: #596274; background: #edf0f4; }
.status-inviato, .status-da_inviare { color: #075a9b; background: #e8f3fc; }
.status-confermato { color: #73540b; background: #fff4d6; }
.status-pagato { color: #116a49; background: #e5f5ed; }
.status-annullato { color: #9e3333; background: #fae9e9; }
.icon-action { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); background: white; font-size: 1.35rem; }
.download-action { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.table-total, .client-total { min-height: 64px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); background: #f8f9fb; }
.table-total strong, .client-total strong { color: var(--ink); font-size: 1.05rem; }
.client-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.client-card { min-height: 96px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; gap: 12px; background: white; }
.client-card div { min-width: 0; display: grid; gap: 3px; }
.client-card strong, .client-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-card small { color: var(--muted); }
.client-card div > span { margin-top: 4px; color: var(--green); font-size: 0.7rem; font-weight: 750; }
.document-request-panel, .client-request-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.document-request-panel > header, .client-request-panel > header { min-height: 70px; padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.document-request-panel h3, .client-request-panel h2 { margin: 0; font-size: 1.08rem; }
.document-request-panel > header > span { color: var(--muted); font-size: 0.75rem; }
.request-list, .client-request-list { display: grid; }
.request-row { min-height: 84px; padding: 13px 18px; border-bottom: 1px solid #edf0f4; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, auto) 210px; align-items: center; gap: 16px; }
.request-row:last-child { border-bottom: 0; }
.request-row > div { min-width: 0; display: grid; gap: 4px; }
.request-row span:not(.status-badge), .request-row small { overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.request-row select { min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: white; }
.document-status-richiesto { color: #075a9b; background: #e8f3fc; }
.document-status-inviato { color: #73540b; background: #fff4d6; }
.document-status-da_correggere { color: #9e3333; background: #fae9e9; }
.document-status-verificato { color: #116a49; background: #e5f5ed; }
.document-status-archiviato { color: #596274; background: #edf0f4; }
.document-direction-in { color: #075a9b; background: #e8f3fc; }
.document-direction-out { color: #116a49; background: #e5f5ed; }
.document-table { margin-top: 18px; }
.operator-license-strip { min-height: 70px; margin-top: 18px; padding: 14px 18px; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: white; }
.operator-license-strip div { display: grid; gap: 4px; }
.operator-license-strip span { color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.operator-license-strip p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.operator-table { margin-top: 14px; }
.operator-status-active { color: #116a49; background: #e5f5ed; }
.operator-status-disabled { color: #9e3333; background: #fae9e9; }
.operator-readonly { color: var(--muted); font-size: 0.72rem; white-space: nowrap; }
.danger-text-button { width: fit-content; padding: 0; border: 0; color: #a52f2f; background: transparent; font-size: 0.78rem; font-weight: 750; }
.danger-text-button:hover { text-decoration: underline; }

/* Dialog */
.fisco-dialog { width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 8px; overflow: auto; color: var(--ink); background: white; box-shadow: var(--shadow); }
.fisco-dialog::backdrop { background: rgba(5, 17, 33, 0.72); }
.fisco-dialog > header { position: sticky; top: 0; z-index: 2; min-height: 76px; padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: white; }
.fisco-dialog h2 { margin: 0; font-size: 1.25rem; }
.fisco-dialog > form, .fisco-dialog > #dialogBody, .fisco-dialog > #detailBody, .fisco-dialog > #clientF24Body, .fisco-dialog > #clientDocumentBody, .fisco-dialog > #securityBody { padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: grid; gap: 7px; font-size: 0.79rem; font-weight: 700; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid small { color: var(--muted); font-weight: 500; }
.check-row { padding: 14px; border: 1px solid var(--line); border-radius: 6px; display: flex !important; grid-template-columns: auto 1fr; align-items: start; gap: 10px !important; background: #f8fafc; }
.check-row[hidden] { display: none !important; }
.check-row input { width: 18px; height: 18px; }
.check-row span { display: grid; gap: 3px; }
.check-row small { color: var(--muted); font-weight: 500; }
.dialog-actions, .detail-actions { display: flex; justify-content: flex-end; gap: 9px; }
.detail-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.detail-summary > div { min-height: 78px; padding: 12px; border-right: 1px solid var(--line); display: grid; align-content: center; gap: 7px; }
.detail-summary > div:last-child { border-right: 0; }
.detail-summary span { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; }
.note-panel { margin: 16px 0; padding: 14px; border-left: 4px solid var(--orange); background: #fff8ef; }
.note-panel span { color: #8c591b; font-size: 0.69rem; font-weight: 800; text-transform: uppercase; }
.note-panel p { margin: 7px 0 0; line-height: 1.55; }
.choice-editor { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; }
.timeline { margin-top: 22px; }
.timeline h3 { margin: 0; }
.timeline article { min-height: 58px; padding: 11px 2px; border-bottom: 1px solid #edf0f4; display: grid; grid-template-columns: 10px 1fr; gap: 12px; }
.timeline article i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--cyan); }
.timeline article div { display: grid; gap: 4px; }
.timeline article span { color: var(--muted); font-size: 0.72rem; }

/* Area cliente */
.client-page { min-height: 100vh; }
.client-topbar { min-height: 76px; padding: 10px clamp(18px, 4vw, 58px); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 210px 1fr auto; align-items: center; gap: 20px; background: white; }
.client-topbar > a { display: flex; align-items: center; }
.client-topbar img { width: 190px; max-height: 58px; object-fit: contain; object-position: left center; }
.client-topbar nav { display: flex; justify-content: center; gap: 4px; }
.client-topbar nav button { min-height: 38px; padding: 0 12px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; }
.client-topbar nav button.is-active { color: var(--blue); background: #eaf4fc; font-weight: 750; }
.client-profile { display: flex; align-items: center; gap: 9px; }
.client-profile > div { display: grid; }
.client-profile small { color: var(--muted); font-size: 0.7rem; }
.client-workspace { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 56px; }
.client-welcome { margin-bottom: 22px; }
.client-welcome h1 { margin: 0 0 7px; font-size: 1.75rem; }
.client-welcome > p:last-child { margin: 0; color: var(--muted); }
.client-record-list { margin-top: 16px; display: grid; gap: 10px; }
.client-record-card { width: 100%; min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; display: grid; grid-template-columns: 1fr auto 30px; align-items: center; gap: 20px; text-align: left; color: var(--ink); background: white; }
.client-record-card:hover { border-color: var(--cyan); }
.client-record-card h3 { margin: 8px 0 3px; font-size: 1rem; }
.client-record-card p { margin: 0; color: var(--muted); font-size: 0.78rem; }
.client-record-meta { display: grid; justify-items: end; gap: 5px; }
.client-record-meta strong { font-size: 1.02rem; }
.client-record-meta span { color: var(--muted); font-size: 0.72rem; }
.card-arrow { color: var(--blue); font-size: 1.5rem; }
.client-total { margin-top: 16px; border: 1px solid var(--line); border-radius: 6px; }
.client-filter { grid-template-columns: 1fr; }
.client-choice-form { margin-top: 20px; display: grid; gap: 15px; }
.client-choice-form h3 { margin: 0; }
.choice-grid { display: grid; gap: 9px; }
.choice-card { min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 10px !important; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--blue); background: #edf6fd; }
.choice-card input { width: 18px; height: 18px; margin-top: 2px; }
.choice-card span { display: grid; gap: 4px; }
.choice-card small { color: var(--muted); font-weight: 500; }
.client-request-card { min-height: 112px; padding: 16px 18px; border-bottom: 1px solid #edf0f4; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.client-request-card:last-child { border-bottom: 0; }
.client-request-card > div { min-width: 0; }
.client-request-card h3 { margin: 8px 0 4px; font-size: 0.96rem; }
.client-request-card p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.request-date { color: var(--muted); font-size: 0.72rem; }
.document-detail-summary { grid-template-columns: repeat(3, 1fr); }
.communication-filter { grid-template-columns: 1fr; }
.communication-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: white; }
.communication-row { width: 100%; min-height: 112px; padding: 17px 18px; border: 0; border-bottom: 1px solid var(--line); background: white; display: grid; grid-template-columns: 42px minmax(0, 1fr) 180px 20px; align-items: center; gap: 14px; color: inherit; text-align: left; cursor: pointer; }
.communication-row:last-child { border-bottom: 0; }
.communication-row:hover { background: #f8fafc; }
.communication-row.is-pending { box-shadow: inset 3px 0 0 var(--orange); }
.communication-row .avatar { width: 42px; height: 42px; }
.communication-main { min-width: 0; }
.communication-main > span { display: flex; align-items: baseline; gap: 8px; }
.communication-main > span small { color: var(--muted); }
.communication-main h3 { margin: 6px 0 4px; font-size: 0.96rem; }
.communication-main p { margin: 0; max-width: 720px; overflow: hidden; color: var(--muted); font-size: 0.8rem; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.communication-meta { display: grid; justify-items: end; gap: 4px; font-size: 0.72rem; }
.communication-meta strong { color: var(--ink); }
.communication-meta span, .communication-meta time { color: var(--muted); }
.communication-thread-dialog { width: min(760px, calc(100vw - 30px)); }
.thread-contact { margin: 0 22px; padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.thread-contact div { display: grid; gap: 4px; }
.thread-contact span { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; }
.conversation-stream { max-height: 390px; padding: 20px 22px; overflow-y: auto; display: grid; gap: 12px; background: #f7f9fb; }
.conversation-message { width: min(82%, 570px); padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.conversation-message.from-studio { justify-self: end; border-color: #b8d8ee; background: #edf6fd; }
.conversation-message.from-client { justify-self: start; }
.conversation-message > div { display: flex; justify-content: space-between; gap: 14px; }
.conversation-message strong { font-size: 0.76rem; }
.conversation-message time { color: var(--muted); font-size: 0.68rem; }
.conversation-message p { margin: 7px 0 0; font-size: 0.84rem; line-height: 1.5; white-space: pre-wrap; }
.thread-reply-form { padding: 18px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.thread-reply-form label { display: grid; gap: 7px; font-size: 0.78rem; font-weight: 700; }
.thread-reply-form textarea { min-height: 92px; }
.thread-reply-form .primary-button { justify-self: end; }
.trace-disclosure { margin: 0 22px 22px; border: 1px solid var(--line); border-radius: 7px; }
.trace-disclosure summary { padding: 13px 15px; font-size: 0.8rem; font-weight: 800; cursor: pointer; }
.trace-switch { padding: 0 14px 12px; display: flex; gap: 6px; }
.trace-switch button { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--muted); font-weight: 750; cursor: pointer; }
.trace-switch button.is-active { border-color: var(--blue); background: #edf6fd; color: #07588f; }
.compact-timeline { margin: 0; padding: 0 14px 14px; }
.compact-timeline[hidden] { display: none; }
.compact-timeline .mail-event-read_receipt i, .compact-timeline .mail-event-delivered i { background: #18875e; }
.compact-timeline .mail-event-delivery_failed i, .compact-timeline .mail-event-send_failed i { background: #b93832; }
.mail-settings-summary { margin: 0 22px; border: 1px solid var(--line); border-radius: 7px; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.mail-settings-summary > div { min-height: 94px; padding: 16px; display: grid; align-content: center; gap: 5px; }
.mail-settings-summary > div + div { border-left: 1px solid var(--line); }
.mail-settings-summary span, .mail-settings-summary small { color: var(--muted); font-size: 0.72rem; }
.mail-settings-summary strong { font-size: 0.92rem; overflow-wrap: anywhere; }
.mail-settings-actions { padding: 0 22px 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.mail-settings-warning, .mail-settings-note { margin: 0 22px 16px; padding: 10px 12px; border: 1px solid #e3b765; border-radius: 6px; color: #784c08; background: #fff8e8; font-size: 0.78rem; line-height: 1.45; }

/* Impostazioni Studio */
.settings-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-tabs { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.settings-tab { width: 100%; min-height: 76px; padding: 13px; border: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 11px; color: var(--ink); background: white; text-align: left; cursor: pointer; }
.settings-tab:last-child { border-bottom: 0; }
.settings-tab:hover, .settings-tab.is-active { background: #edf6fd; }
.settings-tab.is-active { box-shadow: inset 3px 0 0 var(--blue); }
.settings-tab > span { width: 30px; height: 30px; border: 1px solid #bfd0e3; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: var(--blue); font-size: 0.72rem; font-weight: 800; }
.settings-tab > div { min-width: 0; display: grid; gap: 4px; }
.settings-tab strong { font-size: 0.82rem; }
.settings-tab small { color: var(--muted); font-size: 0.7rem; line-height: 1.35; }
.settings-content { min-width: 0; }
.settings-panel { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.settings-panel[hidden] { display: none; }
.settings-panel > header { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.settings-panel > header h2 { margin: 2px 0 5px; font-size: 1.15rem; }
.settings-panel > header > p:last-child { margin: 0; color: var(--muted); font-size: 0.78rem; }
.settings-panel #securityBody { padding: 20px 22px; }
.settings-panel #securityBody .dialog-form { padding: 0; }
.settings-panel #mailSettingsBody { padding: 20px 0 2px; }
.settings-panel #operatorsSettingsBody { padding: 20px 22px; }
.settings-panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.settings-panel-actions p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }

/* Agenda Fisco */
.daily-strip-button { width: 100%; color: var(--ink); text-align: left; }
.daily-strip-button > div { display: grid; gap: 3px; }
.daily-strip-button > div > span { color: var(--muted); font-size: 0.75rem; }
.agenda-summary, .client-agenda-summary { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; background: white; }
.agenda-summary > div, .client-agenda-summary > div { min-height: 70px; padding: 13px 18px; border-right: 1px solid var(--line); display: grid; align-content: center; gap: 3px; }
.agenda-summary > div:last-child, .client-agenda-summary > div:last-child { border-right: 0; }
.agenda-summary span, .client-agenda-summary span { color: var(--muted); font-size: 0.7rem; }
.agenda-summary strong, .client-agenda-summary strong { font-size: 1.25rem; }
.agenda-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.agenda-toolbar { min-height: 58px; padding: 9px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; gap: 12px; }
.agenda-toolbar > div { display: flex; align-items: center; justify-content: center; gap: 12px; }
.agenda-toolbar > div button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--blue); background: white; font-weight: 700; }
.agenda-week { min-width: 980px; display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); }
.agenda-panel { overflow-x: auto; }
.agenda-day { min-height: 390px; border-right: 1px solid var(--line); background: #fbfcfd; }
.agenda-day:last-child { border-right: 0; }
.agenda-day.is-today { background: #f0f8fd; }
.agenda-day > header { min-height: 48px; padding: 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; text-transform: capitalize; }
.agenda-day > header span { font-size: 0.74rem; font-weight: 800; }
.agenda-day > header b { min-width: 22px; height: 22px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: #07588f; background: #dceefa; font-size: 0.68rem; }
.agenda-day > div { padding: 8px; display: grid; gap: 7px; }
.agenda-empty { margin: 16px 0; color: var(--muted); font-size: 0.7rem; text-align: center; }
.appointment-item { width: 100%; min-height: 116px; padding: 9px; border: 1px solid #cfd8e3; border-left: 4px solid var(--blue); border-radius: 6px; color: var(--ink); background: white; text-align: left; }
.appointment-item:hover, .appointment-item:focus-visible { border-color: var(--blue); background: #f7fbfe; }
.appointment-item.status-done { border-left-color: var(--green); opacity: 0.78; }
.appointment-item.status-cancelled, .appointment-item.status-no_show { border-left-color: #b34a4a; opacity: 0.68; }
.appointment-item > time { color: var(--blue); font-size: 0.75rem; font-weight: 850; }
.appointment-item > div { margin-top: 5px; display: grid; gap: 3px; }
.appointment-item strong { overflow: hidden; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.appointment-item span, .appointment-item small { color: var(--muted); font-size: 0.66rem; line-height: 1.35; }
.appointment-item em { width: fit-content; margin-top: 3px; color: #586578; font-size: 0.62rem; font-style: normal; font-weight: 750; }
.appointment-item .reminder-state { margin-top: 3px; color: #07588f; font-weight: 750; white-space: normal; }
.appointment-dialog-actions > span { flex: 1; }
.appointment-request-panel, .client-appointment-section { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: white; }
.appointment-request-panel > header, .client-appointment-section > header { min-height: 68px; padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.appointment-request-panel h3, .client-appointment-section h2 { margin: 0; font-size: 1.05rem; }
.appointment-request-panel > header > span { min-width: 28px; height: 28px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; color: #805113; background: #fff1da; font-weight: 850; }
.appointment-request-list > article { min-height: 88px; padding: 13px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 110px minmax(240px, 1fr) auto; align-items: center; gap: 18px; }
.appointment-request-list > article:last-child { border-bottom: 0; }
.appointment-request-list article > div { min-width: 0; display: grid; gap: 3px; }
.appointment-request-list article span, .appointment-request-list article small { color: var(--muted); font-size: 0.72rem; }
.request-date-block strong { font-size: 1rem; }
.request-actions { display: flex !important; grid-auto-flow: column; gap: 7px !important; }
.availability-dialog { width: min(720px, calc(100vw - 28px)); }
.availability-editor { border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.availability-row { min-height: 54px; padding: 8px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(130px, 1fr) 120px auto 120px; align-items: center; gap: 9px; }
.availability-row:last-child { border-bottom: 0; }
.availability-row > span { color: var(--muted); font-size: 0.7rem; }
.availability-toggle { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px !important; }
.availability-toggle input { width: 18px; height: 18px; }
.client-appointment-strip { width: 100%; min-height: 82px; margin-bottom: 18px; padding: 14px 18px; border: 1px solid var(--line); border-left: 5px solid var(--cyan); border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--ink); text-align: left; background: white; }
.client-appointment-strip > div { display: grid; gap: 3px; }
.client-appointment-strip > div > span, .client-appointment-strip > span { color: var(--muted); font-size: 0.74rem; }
.client-agenda-summary { grid-template-columns: repeat(2, 1fr); }
.client-appointment-list { display: grid; }
.client-appointment-card { min-height: 104px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 18px; }
.client-appointment-card:last-child { border-bottom: 0; }
.client-appointment-card > div { min-width: 0; }
.client-appointment-card h3 { margin: 7px 0 3px; font-size: 0.96rem; }
.client-appointment-card p, .client-appointment-card small { margin: 0; color: var(--muted); font-size: 0.75rem; }
.appointment-date { display: grid; gap: 3px; }
.appointment-date strong { color: var(--blue); font-size: 1.05rem; }
.appointment-date span { color: var(--muted); font-size: 0.72rem; }
.appointment-status-pending { color: #73540b; background: #fff4d6; }
.appointment-history { opacity: 0.9; }
.booking-slots { min-height: 94px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; background: #f8fafc; }
.booking-slots button { min-width: 76px; min-height: 38px; padding: 0 12px; border: 1px solid #b7c5d4; border-radius: 5px; color: var(--blue); background: white; font-weight: 800; }
.booking-slots button:hover, .booking-slots button.is-selected { border-color: var(--blue); color: white; background: var(--blue); }
.booking-slots .empty-state, .booking-slots .loading-state { width: 100%; min-height: 68px; padding: 8px; }

@media (max-width: 980px) {
  .access-layout { grid-template-columns: 1fr; }
  .access-brand-panel { min-height: 300px; padding: 42px 30px; }
  .access-brand-panel img { width: min(500px, 95%); }
  .access-brand-panel > p { margin: 18px 0 24px; }
  .access-panel { min-height: auto; padding: 44px 30px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: 0; width: 242px; transform: translateX(-100%); transition: transform 180ms ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: inline-flex; align-items: center; padding: 0 12px; }
  .client-grid { grid-template-columns: 1fr 1fr; }
  .client-topbar { grid-template-columns: 180px 1fr; }
  .client-topbar nav { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; justify-content: flex-start; }
  .client-profile { justify-self: end; }
  .agenda-heading { align-items: flex-start; }
}

@media (max-width: 680px) {
  .access-brand-panel { min-height: 230px; }
  .access-brand-panel > p { font-size: 0.94rem; }
  .access-panel { padding: 34px 20px; }
  .activation-strip > div, .dashboard-grid, .client-module-grid, .form-grid, .client-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .workspace-body { padding: 20px 14px 36px; }
  .topbar { min-height: 70px; padding: 12px 14px; }
  .topbar-actions .primary-button { display: none; }
  .daily-strip { align-items: flex-start; flex-direction: column; gap: 7px; }
  .support-access-notice { align-items: flex-start; flex-direction: column; }
  .support-access-notice button { width: 100%; }
  .operator-license-strip { align-items: flex-start; flex-direction: column; gap: 7px; }
  .primary-module-card, .client-primary-card { min-height: 190px; padding: 20px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .heading-actions { justify-content: stretch; }
  .heading-actions button { flex: 1 1 180px; }
  .filter-bar { grid-template-columns: 1fr; }
  .table-panel { border: 0; background: transparent; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tr { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: white; }
  td { padding: 7px 0; border: 0; }
  td:last-child { position: absolute; right: 26px; margin-top: -44px; }
  .table-total { border: 1px solid var(--line); border-radius: 6px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .fisco-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .recovery-code-grid { grid-template-columns: 1fr; }
  .detail-summary { grid-template-columns: 1fr 1fr; }
  .detail-summary > div:nth-child(2) { border-right: 0; }
  .detail-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .choice-editor { grid-template-columns: 1fr; }
  .request-row { grid-template-columns: 1fr; align-items: stretch; gap: 9px; }
  .request-row span:not(.status-badge), .request-row small { white-space: normal; }
  .client-request-card { align-items: stretch; flex-direction: column; }
  .client-request-card .secondary-button { width: 100%; }
  .document-detail-summary { grid-template-columns: 1fr; }
  .document-detail-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .document-detail-summary > div:last-child { border-bottom: 0; }
  .client-topbar { padding: 9px 14px; grid-template-columns: 150px 1fr; gap: 8px; }
  .client-topbar img { width: 145px; }
  .client-profile > div { display: none; }
  .client-workspace { width: calc(100% - 28px); padding-top: 24px; }
  .client-record-card { grid-template-columns: 1fr 24px; gap: 10px; }
  .client-record-meta { grid-column: 1; grid-row: 2; justify-items: start; }
  .card-arrow { grid-column: 2; grid-row: 1 / span 2; }
  .communication-row { grid-template-columns: 38px minmax(0, 1fr) 20px; min-height: 126px; padding: 14px; gap: 10px; }
  .communication-row .avatar { width: 38px; height: 38px; }
  .communication-meta { grid-column: 2; justify-items: start; }
  .communication-row .card-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .communication-main > span { align-items: flex-start; flex-direction: column; gap: 2px; }
  .thread-contact { grid-template-columns: 1fr; }
  .conversation-message { width: 92%; }
  .trace-switch { flex-direction: column; }
  .trace-switch button { width: 100%; }
  .mail-settings-summary { grid-template-columns: 1fr; }
  .mail-settings-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .settings-tabs-master { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-tab { min-height: 68px; border-bottom: 0; border-right: 1px solid var(--line); }
  .settings-tab:last-child { border-right: 0; }
  .settings-panel-actions { align-items: stretch; flex-direction: column; }
  .settings-panel-actions .primary-button { width: 100%; }
  .agenda-summary { grid-template-columns: 1fr; }
  .agenda-summary > div { min-height: 58px; border-right: 0; border-bottom: 1px solid var(--line); }
  .agenda-summary > div:last-child { border-bottom: 0; }
  .agenda-toolbar > div strong { font-size: 0.78rem; }
  .appointment-request-list > article { grid-template-columns: 1fr; gap: 9px; }
  .request-actions { grid-auto-flow: row; }
  .request-actions button { width: 100%; }
  .availability-row { grid-template-columns: 1fr 1fr; }
  .availability-row > span { display: none; }
  .availability-toggle { grid-column: 1 / -1; }
  .client-appointment-strip { align-items: flex-start; flex-direction: column; gap: 8px; }
  .client-appointment-card { grid-template-columns: 1fr; gap: 10px; }
  .client-appointment-card > button { width: 100%; }
}
