/* ============================================
   CRM AGENZIA - Main Stylesheet
   Theme: Dark Industrial / Editorial
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap');

:root {
  --content-w: 1400px; 
    
  --bg-primary:     #F5F6F8;
  --bg-secondary:   #FCFCFD;
  --bg-card:        #ffffff;
  --bg-hover:       #EFF1F4;
  --bg-input:       #ffffff;

  --border:         #E8EAEE;
  --border-light:   #F0F1F4;

  --text-primary:   #17191D;
  --text-secondary: #4A4F57;
  --text-muted:     #8A9099;
  --text-menu:      #4A4F57;

  --accent:         #e74023;
  --accent-hover:   #C93318;
  --accent-light:   rgba(231, 64, 35, 0.07);
  --accent-glow:    rgba(231, 64, 35, 0.16);

  --success:        #1AA053;
  --success-light:  rgba(26, 160, 83, 0.09);
  --warning:        #C77D08;
  --warning-light:  rgba(245, 158, 11, 0.12);
  --danger:         #DC3D33;
  --danger-light:   rgba(220, 61, 51, 0.08);
  --info:           #0E7DA0;
  --info-light:     rgba(6, 182, 212, 0.1);

  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;

  --shadow:     0 1px 2px rgba(23,25,29,.04), 0 4px 12px rgba(23,25,29,.05);
  --shadow-lg:  0 4px 8px rgba(23,25,29,.06), 0 16px 48px rgba(23,25,29,.14);

  --sidebar-w:  240px;
  --header-h:   60px;

  --font-sans:    'Manrope', -apple-system, sans-serif;
  --font-display: 'Manrope', -apple-system, sans-serif;
  --font-mono:    'Manrope', -apple-system, sans-serif;
}

.dashboard-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:18px;
}

.dash-greet{
  font-size:1.4rem;
  font-weight:700;
  color:var(--text-primary);
}

.dash-time{
  font-size:1.2rem;
  font-weight:600;
  color:var(--text-secondary);
  font-family:monospace;
}

.mb-3 {
    margin-bottom: 24px;
    margin-top: 24px;
}

/* ============================================
   ALERT PORTALE CLIENTE
   ============================================ */
   .tamita-alert{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px 14px;
  margin: 14px 0 22px;
  border:1px solid var(--border);
  background: var(--danger-light);
  border-radius: 12px;
}

.tamita-alert__icon{
  width:34px;height:34px;
  border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  background: var(--bg-primary);
  border:1px solid var(--border);
  color: var(--accent);
  flex-shrink:0;
}

.tamita-alert__title{
  font-weight:800;
  font-size:.9rem;
  color: var(--text-primary);
  margin-bottom:2px;
}

.tamita-alert__text{
  font-size:.88rem;
  color: var(--text-secondary);
  line-height:1.45;
}

.tamita-alert__link{
  color: var(--accent);
  text-decoration: underline;
  font-weight:700;
}

.tamita-alert__close{
  margin-left:auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor:pointer;
  padding: 6px;
  border-radius: 10px;
  flex-shrink:0;
}

.tamita-alert__close:hover{
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* Main deve espandersi e spingere il footer in basso */
.portal-content,
main{
  flex:1 0 auto;
}

/* ===== Footer ===== */
.portal-footer{
  flex-shrink:0;            /* non si comprime */
  background:#000;
  color:#fff;
  padding:18px 24px;
}

.portal-footer-inner{
  max-width:1400px;
  margin:0 auto;
  text-align:center;
}

.portal-footer-text{
  font-size:13px;
  opacity:.85;
  letter-spacing:.3px;
}

.portal-footer a{
  color:#fff;
  text-decoration:none;
  border-bottom:1px solid rgba(255,255,255,.3);
  transition:.2s;
}

.portal-footer a:hover{
  border-bottom-color:#fff;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

/* ============================================
   LAYOUT
   ============================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-logo .logo-text {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: .5px;
}
.sidebar-logo .logo-version {
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
  position: relative;
  cursor: pointer;
  border-radius: 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-light);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px; text-align: center;
  font-size: 1rem; flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
}

.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  color: #fff; flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user .avatar img { width: 100%; height: 100%; object-fit: cover; }

/* nome e avatar in basso nella sidebar: portano al proprio profilo */
.sidebar-user-link {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  color: inherit; text-decoration: none;
  border-radius: var(--radius-sm); padding: 4px; margin: -4px;
}
.sidebar-user-link:hover { background: var(--bg-hover); }

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: .8rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: .7rem; color: var(--text-muted); text-transform: capitalize; }

.sidebar-user .logout-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer; flex-shrink: 0;
  transition: all .2s;
  font-size: .85rem;
}
.sidebar-user .logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 90;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-title span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: .85rem;
  margin-left: 8px;
}

.topbar-search {
  position: relative;
}
.topbar-search input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 34px;
  color: var(--text-primary);
  font-size: .8rem;
  width: 200px;
  transition: all .2s;
}
.topbar-search input:focus { outline: none; border-color: var(--accent); width: 260px; }
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .8rem;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer; font-size: .9rem;
  transition: all .2s; position: relative;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.notification-dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid var(--bg-secondary);
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px;
}
.page-header-left .page-title {
  font-size: 1.4rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 2px;
}
.page-header-left .page-subtitle {
  font-size: .82rem; color: var(--text-muted);
}
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.card-title {
  font-size: .9rem; font-weight: 600; color: var(--text-primary);
}

.card-body { padding: 20px; }

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap:20px;
  margin-bottom:24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--accent));
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--stat-icon-bg, var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--stat-color, var(--accent));
  margin-bottom: 14px;
}

.stat-value {
  font-size: 1.8rem; font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .78rem; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .5px;
}

.stat-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 600;
  margin-top: 8px; padding: 3px 7px;
  border-radius: 20px;
}
.stat-trend.up   { background: var(--success-light); color: var(--success); }
.stat-trend.down { background: var(--danger-light);  color: var(--danger); }

/* Setting tab */
.settings-tabs{
  display:inline-flex;
  gap:2px;
  margin-bottom:24px;
  padding:4px;
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--radius);
}

