/* ===== BASE ===== */
/* Token in css/shared.css — questo file contiene solo componenti */

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  -webkit-font-smoothing: antialiased;
}
.page { display: none; }
.page.active { display: block; }

/* ===== THEME TOGGLE ===== */
.theme-btn {
  background: none;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 9px;
  cursor: pointer;
  font-size: var(--text-base);
  line-height: 1;
  color: var(--text2);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.theme-btn:hover { border-color: var(--green); color: var(--green); }

/* ===== NAVBAR ===== */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surf);
  position: sticky; top: 0; z-index: var(--z-sticky);
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.04);
}
.logo {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  letter-spacing: -0.03em;
  color: var(--text);
}
.logo span { color: var(--green); }
.nav-right { display: flex; align-items: center; gap: var(--sp-3); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-light);
  border: 1.5px solid var(--green);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs); font-weight: var(--font-semibold);
  flex-shrink: 0; cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.avatar:hover { transform: scale(1.06); box-shadow: var(--shadow-sm); }

/* ===== BANNER DEMO ===== */
.demo-banner {
  display: none;
  background: var(--banner-demo-bg);
  border-bottom: 1px solid var(--banner-demo-border);
  padding: 10px var(--sp-6);
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.demo-banner-text {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--banner-demo-text);
}
.demo-banner-btn {
  background: var(--banner-demo-btn-bg);
  color: var(--banner-demo-btn-fg);
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  padding: 7px 16px;
  border-radius: var(--radius);
  text-decoration: none; white-space: nowrap;
  transition: opacity var(--t-fast);
}
.demo-banner-btn:hover { opacity: 0.88; }

/* ===== SIDEBAR LOGO ===== */
.sb-logo {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sb-dot {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sb-dot svg {
  width: 14px; height: 14px;
  fill: none; stroke: #fff;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.sb-name {
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  color: var(--text); letter-spacing: -0.02em;
}
.sb-role {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--text3); letter-spacing: 0.10em;
  text-transform: uppercase; margin-top: 1px;
}

/* ===== SIDEBAR USER (fondo) ===== */
.sb-bottom {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border-top: 1px solid var(--border);
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: var(--sp-2); border-radius: var(--radius);
  transition: background var(--t-fast);
}
.sb-user:hover { background: var(--surf3); }
.ava-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green-light); border: 1.5px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 9px; font-weight: var(--font-semibold);
  color: var(--green); flex-shrink: 0;
}
.sb-user-name { font-size: var(--text-xs); font-weight: var(--font-semibold); color: var(--text); }
.sb-user-role {
  font-family: var(--font-mono); font-size: 9px; color: var(--text3);
  margin-top: 1px; letter-spacing: 0.06em;
}

/* ===== CLIENT LAYOUT ===== */
.client-layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto; scrollbar-width: none;
  background: var(--surf);
}
.sidebar::-webkit-scrollbar { display: none; }
.sb-nav { flex: 1; padding: var(--sp-3) var(--sp-2); overflow-y: auto; }
.content-area { flex: 1; min-width: 0; }

