:root{
  --bx:#6B1A2A;
  --bx-dark:#3D0D18;
  --bx-mid:#8B2A3A;
  --bx-hover:#7A2030;
  --bx-pale:#F8F0F2;
  --beige:#FAF6F0;
  --beige-mid:#F0E8DC;
  --beige-dark:#DDD0C0;
  --white:#FFFFFF;
  --text:#1A0A0E;
  --text-mid:#5A3A42;
  --text-light:#9A7A82;
  --border:#E8DDD8;
  --success:#1E6B45;
  --warn:#A85C1A;
  --danger:#8A0818;
  --info:#1A3A6A;
  --radius:8px;
  --shadow:0 2px 12px rgba(61,13,24,.08);
  --shadow-lg:0 8px 32px rgba(61,13,24,.14);
}

*{
  box-sizing:border-box;
  margin:0;
  padding:0;
}

body{
  font-family:'Segoe UI',system-ui,sans-serif;
  background:var(--beige);
  color:var(--text);
  min-height:100vh;
  font-size:14px;
}

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

/* LOGIN */
#login-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--bx-dark);
  background-image:
    radial-gradient(ellipse at 30% 50%,rgba(107,26,42,.6) 0%,transparent 60%),
    radial-gradient(ellipse at 70% 20%,rgba(139,42,58,.4) 0%,transparent 50%);
}

.lcard{
  width:400px;
  background:var(--white);
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 24px 64px rgba(0,0,0,.4);
}

.lhead{
  background:var(--bx-dark);
  padding:40px 36px 32px;
  text-align:center;
}

.llogo{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin-bottom:10px;
}

.lbars,
.tnbars{
  display:flex;
  align-items:flex-end;
  gap:4px;
}

.lbars span,
.tnbars span{
  background:#fff;
  display:block;
  border-radius:3px 3px 0 0;
  opacity:.9;
}

.lname{
  color:#fff;
  font-size:28px;
  font-weight:200;
  letter-spacing:3px;
}

.lsub{
  color:rgba(255,255,255,.45);
  font-size:11px;
  letter-spacing:3px;
  text-transform:uppercase;
  margin-top:4px;
}

.lbody{
  padding:32px 36px 36px;
}

.lfield{
  margin-bottom:18px;
}

.lfield label{
  display:block;
  font-size:11px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.7px;
  margin-bottom:7px;
}

.lfield input{
  width:100%;
  padding:11px 14px;
  border:1.5px solid var(--border);
  border-radius:var(--radius);
  font-size:14px;
  color:var(--text);
  outline:none;
  transition:border-color .2s;
  background:#FDFAF8;
}

.lfield input:focus{
  border-color:var(--bx);
}

.lbtn{
  width:100%;
  padding:13px;
  background:var(--bx);
  color:#fff;
  border:none;
  border-radius:var(--radius);
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  letter-spacing:.5px;
  transition:background .2s;
  margin-top:4px;
}

.lbtn:hover{
  background:var(--bx-dark);
}

.lerr{
  color:var(--danger);
  font-size:12px;
  text-align:center;
  margin-top:10px;
}

.lhint{
  margin-top:20px;
  padding-top:18px;
  border-top:1px solid var(--border);
}

.lhint-title{
  font-size:10px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.8px;
  text-align:center;
  margin-bottom:10px;
}

.lhint-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:5px 0;
  font-size:12px;
  border-bottom:1px solid #F5F0EC;
}

.lhint-row:last-child{
  border-bottom:none;
}

.u{
  font-weight:600;
  color:var(--text);
  font-family:monospace;
}

.p{
  color:var(--text-light);
  font-family:monospace;
}

.role-pill{
  font-size:10px;
  font-weight:700;
  padding:2px 8px;
  border-radius:3px;
}

.rp-admin{
  background:#F5E8EA;
  color:var(--bx);
}

/* APP + NAV */
#app{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

#topnav{
  background:var(--bx-dark);
  height:58px;
  display:flex;
  align-items:stretch;
  position:sticky;
  top:0;
  z-index:500;
  box-shadow:0 2px 16px rgba(0,0,0,.25);
}

.tnlogo{
  padding:0 28px;
  display:flex;
  align-items:center;
  gap:10px;
  border-right:1px solid rgba(255,255,255,.1);
  flex-shrink:0;
}

.tnname{
  color:#fff;
  font-size:20px;
  font-weight:200;
  letter-spacing:2px;
}

.tnmenu{
  display:flex;
  align-items:stretch;
  flex:1;
}

