@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root{
  --bg:#F4F5F7;
  --surface:#FFFFFF;
  --surface-2:#FAFAFB;
  --border:#E3E5EA;
  --text:#1B1E27;
  --text-mid:#5B6072;
  --text-dim:#9297A6;

  --brand:#3457D5;
  --brand-dim:#EBEFFC;
  --brand-hover:#2A46B0;

  --green:#1E9E6B;
  --green-dim:#E4F6EE;
  --amber:#B5790A;
  --amber-dim:#FBF0DD;
  --red:#C4362E;
  --red-dim:#FBEAE9;

  --radius:10px;
  --shadow-sm:0 1px 2px rgba(20,22,30,.05);
  --shadow-md:0 4px 16px rgba(20,22,30,.08);

  --sidebar-bg:#111A33;
  --sidebar-bg-2:#182352;
  --sidebar-border:rgba(255,255,255,.08);
  --sidebar-text:#AEB6D1;
  --sidebar-text-dim:#7680A3;
  --sidebar-active-bg:#3457D5;
  --sidebar-active-text:#FFFFFF;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', -apple-system, sans-serif;
  font-size:14px;
  line-height:1.5;
}
.mono{ font-family:'JetBrains Mono', monospace; }
a{ color:var(--brand); text-decoration:none; }

/* ============ AUTH ============ */
.auth-body{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(160deg, #F4F5F7 0%, #E9ECF5 100%);
  padding:24px;
}
.auth-card{
  width:100%; max-width:380px; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-md); padding:36px 32px;
}
.auth-brand{ font-size:22px; font-weight:700; letter-spacing:-.02em; margin-bottom:6px; }
.auth-brand span{ color:var(--brand); }
.auth-sub{ color:var(--text-mid); font-size:13.5px; margin:0 0 24px 0; }
.auth-form{ display:flex; flex-direction:column; gap:16px; }

/* ============ FORM ELEMENTS ============ */
.field{ display:flex; flex-direction:column; gap:6px; }
.field label{ font-size:12.5px; font-weight:600; color:var(--text-mid); }
.field input, .field select, .field textarea{
  border:1px solid var(--border); border-radius:8px; padding:10px 12px;
  font-family:inherit; font-size:14px; color:var(--text); background:var(--surface);
  transition:border-color .15s, box-shadow .15s;
}
.field textarea{ resize:vertical; line-height:1.6; }
.field input:focus, .field select:focus, .field textarea:focus{
  outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-dim);
}
.field-hint{ font-size:12px; color:var(--text-dim); }
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px 18px; }
.form-grid .field.span-2{ grid-column:1 / -1; }
.form-row-3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px 18px; grid-column:1 / -1; }
.form-row-inline{ display:flex; align-items:flex-end; gap:14px; }
.form-row-inline .field{ flex:1; }
.form-row-inline .field.narrow{ flex:0 0 auto; min-width:220px; }

.domanda-textarea{
  border:1px solid var(--border); background:var(--surface); border-radius:8px; padding:10px 12px;
  font-family:inherit; font-size:14px; color:var(--text); resize:vertical; width:100%; line-height:1.5;
  transition:border-color .15s, box-shadow .15s;
}
.domanda-textarea:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-dim); }

.ghost-input{
  border:1px solid transparent; background:transparent; border-radius:6px; padding:6px 8px;
  font-family:inherit; font-size:14px; color:var(--text); resize:none; width:100%; line-height:1.5;
  transition:border-color .15s, background .15s;
}
.ghost-input:hover{ background:var(--surface); }
.ghost-input:focus{ outline:none; border-color:var(--brand); background:var(--surface); box-shadow:0 0 0 3px var(--brand-dim); }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; flex-shrink:0;
  border:1px solid var(--border); border-radius:7px; background:var(--surface); color:var(--text-dim);
  cursor:pointer; font-size:14px; transition:color .15s, border-color .15s, background .15s;
}
.icon-btn:hover{ color:var(--text); border-color:var(--text-dim); }
.icon-btn.icon-btn-danger:hover{ color:var(--red); border-color:var(--red); background:var(--red-dim); }