.snav-section {
  font-family: var(--font-mono); font-size: 9px; font-weight: var(--font-semibold);
  color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.14em; padding: var(--sp-4) var(--sp-3) var(--sp-1);
}
.snav-item {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 7px var(--sp-3); margin-bottom: 2px;
  font-size: var(--text-sm); color: var(--text2);
  cursor: pointer; border-radius: var(--radius);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.snav-item:hover { background: var(--surf2); color: var(--text); }
.snav-item.active { background: var(--green); color: #ffffff; font-weight: var(--font-medium); }
:root:not(.light) .snav-item.active { background: var(--gdim); color: var(--green); }

.snav-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.snav-icon svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke var(--t-fast);
}

.ni-badge {
  margin-left: auto; font-family: var(--font-mono);
  font-size: 9px; font-weight: var(--font-semibold);
  padding: 2px 6px; border-radius: var(--radius-full); flex-shrink: 0;
}
.ni-badge.red   { background: var(--color-danger-bg);  color: var(--color-danger); }
.ni-badge.green { background: var(--green-light);       color: var(--green); }
.ni-badge.amber { background: var(--color-warning-bg);  color: var(--color-warning); }

/* ===== CENTRO NOTIFICHE ===== */
.notif-wrap { position: relative; }
.notif-bell {
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--text2); display: flex; align-items: center; position: relative;
  border-radius: var(--radius); transition: color var(--t-fast), background var(--t-fast);
}
.notif-bell:hover { color: var(--text); background: var(--surf2); }
.notif-bell svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: var(--radius-full);
  background: var(--color-danger); color: #fff;
  font-family: var(--font-mono); font-size: 9px; font-weight: var(--font-semibold);
  display: flex; align-items: center; justify-content: center; line-height: 1;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-overlay);
  width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
  font-size: var(--text-sm); font-weight: var(--font-semibold);
  position: sticky; top: 0; background: var(--bg2);
}
.notif-mark-all {
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--green); font-size: var(--text-xs); font-family: inherit;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-panel-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background var(--t-fast);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surf2); }
.notif-item.unread { background: var(--green-light); }
.notif-item-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: var(--text-sm); color: var(--text); line-height: 1.4; }
.notif-item-time { font-size: var(--text-xs); color: var(--text2); margin-top: 2px; }
.notif-empty { padding: var(--sp-5); text-align: center; color: var(--text2); font-size: var(--text-sm); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 2px; padding: 0 var(--sp-5); border-bottom: 1px solid var(--border); }
.tab {
  padding: 10px 14px; font-size: var(--text-sm); cursor: pointer;
  border: none; background: transparent; color: var(--text2);
  font-family: inherit; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn var(--t-normal) both; }
.sub-tab-content { display: none; }
.sub-tab-content.active { display: block; }

/* ===== ANIMAZIONI ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MOBILE LAYOUT — bottom nav ===== */
.mobile-bottomnav { display: none; }
@media (max-width: 640px) {
  .client-layout { flex-direction: column; }
  .sidebar { display: none; }
  .content-area { padding-bottom: 88px; }

  .mobile-bottomnav {
    display: flex; justify-content: space-around; align-items: center;
    position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
    width: calc(100% - 32px); max-width: 420px;
    padding: 8px 6px;
    background: rgba(20,20,22,0.28);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-full);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: var(--z-overlay);
  }
  :root.light .mobile-bottomnav {
    background: rgba(255,255,255,0.35);
    border-color: rgba(0,0,0,0.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }

  .mbn-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    flex: 1; padding: 4px 0; border-radius: var(--radius);
    color: var(--text3); cursor: pointer;
    font-family: var(--font-mono); font-size: 9px;
    transition: color var(--t-fast);
  }
  .mbn-item svg {
    width: 20px; height: 20px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  }
  .mbn-item.active { color: var(--green); }

  .notif-panel { position: fixed; top: 64px; left: 16px; right: 16px; width: auto; }
}

/* ===== ACCOUNT MENU (Profilo, mobile) ===== */
.account-menu {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border); border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
}
.account-menu-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 14px var(--sp-4); background: var(--surf);
  font-size: var(--text-sm); color: var(--text); cursor: pointer;
  transition: background var(--t-fast);
}
.account-menu-item:hover { background: var(--surf2); }
.account-menu-item .snav-icon { color: var(--text2); width: 18px; height: 18px; }
.account-menu-item .snav-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-menu-item .mai-chev { margin-left: auto; color: var(--text3); flex-shrink: 0; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px var(--sp-4); border-radius: var(--radius);
  font-size: var(--text-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent;
  color: var(--text2); font-family: inherit; line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surf3); color: var(--text); border-color: var(--border-strong); }