.navdirect{
  display:flex;
  align-items:center;
  padding:0 18px;
  color:rgba(255,255,255,.65);
  font-size:13px;
  font-weight:500;
  height:100%;
  border-bottom:3px solid transparent;
  transition:all .18s;
  white-space:nowrap;
  letter-spacing:.2px;
}

.navdirect:hover,
.navdirect.active{
  color:#fff;
  background:rgba(255,255,255,.07);
}

.navdirect.active{
  border-bottom-color:rgba(255,255,255,.55);
}

.ddwrap{
  position:relative;
  display:flex;
  align-items:stretch;
}

.ddtrigger{
  display:flex;
  align-items:center;
  gap:6px;
  padding:0 18px;
  color:rgba(255,255,255,.65);
  font-size:13px;
  font-weight:500;
  cursor:pointer;
  border:none;
  background:none;
  height:100%;
  border-bottom:3px solid transparent;
}

.ddwrap:hover .ddtrigger{
  color:#fff;
  background:rgba(255,255,255,.07);
}

.ddmenu{
  position:absolute;
  top:100%;
  left:0;
  background:#fff;
  border-radius:0 0 10px 10px;
  box-shadow:var(--shadow-lg);
  min-width:200px;
  overflow:hidden;
  display:none;
  border-top:3px solid var(--bx);
  z-index:600;
}

.ddwrap:hover .ddmenu{
  display:block;
}

.dditem{
  display:block;
  padding:11px 18px;
  font-size:13px;
  color:var(--text-mid);
  transition:all .15s;
  border-left:3px solid transparent;
  font-weight:500;
}

.dditem:hover{
  background:var(--bx-pale);
  color:var(--bx);
  border-left-color:var(--bx);
}

.tnright{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:12px;
  padding:0 20px;
  flex-shrink:0;
}

.tnrole{
  color:rgba(255,255,255,.4);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:1px;
}

.tnuser{
  width:32px;
  height:32px;
  background:rgba(255,255,255,.15);
  border:1.5px solid rgba(255,255,255,.3);
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-size:11px;
  font-weight:700;
}

.tnexit{
  color:rgba(255,255,255,.5);
  font-size:12px;
  padding:5px 12px;
  border:1px solid rgba(255,255,255,.2);
  border-radius:5px;
  background:none;
  transition:all .2s;
}

.tnexit:hover{
  color:#fff;
  border-color:rgba(255,255,255,.5);
}

/* TOPBAR: ruolo + nome visualizzato accanto alla foto */
.top-user-text{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:center;
  line-height:1.1;
  min-width:90px;
}

.top-user-text .tnrole{
  color:rgba(255,255,255,.42);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:1px;
  margin-bottom:3px;
}

.top-user-text strong{
  color:#fff;
  font-size:12px;
  font-weight:700;
  max-width:150px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* BREADCRUMB + MAIN */
#breadcrumb{
  background:#fff;
  border-bottom:1px solid var(--border);
  padding:10px 32px;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--text-light);
}

#breadcrumb a{
  color:var(--bx);
  font-weight:600;
}

#breadcrumb strong{
  color:var(--text-mid);
}

#main{
  flex:1;
  padding:28px 32px;
  max-width:1400px;
  width:100%;
  margin:0 auto;
}

.phead{
  margin-bottom:26px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
}

.phead-l h1{
  font-size:24px;
  font-weight:700;
  color:var(--bx-dark);
  letter-spacing:-.4px;
}

.phead-l p{
  font-size:13px;
  color:var(--text-light);
  margin-top:3px;
}

.phead-r{
  display:flex;
  gap:8px;
  align-items:center;
}

/* BRAND TABS */
.bbar{
  display:flex;
  gap:0;
  margin-bottom:24px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
  width:fit-content;
  box-shadow:var(--shadow);
}

.bbtn{
  padding:9px 24px;
  font-size:12px;
  font-weight:600;
  cursor:pointer;
  border-right:1px solid var(--border);
  background:none;
  color:var(--text-light);
  letter-spacing:.4px;
  transition:all .18s;
}

.bbtn:last-child{
  border-right:none;
}

.bbtn.active{
  background:var(--bx);
  color:#fff;
}

.bbtn:not(.active):hover{
  background:var(--bx-pale);
  color:var(--bx);
}

/* CARDS */
.sgrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:16px;
  margin-bottom:26px;
}

.scard{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:20px 18px;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}

.scard::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:3px;
}

.c-bx::before{
  background:var(--bx);
}

.c-ok::before{
  background:var(--success);
}

.c-warn::before{
  background:var(--warn);
}