.settings-tabs .tab{
  padding:7px 18px;
  border-radius:7px;
  font-size:.83rem;
  font-weight:600;
  color:var(--text-muted);
  background:transparent;
  transition:.15s ease;
}

.settings-tabs .tab i{
  margin-right:6px;
}

.settings-tabs .tab:hover{
  color:var(--text-primary);
}

.settings-tabs .tab.active{
  background:var(--bg-secondary);
  color: var(--accent);
}


/* ============================================
   TABLES
   ============================================ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}

thead th {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-light { color: var(--text-secondary) !important; }
.td-mono  { font-family: var(--font-mono); font-size: .8rem; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
  white-space: nowrap;
}

.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light);  color: var(--danger); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-info      { background: var(--info-light);    color: var(--info); }
.badge-primary   { background: var(--accent-light);  color: var(--accent); }
.badge-secondary { background: rgba(255,255,255,.06); color: var(--text-secondary); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .83rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all .2s; white-space: nowrap;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); transform: translateY(-1px); color: #fff; }

.badge-secondary { background: rgba(0,0,0,.06); color: var(--text-secondary); }

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid transparent;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--border-light); background: var(--bg-hover); }

.btn-sm { padding: 5px 10px; font-size: .76rem; }
.btn-lg { padding: 11px 22px; font-size: .9rem; }
.btn-icon { padding: 7px; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: .78rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: var(--text-primary);
  font-size: .875rem;
  font-family: var(--font-sans);
  transition: all .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-hint {
  font-size: .72rem; color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: .72rem; color: var(--danger);
  margin-top: 4px;
}

/* ============================================
   PERMISSIONS GRID (special)
   ============================================ */
.permissions-grid {
  display: flex; flex-direction: column; gap: 6px;
}

.permission-row {
  display: flex; align-items: center;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  gap: 12px;
  transition: all .15s;
}
.permission-row:hover { border-color: var(--border-light); }

.permission-label {
  flex: 1;
}
.permission-label .perm-name {
  font-size: .83rem; font-weight: 500; color: var(--text-primary);
}
.permission-label .perm-desc {
  font-size: .72rem; color: var(--text-muted);
}

/* Custom Toggle Switch */
.toggle-wrap {
  display: flex; gap: 10px;
}

.toggle-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

.toggle-item .role-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.toggle {
  position: relative;
  display: inline-block;
  width: 38px; height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: .2s;
}
.toggle .slider::before {
  position: absolute; content: '';
  height: 14px; width: 14px;
  left: 2px; bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: .2s;
}
.toggle input:checked + .slider {
  background: var(--accent-light);
  border-color: var(--accent);
}
.toggle input:checked + .slider::before {
  transform: translateX(18px);
  background: var(--accent);
}

.perm-module-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px;
  margin-top: 8px;
}
.perm-module-header h4 {
  font-size: .72rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.perm-module-header .module-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; color: var(--accent);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all .25s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);; 
  width: 600px;
  max-height: 90vh; overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform .25s;
  box-shadow: var(--shadow-lg);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-lg { max-width: 760px; }
.modal-sm { max-width: 600px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; border-radius: 5px; font-size: 1rem;
  transition: all .15s;
}
.modal-close:hover { color: var(--danger); background: var(--danger-light); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================
   ALERTS / FLASH
   ============================================ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 16px;
  border: 1px solid;
}
.alert-success { background: var(--success-light); color: var(--success); border-color: rgba(34,197,94,.3); }
.alert-danger   { background: var(--danger-light);  color: var(--danger);  border-color: rgba(239,68,68,.3); }
.alert-warning  { background: var(--warning-light); color: var(--warning); border-color: rgba(245,158,11,.3); }
.alert-info     { background: var(--info-light);    color: var(--info);    border-color: rgba(6,182,212,.3); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
}
.empty-state .empty-icon {
  font-size: 2.5rem; margin-bottom: 16px; opacity: .3;
}
.empty-state .empty-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.empty-state .empty-text  { font-size: .85rem; color: var(--text-muted); max-width: 300px; }

/* ============================================
   EXPIRATION INDICATORS
   ============================================ */
.exp-critical { color: var(--danger) !important; }
.exp-warning  { color: var(--warning) !important; }
.exp-ok       { color: var(--success) !important; }

.progress-bar-wrap {
  background: var(--bg-hover);
  border-radius: 20px; height: 5px; overflow: hidden;
}
.progress-bar {
  height: 100%; border-radius: 20px;
  background: var(--accent);
  transition: width .4s;
}
.progress-bar.danger  { background: var(--danger); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.success { background: var(--success); }

/* ============================================
   AVATAR
   ============================================ */
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -8px; border: 2px solid var(--bg-card); }
.avatar-group .avatar:first-child { margin-left: 0; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent);
  color: #fff; font-size: .78rem; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; }
.avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar.xl { width: 64px; height: 64px; font-size: 1.4rem; }

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: .4; }
.breadcrumb .current { color: var(--text-primary); }

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}

.filter-bar .search-box {
  position: relative; flex: 1; min-width: 180px;
}
.filter-bar .search-box input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .82rem; font-family: var(--font-sans);
  transition: border-color .2s;
}
.filter-bar .search-box input:focus { outline: none; border-color: var(--accent); }
.filter-bar .search-box .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .8rem;
}

.filter-bar select {
  padding: 8px 12px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: .82rem;
  cursor: pointer; font-family: var(--font-sans);
}
.filter-bar select:focus { outline: none; border-color: var(--accent); }

/* ============================================
   DETAIL VIEW
   ============================================ */
.detail-field { margin-bottom: 16px; }
.detail-field .field-label {
  font-size: .7rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 4px;
}
.detail-field .field-value {
  font-size: .88rem; color: var(--text-primary);
}

.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.detail-grid .detail-field {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border); margin: 0;
}
.detail-grid .detail-field:nth-child(even) { border-right: none; }

/* ============================================
   COLOR DOTS (services)
   ============================================ */
.color-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* ============================================
   CHECKBOX CUSTOM
   ============================================ */