.btn:active { transform: translateY(0) !important; box-shadow: none !important; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.btn-primary { background: var(--green); color: #ffffff; border-color: var(--green); font-weight: var(--font-medium); }
.btn-primary:hover {
  background: var(--green-dark); border-color: var(--green-dark); color: #ffffff;
  transform: translateY(-1px); box-shadow: var(--shadow-sm);
}
.btn-primary:focus-visible { box-shadow: var(--shadow-focus); }
.btn-sm { padding: 5px var(--sp-3); font-size: var(--text-xs); }
.btn-danger { color: var(--color-danger); border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-bg); color: var(--color-danger); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ===== FORM ===== */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block; font-size: var(--text-xs); font-weight: var(--font-medium);
  color: var(--text2); margin-bottom: var(--sp-1); letter-spacing: 0.02em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 9px var(--sp-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-size: var(--text-sm); font-family: inherit;
  background: var(--surf); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text3); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green);
  background: var(--surf); box-shadow: var(--shadow-focus);
}
.field textarea { resize: vertical; min-height: 80px; line-height: var(--line-relaxed); }
.error-msg   { font-size: var(--text-sm); color: var(--color-danger); margin-top: var(--sp-2); display: none; }
.success-msg { font-size: var(--text-sm); color: var(--green); margin-top: var(--sp-2); display: none; }

.select-sm {
  font-size: var(--text-sm); padding: 4px var(--sp-2); border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surf); color: var(--text);
  font-family: inherit; cursor: pointer; transition: border-color var(--t-fast);
}
.select-sm:focus { outline: none; border-color: var(--green); box-shadow: var(--shadow-focus); }

/* ===== LOGIN — SPLIT LAYOUT ===== */
/* Layout a due colonne: brand a sinistra, form a destra */
.login-split {
  display: flex;
  min-height: 100vh;
}

/* Pannello sinistro — brand, sempre scuro */
.login-brand {
  flex: 1;
  background: #0f1710;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8);
  position: relative;
  overflow: hidden;
}
/* Cerchio decorativo in basso a destra */
.login-brand::after {
  content: '';
  position: absolute;
  bottom: -120px; right: -120px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13,158,110,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.login-brand-inner {
  max-width: 400px;
  width: 100%;
  position: relative; z-index: 1;
}
.login-brand-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: var(--sp-8);
}
.login-brand-name {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  letter-spacing: -0.03em;
  color: #ffffff;
}
.login-brand-name span { color: #00C896; }

.login-brand-headline {
  font-size: 32px;
  font-weight: var(--font-semibold);
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-4);
}
.login-brand-sub {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  line-height: var(--line-relaxed);
  margin-bottom: var(--sp-8);
}
.login-brand-features {
  list-style: none;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.login-brand-features li {
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.75);
}
.login-brand-features li svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: #00C896;
}

/* Pannello destro — form */
.login-form-panel {
  width: 480px;
  flex-shrink: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-8) var(--sp-6);
}
.login-form-inner {
  width: 100%;
  max-width: 360px;
}
.login-form-header {
  margin-bottom: var(--sp-6);
}
.login-form-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-1);
}
.login-form-sub {
  font-size: var(--text-sm);
  color: var(--text3);
  line-height: var(--line-relaxed);
}
.login-submit {
  width: 100%;
  padding: 11px var(--sp-4);
  font-size: var(--text-base);
  margin-bottom: var(--sp-3);
  justify-content: center;
}
.login-forgot {
  text-align: center;
  margin-bottom: var(--sp-4);
}
.login-forgot a {
  font-size: var(--text-xs);
  color: var(--text3);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--t-fast);
}
.login-forgot a:hover { color: var(--text2); }

/* Divider "oppure" */
.login-divider {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: var(--sp-4) 0;
  color: var(--text3);
  font-size: var(--text-xs);
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.login-demo-btn {
  width: 100%;
  justify-content: center;
  color: var(--text);
  border-color: var(--border-strong);
  margin-bottom: var(--sp-2);
}
.login-demo-sub {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text3);
  margin-bottom: var(--sp-4);
}
.login-footer {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text3);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.login-footer a {
  color: var(--green);
  text-decoration: none;
  font-weight: var(--font-medium);
}
.login-footer a:hover { text-decoration: underline; }
.login-footer-secondary {
  font-size: var(--text-xs);
  color: var(--text3);
}
.login-footer-secondary a {
  color: var(--text2);
  font-weight: var(--font-medium);
}