.c-info::before{
  background:var(--info);
}

.c-neu::before{
  background:var(--beige-dark);
}

.slbl{
  font-size:10px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.8px;
  margin-bottom:10px;
}

.sval{
  font-size:30px;
  font-weight:700;
  color:var(--bx-dark);
  line-height:1;
}

.c-ok .sval{
  color:var(--success);
}

.c-warn .sval{
  color:var(--warn);
}

.c-info .sval{
  color:var(--info);
}

/* BUTTONS */
.btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:9px 18px;
  border-radius:var(--radius);
  border:none;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition:all .18s;
  letter-spacing:.2px;
}

.btn-prim{
  background:var(--bx);
  color:#fff;
}

.btn-prim:hover{
  background:var(--bx-dark);
}

.btn-sec{
  background:#fff;
  color:var(--bx);
  border:1.5px solid var(--bx);
}

.btn-sec:hover{
  background:var(--bx-pale);
}

.btn-neu{
  background:var(--beige-mid);
  color:var(--text-mid);
  border:1px solid var(--border);
}

.btn-neu:hover{
  background:var(--beige-dark);
}

.btn-sm{
  padding:6px 13px;
  font-size:12px;
}

/* TABLES */
.twrap{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:visible;
  box-shadow:var(--shadow);
  margin-bottom:24px;
}

.ttoolbar{
  padding:14px 20px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  background:var(--beige);
}

.ttoolbar input,
.ttoolbar select{
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:6px;
  font-size:13px;
  color:var(--text);
  background:#fff;
  outline:none;
}

.ttoolbar-label{
  font-size:11px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.6px;
}

table{
  width:100%;
  border-collapse:collapse;
}

thead tr{
  background:var(--beige);
}

th{
  padding:11px 16px;
  text-align:left;
  font-size:11px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.5px;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}

td{
  padding:12px 16px;
  font-size:13px;
  color:var(--text);
  border-bottom:1px solid #F5EDE0;
  vertical-align:middle;
}

tr:last-child td{
  border-bottom:none;
}

tr:hover td{
  background:#FBF7F2;
}

/* BADGES */
.badge{
  display:inline-flex;
  align-items:center;
  padding:3px 10px;
  border-radius:4px;
  font-size:11px;
  font-weight:600;
  white-space:nowrap;
}

.bk{
  background:#F0EEEA;
  color:#5A5250;
}

.bok{
  background:#D5EDE4;
  color:#1A5230;
}

.bwarn{
  background:#FEF0DC;
  color:#7A4210;
}

.bdng{
  background:#FDECEA;
  color:#7A0810;
}

.binf{
  background:#DCE8F8;
  color:#1A3068;
}

.bbx{
  background:#F5E8EA;
  color:var(--bx);
}

/* ALERT PANEL */
.apanel{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  margin-bottom:24px;
  overflow:hidden;
  box-shadow:var(--shadow);
}

