/* Piattaforma Progetti — LDM Tecnologie Informatiche
   Design hi-fi tradotto dal prototipo. Token in :root, poi componenti. */

:root {
  --bg: #F5F0E8;
  --white: #FFFFFF;
  --panel: #F7F3EC;
  --panel2: #FBF8F2;
  --fill: #F3ECE0;
  --fill2: #F0E9DD;
  --fill3: #EEE6D9;
  --border: #E9E1D4;
  --border2: #E3D9C9;
  --border3: #EDE5D8;
  --dashed: #D9CDBA;
  --ink: #2B2622;
  --body: #4A4238;
  --body2: #6A6156;
  --muted: #8A8072;
  --muted2: #9A9084;
  --muted3: #A79C8C;
  --muted4: #B4A996;
  --terracotta: #E07A5F;
  --dark: #2B2622;
  --dark-h: #43392F;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --ui: 'Hanken Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; background: var(--bg); font-family: var(--ui); color: var(--ink); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--ui); }
.disp { font-family: var(--display); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #DBD1C2; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #C9BCA8; background-clip: content-box; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------------------------------------------------------------- Brand */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { flex-shrink: 0; border-radius: 11px; box-shadow: 0 4px 10px rgba(126,95,207,.28); }
.brand-word { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.1; }
.brand-tag { font-size: 10.5px; color: var(--muted2); font-weight: 600; letter-spacing: .02em; }

/* ---------------------------------------------------------------- Buttons */
.btn-dark { border: none; cursor: pointer; background: var(--dark); color: #fff; font-weight: 600; font-size: 13px; padding: 10px 16px; border-radius: 11px; box-shadow: 0 3px 8px rgba(43,38,34,.18); transition: transform .12s, background .15s; display: inline-flex; align-items: center; gap: 7px; }
.btn-dark:hover { background: var(--dark-h); transform: translateY(-1px); }
.btn-outline { border: 1.5px solid var(--border2); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; padding: 10px 18px; border-radius: 11px; color: var(--body2); transition: background .15s; }
.btn-outline:hover { background: var(--fill); }
.btn-delete { border: none; background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; padding: 10px 6px; border-radius: 11px; color: #C0492E; display: inline-flex; align-items: center; gap: 6px; transition: background .15s; }
.btn-delete:hover { background: #F8E7E2; }
.icon-btn { border: none; background: var(--fill); cursor: pointer; width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.icon-btn:hover { background: var(--border); }

/* ---------------------------------------------------------------- Login */
.login-overlay { position: fixed; inset: 0; z-index: 100; background: radial-gradient(1100px 560px at 72% -12%, #FBEFE9, #F5F0E8 62%); display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.login-wrap { width: 100%; max-width: 420px; animation: popIn .35s cubic-bezier(.2,.9,.3,1); }
.login-logo { display: flex; align-items: center; gap: 13px; justify-content: center; margin-bottom: 24px; }
.login-logo .mark { flex-shrink: 0; box-shadow: 0 8px 20px rgba(126,95,207,.32); border-radius: 15px; }
.login-card { background: #fff; border: 1px solid var(--border3); border-radius: 20px; box-shadow: 0 20px 50px rgba(43,38,34,.12); padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.login-sub { font-size: 13px; color: var(--muted2); margin-bottom: 22px; }
.login-error { background: #F8E7E2; border: 1px solid #F1C9BE; color: #C0492E; font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 11px; margin-bottom: 16px; }
.login-success { background: #E7F2E6; border: 1px solid #CFE6CD; color: #3E7439; font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 11px; margin-bottom: 16px; }
.label { display: block; font-size: 12px; font-weight: 700; color: var(--body2); margin-bottom: 7px; }
.field { width: 100%; border: 1.5px solid var(--border2); background: #fff; border-radius: 11px; padding: 12px 13px; font-family: var(--ui); font-size: 14px; outline: none; }
.field:focus { border-color: var(--terracotta); }
.field-mb { margin-bottom: 15px; }
.btn-full { width: 100%; justify-content: center; padding: 13px; border-radius: 12px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; }
.divider .line { flex: 1; height: 1px; background: var(--border3); }
.divider span { font-size: 11px; font-weight: 600; color: var(--muted4); text-transform: uppercase; letter-spacing: .06em; }
.role-cards { display: flex; flex-direction: column; gap: 9px; }
.role-card { width: 100%; text-align: left; border: 1.5px solid var(--border); background: var(--panel2); cursor: pointer; padding: 11px 13px; border-radius: 13px; display: flex; align-items: center; gap: 12px; transition: background .15s, border-color .15s; }
.role-card:hover { background: var(--fill); border-color: var(--border2); }
.role-card .ico { width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.role-card .lab { display: block; font-weight: 700; font-size: 14px; color: var(--ink); }
.role-card .desc { display: block; font-size: 12px; color: var(--muted2); }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted4); margin-top: 18px; }

/* ---------------------------------------------------------------- Shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.appbar { display: flex; align-items: center; gap: 20px; padding: 14px 26px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.appbar .brand { min-width: 200px; }
.user-box { min-width: 180px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11px; color: var(--muted2); }
.avatar { border-radius: 11px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* Role switch (statico: indica il ruolo dell'utente) */
.role-switch { position: relative; display: flex; background: var(--fill2); border-radius: 13px; padding: 4px; gap: 2px; width: 440px; }
.role-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px)/4); background: #fff; border-radius: 10px; box-shadow: 0 2px 6px rgba(43,38,34,.10); transition: transform .28s cubic-bezier(.4,1.3,.5,1); }
.role-seg { position: relative; z-index: 1; flex: 1; border: none; background: transparent; padding: 8px 6px; border-radius: 10px; font-weight: 600; font-size: 12.5px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); cursor: default; }
.role-seg.active { color: var(--ink); }
.role-seg .g { font-size: 14px; line-height: 1; }

.role-banner { padding: 9px 26px; border-bottom: 1px solid; display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.role-banner b { font-weight: 600; }
.role-banner .t { opacity: .85; }

.body-row { flex: 1; display: flex; min-height: 0; }
.body-row.is-loading { opacity: .55; pointer-events: none; transition: opacity .12s; }

/* ---------------------------------------------------------------- Sidebar */
.sidebar { width: 274px; flex-shrink: 0; background: var(--panel2); border-right: 1px solid var(--border); padding: 18px 14px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.view-toggle { display: flex; background: var(--fill2); border-radius: 11px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.view-toggle a { flex: 1; text-align: center; padding: 8px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .15s; }
.view-toggle a.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(43,38,34,.10); }
.side-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted3); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.count-pill { font-size: 11px; font-weight: 600; color: var(--muted3); background: var(--fill2); padding: 2px 8px; border-radius: 20px; }
.side-scroll { flex: 1; display: flex; flex-direction: column; gap: 5px; min-height: 0; }
.project-item { text-align: left; border: 1px solid transparent; background: transparent; cursor: pointer; padding: 11px 12px; border-radius: 13px; display: flex; gap: 11px; align-items: center; transition: background .15s, border-color .15s; }
.project-item:hover { background: var(--fill); border-color: var(--border2); }
.project-item.active { background: #fff; border-color: var(--border2); }
.project-item .pa { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.project-item .nm { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.project-item .cl { font-size: 11.5px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item .ct { font-size: 11px; font-weight: 600; color: var(--muted3); }
.new-project { margin-top: 4px; text-align: left; border: 1.5px dashed var(--dashed); background: transparent; cursor: pointer; padding: 11px 12px; border-radius: 13px; display: flex; gap: 11px; align-items: center; color: var(--muted); font-weight: 600; font-size: 13px; transition: all .15s; }
.new-project:hover { background: var(--fill); border-color: #C9BCA8; color: var(--body2); }
.new-project .pa { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--fill2); display: flex; align-items: center; justify-content: center; }
.side-note { margin-top: auto; padding: 14px 10px 4px; font-size: 11px; color: var(--muted4); line-height: 1.5; }
.side-note b { color: var(--muted); }
.reg-nav { text-align: left; border: 1px solid transparent; background: transparent; cursor: pointer; padding: 11px 12px; border-radius: 12px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13.5px; color: var(--ink); transition: background .15s; }
.reg-nav:hover { background: var(--fill); }
.reg-nav.active { background: #fff; border-color: var(--border2); }
.reg-nav .l { display: inline-flex; align-items: center; gap: 9px; }
.log-info { background: var(--fill); border: 1px solid var(--border); border-radius: 12px; padding: 13px; }
.lock-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #B4573A; background: #FBEFE9; padding: 3px 9px; border-radius: 20px; margin-bottom: 9px; }
.log-info .txt { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---------------------------------------------------------------- Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.proj-header { padding: 22px 28px 18px; border-bottom: 1px solid var(--border); background: #fff; }
.proj-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.proj-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 25px; letter-spacing: -.02em; }
.title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--body2); background: var(--fill); padding: 5px 11px; border-radius: 20px; }
.progress-lab { font-size: 12px; color: var(--muted2); font-weight: 600; margin-bottom: 6px; text-align: right; }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-bar { width: 170px; height: 9px; border-radius: 20px; background: var(--fill3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg,#E9A23B,#6FA36B); transition: width .5s; }
.progress-pct { font-family: var(--display); font-weight: 700; font-size: 19px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px 4px; gap: 16px; }
.toolbar h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 16px; }
.toolbar .cnt { font-size: 13px; color: var(--muted2); }
.toolbar .left { display: flex; align-items: baseline; gap: 10px; }

.kanban-scroll { flex: 1; overflow: auto; padding: 16px 28px 28px; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px,1fr)); gap: 16px; min-width: 1000px; }
.column { display: flex; flex-direction: column; gap: 11px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.status-dot { width: 9px; height: 9px; border-radius: 3px; }
.col-title { font-weight: 700; font-size: 13px; color: var(--ink); }
.col-count { font-size: 12px; font-weight: 600; color: var(--muted3); padding: 1px 8px; border-radius: 20px; }
.col-stack { display: flex; flex-direction: column; gap: 11px; min-height: 60px; }
.card { display: block; text-align: left; width: 100%; background: #fff; border: 1.5px solid var(--border3); border-radius: 15px; padding: 14px; cursor: pointer; box-shadow: 0 1px 2px rgba(43,38,34,.05); transition: transform .12s, box-shadow .15s, border-color .15s; animation: fadeUp .3s ease both; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(43,38,34,.10); }
.card.selected { border-color: var(--terracotta); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 9px; }
.chip-priority { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.chip-priority .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-due { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.35; margin-bottom: 12px; color: var(--ink); }
.card-bottom { display: flex; align-items: center; justify-content: space-between; }
.assignee { display: flex; align-items: center; gap: 7px; }
.avatar-xs { width: 24px; height: 24px; border-radius: 7px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 10px; }
.assignee .nm { font-size: 12px; color: var(--muted); font-weight: 500; }
.meta-icons { display: flex; align-items: center; gap: 11px; color: var(--muted4); }
.meta-icons span { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; }

/* ---------------------------------------------------------------- Registry */
.section-header { padding: 22px 28px 20px; border-bottom: 1px solid var(--border); background: #fff; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.section-title { margin: 0 0 4px; font-family: var(--display); font-weight: 700; font-size: 25px; letter-spacing: -.02em; }
.section-sub { font-size: 13px; color: var(--muted2); }
.entity-scroll { flex: 1; overflow: auto; padding: 22px 28px 28px; }
.entity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px,1fr)); gap: 16px; }
.entity-card { text-align: left; background: #fff; border: 1.5px solid var(--border3); border-radius: 16px; padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(43,38,34,.05); transition: transform .12s, box-shadow .15s, border-color .15s; animation: fadeUp .3s ease both; }
.entity-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(43,38,34,.10); border-color: var(--border2); }
.entity-top { display: flex; align-items: center; gap: 13px; }
.entity-avatar { width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px; color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 16px; }
.entity-title { font-family: var(--display); font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-sub { font-size: 12.5px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-meta { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 7px 11px; border-radius: 9px; align-self: flex-start; }

/* ---------------------------------------------------------------- Log */
.log-header { padding: 22px 28px 16px; border-bottom: 1px solid var(--border); background: #fff; }
.log-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.select { border: 1.5px solid var(--border2); background: #fff; border-radius: 10px; padding: 9px 12px; font-family: var(--ui); font-size: 13px; color: var(--ink); outline: none; cursor: pointer; }
.log-scroll { flex: 1; overflow: auto; padding: 18px 28px 28px; }
.log-list { display: flex; flex-direction: column; gap: 9px; max-width: 840px; }
.log-row { text-align: left; background: #fff; border: 1px solid var(--border3); border-radius: 14px; padding: 13px 16px; display: flex; align-items: center; gap: 13px; transition: background .15s, border-color .15s; animation: fadeUp .3s ease both; }
.log-row.click { cursor: pointer; }
.log-row.click:hover { background: var(--panel2); border-color: var(--border2); }
.log-avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.log-body { flex: 1; min-width: 0; }
.log-text { font-size: 13.5px; color: var(--body); line-height: 1.4; }
.log-text b { color: var(--ink); }
.role-badge { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 12px; }
.log-meta { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.chip-type { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 12px; }
.chip-type .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-project { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 12px; }
.log-time { flex-shrink: 0; font-size: 11.5px; color: var(--muted4); font-weight: 500; }
.log-empty { text-align: center; padding: 50px 20px; color: var(--muted4); font-size: 14px; }

/* ---------------------------------------------------------------- Drawer */
.overlay { position: fixed; inset: 0; background: rgba(43,38,34,.34); z-index: 40; animation: overlayIn .2s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px,94vw); background: var(--panel); z-index: 41; box-shadow: -14px 0 40px rgba(43,38,34,.18); display: flex; flex-direction: column; animation: slideIn .3s cubic-bezier(.2,.9,.3,1); }
.drawer-head { padding: 20px 24px 16px; background: #fff; border-bottom: 1px solid var(--border); }
.drawer-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.drawer-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.25; letter-spacing: -.01em; }
.chip-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 20px; }
.chip-status .dot { width: 7px; height: 7px; border-radius: 50%; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted3); margin-bottom: 7px; }
.meta-row { display: flex; gap: 22px; margin-bottom: 22px; }
.meta-val { display: flex; align-items: center; gap: 8px; }
.avatar-s { width: 28px; height: 28px; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; }
.desc { margin: 0 0 22px; font-size: 14px; line-height: 1.6; color: var(--body); }
.status-btns { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 22px; }
.status-btn { cursor: pointer; font-weight: 600; font-size: 12px; padding: 7px 12px; border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.status-btn .dot { width: 7px; height: 7px; border-radius: 50%; }
.attach-row { display: flex; align-items: center; gap: 11px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 8px; }
.file-ico { width: 32px; height: 32px; border-radius: 8px; background: var(--fill); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.attach-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-size { font-size: 11.5px; color: var(--muted3); }
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.comment { display: flex; gap: 10px; }
.comment-avatar { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; }
.comment-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.comment-author { font-size: 13px; font-weight: 700; }
.comment-time { font-size: 11px; color: var(--muted4); margin-left: auto; }
.comment-bubble { font-size: 13.5px; line-height: 1.5; color: var(--body); background: #fff; border: 1px solid var(--border3); border-radius: 11px; padding: 9px 12px; }
.comment-form { display: flex; gap: 9px; align-items: flex-end; }
.send-btn { border: none; cursor: pointer; background: var(--terracotta); color: #fff; width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.send-btn:hover { background: #D06A50; }

/* ---------------------------------------------------------------- Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(43,38,34,.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; animation: overlayIn .2s ease; }
.modal { width: min(520px,100%); background: var(--panel); border-radius: 20px; box-shadow: 0 30px 70px rgba(43,38,34,.35); animation: popIn .28s cubic-bezier(.2,.9,.3,1); overflow: hidden; }
.modal.sm { width: min(480px,100%); }
.modal.scroll { max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 20px 24px; background: #fff; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal.scroll .modal-head { position: sticky; top: 0; z-index: 2; }
.modal-head h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.modal-head .sub { font-size: 12px; color: var(--muted2); margin-top: 2px; }
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { padding: 16px 24px; background: #fff; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-foot.split { justify-content: space-between; align-items: center; }
.modal.scroll .modal-foot { position: sticky; bottom: 0; }
.row2 { display: flex; gap: 14px; }
.row2 > div { flex: 1; }
textarea.field { resize: vertical; }
.team-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.team-chip { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--border2); background: #fff; cursor: pointer; padding: 5px 12px 5px 6px; border-radius: 22px; font-weight: 600; font-size: 12.5px; color: var(--body2); transition: all .15s; }
.team-chip .mini { width: 22px; height: 22px; border-radius: 7px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; }
.team-chip.on, .team-chip:has(input:checked) { background: var(--dark); border-color: var(--dark); color: #fff; }
.team-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.swatches { display: flex; gap: 11px; }
.swatch { position: relative; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; border: 2px solid #fff; transition: box-shadow .15s; padding: 0; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px rgba(43,38,34,.55); }
.modal-error { background: #F8E7E2; border: 1px solid #F1C9BE; color: #C0492E; font-size: 12.5px; font-weight: 600; padding: 10px 12px; border-radius: 11px; }

/* ---------------------------------------------------------------- Header spacer */
.appbar-spacer { flex: 1; }

/* ---------------------------------------------------------------- Sidebar: nav sezione verticale */
.section-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.section-nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--muted); transition: all .15s; }
.section-nav-item:hover { background: var(--fill); }
.section-nav-item.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(43,38,34,.10); }
.section-nav-item .ic { display: inline-flex; }

/* Filtro Attivi / Terminati */
.pf-tabs { display: flex; background: var(--fill2); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 8px; }
.pf-tab { flex: 1; text-align: center; padding: 6px 4px; border-radius: 8px; font-weight: 600; font-size: 12px; color: var(--muted); transition: all .15s; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.pf-tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(43,38,34,.10); }
.pf-tab .n { font-size: 10.5px; opacity: .75; }
.project-item.terminato { opacity: .66; }
.fine-tag { flex-shrink: 0; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); background: var(--fill3); padding: 2px 7px; border-radius: 20px; }

/* ---------------------------------------------------------------- Project header: stato + link piattaforme */
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 11px; border-radius: 20px; }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.platform-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.plink { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 20px; border: 1px solid; transition: background .15s; }
.plink.dev { color: #6A4FB0; background: #F1ECFA; border-color: #E4D8F5; }
.plink.dev:hover { background: #E9DEFA; }
.plink.dev .host { color: #9A8ABF; font-weight: 500; }
.plink.prod { color: #3E7439; background: #E7F2E6; border-color: #CFE6CD; }
.plink.prod:hover { background: #DBEDDA; }
.plink.prod .host { color: #7DA678; font-weight: 500; }

/* Modale progetto: link (label con icona) + toggle stato */
.label-ico { display: flex; align-items: center; gap: 6px; }
.status-toggle { display: flex; gap: 8px; }
.st-opt { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1.5px solid var(--border2); background: #fff; cursor: pointer; padding: 10px 12px; border-radius: 11px; font-weight: 600; font-size: 13px; color: var(--body2); transition: all .15s; }
.st-opt .dot { width: 8px; height: 8px; border-radius: 50%; }
.st-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.st-opt.on, .st-opt:has(input:checked) { border-color: var(--dark); background: var(--fill); color: var(--ink); }

/* ---------------------------------------------------------------- Scadenze & manutenzione */
.scad-header { padding: 22px 28px 16px; border-bottom: 1px solid var(--border); background: #fff; }
.scad-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.scad-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scad-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px; }
.scad-badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.scad-badge.overdue { color: #C0492E; background: #F8E7E2; }
.scad-badge.overdue .dot { background: #C0492E; }
.scad-badge.soon { color: #B0740F; background: #FBF0DC; }
.scad-badge.soon .dot { background: #B0740F; }
.seg-tabs { display: flex; gap: 2px; background: var(--fill2); border-radius: 11px; padding: 3px; margin-top: 16px; width: fit-content; }
.seg-tab { padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .15s; display: inline-flex; align-items: center; gap: 6px; }
.seg-tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(43,38,34,.10); }
.seg-tab .n { font-size: 10.5px; opacity: .7; }
.scad-scroll { flex: 1; overflow: auto; padding: 18px 28px 28px; }
.scad-list { display: flex; flex-direction: column; gap: 9px; max-width: 920px; }
.scad-row { display: flex; align-items: center; gap: 15px; background: #fff; border: 1px solid var(--border3); border-radius: 14px; padding: 14px 16px; transition: background .15s, border-color .15s; animation: fadeUp .3s ease both; }
.scad-row:hover { background: var(--panel2); border-color: var(--border2); }
.scad-ico { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.scad-label { font-weight: 600; font-size: 14.5px; color: var(--ink); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scad-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.scad-type { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 12px; }
.scad-proj { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.scad-proj .sq { width: 8px; height: 8px; border-radius: 3px; }
.scad-right { flex-shrink: 0; text-align: right; }
.scad-date { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.scad-urg { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 12px; }
.scad-urg .dot { width: 6px; height: 6px; border-radius: 50%; }

/* ---------------------------------------------------------------- Auth multi-step */
.auth-steps { position: relative; }
.auth-card[hidden] { display: none; }
.auth-icon { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.auth-icon.warm { background: #FBEFE9; }
.auth-icon.ok { width: 56px; height: 56px; border-radius: 16px; background: #E7F2E6; margin: 0 auto 18px; }
.login-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 18px; }
.remember { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--body2); font-weight: 500; cursor: pointer; }
.remember input { width: 15px; height: 15px; accent-color: var(--terracotta); cursor: pointer; }
.link-btn { border: none; background: transparent; cursor: pointer; padding: 0; font-family: var(--ui); font-size: 12.5px; font-weight: 600; color: #B4573A; }
.link-btn:hover { text-decoration: underline; }
.back-btn { width: 100%; border: none; background: transparent; cursor: pointer; font-family: var(--ui); font-weight: 600; font-size: 13px; color: var(--muted); padding: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.back-btn:hover { color: var(--body2); }

@media (max-width: 720px) {
  .appbar .brand { min-width: 0; }
  .user-box { min-width: 0; }
  .user-name, .user-role { display: none; }
}