/* Criteri password nel form recovery */
.pwd-criteria {
  margin-top: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pwd-crit-item {
  font-size: var(--text-xs);
  color: var(--text3);
  transition: color var(--t-fast);
}
.pwd-crit-item.crit-ok {
  color: var(--green);
}
.pwd-crit-tip {
  color: var(--text3);
  font-style: italic;
  margin-top: 2px;
}

/* Mobile: singola colonna */
@media (max-width: 768px) {
  .login-split { flex-direction: column; }
  .login-brand {
    padding: var(--sp-6);
    min-height: auto;
  }
  .login-brand-headline { font-size: 24px; }
  .login-brand-features { display: none; }
  .login-form-panel {
    width: 100%;
    padding: var(--sp-6) var(--sp-4);
  }
}

/* ===== KPI GRID ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--sp-3); padding: var(--sp-5) var(--sp-6); }
@media (max-width: 600px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }

.kpi-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.kpi-grid-val { font-family: var(--font-mono); font-size: 22px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
@media (max-width: 700px) {
  .kpi-grid-3 .kpi, .kpi-grid-4 .kpi { padding: var(--sp-3); min-height: 64px !important; }
  .kpi-grid-val { font-size: 15px; }
  .kpi-grid-4 { grid-template-columns: repeat(2,1fr); }
}

/* ===== CAPITALE — hero card (Portafoglio) ===== */
.cap-hero {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; background: var(--surf); box-shadow: var(--shadow-xs); margin-bottom: 20px;
}
.cap-hero-label { font-size: 11px; font-weight: 500; color: var(--text2); margin-bottom: 8px; }
.cap-hero-value { font-family: var(--font-mono); font-size: 32px; font-weight: 500; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
.cap-hero-sub { margin-top: 10px; font-size: 12px; color: var(--text2); }
.cap-hero-sub b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 700px) { .dash-cols { grid-template-columns: 1fr; } }

/* ===== DASHBOARD HERO + KPI GRID + SEGMENTED (mobile) ===== */
.dash-hero { display: none; }
.dash-kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 24px; }
.dash-segmented { display: none; }

@media (max-width: 700px) {
  .dash-hero {
    display: block; border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 18px; background: var(--surf); box-shadow: var(--shadow-xs); margin-bottom: 16px;
  }
  .dash-hero-label { font-size: 11px; font-weight: 500; color: var(--text2); margin-bottom: 8px; }
  .dash-hero-value { font-family: var(--font-mono); font-size: 32px; font-weight: 500; color: var(--text); letter-spacing: -0.02em; line-height: 1; }
  .dash-hero-pill { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-full); }

  /* Hero card già riassume valore/performance: 4 KPI ridondanti su mobile */
  .dash-kpi-grid { display: none; }

  .dash-segmented {
    display: flex; gap: 4px; margin-bottom: 16px;
    background: var(--surf2); border: 1px solid var(--border); border-radius: var(--radius-full); padding: 4px;
  }
  .dash-segmented button {
    flex: 1; border: none; background: transparent; color: var(--text2);
    font-family: inherit; font-size: 12px; font-weight: 500; padding: 8px 0;
    border-radius: var(--radius-full); cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
  }
  .dash-segmented button.active { background: var(--green); color: #06120d; }

  #tc-profilo .dash-cols.show-alloc > div:first-child { display: none; }
  #tc-profilo .dash-cols:not(.show-alloc) > div:last-child { display: none; }

  /* Guida & Colloquio: segmented control mostra una colonna alla volta */
  #tc-supporto .dash-cols.show-colloquio > div:first-child { display: none; }
  #tc-supporto .dash-cols:not(.show-colloquio) > div:last-child { display: none; }

  /* Allocazione: grafico sopra, legenda sotto; secondo donut (per ticker) nascosto */
  .dash-pie-row { flex-direction: column !important; align-items: center !important; gap: 8px !important; }
  .dash-pie-row .dash-pie-canvas { width: 220px !important; height: 220px !important; }
  .dash-pie-row .dash-pie-legend { width: 100%; padding-top: 4px !important; }
  .dash-pie-tk-canvas { display: none !important; }

  /* Profilo di rischio: spostato nella pagina "Profilo" — non ripetuto in dashboard */
  .dash-profile-card { display: none; }
}