.apanel-h{
  background:var(--bx-dark);
  padding:14px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.apanel-h h3{
  color:#fff;
  font-size:13px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.5px;
}

.arow{
  padding:14px 20px;
  border-bottom:1px solid #F5EDE0;
  display:flex;
  align-items:center;
  gap:14px;
}

.arow:last-child{
  border-bottom:none;
}

.abar{
  width:4px;
  min-height:38px;
  border-radius:3px;
  flex-shrink:0;
}

.abar.red{
  background:var(--danger);
}

.abar.orange{
  background:var(--warn);
}

.abar.blue{
  background:var(--info);
}

.abody{
  flex:1;
}

.abody strong{
  font-size:13px;
  font-weight:600;
}

.abody small{
  display:block;
  font-size:12px;
  color:var(--text-light);
  margin-top:2px;
}

.atime{
  font-size:11px;
  color:var(--text-light);
  white-space:nowrap;
}

.empty{
  padding:16px 20px;
  color:var(--text-light);
  font-size:13px;
}

.notice{
  background:#D5EDE4;
  color:#1A5230;
  border:1px solid #B8DDC8;
  border-radius:8px;
  padding:12px 16px;
  margin-bottom:18px;
}

.notice-danger{
  background:#FDECEA;
  color:#7A0810;
  border-color:#F5C2C7;
}

/* MODAL */
.movl{
  position:fixed;
  inset:0;
  background:rgba(20,5,8,.55);
  z-index:1000;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:36px 20px;
  overflow-y:auto;
}

.hidden{
  display:none!important;
}

.modal{
  background:#fff;
  border-radius:12px;
  width:100%;
  max-width:720px;
  box-shadow:0 20px 60px rgba(0,0,0,.3);
  overflow:hidden;
}

.mhead{
  background:var(--bx-dark);
  padding:20px 26px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.mhead h2{
  color:#fff;
  font-size:16px;
  font-weight:600;
}

.mclose{
  background:none;
  border:none;
  color:rgba(255,255,255,.5);
  font-size:20px;
  cursor:pointer;
  line-height:1;
}

.mbody{
  padding:26px;
  max-height:65vh;
  overflow-y:auto;
}

.mfoot{
  padding:16px 26px;
  border-top:1px solid var(--border);
  display:flex;
  justify-content:flex-end;
  gap:8px;
  background:var(--beige);
}

/* FORMS */
.fgrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:15px;
}

.ff{
  grid-column:1/-1;
}

.fg{
  display:flex;
  flex-direction:column;
  gap:5px;
}

.fg label{
  font-size:11px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.5px;
}

.fg input,
.fg select,
.fg textarea{
  padding:10px 12px;
  border:1.5px solid var(--border);
  border-radius:6px;
  font-size:13px;
  color:var(--text);
  background:#fff;
  outline:none;
}

.fg textarea{
  min-height:72px;
  resize:vertical;
}

.fsec{
  grid-column:1/-1;
  font-size:11px;
  font-weight:700;
  color:#fff;
  background:var(--bx);
  padding:7px 14px;
  border-radius:5px;
  letter-spacing:.5px;
  text-transform:uppercase;
  margin-top:4px;
}

.check{
  display:flex!important;
  flex-direction:row!important;
  align-items:center;
  gap:8px;
  font-size:13px!important;
  text-transform:none!important;
  color:var(--text)!important;
}

/* CHART/REPORT CARDS */
.chwrap{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow);
}

.chtitle{
  font-size:11px;
  font-weight:700;
  color:var(--text-light);
  text-transform:uppercase;
  letter-spacing:.8px;
  margin-bottom:18px;
}

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

.blbl{
  font-size:12px;
  color:var(--text-mid);
  min-width:200px;
  font-weight:500;
}

.btrack{
  flex:1;
  background:var(--beige-mid);
  border-radius:4px;
  height:14px;
  overflow:hidden;
}

.bfill{
  height:100%;
  border-radius:4px;
  background:var(--bx);
  transition:width .7s ease;
}

.bnum{
  font-size:12px;
  font-weight:700;
  color:var(--text);
  min-width:28px;
  text-align:right;
}

.sgrd2{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(340px,1fr));
  gap:20px;
}

.scard2{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow);
}

.scard2 h3{
  font-size:11px;
  font-weight:700;
  color:#fff;
  background:var(--bx);
  padding:6px 12px;
  border-radius:5px;
  text-transform:uppercase;
  letter-spacing:.6px;
  margin-bottom:16px;
  display:inline-block;
}

.rrow{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 0;
  border-bottom:1px solid #F5EDE0;
  font-size:12px;
}

.rrow:last-child{
  border-bottom:none;
}

#toast{
  position:fixed;
  bottom:24px;
  right:24px;
  background:var(--bx-dark);
  color:#fff;
  padding:12px 20px;
  border-radius:var(--radius);
  font-size:13px;
  box-shadow:var(--shadow-lg);
  z-index:9999;
  opacity:0;
  transition:opacity .3s;
  pointer-events:none;
  max-width:380px;
}

/* CALENDARIO COMPATTO */
.calendar-shell{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  box-shadow:var(--shadow);
  max-width:900px;
  margin:0 auto;
}

.calendar-head{
  height:62px;
  background:var(--bx-dark);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 34px;
  color:#fff;
}

.calendar-head h2{
  font-size:20px;
  letter-spacing:.6px;
}

.calendar-nav{
  color:#fff;
  font-size:25px;
  opacity:.8;
  transition:.2s;
}

.calendar-nav:hover{
  opacity:1;
  transform:scale(1.08);
}

.calendar-weekdays{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  background:var(--beige);
  border-bottom:1px solid var(--border);
}

.calendar-weekdays div{
  text-align:center;
  padding:9px 0;
  font-size:11px;
  font-weight:800;
  color:var(--text-light);
  letter-spacing:1.6px;
}

.calendar-grid{
  display:grid;
  grid-template-columns:repeat(7,1fr);
}

.calendar-cell{
  min-height:74px;
  border-right:1px solid #eadfd7;
  border-bottom:1px solid #eadfd7;
  padding:7px 8px;
  background:#fff;
  position:relative;
}