/* ============ TABELLE (liste con colonne) ============ */
.table-head{
  display:grid; align-items:center; gap:14px; padding:0 16px 10px 16px;
  font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim);
  border-bottom:1px solid var(--border); margin-bottom:4px;
}
.table-row{
  display:grid; align-items:center; gap:14px; padding:14px 16px;
  border-bottom:1px solid var(--border);
}
.table-row:last-child{ border-bottom:none; }
.table-row:hover{ background:var(--surface-2); }
.table-cell-meta{ font-size:12px; color:var(--text-dim); }
.table-actions{ display:flex; align-items:center; gap:8px; justify-content:flex-end; }
.table-scenari{ grid-template-columns:2fr 1.4fr 170px; }
.table-joboffer{ grid-template-columns:1.6fr 1.4fr 1.6fr 190px; }
.link-share-row{ display:flex; align-items:center; gap:8px; }
.link-input{
  flex:1; min-width:0; font-size:12px; padding:7px 10px; border:1px solid var(--border);
  border-radius:7px; background:var(--surface); color:var(--text);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* ============ BUTTONS ============ */
.btn{
  font-family:inherit; font-weight:600; font-size:13.5px;
  border:none; border-radius:8px; padding:10px 18px; cursor:pointer;
  display:inline-flex; align-items:center; gap:8px;
  transition:opacity .15s, transform .15s, background .15s;
}
.btn:active{ transform:scale(.97); }
.btn-primary{ background:var(--brand); color:#fff; }
.btn-primary:hover{ background:var(--brand-hover); }
.btn-ghost{ background:transparent; border:1px solid var(--border); color:var(--text-mid); }
.btn-ghost:hover{ border-color:var(--text-dim); color:var(--text); }
.btn-danger{ background:var(--red-dim); color:var(--red); }
.btn-danger:hover{ opacity:.85; }
.btn-block{ width:100%; justify-content:center; }
.btn-sm{ padding:6px 12px; font-size:12.5px; }
.btn-dropdown::after{ content:'▾'; font-size:10px; margin-left:2px; }

/* ============ ALERTS ============ */
.alert{ border-radius:8px; padding:11px 14px; font-size:13px; margin-bottom:16px; }
.alert-error{ background:var(--red-dim); color:var(--red); }
.alert-success{ background:var(--green-dim); color:var(--green); }
.alert-warning{ background:var(--amber-dim); color:var(--amber); line-height:1.55; }

/* ============ APP SHELL ============ */
#app{ display:flex; min-height:100vh; }

.sidebar{
  width:236px; flex-shrink:0; background:var(--sidebar-bg);
  border-right:1px solid var(--sidebar-border); display:flex; flex-direction:column; padding:22px 0;
  position:sticky; top:0; align-self:flex-start; height:100vh; overflow-y:auto;
}
.brand{ padding:0 22px 20px 22px; border-bottom:1px solid var(--sidebar-border); margin-bottom:14px; font-size:18px; font-weight:700; letter-spacing:-.02em; color:#fff; }
.brand span{ color:#8DA2FF; }
.nav{ display:flex; flex-direction:column; gap:2px; padding:0 10px; }
.nav-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px;
  color:var(--sidebar-text); font-size:13.5px; font-weight:500; cursor:pointer;
}
.nav-item:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-item.active{ background:var(--sidebar-active-bg); color:var(--sidebar-active-text); font-weight:600; }
.nav-icon{ width:16px; height:16px; flex-shrink:0; display:inline-flex; }
.nav-icon svg{ width:100%; height:100%; }

/* nascosti su desktop, attivati dal media query mobile */
.mobile-navbar, .mobile-nav-overlay, .mobile-nav-drawer{ display:none; }
.sidebar-footer{
  margin-top:auto; padding:16px 22px; border-top:1px solid var(--sidebar-border);
  display:flex; flex-direction:column; gap:10px; font-size:12.5px; color:var(--sidebar-text-dim);
}
.sidebar-footer a{ color:var(--sidebar-text); }
.sidebar-footer a:hover{ color:#fff; }
.sidebar-credit{ font-size:11px; color:var(--sidebar-text-dim); }
.sidebar-credit a{ color:var(--sidebar-text); font-weight:600; text-decoration:none; }
.sidebar-credit a:hover{ color:#fff; text-decoration:underline; }

.main{ flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar{
  padding:26px 36px; border-bottom:1px solid var(--border); background:var(--surface);
}
.topbar h1{ font-size:20px; font-weight:700; letter-spacing:-.01em; margin:0 0 4px 0; }
.topbar p{ margin:0; color:var(--text-mid); font-size:13.5px; }
.topbar-flex{ display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap; }
.topbar-actions{ display:flex; gap:10px; flex-shrink:0; flex-wrap:wrap; }
.content{ padding:30px 36px; flex:1; }

/* ============ CARD ============ */
.card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow-sm); padding:24px;
}
.card + .card{ margin-top:18px; }
.card-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.card-header h2{ font-size:15.5px; font-weight:700; margin:0; }
.card-header p{ margin:2px 0 0 0; color:var(--text-mid); font-size:12.5px; }

/* ============ LIST / TABLE ============ */
.item-list{ display:flex; flex-direction:column; gap:10px; }
.item-row{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  border:1px solid var(--border); border-radius:8px; padding:14px 16px; background:var(--surface-2);
}
.item-row-main{ min-width:0; }
.item-title{ font-weight:600; font-size:14px; margin-bottom:3px; }
.item-meta{ font-size:12px; color:var(--text-dim); }
.item-actions{ display:flex; gap:8px; flex-shrink:0; }

.badge{
  display:inline-flex; align-items:center; font-size:11px; font-weight:600;
  padding:3px 9px; border-radius:12px; letter-spacing:.02em; text-transform:uppercase;
}
.badge-amber{ background:var(--amber); color:#fff; }
.badge-green{ background:var(--green); color:#fff; }
.badge-red{ background:var(--red); color:#fff; }
.badge-brand{ background:var(--brand); color:#fff; }
.badge-dim{ background:var(--surface); color:var(--text-dim); border:1px solid var(--border); }

/* ============ TABS (filtri candidature) ============ */
.tab-pills{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:18px; }
.tab-pill{
  font-family:inherit; font-weight:600; font-size:12.5px; cursor:pointer;
  border:none; background:var(--text-mid); color:#fff; opacity:.5;
  border-radius:999px; padding:7px 14px; transition:opacity .15s, box-shadow .15s;
}
.tab-pill:hover{ opacity:.8; }
.tab-pill.active{ opacity:1; box-shadow:0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.tab-pill[data-filter="tutti"]{ background:var(--sidebar-bg); }
.tab-pill[data-filter="eccellente"]{ background:var(--green); }
.tab-pill[data-filter="in_target"]{ background:var(--brand); }
.tab-pill[data-filter="parziale"]{ background:var(--amber); }
.tab-pill[data-filter="fuori_target"]{ background:var(--red); }

/* ============ CANDIDATURE ============ */
.candidate-card{ padding:0; overflow:hidden; }
.candidate-summary{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:16px 20px; cursor:pointer;
}
.candidate-summary:hover{ background:var(--surface-2); }
.candidate-name-row{ display:flex; align-items:center; gap:12px; }
.avatar{
  width:36px; height:36px; border-radius:50%; flex-shrink:0; color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px;
}
.candidate-name{ font-weight:700; font-size:14.5px; }
.candidate-meta{ font-size:12px; color:var(--text-dim); margin-top:3px; }
.candidate-summary-right{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.candidate-expand-icon{ color:var(--text-dim); font-size:12px; transition:transform .15s; }
.candidate-card.open .candidate-expand-icon{ transform:rotate(180deg); }
.candidate-body{ display:none; padding:0 20px 20px 20px; border-top:1px solid var(--border); }
.candidate-card.open .candidate-body{ display:block; padding-top:18px; }

.candidate-tabs{ display:flex; gap:4px; margin-bottom:18px; border-bottom:1px solid var(--border); }
.candidate-tab-btn{
  font-family:inherit; font-weight:600; font-size:13px; cursor:pointer;
  border:none; background:transparent; color:var(--text-dim); padding:9px 4px; margin-right:18px;
  border-bottom:2px solid transparent; transition:color .15s, border-color .15s;
}
.candidate-tab-btn:hover{ color:var(--text); }
.candidate-tab-btn.active{ color:var(--brand); border-color:var(--brand); }
.candidate-tab-panel{ display:none; }
.candidate-tab-panel.active{ display:block; }

.score-row{ display:flex; align-items:center; gap:14px; }
.score-number{ font-family:'JetBrains Mono',monospace; font-size:20px; font-weight:700; color:var(--text); flex-shrink:0; }
.score-track{ flex:1; height:8px; border-radius:4px; background:var(--border); overflow:hidden; }
.score-fill{ height:100%; border-radius:4px; }

.report-section{ margin-bottom:16px; }
.report-section h3{ font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); margin:0 0 8px 0; }
.report-section p{ margin:0; font-size:13.5px; line-height:1.6; color:var(--text); }
.report-vettori{ display:flex; flex-direction:column; gap:8px; }
.report-vettore{ font-size:13px; line-height:1.55; }
.report-vettore b{ color:var(--text); }
.report-columns{ display:flex; flex-wrap:wrap; gap:16px; }
.report-columns > .report-box{ flex:1; min-width:240px; }

.report-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:16px; margin-bottom:16px; }
.report-box{
  border:1px solid var(--border); border-radius:10px; padding:16px 18px; background:var(--surface-2);
}
.report-box h3{ font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); margin:0 0 10px 0; }
.report-box p{ margin:0; font-size:13.5px; line-height:1.6; color:var(--text); }
.report-box ul{ margin:0; padding-left:18px; display:flex; flex-direction:column; gap:7px; font-size:13px; line-height:1.5; color:var(--text); }

.empty-state{
  text-align:center; padding:40px 20px; color:var(--text-dim); font-size:13.5px;
}
.empty-state::before{
  content:''; display:block; width:52px; height:52px; margin:0 auto 14px auto; opacity:.5;
  background:no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239297A6' stroke-width='1.5'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Ccircle cx='11' cy='15' r='3'/%3E%3Cpath d='m15.5 17.5 2 2'/%3E%3C/svg%3E");
}


.cta-box{
  text-align:center; padding:48px 24px; border:1px dashed var(--border); border-radius:var(--radius);
  background:var(--surface-2);
}
.cta-box > p:first-child::before{
  content:''; display:block; width:52px; height:52px; margin:0 auto 14px auto; opacity:.5;
  background:no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239297A6' stroke-width='1.5'%3E%3Cpath d='M7 3h7l4 4v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Z'/%3E%3Cpath d='M14 3v4h4'/%3E%3Ccircle cx='11' cy='15' r='3'/%3E%3Cpath d='m15.5 17.5 2 2'/%3E%3C/svg%3E");
}
.cta-box p{ color:var(--text-mid); font-size:13.5px; margin:6px 0 20px 0; max-width:420px; margin-left:auto; margin-right:auto; }

/* ============ WIZARD ============ */
.wizard-body{ min-height:100vh; display:flex; flex-direction:column; background:var(--bg); }
.wizard-topbar{ display:flex; align-items:center; gap:14px; padding:22px 40px 0 40px; }
.wizard-prog-track{ flex:1; display:flex; gap:5px; }
.wizard-prog-seg{ flex:1; height:3px; border-radius:2px; background:var(--border); transition:background .3s ease; }
.wizard-prog-seg.done{ background:var(--brand); }
.wizard-prog-seg.current{ background:var(--brand); opacity:.4; }
.wizard-prog-counter{ font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--text-dim); flex-shrink:0; }

.wizard-screen{ display:none; flex-direction:column; flex:1; }
.wizard-screen.visible{ display:flex; }

.wizard-center{ flex:1; display:flex; align-items:center; justify-content:center; padding:32px 40px; }
.wizard-card{ max-width:560px; width:100%; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-md); padding:36px; }
.wizard-eyebrow{ font-family:'JetBrains Mono',monospace; font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--brand); margin-bottom:14px; }
.wizard-card h1{ font-size:26px; font-weight:700; letter-spacing:-.02em; margin-bottom:10px; line-height:1.25; }
.wizard-card .wizard-sub{ font-size:13.5px; color:var(--text-mid); line-height:1.6; margin-bottom:24px; }

.wizard-q-body{ flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:20px 40px; text-align:center; }
.wizard-q-note{ font-family:'JetBrains Mono',monospace; font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--brand); margin-bottom:16px; }
.wizard-q-text{ font-size:22px; font-weight:700; line-height:1.4; letter-spacing:-.01em; max-width:600px; margin-bottom:10px; }
.wizard-q-hint{ font-size:13px; color:var(--text-dim); max-width:460px; line-height:1.6; }

.wizard-answer-zone{ padding:20px 40px 44px 40px; display:flex; flex-direction:column; align-items:center; }
.mode-toggle{ display:flex; gap:8px; margin-bottom:22px; }
.mode-btn{
  font-size:12.5px; font-weight:600; padding:7px 16px; border-radius:20px; cursor:pointer;
  border:1px solid var(--border); background:var(--surface); color:var(--text-mid); transition:all .15s ease;
}
.mode-btn.active{ background:var(--brand-dim); border-color:var(--brand); color:var(--brand); }

.wizard-text-mode{ width:100%; max-width:560px; display:none; flex-direction:column; gap:12px; }
.wizard-text-mode.visible{ display:flex; }
.wizard-textarea{
  width:100%; border:1px solid var(--border); background:var(--surface); border-radius:10px;
  padding:14px 16px; font-family:inherit; font-size:14px; color:var(--text); resize:none; min-height:110px; line-height:1.65;
}
.wizard-textarea:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-dim); }

.wizard-voice-mode{ display:none; flex-direction:column; align-items:center; gap:14px; }
.wizard-voice-mode.visible{ display:flex; }
.waveform{ display:flex; align-items:center; gap:3px; height:28px; }
.waveform span{ width:2.5px; border-radius:2px; background:var(--border); height:5px; transition:height .12s ease, background .2s ease; }
.waveform.active span{ background:var(--red); animation:wav 1.2s ease-in-out infinite; }
.waveform.active span:nth-child(2n){ animation-delay:.18s; }
.waveform.active span:nth-child(3n){ animation-delay:.36s; }
.waveform.active span:nth-child(5n){ animation-delay:.08s; }
@keyframes wav{ 0%,100%{height:5px} 50%{height:24px} }
.waveform.done span{ background:var(--green); height:5px!important; animation:none!important; }

.rec-btn-wrap{ position:relative; display:flex; align-items:center; justify-content:center; }
.rec-ring{ position:absolute; width:80px; height:80px; border-radius:50%; border:1px solid var(--red); opacity:0; transform:scale(.9); }
.rec-btn{
  width:60px; height:60px; border-radius:50%; border:1px solid var(--border); background:var(--surface-2);
  display:flex; align-items:center; justify-content:center; cursor:pointer; position:relative; z-index:1; transition:border-color .2s;
}
.rec-btn:hover{ border-color:var(--text-dim); }
.rec-dot{ width:18px; height:18px; border-radius:50%; background:var(--red); transition:border-radius .2s,width .2s,height .2s; }
.rec-btn.recording{ border-color:var(--red); animation:pulse 1.5s ease-out infinite; }
.rec-btn.recording .rec-dot{ border-radius:5px; width:16px; height:16px; }
.rec-btn.recording ~ .rec-ring{ opacity:.4; transform:scale(1.15); animation:rpulse 1.5s ease-out infinite; }
@keyframes pulse{ 0%{box-shadow:0 0 0 0 rgba(196,54,46,.4)} 70%{box-shadow:0 0 0 14px rgba(196,54,46,0)} 100%{box-shadow:0 0 0 0 rgba(196,54,46,0)} }
@keyframes rpulse{ 0%{transform:scale(1.1);opacity:.4} 70%{transform:scale(1.5);opacity:0} 100%{transform:scale(1.1);opacity:.4} }
.rec-btn.done-state{ border-color:var(--green); cursor:default; background:var(--green-dim); }
.rec-btn.done-state .rec-dot{ background:var(--green); border-radius:50%; width:16px; height:16px; }
.rec-timer{ font-family:'JetBrains Mono',monospace; font-size:12px; color:var(--text-dim); }
.rec-hint{ font-size:13px; color:var(--text-dim); }
.rec-error{ font-size:12.5px; color:var(--red); max-width:320px; }
.rec-audio-preview{ width:260px; }

.wizard-nav-row{ display:flex; gap:10px; align-items:center; margin-top:20px; }

.wizard-review-list{ display:flex; flex-direction:column; gap:12px; margin-bottom:26px; }
.wizard-review-item{ border:1px solid var(--border); border-radius:10px; padding:15px 17px; background:var(--surface-2); }
.wizard-review-q{ font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--brand); margin-bottom:7px; }
.wizard-review-a{ font-size:13.5px; color:var(--text-mid); line-height:1.6; }
.wizard-edit-link{ font-size:12px; color:var(--text-dim); cursor:pointer; text-decoration:underline; text-underline-offset:3px; margin-top:6px; display:inline-block; }
.wizard-edit-link:hover{ color:var(--text); }