/* ===== MERCATI + NEWS responsive (mobile) ===== */
.mkt-grid { display: grid; grid-template-columns: repeat(var(--mkt-cols, 4), 1fr); gap: 10px; }
@media (max-width: 700px) {
  .mkt-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .mkt-2col { grid-template-columns: 1fr !important; }
  .news-2col { grid-template-columns: 1fr !important; }
  .mkt-yield-row { flex-wrap: wrap; gap: var(--sp-4) !important; }
  .mkt-yield-row > div { flex: 1 1 40%; }
}

/* ===== PORTAFOGLIO — lista mobile asset class / ETF ===== */
.inv-mobile-list { display: none; }
.inv-card-ac {
  cursor: pointer; background: var(--surf2); border-radius: var(--radius);
  padding: var(--sp-3); margin-bottom: 6px;
}
.inv-card-etf {
  cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-3); margin: 6px 0 6px 17px;
  background: var(--surf);
}
@media (max-width: 700px) {
  .inv-table-desktop { display: none; }
  .inv-mobile-list { display: block; }
}

/* ===== ETF DETAIL — bottom sheet ===== */
.etf-sheet-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: var(--z-toast);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--t-normal);
}
.etf-sheet-overlay.show { opacity: 1; pointer-events: auto; }
.etf-sheet {
  background: var(--surf); border: 1px solid var(--border); border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%; max-width: 480px; padding: var(--sp-5);
  padding-bottom: max(var(--sp-6), env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform var(--t-normal) ease;
  max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.etf-sheet-overlay.show .etf-sheet { transform: translateY(0); }
.etf-sheet-handle { width: 36px; height: 4px; background: var(--border-strong); border-radius: var(--radius-full); margin: 0 auto var(--sp-4); }
.etf-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.etf-sheet-stat { background: var(--surf2); border-radius: var(--radius); padding: var(--sp-3); }
.etf-sheet-stat-label { font-size: 10px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.etf-sheet-stat-val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text); }

/* ===== PREZZI STORICI — modal override manuale (admin, ETF senza fonte Yahoo) ===== */
.psm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: var(--z-toast);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
  opacity: 0; pointer-events: none; transition: opacity var(--t-normal);
}
.psm-overlay.show { opacity: 1; pointer-events: auto; }
.psm-box {
  background: var(--surf); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); transform: translateY(8px); transition: transform var(--t-normal) ease;
}
.psm-overlay.show .psm-box { transform: translateY(0); }
.psm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5); border-bottom: 0.5px solid var(--border); flex-shrink: 0;
}
.psm-title { font-weight: var(--font-semibold); font-size: 14px; }
.psm-title span { font-family: var(--font-mono); color: var(--accent); }
.psm-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text2); line-height: 1; }
.psm-body { padding: var(--sp-5); overflow-y: auto; }
.psm-sec-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text3); margin-bottom: var(--sp-2); font-weight: 600;
}
.psm-grid-head, .psm-row {
  display: grid; grid-template-columns: 1fr 1fr 32px; gap: var(--sp-2); align-items: center;
}
.psm-grid-head { margin-bottom: var(--sp-1); }
.psm-grid-head span { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; }
.psm-row { margin-bottom: var(--sp-2); }
.psm-row input {
  width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surf2); color: var(--text); font-size: 13px; font-family: var(--font-mono);
}
.psm-row input:focus { outline: none; border-color: var(--accent); }
.psm-row input.psm-invalid { border-color: var(--color-danger); }
.psm-row-del {
  background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px;
  padding: 0; line-height: 1;
}
.psm-row-del:hover { color: var(--color-danger); }
.psm-add {
  background: var(--surf2); border: 1px dashed var(--border-strong); color: var(--text2);
  border-radius: var(--radius); padding: 7px; width: 100%; cursor: pointer; font-size: 12px;
  margin-top: var(--sp-1);
}
.psm-add:hover { color: var(--text); border-color: var(--accent); }
.psm-paste {
  width: 100%; min-height: 76px; resize: vertical; padding: 9px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surf2); color: var(--text);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