.calendar-cell:nth-child(7n){
  border-right:none;
}

.calendar-cell.muted{
  background:#fbf8f5;
  color:#c8bcc0;
}

.day-number{
  font-size:13px;
  font-weight:800;
  color:#9b7d86;
  margin-bottom:5px;
}

.calendar-cell.today .day-number{
  width:26px;
  height:26px;
  background:var(--bx);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  margin-top:-2px;
}

.cal-event{
  padding:3px 6px;
  border-radius:5px;
  margin-bottom:3px;
  font-size:10px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.cal-event.appointment{
  background:#d7f0e3;
  color:#155c36;
}

.cal-event.follow{
  background:#fff0d9;
  color:#76420e;
}

.legend-row{
  display:flex;
  gap:16px;
  max-width:900px;
  margin:10px auto 0;
  color:var(--text-light);
  font-size:11px;
  font-weight:600;
}

.legend-dot{
  display:inline-block;
  width:9px;
  height:9px;
  border-radius:50%;
  margin-right:6px;
}

.legend-dot.appointment{
  background:#d7f0e3;
  border:1px solid #155c36;
}

.legend-dot.follow{
  background:#fff0d9;
  border:1px solid #76420e;
}

/* FOLLOW-UP PREMIUM PAGE */
.followup-board{
  display:flex;
  flex-direction:column;
  gap:18px;
  margin-top:22px;
}

.empty-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  padding:42px;
  box-shadow:var(--shadow);
  position:relative;
  overflow:hidden;
}

.empty-card::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:5px;
  background:var(--bx);
}

.empty-card h3{
  font-size:22px;
  color:var(--bx-dark);
  margin-bottom:8px;
}

.empty-card p{
  color:var(--text-light);
  font-size:14px;
}

.follow-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
  padding:20px;
  display:grid;
  grid-template-columns:76px 1fr auto;
  gap:20px;
  align-items:center;
  border-left:6px solid var(--warn);
  transition:all .2s ease;
}

.follow-card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-lg);
}

.follow-card.expired{
  border-left-color:var(--danger);
  background:#fffafa;
}

.follow-date{
  width:64px;
  height:76px;
  border-radius:14px;
  background:var(--bx-pale);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  color:var(--bx);
  border:1px solid #ead4da;
}

.follow-date span{
  font-size:28px;
  font-weight:900;
  line-height:1;
}

.follow-date small{
  font-size:11px;
  font-weight:800;
  letter-spacing:1px;
  margin-top:6px;
}

.follow-main{
  min-width:0;
}

.follow-top{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:8px;
}

.follow-top h3{
  font-size:19px;
  color:var(--bx-dark);
  margin:0;
}

.follow-meta{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin-bottom:10px;
}

.follow-meta span{
  background:var(--beige);
  border:1px solid var(--border);
  padding:4px 9px;
  border-radius:5px;
  font-size:11px;
  font-weight:700;
  color:var(--text-mid);
}

.follow-desc{
  font-size:13px;
  color:var(--text-mid);
  margin-bottom:10px;
  line-height:1.45;
}

.follow-contact{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:center;
  font-size:13px;
}

.follow-contact strong{
  color:var(--success);
  font-size:14px;
}

.follow-contact span{
  color:var(--text-light);
}

.follow-note{
  margin-top:12px;
  padding:11px 13px;
  background:#fbf7f2;
  border:1px solid #f0e4db;
  border-radius:8px;
  font-size:12px;
  color:var(--text-mid);
}

.follow-action{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}

.follow-action .btn{
  white-space:nowrap;
}

.followup-header-card{
  background:linear-gradient(135deg,var(--bx-dark),var(--bx));
  border-radius:16px;
  padding:28px 32px;
  color:#fff;
  margin-bottom:24px;
  box-shadow:var(--shadow-lg);
}

.followup-header-card h1{
  color:#fff;
  font-size:28px;
  margin-bottom:6px;
}

.followup-header-card p{
  color:rgba(255,255,255,.7);
  font-size:14px;
}

.followup-summary{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:14px;
  margin-bottom:24px;
}

.followup-mini-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
  box-shadow:var(--shadow);
}

.followup-mini-card small{
  display:block;
  color:var(--text-light);
  font-size:10px;
  text-transform:uppercase;
  font-weight:800;
  letter-spacing:.8px;
  margin-bottom:8px;
}

.followup-mini-card strong{
  font-size:28px;
  color:var(--bx-dark);
}

/* SETTINGS */
.settings-select{
  padding:9px 14px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#fff;
  color:var(--text);
  font-weight:700;
  outline:none;
}