/* ============ CALIBRAZIONE TRATTI ============ */
.trait-list{ display:flex; flex-direction:column; gap:12px; margin-bottom:22px; }
.trait-item{ border:1px solid var(--border); border-radius:10px; padding:16px 18px; background:var(--surface-2); }
.trait-item-head{ display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.trait-item-head input[type="text"]{ flex:1; }
.trait-labels{ display:flex; justify-content:space-between; font-size:11px; color:var(--text-dim); margin-bottom:6px; font-family:'JetBrains Mono',monospace; }
.trait-range{ width:100%; accent-color:var(--brand); }
.trait-readout{ text-align:right; font-size:12px; color:var(--brand); font-weight:600; margin-top:4px; }
.remove-trait{ background:transparent; border:none; color:var(--text-dim); cursor:pointer; font-size:18px; line-height:1; padding:4px 8px; }

/* Modifica manuale delle caratteristiche di fitting (scenario-detail.php): il
   form nasce in sola lettura e mostra .car-ro; il clic su "Modifica le
   caratteristiche" gli aggiunge .editing e scambia .car-ro con .car-rw. */
#form-caratteristiche .car-rw{ display:none; }
#form-caratteristiche.editing .car-rw{ display:block; }
#form-caratteristiche.editing .car-ro{ display:none; }
.car-field-label{
  font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.06em;
  text-transform:uppercase; color:var(--text-dim); margin-bottom:5px;
}

.remove-trait:hover{ color:var(--red); }

/* ============ SPINNER ============ */
.spinner{ width:44px; height:44px; border:3px solid var(--border); border-top-color:var(--brand); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ============ WIZARD EXIT LINK ============ */
.wizard-exit-link{
  position:fixed; top:20px; right:28px; z-index:50;
  font-size:13px; font-weight:600; color:var(--text-dim); text-decoration:none;
  padding:7px 12px; border-radius:8px; border:1px solid var(--border); background:var(--surface);
}
.wizard-exit-link:hover{ color:var(--red); border-color:var(--red); }

.credit-footer{
  position:fixed; left:0; right:0; bottom:0; z-index:40;
  text-align:center; padding:9px 12px; font-size:11.5px; color:var(--text-dim);
  background:var(--surface); border-top:1px solid var(--border);
}
.credit-footer a{ color:var(--text-mid); font-weight:600; text-decoration:none; }
.credit-footer a:hover{ color:var(--brand); text-decoration:underline; }

/* ============ CANDIDATO: COUNTDOWN ============ */
.countdown-number{
  font-family:'JetBrains Mono',monospace; font-weight:700; font-size:72px;
  color:var(--brand); line-height:1; margin:18px 0;
}
.countdown-label{ font-size:13.5px; color:var(--text-dim); }

/* ============ DONE SCREEN ============ */
.done-wrap{ flex:1; display:flex; align-items:center; justify-content:center; padding:40px; text-align:center; min-height:100vh; }
.done-card{ max-width:420px; }
.check-mark{
  width:54px; height:54px; border-radius:50%; border:1px solid var(--green); color:var(--green);
  display:flex; align-items:center; justify-content:center; font-size:22px; margin:0 auto 22px auto;
}
.done-card h1{ font-size:24px; margin-bottom:12px; }
.done-card p{ font-size:14px; color:var(--text-mid); line-height:1.6; }

/* ============ CANDIDATO: REGOLE INTRO ============ */
.rules{ list-style:none; display:flex; flex-direction:column; gap:12px; margin-bottom:26px; }
.rules li{ display:flex; align-items:flex-start; gap:12px; font-size:13.5px; line-height:1.55; color:var(--text-mid); }
.rule-num{ font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--brand); flex-shrink:0; padding-top:2px; letter-spacing:.04em; }

/* ============ CANDIDATO: MIC CHECK ============ */
.mic-section{ margin-bottom:22px; }
.mic-section-label{ font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-dim); margin-bottom:10px; }
.mic-row{ display:flex; align-items:center; gap:12px; padding:14px 16px; border:1px solid var(--border); border-radius:10px; background:var(--surface-2); transition:border-color .2s; }
.mic-row.ok{ border-color:var(--green); background:var(--green-dim); }
.mic-btn{ font-family:inherit; font-size:12.5px; font-weight:600; border:1px solid var(--border); border-radius:7px; padding:8px 14px; cursor:pointer; background:var(--surface); color:var(--text-mid); white-space:nowrap; transition:color .15s, border-color .15s; flex-shrink:0; }
.mic-btn:hover{ color:var(--text); border-color:var(--text-dim); }
.mic-btn.active{ border-color:var(--red); color:var(--red); }
.mic-meter{ flex:1; height:6px; border-radius:3px; background:var(--border); overflow:hidden; }
.mic-fill{ height:100%; border-radius:3px; background:linear-gradient(90deg,var(--green),var(--brand)); width:0%; transition:width .08s ease; }
.mic-status{ font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--text-dim); letter-spacing:.04em; flex-shrink:0; min-width:52px; text-align:right; }
.mic-status.ok{ color:var(--green); }
.mic-status.err{ color:var(--red); }
.mic-note{ font-size:12px; color:var(--text-dim); margin-top:8px; line-height:1.5; }
.mic-note.ok{ color:var(--green); }