.psm-paste:focus { outline: none; border-color: var(--accent); }
.psm-hint { font-size: 11px; color: var(--text3); margin-top: var(--sp-1); }
.psm-divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; }
.psm-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-top: 0.5px solid var(--border); flex-shrink: 0;
}
.psm-count { font-size: 12px; color: var(--text2); }
.psm-count b { color: var(--text); font-family: var(--font-mono); }
.psm-foot-btns { display: flex; gap: var(--sp-2); }

.kpi {
  background: var(--surf); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5); position: relative; overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-normal);
  box-shadow: var(--shadow-xs);
}
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi-label { font-size: var(--text-xs); color: var(--text3); margin-bottom: var(--sp-1); letter-spacing: 0.01em; }
.kpi-value {
  font-family: var(--font-mono); font-size: var(--text-3xl); font-weight: var(--font-semibold);
  color: var(--text); line-height: var(--line-tight); letter-spacing: -0.02em;
}
.kpi-sub { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-top: var(--sp-1); }

.pos { color: var(--green) !important; }
.neg { color: var(--color-danger) !important; }

/* ===== STAT CARDS ===== */
.stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-3); padding: var(--sp-5) var(--sp-6) 0; }
.stat {
  background: var(--surf); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5); position: relative; overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-normal);
  cursor: default; box-shadow: var(--shadow-xs);
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.stat::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--text3); }
.stat.s1::after { background: var(--green); }
.stat.s2::after { background: var(--color-info); }
.stat.s3::after { background: var(--color-warning); }
.stat.s4::after { background: var(--color-danger); }

.stat-val {
  font-family: var(--font-mono); font-size: var(--text-3xl); font-weight: var(--font-semibold);
  color: var(--text); margin-bottom: var(--sp-1);
  line-height: var(--line-tight); letter-spacing: -0.02em;
}
.stat-lab { font-size: var(--text-xs); color: var(--text3); letter-spacing: 0.01em; }

/* ===== SECTIONS ===== */
.section { padding: 0 var(--sp-6) var(--sp-6); }
.section-title {
  font-size: var(--text-xs); font-weight: var(--font-semibold);
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: var(--sp-3);
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th {
  text-align: left; padding: 8px var(--sp-3); border-bottom: 1px solid var(--border);
  color: var(--text3); font-weight: var(--font-medium);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
td { padding: 11px var(--sp-3); border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--surf2); }

/* ===== BADGE ===== */
.badge {
  display: inline-block; padding: 3px var(--sp-2); border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: var(--font-medium); line-height: 1.4;
}
.badge-az { background: var(--color-info-bg);    color: var(--color-info); }
.badge-ob { background: var(--green-light);       color: var(--green); }
.badge-co { background: var(--color-warning-bg);  color: var(--color-warning); }
.badge-al { background: var(--color-pink-bg);     color: var(--color-pink); }
.badge-li { background: var(--surf3); color: var(--text2); border: 1px solid var(--border); }
.badge-ma { background: var(--color-purple-bg);   color: var(--color-purple); }

.bar-wrap { background: var(--surf3); border-radius: var(--radius-full); height: 5px; width: 60px; display: inline-block; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--green); }
.progress-bar { height: 5px; border-radius: var(--radius-full); background: var(--surf3); overflow: hidden; }