.settings-tabs{
  display:flex;
  gap:0;
  margin-bottom:22px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  width:fit-content;
  box-shadow:var(--shadow);
}

.settings-tabs a{
  padding:10px 22px;
  font-size:12px;
  font-weight:800;
  color:var(--text-light);
  border-right:1px solid var(--border);
  text-transform:uppercase;
  letter-spacing:.6px;
}

.settings-tabs a:last-child{
  border-right:none;
}

.settings-tabs a.active{
  background:var(--bx);
  color:#fff;
}

/* PROFILE TOP RIGHT */
.profile-wrap{
  position:relative;
  display:flex;
  align-items:center;
}

.profile-btn{
  width:36px;
  height:36px;
  border-radius:50%;
  border:1.5px solid rgba(255,255,255,.3);
  background:rgba(255,255,255,.15);
  color:#fff;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  font-size:11px;
  font-weight:900;
}

.profile-btn img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.profile-menu{
  display:none;
  position:absolute;
  top:48px;
  right:0;
  width:320px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow-lg);
  z-index:9999;
  overflow:hidden;
}

.profile-menu.open{
  display:block;
}

.profile-menu-head{
  background:linear-gradient(135deg,var(--bx-dark),var(--bx));
  color:#fff;
  padding:18px;
  display:flex;
  align-items:center;
  gap:12px;
}

.profile-preview{
  width:54px;
  height:54px;
  border-radius:50%;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  font-weight:900;
}

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

.profile-menu-head strong{
  display:block;
  font-size:15px;
}

.profile-menu-head small{
  display:block;
  font-size:11px;
  opacity:.65;
  margin-top:3px;
}

.profile-form{
  padding:18px;
}

.profile-form label{
  display:block;
  font-size:10px;
  color:var(--text-light);
  text-transform:uppercase;
  font-weight:900;
  letter-spacing:.7px;
  margin-bottom:6px;
}

.profile-form input[type="text"],
.profile-form input[type="file"]{
  width:100%;
  padding:10px;
  border:1px solid var(--border);
  border-radius:8px;
  margin-bottom:14px;
  font-size:13px;
  background:#fff;
  color:var(--text);
}

.profile-form button{
  width:100%;
  justify-content:center;
}

/* EUROINSTANBUL + ACTIONS */
.actions-th{
  width:80px;
  text-align:center;
}

.actions-cell{
  text-align:center;
}

.dots-btn{
  width:30px!important;
  height:30px!important;
  border:1px solid var(--border)!important;
  background:#fff!important;
  color:var(--bx)!important;
  border-radius:8px!important;
  cursor:pointer!important;
  font-size:20px!important;
  line-height:20px!important;
  font-weight:900!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  padding:0!important;
}

.dots-btn:hover{
  background:var(--bx-pale)!important;
  border-color:var(--bx)!important;
}

.mini-action-modal{
  position:fixed;
  inset:0;
  background:rgba(20,5,8,.42);
  z-index:999999;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.mini-action-modal.hidden{
  display:none!important;
}

.mini-action-card{
  width:360px;
  max-width:94vw;
  background:#fff;
  border-radius:16px;
  box-shadow:0 24px 70px rgba(0,0,0,.35);
  overflow:hidden;
  border:1px solid var(--border);
}

.mini-action-head{
  background:linear-gradient(135deg,var(--bx-dark),var(--bx));
  color:#fff;
  padding:17px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.mini-action-head strong{
  font-size:15px;
}

.mini-action-head button{
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.25);
  color:#fff;
  width:28px;
  height:28px;
  border-radius:8px;
  cursor:pointer;
  font-size:18px;
  line-height:1;
}

.mini-action-body{
  padding:10px;
}

.mini-action-item{
  display:block!important;
  padding:15px 16px;
  border-radius:12px;
  border:1px solid transparent;
  background:#fff;
  color:var(--text)!important;
  text-align:left;
  margin-bottom:8px;
}

.mini-action-item:last-child{
  margin-bottom:0;
}

.mini-action-item:hover{
  background:var(--bx-pale);
  border-color:#ead4da;
}

.mini-action-item span{
  display:block;
  font-size:14px;
  font-weight:800;
  color:var(--bx-dark);
  margin-bottom:4px;
}

.mini-action-item small{
  display:block;
  font-size:12px;
  color:var(--text-light);
  line-height:1.35;
}

/* spegne eventuali vecchi dropdown rimasti */
.actions-menu{
  display:none!important;
}

.actions-dd{
  display:none!important;
}

/* RESPONSIVE */
@media(max-width:900px){
  #topnav{
    height:auto;
    flex-wrap:wrap;
  }

  .tnmenu{
    order:3;
    width:100%;
    overflow:auto;
  }

  .top-user-text{
    display:none;
  }

  .phead{
    align-items:flex-start;
    flex-direction:column;
    gap:14px;
  }

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

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

  #main{
    padding:20px 16px;
  }

  .calendar-shell{
    max-width:100%;
  }

  .calendar-head{
    padding:0 24px;
    height:60px;
  }

  .calendar-head h2{
    font-size:18px;
  }

  .calendar-cell{
    min-height:68px;
    padding:6px;
  }

  .calendar-weekdays div{
    font-size:10px;
    letter-spacing:1.2px;
  }

  .follow-card{
    grid-template-columns:1fr;
  }

  .follow-action{
    justify-content:flex-start;
  }

  .followup-header-card{
    padding:22px;
  }

  .profile-menu{
    right:-60px;
    width:290px;
  }

  .mini-action-card{
    width:94vw;
  }
}
/* =========================================================
   FIX CALENDARIO SETTIMANALE - VERSIONE SICURA SENZA :has()
   ========================================================= */