/* ============ CANDIDATO: CONSENSI ============ */
.consent-section{ margin-bottom:22px; }
.consent-section-label{ font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--text-dim); margin-bottom:10px; }
.consent-item{ display:flex; align-items:flex-start; gap:13px; padding:13px 15px; border-radius:9px; border:1px solid var(--border); background:var(--surface-2); margin-bottom:8px; cursor:pointer; transition:border-color .15s, background .15s; }
.consent-item:hover{ border-color:var(--text-dim); }
.consent-item.checked{ border-color:var(--brand); background:var(--brand-dim); }
.consent-checkbox{ width:18px; height:18px; flex-shrink:0; border:1.5px solid var(--text-dim); border-radius:4px; background:transparent; display:flex; align-items:center; justify-content:center; margin-top:1px; transition:background .15s, border-color .15s; }
.consent-item.checked .consent-checkbox{ background:var(--brand); border-color:var(--brand); }
.consent-checkbox svg{ display:none; }
.consent-item.checked .consent-checkbox svg{ display:block; }
.consent-text{ font-size:12.5px; line-height:1.6; color:var(--text-mid); }
.consent-text strong{ color:var(--text); font-weight:600; display:block; margin-bottom:3px; }
.consent-text a{ color:var(--brand); text-decoration:underline; }
.consent-footnote{ font-size:11.5px; color:var(--text-dim); margin-top:4px; line-height:1.5; }

