:root{
  --navy:#062553;--navy-2:#0a346e;--primary:#1888ff;--primary-soft:#eaf4ff;--bg:#f4f7fb;--surface:#fff;
  --text:#0f2343;--muted:#6b7890;--line:#dfe6ef;--success:#1ca66c;--success-bg:#e8f8f0;
  --warning:#ed8a00;--warning-bg:#fff6e6;--danger:#df4b57;--danger-bg:#fff0f1;--neutral:#7d8aa3;--neutral-bg:#eef2f6;
  --shadow:0 12px 32px rgba(21,44,78,.07);--radius:15px;--sidebar:236px;
  font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;color:var(--text);background:var(--bg)
}
*{box-sizing:border-box}body{margin:0;background:linear-gradient(180deg,#f8fafc 0,#f2f6fb 100%);color:var(--text)}button,input,select{font:inherit}button,select{cursor:pointer}.icon{display:inline-block;vertical-align:middle;flex:0 0 auto}
.app-shell{min-height:100vh;display:grid;grid-template-columns:var(--sidebar) minmax(0,1fr)}
.sidebar{position:sticky;top:0;height:100vh;background:linear-gradient(180deg,#062553,#082d62 65%,#062553);color:#fff;padding:24px 16px 18px;display:flex;flex-direction:column;box-shadow:10px 0 30px rgba(3,30,68,.10);z-index:20}
.brand{display:flex;align-items:center;gap:11px;font-size:22px;font-weight:760;padding:7px 8px 24px}.brand-mark,.brand-dot{width:34px;height:34px;border-radius:11px;background:linear-gradient(135deg,#1d96ff,#0969db);display:grid;place-items:center;color:#fff;font-weight:800;letter-spacing:-.5px;box-shadow:0 8px 18px rgba(20,135,255,.28)}
.side-nav{display:flex;flex-direction:column;gap:8px}.nav-item{display:flex;align-items:center;gap:12px;color:#e7eef8;text-decoration:none;padding:12px 13px;border-radius:10px;font-size:14px}.nav-item:hover{background:rgba(255,255,255,.08)}.nav-item.active{background:linear-gradient(90deg,#147df0,#1b90ff);color:#fff;box-shadow:0 8px 18px rgba(17,128,245,.3)}
.sidebar-foot{margin-top:auto;border-top:1px solid rgba(255,255,255,.12);padding-top:17px}.white-label-badge{display:flex;align-items:center;gap:10px;padding:8px 5px}.shield{width:34px;height:38px;border:2px solid #fff;border-radius:10px 10px 13px 13px;display:grid;place-items:center;font-size:20px}.white-label-badge strong{display:block;font-size:13px}.white-label-badge small{display:block;font-size:9px;color:#bfd0e6;margin-top:3px;letter-spacing:.4px}.env-chip{margin-top:12px;display:inline-flex;background:rgba(255,255,255,.09);color:#bcd1eb;border:1px solid rgba(255,255,255,.12);padding:5px 8px;border-radius:999px;font-size:9px;letter-spacing:.5px}
.content-shell{min-width:0}.topbar{height:84px;background:rgba(255,255,255,.94);border-bottom:1px solid var(--line);display:flex;align-items:center;gap:14px;padding:0 28px;position:sticky;top:0;z-index:10;backdrop-filter:blur(12px)}
.date-navigator{display:flex;align-items:center;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#fff;min-width:300px}.icon-button{width:40px;height:40px;border:1px solid var(--line);background:#fff;color:var(--text);border-radius:9px;display:inline-grid;place-items:center}.date-navigator .icon-button{border:0;border-radius:0}.date-display{height:40px;flex:1;border:0;border-left:1px solid var(--line);border-right:1px solid var(--line);background:#fff;font-size:13px;font-weight:700;color:var(--text);display:flex;align-items:center;justify-content:center;gap:9px;padding:0 12px;white-space:nowrap}
.studio-select-wrap,.search-box{height:42px;border:1px solid var(--line);border-radius:10px;background:#fff;display:flex;align-items:center;gap:8px;padding:0 12px;color:#55708f}.studio-select-wrap select{border:0;background:transparent;color:var(--text);font-weight:650;outline:0;min-width:150px}.search-box{min-width:190px;flex:1;max-width:260px}.search-box input{border:0;outline:0;width:100%;min-width:0;color:var(--text)}.search-box input::placeholder{color:#9aa5b5}
.top-action{height:42px;border:1px solid var(--line);background:#fff;border-radius:10px;color:var(--text);font-weight:700;padding:0 14px;display:flex;align-items:center;gap:8px}.profile{display:flex;align-items:center;gap:10px;margin-left:auto;min-width:180px}.avatar{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,#d3a679,#7f5638);color:#fff;display:grid;place-items:center;font-weight:800;border:3px solid #f3eee9}.profile strong,.profile small{display:block}.profile strong{font-size:12px}.profile small{font-size:10px;color:var(--muted);margin-top:2px}
#page-root{padding:30px 28px 88px;max-width:1500px;margin:0 auto}.page-head{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:19px}.page-head h1{margin:0 0 6px;font-size:26px;letter-spacing:-.4px}.page-head p{margin:0;color:var(--muted);font-size:13px}.refresh-button{border:1px solid var(--line);background:#fff;border-radius:9px;padding:9px 12px;color:#3f5878;font-weight:700;display:flex;align-items:center;gap:7px}
.summary-grid{display:grid;grid-template-columns:1fr 1.45fr;gap:18px;margin-bottom:22px}.absence-card,.warning-card,.agenda-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.absence-card{padding:17px 19px}.summary-title{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:14px;color:#263b59}.absence-list{display:flex;gap:18px;flex-wrap:wrap}.absence-list>span{display:grid;grid-template-columns:10px auto;column-gap:7px;align-items:center}.absence-list i{width:7px;height:7px;background:#ef6c77;border-radius:50%;box-shadow:0 0 0 4px #fde9ec}.absence-list b{font-size:12px}.absence-list small{grid-column:2;font-size:10px;color:var(--muted);margin-top:1px}.muted{color:var(--muted);font-size:12px}
.warning-card{background:linear-gradient(90deg,#fffaf1,#fff7e7);border-color:#f3d8a7;padding:16px 18px;display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:12px}.warning-card.warning-clear{background:linear-gradient(90deg,#f5fbf8,#eefaf4);border-color:#c9e9d9}.warning-icon{color:var(--warning);display:grid;place-items:center}.warning-clear .warning-icon{color:var(--success)}.warning-card strong{font-size:13px}.warning-card p{margin:4px 0 0;font-size:11px;color:#5d6879}.warning-card button{border:1px solid #efcf96;background:#fff;border-radius:9px;padding:8px 13px;font-size:11px;font-weight:700;color:#4c5666}.warning-card button:disabled{opacity:.45;cursor:default}
.agenda-card{overflow:hidden}.agenda-table-head,.time-band-columns,.appointment-row{display:grid;grid-template-columns:92px minmax(170px,1.35fr) minmax(150px,1.15fr) minmax(120px,.9fr) minmax(120px,.9fr) 95px 150px 72px 110px;align-items:center;gap:8px}.agenda-table-head{padding:12px 14px;background:#f5f8fc;border-bottom:1px solid var(--line);font-size:9px;text-transform:uppercase;letter-spacing:.35px;color:#66768c;font-weight:800}.agenda-list{padding:10px;display:flex;flex-direction:column;gap:8px}.appointment-row{border:1px solid #e4e9f0;background:#fff;border-radius:12px;padding:11px 10px;min-height:76px;transition:box-shadow .15s,border-color .15s}.appointment-row:hover{border-color:#c9d8ec;box-shadow:0 8px 20px rgba(19,55,100,.06)}.appointment-row.cancelled{background:#fff7f7;border-color:#f2c7cb}
.time-box{width:78px;min-height:52px;background:#f2f7ff;border:1px solid #cfe1fb;border-radius:9px;display:grid;grid-template-columns:20px 1fr;align-items:center;padding:6px 7px;color:#1268cf}.time-box strong{font-size:12px;color:#213c62}.time-box small{grid-column:1/-1;text-align:center;color:#7c8aa0;font-size:9px;margin-top:-2px}.cancelled .time-box{background:#fff2f3;border-color:#f1c8cd;color:var(--danger)}
.patient-cell{display:flex;align-items:center;gap:9px;min-width:0}.patient-avatar{width:38px;height:38px;border-radius:50%;background:linear-gradient(145deg,#e9d4bd,#b48463);display:grid;place-items:center;color:white;font-weight:800;flex:0 0 auto}.patient-cell strong,.patient-cell small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.patient-cell strong{font-size:12px}.patient-cell small{font-size:9px;color:#8290a4;margin-top:3px}.field-select,.outcome-select,.price-input{width:100%;height:36px;border:1px solid transparent;border-radius:8px;background:transparent;color:#263b59;font-size:11px;font-weight:650;outline:0}.field-select:hover,.field-select:focus,.price-input-wrap:hover{border-color:#cad7e8;background:#f8fbff}.field-select:disabled,.price-input:disabled{color:#98a3b1;background:#f1f3f6}
.price-input-wrap{height:36px;border:1px solid transparent;border-radius:8px;display:flex;align-items:center;padding:0 4px;transition:.15s}.price-input-wrap span{font-size:11px;color:#617088}.price-input{border:0;padding:0 4px;min-width:0}.outcome-select{border:1px solid #c6dafa;background:#eff6ff;color:#1866c2;padding:0 8px}.status-chip{display:inline-flex;align-items:center;justify-content:center;min-height:30px;padding:6px 10px;border-radius:999px;font-size:10px;font-weight:800;white-space:nowrap;border:1px solid transparent}.outcome-eseguita,.census-censito{background:var(--success-bg);color:#188a58;border-color:#bfe9d2}.outcome-da-confermare{background:#edf5ff;color:#1670d5;border-color:#c8dffc}.outcome-assente,.census-non-censito,.census-non-disponibile{background:var(--neutral-bg);color:#6d788c;border-color:#d9e0e8}.outcome-annullata{background:var(--danger-bg);color:#cc3948;border-color:#f4c5ca}.outcome-non-conclusa,.census-da-verificare{background:var(--warning-bg);color:#c87300;border-color:#f4d69e}
.outcome-select.outcome-eseguita{background:var(--success-bg);color:#188a58;border-color:#bfe9d2}.outcome-select.outcome-da-confermare{background:#edf5ff;color:#1670d5;border-color:#c8dffc}.outcome-select.outcome-assente{background:var(--neutral-bg);color:#6d788c;border-color:#d9e0e8}.outcome-select.outcome-non-conclusa{background:var(--warning-bg);color:#c87300;border-color:#f4d69e}.history-cell,.census-cell{display:flex;justify-content:center}.history-button{width:34px;height:34px}.mobile-row-meta,.mobile-row-bottom{display:none}
.legend-row{display:flex;justify-content:center;gap:22px;padding:16px;color:#5e6f85;font-size:10px}.legend-row span{display:flex;align-items:center;gap:6px}.dot{width:8px;height:8px;border-radius:50%}.dot.green{background:var(--success)}.dot.blue{background:var(--primary)}.dot.orange{background:var(--warning)}.dot.gray{background:#96a0af}.dot.red{background:var(--danger)}.connection-line{text-align:center;color:#8390a4;font-size:9px;display:flex;justify-content:center;align-items:center;gap:5px}.empty-state{padding:50px;display:flex;flex-direction:column;align-items:center;gap:8px;color:#7f8da2}.empty-state strong{color:#3a4f6d}.empty-state span{font-size:11px}
.skeleton-block{display:grid;gap:10px}.skeleton-block span{height:74px;border-radius:12px;background:linear-gradient(90deg,#eef2f6 25%,#f7f9fb 50%,#eef2f6 75%);background-size:200% 100%;animation:shimmer 1.2s infinite}@keyframes shimmer{to{background-position:-200% 0}}.toast-region{position:fixed;right:22px;bottom:22px;z-index:100;display:flex;flex-direction:column;gap:8px;max-width:min(380px,calc(100vw - 32px))}.toast{background:#fff;border:1px solid var(--line);border-left:4px solid var(--primary);box-shadow:0 12px 28px rgba(20,43,73,.18);border-radius:10px;padding:11px 14px;font-size:12px}.toast.success{border-left-color:var(--success)}.toast.warning{border-left-color:var(--warning)}.toast.error{border-left-color:var(--danger)}
.mobile-bottom-nav,.mobile-topbar,.mobile-date-card{display:none}
@media (max-width:1250px){.agenda-table-head,.time-band-columns,.appointment-row{grid-template-columns:84px minmax(150px,1.25fr) minmax(130px,1fr) 110px 110px 82px 140px 58px 100px}.topbar{padding:0 18px}.profile{display:none}.date-navigator{min-width:275px}.search-box{display:none}}
@media (max-width:980px){:root{--sidebar:78px}.brand span:last-child,.nav-item span,.white-label-badge div,.env-chip{display:none}.brand{justify-content:center;padding-left:0;padding-right:0}.brand-mark{width:38px}.nav-item{justify-content:center;padding:13px}.sidebar{padding-left:10px;padding-right:10px}.white-label-badge{justify-content:center}.agenda-table-head,.time-band-columns{display:none}.appointment-row{grid-template-columns:82px minmax(155px,1.3fr) minmax(130px,1fr) minmax(110px,.8fr) 90px 135px 90px}.field-cell:nth-of-type(5),.history-cell{display:none}.summary-grid{grid-template-columns:1fr}}
@media (max-width:720px){body{background:#f2f5f8}.app-shell{display:block}.sidebar,.topbar{display:none}.content-shell{padding-bottom:72px}.mobile-topbar{height:70px;background:linear-gradient(180deg,#062553,#08316a);display:flex;align-items:center;justify-content:space-between;padding:env(safe-area-inset-top) 15px 0;color:#fff;position:sticky;top:0;z-index:30}.icon-button.ghost{background:transparent;border:0;color:#fff}.mobile-brand{font-size:17px;font-weight:760;display:flex;align-items:center;gap:8px}.brand-dot{width:28px;height:28px;border-radius:8px;font-size:9px}.mobile-date-icon{width:40px;display:flex;justify-content:center}#page-root{padding:12px 10px 92px}.page-head{display:none}.mobile-date-card{display:grid;grid-template-columns:1fr auto;gap:8px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:9px;margin-bottom:10px;box-shadow:0 4px 16px rgba(24,52,88,.04)}.mobile-date-main{border:0;background:transparent;text-align:left;font-size:12px;font-weight:800;color:var(--text);display:flex;align-items:center;justify-content:space-between;gap:8px}.mobile-date-card select{border:1px solid var(--line);background:#f8fafc;border-radius:8px;font-size:10px;color:#42536b;padding:0 7px;max-width:120px}.summary-grid{display:block;margin-bottom:10px}.absence-card{display:none}.warning-card{border-radius:11px;grid-template-columns:30px 1fr auto;padding:12px 10px;gap:8px;box-shadow:none}.warning-card strong{font-size:12px}.warning-card p{font-size:9px;line-height:1.35}.warning-card button{border:0;background:transparent;padding:5px;color:#6b778a;font-size:9px}.agenda-card{border:0;background:transparent;box-shadow:none;overflow:visible}.agenda-list{padding:0;gap:7px}.appointment-row{display:grid;grid-template-columns:58px 1fr auto;grid-template-areas:"time patient outcome" "time meta price";min-height:96px;border-radius:11px;padding:10px 9px;background:#fff;box-shadow:0 2px 8px rgba(25,52,87,.04);gap:4px 9px}.time-cell{grid-area:time;align-self:start}.time-box{width:54px;min-height:60px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:2px;padding:5px}.time-box .icon{display:none}.time-box strong{font-size:11px}.time-box small{font-size:8px}.patient-cell{grid-area:patient;align-self:start;gap:7px}.patient-avatar{width:32px;height:32px;font-size:11px}.patient-cell strong{font-size:11px}.patient-cell small{display:none}.field-cell,.price-cell,.history-cell,.census-cell,.outcome-cell{display:none!important}.mobile-row-meta{display:flex;grid-area:meta;flex-direction:column;gap:2px;min-width:0}.mobile-row-meta span{font-size:8.5px;color:#6d7c90;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-row-meta span:first-child{color:#344960;font-weight:650}.mobile-row-bottom{display:flex;grid-area:price;justify-content:flex-end;align-items:center;gap:7px;align-self:end}.mobile-row-bottom>span:first-child{font-size:9px;font-weight:800;color:#33465f}.mobile-row-bottom .status-chip{grid-area:outcome;min-height:23px;padding:4px 7px;font-size:8px;position:absolute;right:9px;top:9px}.appointment-row{position:relative}.legend-row,.connection-line{display:none}.mobile-bottom-nav{position:fixed;z-index:40;left:0;right:0;bottom:0;height:69px;padding-bottom:env(safe-area-inset-bottom);display:grid;grid-template-columns:repeat(4,1fr);background:#fff;border-top:1px solid var(--line);box-shadow:0 -6px 20px rgba(25,48,78,.06)}.mobile-bottom-nav a{color:#7b879a;text-decoration:none;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:9px}.mobile-bottom-nav a.active{color:var(--primary);font-weight:750}.toast-region{right:10px;bottom:82px}.skeleton-block span{height:90px}}
@media (max-width:380px){.mobile-date-card{grid-template-columns:1fr}.mobile-date-card select{max-width:none;height:32px}.warning-card p{display:none}}
.placeholder-page,.auth-blocked{max-width:720px;margin:8vh auto;background:#fff;border:1px solid var(--line);border-radius:18px;padding:40px;box-shadow:var(--shadow);text-align:center}.placeholder-page>span{display:inline-grid;place-items:center;width:46px;height:46px;border-radius:14px;background:var(--primary-soft);color:var(--primary);font-weight:900}.placeholder-page h1,.auth-blocked h1{font-size:28px;margin:18px 0 8px}.placeholder-page p,.auth-blocked p{color:var(--muted);line-height:1.6}.placeholder-page a{display:inline-block;margin-top:14px;background:var(--primary);color:#fff;text-decoration:none;padding:10px 14px;border-radius:10px;font-weight:750;font-size:13px}
.staging-login{max-width:340px;margin:22px auto 0;display:grid;gap:13px;text-align:left}.staging-login label{display:grid;gap:6px;color:var(--muted);font-size:11px;font-weight:750}.staging-login select,.staging-login input{height:42px;border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--text);padding:0 10px}.staging-login button{width:100%}.staging-login [aria-live]{min-height:18px;color:var(--danger);font-size:11px;text-align:center}.logout-button{width:100%;margin-top:10px;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.08);color:#fff;border-radius:8px;padding:8px;font-size:11px;font-weight:750}.logout-button:hover{background:rgba(255,255,255,.15)}
/* OP07 — Patients / patient detail */
.patients-page,.patient-detail-page{max-width:1380px;margin:0 auto}.patients-head{display:flex;justify-content:space-between;align-items:flex-end;margin-bottom:18px}.patients-head h1,.patient-profile h1{margin:0;color:var(--text)}.patients-head p{margin:5px 0 0;color:var(--muted);font-size:13px}.patient-toolbar{display:flex;gap:12px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:16px;box-shadow:var(--shadow)}.patient-search{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:10px;padding:0 12px;min-height:42px;flex:1}.patient-search input{border:0;outline:0;width:100%}.patient-toolbar select,.history-filters select{border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 12px}.patient-table{background:#fff;border:1px solid var(--line);border-radius:14px;overflow:hidden;box-shadow:var(--shadow)}.patient-table-head,.patient-row{display:grid;grid-template-columns:minmax(220px,1.5fr) minmax(150px,1fr) 130px minmax(160px,1fr) 130px 24px;align-items:center;gap:12px;padding:12px 16px}.patient-table-head{background:#f8fafc;color:#65758b;font-size:10px;font-weight:800;text-transform:uppercase;border-bottom:1px solid var(--line)}.patient-row{width:100%;border:0;border-bottom:1px solid var(--line);background:#fff;text-align:left;color:var(--text)}.patient-row:last-child{border-bottom:0}.patient-row:hover,.patient-row:focus-visible{background:#f8fbff;outline:none;box-shadow:inset 3px 0 0 var(--primary)}.patient-main{display:grid;grid-template-columns:40px 1fr;grid-template-rows:auto auto;column-gap:10px;align-items:center}.patient-main .patient-initials{grid-row:1/3}.patient-main b{font-size:12px}.patient-main small{font-size:9px;color:var(--muted)}.patient-initials,.detail-avatar{font-style:normal;background:linear-gradient(145deg,#ddeaf8,#91b6dc);color:#123b67;display:grid;place-items:center;font-weight:800;border-radius:50%}.patient-initials{width:38px;height:38px}.patient-footer{display:flex;justify-content:space-between;align-items:center;padding:14px 4px;color:var(--muted);font-size:11px}.secondary-button,.primary-button{border:1px solid var(--line);border-radius:9px;padding:9px 12px;background:#fff;color:var(--text);font-weight:700}.primary-button{background:var(--primary);color:#fff;border-color:var(--primary)}.patient-mobile-list{display:none}.patient-loading{display:grid;gap:9px}.patient-loading span{height:72px;border-radius:12px;background:linear-gradient(90deg,#eef2f6 25%,#fafbfd 50%,#eef2f6 75%);background-size:200% 100%;animation:shimmer 1.2s infinite}.patient-empty,.patient-error{background:#fff;border:1px solid var(--line);border-radius:14px;padding:42px;display:flex;flex-direction:column;gap:8px;align-items:center;color:var(--muted);text-align:center}.patient-error strong,.patient-empty strong{color:var(--text)}
.back-link{display:inline-block;margin-bottom:12px;color:var(--primary);text-decoration:none;font-size:12px;font-weight:800}.patient-profile{background:#fff;border:1px solid var(--line);border-radius:15px;padding:18px;display:grid;grid-template-columns:86px 1fr auto;gap:16px;align-items:center;box-shadow:var(--shadow)}.detail-avatar{width:82px;height:82px;font-size:24px}.patient-profile h1{font-size:24px}.patient-profile p{margin:5px 0;color:var(--muted);font-size:12px}.contact-line{display:flex;gap:16px;flex-wrap:wrap;font-size:11px;color:#44607d}.patient-tabs{display:flex;gap:8px;border-bottom:1px solid var(--line);margin:18px 0}.patient-tabs button{border:0;background:transparent;padding:12px 14px;color:#748198}.patient-tabs button.active{color:var(--primary);font-weight:800;border-bottom:2px solid var(--primary)}.patient-tabs button:disabled{opacity:.42;cursor:not-allowed}.patient-detail-grid{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:18px}.history-panel,.patient-summary{background:#fff;border:1px solid var(--line);border-radius:15px;box-shadow:var(--shadow)}.history-panel{padding:16px}.history-head h2,.patient-summary h2{margin:0;font-size:16px}.history-head p{margin:5px 0 0;color:var(--muted);font-size:11px}.history-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:end;margin:15px 0}.history-filters button{border:1px solid var(--line);background:#fff;border-radius:8px;padding:8px 10px;font-size:10px}.history-filters .primary-button{background:var(--primary);color:#fff}.history-filters label{font-size:9px;color:var(--muted);display:grid;gap:3px}.history-filters input{border:1px solid var(--line);border-radius:8px;padding:7px}.history-list{border-top:1px solid var(--line)}.history-row{display:grid;grid-template-columns:105px minmax(180px,1.4fr) minmax(130px,1fr) 130px 100px;gap:10px;align-items:center;padding:12px 4px;border-bottom:1px solid var(--line)}.history-row b,.history-row small{display:block}.history-row b{font-size:11px}.history-row small{font-size:9px;color:var(--muted);margin-top:3px}.patient-summary{padding:16px;height:max-content}.summary-kpi{border:1px solid var(--line);border-radius:10px;padding:12px;margin-top:10px}.summary-kpi span{display:block;color:var(--muted);font-size:10px}.summary-kpi strong{display:block;font-size:18px;margin-top:4px}.summary-note{margin-top:12px;padding:11px;border-radius:9px;background:#fff8e9;color:#9c6500;font-size:10px;line-height:1.45}
@media(max-width:980px){.patient-table-head,.patient-row{grid-template-columns:minmax(200px,1.5fr) minmax(150px,1fr) 120px 120px}.patient-table-head span:nth-child(4),.patient-table-head span:nth-child(6),.patient-row>span:nth-child(4),.patient-row>span:nth-child(6){display:none}.patient-detail-grid{grid-template-columns:1fr}.patient-summary{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.patient-summary h2,.summary-note{grid-column:1/-1}.summary-kpi{margin:0}}
@media(max-width:720px){.patients-page,.patient-detail-page{max-width:none}.patients-head{margin:4px 2px 12px}.patients-head h1{font-size:20px}.patients-head p{font-size:10px}.patient-toolbar{padding:8px;box-shadow:none;position:sticky;top:0;z-index:5}.patient-toolbar select{max-width:135px;font-size:10px}.patient-table{display:none}.patient-mobile-list{display:grid;gap:8px}.patient-card{display:grid;grid-template-columns:40px 1fr auto 14px;gap:9px;align-items:center;width:100%;border:1px solid var(--line);border-radius:12px;background:#fff;padding:10px;text-align:left;color:var(--text);box-shadow:0 2px 9px rgba(25,52,87,.04)}.patient-card-body b,.patient-card-body small{display:block}.patient-card-body b{font-size:11px}.patient-card-body small{font-size:8.5px;color:var(--muted);margin-top:2px}.patient-card .status-chip{font-size:7.5px;padding:4px 6px;min-height:22px}.patient-profile{grid-template-columns:60px 1fr auto;padding:12px}.detail-avatar{width:58px;height:58px;font-size:18px}.patient-profile h1{font-size:18px}.patient-profile p{font-size:9px}.contact-line{gap:8px;font-size:9px}.patient-tabs{overflow:auto;white-space:nowrap;margin:12px 0}.patient-tabs button{padding:10px 9px;font-size:9px}.patient-detail-grid{display:block}.history-panel{border:0;box-shadow:none;padding:0;background:transparent}.history-head{background:#fff;border:1px solid var(--line);padding:11px;border-radius:11px}.history-filters{background:#fff;border:1px solid var(--line);padding:8px;border-radius:11px}.history-row{grid-template-columns:78px 1fr auto;grid-template-areas:'date main money' 'status therapist money';background:#fff;border:1px solid var(--line);border-radius:10px;margin-bottom:7px;padding:10px}.history-row>span:nth-child(1){grid-area:date}.history-row>span:nth-child(2){grid-area:main}.history-row>span:nth-child(3){grid-area:therapist}.history-row>span:nth-child(4){grid-area:status}.history-row>span:nth-child(5){grid-area:money}.patient-summary{margin-top:12px;grid-template-columns:1fr 1fr}.summary-kpi strong{font-size:15px}.patient-error,.patient-empty{padding:28px 16px}.back-link{margin-top:3px}}
/* OP08 — Economic management (non-fiscal, read-only) */
.economic-page{max-width:1440px;margin:0 auto}.economic-readonly{font-size:9px;letter-spacing:.7px;font-weight:900;color:#477091;background:#edf5fb;border:1px solid #d3e3ef;border-radius:999px;padding:6px 9px}.economic-toolbar{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr)) minmax(180px,1.4fr) auto;gap:10px;align-items:end;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:16px;box-shadow:var(--shadow)}.economic-toolbar label{display:grid;gap:5px;color:var(--muted);font-size:9px;font-weight:800;text-transform:uppercase}.economic-toolbar input,.economic-toolbar select{height:39px;border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--text);padding:0 9px;min-width:0;font-size:11px}.economic-kpis{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;margin-bottom:16px}.economic-kpi{background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px;box-shadow:0 5px 16px rgba(20,52,90,.04);min-width:0}.economic-kpi span{font-size:10px;color:#586b83;font-weight:750}.economic-kpi strong{display:block;font-size:21px;margin:9px 0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.economic-kpi small{font-size:8.5px;color:var(--muted);line-height:1.3}.economic-kpi.blue{border-top:3px solid #3a8cff}.economic-kpi.green{border-top:3px solid var(--success)}.economic-kpi.red{border-top:3px solid var(--danger)}.economic-kpi.amber{border-top:3px solid var(--warning)}.economic-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(310px,.85fr);gap:14px}.economic-list-panel,.economic-summary-card{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}.economic-list-panel>header{padding:15px 16px;border-bottom:1px solid var(--line)}.economic-list-panel h2,.economic-summary-card h2{font-size:14px;margin:0}.economic-list-panel p,.economic-summary-card p{font-size:9.5px;color:var(--muted);margin:4px 0 0}.economic-table-head,.economic-row{display:grid;grid-template-columns:100px minmax(155px,1.1fr) minmax(190px,1.45fr) 130px 120px;gap:10px;align-items:center}.economic-table-head{padding:10px 14px;background:#f7f9fc;color:#718096;font-size:8.5px;text-transform:uppercase;font-weight:850}.economic-row{padding:12px 14px;border-top:1px solid var(--line);min-height:65px}.economic-row b,.economic-row small{display:block}.economic-row b{font-size:10.5px}.economic-row small{font-size:8.5px;color:var(--muted);margin-top:3px}.eco-money{font-weight:850;font-size:11px}.economic-pager{display:flex;justify-content:flex-end;padding:12px;border-top:1px solid var(--line)}.economic-side{display:grid;gap:12px;align-content:start}.economic-summary-card{padding:14px}.economic-summary-card small{display:block;color:var(--muted);font-size:8.5px;line-height:1.45;margin-top:10px}.eco-total{display:flex;justify-content:space-between;gap:8px;margin-top:10px;font-size:10px}.eco-break-head,.eco-break-row{display:grid;grid-template-columns:minmax(90px,1fr) 34px 86px 86px;gap:7px;align-items:center}.eco-break-head{font-size:7px;text-transform:uppercase;color:var(--muted);padding:10px 0 6px}.eco-break-row{padding:7px 0;border-top:1px solid #edf1f5;font-size:8.5px}.eco-break-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.eco-break-row b,.eco-break-row strong,.eco-break-row em{text-align:right;font-style:normal;font-weight:750}.economic-loading{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.economic-loading span{height:110px;border-radius:13px;background:linear-gradient(90deg,#eef2f6 25%,#fafbfd 50%,#eef2f6 75%);background-size:200% 100%;animation:shimmer 1.2s infinite}
@media(max-width:1180px){.economic-toolbar{grid-template-columns:repeat(3,1fr)}.economic-kpis{grid-template-columns:repeat(3,1fr)}.economic-layout{grid-template-columns:1fr}.economic-side{grid-template-columns:repeat(2,1fr)}}
@media(max-width:720px){.economic-page{max-width:none}.economic-toolbar{grid-template-columns:1fr 1fr;padding:9px;box-shadow:none}.economic-toolbar label{font-size:7.5px}.economic-toolbar .eco-patient-filter{grid-column:1/-1}.economic-toolbar button{grid-column:1/-1}.economic-kpis{grid-template-columns:1fr;gap:7px}.economic-kpi{padding:11px}.economic-kpi strong{font-size:18px}.economic-layout{display:block}.economic-table-head{display:none}.economic-row{grid-template-columns:75px 1fr auto;grid-template-areas:'date patient status' 'date treatment money';gap:7px;background:#fff;border:1px solid var(--line);border-radius:10px;margin:0 0 7px;padding:10px}.economic-list{padding:8px;background:#f6f8fb}.economic-row>span:nth-child(1){grid-area:date}.economic-row>span:nth-child(2){grid-area:patient}.economic-row>span:nth-child(3){grid-area:treatment}.economic-row>span:nth-child(4){grid-area:money;text-align:right}.economic-row>span:nth-child(5){grid-area:status;text-align:right}.economic-list-panel{border:0;box-shadow:none;background:transparent}.economic-list-panel>header{background:#fff;border:1px solid var(--line);border-radius:11px;margin-bottom:7px}.economic-side{display:grid;grid-template-columns:1fr;margin-top:10px}.economic-summary-card{box-shadow:none}.economic-loading{grid-template-columns:1fr}.mobile-bottom-nav{grid-template-columns:repeat(5,1fr)}}

/* OP16 UI recovery - V3-style operational compactness */
.top-action{text-decoration:none}
.v3-ops-strip{display:flex;align-items:center;gap:14px;flex-wrap:wrap;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 14px;margin-bottom:14px;box-shadow:0 4px 14px rgba(22,52,88,.04);font-size:12px}
.v3-ops-strip strong{color:#263b59;font-size:13px}
.v3-ops-strip span{display:inline-flex;align-items:center;gap:6px;color:#5c6e85;font-weight:750}
.print-link{margin-left:auto;border:1px solid var(--line);background:#f8fafc;color:#334960;border-radius:9px;padding:7px 10px;font-weight:800;font-size:11px}
.summary-note{background:#eef8f2;color:#21744c}
.mobile-bottom-nav{grid-template-columns:repeat(3,1fr)!important}
.agenda-card{background:#f5f8fc;border-color:#d8e1ed}
.agenda-table-head{background:#eef3fa;border-color:#d8e1ed}
.agenda-list{background:#f4f7fb;padding:12px;gap:14px}
.time-band{border:1px solid #d5dfeb;border-radius:13px;background:#fff;overflow:hidden;box-shadow:0 4px 14px rgba(25,52,87,.035)}
.time-band-head{min-height:40px;background:#203f70;color:#fff;display:flex;align-items:center;gap:10px;padding:8px 14px}
.time-band-head strong{font-size:14px;font-weight:850;letter-spacing:.1px}
.time-band-head span{margin-left:auto;background:#5275a8;color:#fff;border-radius:999px;padding:4px 9px;font-size:11px;font-weight:800}
.time-band-head em{font-style:normal;background:#d83333;color:#fff;border-radius:999px;padding:4px 9px;font-size:11px;font-weight:800}
.time-band-columns{padding:7px 10px 6px;background:#f5f8fc;border-bottom:1px solid #dfe6ef;font-size:9px;text-transform:uppercase;letter-spacing:.35px;color:#66768c;font-weight:800}
.time-band-columns span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.time-band-rows{display:flex;flex-direction:column;gap:8px;padding:10px}
.appointment-row{box-shadow:none}
.appointment-row.census-state-censito{background:#edf7ef;border-color:#cfe4d2;border-left:5px solid #23a66d}
.appointment-row.census-state-non-censito{background:#fff1f2;border-color:#f2ccd0;border-left:5px solid #df4657}
.appointment-row.census-state-da-verificare{background:#fff7e6;border-color:#efd59c;border-left:5px solid #ed8a00}
.appointment-row.census-state-unavailable{background:#f3f5f8;border-color:#dce3ec;border-left:5px solid #8c98aa}
.appointment-row.census-state-censito .patient-avatar{background:linear-gradient(145deg,#a8d9b9,#2fa86e)}
.appointment-row.census-state-non-censito .patient-avatar{background:linear-gradient(145deg,#e6c5bd,#c99670)}
.appointment-row.census-state-da-verificare .patient-avatar{background:linear-gradient(145deg,#f1d7a6,#d0932e)}
.patient-table{background:#f7f4ec;border-color:#ded7c8}
.patient-table-head{background:#eee9dd;color:#596573;border-color:#ded7c8}
.patient-row,.patient-card{background:#f4f0e7;border-color:#ddd5c5}
.patient-row:has(.census-censito),.patient-card:has(.census-censito){background:#eef4ea;border-color:#d4dfcd}
.patient-row:has(.census-da-verificare),.patient-card:has(.census-da-verificare){background:#f6efe2;border-color:#e2d5bd}
.patient-row:hover,.patient-row:focus-visible{background:#eaf1e6;box-shadow:inset 3px 0 0 #91a987}
.patient-card:hover,.patient-card:focus-visible{background:#eaf1e6;outline:none;box-shadow:inset 3px 0 0 #91a987,0 5px 15px rgba(66,83,58,.08)}
.patient-initials,.detail-avatar{background:linear-gradient(145deg,#edf2ea,#c8d7c1);color:#314834}
.patient-card .census-censito,.patient-row .census-censito,.patient-profile .census-censito{background:#eef5ec;color:#4b6f45;border-color:#d6e4d0}
.patient-card .census-da-verificare,.patient-row .census-da-verificare,.patient-profile .census-da-verificare{background:#f7f3ea;color:#846b39;border-color:#e6dcc7}
.patient-card .status-chip,.patient-row .status-chip,.patient-profile .status-chip{font-weight:750}
.patient-profile{background:#f4f0e7;border-color:#ddd5c5}
.patient-summary,.history-panel{background:#fff9ef;border-color:#e5dccb}
.summary-kpi{background:#fbfaf6;border-color:#e6e0d4}
.summary-note{background:#f1f5ee;color:#5d7458;border:1px solid #dbe6d5}
@media(max-width:720px){.v3-ops-strip{margin:0 0 10px;padding:9px 10px;gap:8px;font-size:10px}.v3-ops-strip strong{width:100%;font-size:12px}.print-link{margin-left:0;padding:6px 8px}.mobile-bottom-nav{grid-template-columns:repeat(3,1fr)!important}}
/* OP08 — Economic management (non-fiscal, read-only) */
.economic-page{max-width:1440px;margin:0 auto}.economic-readonly{font-size:9px;letter-spacing:.7px;font-weight:900;color:#477091;background:#edf5fb;border:1px solid #d3e3ef;border-radius:999px;padding:6px 9px}.economic-toolbar{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr)) minmax(180px,1.4fr) auto;gap:10px;align-items:end;background:#fff;border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:16px;box-shadow:var(--shadow)}.economic-toolbar label{display:grid;gap:5px;color:var(--muted);font-size:9px;font-weight:800;text-transform:uppercase}.economic-toolbar input,.economic-toolbar select{height:39px;border:1px solid var(--line);border-radius:9px;background:#fff;color:var(--text);padding:0 9px;min-width:0;font-size:11px}.economic-kpis{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;margin-bottom:16px}.economic-kpi{background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px;box-shadow:0 5px 16px rgba(20,52,90,.04);min-width:0}.economic-kpi span{font-size:10px;color:#586b83;font-weight:750}.economic-kpi strong{display:block;font-size:21px;margin:9px 0 5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.economic-kpi small{font-size:8.5px;color:var(--muted);line-height:1.3}.economic-kpi.blue{border-top:3px solid #3a8cff}.economic-kpi.green{border-top:3px solid var(--success)}.economic-kpi.red{border-top:3px solid var(--danger)}.economic-kpi.amber{border-top:3px solid var(--warning)}.economic-layout{display:grid;grid-template-columns:minmax(0,2fr) minmax(310px,.85fr);gap:14px}.economic-list-panel,.economic-summary-card{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}.economic-list-panel>header{padding:15px 16px;border-bottom:1px solid var(--line)}.economic-list-panel h2,.economic-summary-card h2{font-size:14px;margin:0}.economic-list-panel p,.economic-summary-card p{font-size:9.5px;color:var(--muted);margin:4px 0 0}.economic-table-head,.economic-row{display:grid;grid-template-columns:100px minmax(155px,1.1fr) minmax(190px,1.45fr) 130px 120px;gap:10px;align-items:center}.economic-table-head{padding:10px 14px;background:#f7f9fc;color:#718096;font-size:8.5px;text-transform:uppercase;font-weight:850}.economic-row{padding:12px 14px;border-top:1px solid var(--line);min-height:65px}.economic-row b,.economic-row small{display:block}.economic-row b{font-size:10.5px}.economic-row small{font-size:8.5px;color:var(--muted);margin-top:3px}.eco-money{font-weight:850;font-size:11px}.economic-pager{display:flex;justify-content:flex-end;padding:12px;border-top:1px solid var(--line)}.economic-side{display:grid;gap:12px;align-content:start}.economic-summary-card{padding:14px}.economic-summary-card small{display:block;color:var(--muted);font-size:8.5px;line-height:1.45;margin-top:10px}.eco-total{display:flex;justify-content:space-between;gap:8px;margin-top:10px;font-size:10px}.eco-break-head,.eco-break-row{display:grid;grid-template-columns:minmax(90px,1fr) 34px 86px 86px;gap:7px;align-items:center}.eco-break-head{font-size:7px;text-transform:uppercase;color:var(--muted);padding:10px 0 6px}.eco-break-row{padding:7px 0;border-top:1px solid #edf1f5;font-size:8.5px}.eco-break-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.eco-break-row b,.eco-break-row strong,.eco-break-row em{text-align:right;font-style:normal;font-weight:750}.economic-loading{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.economic-loading span{height:110px;border-radius:13px;background:linear-gradient(90deg,#eef2f6 25%,#fafbfd 50%,#eef2f6 75%);background-size:200% 100%;animation:shimmer 1.2s infinite}
@media(max-width:1180px){.economic-toolbar{grid-template-columns:repeat(3,1fr)}.economic-kpis{grid-template-columns:repeat(3,1fr)}.economic-layout{grid-template-columns:1fr}.economic-side{grid-template-columns:repeat(2,1fr)}}
@media(max-width:720px){.economic-page{max-width:none}.economic-toolbar{grid-template-columns:1fr 1fr;padding:9px;box-shadow:none}.economic-toolbar label{font-size:7.5px}.economic-toolbar .eco-patient-filter{grid-column:1/-1}.economic-toolbar button{grid-column:1/-1}.economic-kpis{grid-template-columns:1fr;gap:7px}.economic-kpi{padding:11px}.economic-kpi strong{font-size:18px}.economic-layout{display:block}.economic-table-head{display:none}.economic-row{grid-template-columns:75px 1fr auto;grid-template-areas:'date patient status' 'date treatment money';gap:7px;background:#fff;border:1px solid var(--line);border-radius:10px;margin:0 0 7px;padding:10px}.economic-list{padding:8px;background:#f6f8fb}.economic-row>span:nth-child(1){grid-area:date}.economic-row>span:nth-child(2){grid-area:patient}.economic-row>span:nth-child(3){grid-area:treatment}.economic-row>span:nth-child(4){grid-area:money;text-align:right}.economic-row>span:nth-child(5){grid-area:status;text-align:right}.economic-list-panel{border:0;box-shadow:none;background:transparent}.economic-list-panel>header{background:#fff;border:1px solid var(--line);border-radius:11px;margin-bottom:7px}.economic-side{display:grid;grid-template-columns:1fr;margin-top:10px}.economic-summary-card{box-shadow:none}.economic-loading{grid-template-columns:1fr}.mobile-bottom-nav{grid-template-columns:repeat(5,1fr)}}

/* OP16 native controls: today + direct pagination */
.today-button{border:0;border-left:1px solid var(--line);background:#f7faff;color:var(--primary);font-weight:800;padding:0 14px;height:44px;cursor:pointer;white-space:nowrap}
.today-button:hover{background:#eaf4ff}
.pagination-controls{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap}
.patient-footer .pagination-controls{margin-left:auto}
.page-counter{color:var(--text);font-size:12px;white-space:nowrap}
.page-jump{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;font-weight:700;white-space:nowrap}
.page-number-input{width:68px;height:36px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text);padding:0 8px;font:inherit}
.pagination-controls .secondary-button:disabled{opacity:.45;cursor:not-allowed}
.history-pagination{margin-top:12px;padding-top:12px;border-top:1px solid var(--line)}
@media(max-width:760px){
  .today-button{padding:0 10px;height:40px}
  .pagination-controls{justify-content:center;width:100%}
  .patient-footer{gap:10px;flex-wrap:wrap}
  .patient-footer>span:first-child{width:100%;text-align:center}
}

/* OP16 V2 historical daily agenda */
.appointment-row.historical-readonly .field-select:disabled,
.appointment-row.historical-readonly .price-input:disabled{opacity:1;color:var(--text);-webkit-text-fill-color:var(--text);background:#f8fafc}
.appointment-row.historical-readonly{cursor:default}

/* OP16 V3 — canonical/clean patient names + restored date picker */
.date-navigator{position:relative}
.date-display{cursor:pointer}
.agenda-date-picker{
  position:absolute;
  left:50%;
  top:100%;
  width:1px;
  height:1px;
  opacity:0;
  border:0;
  padding:0;
  pointer-events:none;
}
.mobile-date-main{cursor:pointer}

/* OP16 V4 — patient contact + treatment-category emoji */
.patient-contact-main{min-width:0}
.patient-contact-main strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.patient-emoji{margin-left:3px;font-size:13px;vertical-align:baseline}
.patient-phone-link{
  display:inline-flex!important;
  align-items:center;
  gap:3px;
  margin-top:3px;
  color:#315f92!important;
  font-size:10px!important;
  font-weight:750;
  text-decoration:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}
.patient-phone-link:hover{text-decoration:underline;color:#0d6efd!important}
.patient-phone-text{display:block;margin-top:3px;color:#315f92!important}
.contact-line .patient-phone-link{font-size:inherit!important;margin-top:0}
@media(max-width:760px){
  .patient-phone-link{font-size:11px!important;min-height:24px}
}

/* OP16 V5 — full canonical patient name visible */
.patient-cell{align-items:flex-start}
.patient-contact-main{min-width:0;max-width:100%;padding-top:1px}
.patient-contact-main strong,
.patient-cell .patient-contact-main strong{
  display:block;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.18;
  max-width:100%;
}
.patient-contact-main .patient-phone-link{
  margin-top:4px;
}
@media(min-width:900px){
  .appointment-row{grid-template-columns:92px minmax(190px,1.5fr) minmax(145px,1.08fr) minmax(115px,.86fr) minmax(115px,.86fr) 92px 145px 68px 106px}
}

/* OP16 V14 economic consistency */
.eco-period-note{font-size:9px;color:var(--muted);font-weight:600}

/* OP16 V16 — PosturalLAB Manager product identity */
.white-label-badge .product-compact-logo{flex:0 0 34px}
.product-version-chip{margin-top:10px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;min-height:32px!important;width:100%!important;padding:0 11px!important;border-radius:999px!important;font-size:10px!important;font-weight:800!important;letter-spacing:.15px!important;cursor:pointer;user-select:none;transition:background .16s ease,border-color .16s ease,color .16s ease}
.product-version-chip:hover,.product-version-chip:focus-visible{background:rgba(255,255,255,.16);border-color:rgba(255,255,255,.28);color:#fff;outline:none}
.product-info-overlay{position:fixed;inset:0;z-index:1000;background:rgba(4,20,44,.46);display:grid;place-items:center;padding:20px;backdrop-filter:blur(4px)}
.product-info-dialog{width:min(460px,calc(100vw - 32px));background:#fff;border:1px solid #dbe4ef;border-radius:16px;box-shadow:0 24px 70px rgba(7,31,65,.25);padding:18px;color:#142c4a}
.product-info-head{display:grid;grid-template-columns:42px 1fr auto;gap:11px;align-items:center;padding-bottom:14px;border-bottom:1px solid #e4eaf1}
.product-info-logo{width:40px;height:40px;border-radius:11px}
.product-info-head strong{display:block;font-size:16px}
.product-info-head small{display:block;margin-top:2px;color:#708096;font-size:10px}
.product-info-close{width:34px;height:34px;border:1px solid #dfe6ef;border-radius:9px;background:#fff;color:#496078;font-size:22px;line-height:1;cursor:pointer}
.product-info-close:hover{background:#f5f8fb}
.product-info-grid{display:grid;gap:0;margin:14px 0 0}
.product-info-grid>div{display:grid;grid-template-columns:1fr minmax(150px,1.2fr);gap:12px;padding:9px 0;border-bottom:1px solid #eef2f6}
.product-info-grid dt{font-size:11px;color:#708096}
.product-info-grid dd{margin:0;text-align:right;font-size:11px;font-weight:750;color:#183755;overflow-wrap:anywhere}
.product-info-note{margin:13px 0 0;font-size:9px;line-height:1.45;color:#7a8899}
@media(max-width:980px){.sidebar-foot .product-version-chip{display:none}}


/* OP16 V17 — original header logo + compact footer icon + app icon */
.brand.brand-has-image{display:block;padding:8px 6px 18px;min-height:auto}
.sidebar-brand-image{display:block;width:100%;max-width:228px;height:auto;object-fit:contain}
.white-label-badge .product-compact-image{width:34px;height:34px;flex:0 0 34px;border-radius:10px;object-fit:contain;background:transparent;box-shadow:none}
.product-info-logo{width:40px;height:40px;border-radius:12px;object-fit:contain;background:transparent}
@media (max-width:980px){.sidebar .brand.brand-has-image{display:flex;justify-content:center;padding-left:0;padding-right:0}.sidebar-brand-image{max-width:44px}}


/* OP16 V18 desktop isolation */
.mobile-row-actions{display:none}

/* OP16 V18 — MOBILE-FIRST FOUNDATION
   Smartphone is the primary operating surface. Desktop behavior remains intact. */
@media (max-width:720px){
  html{font-size:16px;-webkit-text-size-adjust:100%}
  body{background:#f3f6fa;overscroll-behavior-y:none}
  .content-shell{padding-bottom:calc(78px + env(safe-area-inset-bottom))}
  #page-root{padding:10px 10px calc(96px + env(safe-area-inset-bottom));max-width:none}

  /* Mobile app header */
  .mobile-topbar{
    height:calc(58px + env(safe-area-inset-top));
    padding:env(safe-area-inset-top) 12px 0;
    background:linear-gradient(180deg,#062553,#082d62);
    box-shadow:0 4px 14px rgba(3,30,68,.14)
  }
  .mobile-brand{font-size:15px;gap:8px}
  .mobile-brand .brand-dot{width:30px;height:30px}
  .mobile-date-icon{width:38px}

  /* Agenda: date/studio always available */
  .mobile-date-card{
    position:sticky;top:0;z-index:18;
    grid-template-columns:minmax(0,1fr) 120px;
    gap:8px;margin:0 0 10px;padding:8px;
    border-radius:13px;box-shadow:0 7px 20px rgba(25,52,87,.09)
  }
  .mobile-date-main{min-height:42px;font-size:13px;padding:0 5px}
  .mobile-date-card select{height:42px;max-width:none;font-size:11px;font-weight:750;padding:0 8px}

  /* Operational summary: compact, horizontal, thumb friendly */
  .v3-ops-strip{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px!important;padding:8px!important;margin-bottom:9px!important;
    border-radius:12px!important
  }
  .v3-ops-strip strong{grid-column:1/-1;width:auto!important;font-size:12px!important}
  .v3-ops-strip span{
    min-height:30px;justify-content:center;
    border-radius:9px;background:#f6f8fb;padding:5px 4px;
    font-size:9px!important;text-align:center
  }
  .v3-ops-strip .print-link{display:none}

  .summary-grid{margin-bottom:9px}
  .warning-card{min-height:58px;padding:9px 10px;border-radius:12px}
  .warning-card strong{font-size:11px}
  .warning-card p{font-size:9px}
  .warning-card button{min-height:36px;padding:0 8px}

  /* Agenda is a stack of touch cards, grouped by time band */
  .agenda-list{gap:10px;background:transparent}
  .time-band{border:0;border-radius:13px;overflow:visible;box-shadow:none;background:transparent}
  .time-band-head{
    position:sticky;top:60px;z-index:12;
    min-height:38px;padding:7px 10px;border-radius:11px 11px 0 0;
    box-shadow:0 3px 10px rgba(18,48,88,.13)
  }
  .time-band-head strong{font-size:13px}
  .time-band-head span,.time-band-head em{font-size:9px;padding:4px 7px}
  .time-band-rows{padding:7px 0 0;gap:8px}

  .appointment-row{
    display:grid!important;
    grid-template-columns:58px minmax(0,1fr) auto;
    grid-template-areas:
      "time patient status"
      "time meta price"
      "actions actions actions";
    min-height:118px;
    padding:10px 9px 9px;
    gap:5px 9px;
    border-radius:13px!important;
    box-shadow:0 4px 13px rgba(25,52,87,.065)!important
  }
  .appointment-row.census-state-censito,
  .appointment-row.census-state-non-censito,
  .appointment-row.census-state-da-verificare,
  .appointment-row.census-state-unavailable{border-left-width:4px}

  .time-cell{grid-area:time}
  .time-box{width:54px;min-height:64px;border-radius:10px}
  .time-box strong{font-size:12px}
  .time-box small{font-size:8px}
  .patient-cell{grid-area:patient;gap:7px;min-width:0;padding-right:2px}
  .patient-avatar{width:34px;height:34px;font-size:11px}
  .patient-contact-main strong{font-size:12px!important;line-height:1.22!important}
  .patient-phone-link{font-size:11px!important;min-height:27px;margin-top:5px!important}
  .patient-emoji{font-size:14px}

  .mobile-row-meta{grid-area:meta;display:flex!important;gap:3px}
  .mobile-row-meta span{font-size:9.5px!important;line-height:1.25}
  .mobile-row-meta span:first-child{font-size:10px!important}
  .mobile-row-bottom{grid-area:price;display:flex!important;align-self:center}
  .mobile-row-bottom>span:first-child{font-size:10px!important}
  .mobile-row-bottom .status-chip{font-size:8px!important;min-height:24px!important;top:9px;right:8px}

  /* Primary actions are no longer hidden on mobile */
  .mobile-row-actions{
    grid-area:actions;
    display:grid;
    grid-template-columns:minmax(92px,1fr) minmax(0,1.2fr) minmax(92px,1fr);
    gap:7px;
    align-items:center;
    padding-top:8px;
    margin-top:3px;
    border-top:1px solid rgba(126,145,169,.18)
  }
  .mobile-row-actions button{
    min-height:40px;border:1px solid #cfdae8;border-radius:10px;
    background:#fff;color:#23405f;font-size:10px;font-weight:800;
    display:flex;align-items:center;justify-content:center;gap:6px;padding:0 8px
  }
  .mobile-row-actions button:active{transform:translateY(1px)}
  .mobile-history-button{color:#176ac4!important;background:#f4f9ff!important;border-color:#cfe1f6!important}
  .mobile-edit-toggle{color:#fff!important;background:#147df0!important;border-color:#147df0!important}
  .mobile-census-chip{display:flex;justify-content:center;min-width:0}
  .mobile-census-chip .status-chip{font-size:8px;min-height:28px;max-width:100%;padding:5px 7px;overflow:hidden;text-overflow:ellipsis}

  /* Desktop cells stay hidden until the operator taps Modifica */
  .appointment-row>.field-cell,
  .appointment-row>.price-cell,
  .appointment-row>.outcome-cell,
  .appointment-row>.history-cell,
  .appointment-row>.census-cell{display:none!important}

  .appointment-row.mobile-expanded{
    grid-template-columns:1fr 1fr;
    grid-template-areas:
      "time patient"
      "meta meta"
      "treatment treatment"
      "therapist1 therapist2"
      "priceedit outcomeedit"
      "actions actions";
    padding-bottom:11px
  }
  .appointment-row.mobile-expanded .time-cell{grid-area:time}
  .appointment-row.mobile-expanded .patient-cell{grid-area:patient}
  .appointment-row.mobile-expanded .mobile-row-meta{grid-area:meta}
  .appointment-row.mobile-expanded>.field-cell,
  .appointment-row.mobile-expanded>.price-cell,
  .appointment-row.mobile-expanded>.outcome-cell{
    display:block!important;background:#f8fafc;border:1px solid #e1e7ef;
    border-radius:10px;padding:7px
  }
  .appointment-row.mobile-expanded>.field-cell::before,
  .appointment-row.mobile-expanded>.price-cell::before,
  .appointment-row.mobile-expanded>.outcome-cell::before{
    content:attr(data-label);display:block;margin:0 0 4px;
    color:#6b7890;font-size:8px;font-weight:850;text-transform:uppercase;letter-spacing:.25px
  }
  .appointment-row.mobile-expanded>.field-cell:nth-of-type(3){grid-area:treatment}
  .appointment-row.mobile-expanded>.field-cell:nth-of-type(4){grid-area:therapist1}
  .appointment-row.mobile-expanded>.field-cell:nth-of-type(5){grid-area:therapist2}
  .appointment-row.mobile-expanded>.price-cell{grid-area:priceedit}
  .appointment-row.mobile-expanded>.outcome-cell{grid-area:outcomeedit}
  .appointment-row.mobile-expanded .field-select,
  .appointment-row.mobile-expanded .outcome-select,
  .appointment-row.mobile-expanded .price-input-wrap{height:42px!important;background:#fff}
  .appointment-row.mobile-expanded .field-select,
  .appointment-row.mobile-expanded .outcome-select,
  .appointment-row.mobile-expanded .price-input{font-size:12px}
  .appointment-row.mobile-expanded .mobile-row-bottom{display:none!important}
  .appointment-row.mobile-expanded .mobile-edit-toggle{background:#fff!important;color:#23405f!important;border-color:#cfdae8!important}

  /* Patients: mobile is the main list, with readable targets */
  .patients-head{margin:2px 2px 10px}
  .patients-head h1{font-size:21px}
  .patients-head p{font-size:10px;line-height:1.4}
  .patient-toolbar{
    position:sticky;top:0;z-index:16;
    display:grid;grid-template-columns:minmax(0,1fr) 122px;
    gap:8px;padding:8px;margin-bottom:10px;border-radius:13px;
    box-shadow:0 6px 18px rgba(25,52,87,.08)
  }
  .patient-search{min-height:44px;padding:0 10px}
  .patient-search input{font-size:13px}
  .patient-toolbar select{height:44px;max-width:none;width:100%;padding:0 7px;font-size:10px}
  .patient-mobile-list{gap:8px}
  .patient-card{
    min-height:76px;padding:11px 9px;
    grid-template-columns:42px minmax(0,1fr) auto 12px;
    border-radius:13px
  }
  .patient-card .patient-initials{width:40px;height:40px}
  .patient-card-body b{font-size:12px}
  .patient-card-body small{font-size:9px;line-height:1.35}
  .patient-card .status-chip{font-size:8px;padding:5px 7px;min-height:27px}

  /* Patient detail: profile and history are genuinely one-column */
  .back-link{min-height:34px;display:inline-flex;align-items:center;font-size:11px}
  .patient-profile{
    grid-template-columns:50px minmax(0,1fr);
    gap:10px;padding:11px;border-radius:13px
  }
  .patient-profile>.status-chip{grid-column:1/-1;justify-self:start}
  .detail-avatar{width:48px;height:48px;font-size:15px}
  .patient-profile h1{font-size:19px;line-height:1.15}
  .patient-profile p{font-size:9.5px;line-height:1.35}
  .contact-line{font-size:10px;gap:6px 12px}
  .contact-line a,.contact-line span{min-height:28px;display:inline-flex;align-items:center}
  .patient-tabs{margin:10px -10px 10px;padding:0 10px;background:#fff;position:sticky;top:0;z-index:14}
  .patient-tabs button{min-height:42px;font-size:9px}
  .history-head{padding:10px}
  .history-filters{
    display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;padding:8px
  }
  .history-filters button{min-height:38px;padding:6px;font-size:9px}
  .history-filters label{grid-column:span 1}
  .history-filters input{width:100%;min-width:0;height:39px;font-size:10px;padding:5px}
  .history-filters #hist-search{grid-column:1/-1;min-height:42px}
  .history-row{
    grid-template-columns:68px minmax(0,1fr) auto;
    gap:6px 8px;padding:10px 9px;border-radius:11px
  }
  .history-row b{font-size:10.5px}
  .history-row small{font-size:8.5px}
  .history-row .status-chip{font-size:8px;padding:4px 7px;min-height:25px}
  .patient-summary{
    margin-top:10px;padding:10px;
    grid-template-columns:1fr 1fr;gap:7px;border-radius:12px
  }
  .patient-summary h2{font-size:14px}
  .summary-kpi{padding:10px}
  .summary-kpi span{font-size:9px}
  .summary-kpi strong{font-size:16px}

  /* Economic: filters and KPIs optimized for vertical use */
  .economic-toolbar{
    grid-template-columns:1fr 1fr!important;
    gap:7px;padding:8px;border-radius:13px;margin-bottom:10px
  }
  .economic-toolbar label{font-size:8px}
  .economic-toolbar input,.economic-toolbar select{height:43px;font-size:11px}
  .economic-toolbar .eco-patient-filter{grid-column:1/-1}
  .economic-toolbar button{grid-column:1/-1;min-height:44px}
  .economic-kpis{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:7px!important;margin-bottom:10px
  }
  .economic-kpi{padding:10px;border-radius:11px}
  .economic-kpi:nth-child(1),.economic-kpi:nth-child(2){grid-column:span 1}
  .economic-kpi span{font-size:9px}
  .economic-kpi strong{font-size:17px;margin:6px 0 3px}
  .economic-kpi small{font-size:7.5px}
  .economic-list-panel>header{padding:11px}
  .economic-list-panel h2{font-size:13px}
  .economic-list-panel p{font-size:8.5px}
  .economic-list{padding:0;background:transparent}
  .economic-row{
    grid-template-columns:66px minmax(0,1fr) auto!important;
    gap:6px 8px;padding:9px;border-radius:11px;margin-bottom:7px
  }
  .economic-row b{font-size:10px}
  .economic-row small{font-size:8px}
  .eco-money{font-size:10px}
  .economic-row .status-chip{font-size:7.5px;min-height:24px;padding:4px 6px}
  .economic-side{margin-top:8px;gap:8px}
  .economic-summary-card{padding:11px;border-radius:12px}
  .eco-break-head,.eco-break-row{grid-template-columns:minmax(76px,1fr) 28px 72px 72px;gap:5px}
  .eco-break-row{font-size:8px}

  /* Pagination: only two large actions + compact page jump */
  .pagination-controls{gap:6px}
  .pagination-controls .secondary-button{min-height:40px;font-size:9px;padding:7px 9px}
  .page-counter{width:100%;text-align:center;font-size:10px}
  .page-jump{font-size:9px}
  .page-number-input{height:38px;width:60px;font-size:11px}

  /* Bottom nav is the primary mobile navigation */
  .mobile-bottom-nav{
    height:calc(68px + env(safe-area-inset-bottom));
    padding-bottom:env(safe-area-inset-bottom);
    box-shadow:0 -8px 24px rgba(25,48,78,.10)
  }
  .mobile-bottom-nav a{min-width:0;font-size:9px;gap:4px}
  .mobile-bottom-nav a .icon{width:20px;height:20px}
}

@media (max-width:380px){
  .mobile-date-card{grid-template-columns:1fr 108px}
  .v3-ops-strip{grid-template-columns:1fr 1fr}
  .v3-ops-strip strong{grid-column:1/-1}
  .mobile-row-actions{grid-template-columns:1fr 1fr}
  .mobile-census-chip{grid-column:1/-1;grid-row:1}
  .economic-kpis{grid-template-columns:1fr!important}
}


/* OP16 V18.1 — mobile header/navigation polish */
@media (max-width:720px){
  /* Top bar: no orphan controls. Navigation lives at the bottom. */
  .mobile-topbar{
    justify-content:center!important;
    height:calc(58px + env(safe-area-inset-top))!important;
    padding-left:12px!important;
    padding-right:12px!important
  }
  .mobile-topbar>.icon-button,
  .mobile-topbar .mobile-date-icon{
    display:none!important
  }
  .mobile-brand{
    width:100%;
    justify-content:center;
    gap:8px!important;
    font-size:14px!important;
    white-space:nowrap
  }
  .mobile-brand-image{
    width:30px;
    height:30px;
    border-radius:8px;
    object-fit:contain;
    background:#fff
  }
  .mobile-brand-label{
    font-size:14px;
    font-weight:800;
    letter-spacing:-.15px
  }

  /* Sticky stack: header -> date/studio -> time band. */
  .mobile-date-card{
    top:calc(58px + env(safe-area-inset-top))!important;
    z-index:24!important
  }
  .time-band-head{
    top:calc(118px + env(safe-area-inset-top))!important;
    z-index:20!important
  }

  /* Three real destinations = three equal columns, no empty fourth slot. */
  .mobile-bottom-nav{
    grid-template-columns:repeat(3,minmax(0,1fr))!important
  }

  /* Missing price is explicit instead of a floating dash. */
  .mobile-price-label{
    color:#53657b!important;
    font-size:9px!important;
    font-weight:750!important;
    white-space:nowrap
  }
}

/* OP16 V19 — V3 MOBILE PARITY */
@media (max-width:720px){
 .appointment-row{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;grid-template-areas:"census history" "patient patient" "treatment treatment" "therapist1 therapist2" "priceedit outcomeedit"!important;min-height:0!important;padding:8px!important;gap:7px 6px!important;border-radius:10px!important;box-shadow:none!important;align-items:stretch!important}
 .appointment-row .time-cell{display:none!important}
 .appointment-row .patient-cell{grid-area:patient!important;display:flex!important;min-width:0!important;padding:0!important;gap:0!important;align-items:center!important}
 .appointment-row .patient-avatar{display:none!important}
 .appointment-row .patient-contact-main{width:100%!important;min-width:0!important;display:flex!important;flex-direction:column!important;gap:3px!important}
 .appointment-row .patient-contact-main strong{font-size:13px!important;line-height:1.2!important;color:#172b46!important;white-space:normal!important}
 .appointment-row .patient-phone-link,.appointment-row .patient-phone-text{font-size:10px!important;min-height:0!important;margin:0!important;color:#176ac4!important}
 .appointment-row>.field-cell,.appointment-row>.price-cell,.appointment-row>.outcome-cell,.appointment-row>.history-cell,.appointment-row>.census-cell{display:flex!important;min-width:0!important}
 .appointment-row>.field-cell,.appointment-row>.price-cell,.appointment-row>.outcome-cell{flex-direction:column!important;align-items:stretch!important;gap:4px!important;background:transparent!important;border:0!important;border-radius:0!important;padding:0!important}
 .appointment-row>.field-cell::before,.appointment-row>.price-cell::before,.appointment-row>.outcome-cell::before{content:attr(data-label)!important;display:block!important;padding-left:2px!important;margin:0!important;font-size:9px!important;line-height:1.1!important;font-weight:800!important;color:#52606d!important;text-transform:uppercase!important;letter-spacing:.32px!important}
 .appointment-row>.field-cell[data-label="Prestazione"]{grid-area:treatment!important}
 .appointment-row>.field-cell[data-label="Terapista 1"]{grid-area:therapist1!important}
 .appointment-row>.field-cell[data-label="Terapista 2"]{grid-area:therapist2!important}
 .appointment-row>.price-cell{grid-area:priceedit!important}
 .appointment-row>.outcome-cell{grid-area:outcomeedit!important}
 .appointment-row>.history-cell{grid-area:history!important;justify-content:flex-end!important;align-items:center!important}
 .appointment-row>.census-cell{grid-area:census!important;justify-content:flex-start!important;align-items:center!important}
 .appointment-row .field-select,.appointment-row .outcome-select,.appointment-row .price-input-wrap{width:100%!important;min-height:40px!important;height:40px!important;border:1px solid #ccd6e0!important;border-radius:7px!important;background:#fff!important;box-shadow:none!important}
 .appointment-row .field-select,.appointment-row .outcome-select{padding:7px 8px!important;font-size:13px!important}
 .appointment-row .price-input-wrap{display:flex!important;align-items:stretch!important}
 .appointment-row .price-input-wrap>span{display:flex!important;align-items:center!important;padding:0 8px!important;border-right:1px solid #ccd6e0!important;background:#f0f4f8!important;color:#78889a!important;font-size:12px!important}
 .appointment-row .price-input{min-width:0!important;width:100%!important;padding:7px 8px!important;font-size:13px!important;border:0!important;background:transparent!important}
 .appointment-row .history-cell .icon-button{width:32px!important;height:32px!important;border-radius:7px!important;border:1px solid #b7c4d2!important;background:#fff!important}
 .appointment-row .census-cell .status-chip{min-height:24px!important;padding:4px 7px!important;font-size:8px!important}
 .mobile-row-meta,.mobile-row-bottom,.mobile-row-actions{display:none!important}
 .appointment-row.mobile-expanded{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;grid-template-areas:"census history" "patient patient" "treatment treatment" "therapist1 therapist2" "priceedit outcomeedit"!important}
}


/* OP16 V19.1 — mobile original logo + visible app version */
@media (max-width:720px){
  .mobile-topbar{
    height:calc(68px + env(safe-area-inset-top))!important;
    padding:calc(6px + env(safe-area-inset-top)) 10px 6px!important
  }
  .mobile-brand{
    width:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:8px!important;
    min-width:0!important
  }
  .mobile-brand-full-logo{
    display:block!important;
    width:min(205px,70vw)!important;
    height:48px!important;
    object-fit:contain!important;
    object-position:center!important;
    border-radius:4px!important;
    background:#fff!important
  }
  .mobile-version-chip{
    flex:0 0 auto!important;
    border:1px solid rgba(255,255,255,.35)!important;
    background:rgba(255,255,255,.12)!important;
    color:#fff!important;
    border-radius:999px!important;
    padding:5px 7px!important;
    font-size:9px!important;
    font-weight:800!important;
    line-height:1!important;
    cursor:pointer!important
  }
  .mobile-version-chip:active{
    background:rgba(255,255,255,.22)!important
  }
  .mobile-date-card{
    top:calc(68px + env(safe-area-inset-top))!important
  }
  .time-band-head{
    top:calc(128px + env(safe-area-inset-top))!important
  }
  .mobile-brand-image,.mobile-brand-label{
    display:none!important
  }
}


/* OP16 V19.1 FIX4 — persistent mobile brand + Oggi */
@media (max-width:720px){
  .mobile-date-card{
    grid-template-columns:minmax(0,1fr) auto 104px!important;
    gap:6px!important;
    align-items:center!important
  }
  .mobile-date-main{
    min-width:0!important;
    font-size:11px!important;
    white-space:nowrap!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important
  }
  .mobile-today-button{
    height:42px!important;
    min-width:42px!important;
    padding:0 8px!important;
    border:1px solid #cfe0f3!important;
    border-radius:8px!important;
    background:#eef6ff!important;
    color:#0876df!important;
    font-size:10px!important;
    font-weight:850!important;
    cursor:pointer!important
  }
  .mobile-today-button:active{
    background:#dfefff!important
  }
  .mobile-date-card select{
    width:104px!important;
    max-width:104px!important
  }
}

@media (max-width:360px){
  .mobile-date-card{
    grid-template-columns:minmax(0,1fr) auto 94px!important
  }
  .mobile-date-card select{
    width:94px!important;
    max-width:94px!important
  }
  .mobile-today-button{
    min-width:38px!important;
    padding:0 6px!important
  }
}


/* OP16 V19.2 incomplete-data modal — V3 visual model */
.incomplete-modal-overlay{
  position:fixed;
  inset:0;
  z-index:1600;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(6,22,45,.64);
  backdrop-filter:blur(2px)
}
.incomplete-modal-dialog{
  width:min(560px,calc(100vw - 28px));
  max-height:min(84vh,760px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#f5f7fb;
  border:1px solid #d5dfeb;
  border-radius:14px;
  box-shadow:0 24px 70px rgba(3,20,44,.32)
}
.incomplete-modal-head{
  min-height:50px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px 10px 14px;
  background:#234b82;
  color:#fff
}
.incomplete-modal-head strong{
  font-size:15px;
  line-height:1.2
}
.incomplete-modal-close{
  width:34px;
  height:34px;
  flex:0 0 34px;
  display:grid;
  place-items:center;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.18);
  color:#fff;
  font-size:23px;
  line-height:1;
  cursor:pointer
}
.incomplete-modal-summary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 13px;
  background:#eaf0f8;
  border-bottom:1px solid #d5dfeb;
  color:#344b67;
  font-size:10px
}
.incomplete-modal-summary b{font-size:11px}
.incomplete-modal-list{
  overflow:auto;
  display:grid;
  gap:8px;
  padding:9px
}
.incomplete-modal-card{
  width:100%;
  display:grid;
  grid-template-columns:minmax(0,1.2fr) minmax(120px,.8fr);
  gap:12px;
  text-align:left;
  border:1px solid #d8e0ea;
  border-radius:9px;
  background:#fff;
  padding:10px 11px;
  color:#203650;
  cursor:pointer;
  box-shadow:0 1px 2px rgba(19,43,73,.03)
}
.incomplete-modal-card:hover{
  border-color:#a9bed8;
  background:#fbfdff
}
.incomplete-card-main,
.incomplete-card-side{
  display:flex;
  flex-direction:column;
  min-width:0
}
.incomplete-card-main strong{
  font-size:13px;
  line-height:1.2;
  margin-bottom:3px
}
.incomplete-card-main span{
  font-size:9px;
  color:#617086;
  line-height:1.35
}
.incomplete-card-main b{
  margin-top:5px;
  font-size:9px;
  color:#7b8796
}
.incomplete-card-main em{
  font-style:normal;
  font-size:10px;
  line-height:1.25;
  font-weight:850;
  color:#b85c00
}
.incomplete-card-side{
  justify-content:center;
  gap:1px
}
.incomplete-card-side small{
  margin-top:3px;
  font-size:8px;
  color:#748399;
  text-transform:uppercase;
  letter-spacing:.2px
}
.incomplete-card-side strong,
.incomplete-card-side span{
  font-size:9px;
  line-height:1.3;
  color:#354a65
}
.incomplete-modal-empty{
  padding:28px;
  text-align:center;
  color:#66768a;
  font-size:12px
}
.appointment-row.incomplete-focus{
  outline:3px solid rgba(244,154,24,.46)!important;
  outline-offset:2px;
  animation:incompleteFocusPulse .9s ease 2
}
@keyframes incompleteFocusPulse{
  50%{outline-color:rgba(244,154,24,.95)}
}

@media (max-width:720px){
  .incomplete-modal-overlay{
    place-items:end center;
    padding:0
  }
  .incomplete-modal-dialog{
    width:100%;
    max-height:88vh;
    border-radius:14px 14px 0 0;
    border-bottom:0
  }
  .incomplete-modal-head{
    min-height:48px;
    padding:9px 11px 9px 13px
  }
  .incomplete-modal-head strong{
    font-size:13px
  }
  .incomplete-modal-summary{
    align-items:flex-start;
    flex-direction:column;
    gap:2px;
    padding:8px 11px
  }
  .incomplete-modal-list{
    gap:7px;
    padding:8px
  }
  .incomplete-modal-card{
    grid-template-columns:minmax(0,1fr) 118px;
    gap:8px;
    padding:9px
  }
  .incomplete-card-main strong{font-size:12px}
  .incomplete-card-main span{font-size:8.5px}
  .incomplete-card-main em{font-size:9.5px}
  .incomplete-card-side small{font-size:7.5px}
  .incomplete-card-side strong,
  .incomplete-card-side span{font-size:8.5px}
}


/* OP16 V19.3 — patient history modal inspired by V3 */
.patient-history-modal-overlay{
  position:fixed;
  inset:0;
  z-index:1700;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(8,20,38,.68);
  backdrop-filter:blur(2px)
}
.patient-history-modal-dialog{
  width:min(620px,calc(100vw - 28px));
  max-height:min(90vh,820px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid #cfd9e6;
  border-radius:14px;
  background:#f4f7fb;
  box-shadow:0 24px 70px rgba(3,20,44,.34)
}
.patient-history-modal-head{
  min-height:50px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px 10px 14px;
  background:#234b82;
  color:#fff
}
.patient-history-modal-head strong{
  font-size:15px;
  line-height:1.2
}
.patient-history-modal-close{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border:0;
  border-radius:50%;
  background:rgba(255,255,255,.18);
  color:#fff;
  font-size:23px;
  line-height:1;
  cursor:pointer
}
.patient-history-modal-controls{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
  padding:10px;
  background:#fff
}
.patient-history-modal-controls label{
  display:flex;
  flex-direction:column;
  gap:4px;
  font-size:8px;
  font-weight:850;
  color:#566980
}
.patient-history-modal-controls input{
  height:38px;
  border:1px solid #ccd7e4;
  border-radius:7px;
  padding:0 9px;
  font-size:11px;
  background:#fff
}
.patient-history-search{
  grid-column:1/-1;
  height:36px;
  border:0;
  border-radius:7px;
  background:#234b82;
  color:#fff;
  font-size:11px;
  font-weight:850;
  cursor:pointer
}
.patient-history-presets{
  grid-column:1/-1;
  display:flex;
  flex-wrap:wrap;
  gap:6px
}
.patient-history-presets button{
  min-height:28px;
  padding:4px 9px;
  border:1px solid #c5d2e1;
  border-radius:7px;
  background:#fff;
  color:#314963;
  font-size:9px;
  font-weight:750;
  cursor:pointer
}
.patient-history-presets button.active{
  border-color:#234b82;
  color:#173f73;
  box-shadow:inset 0 0 0 1px #234b82
}
.patient-history-modal-note{
  margin:0 10px 8px;
  padding:7px 9px;
  border:1px solid #cbd8e6;
  border-radius:7px;
  background:#e9f0f8;
  color:#53667c;
  font-size:9px;
  line-height:1.25
}
.patient-history-modal-state{
  min-height:120px;
  overflow:auto;
  border-top:1px solid #d5dfeb
}
.patient-history-modal-result-head{
  position:sticky;
  top:0;
  z-index:2;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  padding:8px 10px;
  background:#e7edf6;
  border-bottom:1px solid #d2dce8;
  color:#51647a;
  font-size:9px
}
.patient-history-modal-result-head strong{
  color:#324861
}
.patient-history-modal-list{
  display:grid;
  gap:7px;
  padding:8px
}
.patient-history-modal-card{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(105px,.75fr);
  gap:10px;
  padding:9px 10px;
  border:1px solid #d5dee9;
  border-radius:9px;
  background:#fff
}
.patient-history-modal-left,
.patient-history-modal-right{
  display:flex;
  flex-direction:column;
  min-width:0
}
.patient-history-modal-left strong{
  font-size:13px;
  line-height:1.1;
  color:#183f75
}
.patient-history-modal-left b{
  margin-top:3px;
  font-size:9px;
  color:#384e68
}
.patient-history-modal-left span{
  margin-top:5px;
  font-size:9px;
  font-weight:750;
  color:#475d77
}
.patient-history-modal-left small{
  margin-top:2px;
  font-size:8px;
  color:#66788d
}
.patient-history-modal-right{
  justify-content:center
}
.patient-history-modal-right strong{
  font-size:9px;
  color:#55687e
}
.patient-history-modal-right span{
  margin-top:2px;
  font-size:9px;
  color:#455b73
}
.patient-history-modal-right b{
  margin-top:6px;
  font-size:10px;
  color:#2a435f
}
.patient-history-modal-loading,
.patient-history-modal-empty,
.patient-history-modal-error{
  padding:28px 16px;
  text-align:center;
  color:#62748a;
  font-size:11px
}
.patient-history-modal-error{
  display:flex;
  flex-direction:column;
  gap:4px;
  color:#9d3030
}

@media (max-width:720px){
  .patient-history-modal-overlay{
    place-items:end center;
    padding:0
  }
  .patient-history-modal-dialog{
    width:100%;
    max-height:92vh;
    border-radius:14px 14px 0 0;
    border-bottom:0
  }
  .patient-history-modal-head strong{
    font-size:13px
  }
  .patient-history-modal-controls{
    padding:8px
  }
  .patient-history-modal-note{
    margin:0 8px 7px
  }
  .patient-history-modal-card{
    grid-template-columns:minmax(0,1fr) 116px;
    gap:8px;
    padding:9px
  }
}


/* OP16 V19.6 — centered transparent mobile logo + version bottom-right */
@media (max-width:720px){
  .mobile-topbar{
    position:relative!important;
    height:calc(68px + env(safe-area-inset-top))!important;
    padding:env(safe-area-inset-top) 8px 0!important;
    overflow:visible!important
  }

  .mobile-brand{
    position:relative!important;
    width:100%!important;
    height:68px!important;
    display:block!important;
    min-width:0!important
  }

  .mobile-brand-full-logo{
    position:absolute!important;
    left:50%!important;
    top:6px!important;
    transform:translateX(-50%)!important;
    display:block!important;
    width:min(210px,62vw)!important;
    height:50px!important;
    object-fit:contain!important;
    object-position:center!important;
    background:transparent!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    filter:
      drop-shadow(0 0 1px rgba(255,255,255,.98))
      drop-shadow(0 0 1.8px rgba(255,255,255,.82))!important
  }

  .mobile-version-chip{
    position:absolute!important;
    right:7px!important;
    bottom:5px!important;
    z-index:3!important;
    min-width:0!important;
    padding:4px 6px!important;
    border:1px solid rgba(255,255,255,.30)!important;
    background:rgba(255,255,255,.10)!important;
    color:#fff!important;
    border-radius:999px!important;
    font-size:8px!important;
    font-weight:800!important;
    line-height:1!important
  }

  .mobile-date-card{
    top:calc(68px + env(safe-area-inset-top))!important
  }
  .time-band-head{
    top:calc(128px + env(safe-area-inset-top))!important
  }
}

@media (max-width:360px){
  .mobile-brand-full-logo{
    width:min(190px,60vw)!important
  }
  .mobile-version-chip{
    right:5px!important;
    bottom:4px!important;
    font-size:7.5px!important
  }
}


/* OP17-C — censimento paziente da Agenda */
.census-action-wrap{display:flex;flex-direction:column;align-items:center;gap:5px}.census-action-button{border:1px solid #b8d5ff;background:#f2f7ff;color:#1769c2;border-radius:8px;padding:5px 8px;font-size:10px;font-weight:800;cursor:pointer;white-space:nowrap}.census-action-button:hover,.census-action-button:focus-visible{background:#e7f1ff;border-color:#8cbcff;outline:0}.census-action-wrap.mobile{align-items:flex-start}.census-action-wrap.mobile .census-action-button{min-height:36px;padding:7px 10px}
.census-modal-overlay{position:fixed;inset:0;z-index:220;background:rgba(18,33,53,.52);display:flex;align-items:center;justify-content:center;padding:20px}.census-modal-dialog{width:min(760px,100%);max-height:min(90vh,880px);overflow:auto;background:#fff;border-radius:18px;box-shadow:0 24px 60px rgba(17,38,67,.3);border:1px solid #dce5ef}.census-modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;padding:20px 22px;border-bottom:1px solid #e4eaf1}.census-modal-head>div{display:flex;flex-direction:column;gap:4px}.census-modal-head strong{font-size:18px;color:#233b5c}.census-modal-head span{font-size:12px;color:#6d7b8e}.census-modal-close{border:0;background:#f1f4f8;width:34px;height:34px;border-radius:50%;font-size:22px;line-height:1;cursor:pointer;color:#53657d}.census-calendar-context{display:flex;flex-wrap:wrap;gap:8px 16px;padding:14px 22px;background:#f8fafc;border-bottom:1px solid #e8edf3;font-size:11px;color:#506279}.census-calendar-context span{display:flex;gap:5px}.census-origin-note,.census-safety-note{margin:14px 22px 0;padding:10px 12px;border-radius:10px;font-size:11px;line-height:1.45}.census-origin-note{background:#eff8f3;color:#266346;border:1px solid #cde9d9}.census-origin-note.warning{background:#fff7e8;color:#8a5b05;border-color:#f0d49a}.census-safety-note{background:#f6f8fb;color:#56677f;border:1px solid #e0e6ee}.census-safety-note.preview{background:#fff7e8;color:#8a5b05;border-color:#f0d49a}.census-form{padding:18px 22px 22px}.census-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.census-form-grid label{display:flex;flex-direction:column;gap:6px;font-size:11px;font-weight:800;color:#53657d}.census-form-grid input,.census-form-grid select{width:100%;height:40px;border:1px solid #d6dfe9;border-radius:9px;background:#fff;padding:0 10px;color:#243b5a;font:inherit;font-weight:500;box-sizing:border-box}.census-form-grid input:focus,.census-form-grid select:focus{outline:2px solid #cfe2ff;border-color:#77aef1}.census-full-row{grid-column:1/-1}.census-modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}.census-modal-actions button{min-height:40px}.census-save:disabled{opacity:.5;cursor:not-allowed}
@media(max-width:720px){.census-modal-overlay{align-items:flex-end;padding:0}.census-modal-dialog{width:100%;max-height:94vh;border-radius:18px 18px 0 0}.census-modal-head{padding:16px}.census-calendar-context{padding:12px 16px}.census-origin-note,.census-safety-note{margin-left:16px;margin-right:16px}.census-form{padding:16px}.census-form-grid{grid-template-columns:1fr}.census-full-row{grid-column:auto}.census-modal-actions{position:sticky;bottom:-16px;background:#fff;padding:12px 0 4px}.census-modal-actions button{flex:1}.mobile-census-chip .census-action-wrap{gap:4px}}

/* OP17-D — separazione Anagrafica/Storico + Scheda Paziente + Riconciliazione */
.patient-toolbar-split{display:grid;grid-template-columns:minmax(320px,1fr) 180px 180px;gap:10px;align-items:end}.patient-filter-group{display:flex;flex-direction:column;gap:5px;font-size:10px;font-weight:800;color:#64758a}.patient-filter-group select{height:42px;border:1px solid #d7e0e9;border-radius:10px;background:#fff;padding:0 11px;color:#243b5a;font:inherit;font-weight:600}.patient-filter-explain{display:flex;flex-wrap:wrap;gap:8px 22px;padding:0 3px 11px;font-size:10px;color:#68798f}.patient-filter-explain b{color:#304865}.patient-table-dual-status .patient-table-head,.patient-table-dual-status .patient-row-dual{grid-template-columns:minmax(280px,1.45fr) minmax(150px,.75fr) 120px 130px 150px 28px}.patient-card-statuses{display:flex;gap:6px;flex-wrap:wrap;margin-top:5px}.history-with{background:#eef7ee!important;border-color:#cae2ca!important;color:#35633d!important}.history-without{background:#f4f6f8!important;border-color:#dfe5ea!important;color:#657286!important}
.patient-profile-extended{align-items:center}.patient-dual-status{margin-left:auto;display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap}.patient-dual-status>span{display:flex;flex-direction:column;gap:4px;align-items:flex-start}.patient-dual-status small{font-size:9px;text-transform:uppercase;letter-spacing:.04em;color:#7b8797;font-style:normal}.patient-detail-actions{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0 16px}.patient-detail-actions .reconcile-button{border-color:#b8d5ff;background:#f3f8ff;color:#1769c2}.patient-sheet-callout,.patient-sheet-panel{margin:0 0 16px;border:1px solid #dce4ed;border-radius:14px;background:#fff;padding:16px 18px}.patient-sheet-callout{display:flex;align-items:center;justify-content:space-between;gap:18px;background:#fff9ee;border-color:#eed9aa}.patient-sheet-callout h2,.patient-sheet-panel h2{margin:0 0 4px;font-size:16px;color:#213c5f}.patient-sheet-callout p,.patient-sheet-panel p{margin:0;color:#6d7a8b;font-size:11px;line-height:1.5}.patient-sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;margin-bottom:14px}.patient-sheet-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.patient-sheet-field{border:1px solid #e1e7ee;border-radius:10px;padding:10px 11px;background:#f9fbfd;min-width:0}.patient-sheet-field.wide{grid-column:span 2}.patient-sheet-field span{display:block;font-size:9px;text-transform:uppercase;letter-spacing:.03em;color:#7a8898;margin-bottom:4px}.patient-sheet-field strong{display:block;font-size:12px;color:#253e5e;overflow-wrap:anywhere}
.reconcile-modal-overlay{position:fixed;inset:0;z-index:240;background:rgba(14,30,50,.6);display:flex;align-items:center;justify-content:center;padding:18px}.reconcile-modal-card{width:min(1180px,100%);max-height:94vh;overflow:hidden;background:#fff;border:1px solid #d8e1eb;border-radius:18px;box-shadow:0 28px 70px rgba(16,35,59,.34);display:flex;flex-direction:column}.reconcile-modal-card>header{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding:18px 20px;border-bottom:1px solid #e3e9f0}.reconcile-modal-card>header h2{margin:0 0 4px;color:#203a5c;font-size:20px}.reconcile-modal-card>header p{margin:0;color:#66778c;font-size:11px;line-height:1.45}.reconcile-modal-card .icon-button{border:0;background:#f1f4f8;color:#52647b;border-radius:50%;width:34px;height:34px;font-size:23px;line-height:1;cursor:pointer}.reconcile-modal-card #reconcile-body{overflow:auto;padding:16px 18px 18px}.reconcile-explain{display:flex;flex-direction:column;gap:3px;margin-bottom:14px;padding:10px 12px;border:1px solid #dce7f3;background:#f5f9fe;border-radius:10px;color:#50647c;font-size:11px}.reconcile-explain strong{color:#254467}.reconcile-explain em{margin-top:3px;color:#8a5b05;font-style:normal;font-weight:800}.reconcile-layout{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(300px,.75fr);gap:14px}.reconcile-history-panel,.reconcile-target-panel{border:1px solid #e0e6ed;border-radius:13px;background:#fff;padding:13px}.reconcile-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}.reconcile-panel-head h3,.reconcile-target-panel h3{margin:0 0 3px;color:#253e5d;font-size:14px}.reconcile-panel-head p,.reconcile-target-panel>p{margin:0;color:#758295;font-size:10px;line-height:1.4}.reconcile-select-actions{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.reconcile-select-actions .secondary-button{min-height:32px;padding:5px 8px;font-size:9px}.reconcile-session-list{border:1px solid #e5eaf0;border-radius:10px;overflow:hidden}.reconcile-session-row{display:grid;grid-template-columns:22px minmax(0,1fr) 85px;gap:9px;align-items:center;padding:9px 10px;border-bottom:1px solid #e9edf2;cursor:pointer;background:#fff}.reconcile-session-row:last-child{border-bottom:0}.reconcile-session-row:hover{background:#f8fbff}.reconcile-session-row input{width:16px;height:16px}.reconcile-session-row span{display:flex;flex-direction:column;gap:2px;min-width:0}.reconcile-session-row b{font-size:10px;color:#29415f}.reconcile-session-row small{font-size:9px;color:#778598;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.reconcile-session-row>strong{text-align:right;font-size:10px;color:#344c69}.reconcile-pagination{margin-top:10px}.reconcile-search{display:flex;flex-direction:column;gap:5px;margin:12px 0 9px;color:#67788d;font-size:10px;font-weight:800}.reconcile-search input{height:39px;border:1px solid #d8e1eb;border-radius:9px;padding:0 10px;color:#243c5c;font:inherit;font-weight:500}.reconcile-target-results{max-height:250px;overflow:auto;border:1px solid #e4e9ef;border-radius:10px}.reconcile-target-row{width:100%;border:0;border-bottom:1px solid #e8edf2;background:#fff;padding:9px 10px;display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;cursor:pointer}.reconcile-target-row:last-child{border-bottom:0}.reconcile-target-row:hover{background:#f5f9fe}.reconcile-target-row span{display:flex;flex-direction:column;gap:2px;min-width:0}.reconcile-target-row b{font-size:11px;color:#263f60}.reconcile-target-row small{font-size:9px;color:#788698;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.reconcile-target-chosen{margin-top:10px;padding:10px 11px;border-radius:10px;border:1px solid #cce1cf;background:#f1f8f2;display:flex;flex-direction:column;gap:2px}.reconcile-target-chosen.empty{border-color:#e2e7ec;background:#f7f9fb;color:#798697}.reconcile-target-chosen small{font-size:8px;text-transform:uppercase;color:#758598}.reconcile-target-chosen strong{font-size:12px;color:#275038}.reconcile-target-chosen span{font-size:9px;color:#64768a}.reconcile-footer{display:flex;justify-content:space-between;align-items:center;gap:14px;border-top:1px solid #e5eaf0;margin-top:14px;padding-top:13px;color:#50627a;font-size:11px}.reconcile-footer .primary-button:disabled{opacity:.5;cursor:not-allowed}.patient-empty.compact,.patient-error.compact,.patient-loading.compact{min-height:72px;padding:12px}
@media(max-width:900px){.patient-toolbar-split{grid-template-columns:1fr 1fr}.patient-toolbar-split .patient-search{grid-column:1/-1}.patient-table-dual-status .patient-table-head,.patient-table-dual-status .patient-row-dual{grid-template-columns:minmax(220px,1.3fr) 120px 105px 110px 125px 22px}.patient-sheet-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.reconcile-layout{grid-template-columns:1fr}.reconcile-target-results{max-height:180px}}
@media(max-width:720px){.patient-toolbar-split{grid-template-columns:1fr}.patient-toolbar-split .patient-search{grid-column:auto}.patient-filter-explain{flex-direction:column;gap:5px}.patient-dual-status{width:100%;margin-left:0}.patient-detail-actions{display:grid;grid-template-columns:1fr}.patient-detail-actions button{width:100%}.patient-sheet-callout{align-items:flex-start;flex-direction:column}.patient-sheet-callout .primary-button{width:100%;text-align:center}.patient-sheet-grid{grid-template-columns:1fr}.patient-sheet-field.wide{grid-column:auto}.reconcile-modal-overlay{align-items:flex-end;padding:0}.reconcile-modal-card{width:100%;max-height:96vh;border-radius:18px 18px 0 0}.reconcile-modal-card #reconcile-body{padding:12px}.reconcile-panel-head{flex-direction:column}.reconcile-select-actions{justify-content:flex-start}.reconcile-session-row{grid-template-columns:22px minmax(0,1fr);}.reconcile-session-row>strong{grid-column:2;text-align:left}.reconcile-footer{position:sticky;bottom:-12px;background:#fff;padding:12px 0 4px;flex-direction:column;align-items:stretch}.reconcile-footer .primary-button{width:100%}}


/* OP17-D UI FIX: technical IDs hidden + direct patient sheet action */
.patient-table-dual-status .patient-table-head,
.patient-table-dual-status .patient-row-dual{
  grid-template-columns:minmax(280px,1.45fr) minmax(150px,.75fr) 120px 130px 150px 150px;
}
.patient-row-dual{cursor:default}
.patient-open-detail{
  border:0;background:transparent;color:inherit;text-align:left;padding:0;margin:0;cursor:pointer;width:100%;
}
.patient-open-detail:hover b,.patient-open-detail:focus-visible b{color:var(--primary)}
.patient-open-detail:focus-visible{outline:2px solid rgba(28,126,214,.25);outline-offset:3px;border-radius:8px}
.patient-sheet-action{
  border:1px solid #cad7e4;border-radius:9px;background:#fff;color:#153d69;
  font-size:10px;font-weight:800;padding:8px 10px;cursor:pointer;white-space:nowrap;
}
.patient-sheet-action:hover,.patient-sheet-action:focus-visible{border-color:#8fb8df;background:#eef6ff;outline:none}
.patient-table-dual-status .patient-table-head span:nth-child(6){display:block}
.patient-card-dual{display:none}

@media(max-width:900px){
  .patient-table-dual-status .patient-table-head,
  .patient-table-dual-status .patient-row-dual{
    grid-template-columns:minmax(220px,1.3fr) 120px 105px 110px 125px 125px;
  }
}
@media(max-width:720px){
  .patient-card-dual{
    display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:stretch;
    border:1px solid var(--line);border-radius:12px;background:#fff;padding:8px;
    box-shadow:0 2px 9px rgba(25,52,87,.04)
  }
  .patient-card-open{
    display:grid;grid-template-columns:40px minmax(0,1fr) 14px;gap:9px;align-items:center;
    border:0;background:transparent;color:inherit;text-align:left;padding:2px;min-width:0;cursor:pointer;
  }
  .patient-card-dual:has(.census-censito){background:#eef4ea;border-color:#d4dfcd}
  .patient-card-dual:has(.census-da-verificare){background:#f6efe2;border-color:#e2d5bd}
  .patient-sheet-action-mobile{align-self:center;font-size:8px;padding:7px 8px}
}


/* OP17-E — editor unico Scheda Paziente */
.patient-sheet-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.patient-edit-trigger{white-space:nowrap}
html.patient-editor-open,html.patient-editor-open body{overflow:hidden}
.patient-edit-overlay{
  position:fixed;inset:0;z-index:10000;background:rgba(4,24,48,.52);
  display:flex;align-items:center;justify-content:center;padding:24px;
}
.patient-edit-card{
  width:min(980px,100%);max-height:calc(100vh - 48px);overflow:auto;
  background:#fff;border:1px solid #d6e0ea;border-radius:18px;
  box-shadow:0 24px 70px rgba(6,37,83,.28);
}
.patient-edit-header{
  position:sticky;top:0;z-index:2;background:#fff;border-bottom:1px solid #e1e7ee;
  display:flex;justify-content:space-between;gap:20px;align-items:flex-start;padding:20px 22px;
}
.patient-edit-header h2{margin:0 0 4px;font-size:20px}.patient-edit-header p{margin:0;color:#64748b}
.patient-edit-close{
  border:0;background:#eef3f8;width:34px;height:34px;border-radius:10px;
  font-size:24px;line-height:1;cursor:pointer;color:#173a63;
}
.patient-edit-form{padding:0 22px 22px}
.patient-edit-section{padding:20px 0;border-bottom:1px solid #edf1f5}
.patient-edit-section:last-of-type{border-bottom:0}
.patient-edit-section h3{margin:0 0 14px;font-size:15px;color:#173a63}
.patient-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.patient-edit-grid label{display:flex;flex-direction:column;gap:6px;font-size:11px;font-weight:800;color:#52667c}
.patient-edit-grid label.wide{grid-column:1/-1}
.patient-edit-grid input,.patient-edit-grid textarea{
  width:100%;box-sizing:border-box;border:1px solid #cbd7e3;border-radius:10px;
  background:#fff;color:#102b4b;font:inherit;font-size:14px;font-weight:500;padding:10px 11px;
}
.patient-edit-grid textarea{min-height:88px;resize:vertical}
.patient-edit-grid input:focus,.patient-edit-grid textarea:focus{
  outline:2px solid rgba(24,136,255,.16);border-color:#1888ff
}
.patient-edit-status{min-height:22px;padding:12px 0 0;color:#b42318;font-weight:700;font-size:12px}
.patient-edit-footer{
  position:sticky;bottom:0;background:#fff;border-top:1px solid #e1e7ee;
  display:flex;justify-content:flex-end;gap:10px;padding:16px 0 0;margin-top:4px
}
.patient-edit-save:disabled{opacity:.6;cursor:wait}

@media(max-width:720px){
  .patient-edit-overlay{padding:0;align-items:stretch}
  .patient-edit-card{max-height:100vh;height:100vh;border-radius:0;border:0}
  .patient-edit-header{padding:16px}
  .patient-edit-form{padding:0 16px 18px}
  .patient-edit-grid{grid-template-columns:1fr}
  .patient-edit-grid label.wide{grid-column:auto}
  .patient-edit-footer{padding:14px 0 0}
  .patient-sheet-head-actions{align-items:flex-start}
}


/* OP17-F — Agenda -> scheda paziente + filtro settimanale + totali periodo */
.agenda-patient-profile-link{
  display:inline-flex;align-items:center;max-width:100%;border:0;background:transparent;
  color:inherit;padding:0;margin:0;cursor:pointer;text-align:left;
}
.agenda-patient-profile-link strong{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}
.agenda-patient-profile-link:hover strong,.agenda-patient-profile-link:focus-visible strong{color:#0b73d9}
.agenda-patient-profile-link:focus-visible{outline:2px solid rgba(24,136,255,.18);outline-offset:3px;border-radius:5px}
.economic-toolbar-week{grid-template-columns:minmax(135px,.9fr) auto repeat(5,minmax(115px,1fr)) minmax(170px,1.35fr) auto}
.eco-week-button{height:39px;align-self:end;white-space:nowrap}
.economic-period-banner{
  display:flex;align-items:center;gap:10px;margin:0 0 10px;padding:9px 12px;border:1px solid #d7e5f2;
  border-radius:11px;background:#f5f9fd;color:#315675;font-size:10px
}
.economic-period-banner strong{color:#153d69}.economic-period-banner span{font-weight:800}
.economic-patient-link{border:0;background:transparent;padding:0;margin:0;color:inherit;cursor:pointer;text-align:left}
.economic-patient-link b{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}
.economic-patient-link:hover b,.economic-patient-link:focus-visible b{color:#0b73d9}
.economic-patient-link:focus-visible{outline:2px solid rgba(24,136,255,.18);outline-offset:2px;border-radius:4px}
.economic-period-total{
  display:grid;grid-template-columns:minmax(155px,1fr) auto auto auto;gap:14px;align-items:center;
  border-top:2px solid #dce6ef;background:#f7fafc;padding:12px 14px;font-size:9px
}
.economic-period-total>div span,.economic-period-total>div small{display:block}
.economic-period-total>div span{font-weight:900;color:#173a63}
.economic-period-total>div small{margin-top:2px;color:#64748b}
.economic-period-total>b,.economic-period-total>strong,.economic-period-total>em{font-style:normal;text-align:right;white-space:nowrap}
.eco-break-total{border-top:2px solid #cfdbe6!important;background:#f7fafc;font-weight:900}
.eco-break-total span{font-weight:900;color:#173a63}
.eco-period-inline{display:block!important;margin-top:4px!important;font-size:8px!important;font-weight:500!important}
.eco-therapist-head,.eco-therapist-row{
  display:grid;grid-template-columns:minmax(76px,1fr) 42px 42px 80px 80px;gap:6px;align-items:center
}
.eco-therapist-head{font-size:6.7px;text-transform:uppercase;color:var(--muted);padding:10px 0 6px}
.eco-therapist-row{padding:7px 0;border-top:1px solid #edf1f5;font-size:8.2px}
.eco-therapist-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.eco-therapist-row b,.eco-therapist-row i,.eco-therapist-row strong,.eco-therapist-row em{
  text-align:right;font-style:normal;font-weight:750
}
@media(max-width:1100px){
  .economic-toolbar-week{grid-template-columns:repeat(4,minmax(120px,1fr))}
  .economic-toolbar-week .eco-patient-filter{grid-column:span 2}
}
@media(max-width:720px){
  .economic-toolbar-week{grid-template-columns:1fr 1fr}
  .economic-toolbar-week .eco-week-button{grid-column:auto}
  .economic-period-total{grid-template-columns:1fr 1fr;gap:7px}
  .economic-period-total>b,.economic-period-total>strong,.economic-period-total>em{text-align:left}
  .eco-therapist-head,.eco-therapist-row{grid-template-columns:minmax(72px,1fr) 38px 38px 68px 68px;font-size:7.5px}
}


/* OP17-G — contatto separato, settimana coerente, storico -> Agenda */
.patient-contact-main{
  display:flex!important;
  flex-direction:column!important;
  align-items:flex-start!important;
  gap:4px!important;
}
.patient-name-line,.patient-phone-line{
  display:block!important;
  width:100%!important;
  min-width:0!important;
}
.patient-phone-line{margin-top:1px!important}
.patient-phone-line .patient-phone-link,
.patient-phone-line .patient-phone-text{
  display:flex!important;
  width:max-content!important;
  max-width:100%!important;
  margin:0!important;
}
.agenda-patient-profile-link{display:flex!important;width:max-content!important;max-width:100%!important}

.economic-toolbar-week{
  grid-template-columns:auto minmax(135px,.9fr) repeat(5,minmax(115px,1fr)) minmax(170px,1.35fr) auto
}
.economic-toolbar .eco-week-button{
  height:39px;
  min-height:39px;
  align-self:end;
  white-space:nowrap;
  font-family:inherit!important;
  font-size:11px!important;
  line-height:1!important;
  font-weight:700!important;
  letter-spacing:0!important;
  text-transform:none!important;
  padding:0 12px!important;
}

.history-confirm-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none!important;
  cursor:pointer;
}
.history-confirm-link:hover,.history-confirm-link:focus-visible{
  box-shadow:0 0 0 2px rgba(24,136,255,.18);
  outline:none;
}

.agenda-deeplink-target{
  position:relative;
  box-shadow:0 0 0 3px rgba(24,136,255,.28),0 9px 24px rgba(12,77,145,.14)!important;
  z-index:2;
}
.agenda-deeplink-target::after{
  content:"Da confermare";
  position:absolute;
  top:-10px;
  right:12px;
  background:#1888ff;
  color:#fff;
  border-radius:999px;
  padding:4px 8px;
  font-size:8px;
  font-weight:850;
  letter-spacing:.15px;
}
.agenda-deeplink-outcome{
  border-color:#1888ff!important;
  box-shadow:0 0 0 3px rgba(24,136,255,.14)!important;
}

@media(max-width:1100px){
  .economic-toolbar-week{grid-template-columns:repeat(4,minmax(120px,1fr))}
}
@media(max-width:720px){
  .economic-toolbar-week{grid-template-columns:1fr 1fr}
  .economic-toolbar-week .eco-week-button{grid-column:auto!important;font-size:11px!important}
  .patient-contact-main{gap:5px!important}
}


/* OP17-H — recupero storico verso paziente censito */
.reconcile-inbound-explain{border-left:4px solid #1888ff}
.reconcile-source-search-head{
  display:flex;justify-content:space-between;align-items:end;gap:16px;margin-bottom:12px
}
.reconcile-source-search-head h3{margin:0 0 4px}
.reconcile-source-search-head p{margin:0;color:#66788e}
.reconcile-source-search-head .reconcile-search{min-width:280px}
.reconcile-source-results{
  max-height:290px;overflow:auto;border:1px solid #e0e7ef;border-radius:12px;background:#fff
}
.reconcile-source-row{
  width:100%;border:0;border-bottom:1px solid #edf1f5;border-radius:0;text-align:left
}
.reconcile-source-row:last-child{border-bottom:0}
.reconcile-source-row:hover{background:#eef6ff}
.reconcile-selected-source{
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;padding:8px
}
.reconcile-selected-source .reconcile-source-row{
  border:1px solid #c9d9e8;border-radius:10px;background:#f4f8fc
}
.inbound-sessions-head{margin-top:16px}
.reconcile-target-chosen.fixed{border-color:#a8d5b5;background:#f0f8f2}
@media(max-width:720px){
  .reconcile-source-search-head{display:grid;grid-template-columns:1fr}
  .reconcile-source-search-head .reconcile-search{min-width:0}
  .reconcile-selected-source{grid-template-columns:1fr}
}


/* OP17-I — doppio controllo obbligatorio riconciliazione */
.reconcile-confirm-overlay{
  position:fixed;inset:0;z-index:420;background:rgba(7,22,40,.72);
  display:flex;align-items:center;justify-content:center;padding:20px
}
.reconcile-confirm-card{
  width:min(620px,100%);background:#fff;border:1px solid #d4dee9;border-radius:18px;
  box-shadow:0 30px 80px rgba(4,22,45,.38);padding:22px
}
.reconcile-confirm-card h2{margin:4px 0 8px;color:#213b5c;font-size:21px}
.reconcile-confirm-card>p{margin:0 0 16px;color:#617389;font-size:12px;line-height:1.55}
.reconcile-confirm-step{
  display:inline-flex;border-radius:999px;background:#e8f2ff;color:#1b5f9f;
  padding:5px 9px;font-size:9px;font-weight:850;text-transform:uppercase;letter-spacing:.35px
}
.reconcile-confirm-step.danger{background:#fff0ec;color:#a63b27}
.reconcile-confirm-summary{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.reconcile-confirm-summary>div,.reconcile-confirm-final-target{
  border:1px solid #e0e7ef;border-radius:11px;background:#f8fafc;padding:11px;
  display:flex;flex-direction:column;gap:3px
}
.reconcile-confirm-summary span,.reconcile-confirm-final-target span{font-size:8px;text-transform:uppercase;color:#7a899a;font-weight:800}
.reconcile-confirm-summary strong,.reconcile-confirm-final-target strong{font-size:12px;color:#263f60}
.reconcile-confirm-summary small,.reconcile-confirm-final-target small{font-size:9px;color:#697b8e}
.reconcile-confirm-final-target{margin:14px 0;border-color:#c7dbc9;background:#f1f8f2}
.reconcile-confirm-warning{
  display:flex;flex-direction:column;gap:3px;margin:12px 0;padding:10px 12px;
  border:1px solid #f2c7b8;background:#fff4ef;border-radius:10px;color:#8e422b;font-size:10px
}
.reconcile-confirm-warning.neutral{border-color:#dce5ef;background:#f6f9fc;color:#52677f}
.reconcile-confirm-check{
  display:grid;grid-template-columns:22px 1fr;gap:10px;align-items:flex-start;margin:14px 0;
  padding:12px;border:1px solid #efbba9;background:#fff6f2;border-radius:11px;color:#693725;
  font-size:11px;line-height:1.45;cursor:pointer
}
.reconcile-confirm-check input{width:17px;height:17px;margin-top:1px}
.reconcile-confirm-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}
.reconcile-confirm-actions button{min-width:130px}
.reconcile-confirm-actions .primary-button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:720px){
  .reconcile-confirm-overlay{padding:12px;align-items:flex-end}
  .reconcile-confirm-card{border-radius:17px 17px 0 0;padding:18px}
  .reconcile-confirm-summary{grid-template-columns:1fr}
  .reconcile-confirm-actions{display:grid;grid-template-columns:1fr 1fr}
  .reconcile-confirm-actions button{min-width:0;width:100%}
}


/* OP17-J — Economico -> Agenda */
.economic-agenda-cell{
  display:flex;flex-direction:column;align-items:flex-start;gap:6px;min-width:0
}
.economic-agenda-link{
  display:inline-flex;align-items:center;justify-content:center;
  color:#126cc5;text-decoration:none;font-size:8px;font-weight:800;
  border-bottom:1px solid rgba(18,108,197,.28);line-height:1.2
}
.economic-agenda-link:hover,.economic-agenda-link:focus-visible{
  color:#084d91;border-bottom-color:#084d91;outline:none
}
.economic-confirm-link{text-decoration:none!important;cursor:pointer}
.economic-confirm-link:hover,.economic-confirm-link:focus-visible{
  box-shadow:0 0 0 2px rgba(24,136,255,.18);outline:none
}
@media(max-width:720px){
  .economic-agenda-cell{align-items:flex-end;gap:4px}
  .economic-agenda-link{font-size:7.5px}
}


/* OP17-K — foglio unico completamento prestazioni paziente */
.bulk-complete-overlay{
  position:fixed;inset:0;z-index:410;background:rgba(5,20,38,.74);
  display:flex;align-items:stretch;justify-content:center;padding:18px
}
.bulk-complete-card{
  width:min(1540px,100%);height:100%;background:#f8fafc;border:1px solid #d9e2ec;
  border-radius:18px;box-shadow:0 30px 85px rgba(2,19,38,.42);overflow:hidden;
  display:flex;flex-direction:column
}
.bulk-complete-header{
  display:flex;justify-content:space-between;gap:16px;align-items:flex-start;
  padding:17px 20px;background:#fff;border-bottom:1px solid #dde6ef
}
.bulk-complete-header h2{margin:0 0 4px;color:#213b5c;font-size:20px}
.bulk-complete-header p{margin:0;color:#66798e;font-size:11px}
#bulk-complete-body{display:flex;flex-direction:column;min-height:0;flex:1}
.bulk-complete-toolbar{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:11px 18px;background:#eef5fb;border-bottom:1px solid #d8e4ef;color:#50657e;font-size:10px
}
.bulk-complete-toolbar strong{color:#203c5e}
.bulk-complete-toolbar-actions{display:flex;gap:8px}
.bulk-complete-columns,.bulk-complete-row{
  display:grid;grid-template-columns:150px minmax(160px,1.2fr) minmax(130px,.9fr) minmax(130px,.9fr) 100px minmax(140px,.85fr) minmax(135px,.8fr);
  gap:9px;align-items:center
}
.bulk-complete-columns{
  padding:8px 18px;background:#f5f8fb;border-bottom:1px solid #e0e7ee;
  color:#75869a;font-size:8px;font-weight:850;text-transform:uppercase;letter-spacing:.25px
}
.bulk-complete-list{overflow:auto;min-height:0;flex:1;background:#fff}
.bulk-complete-row{padding:10px 18px;border-bottom:1px solid #e8edf2;transition:background .15s ease}
.bulk-complete-row:hover{background:#fbfdff}
.bulk-complete-row.dirty{background:#fff9ee;box-shadow:inset 3px 0 #e8a62a}
.bulk-complete-row label{display:flex;flex-direction:column;gap:3px;min-width:0}
.bulk-complete-row label>span{display:none}
.bulk-complete-row select,.bulk-complete-row input{
  width:100%;height:34px;border:1px solid #cbd8e5;border-radius:8px;background:#fff;
  padding:0 8px;color:#203a59;font-size:10px;font-weight:650;min-width:0
}
.bulk-complete-date{display:flex;flex-direction:column;gap:2px;min-width:0}
.bulk-complete-date strong{font-size:10px;color:#203a59}
.bulk-complete-date small{font-size:8px;color:#72849a}
.bulk-agenda-link{font-size:8px;color:#126cc5;text-decoration:none;font-weight:800;width:max-content;border-bottom:1px solid rgba(18,108,197,.25)}
.bulk-missing-state span{
  display:inline-flex;border-radius:999px;padding:5px 8px;background:#fff1e8;color:#99502f;
  font-size:8px;font-weight:800;line-height:1.2
}
.bulk-complete-footer{
  display:flex;justify-content:space-between;gap:12px;padding:9px 18px;background:#f4f7fa;
  border-top:1px solid #dde5ed;color:#6f8093;font-size:8.5px
}
.bulk-empty{margin:auto;padding:40px}.bulk-empty strong{display:block;font-size:15px;color:#2b4a6c;margin-bottom:5px}
.bulk-save-confirm-overlay{
  position:fixed;inset:0;z-index:430;background:rgba(4,17,32,.74);display:flex;align-items:center;justify-content:center;padding:18px
}
.bulk-save-confirm-card{
  width:min(520px,100%);background:#fff;border-radius:16px;border:1px solid #d8e1ea;
  box-shadow:0 28px 70px rgba(4,20,38,.4);padding:20px
}
.bulk-save-confirm-card h2{margin:0 0 7px;color:#203b5c;font-size:19px}
.bulk-save-confirm-card>p{margin:0 0 15px;color:#64778d;font-size:11px;line-height:1.5}
.bulk-save-summary{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.bulk-save-summary>div{padding:10px;border:1px solid #dde6ee;background:#f8fafc;border-radius:9px;display:flex;flex-direction:column;gap:3px}
.bulk-save-summary span{font-size:8px;text-transform:uppercase;color:#7c8a9a;font-weight:800}
.bulk-save-summary strong{font-size:16px;color:#213d5f}
.bulk-save-warning,.bulk-save-ok{margin-top:12px;border-radius:9px;padding:10px;font-size:10px;line-height:1.4}
.bulk-save-warning{background:#fff5e9;border:1px solid #f0d3aa;color:#845421}
.bulk-save-ok{background:#eef8f0;border:1px solid #c8dfcc;color:#356842}
.bulk-save-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
@media(max-width:980px){
  .bulk-complete-overlay{padding:0}
  .bulk-complete-card{border-radius:0;border:0}
  .bulk-complete-columns{display:none}
  .bulk-complete-row{grid-template-columns:1fr 1fr;padding:13px}
  .bulk-complete-date,.bulk-missing-state{grid-column:1/-1}
  .bulk-complete-row label>span{display:block;font-size:8px;text-transform:uppercase;color:#72839a;font-weight:800}
  .bulk-complete-toolbar{align-items:flex-start;flex-direction:column}
  .bulk-complete-toolbar-actions{width:100%}.bulk-complete-toolbar-actions button{flex:1}
  .bulk-complete-footer{flex-direction:column}
}
@media(max-width:600px){
  .bulk-complete-row{grid-template-columns:1fr}
  .bulk-complete-date,.bulk-missing-state{grid-column:auto}
  .bulk-save-summary{grid-template-columns:1fr}
  .bulk-save-actions{display:grid;grid-template-columns:1fr 1fr}
}


/* OP17-K FIX1 — posizione azione storico + tracking modifiche */
.history-head{
  display:flex;justify-content:space-between;align-items:flex-start;gap:12px
}
.history-bulk-action{
  flex:0 0 auto;white-space:nowrap;align-self:center
}
.bulk-complete-toolbar .primary-button:disabled{
  opacity:.45;cursor:not-allowed;filter:saturate(.55)
}
@media(max-width:720px){
  .history-head{display:flex;align-items:center;gap:8px}
  .history-head>div{min-width:0;flex:1}
  .history-bulk-action{font-size:9px;padding:8px 9px;min-height:36px}
}


/* OP17-M — Report unificato: Riepilogo + Andamento */
.report-head{margin-bottom:8px}
.report-tabs{display:flex;gap:7px;margin:0 0 10px;padding:4px;background:#edf3f8;border:1px solid #dbe5ee;border-radius:11px;width:max-content}
.report-tab{border:0;background:transparent;color:#61758c;padding:8px 14px;border-radius:8px;font-size:10px;font-weight:850;cursor:pointer}
.report-tab.active{background:#fff;color:#153e6c;box-shadow:0 2px 8px rgba(17,55,94,.1)}
.report-actions{display:flex;justify-content:flex-end;align-items:center;gap:10px;margin:-8px 0 12px}
.report-action-status{font-size:9px;color:#657a91}
.report-export-button{min-height:34px}
.report-trend-panel{display:grid;gap:13px}
.report-trend-head{display:flex;justify-content:space-between;align-items:flex-end;gap:14px;background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px;box-shadow:var(--shadow)}
.report-trend-head h2{font-size:16px;margin:0}.report-trend-head p{font-size:9px;color:var(--muted);margin:4px 0 0}
.report-grain-switch{display:flex;gap:6px}.report-grain.active{background:#1888ff;color:#fff;border-color:#1888ff}
.report-trend-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.report-chart-grid-layout{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.report-chart-card,.report-trend-table{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);padding:14px;overflow:hidden}
.report-chart-card header h3,.report-trend-table h3{margin:0;font-size:13px;color:#203d60}.report-chart-card header p{margin:4px 0 8px;font-size:8.5px;color:var(--muted)}
.report-chart-svg{width:100%;height:auto;min-height:210px;overflow:visible}.report-chart-grid{stroke:#e6edf4;stroke-width:1}.report-chart-axis,.report-chart-label{font-size:8px;fill:#718096}.report-chart-line{stroke-width:2.3;vector-effect:non-scaling-stroke}.report-chart-line.primary,.report-chart-dot.primary{stroke:#2188f3;fill:#2188f3}.report-chart-line.secondary,.report-chart-dot.secondary{stroke:#21a665;fill:#21a665}.legend{display:inline-flex;align-items:center;margin-right:12px}.legend:before{content:'';width:9px;height:3px;border-radius:3px;margin-right:5px}.legend.primary:before{background:#2188f3}.legend.secondary:before{background:#21a665}
.report-outcome-bars{display:grid;grid-template-columns:repeat(auto-fit,minmax(70px,1fr));gap:8px;align-items:end;min-height:190px;padding-top:10px}.report-outcome-bucket{display:flex;flex-direction:column;gap:5px;min-width:0}.report-outcome-bucket>strong{font-size:7.5px;color:#61758c;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.report-outcome-bucket>div{height:145px;display:flex;align-items:flex-end;justify-content:center;gap:3px;border-bottom:1px solid #dce5ee}.report-mini-bar{width:10px;height:var(--bar);min-height:2px;border-radius:3px 3px 0 0}.report-mini-bar.executed{background:#27a96b}.report-mini-bar.cancelled{background:#e55858}.report-mini-bar.absent{background:#f0a23b}.report-mini-bar.confirm{background:#4b94df}.report-outcome-legend{display:flex;justify-content:center;gap:14px;flex-wrap:wrap;margin-top:10px;font-size:8px;color:#60748a}.report-outcome-legend span:before{content:'';display:inline-block;width:7px;height:7px;border-radius:2px;margin-right:4px}.report-outcome-legend .executed:before{background:#27a96b}.report-outcome-legend .cancelled:before{background:#e55858}.report-outcome-legend .absent:before{background:#f0a23b}.report-outcome-legend .confirm:before{background:#4b94df}
.report-trend-table{padding:0}.report-trend-table>header{padding:13px 14px;border-bottom:1px solid var(--line)}.report-trend-table-head,.report-trend-row{display:grid;grid-template-columns:minmax(90px,1fr) repeat(3,90px) 120px 120px;gap:8px;align-items:center;padding:9px 14px}.report-trend-table-head{background:#f7f9fc;color:#718096;font-size:7.5px;text-transform:uppercase;font-weight:850}.report-trend-row{border-top:1px solid #edf1f5;font-size:9px}.report-trend-row b,.report-trend-row strong,.report-trend-row em{text-align:right;font-style:normal}.report-scope-note{background:#f5f8fb;border:1px solid #dce6ef;border-radius:10px;padding:10px 12px;color:#60758d;font-size:9px;line-height:1.45}
@media(max-width:1000px){.report-chart-grid-layout{grid-template-columns:1fr}.report-trend-kpis{grid-template-columns:repeat(2,1fr)}.report-trend-table{overflow:auto}.report-trend-table-head,.report-trend-row{min-width:720px}}
@media(max-width:720px){.report-tabs{width:100%;display:grid;grid-template-columns:1fr 1fr}.report-tab{width:100%}.report-actions{margin:0 0 10px;justify-content:space-between}.report-trend-head{display:grid;grid-template-columns:1fr}.report-grain-switch{display:grid;grid-template-columns:repeat(3,1fr)}.report-trend-kpis{grid-template-columns:1fr 1fr}.report-chart-card{padding:10px}.report-chart-label{font-size:6px}.report-outcome-bars{overflow-x:auto;grid-template-columns:repeat(auto-fit,minmax(58px,1fr))}}


/* OP17-N — schede paziente attive */
.patient-tabs button{
  cursor:pointer;
}
.patient-tabs button:not(.active){
  opacity:1;
  color:#98a3b1;
}
.patient-tabs button:hover:not(.active),
.patient-tabs button:focus-visible:not(.active){
  color:#1683f3;
}
.patient-secondary-tab-panel{
  margin-top:16px;
}
.patient-secondary-tab-panel[hidden]{
  display:none !important;
}
.patient-secondary-empty{
  min-height:250px;
  border:1px solid #e0e7ee;
  border-radius:14px;
  background:#fffaf2;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:30px;
}
.patient-secondary-icon{
  width:56px;
  height:56px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#f0f4f7;
  font-size:24px;
  margin-bottom:12px;
}
.patient-secondary-empty h2{
  margin:0 0 6px;
  color:#203d60;
  font-size:17px;
}
.patient-secondary-empty p{
  margin:0;
  color:#6b7d91;
  font-size:10px;
}
@media(max-width:720px){
  .patient-tabs{
    overflow-x:auto;
    white-space:nowrap;
  }
  .patient-tabs button{
    flex:0 0 auto;
  }
  .patient-secondary-empty{
    min-height:190px;
    padding:22px;
  }
}


/* OP17-N FIX1 — hidden deve prevalere anche su patient-detail-grid */
[data-patient-tab-panel][hidden]{
  display:none !important;
}


/* OP17-O UI FIX — Attività leggibile + sidebar operatore */
.operator-card{
  display:flex;
  flex-direction:column;
  gap:3px;
  margin:10px 0 4px;
  padding:10px 0 9px;
  border-top:1px solid rgba(255,255,255,.14);
  border-bottom:1px solid rgba(255,255,255,.10);
  min-width:0;
}
.operator-card strong{
  display:block;
  color:#fff;
  font-size:12px;
  line-height:1.25;
  font-weight:800;
  overflow:hidden;
  text-overflow:ellipsis;
}
.operator-card .operator-role{
  display:block;
  color:#dbe8f7;
  font-size:9px;
  line-height:1.35;
  font-weight:700;
}
.operator-card small{
  display:block;
  color:#b9cbe0;
  font-size:8.5px;
  line-height:1.35;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.activity-page{width:min(1180px,100%);}
.activity-head{margin-bottom:10px;}
.activity-tabs{margin-bottom:14px;}
.activity-feed{display:grid;gap:10px;}
.activity-card{
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  gap:12px;
  padding:14px 16px;
  background:#fff;
  border:1px solid #dfe7ef;
  border-radius:13px;
  box-shadow:0 4px 16px rgba(24,61,99,.055);
}
.activity-avatar{
  width:38px;height:38px;border-radius:50%;
  display:grid;place-items:center;
  background:#e8f2fb;color:#1f5f99;
  font-weight:850;font-size:11px;
}
.activity-card-main{min-width:0;}
.activity-card-top{
  display:flex;justify-content:space-between;align-items:flex-start;gap:18px;
}
.activity-card-top>div:first-child{
  min-width:0;display:flex;flex-direction:column;gap:3px;
}
.activity-actor{color:#163b63;font-size:12px;line-height:1.3;}
.activity-action{color:#566f8a;font-size:10px;line-height:1.35;font-weight:650;}
.activity-role{color:#708397;font-size:9px;line-height:1.35;}
.activity-when{
  flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-end;gap:2px;
  color:#74869a;font-size:8.5px;line-height:1.25;
}
.activity-when time{color:#425c77;font-weight:750;}
.activity-change-list{
  display:grid;gap:7px;margin-top:12px;padding-top:11px;border-top:1px solid #edf1f5;
}
.activity-change{
  display:grid;grid-template-columns:minmax(110px,170px) minmax(0,1fr);
  gap:12px;align-items:center;
}
.activity-field{color:#667b91;font-size:9px;font-weight:750;}
.activity-before-after{
  display:grid;grid-template-columns:minmax(0,1fr) 18px minmax(0,1fr);
  align-items:center;gap:5px;min-width:0;font-size:9.5px;
}
.activity-before,.activity-after{
  padding:6px 8px;border-radius:7px;overflow-wrap:anywhere;
}
.activity-before{color:#6e7c8d;background:#f4f6f8;}
.activity-after{color:#175f43;background:#edf8f2;}
.activity-arrow{color:#94a2b0;text-align:center;font-weight:800;}
.activity-muted-note{
  margin-top:10px;padding:8px 10px;border-radius:8px;
  background:#f7f9fb;color:#8592a0;font-size:8.5px;
}
.activity-technical{margin-top:9px;color:#8795a5;font-size:8px;}
.activity-technical summary{
  cursor:pointer;width:max-content;color:#74879a;font-weight:700;
}
.activity-technical>div{
  display:grid;grid-template-columns:55px minmax(0,1fr);gap:8px;margin-top:5px;
}
.activity-technical code{
  overflow-wrap:anywhere;color:#728196;font-size:7.5px;
}
.activity-access-event{margin-top:9px;}
.activity-event{
  display:inline-flex;align-items:center;min-height:23px;padding:3px 9px;
  border-radius:999px;font-size:8px;font-weight:800;
}
.activity-event.login{background:#e8f7ef;color:#187448;}
.activity-event.logout{background:#f2f4f7;color:#68788b;}
@media(max-width:720px){
  .activity-card{grid-template-columns:34px minmax(0,1fr);padding:12px;gap:9px;}
  .activity-avatar{width:32px;height:32px;font-size:9px;}
  .activity-card-top{display:grid;grid-template-columns:1fr auto;gap:8px;}
  .activity-change{grid-template-columns:1fr;gap:4px;}
  .activity-before-after{grid-template-columns:1fr 14px 1fr;}
}


/* OP17-P — Scheda Paziente: Anagrafica separata dal Percorso clinico */
.patient-sheet-panel{
  display:grid;
  gap:16px;
}
.patient-sheet-section{
  border:1px solid #dfe7ef;
  border-radius:13px;
  background:#fff;
  overflow:hidden;
}
.patient-sheet-section-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:13px 15px 11px;
  border-bottom:1px solid #e9eef3;
  background:#f8fafc;
}
.patient-sheet-section-head h3{
  margin:0;
  color:#173d65;
  font-size:14px;
  line-height:1.25;
}
.patient-sheet-section-head p{
  margin:4px 0 0;
  color:#708399;
  font-size:9.5px;
  line-height:1.4;
}
.patient-anagraphic-section .patient-sheet-grid{
  padding:14px;
  margin:0;
}
.patient-clinical-section{
  border-color:#e5dcc7;
  background:#fffdf8;
}
.patient-clinical-section .patient-sheet-section-head{
  background:#fff9ef;
  border-bottom-color:#eee3cf;
}
.patient-clinical-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  padding:14px;
}
.patient-clinical-grid .patient-sheet-field.wide{
  grid-column:span 2;
}
.patient-sheet-field{
  min-height:62px;
  padding:10px 11px;
}
.patient-sheet-field span{
  font-size:8.5px;
  letter-spacing:.02em;
  line-height:1.2;
}
.patient-sheet-field strong{
  margin-top:5px;
  font-size:11px;
  line-height:1.35;
}
.patient-extension-grid{
  margin-top:0;
}
@media(max-width:1000px){
  .patient-clinical-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media(max-width:720px){
  .patient-sheet-section-head{
    padding:12px;
  }
  .patient-sheet-section-head h3{
    font-size:13px;
  }
  .patient-clinical-grid{
    grid-template-columns:1fr;
    padding:12px;
  }
  .patient-clinical-grid .patient-sheet-field.wide{
    grid-column:auto;
  }
  .patient-anagraphic-section .patient-sheet-grid{
    padding:12px;
  }
}


/* OP17-Q — leggibilità scheda + ordine identità/clinica + foto evoluzione */
.patient-sheet-panel{
  gap:18px;
}
.patient-sheet-head h2{
  font-size:20px;
  line-height:1.25;
}
.patient-sheet-head p{
  font-size:11px;
  line-height:1.45;
}
.patient-sheet-section-head{
  padding:15px 17px 13px;
}
.patient-sheet-section-head h3{
  font-size:16px;
}
.patient-sheet-section-head p{
  font-size:11px;
}
.patient-sheet-field{
  min-height:70px;
  padding:12px 13px;
}
.patient-sheet-field span{
  font-size:10px;
  letter-spacing:.015em;
}
.patient-sheet-field strong{
  margin-top:6px;
  font-size:13px;
  line-height:1.42;
}
.patient-extension-card header h3{
  font-size:16px;
}
.patient-extension-card header p,
.guardian-summary-main,
.consent-summary-list{
  font-size:11px;
}
.patient-identity-extension{
  margin-top:0;
}
.patient-clinical-head{
  align-items:center;
}
.clinical-edit-trigger{
  flex:0 0 auto;
  min-height:36px;
  font-size:10px;
}
.patient-evolution-photos{
  margin:0 14px 14px;
  border-top:1px solid #eadfc9;
  padding-top:14px;
}
.patient-evolution-photos>header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
}
.patient-evolution-photos h4{
  margin:0;
  color:#173d65;
  font-size:14px;
  line-height:1.3;
}
.patient-evolution-photos p{
  margin:4px 0 0;
  color:#708399;
  font-size:10.5px;
  line-height:1.45;
}
.patient-evolution-empty{
  min-height:150px;
  border:1px dashed #d7cbb7;
  border-radius:12px;
  background:#fffaf2;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:22px;
  gap:5px;
}
.patient-evolution-icon{
  width:46px;
  height:46px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#f3eee4;
  font-size:21px;
  margin-bottom:4px;
}
.patient-evolution-empty strong{
  color:#24486d;
  font-size:12px;
}
.patient-evolution-empty span{
  max-width:620px;
  color:#78899a;
  font-size:10px;
  line-height:1.45;
}
.patient-consents-card{
  margin-top:0;
}
@media(max-width:720px){
  .patient-sheet-head h2{font-size:18px;}
  .patient-sheet-head p{font-size:10.5px;}
  .patient-sheet-section-head{
    display:grid;
    grid-template-columns:1fr;
    padding:13px;
  }
  .patient-sheet-section-head h3{font-size:15px;}
  .patient-sheet-section-head p{font-size:10.5px;}
  .patient-sheet-field span{font-size:9.5px;}
  .patient-sheet-field strong{font-size:12.5px;}
  .clinical-edit-trigger{width:100%;}
  .patient-evolution-photos{margin:0 12px 12px;}
  .patient-evolution-photos>header{
    display:grid;
    grid-template-columns:1fr;
  }
}


/* OP17-R — Patient Workspace redesign inspired by legacy clinical workflow */
.patient-sheet-panel{
  gap:20px;
}
.patient-sheet-head h2{
  font-size:22px;
}
.patient-sheet-head p{
  font-size:12px;
}
.patient-sheet-section-head{
  padding:16px 18px 14px;
}
.patient-sheet-section-head h3{
  font-size:17px;
}
.patient-sheet-section-head p{
  font-size:11.5px;
}
.patient-sheet-field{
  min-height:76px;
  padding:13px 14px;
}
.patient-sheet-field span{
  font-size:10.5px;
  font-weight:700;
}
.patient-sheet-field strong{
  font-size:14px;
  line-height:1.45;
}
.patient-guardians-card,
.patient-consents-card{
  border-radius:13px;
  border:1px solid #dfe7ef;
  background:#fff;
  padding:15px 16px;
}
.patient-guardians-card header h3,
.patient-consents-card header h3{
  font-size:17px;
}
.patient-guardians-card header p,
.patient-consents-card header p,
.guardian-summary-main,
.consent-summary-list{
  font-size:11.5px;
}
.patient-clinical-workspace{
  border:1px solid #dfd2b8;
  box-shadow:0 6px 20px rgba(86,63,27,.05);
}
.patient-clinical-primary{
  padding-bottom:16px;
}
.clinical-edit-trigger{
  min-height:38px;
  font-size:10.5px;
  font-weight:800;
}
.patient-clinical-tools{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  padding:0 14px 14px;
}
.clinical-tool-card{
  border:1px solid #e4dccd;
  border-radius:12px;
  background:#fff;
  overflow:hidden;
}
.clinical-tool-card>header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  padding:13px 14px;
  border-bottom:1px solid #efe7da;
  background:#fffaf3;
}
.clinical-tool-card h4{
  margin:0;
  color:#1f446b;
  font-size:14px;
}
.clinical-tool-card p{
  margin:4px 0 0;
  color:#718397;
  font-size:10px;
  line-height:1.4;
}
.clinical-tool-empty{
  min-height:132px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:5px;
  padding:18px;
}
.clinical-tool-icon{
  width:42px;height:42px;border-radius:50%;
  display:grid;place-items:center;
  background:#f2f5f8;font-size:19px;margin-bottom:2px;
}
.clinical-tool-empty strong{
  color:#24486d;
  font-size:11.5px;
}
.clinical-tool-empty>span:last-child{
  max-width:460px;
  color:#7b8a99;
  font-size:9.5px;
  line-height:1.4;
}
.history-workspace{
  border-radius:14px;
}
.history-workspace .history-head h2{
  font-size:17px;
}
.history-workspace .history-head p{
  font-size:10.5px;
}
.history-capability-strip{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  padding:10px 0 12px;
  border-bottom:1px solid #e9eef3;
}
.history-capability-strip span{
  display:inline-flex;
  min-height:25px;
  align-items:center;
  padding:4px 9px;
  border-radius:999px;
  background:#f3f6f9;
  color:#5b7289;
  font-size:8.5px;
  font-weight:750;
}
.history-state{
  font-size:10.5px;
}
.history-session-card{
  border-radius:10px;
}
.patient-tabs button{
  font-size:11px;
  font-weight:800;
}
@media(max-width:900px){
  .patient-clinical-tools{
    grid-template-columns:1fr;
  }
}
@media(max-width:720px){
  .patient-sheet-head h2{font-size:19px;}
  .patient-sheet-head p{font-size:11px;}
  .patient-sheet-section-head h3{font-size:16px;}
  .patient-sheet-section-head p{font-size:10.5px;}
  .patient-sheet-field span{font-size:10px;}
  .patient-sheet-field strong{font-size:13px;}
  .patient-clinical-tools{padding:0 12px 12px;}
  .clinical-tool-card>header{display:grid;grid-template-columns:1fr;}
  .patient-tabs button{font-size:10.5px;}
}


/* OP17-S — Archivio documentale privato + Foto evoluzione */
.patient-documents-tab{
  display:grid;
  gap:12px;
}
.patient-documents-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  padding:15px 16px;
  border:1px solid #dfe7ef;
  border-radius:13px;
  background:#fff;
}
.patient-documents-head h2{
  margin:0;
  color:#173d65;
  font-size:18px;
}
.patient-documents-head p{
  margin:4px 0 0;
  color:#6f8297;
  font-size:11px;
  line-height:1.45;
}
.patient-documents-toolbar{
  display:flex;
  justify-content:flex-end;
}
.patient-documents-toolbar label{
  display:grid;
  gap:4px;
  color:#6c7e92;
  font-size:9px;
  font-weight:700;
}
.patient-documents-toolbar select{
  min-width:180px;
  height:36px;
  border:1px solid #d8e2ec;
  border-radius:9px;
  padding:0 10px;
  background:#fff;
  color:#173d65;
  font-weight:700;
}
.patient-document-list{
  display:grid;
  gap:9px;
}
.patient-document-card{
  display:grid;
  grid-template-columns:48px minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border:1px solid #dde6ee;
  border-radius:12px;
  background:#fff;
}
.patient-document-kind{
  width:42px;height:42px;
  border-radius:10px;
  display:grid;place-items:center;
  background:#edf4fa;
  color:#245e93;
  font-size:11px;
  font-weight:850;
}
.patient-document-main{
  min-width:0;
}
.patient-document-title{
  display:flex;
  align-items:baseline;
  gap:8px;
  flex-wrap:wrap;
}
.patient-document-title strong{
  color:#173d65;
  font-size:12.5px;
}
.patient-document-title span{
  color:#688096;
  font-size:9px;
  font-weight:700;
}
.patient-document-meta{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:5px;
  color:#7a8c9e;
  font-size:8.5px;
}
.patient-document-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.danger-button{
  min-height:34px;
  padding:0 11px;
  border:1px solid #efb4b4;
  border-radius:8px;
  background:#fff5f5;
  color:#b33b3b;
  font-weight:800;
  cursor:pointer;
}
.clinical-tool-empty.has-items{
  display:block;
  min-height:unset;
  text-align:left;
}
.clinical-document-summary-list{
  display:grid;
  gap:6px;
  width:100%;
}
.clinical-document-summary-list button{
  width:100%;
  display:grid;
  gap:2px;
  text-align:left;
  border:1px solid #e5e9ee;
  border-radius:8px;
  background:#fff;
  padding:8px 9px;
  cursor:pointer;
}
.clinical-document-summary-list strong{
  color:#24486d;
  font-size:10.5px;
}
.clinical-document-summary-list span{
  color:#77899a;
  font-size:8.5px;
}
.clinical-tool-empty.has-items>small{
  display:block;
  margin-top:7px;
  color:#7c8c9d;
  font-size:8px;
}
.clinical-photo-grid{
  width:100%;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
}
.clinical-photo-grid button{
  border:1px solid #e4e8ed;
  border-radius:9px;
  background:#fff;
  padding:8px;
  display:grid;
  gap:3px;
  text-align:left;
  cursor:pointer;
}
.photo-placeholder{
  display:grid;
  place-items:center;
  height:52px;
  border-radius:7px;
  background:#f0f4f7;
  font-size:20px;
}
.clinical-photo-grid strong{
  color:#24486d;
  font-size:9.5px;
}
.clinical-photo-grid small{
  color:#7a8b9d;
  font-size:7.5px;
}
.patient-document-upload-overlay{
  z-index:5000;
}
.patient-document-upload-card{
  width:min(680px,calc(100vw - 28px));
  max-height:calc(100vh - 30px);
  overflow:auto;
  background:#fff;
  border-radius:16px;
  box-shadow:0 24px 70px rgba(18,46,77,.24);
}
.patient-document-upload-card>header{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:17px 18px 13px;
  border-bottom:1px solid #e8edf2;
}
.patient-document-upload-card h2{
  margin:0;
  color:#173d65;
  font-size:18px;
}
.patient-document-upload-card header p{
  margin:4px 0 0;
  color:#718397;
  font-size:10px;
}
.patient-document-upload-form{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  padding:16px 18px;
}
.patient-document-upload-form label{
  display:grid;
  gap:5px;
  color:#61768d;
  font-size:9px;
  font-weight:750;
}
.patient-document-upload-form input,
.patient-document-upload-form select{
  min-height:38px;
  border:1px solid #d7e1eb;
  border-radius:9px;
  padding:8px 10px;
  background:#fff;
  color:#193f67;
  font:inherit;
}
.document-upload-status{
  min-height:18px;
  padding:0 18px;
  color:#b14a3c;
  font-size:9px;
}
.patient-document-upload-card>footer{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:13px 18px 17px;
}
@media(max-width:760px){
  .patient-documents-head{display:grid;grid-template-columns:1fr;}
  .patient-documents-head .primary-button{width:100%;}
  .patient-document-card{grid-template-columns:42px minmax(0,1fr);}
  .patient-document-actions{grid-column:1/-1;justify-content:flex-start;}
  .patient-document-upload-form{grid-template-columns:1fr;}
}
.photo-placeholder img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:7px;
  display:block;
}


/* OP17-S2 / rc25 — layout approvato: Scheda paziente + Percorso terapeutico */
.patient-sheet-panel{
  gap:18px;
}
.patient-sheet-head{
  padding:18px 20px;
  border:1px solid #dce8f4;
  border-radius:18px;
  background:linear-gradient(135deg,#ffffff 0%,#f8fbff 100%);
}
.patient-sheet-head h2{font-size:23px!important;line-height:1.2}
.patient-sheet-head p{font-size:12.5px!important}
.patient-anagraphic-section{
  overflow:visible;
  background:linear-gradient(180deg,#f7fbff 0%,#ffffff 100%);
  border-color:#d8e8f7;
}
.patient-anagraphic-section .patient-sheet-section-head{
  background:linear-gradient(135deg,#eaf5ff 0%,#f7fbff 100%);
}
.patient-anagraphic-extensions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  padding:0 14px 14px;
}
.patient-anagraphic-extensions .patient-extension-card{
  min-height:170px;
  margin:0;
  border-radius:16px;
  padding:14px 15px;
  box-sizing:border-box;
}
.patient-anagraphic-extensions .patient-guardians-card{
  background:linear-gradient(135deg,#eefcf8 0%,#f9fffd 100%);
  border-color:#d1efe6;
}
.patient-anagraphic-extensions .patient-consents-card{
  background:linear-gradient(135deg,#f6f0ff 0%,#fcfaff 100%);
  border-color:#e4d8fa;
}
.patient-anagraphic-extensions .patient-extension-card header h3{
  font-size:16px!important;
}
.patient-anagraphic-extensions .patient-extension-card header p{
  font-size:11px!important;
}
.patient-anagraphic-extensions .patient-extension-card .secondary-button{
  min-height:36px;
  padding:8px 14px;
  font-size:11px;
}
.patient-therapeutic-workspace{
  background:linear-gradient(180deg,#fffaf3 0%,#ffffff 100%);
  border-color:#eadcc3;
}
.patient-therapeutic-workspace .patient-sheet-section-head{
  background:linear-gradient(135deg,#fff5f3 0%,#fffaf2 100%);
}
.patient-therapeutic-workspace .patient-sheet-section-head h3{
  font-size:22px!important;
}
.patient-therapeutic-workspace .patient-sheet-section-head p{
  font-size:12px!important;
}
.patient-therapeutic-workspace .clinical-edit-trigger{
  min-height:46px;
  padding:11px 18px;
  font-size:13px!important;
  border-radius:12px;
}
.patient-sheet-field span{font-size:11px!important}
.patient-sheet-field strong{font-size:14px!important}

/* Popup base: wide, modern, pastel */
.patient-edit-overlay{
  padding:26px!important;
  background:rgba(10,31,56,.56)!important;
  backdrop-filter:blur(5px);
}
.patient-edit-card{
  width:min(1280px,calc(100vw - 52px))!important;
  max-height:calc(100vh - 52px)!important;
  border-radius:24px!important;
  border:1px solid rgba(173,194,218,.8)!important;
  box-shadow:0 30px 100px rgba(3,27,61,.34)!important;
  background:#fbfdff!important;
}
.patient-edit-header{
  padding:24px 28px!important;
  background:linear-gradient(135deg,#ffffff 0%,#f2f8ff 100%)!important;
}
.patient-edit-header h2{
  font-size:27px!important;
  line-height:1.18!important;
  color:#0e3f7d!important;
}
.patient-edit-header p{
  font-size:14px!important;
  line-height:1.45!important;
}
.patient-edit-close{
  width:44px!important;height:44px!important;
  border-radius:50%!important;font-size:28px!important;
}
.patient-edit-form{padding:22px 28px 28px!important}
.patient-edit-section{
  margin-bottom:16px;
  padding:20px!important;
  border:1px solid #dfeaf5!important;
  border-radius:18px;
  background:linear-gradient(135deg,#eef7ff 0%,#f9fcff 100%);
}
.patient-edit-section h3{font-size:18px!important}
.patient-edit-grid{gap:16px!important}
.patient-edit-grid label{font-size:13px!important;gap:8px!important}
.patient-edit-grid input,.patient-edit-grid textarea,.patient-edit-grid select{
  min-height:48px;
  padding:12px 14px!important;
  font-size:15px!important;
  border-radius:12px!important;
}
.patient-edit-grid textarea{min-height:110px!important}
.patient-edit-footer{
  padding:18px 0 0!important;
}
.patient-edit-footer .primary-button,
.patient-edit-footer .secondary-button{
  min-height:48px;
  padding:12px 20px;
  font-size:14px;
  border-radius:12px;
}

/* Anagraphic popup */
.patient-anagraphic-edit-card .patient-edit-section:nth-of-type(1){
  background:linear-gradient(135deg,#edf6ff,#f9fcff);
}
.patient-anagraphic-edit-card .patient-edit-section:nth-of-type(2){
  background:linear-gradient(135deg,#eefaf7,#fbfffd);
}

/* Therapeutic popup */
.therapeutic-edit-card{
  width:min(1320px,calc(100vw - 48px))!important;
  background:linear-gradient(180deg,#fff 0%,#fbfdff 100%)!important;
}
.therapeutic-edit-header{
  background:linear-gradient(135deg,#fff7f8 0%,#f8fbff 55%,#ffffff 100%)!important;
}
.therapeutic-title-wrap{
  display:flex;align-items:flex-start;gap:16px;
}
.therapeutic-title-icon{
  width:58px;height:58px;flex:0 0 58px;
  display:grid;place-items:center;
  border-radius:18px;
  background:linear-gradient(135deg,#ffe2e9,#fff0f3);
  color:#da315a;font-size:29px;
}
.therapeutic-edit-form{padding-top:18px!important}
.therapeutic-fields-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.therapeutic-field-card{
  display:grid;
  grid-template-columns:48px minmax(0,1fr);
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border:1px solid #dbe9f7;
  border-radius:16px;
  background:linear-gradient(135deg,#eaf5ff 0%,#f8fbff 100%);
}
.therapeutic-field-wide{grid-column:1/-1}
.therapeutic-field-icon{
  width:44px;height:44px;
  display:grid;place-items:center;
  border-radius:14px;
  background:#dcecff;
  color:#1674e8;
  font-size:21px;
}
.therapeutic-field-body{
  display:flex;flex-direction:column;gap:7px;min-width:0;
}
.therapeutic-field-body b{
  font-size:14px;color:#123f78;
}
.therapeutic-field-body input,
.therapeutic-field-body textarea{
  width:100%;box-sizing:border-box;
  border:1px solid #c9daeb;
  border-radius:11px;
  background:#fff;
  color:#173a63;
  font:inherit;
  font-size:15px;
  padding:11px 13px;
}
.therapeutic-field-body textarea{min-height:76px;resize:vertical}
.therapeutic-field-wide textarea{min-height:62px}
.therapeutic-assets-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-top:14px;
}
.therapeutic-assets-card{
  overflow:hidden;
  border-radius:18px;
  border:1px solid #e4e8ef;
}
.therapeutic-documents-card{
  background:linear-gradient(135deg,#fff7dc 0%,#fffdf5 100%);
  border-color:#f0e1ad;
}
.therapeutic-photos-card{
  background:linear-gradient(135deg,#eaf7ff 0%,#f7fcff 100%);
  border-color:#cfe8fa;
}
.therapeutic-assets-card>header{
  display:flex;justify-content:space-between;align-items:flex-start;gap:12px;
  padding:15px 16px;
  border-bottom:1px solid rgba(116,145,177,.18);
}
.therapeutic-assets-card h3{
  margin:0;font-size:16px;color:#123f78;
}
.therapeutic-assets-card p{
  margin:4px 0 0;font-size:10.5px;color:#698097;
}
.therapeutic-add-button{
  min-height:38px;padding:8px 13px;font-size:11px;font-weight:800;
  border-radius:11px;
}
.therapeutic-dropzone{
  margin:14px;
  min-height:88px;
  border:2px dashed #a8c9ed;
  border-radius:14px;
  background:rgba(255,255,255,.72);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:3px;text-align:center;padding:12px;cursor:pointer;
  transition:.15s ease;
}
.therapeutic-dropzone:hover,.therapeutic-dropzone.dragging{
  border-color:#1674e8;background:#f4faff;transform:translateY(-1px);
}
.therapeutic-dropzone.disabled{cursor:default;opacity:.65}
.dropzone-icon{font-size:24px;color:#1674e8}
.therapeutic-dropzone strong{font-size:11px;color:#164579}
.therapeutic-dropzone small{font-size:9px;color:#73869a}
.therapeutic-document-list{
  display:grid;gap:8px;padding:0 14px 14px;
}
.therapeutic-document-row{
  display:grid;
  grid-template-columns:38px minmax(0,1fr) 32px;
  align-items:center;gap:9px;
  padding:9px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.88);
  border:1px solid rgba(224,198,119,.34);
}
.therapeutic-doc-icon{
  width:36px;height:36px;display:grid;place-items:center;
  border-radius:10px;background:#fff0ed;font-size:18px;
}
.therapeutic-doc-open{
  border:0;background:transparent;text-align:left;padding:0;cursor:pointer;min-width:0;
}
.therapeutic-doc-open strong{
  display:block;font-size:11px;color:#153e70;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.therapeutic-doc-open small{display:block;margin-top:2px;font-size:8.5px;color:#718399}
.therapeutic-delete-button,.therapeutic-photo-delete{
  border:0;background:#fff;color:#a23b4d;border-radius:50%;cursor:pointer;
  box-shadow:0 1px 4px rgba(38,60,85,.14);font-size:18px;
}
.therapeutic-delete-button{width:30px;height:30px}
.therapeutic-photo-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:8px;
  padding:0 14px 14px;
}
.therapeutic-photo-card{
  position:relative;min-width:0;
  border-radius:12px;background:#fff;border:1px solid #dce9f4;
  overflow:hidden;padding-bottom:7px;
}
.therapeutic-photo-open{
  width:100%;height:110px;border:0;background:#eef5fb;padding:0;cursor:pointer;overflow:hidden;
}
.therapeutic-photo-open img{width:100%;height:100%;object-fit:cover;display:block}
.photo-placeholder{display:grid;place-items:center;width:100%;height:100%;font-size:25px}
.therapeutic-photo-card strong,.therapeutic-photo-card small{
  display:block;padding:0 7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.therapeutic-photo-card strong{font-size:9.5px;color:#173f70;margin-top:6px}
.therapeutic-photo-card small{font-size:8px;color:#708298;margin-top:2px}
.therapeutic-photo-delete{
  position:absolute;top:6px;right:6px;width:28px;height:28px;z-index:2;
}
.therapeutic-empty,.therapeutic-loading{
  grid-column:1/-1;
  min-height:80px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:14px;color:#6f8296;font-size:10px;
}
.therapeutic-empty strong{font-size:11px;color:#284c72}
.therapeutic-edit-status{font-size:13px!important}
.therapeutic-edit-footer{
  margin-top:16px!important;
  justify-content:space-between!important;
  background:#fff!important;
}
.therapeutic-save{
  min-width:240px;
  font-size:14px!important;
}

/* Guardians / Consents modals also modernized */
.guardian-editor-row,
.consent-signature-block,
.consent-list{
  border:1px solid #dce9f4;
  border-radius:16px;
  background:linear-gradient(135deg,#eef7ff 0%,#fbfdff 100%);
  padding:16px;
  margin-bottom:14px;
}
.guardian-editor-grid label,
.consent-signature-block label,
.consent-row{
  font-size:12.5px!important;
}
.guardian-editor-grid input,
.guardian-editor-grid select,
.consent-signature-block input,
.consent-signature-block select,
.consent-row select{
  min-height:46px!important;
  font-size:14px!important;
  border-radius:11px!important;
}
.consent-row{
  min-height:54px;
  padding:10px 12px!important;
  background:#fff;
  border-radius:12px;
}

@media(max-width:980px){
  .patient-anagraphic-extensions,
  .therapeutic-fields-grid,
  .therapeutic-assets-grid{grid-template-columns:1fr}
  .therapeutic-field-wide{grid-column:auto}
  .therapeutic-photo-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:720px){
  .patient-edit-overlay{padding:0!important}
  .patient-edit-card,.therapeutic-edit-card{
    width:100%!important;max-height:100vh!important;height:100vh!important;border-radius:0!important;
  }
  .patient-edit-header{padding:18px!important}
  .patient-edit-header h2{font-size:22px!important}
  .patient-edit-form{padding:16px!important}
  .therapeutic-title-icon{width:48px;height:48px;flex-basis:48px}
  .therapeutic-field-card{grid-template-columns:38px minmax(0,1fr);padding:11px}
  .therapeutic-field-icon{width:36px;height:36px}
  .therapeutic-photo-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .therapeutic-save{min-width:0;flex:1}
}


/* ================================================================
   OP17-T / rc26 — GLOBAL TYPOGRAPHY + MODAL DESIGN SYSTEM
   Standard visivo V4: leggibilità alta, desktop sfruttato, popup
   moderni e pastello coerenti con Percorso terapeutico.
   ================================================================ */

/* ---------- Global readable typography ---------- */
:root{
  --v4-font-body: 15px;
  --v4-font-small: 12.5px;
  --v4-font-label: 12px;
  --v4-font-value: 14.5px;
  --v4-font-button: 13.5px;
  --v4-title-1: 30px;
  --v4-title-2: 22px;
  --v4-title-3: 17px;
}
html,body{
  font-size:var(--v4-font-body)!important;
}
body,
button,
input,
select,
textarea{
  font-size:var(--v4-font-body);
}
h1{
  font-size:var(--v4-title-1)!important;
  line-height:1.18!important;
}
h2{
  font-size:var(--v4-title-2);
  line-height:1.22;
}
h3{
  font-size:var(--v4-title-3);
  line-height:1.25;
}
p,
span,
label,
small{
  line-height:1.42;
}

/* Sidebar */
.app-sidebar nav a,
.app-sidebar nav button,
.sidebar-nav a,
.sidebar-nav button,
.nav-item{
  font-size:14px!important;
}
.operator-card strong{
  font-size:14px!important;
}
.operator-card .operator-role{
  font-size:11px!important;
}
.operator-card small{
  font-size:10.5px!important;
}
.app-version,
.sidebar-version{
  font-size:10.5px!important;
}

/* Page headings/subtitles */
.patients-head h1,
.economic-head h1,
.activity-head h1,
.page-head h1,
.report-head h1{
  font-size:30px!important;
}
.patients-head p,
.economic-head p,
.activity-head p,
.page-head p,
.report-head p{
  font-size:13px!important;
}

/* Buttons everywhere */
button,
.primary-button,
.secondary-button,
.action-button,
.report-tab,
.patient-tab,
.patient-tabs button,
.bulk-complete-trigger{
  font-size:13px!important;
}
.primary-button,
.secondary-button,
.action-button{
  min-height:40px;
  padding:9px 14px;
  border-radius:10px;
}

/* Form controls everywhere */
input,
select,
textarea{
  font-size:14px!important;
}
input,
select{
  min-height:42px;
}
textarea{
  min-height:88px;
}
.search-input,
.filter-input,
.filter-select,
.economic-filter-grid input,
.economic-filter-grid select{
  font-size:13.5px!important;
  min-height:42px;
}

/* Agenda */
.agenda-toolbar,
.agenda-toolbar button,
.agenda-toolbar select,
.agenda-toolbar input{
  font-size:13px!important;
}
.agenda-day-title,
.agenda-date-label{
  font-size:16px!important;
}
.agenda-slot-title,
.agenda-hour,
.agenda-time{
  font-size:13px!important;
}
.agenda-patient-name,
.agenda-card strong,
.agenda-row strong{
  font-size:14px!important;
}
.agenda-patient-phone,
.agenda-card small,
.agenda-row small{
  font-size:11px!important;
}
.agenda-table th,
.agenda-table td{
  font-size:12.5px!important;
}
.agenda-table th{
  font-size:11.5px!important;
}
.status-chip,
.outcome-chip,
.census-chip{
  font-size:11px!important;
  padding:5px 9px!important;
}

/* Patients list */
.patient-table th,
.patient-table td,
.patients-table th,
.patients-table td{
  font-size:12.5px!important;
}
.patient-table th,
.patients-table th{
  font-size:11.5px!important;
}
.patient-name,
.patient-row strong{
  font-size:14px!important;
}
.patient-row small{
  font-size:11px!important;
}
.patient-summary-card h2,
.patient-hero h2,
.patient-header h2{
  font-size:23px!important;
}
.patient-summary-card p,
.patient-hero p,
.patient-header p{
  font-size:12px!important;
}

/* Patient sheet / history */
.patient-sheet-field span{
  font-size:11.5px!important;
}
.patient-sheet-field strong{
  font-size:15px!important;
}
.patient-extension-card h3{
  font-size:17px!important;
}
.patient-extension-card p,
.patient-extension-card small{
  font-size:11.5px!important;
}
.history-workspace .history-head h2,
.history-panel .history-head h2{
  font-size:19px!important;
}
.history-workspace .history-head p,
.history-panel .history-head p{
  font-size:11.5px!important;
}
.history-capability-strip span{
  font-size:10px!important;
  padding:6px 10px!important;
}
.history-filter-bar button,
.history-filter-bar input,
.history-filter-bar select{
  font-size:12px!important;
}
.history-row,
.history-row button,
.history-row span,
.history-row strong,
.history-list-row,
.history-list-row button,
.history-list-row span,
.history-list-row strong{
  font-size:12px!important;
}
.history-state{
  font-size:11px!important;
}

/* Report / economic */
.economic-filter-grid label,
.report-filter-grid label{
  font-size:11.5px!important;
}
.economic-period-bar,
.report-period-bar{
  font-size:12px!important;
}
.economic-kpi-card span,
.kpi-card span{
  font-size:11px!important;
}
.economic-kpi-card strong,
.kpi-card strong{
  font-size:22px!important;
}
.economic-kpi-card small,
.kpi-card small{
  font-size:10.5px!important;
}
.economic-table th,
.economic-table td,
.report-table th,
.report-table td{
  font-size:12.5px!important;
}
.economic-table th,
.report-table th{
  font-size:11.5px!important;
}
.economic-side-card h3,
.report-side-card h3{
  font-size:15px!important;
}
.economic-side-card,
.economic-side-card span,
.economic-side-card strong,
.report-side-card,
.report-side-card span,
.report-side-card strong{
  font-size:11.5px!important;
}

/* Activity */
.activity-actor{
  font-size:14px!important;
}
.activity-action{
  font-size:12px!important;
}
.activity-role{
  font-size:11px!important;
}
.activity-when{
  font-size:10.5px!important;
}
.activity-field{
  font-size:11px!important;
}
.activity-before-after{
  font-size:12px!important;
}
.activity-muted-note{
  font-size:10.5px!important;
}
.activity-technical{
  font-size:9.5px!important;
}
.activity-event{
  font-size:10px!important;
}

/* Empty/error/help text */
.patient-empty,
.patient-error,
.empty-state,
.loading-state,
.help-text,
.field-help{
  font-size:12px!important;
}

/* ---------- Unified modal shell ---------- */
.patient-edit-overlay,
.modal-overlay,
.dialog-overlay,
.reconcile-overlay,
.bulk-modal-overlay,
.guardian-modal-overlay,
.consent-modal-overlay{
  padding:26px!important;
  background:rgba(10,31,56,.56)!important;
  backdrop-filter:blur(5px);
}
.patient-edit-card,
.modal-card,
.dialog-card,
.reconcile-modal,
.bulk-modal,
.guardian-modal,
.consent-modal{
  width:min(1280px,calc(100vw - 52px))!important;
  max-width:none!important;
  max-height:calc(100vh - 52px)!important;
  border-radius:24px!important;
  border:1px solid rgba(173,194,218,.82)!important;
  box-shadow:0 30px 100px rgba(3,27,61,.34)!important;
  background:linear-gradient(180deg,#ffffff 0%,#f9fcff 100%)!important;
  overflow:hidden;
}
.patient-edit-header,
.modal-header,
.dialog-header,
.reconcile-modal header,
.bulk-modal header,
.guardian-modal header,
.consent-modal header{
  padding:22px 26px!important;
  background:linear-gradient(135deg,#ffffff 0%,#eef7ff 100%)!important;
  border-bottom:1px solid #dce9f4!important;
}
.patient-edit-header h2,
.modal-header h2,
.dialog-header h2,
.reconcile-modal header h2,
.bulk-modal header h2,
.guardian-modal header h2,
.consent-modal header h2{
  font-size:26px!important;
  color:#0f3f78!important;
}
.patient-edit-header p,
.modal-header p,
.dialog-header p,
.reconcile-modal header p,
.bulk-modal header p,
.guardian-modal header p,
.consent-modal header p{
  font-size:13px!important;
}
.patient-edit-close,
.modal-close,
.dialog-close{
  width:44px!important;
  height:44px!important;
  font-size:27px!important;
  border-radius:50%!important;
}

/* Modal bodies */
.patient-edit-form,
.modal-body,
.dialog-body,
.reconcile-body,
.bulk-modal-body,
.guardian-modal-body,
.consent-modal-body{
  padding:22px 26px 26px!important;
}
.patient-edit-section,
.modal-section,
.dialog-section,
.reconcile-panel,
.bulk-panel,
.guardian-editor-row,
.consent-signature-block,
.consent-list{
  border-radius:18px!important;
  border:1px solid #dce9f4!important;
  background:linear-gradient(135deg,#eef7ff 0%,#fbfdff 100%)!important;
}
.patient-edit-section h3,
.modal-section h3,
.dialog-section h3,
.reconcile-panel h3,
.bulk-panel h3{
  font-size:17px!important;
}
.patient-edit-grid label,
.modal-body label,
.dialog-body label,
.reconcile-body label,
.bulk-modal-body label,
.guardian-editor-grid label,
.consent-signature-block label,
.consent-row{
  font-size:12.5px!important;
}
.patient-edit-grid input,
.patient-edit-grid select,
.patient-edit-grid textarea,
.modal-body input,
.modal-body select,
.modal-body textarea,
.dialog-body input,
.dialog-body select,
.dialog-body textarea,
.reconcile-body input,
.reconcile-body select,
.reconcile-body textarea,
.bulk-modal-body input,
.bulk-modal-body select,
.bulk-modal-body textarea,
.guardian-editor-grid input,
.guardian-editor-grid select,
.guardian-editor-grid textarea,
.consent-signature-block input,
.consent-signature-block select,
.consent-row select{
  min-height:46px!important;
  font-size:14px!important;
  border-radius:11px!important;
  padding:10px 12px!important;
}
.patient-edit-footer,
.modal-footer,
.dialog-footer{
  padding-top:18px!important;
}
.patient-edit-footer button,
.modal-footer button,
.dialog-footer button{
  min-height:48px!important;
  padding:12px 20px!important;
  font-size:14px!important;
  border-radius:12px!important;
}

/* Reconcile storico modal */
.reconcile-modal{
  background:linear-gradient(180deg,#ffffff,#f9fcff)!important;
}
.reconcile-modal .reconcile-panel:first-child{
  background:linear-gradient(135deg,#f6faff,#ffffff)!important;
}
.reconcile-modal .reconcile-panel:last-child{
  background:linear-gradient(135deg,#eefaf7,#fbfffd)!important;
}
.reconcile-row,
.reconcile-session-row{
  font-size:12.5px!important;
  min-height:48px;
}
.reconcile-search input{
  min-height:46px!important;
  font-size:14px!important;
}

/* Bulk "Completa prestazioni" modal */
.bulk-modal,
.bulk-history-modal{
  width:min(1500px,calc(100vw - 40px))!important;
}
.bulk-history-table th,
.bulk-history-table td,
.bulk-modal table th,
.bulk-modal table td{
  font-size:12.5px!important;
}
.bulk-history-table th,
.bulk-modal table th{
  font-size:11.5px!important;
}
.bulk-history-table select,
.bulk-history-table input,
.bulk-modal table select,
.bulk-modal table input{
  min-height:42px!important;
  font-size:13px!important;
}

/* Document upload / photo modals if opened separately */
.document-upload-modal,
.photo-upload-modal,
.patient-document-modal{
  width:min(1200px,calc(100vw - 52px))!important;
  border-radius:24px!important;
}
.document-upload-modal label,
.photo-upload-modal label,
.patient-document-modal label{
  font-size:12.5px!important;
}
.document-upload-modal input,
.document-upload-modal select,
.photo-upload-modal input,
.photo-upload-modal select,
.patient-document-modal input,
.patient-document-modal select{
  font-size:14px!important;
  min-height:46px!important;
}

/* Mobile keeps the same visual language but uses the full screen. */
@media(max-width:720px){
  :root{
    --v4-font-body:14px;
    --v4-title-1:26px;
    --v4-title-2:20px;
  }
  .patient-edit-overlay,
  .modal-overlay,
  .dialog-overlay,
  .reconcile-overlay,
  .bulk-modal-overlay,
  .guardian-modal-overlay,
  .consent-modal-overlay{
    padding:0!important;
  }
  .patient-edit-card,
  .modal-card,
  .dialog-card,
  .reconcile-modal,
  .bulk-modal,
  .guardian-modal,
  .consent-modal{
    width:100%!important;
    max-height:100vh!important;
    height:100vh!important;
    border-radius:0!important;
  }
  .patient-edit-header,
  .modal-header,
  .dialog-header{
    padding:17px!important;
  }
  .patient-edit-header h2,
  .modal-header h2,
  .dialog-header h2{
    font-size:21px!important;
  }
  .patient-edit-form,
  .modal-body,
  .dialog-body{
    padding:15px!important;
  }
  .economic-table th,
  .economic-table td,
  .report-table th,
  .report-table td,
  .agenda-table th,
  .agenda-table td{
    font-size:11.5px!important;
  }
}


/* ================================================================
   OP17-U / rc27 — History workspace polish
   Uniforma Storico prestazioni alle nuove schede paziente:
   testata leggermente colorata + intestazioni colonne esplicite.
   ================================================================ */
.history-workspace,
.patient-summary{
  border-radius:20px!important;
  overflow:hidden;
}
.history-workspace{
  border:1px solid #e8ddc9!important;
  background:linear-gradient(180deg,#fffdf8 0%,#ffffff 100%)!important;
}
.history-workspace .history-head{
  margin:-16px -16px 0!important;
  padding:18px 18px 14px!important;
  border-bottom:1px solid #f0e5d6;
  background:linear-gradient(135deg,#fff7ea 0%,#fffdfa 100%);
}
.history-workspace .history-head h2{
  font-size:21px!important;
  color:#163c66!important;
}
.history-workspace .history-head p{
  font-size:12.5px!important;
  color:#6c7f94!important;
  max-width:780px;
}
.history-workspace .history-bulk-action{
  min-height:42px;
}
.history-capability-strip{
  padding:12px 0 14px!important;
  border-bottom:1px solid #ece4d7!important;
}
.history-capability-strip span{
  background:#f7efe3!important;
  color:#745328!important;
  border:1px solid #eedfca;
  font-size:10.5px!important;
}
.history-filters{
  margin:16px 0 14px!important;
}
.history-filters button,
.history-filters input,
.history-filters label{
  font-size:12px!important;
}
.history-filters button{
  min-height:38px;
}
.history-filters label{
  gap:5px!important;
  font-weight:700;
}
.history-filters input{
  min-height:40px!important;
}
.history-table-head{
  display:grid;
  grid-template-columns:105px minmax(180px,1.4fr) minmax(130px,1fr) 130px 100px;
  gap:10px;
  align-items:center;
  padding:11px 8px 11px 4px;
  border-top:1px solid #e5dbcd;
  border-bottom:1px solid #e5dbcd;
  background:linear-gradient(135deg,#fff5e8 0%,#fff9f1 100%);
}
.history-table-head span{
  font-size:11px!important;
  font-weight:800;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:#7b5d33;
}
.history-list{
  border-top:0!important;
}
.history-row{
  min-height:66px;
  padding:14px 4px!important;
}
.history-row b{
  font-size:13px!important;
  color:#173d65;
}
.history-row small{
  font-size:11px!important;
}
.history-inline-label{
  display:none!important;
  margin-bottom:5px;
  text-transform:uppercase;
  letter-spacing:.02em;
  font-weight:800;
  color:#7b5d33!important;
}
.patient-summary{
  border:1px solid #e8ddc9!important;
  background:linear-gradient(180deg,#fffdf8 0%,#ffffff 100%)!important;
  padding:0!important;
}
.patient-summary h2{
  margin:0!important;
  padding:18px 18px 8px!important;
  font-size:20px!important;
  color:#163c66!important;
}
.patient-summary .summary-note{
  margin:0 18px 14px!important;
  font-size:12px!important;
}
#patient-summary-content{
  padding:0 18px 18px;
}
.patient-summary .summary-kpi span{
  font-size:11px!important;
}
.patient-summary .summary-kpi strong{
  font-size:24px!important;
}
@media(max-width:980px){
  .history-table-head{
    grid-template-columns:105px minmax(170px,1.4fr) minmax(120px,1fr) 120px 85px;
  }
}
@media(max-width:720px){
  .history-workspace .history-head,
  .patient-summary{
    border-radius:18px!important;
  }
  .history-table-head{
    display:none;
  }
  .history-row{
    grid-template-columns:1fr!important;
    gap:8px!important;
    padding:14px 10px!important;
    border-radius:14px;
    background:#fff;
    margin-top:10px;
    border:1px solid #ecdfcf;
  }
  .history-inline-label{
    display:block!important;
    font-size:10px!important;
  }
  .history-list{
    display:grid;
    gap:0;
    border-top:0!important;
  }
  .history-workspace .history-head{
    margin:-16px -16px 0!important;
  }
}


/* ================================================================
   OP17-V / rc28 — Agenda deferred save
   Compilazione libera + un solo salvataggio finale.
   ================================================================ */
.agenda-page-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.agenda-pending-label{
  font-size:11.5px!important;
  color:#728399;
  font-weight:700;
}
.agenda-pending-label.has-pending{
  color:#9a6517;
}
.agenda-save-button{
  min-height:42px;
  padding:9px 16px;
  border:1px solid #c9d9ea;
  border-radius:11px;
  background:#e9eef4;
  color:#8090a1;
  font-size:13px!important;
  font-weight:800;
  cursor:not-allowed;
  display:inline-flex;
  align-items:center;
  gap:7px;
}
.agenda-save-button.has-pending:not(:disabled){
  border-color:#1685ef;
  background:linear-gradient(135deg,#1685ef,#0872dc);
  color:#fff;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(22,133,239,.22);
}
.appointment-row.agenda-row-pending{
  position:relative;
  box-shadow:inset 4px 0 0 #f0a521, 0 0 0 1px rgba(240,165,33,.18)!important;
  background:linear-gradient(90deg,#fff9e9 0%,#fffdf7 26%,var(--agenda-row-bg,#fff) 100%)!important;
}
.appointment-row.agenda-row-pending::after{
  content:'DA SALVARE';
  position:absolute;
  top:5px;
  right:7px;
  padding:3px 7px;
  border-radius:999px;
  background:#fff0c8;
  color:#8a5a0b;
  font-size:8.5px;
  font-weight:900;
  letter-spacing:.03em;
  z-index:3;
}
.appointment-row.agenda-row-saved{
  box-shadow:inset 4px 0 0 #22a06b,0 0 0 2px rgba(34,160,107,.14)!important;
}
.appointment-row.agenda-row-save-error{
  box-shadow:inset 4px 0 0 #dc4c57,0 0 0 2px rgba(220,76,87,.16)!important;
}
@media(max-width:900px){
  .agenda-page-actions{
    width:100%;
    justify-content:flex-start;
  }
}
@media(max-width:720px){
  .agenda-save-button{
    flex:1;
    justify-content:center;
    min-height:46px;
  }
  .agenda-pending-label{
    width:100%;
  }
  .appointment-row.agenda-row-pending::after{
    position:static;
    display:inline-flex;
    width:max-content;
    margin:8px 10px 0;
  }
}


/* OP17-V FIX1 / rc29 — historical Calendar-only first-write diagnostics */
.appointment-row.agenda-row-save-error{
  position:relative;
}
.appointment-row.agenda-row-save-error::before{
  content:'ERRORE SALVATAGGIO';
  position:absolute;
  left:8px;
  bottom:5px;
  padding:3px 7px;
  border-radius:999px;
  background:#ffe5e8;
  color:#a72b38;
  font-size:8.5px;
  font-weight:900;
  letter-spacing:.02em;
  z-index:4;
}


/* ================================================================
   OP17-W / rc30 — Salva riga + Salva tutte, senza reload
   ================================================================ */
.time-band-columns,
.appointment-row{
  grid-template-columns:
    88px
    minmax(155px,1.2fr)
    minmax(135px,1.02fr)
    minmax(108px,.86fr)
    minmax(108px,.86fr)
    82px
    136px
    86px
    58px
    96px!important;
}
.row-save-cell,
.history-cell,
.census-cell{
  display:flex;
  justify-content:center;
  align-items:center;
}
.row-save-button{
  min-width:74px;
  min-height:36px;
  border:1px solid transparent;
  border-radius:10px;
  background:#e8edf3;
  color:#7f8c9c;
  font-size:10.5px!important;
  font-weight:850;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transform:translateY(2px);
  transition:opacity .15s,transform .15s,background .15s,color .15s,border-color .15s;
}
.row-save-button.is-visible{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transform:none;
  background:#147df0;
  border-color:#147df0;
  color:#fff;
  cursor:pointer;
  box-shadow:0 4px 12px rgba(20,125,240,.18);
}
.row-save-button.is-saving{
  background:#e9eef4;
  border-color:#d4dde7;
  color:#68788b;
  box-shadow:none;
  cursor:wait;
}
.row-save-button.is-saved{
  background:#e5f7ee;
  border-color:#bde6d1;
  color:#168454;
  box-shadow:none;
}
.row-save-button.is-error{
  background:#fff0f2;
  border-color:#f1c4ca;
  color:#b52f40;
  box-shadow:none;
}
.mobile-row-save-button{
  display:none;
}
.agenda-save-button.has-pending:not(:disabled){
  background:linear-gradient(135deg,#0e79e8,#086bd2)!important;
}
@media(max-width:1250px){
  .time-band-columns,
  .appointment-row{
    grid-template-columns:
      80px
      minmax(140px,1.15fr)
      minmax(118px,.98fr)
      98px
      98px
      75px
      126px
      78px
      52px
      90px!important;
  }
  .row-save-button{
    min-width:66px;
    padding:0 6px;
    font-size:9.5px!important;
  }
}
@media(max-width:720px){
  .appointment-row{
    grid-template-columns:58px minmax(0,1fr) auto!important;
  }
  .appointment-row>.row-save-cell{
    display:none!important;
  }
  .mobile-row-save-button{
    display:none!important;
    grid-column:1/-1;
    min-height:42px!important;
    border-radius:10px!important;
    font-size:11px!important;
    font-weight:850!important;
    align-items:center!important;
    justify-content:center!important;
    gap:6px!important;
  }
  .mobile-row-save-button.is-visible{
    display:flex!important;
    background:#147df0!important;
    border-color:#147df0!important;
    color:#fff!important;
  }
  .mobile-row-save-button.is-saving{
    background:#e9eef4!important;
    border-color:#d4dde7!important;
    color:#68788b!important;
  }
  .mobile-row-save-button.is-saved{
    background:#e5f7ee!important;
    border-color:#bde6d1!important;
    color:#168454!important;
  }
  .mobile-row-save-button.is-error{
    background:#fff0f2!important;
    border-color:#f1c4ca!important;
    color:#b52f40!important;
  }
}

/* ================================================================
   OP17-W FIX3 / rc33 — THERAPEUTIC MODAL VIEWPORT SCROLL FIX
   Root cause: the global rc26 modal shell sets overflow:hidden on
   .patient-edit-card while the therapeutic form had no scroll owner.
   On shorter desktop viewports the assets section ended behind the
   sticky footer and could not be fully reached.
   Scope: only #patient-therapeutic-modal.
   ================================================================ */
#patient-therapeutic-modal .therapeutic-edit-card{
  display:flex!important;
  flex-direction:column!important;
  max-height:calc(100dvh - 52px)!important;
  overflow:hidden!important;
}
#patient-therapeutic-modal .therapeutic-edit-header{
  position:relative!important;
  top:auto!important;
  flex:0 0 auto!important;
  z-index:6!important;
}
#patient-therapeutic-modal .therapeutic-edit-form{
  flex:1 1 auto!important;
  min-height:0!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding-bottom:0!important;
}
#patient-therapeutic-modal .therapeutic-edit-footer{
  position:sticky!important;
  bottom:0!important;
  z-index:7!important;
  margin:16px -26px 0!important;
  padding:14px 26px 18px!important;
  border-top:1px solid #dce9f4!important;
  background:rgba(255,255,255,.97)!important;
  box-shadow:0 -10px 24px rgba(17,55,92,.10)!important;
  backdrop-filter:blur(6px);
}
@media(max-width:720px){
  #patient-therapeutic-modal .therapeutic-edit-card{
    max-height:100dvh!important;
    height:100dvh!important;
  }
  #patient-therapeutic-modal .therapeutic-edit-form{
    padding-bottom:0!important;
  }
  #patient-therapeutic-modal .therapeutic-edit-footer{
    margin:14px -16px 0!important;
    padding:12px 16px max(14px,env(safe-area-inset-bottom))!important;
  }
}

/* ================================================================
   OP17-X / rc35-preview — HISTORY SESSION WORKSPACE PREVIEW
   Selezione riga + toolbar attiva + workspace singola seduta.
   Frontend-only: nessun nuovo dato clinico di seduta viene persistito.
   ================================================================ */
.history-session-toolbar{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px 14px!important;
  align-items:center;
}
.history-session-actions{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}
.history-session-actions button{
  appearance:none;
  border:1px solid #e1d1b7;
  background:#fff8ee;
  color:#6d4d22;
  min-height:31px;
  padding:6px 11px;
  border-radius:999px;
  font:inherit;
  font-size:10.5px;
  font-weight:800;
  cursor:pointer;
  transition:.15s ease;
}
.history-session-actions button:hover:not(:disabled){
  border-color:#b99159;
  background:#fff2df;
  transform:translateY(-1px);
}
.history-session-actions button:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none;
}
.history-selected-session{
  color:#687a8e!important;
  font-size:10.5px!important;
  line-height:1.35;
  text-align:right;
}
.history-selected-session strong{color:#1c507f}
.history-session-card{
  cursor:pointer;
  position:relative;
  transition:background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.history-session-card:hover{
  background:#fffaf2;
}
.history-session-card.is-selected{
  background:linear-gradient(90deg,#eef7ff 0%,#fffdf9 78%)!important;
  box-shadow:inset 4px 0 0 #2489ef,0 0 0 1px #bedcff;
}
.history-session-card.is-selected::after{
  content:'SELEZIONATA';
  position:absolute;
  right:8px;
  top:6px;
  padding:2px 6px;
  border-radius:999px;
  background:#e7f3ff;
  color:#176ab5;
  font-size:7.5px;
  font-weight:900;
  letter-spacing:.04em;
}
/* OP17-X R4 / rc38-preview — CLINICAL DETAILS WITHOUT DUPLICATES */
.history-session-workspace-overlay{
  position:fixed;inset:0;z-index:300;display:flex;align-items:center;justify-content:center;
  padding:24px;background:rgba(15,38,66,.55);backdrop-filter:blur(5px);
}
.history-session-workspace-dialog{
  width:min(1420px,calc(100vw - 48px));height:min(880px,calc(100vh - 48px));max-height:94vh;
  display:flex;flex-direction:column;overflow:hidden;border:1px solid #d9e6f2;border-radius:30px;
  background:#fbfdff;box-shadow:0 30px 90px rgba(25,53,84,.32);
}
.history-session-workspace-head{
  display:flex;align-items:center;justify-content:space-between;gap:24px;padding:26px 30px 22px;
  border-bottom:1px solid #dfeaf4;background:linear-gradient(135deg,#eef7ff 0%,#f8f2ff 47%,#fff9eb 100%);
}
.history-session-workspace-hero{display:flex;align-items:center;gap:18px;min-width:0}
.history-session-workspace-icon{
  width:62px;height:62px;display:grid;place-items:center;flex:0 0 62px;border-radius:20px;
  background:linear-gradient(145deg,#dceeff,#edf6ff);box-shadow:inset 0 0 0 1px #cfe2f5;color:#2485dc;font-size:28px;font-weight:900;
}
.history-session-workspace-head small{display:block;margin-bottom:4px;text-transform:uppercase;letter-spacing:.08em;color:#6e8399;font-size:11px;font-weight:900}
.history-session-workspace-head h2{margin:0;color:#123f6c;font-size:31px;line-height:1.1;letter-spacing:-.02em}
.history-session-workspace-head p{margin:7px 0 0;color:#5f7790;font-size:16px;font-weight:700}
.history-session-workspace-close{
  width:48px;height:48px;flex:0 0 48px;border:1px solid #d8e5f0;border-radius:50%;background:rgba(255,255,255,.74);
  color:#355b7d;font-size:28px;line-height:1;cursor:pointer;box-shadow:0 5px 18px rgba(41,76,109,.08);
}
.history-session-workspace-close:hover{background:#fff;transform:translateY(-1px)}
.history-session-workspace-summary{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;padding:18px 30px;border-bottom:1px solid #e4edf5;background:#fff;
}
.history-session-workspace-summary>div{
  min-width:0;padding:15px 17px;border:1px solid #dfe8f1;border-radius:17px;background:#f8fbfd;
}
.history-session-workspace-summary>div.tone-blue{background:#eef7ff;border-color:#d2e7fa}
.history-session-workspace-summary>div.tone-green{background:#eefaf4;border-color:#d2ebdd}
.history-session-workspace-summary>div.tone-sand{background:#fff8e9;border-color:#f2e2bc}
.history-session-workspace-summary span,.history-session-detail-grid span{
  display:block;margin-bottom:6px;color:#6d8297;font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.06em;
}
.history-session-workspace-summary strong{display:block;overflow:hidden;color:#20496f;font-size:16px;text-overflow:ellipsis;white-space:nowrap}
.history-session-workspace-tabs{
  display:flex;gap:10px;padding:16px 30px 0;background:#fff;border-bottom:1px solid #e6edf4;
}
.history-session-workspace-tabs button{
  border:1px solid #dce6ef;border-bottom:0;background:#f7fafc;color:#526d86;min-height:45px;padding:10px 20px;
  border-radius:14px 14px 0 0;font:inherit;font-size:14px;font-weight:850;cursor:pointer;
}
.history-session-workspace-tabs button:hover{background:#f0f7fd;color:#236ea9}
.history-session-workspace-tabs button.active{border-color:#c8e0f5;background:#eef7ff;color:#126fbd;box-shadow:inset 0 3px 0 #58a9ed}
.history-session-workspace-body{flex:1;min-height:0;overflow:auto;padding:26px 30px 30px;background:linear-gradient(180deg,#fbfdff 0%,#ffffff 100%)}
.history-session-details-layout{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(380px,.85fr);gap:22px;min-height:100%}
.history-session-detail-panel,.history-session-clinical-panel{
  padding:22px;border:1px solid #dfe8f1;border-radius:22px;background:#fff;box-shadow:0 8px 24px rgba(27,67,105,.05);
}
.history-session-clinical-panel{background:linear-gradient(145deg,#fff7f9 0%,#fffdf6 100%);border-color:#f0dfe3}
.history-session-section-title{display:flex;align-items:flex-start;gap:13px}
.history-session-section-icon{
  width:40px;height:40px;display:grid;place-items:center;flex:0 0 40px;border-radius:13px;font-size:17px;font-weight:900;color:#2a6f9d;
}
.history-session-section-icon.tone-blue{background:#e4f2ff;color:#1f79bd}
.history-session-section-icon.tone-green{background:#e7f7ee;color:#27895b}
.history-session-section-icon.tone-rose{background:#fdecef;color:#c84d6a}
.history-session-section-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:18px}
.history-session-section-title h3{margin:0 0 5px;color:#174a78;font-size:20px;line-height:1.2}
.history-session-section-title p{margin:0;color:#6b8094;font-size:13px;line-height:1.5}
.history-session-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:20px}
.history-session-detail-grid>div{padding:16px 17px;border:1px solid #dde8f1;border-radius:16px;background:#f8fbfd}
.history-session-detail-grid>div.tone-blue{background:#f1f8ff;border-color:#d8eaf9}
.history-session-detail-grid>div.tone-lilac{background:#f7f2ff;border-color:#e7dcf6}
.history-session-detail-grid>div.tone-sand{background:#fff9ee;border-color:#f0e2c7}
.history-session-detail-grid>div.tone-green{background:#f0faf5;border-color:#d9ecdf}
.history-session-detail-grid strong{color:#263f5e;font-size:15px;line-height:1.35}
.history-session-clinical-placeholder{
  display:flex;flex-direction:column;justify-content:center;min-height:280px;margin-top:20px;padding:26px;border:1px dashed #e5bdc8;border-radius:18px;
  background:rgba(255,255,255,.74);
}
.history-session-clinical-placeholder strong{color:#82445a;font-size:17px;margin-bottom:8px}
.history-session-clinical-placeholder p{margin:0;color:#6e6670;font-size:14px;line-height:1.7}
.history-session-clinical-placeholder span{display:block;margin-top:16px;color:#9a7180;font-size:12px;font-weight:750}
.history-session-preview-badge{flex:0 0 auto;padding:7px 11px;border-radius:999px;background:#fff1cf;color:#97620f;font-size:9px;font-weight:900;letter-spacing:.07em}
.history-session-doc-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:6px}
.history-session-doc-list button{width:100%;display:flex;justify-content:space-between;gap:14px;align-items:center;padding:17px 18px;border:1px solid #dbe7f0;border-radius:16px;background:#fff;text-align:left;cursor:pointer;box-shadow:0 6px 18px rgba(31,72,109,.04)}
.history-session-doc-list button:hover{background:#f4f9fe;border-color:#c7ddf0}
.history-session-doc-list strong{color:#294766;font-size:14px}.history-session-doc-list span{color:#7a8999;font-size:11px}
.history-session-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-height:330px;padding:28px;border:1px dashed #cbddeb;border-radius:20px;background:linear-gradient(145deg,#f5faff,#fffdf7);text-align:center}
.history-session-empty strong{color:#315b80;font-size:17px}.history-session-empty span{max-width:660px;color:#71869a;font-size:13px;line-height:1.6}
.history-session-exercise-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px}
.history-session-editor{display:grid;gap:9px;margin:0;padding:18px;border:1px solid #dce8f1;border-radius:18px;background:#f8fbfd;color:#426078;font-size:13px;font-weight:850}
.history-session-editor.tone-blue{background:#f2f9ff;border-color:#d6eafb}.history-session-editor.tone-green{background:#f1faf5;border-color:#d7ecdf}
.history-session-editor textarea{min-height:240px;resize:vertical;border:1px solid #d3e0eb;border-radius:14px;padding:15px 16px;background:#fff;color:#273f5b;font:inherit;font-size:14px;font-weight:500;line-height:1.55;box-shadow:inset 0 1px 2px rgba(25,55,80,.03)}
.history-session-editor textarea:focus{outline:3px solid rgba(62,144,214,.13);border-color:#84bce7}
.history-session-preview-note{margin-top:18px;padding:13px 15px;border-radius:13px;border:1px solid #efd79f;background:#fff9e8;color:#755719;font-size:12px;font-weight:750}
.history-session-workspace-footer{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px 30px 18px;border-top:1px solid #dfe9f2;background:#f8fbfd}
.history-session-workspace-footer>span{color:#71869a;font-size:12px}.history-session-workspace-footer>div{display:flex;gap:10px;align-items:center}.history-session-workspace-footer a{text-decoration:none}
.history-session-workspace-footer .secondary-button,.history-session-workspace-footer .primary-button{min-height:44px;padding:10px 18px;border-radius:12px}
@media(max-width:1100px){
  .history-session-workspace-dialog{width:calc(100vw - 30px);height:calc(100vh - 30px)}
  .history-session-details-layout{grid-template-columns:1fr}.history-session-clinical-placeholder{min-height:200px}
}
@media(max-width:900px){
  .history-session-toolbar{grid-template-columns:1fr}.history-selected-session{text-align:left}.history-session-workspace-summary{grid-template-columns:1fr 1fr 1fr}.history-session-exercise-grid{grid-template-columns:1fr}
}
@media(max-width:620px){
  .history-session-workspace-overlay{padding:7px}.history-session-workspace-dialog{width:100%;height:calc(100vh - 14px);max-height:none;border-radius:18px}
  .history-session-workspace-head{padding:16px}.history-session-workspace-icon{width:46px;height:46px;flex-basis:46px;border-radius:14px}.history-session-workspace-head h2{font-size:21px}.history-session-workspace-head p{font-size:13px}
  .history-session-workspace-summary{grid-template-columns:1fr;padding:11px 14px;gap:8px}.history-session-workspace-tabs{overflow:auto;padding:9px 14px 0}.history-session-workspace-tabs button{white-space:nowrap;font-size:12px;padding:8px 12px}
  .history-session-workspace-body{padding:16px 14px}.history-session-detail-panel,.history-session-clinical-panel{padding:15px}.history-session-detail-grid{grid-template-columns:1fr}.history-session-editor textarea{min-height:170px}
  .history-session-workspace-footer{align-items:flex-start;flex-direction:column;padding:12px 14px}.history-session-workspace-footer>div{width:100%;justify-content:flex-end}
}
.history-session-toolbar .history-selected-session{
  background:transparent!important;
  border:0!important;
  border-radius:0!important;
  padding:0!important;
  min-height:0!important;
  display:block!important;
  font-weight:600!important;
}


/* OP17-X R4 / rc38-preview — details tab uses space for clinical content instead of repeated metadata */
.history-session-details-clinical{align-items:stretch}
.history-session-details-clinical .history-session-detail-panel,
.history-session-details-clinical .history-session-clinical-panel{display:flex;flex-direction:column}
.history-session-details-editor-grid{display:grid;grid-template-rows:1fr 1fr;gap:16px;margin-top:20px;flex:1;min-height:0}
.history-session-details-editor-grid .history-session-editor{min-height:0}
.history-session-details-editor-grid .history-session-editor textarea{min-height:150px;height:100%;resize:vertical}
.history-session-editor.tone-lilac{background:#f7f2ff;border-color:#e6dbf7}
.history-session-editor.tone-rose{background:#fff3f6;border-color:#f1d9e0}
.history-session-editor.tone-sand{background:#fff9ee;border-color:#f0e2c7}
@media (max-width: 900px){.history-session-details-editor-grid{grid-template-rows:auto}.history-session-details-editor-grid .history-session-editor textarea{min-height:150px;height:auto}}


/* OP17-X R5 / rc39-preview — direct workspace from history row, no detached top toolbar */
.history-session-card{cursor:pointer}
.history-session-card:focus-visible{outline:3px solid rgba(45,139,218,.22);outline-offset:2px}

/* OP17-X R6 / rc40-preview — studio display capitalization + close workspace before Agenda navigation */

/* OP17-X R7 / rc41-preview — historical Agenda fallback when legacy Calendar day is unreadable */

/* OP17-X R8 / rc42-preview — UI cleanup: single Report entry, compact operator identity */
.topbar .search-box{max-width:460px}
.operator-card-compact{padding:10px 5px 2px;margin-top:8px}
.operator-card-compact strong{display:block;font-size:12px;color:#fff;line-height:1.3}


/* OP17-X R9 / rc43-preview — visible user role restored; technical email/session chrome stays hidden */
.operator-card-compact .operator-role{display:block;margin-top:2px;color:#dbe8f7;font-size:11px;font-weight:700;line-height:1.35}


/* OP17-Y / rc44-candidate — persistent clinical workspace for each session */
.history-session-save-state{display:flex;align-items:center;min-height:34px;padding:7px 11px;border-radius:10px;color:#6d8297;font-size:12px;font-weight:750;background:transparent;border:1px solid transparent}
.history-session-save-state.is-dirty{color:#8a5b05;background:#fff8e7;border-color:#f1d99e}
.history-session-save-state.is-saving{color:#1e6b9f;background:#eef7ff;border-color:#cee5f6}
.history-session-save-state.is-saved{color:#2a7956;background:#eef9f3;border-color:#d3eadf}
.history-session-save-state.is-error{color:#a23c49;background:#fff1f3;border-color:#f0cfd4}
.history-session-save{background:#2b8b62;border-color:#2b8b62}
.history-session-save:hover:not(:disabled){background:#237653;border-color:#237653}
.history-session-save:disabled{opacity:.48;cursor:not-allowed}
.history-session-editor textarea:disabled{background:#f4f6f8;color:#74879a;cursor:not-allowed}
.history-session-workspace-footer>div{flex-wrap:wrap;justify-content:flex-end}
@media(max-width:760px){.history-session-workspace-footer>div{display:grid;grid-template-columns:1fr 1fr;width:100%}.history-session-workspace-footer .history-session-open-agenda{grid-column:1/-1}.history-session-workspace-footer button{width:100%}}

/* OP17-Y R2 / rc45-candidate — fresh login opens today's Agenda + history content indicators */
.history-session-presence{display:flex!important;align-items:center;gap:5px;flex-wrap:wrap;margin-top:7px}
.history-session-presence-chip{display:inline-flex!important;align-items:center;min-height:20px;margin:0!important;padding:3px 7px;border:1px solid transparent;border-radius:999px;font-style:normal;font-size:9px!important;font-weight:850;line-height:1.1;white-space:nowrap}
.history-session-presence-chip.clinical{background:#eef7ff;border-color:#cfe5f8;color:#176ba9}
.history-session-presence-chip.attachments{background:#f5f0ff;border-color:#dfd2f6;color:#7053a5}
@media(max-width:720px){.history-session-presence{margin-top:6px}.history-session-presence-chip{font-size:9px!important}}

/* OP17-Z / rc46-candidate — Report KPI drill-down + bulk completion */
.report-operational-badge{color:#2d6b50;background:#edf8f1;border-color:#cfe5d7}
.report-kpi-button{font:inherit;text-align:left;cursor:pointer;appearance:none;width:100%;transition:transform .15s ease,box-shadow .15s ease,border-color .15s ease}
.report-kpi-button:hover{transform:translateY(-1px);box-shadow:0 10px 24px rgba(20,52,90,.10);border-color:#b8d3ec}
.report-kpi-button:focus-visible,.report-kpi-mini:focus-visible{outline:3px solid rgba(43,137,240,.22);outline-offset:2px}
.report-kpi-button.active{box-shadow:0 0 0 2px rgba(43,137,240,.22),0 10px 24px rgba(20,52,90,.08);border-color:#70afe9;background:#f5faff}
.report-kpi-split{display:flex;flex-direction:column;justify-content:space-between;gap:5px}
.report-kpi-split-values{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:5px}
.report-kpi-mini{appearance:none;border:1px solid #e0e7ee;background:#fff;border-radius:9px;padding:6px 7px;text-align:left;cursor:pointer;min-width:0;transition:background .15s ease,border-color .15s ease,transform .15s ease}
.report-kpi-mini:hover{background:#fffaf0;border-color:#ebc66f;transform:translateY(-1px)}
.report-kpi-mini.active{background:#fff5df;border-color:#e8ad2d;box-shadow:0 0 0 2px rgba(232,173,45,.15)}
.report-kpi-mini strong{font-size:17px!important;margin:0!important;line-height:1.05;overflow:visible!important}
.report-kpi-mini small{display:block;font-size:7.5px!important;margin-top:3px;color:#7b6a45!important}
.report-kpi-hint{margin-top:2px}
.report-list-head{display:flex;justify-content:space-between;align-items:center;gap:14px}
.report-bulk-open{white-space:nowrap;min-height:38px}
.report-bulk-complete .bulk-complete-card{width:min(1600px,100%)}
.report-bulk-complete .bulk-complete-columns,.report-bulk-complete .bulk-complete-row{grid-template-columns:205px minmax(160px,1.2fr) minmax(130px,.9fr) minmax(130px,.9fr) 95px minmax(135px,.85fr) minmax(145px,.85fr)}
.report-bulk-row .bulk-complete-date b{font-size:9.5px;color:#183a5f;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.report-bulk-current{background:#f7f9fb!important;opacity:.78}
.report-bulk-current .bulk-missing-state span{background:#edf2f6;color:#6d7d8d}
.report-bulk-page{align-self:center;min-width:90px;text-align:center;font-size:9px;font-weight:800;color:#50657e}
@media(max-width:980px){
  .report-list-head{align-items:stretch;flex-direction:column}
  .report-bulk-open{width:100%}
  .report-bulk-complete .bulk-complete-row{grid-template-columns:1fr 1fr}
}

/* OP17-Z R1 / rc47-candidate — human-readable Activity labels */

/* OP50 MOBILE FIX1 — sticky top + equal editor columns */
@media (max-width:720px){
  .mobile-topbar{
    display:none!important;
    height:0!important;
    min-height:0!important;
    padding:0!important;
    margin:0!important;
  }
  .mobile-date-card{
    top:env(safe-area-inset-top)!important;
  }
  .time-band-head{
    top:calc(env(safe-area-inset-top) + 60px)!important;
  }
  .appointment-row,
  .appointment-row.mobile-expanded{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-areas:
      "census history"
      "patient patient"
      "treatment treatment"
      "therapist1 therapist2"
      "priceedit outcomeedit"!important;
  }
  .appointment-row>.field-cell[data-label="Terapista 1"],
  .appointment-row>.field-cell[data-label="Terapista 2"],
  .appointment-row>.price-cell,
  .appointment-row>.outcome-cell{
    min-width:0!important;
    width:100%!important;
    box-sizing:border-box!important;
  }
  .appointment-row .field-select,
  .appointment-row .outcome-select,
  .appointment-row .price-input-wrap{
    min-width:0!important;
    max-width:none!important;
    box-sizing:border-box!important;
  }
}

/* OP53 Access control candidate */
.secondary-button{appearance:none;border:1px solid #cbd5e1;background:#fff;color:#17324d;border-radius:10px;padding:10px 14px;font-weight:600;cursor:pointer}.secondary-button:hover{background:#f8fafc}.privacy-check{display:flex!important;gap:10px;align-items:flex-start}.privacy-check input{width:auto!important;margin-top:4px}.users-list{display:grid;gap:16px}.user-access-card{display:grid;gap:14px}.user-access-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.user-access-head h3{margin:0 0 4px}.user-access-head p{margin:0;color:#64748b}.user-access-head small{display:block;margin-top:6px;color:#64748b}.user-access-controls{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.user-access-controls label{display:grid;gap:6px}.user-access-controls select,.permission-row select{border:1px solid #cbd5e1;border-radius:9px;padding:9px;background:#fff}.permission-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:12px}.permission-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid #eef2f7}.user-access-actions{display:flex;align-items:center;gap:12px}@media(max-width:760px){.user-access-controls,.permission-grid{grid-template-columns:1fr}.user-access-head{flex-direction:column}}

/* OP53B password visibility */
.password-field{position:relative;display:block;width:100%}
.staging-login .password-field input{width:100%;padding-right:44px!important}
.staging-login .password-toggle{position:absolute;right:5px;top:50%;transform:translateY(-50%);width:34px!important;height:34px!important;min-height:34px;padding:0!important;margin:0;border:0!important;border-radius:8px;background:transparent!important;color:#64748b;display:grid;place-items:center;box-shadow:none!important}
.staging-login .password-toggle:hover{background:#f1f5f9!important;color:#173b66}
.staging-login .password-toggle:focus-visible{outline:2px solid #8bbcff;outline-offset:1px}
.staging-login .password-toggle svg{width:20px;height:20px;pointer-events:none}

/* OP53B account privacy notice */
.privacy-check{display:flex!important;gap:10px;align-items:flex-start}
.privacy-check>div{line-height:1.35}
.privacy-check label{display:inline!important}
.privacy-link{appearance:none;border:0;background:transparent;color:#1769c2;padding:0;margin:0;font:inherit;font-weight:700;text-decoration:underline;cursor:pointer}
.privacy-link:hover{color:#0e4d92}
.privacy-link:focus-visible{outline:2px solid #8bbcff;outline-offset:2px;border-radius:3px}
.account-privacy-dialog{width:min(720px,calc(100vw - 28px));max-height:min(84vh,820px);padding:0;border:0;border-radius:16px;box-shadow:0 24px 70px rgba(15,40,70,.28);color:#17324d}
.account-privacy-dialog::backdrop{background:rgba(12,32,52,.55)}
.privacy-modal-card{display:flex;flex-direction:column;max-height:84vh;background:#fff;border-radius:16px;overflow:hidden}
.privacy-modal-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding:20px 22px 14px;border-bottom:1px solid #e6edf4}
.privacy-modal-head h2{margin:0 0 5px;font-size:20px;line-height:1.2}
.privacy-modal-head p{margin:0;color:#64748b;font-size:12px}
.privacy-modal-close{appearance:none;border:0;background:#f1f5f9;color:#17324d;width:36px;height:36px;border-radius:9px;font-size:25px;line-height:1;cursor:pointer;flex:0 0 auto}
.privacy-modal-body{padding:18px 22px;overflow:auto;font-size:14px;line-height:1.55}
.privacy-modal-body h3{font-size:15px;margin:18px 0 6px}
.privacy-modal-body p{margin:0 0 10px}
.privacy-modal-actions{padding:14px 22px 20px;border-top:1px solid #e6edf4}
.privacy-modal-actions .primary-button{width:100%}
@media(max-width:600px){.privacy-modal-head,.privacy-modal-body,.privacy-modal-actions{padding-left:16px;padding-right:16px}.privacy-modal-head h2{font-size:18px}}

/* OP53B remember me */
.remember-me-row{display:flex!important;align-items:flex-start!important;justify-content:flex-start!important;gap:9px!important;margin-top:2px!important;cursor:pointer;text-align:left!important}
.staging-login .remember-me-row input[type="checkbox"]{
  appearance:auto!important;
  -webkit-appearance:checkbox!important;
  width:16px!important;
  height:16px!important;
  min-width:16px!important;
  min-height:16px!important;
  padding:0!important;
  margin:2px 0 0 0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  flex:0 0 16px!important;
  box-sizing:border-box!important;
}
.remember-me-row span{display:flex;flex-direction:column;gap:2px;line-height:1.25;min-width:0}
.remember-me-row strong{font-size:13px;color:#17324d}
.remember-me-row small{font-size:11px;font-weight:400;color:#64748b}

/* OP53B UI8/UI9/UI10 — mobile hamburger navigation + mobile logo + identity footer */
.mobile-shell-bar,.mobile-drawer-backdrop{display:none}

@media (max-width:720px){
  :root{--mobile-shell-h:48px;--mobile-date-h:94px}

  body.mobile-menu-open{overflow:hidden!important}

  /* Global compact mobile header */
  .mobile-shell-bar{
    position:sticky!important;
    top:0!important;
    z-index:80!important;
    height:calc(var(--mobile-shell-h) + env(safe-area-inset-top))!important;
    padding:env(safe-area-inset-top) 8px 0!important;
    display:grid!important;
    grid-template-columns:44px minmax(0,1fr) 44px!important;
    align-items:center!important;
    background:#fff!important;
    border-bottom:1px solid #dce5ef!important;
    box-shadow:0 3px 12px rgba(18,48,88,.08)!important;
    color:#17324d!important;
  }
  .mobile-menu-toggle,.mobile-menu-close{
    appearance:none!important;
    border:0!important;
    background:transparent!important;
    color:#17324d!important;
    width:40px!important;
    height:40px!important;
    padding:0!important;
    margin:0!important;
    display:grid!important;
    place-items:center!important;
    border-radius:10px!important;
    cursor:pointer!important;
  }
  .mobile-menu-toggle:active,.mobile-menu-close:active{background:#eef5fb!important}
  .mobile-shell-brand{
    min-width:0!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    padding:0 4px!important;
  }
  .mobile-shell-logo{
    display:block!important;
    width:min(230px,56vw)!important;
    max-width:100%!important;
    height:30px!important;
    object-fit:contain!important;
    object-position:center!important;
  }
  .mobile-shell-spacer{width:40px;height:40px}

  /* Drawer */
  .mobile-drawer-backdrop{
    position:fixed!important;
    inset:0!important;
    z-index:1200!important;
    display:block!important;
    background:rgba(4,22,44,0)!important;
    transition:background .18s ease!important;
  }
  .mobile-drawer-backdrop[hidden]{display:none!important}
  .mobile-drawer-backdrop.open{background:rgba(4,22,44,.46)!important}
  .mobile-drawer{
    position:absolute!important;
    left:0!important;
    top:0!important;
    bottom:0!important;
    width:min(84vw,320px)!important;
    padding:calc(12px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom))!important;
    background:linear-gradient(180deg,#062553,#082d62 72%,#062553)!important;
    color:#fff!important;
    display:flex!important;
    flex-direction:column!important;
    box-shadow:14px 0 34px rgba(3,30,68,.28)!important;
    transform:translateX(-102%)!important;
    transition:transform .18s ease!important;
  }
  .mobile-drawer-backdrop.open .mobile-drawer{transform:translateX(0)!important}
  .mobile-drawer-head{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:12px!important;
    padding:4px 2px 14px!important;
    border-bottom:1px solid rgba(255,255,255,.14)!important;
  }
  .mobile-drawer-brand{display:flex!important;flex-direction:column!important;gap:6px!important;min-width:0!important;flex:1 1 auto!important;width:calc(100% - 46px)!important;max-width:calc(100% - 46px)!important}
  .mobile-drawer-logo{display:block!important;width:100%!important;max-width:100%!important;height:46px!important;object-fit:contain!important;object-position:left center!important}
  .mobile-drawer-head small{font-size:10px!important;color:#bcd1eb!important;padding-left:2px!important}
  .mobile-drawer .mobile-menu-close{color:#fff!important}
  .mobile-drawer .mobile-menu-close:active{background:rgba(255,255,255,.12)!important}

  .mobile-drawer-nav{
    display:flex!important;
    flex-direction:column!important;
    gap:7px!important;
    padding:14px 0!important;
  }
  .mobile-drawer-nav a{
    min-height:46px!important;
    display:flex!important;
    align-items:center!important;
    gap:12px!important;
    padding:0 13px!important;
    border-radius:11px!important;
    color:#e7eef8!important;
    text-decoration:none!important;
    font-size:14px!important;
    font-weight:700!important;
  }
  .mobile-drawer-nav a .icon{width:20px!important;height:20px!important}
  .mobile-drawer-nav a.active{
    color:#fff!important;
    background:linear-gradient(90deg,#147df0,#1b90ff)!important;
    box-shadow:0 8px 18px rgba(17,128,245,.28)!important;
  }
  .mobile-drawer-foot{
    margin-top:auto!important;
    border-top:1px solid rgba(255,255,255,.14)!important;
    padding-top:14px!important;
    display:grid!important;
    gap:10px!important;
  }

  .mobile-identity-badge{padding:8px 2px 2px!important;align-items:center!important;width:100%!important}
  .mobile-identity-badge strong{display:block!important;font-size:13px!important;color:#fff!important;line-height:1.2!important}
  .mobile-identity-badge small{display:block!important;font-size:9px!important;color:#bfd0e6!important;line-height:1.25!important;margin-top:3px!important}
  .mobile-drawer-foot .product-compact-image{width:34px!important;height:34px!important;flex:0 0 34px!important;border-radius:10px!important;object-fit:contain!important;background:transparent!important}
  .mobile-version-chip{width:100%!important;max-width:100%!important;margin:2px 0 0 0!important;text-align:center!important}
  .mobile-drawer-user{display:flex!important;flex-direction:column!important;gap:2px!important;padding:0 3px!important}
  .mobile-drawer-user strong{font-size:13px!important}
  .mobile-drawer-user span{font-size:10px!important;color:#bcd1eb!important}
  .mobile-drawer-logout{
    min-height:42px!important;
    border:1px solid rgba(255,255,255,.24)!important;
    background:rgba(255,255,255,.08)!important;
    color:#fff!important;
    border-radius:9px!important;
    font-weight:800!important;
  }

  /* The old bottom navigation is removed on mobile */
  .mobile-bottom-nav{display:none!important}
  .content-shell{padding-bottom:0!important}
  #page-root{padding:8px 8px calc(20px + env(safe-area-inset-bottom))!important}
  .toast-region{bottom:14px!important}

  /* Agenda controls: date + Today on row 1, full-width studio on row 2 */
  .mobile-date-card{
    top:calc(var(--mobile-shell-h) + env(safe-area-inset-top))!important;
    z-index:30!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:38px 38px!important;
    gap:6px!important;
    padding:6px!important;
    margin:0 0 8px!important;
    min-height:var(--mobile-date-h)!important;
    box-sizing:border-box!important;
  }
  .mobile-date-main{
    min-width:0!important;
    height:38px!important;
    min-height:38px!important;
    font-size:11px!important;
    padding:0 7px!important;
  }
  .mobile-today-button{
    height:38px!important;
    min-height:38px!important;
    min-width:48px!important;
    padding:0 9px!important;
  }
  .mobile-date-card select{
    grid-column:1/-1!important;
    grid-row:2!important;
    width:100%!important;
    max-width:none!important;
    height:38px!important;
    min-height:38px!important;
    padding:0 10px!important;
    font-size:13px!important;
    font-weight:800!important;
    color:#273f5d!important;
    background:#f8fafc!important;
    text-overflow:ellipsis!important;
  }

  /* Keep the time-band sticky below the two-row agenda controls */
  .time-band-head{
    top:calc(var(--mobile-shell-h) + var(--mobile-date-h) + env(safe-area-inset-top))!important;
  }
}

@media (max-width:380px){
  .mobile-drawer{width:min(88vw,300px)!important}
  .mobile-shell-logo{width:min(190px,52vw)!important;height:28px!important}
  .mobile-drawer-logo{width:min(188px,100%)!important;height:40px!important}
}


/* OP53B UI11 — align mobile footer identity to desktop; keep all other UI unchanged */
@media (max-width:720px){
  .mobile-drawer-foot{
    gap:10px!important;
  }
  .mobile-identity-badge{
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    gap:10px!important;
    padding:8px 4px!important;
    margin:0!important;
    width:100%!important;
    box-sizing:border-box!important;
  }
  .mobile-identity-badge div{
    display:block!important;
    min-width:0!important;
  }
  .mobile-identity-badge .product-compact-image{
    width:34px!important;
    height:34px!important;
    min-width:34px!important;
    flex:0 0 34px!important;
    margin:0!important;
    object-fit:contain!important;
  }
  .mobile-identity-badge strong{
    display:block!important;
    font-size:13px!important;
    line-height:1.2!important;
    color:#fff!important;
    white-space:nowrap!important;
  }
  .mobile-identity-badge small{
    display:block!important;
    margin-top:3px!important;
    font-size:9px!important;
    line-height:1.2!important;
    color:#bfd0e6!important;
    white-space:nowrap!important;
  }
  .mobile-drawer-user{
    padding:0 4px!important;
    margin:0!important;
  }
  .mobile-version-chip{
    position:static!important;
    inset:auto!important;
    right:auto!important;
    bottom:auto!important;
    left:auto!important;
    top:auto!important;
    z-index:auto!important;
    display:inline-flex!important;
    width:100%!important;
    max-width:100%!important;
    min-height:30px!important;
    margin:0 0 0 2px!important;
    padding:0 10px!important;
    align-items:center!important;
    justify-content:center!important;
    border:1px solid rgba(255,255,255,.16)!important;
    background:rgba(255,255,255,.09)!important;
    color:#d7e5f6!important;
    border-radius:999px!important;
    font-size:9px!important;
    font-weight:800!important;
    line-height:1.1!important;
    white-space:nowrap!important;
  }
  .mobile-drawer-logout{
    position:static!important;
    margin:0!important;
    width:100%!important;
  }
}