/* Allarga la pagina */
#main{
  max-width:none !important;
  width:100% !important;
  padding-left:24px !important;
  padding-right:24px !important;
}

/* Header pagina */
.phead{
  margin-bottom:22px !important;
}

/* Titolo Calendario bianco SOLO se usi classe dedicata nella view */
.calendar-page-header{
  background:var(--bx-dark) !important;
  color:#fff !important;
  padding:18px 28px !important;
  margin:-28px -32px 22px !important;
  border-radius:0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
}

.calendar-page-header h1{
  color:#fff !important;
}

.calendar-page-header p{
  display:none !important;
}

.calendar-page-header .btn{
  background:#fff !important;
  color:var(--bx) !important;
  border:1px solid #fff !important;
}

/* Wrapper generale calendario */
.calendar-week-wrap,
.calendar-shell-week,
.weekly-calendar,
.calendar-time-wrap,
.calendar-full-wrap,
.calendar-scroll{
  width:100% !important;
  max-width:none !important;
  margin:0 !important;
  background:#fff !important;
  border:1px solid var(--border) !important;
  border-radius:12px !important;
  box-shadow:var(--shadow) !important;
  overflow:hidden !important;
}

/* Titolo settimana */
.calendar-week-title,
.week-calendar-title,
.week-title,
.calendar-range-title{
  text-align:center !important;
  font-size:28px !important;
  font-weight:900 !important;
  color:var(--bx-dark) !important;
  margin:18px 0 !important;
}

/* Area scroll */
.calendar-week-scroll,
.week-calendar-scroll,
.calendar-scroll,
.calendar-time-scroll{
  width:100% !important;
  max-width:none !important;
  overflow-x:auto !important;
  overflow-y:auto !important;
  max-height:calc(100vh - 250px) !important;
  background:#fff !important;
}

/* Tabella calendario */
.calendar-week-grid,
.calendar-time-grid,
.week-calendar-table,
.weekly-calendar table,
.calendar-shell-week table{
  width:100% !important;
  min-width:1320px !important;
  border-collapse:collapse !important;
  table-layout:fixed !important;
}

/* Header giorni */
.calendar-week-grid thead th,
.calendar-time-grid thead th,
.week-calendar-table thead th,
.weekly-calendar table thead th,
.calendar-shell-week table thead th{
  position:sticky !important;
  top:0 !important;
  z-index:5 !important;
  height:62px !important;
  padding:10px 8px !important;
  background:#FAF6F0 !important;
  color:var(--bx-dark) !important;
  border-right:1px solid var(--border) !important;
  border-bottom:1px solid var(--border) !important;
  text-align:center !important;
  font-size:12px !important;
  font-weight:900 !important;
  letter-spacing:.6px !important;
  text-transform:uppercase !important;
}

/* Colonna orari più larga */
.calendar-week-grid th:first-child,
.calendar-week-grid td:first-child,
.calendar-time-grid th:first-child,
.calendar-time-grid td:first-child,
.week-calendar-table th:first-child,
.week-calendar-table td:first-child,
.weekly-calendar table th:first-child,
.weekly-calendar table td:first-child,
.calendar-shell-week table th:first-child,
.calendar-shell-week table td:first-child{
  width:120px !important;
  min-width:120px !important;
  max-width:120px !important;
  background:#FAF6F0 !important;
  color:var(--text-mid) !important;
  text-align:center !important;
  font-weight:900 !important;
  font-size:13px !important;
  border-right:1px solid var(--border) !important;
}