/* ============ CANDIDATO: OVERLAY INTERRUZIONE ============ */
.overlay{ position:absolute; inset:0; background:rgba(244,245,247,.97); display:none; align-items:center; justify-content:center; z-index:50; text-align:center; padding:40px; }
.overlay.visible{ display:flex; }
.overlay-card{ max-width:420px; }
.overlay-icon{ width:44px; height:44px; border-radius:50%; border:1px solid var(--red); color:var(--red); display:flex; align-items:center; justify-content:center; font-family:'JetBrains Mono',monospace; font-size:16px; margin:0 auto 22px auto; }
.overlay-card h1{ font-size:22px; font-weight:700; letter-spacing:-.01em; margin-bottom:12px; }
.overlay-card p{ font-size:13.5px; color:var(--text-mid); line-height:1.6; margin-bottom:26px; }

/* ============ CANDIDATO: UPLOAD CV ============ */
.dropzone{ border:1.5px dashed var(--border); border-radius:12px; padding:28px 22px; text-align:center; cursor:pointer; transition:border-color .2s, background .2s; margin-bottom:16px; }
.dropzone:hover, .dropzone.drag{ border-color:var(--brand); background:var(--brand-dim); }
.dropzone .dz-icon{ font-size:20px; margin-bottom:8px; color:var(--text-dim); }
.dropzone .dz-title{ font-weight:600; font-size:14px; }
.dropzone .dz-sub{ font-size:13px; color:var(--text-dim); margin-top:3px; }
.file-chip{ display:none; align-items:center; justify-content:space-between; background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:11px 16px; margin-bottom:16px; }
.file-chip.visible{ display:flex; }
.file-chip .name{ font-family:'JetBrains Mono',monospace; font-size:11.5px; color:var(--green); }
.file-chip button{ background:none; border:none; color:var(--text-dim); cursor:pointer; font-size:13px; }