/* ===== CONTACT CARDS ===== */
.contact-card {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surf); text-decoration: none; color: var(--text);
  margin-bottom: 10px; box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.contact-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.contact-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.contact-icon-info  { background: var(--avatar-icon-info-bg); }
.contact-icon-green { background: var(--avatar-icon-green-bg); }
.contact-name  { font-size: var(--text-sm); font-weight: var(--font-semibold); }
.contact-label { font-size: var(--text-xs); color: var(--text3); margin-top: 1px; }
.contact-row   { display: flex; gap: 10px; }

/* ===== GUIDE STEPS ===== */
.guide-step {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4); margin-bottom: var(--sp-3);
  background: var(--surf); box-shadow: var(--shadow-xs);
}
.guide-step-inner { display: flex; align-items: flex-start; gap: var(--sp-3); }
.guide-step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: var(--font-semibold); flex-shrink: 0;
}
.guide-step-title { font-size: var(--text-base); font-weight: var(--font-semibold); margin-bottom: 4px; }
.guide-step-body  { font-size: var(--text-sm); color: var(--text2); line-height: var(--line-relaxed); }

/* ===== DISCLAIMER ===== */
.disclaimer {
  margin-top: var(--sp-4); padding: 12px 14px;
  background: var(--disclaimer-bg); border-radius: var(--radius);
  font-size: var(--text-xs); color: var(--disclaimer-text);
  line-height: var(--line-relaxed); border-left: 3px solid var(--disclaimer-border);
}

/* ===== NEWS ===== */
.news-list { padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3); }
.news-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-5); background: var(--surf); cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-normal), border-color var(--t-normal), transform var(--t-normal);
}
.news-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.news-card.pinned { border-color: var(--green); }
.news-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.news-title { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--text); line-height: var(--line-tight); }
.news-date { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text3); white-space: nowrap; }
.news-body { font-size: var(--text-sm); color: var(--text2); line-height: var(--line-relaxed); }
.news-tag { display: inline-block; padding: 3px var(--sp-2); border-radius: var(--radius-full); font-size: var(--text-xs); margin-top: var(--sp-2); font-weight: var(--font-medium); }
.tag-analisi { background: var(--color-info-bg);    color: var(--color-info); }
.tag-mercato { background: var(--green-light);       color: var(--green-text); }
.tag-avviso  { background: var(--color-warning-bg);  color: var(--color-warning); }
.pin-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; margin-top: 4px; }

/* ===== EMPTY & LOADING ===== */
.empty-state { text-align: center; padding: var(--sp-10) var(--sp-6); color: var(--text3); font-size: var(--text-sm); line-height: var(--line-relaxed); }
.loading { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-10); color: var(--text3); font-size: var(--text-sm); }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong); border-top-color: var(--green);
  border-radius: 50%; animation: spin 0.65s linear infinite; flex-shrink: 0;
}

/* ===== ADMIN PANELS ===== */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6); }
@media (max-width: 600px) { .admin-grid { grid-template-columns: 1fr; } }

.panel {
  border-radius: var(--radius-lg); padding: var(--sp-5);
  background: var(--surf); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.panel-title {
  font-size: var(--text-xs); font-weight: var(--font-semibold);
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-4);
}