.checkbox-custom {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.checkbox-custom input[type="checkbox"] {
  appearance: none; width: 16px; height: 16px;
  border: 1.5px solid var(--border-light);
  border-radius: 4px; background: var(--bg-input);
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.checkbox-custom input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M2 6l3 3 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-secondary);
}
.login-logo{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
}

.logo {
    width: 60%;
}

/* TITOLI */
.login-title{
  font-size:26px;
  font-weight:700;
  color:#111;
  margin-bottom:6px;
}
.login-subtitle{
  font-size:14px;
  color:#777;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; 
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 32px;
}
.login-logo .logo-icon {
  width: 42px; height: 42px;
  background: var(--accent); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 24px var(--accent-glow);
}
.login-logo .logo-text { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; }
.login-logo .logo-sub  { font-size: .72rem; color: var(--text-muted); }

.login-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { font-size: .83rem; color: var(--text-muted); margin-bottom: 28px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-header {
    flex-direction: column;
  }
  .toggle-wrap {
    flex-wrap: wrap;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-none { display: none !important; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
.animate-in { animation: fadeIn .3s ease both; }
.animate-pulse { animation: pulse 2s infinite; }




/* ============================================
   TOP NAV (usa variabili esistenti)
   ============================================ */

/* shell al posto di app-wrapper + sidebar */
.app-shell{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* barra in alto */
.topnav{
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;

  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

/* logo a sinistra */
.topnav-logo{
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  min-width: 200px;
}
.topnav-logo-img {
  width: 200px; /* regola a piacere */
  height: auto;
}

.topnav-logo .logo-icon{
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.topnav-logo .logo-text{
  display: grid;
  line-height: 1.05;
  min-width: 0;
}

.topnav-logo .logo-name{
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav-logo .logo-version{
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* menu centrato */
.topnav-menu{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.topnav-link{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-menu);
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.topnav-link:hover{
  color: var(--text-primary);
  background: var(--bg-hover);
}

.topnav-link.active{
  color: var(--accent);
}

/* badge count scadenze nel menu */
.topnav-link .pill{
  margin-left: 6px;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  font-family: var(--font-mono);
}

/* area destra */
.topnav-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* search (stile coerente con topbar-search) */
.topnav-search{
  position: relative;
  display: flex;
  align-items: center;
}

.topnav-search i{
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .85rem;
}

.topnav-search input{
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 34px;
  color: var(--text-primary);
  font-size: .8rem;
  width: 220px;
  transition: all .2s;
}

.topnav-search input:focus{
  outline: none;
  border-color: var(--accent);
  width: 280px;
}

.topnav-search input::placeholder{
  color: var(--text-muted);
}

.fas.fa-chevron-down.dd-caret {
  color: var(--accent);
}

/* bottoni icona (notifiche ecc) */
.icon-btn{
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  text-decoration: none;
}

.icon-btn:hover{
  border-color: var(--accent-hover);
  color: var(--accent);
  background: var(--accent-light);
}

/* dot notifiche */
.icon-btn .dot{
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  background: var(--danger);
  border-radius: 50%;
  border: 1px solid var(--bg-secondary);
}

/* dropdown */
.topnav-dropdown{
  position: relative;
}

.topnav-ddbtn{
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.dd-caret{
  font-size: 12px;
  opacity: .65;
}

.topnav-ddmenu{
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 120;
}

.topnav-dropdown.open .topnav-ddmenu{
  display: block;
}

.dd-item{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 600;
  transition: all .15s;
}

.dd-item:hover{
  color: var(--text-primary);
  background: var(--bg-hover);
}

.dd-item.active{
  color: var(--accent);
  background: var(--accent-light);
}

.dd-item.danger{
  color: var(--danger);
}

.dd-item.danger:hover{
  background: var(--danger-light);
}

/* header dentro menu utente */
.dd-header{
  padding: 10px 10px 8px;
}

.dd-strong{
  font-weight: 800;
  color: var(--text-primary);
  font-size: .88rem;
}

.dd-muted{
  color: var(--text-muted);
  font-size: .75rem;
  margin-top: 2px;
}

.dd-sep{
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* bottone utente (avatar + nome) */
.user-btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  color: var(--text-secondary);
}

.user-btn:hover{
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-primary);
}

.user-btn .avatar{
  width: 30px;
  height: 30px;
}

.user-meta{
  display: grid;
  line-height: 1.05;
  text-align: left;
  max-width: 160px;
}

.user-meta .user-name{
  font-size: .82rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta .user-role{
  font-size: .7rem;
  color: var(--accent);
  text-transform: capitalize;
}

/* main content sotto topnav */
.app-main{
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* titolo pagina (se vuoi mantenerlo) */
.page-head{
  padding: 24px 24px 0;
}

.page-head .page-title{
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.page-title-dashboard {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.page-head .page-subtitle{
  font-size: .82rem;
  color: var(--text-muted);
}

/* page content resta come il tuo */
.page-content{
  max-width: var(--content-w);
  margin: 0 auto;
  width: 100%;
}

.page-head{
  max-width: var(--content-w);
  margin: 0 auto;
  width: 100%;
}

/* responsive: menu centrato si compatta */
@media (max-width: 980px){
  .topnav-search input{ width: 160px; }
  .topnav-search input:focus{ width: 200px; }
  .user-meta{ display: none; }
}

@media (max-width: 768px){
  .topnav{
    grid-template-columns: auto 1fr auto;
    padding: 0 16px;
    gap: 10px;
  }
  .topnav-menu{
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav-menu::-webkit-scrollbar{ display: none; }
  .topnav-search{ display: none; }
}

/* TIME TRACKING */
.harvest-container {
    max-width: 1400px;
    margin: 0 auto;
}
.harvest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.date-title {
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 16px;
}
.date-nav-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}
.date-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.return-today {
    color: var(--accent);
    text-decoration: underline;
    font-size: 1rem;
    cursor: pointer;
    margin-left: 12px;
}
.view-tabs {
    display: flex;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    background: white;
}
.view-tab {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.view-tab.active {
    background: var(--accent);
    color: white;
}
.week-summary {
    display: grid;
    grid-template-columns: 140px repeat(7, 1fr) 80px 40px; 
    gap: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
}
.week-day-header {
    padding: 16px 12px;
    text-align: center;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.week-summary .week-day-header:nth-child(10) { /* ultima colonna header */
    border-right: none;
}
.week-day-header:last-child {
    border-right: none;
}
.week-day-name {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}
.week-day-date {
    font-size: .9rem;
    color: var(--text-primary);
    margin-top: 2px;
}
.week-day-total {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 4px;
}
.week-day-header.today {
    background: var(--accent);
}
.week-day-header.today .week-day-name,
.week-day-header.today .week-day-date,
.week-day-header.today .week-day-total {
    color: white;
}
.track-btn {
    width: 60px;
    height: 60px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: all .2s;
}
.track-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
}
.track-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}
.entry-row {
    display: grid;
    grid-template-columns: 140px repeat(7, 1fr) 80px 40px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 12px 0;
    background: white;
}
.entry-row:hover {
    background: var(--bg-hover);
}
.entry-project {
    padding: 0 12px;
}
.entry-project-code {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.entry-project-task {
    font-size: .75rem;
    color: var(--text-muted);
}
.entry-notes {
    font-size: .75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.entry-cell {
    padding: 4px 8px;
    text-align: center;
}
.entry-duration {
    font-family: var(--font-mono);
    font-size: .9rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    min-width: 50px;
    cursor: pointer;
}
.entry-duration:hover {
    background: var(--bg-hover);
}
.entry-duration-input {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 6px;
    padding: 12px 8px;
    width: 60px;
    text-align: center;
    background: #fff;
}
.entry-duration-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-light);
}
.entry-total {
    font-family: var(--font-mono);
    font-size: .9rem;
    font-weight: 700;
    text-align: right;
    padding-right: 12px;
}
.entry-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}
.entry-actions button:hover {
    color: var(--danger);
}
.week-total-row {
    display: grid;
    grid-template-columns: 140px repeat(7, 1fr) 80px 40px;
    padding: 16px 0;
    font-weight: 700;
    background: var(--bg-primary);
}
.week-total-label {
    padding: 0 12px;
    font-size: .9rem;
    color: var(--text-muted);
}
.week-total-cell {
    font-family: var(--font-mono);
    font-size: .95rem;
    text-align: center;
    color: var(--text-primary);
}
.week-total-sum {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    text-align: right;
    padding-right: 12px;
    color: var(--text-primary);
}
.add-row-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px dashed var(--border);
    background: white;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 500;
    margin: 12px;
    transition: all .2s;
}
.add-row-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* DAY VIEW */
.day-entries {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.day-entry-card {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
}
.day-entry-card:hover {
    background: var(--bg-hover);
}
.day-entry-project {
    flex: 1;
}
.day-entry-code {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.day-entry-task {
    font-size: .85rem;
    color: var(--text-secondary);
}
.day-entry-description {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.day-entry-duration {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 80px;
    text-align: right;
}
.day-entry-actions {
    display: flex;
    gap: 8px;
}
.day-entry-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.day-entry-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.day-total-bar {
    padding: 20px;
    background: var(--bg-primary);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
}
.day-total-bar strong {
    color: var(--text-muted);
}
.day-total-bar span {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
}



/* ============================================
   Client portal
   ============================================ */
:root{
      --portal-primary:#e56655;
      --portal-secondary:#F8FAFC;
      --bg-primary:#f8f9fa;
      --bg-secondary:#F8FAFC;
      --accent:#e74023;

      --footer-h: 56px; /* altezza footer fisso */
    }

    html, body{ height:100%; }
    body{ margin:0; background:var(--bg-primary); }
    
    /* TICKET */
    .portal-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.btn-ticket{
  background: var(--accent);
  border:1px solid rgba(255,255,255,.06);
  color:#fff;
  padding:8px 14px;
  border-radius:8px;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
  white-space:nowrap;
  transition:.2s;
}
.btn-ticket:hover{ filter: brightness(1.05); transform: translateY(-1px); }

.btn-ticket[aria-disabled="true"]{
  opacity:.45;
  cursor:not-allowed;
  /* NON mettere pointer-events:none, altrimenti non puoi cliccarlo */
}

.ticket-hint{
  position:fixed;
  top:72px; /* sotto header */
  right:24px;
  background:#111;
  color:#fff;
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  padding:12px 14px;
  font-size:13px;
  max-width: 360px;
  z-index: 50;
  display:none;
}
.ticket-hint a{ color:#fff; text-decoration:underline; }

    /* full width sempre + spazio per footer fisso */
    .portal-layout{
      min-height:100vh;
      width:100%;
      padding-bottom: var(--footer-h);
    }

    /* HEADER: 3 colonne (sx logo | centro menu | dx user) */
    .portal-header{
      background:var(--bg-secondary);
      color:#fff;
      height:60px;
      padding:0 24px;
      position:sticky;
      top:0;
      z-index:9;
      width:100%;

      display:grid;
      grid-template-columns: 1fr auto 1fr;
      align-items:center;
      gap:16px;
    }

    /* LOGO */
    .portal-logo{ display:flex; align-items:center; }
    .portal-logo img{ height:28px; width:auto; display:block; }

    /* NAV centrato (dentro header) */
    .portal-nav{
      display:flex;
      justify-content:center;
      align-items:center;
      gap:28px;
      white-space:nowrap;
    }
    .portal-nav-item{
      color:var(--text-primary);
      opacity:.85;
      text-decoration:none;
      font-weight:600;
      font-size:14px;
      display:inline-flex;
      align-items:center;
      gap:8px;
      padding:10px 0;
      border-bottom:2px solid transparent;
      transition:.2s;
    }
    .portal-nav-item:hover{ 
        opacity:1; 
        color:var(--text-primary);}
    .portal-nav-item.active{
      opacity:1;
      border-bottom-color: var(--accent);
      
    }

    /* USER a destra */
    .portal-user{
      justify-self:end;
      display:flex;
      align-items:center;
      gap:16px;
    }
    .portal-user-name{ font-weight:600; font-size:14px; opacity:.9;
    color:var(--text-primary);}

    /* LOGOUT BTN */
    .btn-logout{
      background:rgba(255,255,255,.12);
      border:1px solid rgba(255,255,255,.22);
      color:var(--text-primary);
      padding:8px 14px;
      border-radius:8px;
      font-size:14px;
      cursor:pointer;
      transition:.2s;
      text-decoration:none;
      display:inline-flex;
      align-items:center;
      gap:8px;
      white-space:nowrap;
    }
    .btn-logout:hover{ background:rgba(255,255,255,.18); }

    /* CONTENT */
    .portal-content{
      padding:40px;
      max-width:1400px;
      margin:0 auto;
      min-height: 100%;
    }

    /* FOOTER FISSO (togliamo margin-top: non serve e puÃ² creare bug) */
    .portal-footer{
     
      left:0;
      right:0;
      bottom:0;
      height:var(--footer-h);
      background:#000;
      color:#fff;
      display:flex;
      align-items:center;
      z-index:10;
      padding:0 24px;
    }
    .portal-footer-inner{
      width:100%;
      max-width:1400px;
      margin:0 auto;
      text-align:center;
      font-size:13px;
      opacity:.88;
      letter-spacing:.3px;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .portal-footer a{
      color:#fff;
      text-decoration:none;
      border-bottom:1px solid rgba(255,255,255,.3);
      transition:.2s;
    }
    .portal-footer a:hover{ border-bottom-color:#fff; }

    /* responsive */
    @media (max-width: 900px){
      .portal-header{
        padding:0 16px;
        grid-template-columns: auto 1fr auto; /* logo | nav scroll | logout */
        gap:12px;
      }

      .portal-nav{
        justify-content:flex-start;
        overflow-x:auto;
        gap:16px;
        scrollbar-width:none;
      }
      .portal-nav::-webkit-scrollbar{ display:none; }

      .portal-content{ padding:20px; }
      .portal-user-name{ display:none; }
      .portal-footer{ padding:0 16px; }
    }


/* TAB TIME ENTRIES PROJECT */
.entry-accordion-header:hover {
  background: #eaeaea !important;
}
.accordion-icon.open {
  transform: rotate(180deg);
}

/* LOGIN CLIENTE */
/* SFONDO */
/* SFONDO */
body.login-page{
  background:#F8FAFC;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
}

/* BOX LOGIN */
.login-container{
  background:#fff;
  border-radius:14px;
  padding:42px;
  width:100%;
  max-width:500px;
  box-shadow:0 25px 70px rgba(0,0,0,.45);
}

/* LOGO */
.login-logo{
  text-align:center;
  margin-bottom:28px;
}
.login-logo img{
  height:48px;
  width:auto;
  margin-bottom:18px;
}

/* TITOLI */
.login-title{
  font-size:26px;
  font-weight:700;
  color:#111;
  margin-bottom:6px;
}
.login-subtitle{
  font-size:14px;
  color:#777;
}

/* FORM */
.login-form{ margin-top:28px; }

.form-group{ margin-bottom:18px; }

.form-label{
  display:block;
  font-size:13px;
  font-weight:600;
  margin-bottom:6px;
  color:#444;
}

.form-control{
  width:100%;
  padding:12px 14px;
  border:1px solid #ddd;
  border-radius:8px;
  font-size:14px;
  transition:.2s;
}
.form-control:focus{
  border-color:var(--accent);
  outline:none;
  box-shadow:0 0 0 3px rgba(254,51,10,.15);
}

/* BOTTONE ACCENT */
.btn-login{
  width:100%;
  padding:13px;
  font-size:15px;
  font-weight:700;
  background:var(--accent);
  border:none;
  color:#fff;
  border-radius:8px;
  cursor:pointer;
  transition:.18s;
}
.btn-login:hover{
  filter:brightness(.95);
  transform:translateY(-1px);
  box-shadow:0 6px 18px rgba(254,51,10,.35);
}

/* ERRORE */
.error-message{
  background:#fff0f0;
  border:1px solid #ffc9c9;
  color:#c40000;
  padding:11px;
  border-radius:8px;
  margin-bottom:18px;
  font-size:13px;
  text-align:center;
}

.login-logo{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
}

.login-links{
  margin-top:14px;
  text-align:center;
  font-size:13px;
}

.login-links a{
  color:#666;
  text-decoration:none;
  transition:.2s;
}

.login-links a:hover{
  color:var(--accent);
}

/* PULSE BTN */
.pulse-btn {
  position: relative;
  animation: pulseBorder 2s ease-in-out infinite;
}

@keyframes pulseBorder {
  0%   { box-shadow: 0 0 0 0 rgba(255, 120, 0, 0.6); }
  50%  { box-shadow: 0 0 0 8px rgba(255, 120, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 120, 0, 0); }
}

/* MODAL TIME TRACKING */
.choices__inner {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    background: var(--bg-card) !important;
    font-size: .875rem !important;
    padding: 6px 10px !important;
    min-height: 38px !important;
}
.choices__list--dropdown {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.1) !important;
}
.choices__list--dropdown .choices__item--selectable {
    padding: 8px 14px !important;
    font-size: .875rem !important;
}
.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}
.choices__group .choices__heading {
    font-size: .72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .6px !important;
    color: var(--text-muted) !important;
    padding: 10px 14px 4px !important;
    border-bottom: none !important;
}
.choices__input {
    background: transparent !important;
    font-size: .875rem !important;
}
.choices__placeholder {
    color: var(--text-muted) !important;
    opacity: 1 !important;
}
/* ============================================
   SIDEBAR LAYOUT — aggiunte (logo SVG, hamburger, overlay mobile)
   ============================================ */
.sidebar-logo { text-decoration: none; }
.sidebar-logo .sidebar-logo-img {
  width: 150px;
  height: auto;
  display: block;
}
.sidebar-logo .logo-version {
  font-size: .65rem;
  color: var(--text-muted);
  align-self: flex-end;
}

.sidebar-user .logout-btn { text-decoration: none; }

.menu-toggle { display: none; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { z-index: 200; }
  .sidebar-overlay.show { display: block; }
}

/* ============================================
   RESTYLE 2026 — "Workspace di precisione"
   Layer di rifinitura: minimal, ink & MB red,
   dati in monospace tabellare (firma visiva)
   ============================================ */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text-secondary);
  background: var(--bg-primary);
}

/* ---- Tipografia display ---- */
.page-title,
.dash-greet,
.modal-title,
.login-title,
.page-title-dashboard {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { font-size: .82rem; }

/* ---- Sidebar: voci a pillola ---- */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
}
.sidebar-logo { padding: 22px 20px 18px; border-bottom: none; }
.sidebar-nav { padding: 4px 0 12px; }
.nav-section-label {
  font-size: .62rem;
  letter-spacing: .14em;
  padding: 18px 22px 8px;
  color: var(--text-muted);
}
.nav-item {
  margin: 1px 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: .86rem;
  color: var(--text-menu);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before { display: none; }
.nav-item .nav-icon { font-size: .9rem; opacity: .85; }
.sidebar-footer { border-top: 1px solid var(--border-light); }

/* ---- Topbar: vetro smerigliato ---- */
.topbar {
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border-light);
}
.topbar-title {
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: -0.01em;
}
.topbar-btn {
  border-color: transparent;
  color: var(--text-muted);
}
.topbar-btn:hover {
  background: var(--bg-hover);
  border-color: transparent;
  color: var(--text-primary);
}
.user-btn { border-color: transparent; }
.user-btn:hover { background: var(--bg-hover); }

/* ---- Dropdown ---- */
.topnav-ddmenu {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* ---- Card ---- */
.card {
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
}

/* ---- Tabelle: registro dati ---- */
thead th {
  background: transparent;
  color: var(--text-muted);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border-light); }
tbody tr:hover { background: #FAFBFC; }
tbody td {
  padding: 13px 16px;
  font-variant-numeric: tabular-nums;
}
.td-mono, .text-mono {
  font-family: var(--font-mono);
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---- Badge ---- */
.badge {
  padding: 3px 10px;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.badge-secondary { background: rgba(23,25,29,.05); color: var(--text-secondary); }

/* ---- Bottoni ---- */
.btn { border-radius: var(--radius-sm); }
.btn-primary {
  box-shadow: 0 1px 2px rgba(201,51,24,.25);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(201,51,24,.3);
  transform: none;
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text-primary); }

/* ---- Tab impostazioni: segmented control ---- */
.settings-tabs {
  background: var(--bg-hover);
  border: none;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}
.settings-tabs .tab {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: .82rem;
}
.settings-tabs .tab:hover { color: var(--text-primary); }
.settings-tabs .tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(23,25,29,.1);
}
.settings-tabs .tab.active i { color: var(--accent); }

/* ---- Barra filtri ---- */
.filter-bar .search-box input,
.filter-bar select {
  border-radius: var(--radius-sm);
}
.filter-bar select:focus,
.filter-bar .search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- Progress bar ---- */
.progress-bar-wrap {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-hover);
  overflow: hidden;
}
.progress-bar { border-radius: 999px; }

/* ---- Modali ---- */
.modal-backdrop {
  background: rgba(16, 18, 22, .45);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.modal {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

/* ---- Alert ---- */
.alert {
  border-radius: var(--radius);
  border: none;
  font-weight: 500;
}

/* ---- Empty state ---- */
.empty-state .empty-icon { opacity: .5; }
.empty-state .empty-title { color: var(--text-primary); }

/* ---- Focus visibile (tastiera) ---- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D5D8DE; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #B9BEC7; }

/* ---- Motion ridotto ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---- Ordinamento colonne ---- */
thead th.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
thead th.th-sortable:hover { color: var(--text-primary); }
thead th .sort-ind {
  margin-left: 4px;
  color: var(--accent);
  font-size: .75rem;
}

/* ---- Sidebar: gruppo a tendina (Contabilità) ---- */
button.nav-item {
  width: calc(100% - 20px);
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
}
.nav-caret {
  margin-left: auto;
  font-size: .6rem;
  opacity: .6;
  transition: transform .2s;
}
.nav-group-toggle.open .nav-caret { transform: rotate(180deg); }
.nav-group { display: none; }
.nav-group.open { display: block; }
.nav-item.nav-sub {
  padding-left: 44px;
  font-size: .82rem;
}

/* ---- Contabilità: barra mesi (stile FIC) ---- */
.mesi-strip {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
}
.mese-cell {
  flex: 1;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: all .15s;
}
.mese-cell:hover { background: var(--bg-hover); }
.mese-cell.has-docs { background: var(--success-light); }
.mese-cell.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.mese-nome {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}
.mese-cell.active .mese-nome { color: var(--accent); }
.mese-doc { font-size: .72rem; color: var(--text-secondary); }
.mese-tot { font-size: .74rem; font-weight: 600; color: var(--text-primary); }

/* ---- Statistiche: grafico a barre ---- */
.stat-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 180px;
}
.stat-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.stat-bar-val {
  font-size: .64rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.stat-bar-track {
  width: 100%;
  max-width: 46px;
  height: 120px;
  display: flex;
  align-items: flex-end;
  background: var(--bg-primary);
  border-radius: 6px;
  overflow: hidden;
}
.stat-bar-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  opacity: .85;
  transition: height .3s ease;
}
.stat-bar-col:hover .stat-bar-fill { opacity: 1; }
.stat-bar-label {
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-secondary);
}
@media (max-width: 900px) {
  .stats-cols { grid-template-columns: 1fr !important; }
}

/* ---- Righe cliccabili ---- */
tbody tr.row-clickable { cursor: pointer; }

/* ============================================
   RESTYLE 2026 — PASS 2
   Full width + tabelle moderne e silenziose
   ============================================ */

/* ---- Contenuto a tutto schermo ---- */
.page-content { max-width: none; padding: 28px 36px; }
.page-head { max-width: none; }
.harvest-container { max-width: none; }

/* ---- Gerarchia pagina ---- */
.page-title { font-size: 1.6rem; letter-spacing: -0.025em; }
.page-header { margin-bottom: 26px; }
.card { border-radius: 14px; }

/* ---- Tabelle: header minuscolo e quieto ---- */
thead th {
  text-transform: none;
  letter-spacing: 0;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
}
tbody td { padding: 14px 16px; font-size: .875rem; }
tbody tr:hover { background: var(--bg-primary); }
.td-mono, .text-mono { font-size: .8rem; }

/* ---- Azioni riga: invisibili finché non servono ---- */
tbody .btn-icon {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .12s, color .12s, background .12s;
}
tbody tr:hover .btn-icon, tbody .btn-icon:focus-visible { opacity: 1; }
tbody .btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
tbody .btn-danger.btn-icon:hover { background: var(--danger-light); color: var(--danger); }
@media (hover: none) {
  tbody .btn-icon { opacity: 1; }   /* touch: sempre visibili */
}

/* ---- Badge: pallino + testo normale ---- */
.badge {
  text-transform: none;
  letter-spacing: 0;
  font-size: .74rem;
  font-weight: 600;
  gap: 6px;
  padding: 3px 10px 3px 8px;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .65;
  flex-shrink: 0;
}
.nav-badge::before, .pill::before { display: none; }

/* ---- Intestazioni gruppo cliente (lista progetti) ---- */
.client-group-header td {
  background: transparent !important;
  border-top: none !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 20px 16px 8px !important;
}

/* ---- Filtri a pillola ---- */
.filter-bar .search-box input { border-radius: 999px; }
.filter-bar select { border-radius: 999px; padding: 8px 16px; }

/* ---- Mono meno gridato nelle stat ---- */
.stat-value.td-mono { letter-spacing: -0.02em; }

/* ---- Manrope ovunque: numeri tabellari per l'allineamento in colonna ---- */
.td-mono, .text-mono, .stat-value, .stat-bar-val, tbody td {
  font-variant-numeric: tabular-nums;
}

/* ---- Lista progetti: intestazione cliente ben distinta dalle righe ---- */
.client-group-header td {
  background: var(--bg-hover) !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 10px 16px !important;
}
.client-group-header .client-group-name {
  font-size: .8rem !important;
  font-weight: 800 !important;
  color: var(--text-primary) !important;
  letter-spacing: .04em !important;
}
.client-group-header:hover td { background: var(--bg-hover) !important; }

/* ---- Filtri anno: segmented control pulito (reset bordi dei <button>) ---- */
.settings-tabs .tab,
.settings-tabs button.tab {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.settings-tabs .tab:hover { color: var(--text-primary); }
.settings-tabs .tab.active,
.settings-tabs button.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(23,25,29,.1);
}

/* ---- Card statistiche: numeri uniformi a 21px ---- */
.stat-value { font-size: 21px; }

/* ---- Impostazioni ancorato in fondo, sopra l'utente ---- */
.sidebar-settings {
  padding: 8px 0;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   GRAFICO ANDAMENTO (Statistiche) — SVG
   ============================================================ */
.chart-legend { display: flex; gap: 16px; font-size: .8rem; color: var(--text-secondary); }
.chart-legend .chart-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle;
}
.chart-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.trend-chart { display: block; width: 100%; min-width: 520px; height: auto; }
.trend-chart rect { transition: opacity .15s; }
.trend-chart g:hover rect { opacity: .8; }

/* ============================================================
   DIARIO CLIENTE — timeline
   ============================================================ */
.diary-timeline { display: flex; flex-direction: column; gap: 4px; }
.diary-item { display: flex; gap: 14px; padding: 4px 0; }
.diary-item:not(:last-child) { position: relative; }
.diary-item:not(:last-child)::before {
  content: ''; position: absolute; left: 17px; top: 40px; bottom: -4px;
  width: 2px; background: var(--border-light);
}
.diary-dot {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; z-index: 1;
}
.diary-body { flex: 1; min-width: 0; padding-bottom: 16px; }
.diary-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: .82rem; color: var(--text-muted); margin-bottom: 4px;
}
.diary-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.diary-text { font-size: .9rem; color: var(--text-primary); line-height: 1.5; white-space: normal; word-break: break-word; }
.diary-next {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 12px; border-radius: 8px;
  background: rgba(199,125,8,.08); color: #8a5a06; font-size: .84rem;
}
.diary-next .diary-next-text { flex: 1; min-width: 0; }
.diary-next.is-overdue { background: rgba(220,61,51,.1); color: var(--danger); }
.diary-next.is-done { background: rgba(26,160,83,.1); color: #157a40; }
.diary-next.is-done .diary-next-text { text-decoration: line-through; opacity: .8; }

/* ============================================================
   RESPONSIVE 2026 — pass mobile completo
   Batte gli stili inline con !important dove serve.
   ============================================================ */

/* niente scroll orizzontale della pagina: scrollano i contenitori interni */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 860px) {

  /* ---- Sidebar a cassetto ---- */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0,0,0,.25);
    z-index: 300;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block !important; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  .menu-toggle { display: flex !important; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title { font-size: .9rem; }
  .user-meta { display: none; }               /* nell'header utente solo avatar */

  /* ---- Contenuto ---- */
  .page-content { padding: 16px 12px !important; }
  .page-title { font-size: 1.3rem !important; }

  /* header pagina: impila titolo e azioni */
  .page-header { flex-direction: column; align-items: stretch !important; gap: 12px; }
  .page-header-actions { flex-wrap: wrap; }
  .page-header-actions .btn { flex: 1; justify-content: center; }

  /* ---- Collassa TUTTE le griglie a colonna singola ---- */
  .stats-grid,
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .stats-cols { grid-template-columns: 1fr !important; }
  .form-row { grid-template-columns: 1fr !important; }
  .detail-grid { grid-template-columns: 1fr 1fr !important; }

  /* riquadri affiancati con flex → colonna */
  .prev-grid { grid-template-columns: 1fr !important; }

  /* sidebar totali "sticky" del preventivatore → statica */
  .prev-grid > div:last-child .card[style*="sticky"] { position: static !important; }

  /* ---- Filtri: uno sotto l'altro, larghezza piena ---- */
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar > * { width: 100% !important; }
  .filter-bar .search-box input,
  .filter-bar select { width: 100% !important; }

  /* ---- Tabelle: scroll orizzontale fluido ---- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: .8rem; }
  thead th, tbody td { padding: 10px 10px; white-space: nowrap; }
  /* le azioni restano sempre visibili su touch (già gestito da hover:none) */

  /* ---- Tab/filtri scrollabili in orizzontale ---- */
  .settings-tabs {
    display: flex !important;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tabs .tab { white-space: nowrap; flex: 0 0 auto; }

  /* barra mesi contabilità: già scrolla, rendo le celle compatte */
  .mesi-strip { padding: 10px 10px; }
  .mese-cell { min-width: 56px; }

  /* ---- Modali a tutto schermo (dal basso, stile bottom-sheet) ---- */
  .modal-backdrop { align-items: flex-end; }
  .modal, .modal.modal-lg, .modal.modal-sm {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 92vh;
    display: flex; flex-direction: column;
  }
  .modal-body { overflow-y: auto; }

  /* ---- Grafico barre statistiche: più stretto ---- */
  .stat-bars { min-height: 140px; }
  .stat-bar-track { height: 90px; }

  /* ---- Righe cliccabili: tap target comodo ---- */
  tbody tr.row-clickable td { padding-top: 12px; padding-bottom: 12px; }
}

/* Telefoni piccoli */
@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr !important; }
  .page-content { padding: 14px 10px !important; }
  .stat-value { font-size: 20px !important; }
  .topbar-title span { display: none; }        /* nasconde il sottotitolo lungo */
}

/* ============================================================
   TABELLE → SCHEDE (mobile ≤ 900px, come il resto della veste mobile)
   ============================================================ */
/* la freccetta accordion esiste solo su mobile: nascosta di default */
.card-chevron { display: none !important; }

@media (max-width: 900px) {
  table.as-cards,
  table.as-cards tbody,
  table.as-cards tr,
  table.as-cards td { display: block; width: 100%; }
  table.as-cards thead { display: none; }

  table.as-cards tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 0 0 10px 0;
    padding: 4px 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow);
  }
  /* intestazioni-gruppo (es. clienti nella lista progetti) come divisori */
  table.as-cards tr.card-full,
  table.as-cards tr.client-group-header {
    border: none; box-shadow: none; background: transparent;
    padding: 12px 2px 4px; margin: 0;
  }
  table.as-cards tr.card-full td,
  table.as-cards tr.client-group-header td {
    padding: 0 !important; border: none !important; text-align: left;
  }

  table.as-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    white-space: normal;
    text-align: right;
    min-height: 20px;
  }
  table.as-cards td:last-child { border-bottom: none; }

  /* ---- ACCORDION: di base mostra solo l'intestazione (nome) ---- */
  table.as-cards td:not(.card-head) { display: none; }
  table.as-cards tr.card-expanded td { display: flex; }
  table.as-cards td.card-head {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: .95rem;
    border-bottom: none;
    text-align: left;
    cursor: pointer;
    padding: 12px 0;
  }
  table.as-cards td.card-head::before { display: none; }
  table.as-cards tr.card-expanded td.card-head { border-bottom: 1px solid var(--border-light); }
  .card-chevron { display: inline-block !important; color: var(--text-muted); transition: transform .2s; margin-left: 8px; flex-shrink: 0; }
  table.as-cards tr.card-expanded .card-chevron { transform: rotate(180deg); }

  /* etichetta a sinistra */
  table.as-cards td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: .72rem;
    color: var(--text-muted);
    text-transform: none;
    text-align: left;
    flex-shrink: 0;
    white-space: nowrap;
  }
  /* celle senza etichetta (azioni) o vuote: niente prefisso, valore a destra pieno */
  table.as-cards td:not([data-label]) { justify-content: flex-end; }
  table.as-cards td:empty { display: none; }

  /* il valore può andare a capo/occupare spazio */
  table.as-cards td > * { max-width: 100%; }
  /* barre di progresso a piena larghezza nella card */
  table.as-cards td .progress-bar-wrap { min-width: 90px; }
  /* colonna azioni: bottoni allineati a destra, sempre visibili */
  table.as-cards td .flex.gap-2 { justify-content: flex-end; }
}

/* testo solo per lettori di schermo */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Portale cliente: storico mensile dei progetti condivisi */
.pp-month { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; background: var(--bg-card); }
.pp-month > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; font-weight: 700; }
.pp-month > summary::-webkit-details-marker { display: none; }
.pp-month > summary .pp-chev { transition: transform .15s; color: var(--text-muted); }
.pp-month[open] > summary .pp-chev { transform: rotate(90deg); }
.pp-day { padding: 10px 18px; border-top: 1px solid var(--border-light); }
.pp-day-head { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; text-transform: capitalize; }
.pp-entry { display: flex; gap: 12px; justify-content: space-between; padding: 6px 0; font-size: .88rem; }
.pp-entry + .pp-entry { border-top: 1px dashed var(--border-light); }
.pp-entry-desc { color: var(--text-secondary); font-size: .82rem; margin-top: 2px; white-space: pre-line; }

/* Portale cliente: footer chiaro (sostituisce il nero) */
.portal-footer {
  background: var(--bg-card);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.portal-footer-inner, .portal-footer-text { opacity: 1; }
.portal-footer strong { color: var(--text-secondary); }
.portal-footer a { color: var(--accent); border-bottom-color: transparent; }
.portal-footer a:hover { color: var(--accent-hover); border-bottom-color: currentColor; }

/* icone al posto delle emoji negli stati vuoti */
.empty-state .empty-icon { color: var(--text-muted); }

/* Nome progetto: tendina dei pacchetti time card */
.tc-suggest-wrap { position: relative; }
.tc-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; padding: 4px; }
.tc-suggest-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.tc-suggest-item:hover, .tc-suggest-item.active { background: var(--bg-hover); color: var(--text-primary); }