/* ============================================================
   RESPONSIVE — tablet e smartphone
   ============================================================ */

/* ---------- LAPTOP STRETTO (≤1180px): sidebar più stretta ---------- */
@media (max-width:1180px){
  .content{ padding:24px; }
  .topbar{ padding:20px 24px; }
  .sidebar{ width:200px; }
  .report-columns{ gap:12px; }
}

/* ---------- TABLET (≤1180px): le tabelle non ci stanno più affiancate → card impilate ---------- */
@media (max-width:1180px){
  .table-head{ display:none; }
  .table-row{
    display:flex; flex-direction:column; align-items:stretch; gap:8px;
    grid-template-columns:none;
    border:1px solid var(--border); border-radius:10px; background:var(--surface-2);
    padding:14px 16px; margin-bottom:10px;
  }
  .table-row:last-child{ margin-bottom:0; border-bottom:1px solid var(--border); }
  .table-actions{ justify-content:flex-start; flex-wrap:wrap; margin-top:4px; }
  .table-actions > *{ flex:1; min-width:90px; }
  .table-actions .btn{ width:100%; justify-content:center; }
  .form-row-3{ grid-template-columns:1fr 1fr; }
}

/* ---------- TABLET VERTICALE / MOBILE (≤900px) ---------- */
@media (max-width:900px){
  #app{ flex-direction:column; }

  /* la sidebar desktop sparisce, sostituita dalla barra fissa in basso */
  .sidebar{ display:none; }
  .main{ padding-bottom:64px; }

  .topbar{ flex-wrap:wrap; gap:12px; }
  .topbar-actions{ width:100%; }
  .topbar-actions .btn{ flex:1; justify-content:center; }
  .content{ padding:18px; }
  .card{ padding:18px; }
  .card-header{ flex-wrap:wrap; gap:10px; }

  /* form a più colonne → una sola colonna */
  .form-grid{ grid-template-columns:1fr; }
  .form-row-3{ grid-template-columns:1fr; }
  .form-row-inline{ flex-direction:column; align-items:stretch; }
  .form-row-inline .field.narrow{ flex:1; min-width:0; }

  .candidate-summary{ flex-direction:column; align-items:flex-start; gap:10px; }
  .candidate-summary-right{ flex-wrap:wrap; width:100%; justify-content:flex-start; }

  .report-grid{ grid-template-columns:1fr; }
  .report-columns{ flex-direction:column; }

  .wizard-topbar{ padding:16px 20px 0 20px; }
  .wizard-center{ padding:20px; }
  .wizard-q-body{ padding:16px 20px; }
  .wizard-answer-zone{ padding:16px 20px 60px 20px; }
  .wizard-card{ padding:24px; }
  .wizard-card h1{ font-size:21px; }
  .wizard-q-text{ font-size:18px; }
  .wizard-exit-link{ top:12px; right:14px; padding:6px 10px; font-size:12px; }

  /* ---- barra di navigazione fissa in basso + menu a comparsa ---- */
  .mobile-navbar{
    display:flex; align-items:center; justify-content:space-between;
    position:fixed; left:0; right:0; bottom:0; z-index:60; height:56px; padding:0 18px;
    background:var(--sidebar-bg); border-top:1px solid var(--sidebar-border);
  }
  .mobile-navbar-brand{ color:#fff; font-weight:700; font-size:16px; letter-spacing:-.02em; }
  .mobile-navbar-brand span{ color:#8DA2FF; }
  .mobile-navbar-toggle{
    display:flex; align-items:center; gap:9px; background:transparent; border:none; cursor:pointer;
    color:var(--sidebar-text); font-family:inherit; font-size:13px; font-weight:600; padding:8px 4px;
  }
  .mobile-navbar-toggle:active{ color:#fff; }
  .mobile-navbar-hamburger{ width:20px; height:14px; position:relative; flex-shrink:0; }
  .mobile-navbar-hamburger span{ position:absolute; left:0; right:0; height:2px; background:currentColor; border-radius:1px; }
  .mobile-navbar-hamburger span:nth-child(1){ top:0; }
  .mobile-navbar-hamburger span:nth-child(2){ top:6px; }
  .mobile-navbar-hamburger span:nth-child(3){ top:12px; }

  .mobile-nav-overlay{
    display:none; position:fixed; inset:0; background:rgba(10,14,28,.5); z-index:65;
  }
  .mobile-nav-overlay.open{ display:block; }

  .mobile-nav-drawer{
    display:block; position:fixed; left:0; right:0; bottom:0; z-index:70; max-height:75vh; overflow-y:auto;
    background:var(--sidebar-bg); border-radius:18px 18px 0 0; padding:10px 0 0 0;
    transform:translateY(100%); transition:transform .25s ease;
  }
  .mobile-nav-drawer.open{ transform:translateY(0); }
  .mobile-nav-drag{ width:36px; height:4px; border-radius:2px; background:var(--sidebar-border); margin:0 auto 14px auto; }
  .mobile-nav-drawer .nav{ padding:0 14px; gap:4px; }
  .mobile-nav-drawer .nav-item{ padding:13px 14px; font-size:14.5px; }
  .mobile-nav-drawer .sidebar-footer{ margin-top:14px; padding:14px 18px 20px 18px; }
}

/* ---------- SMARTPHONE (≤560px) ---------- */
@media (max-width:560px){
  .topbar h1{ font-size:17px; }
  .content{ padding:14px; }
  .card{ padding:14px; }

  .btn{ padding:9px 14px; }

  .candidate-name-row{ width:100%; }
  .avatar{ width:32px; height:32px; font-size:12px; }

  .score-row{ flex-wrap:wrap; }

  .link-share-row{ flex-wrap:wrap; }
  .link-share-row input{ flex-basis:100%; }
  .link-share-row .btn{ flex:1; justify-content:center; }

  .rec-btn{ width:52px; height:52px; }
  .rec-ring{ width:70px; height:70px; }
  .countdown-number{ font-size:52px; }

  .credit-footer{ font-size:10.5px; padding:7px 10px; }
}