/* Colonne giorni */
.calendar-week-grid th:not(:first-child),
.calendar-week-grid td:not(:first-child),
.calendar-time-grid th:not(:first-child),
.calendar-time-grid td:not(:first-child),
.week-calendar-table th:not(:first-child),
.week-calendar-table td:not(:first-child),
.weekly-calendar table th:not(:first-child),
.weekly-calendar table td:not(:first-child),
.calendar-shell-week table th:not(:first-child),
.calendar-shell-week table td:not(:first-child){
  width:calc((100% - 120px) / 7) !important;
  min-width:170px !important;
}

/* Celle orarie più alte */
.calendar-week-grid tbody td,
.calendar-time-grid tbody td,
.week-calendar-table tbody td,
.weekly-calendar table tbody td,
.calendar-shell-week table tbody td{
  height:62px !important;
  min-height:62px !important;
  padding:6px 8px !important;
  border-right:1px solid #E8DDD8 !important;
  border-bottom:1px solid #E8DDD8 !important;
  vertical-align:top !important;
  background:#fff !important;
}

/* Linee ore principali */
.calendar-week-grid tbody tr:nth-child(4n) td,
.calendar-time-grid tbody tr:nth-child(4n) td,
.week-calendar-table tbody tr:nth-child(4n) td,
.weekly-calendar table tbody tr:nth-child(4n) td,
.calendar-shell-week table tbody tr:nth-child(4n) td{
  border-bottom-color:#D8C9C2 !important;
}

/* Giorno corrente */
.calendar-week-grid .today,
.calendar-time-grid .today,
.week-calendar-table .today,
.weekly-calendar table .today,
.calendar-shell-week table .today{
  background:#FFFDF6 !important;
}

/* Weekend */
.calendar-week-grid .weekend,
.calendar-time-grid .weekend,
.week-calendar-table .weekend,
.weekly-calendar table .weekend,
.calendar-shell-week table .weekend,
.calendar-week-grid td:nth-last-child(-n+2),
.calendar-time-grid td:nth-last-child(-n+2),
.week-calendar-table td:nth-last-child(-n+2){
  background:#EEF7FF !important;
}

/* Eventi */
.calendar-event,
.cal-event,
.week-event,
.appointment-event{
  display:block !important;
  width:100% !important;
  padding:6px 8px !important;
  border-radius:7px !important;
  margin-bottom:4px !important;
  font-size:11px !important;
  font-weight:800 !important;
  line-height:1.25 !important;
  white-space:normal !important;
  overflow:hidden !important;
  color:#155C36 !important;
  background:#D7F0E3 !important;
  border:1px solid #B6DFC8 !important;
}

.calendar-event a,
.cal-event a,
.week-event a,
.appointment-event a{
  color:inherit !important;
  display:block !important;
}

/* Vecchio calendario compatto */
.calendar-shell{
  max-width:none !important;
  width:100% !important;
}

/* Responsive */
@media(max-width:900px){
  #main{
    padding-left:14px !important;
    padding-right:14px !important;
  }

  .calendar-page-header{
    margin:-20px -16px 18px !important;
    padding:16px !important;
  }

  .calendar-week-grid,
  .calendar-time-grid,
  .week-calendar-table,
  .weekly-calendar table,
  .calendar-shell-week table{
    min-width:1080px !important;
  }

  .calendar-week-grid th:first-child,
  .calendar-week-grid td:first-child,
  .calendar-time-grid th:first-child,
  .calendar-time-grid td:first-child,
  .week-calendar-table th:first-child,
  .week-calendar-table td:first-child,
  .weekly-calendar table th:first-child,
  .weekly-calendar table td:first-child,
  .calendar-shell-week table th:first-child,
  .calendar-shell-week table td:first-child{
    width:95px !important;
    min-width:95px !important;
    max-width:95px !important;
  }

  .calendar-week-grid th:not(:first-child),
  .calendar-week-grid td:not(:first-child),
  .calendar-time-grid th:not(:first-child),
  .calendar-time-grid td:not(:first-child),
  .week-calendar-table th:not(:first-child),
  .week-calendar-table td:not(:first-child),
  .weekly-calendar table th:not(:first-child),
  .weekly-calendar table td:not(:first-child),
  .calendar-shell-week table th:not(:first-child),
  .calendar-shell-week table td:not(:first-child){
    min-width:140px !important;
  }
}