/* ===== MEETING SLOT LEGEND ===== */
.slot-legend { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.slot-legend-item { font-size: var(--text-xs); font-weight: var(--font-medium); padding: 3px var(--sp-2); border-radius: var(--radius-full); }
.slot-legend-disponibile { background: var(--green-light); color: var(--green-text); }
.slot-legend-prenotato   { background: var(--color-warning-bg); color: var(--color-warning); }

/* ===== CALENDARIO ===== */
.cal-day { border-radius: var(--radius); font-size: var(--text-sm); cursor: default; transition: background var(--t-fast); min-height: 56px; padding: var(--sp-1); overflow: hidden; }
.cal-day-num { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--font-medium); text-align: center; margin-bottom: 3px; }
.cal-day.has-event { cursor: pointer; }
.cal-day.has-event:hover { background: var(--surf2); }
.cal-day.is-today .cal-day-num { background: var(--green); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; margin: 0 auto 3px; }
.cal-day.is-selected { background: var(--green-light); }
.cal-chip { font-size: 9px; font-weight: var(--font-medium); padding: 1px var(--sp-1); border-radius: var(--radius-sm); margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.cal-chip-dispo     { background: var(--green-light);      color: var(--green-text); }
.cal-chip-prenotato { background: var(--color-warning-bg);  color: var(--color-warning); }
.cal-chip-meeting   { background: var(--color-info-bg);     color: var(--color-info); }
.cal-week-col { flex: 1; min-width: 0; }
.cal-week-header { text-align: center; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--font-semibold); padding: 4px 2px; border-radius: var(--radius) var(--radius) 0 0; background: var(--surf2); margin-bottom: var(--sp-1); }
.cal-week-header.is-today { background: var(--green); color: #fff; }
.cal-week-event { font-size: 10px; padding: 4px var(--sp-2); border-radius: 5px; margin-bottom: 3px; cursor: pointer; line-height: 1.4; transition: filter var(--t-fast); }
.cal-week-event:hover { filter: brightness(1.08); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .mt-2col { flex-direction: column; }
  .mt-2col #mt-cal-panel { width: 100% !important; position: static !important; }
}
@media (max-width: 600px) {
  .stats-row      { grid-template-columns: repeat(2,1fr) !important; }
  .grid-3col      { grid-template-columns: 1fr !important; }
  .grid-2col      { grid-template-columns: 1fr !important; }
  .admin-grid     { grid-template-columns: 1fr !important; }
  .pf-donut-panel { width: 100% !important; }
  .admin-grid, .section { padding-left: var(--sp-4) !important; padding-right: var(--sp-4) !important; }
  .stats-row { padding-left: var(--sp-4) !important; padding-right: var(--sp-4) !important; }
}

/* ===== AI ASSISTENTE ADMIN ===== */
.ai-tab-content { padding: 0 !important; }
.ai-layout {
  display: flex;
  height: calc(100vh - 57px);
  overflow: hidden;
}
.ai-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--surf);
}
.ai-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.ai-input-area {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-top: 0.5px solid var(--border);
  background: var(--surf);
  align-items: flex-start;
}
.ai-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  line-height: 1.5;
  min-height: 60px;
}
.ai-input:focus { outline: none; border-color: var(--green); }
.ai-bolla-wrap {
  display: flex;
  flex-direction: column;
}
.ai-bolla-user { align-items: flex-end; }
.ai-bolla-assistant { align-items: flex-start; }
.ai-bolla-error { align-items: flex-start; }
.ai-bolla {
  max-width: 75%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
}
.ai-skill-btn {
  width: 100%;
  text-align: left;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.ai-skill-btn:hover { border-color: var(--green); background: var(--green-light); }
.ai-conv-item {
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  border: 0.5px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-conv-item:hover { background: var(--bg2); }
.ai-conv-item-attiva { background: var(--green-light); border-color: var(--green); color: var(--green-text); }
.ai-tool-chips { margin-bottom: 6px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.ai-tool-chip {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color var(--t-fast);
  position: relative;
}
.ai-tool-chip:hover { color: var(--text2); }
.ai-tool-detail {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: var(--surf);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text2);
  white-space: pre-wrap;
  max-width: 400px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  margin-top: 4px;
}
.ai-tool-detail-open { display: block; }
@media (max-width: 700px) {
  .ai-layout { flex-direction: column; height: auto; }
  .ai-sidebar { width: 100%; border-right: none; border-bottom: 0.5px solid var(--border); max-height: 200px; }
  .ai-chat-messages { min-height: 300px; }
}
