/* STAFF · Mechit — tema scuro, accento lime (brand Mechit RSC) */
:root {
  --bg: #0a0a0a;
  --bg-2: #101010;
  --surface: #161616;
  --surface-2: #1d1d1d;
  --surface-3: #262626;
  --line: #2a2a2a;
  --line-2: #363636;
  --txt: #f0f0f0;
  --txt-2: #c4c4c4;
  --muted: #8a8a8a;
  --accent: #ccff00;
  --accent-2: #99cc00;
  --accent-ink: #101400;
  --danger: #ff5a5a;
  --ok: #3ddc84;
  --warn: #ffb84d;
  --info: #2a6cff;
  --event: #a855f7;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 10px 40px rgba(0,0,0,.55);
  --sidebar-w: 236px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--txt); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- Login */
.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(ellipse at 50% 20%, #171c05 0%, var(--bg) 60%); }
.login-wrap { position: relative; width: 100%; max-width: 420px; padding: 24px; }
.login-glow { position: absolute; inset: -80px; background: radial-gradient(circle at 50% 30%, rgba(204,255,0,.12), transparent 60%); filter: blur(30px); pointer-events: none; }
.login-card {
  position: relative; background: rgba(22,22,22,.92); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px 28px;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.login-logo { height: 26px; display: block; margin: 0 auto 22px; opacity: .95; }
.login-card h1 { margin: 0; text-align: center; font-size: 1.7rem; letter-spacing: .04em; font-weight: 800; }
.login-card h1 span { color: var(--accent); font-weight: 600; letter-spacing: 0; text-transform: lowercase; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 28px; font-size: .92rem; }
.login-error { background: rgba(255,90,90,.12); border: 1px solid rgba(255,90,90,.4); color: #ffb3b3; border-radius: var(--radius-s); padding: 10px 12px; margin: 4px 0 14px; font-size: .9rem; }
.login-foot { text-align: center; color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; width: 100%; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; opacity: .6; padding: 6px 8px; border-radius: 8px; }
.pw-toggle:hover { opacity: 1; background: var(--surface-3); }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-6px);} 40%,80% { transform: translateX(6px);} }

/* ---------------------------------------------------------------- Form */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field select, .field textarea, .input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 11px 13px; color: var(--txt);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(204,255,0,.12); }
.field textarea { min-height: 84px; resize: vertical; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type=time] { font-variant-numeric: tabular-nums; }
input[type=time]::-webkit-calendar-picker-indicator, input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }
.field.inline { display: flex; align-items: center; gap: 10px; margin: 0; }
.field.inline > span { margin: 0; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--txt-2); font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: .8rem; margin: -6px 0 12px; }

/* switch */
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--surface-3); border-radius: 24px; transition: .2s; border: 1px solid var(--line-2); }
.switch i::after { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--txt); padding: 9px 14px; border-radius: var(--radius-s); font-weight: 600; font-size: .9rem; transition: .15s; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-3); border-color: #444; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 800; }
.btn.primary:hover { background: #d8ff33; }
.btn.danger { background: rgba(255,90,90,.12); border-color: rgba(255,90,90,.45); color: #ff9c9c; }
.btn.danger:hover { background: rgba(255,90,90,.22); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--txt-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--txt); }
.btn.small { padding: 6px 10px; font-size: .8rem; }
.btn.big { width: 100%; padding: 13px; font-size: 1rem; border-radius: 12px; }
.btn.icon { padding: 8px; width: 36px; height: 36px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.btn-row.between { justify-content: space-between; }

/* ---------------------------------------------------------------- Layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--bg-2); border-right: 1px solid var(--line); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand img { height: 20px; }
.brand span { color: var(--accent); font-weight: 800; letter-spacing: .12em; font-size: .85rem; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; color: var(--txt-2); font-weight: 600; font-size: .92rem; transition: .15s; }
.nav a i { font-style: normal; width: 22px; text-align: center; font-size: 1.05rem; filter: grayscale(1) brightness(1.4); }
.nav a:hover { background: var(--surface-2); color: var(--txt); }
.nav a.active { background: var(--accent); color: var(--accent-ink); }
.nav a.active i { filter: grayscale(1) brightness(.2); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; text-align: left; transition: .15s; }
.user-chip:hover { border-color: var(--line-2); background: var(--surface-2); }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta b { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; font-size: .78rem; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.4); flex: 0 0 auto; }
.avatar.sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar.xs { width: 18px; height: 18px; font-size: .5rem; }

.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.page-head h1 small { display: block; color: var(--muted); font-size: .85rem; font-weight: 500; letter-spacing: 0; margin-top: 2px; }

.bottom-nav { display: none; }

/* ---------------------------------------------------------------- Cards/KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kpi-color, var(--accent)); }
.kpi small { display: block; color: var(--muted); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.kpi b { display: block; font-size: 1.45rem; font-weight: 800; margin-top: 2px; letter-spacing: -.01em; }
.kpi span { display: block; color: var(--txt-2); font-size: .82rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.clickable { cursor: pointer; transition: .15s; }
.kpi.clickable:hover { border-color: var(--line-2); background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h3 { margin: 0 0 12px; font-size: 1rem; }

/* ---------------------------------------------------------------- Calendar */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-toolbar .title { font-weight: 800; font-size: 1.15rem; min-width: 190px; text-transform: capitalize; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--txt-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.seg button.active { background: var(--surface-3); color: var(--txt); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .8rem; margin: 12px 0 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 14px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 10px 8px; text-align: center; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(112px, auto); }
.cal-day { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; transition: background .15s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: rgba(0,0,0,.25); }
.cal-day.other .dnum { color: #555; }
.cal-day.weekend:not(.other) { background: rgba(255,255,255,.015); }
.cal-day.admin:hover { background: var(--surface-2); cursor: pointer; }
.cal-day .dnum { font-size: .82rem; font-weight: 700; color: var(--txt-2); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .dnum { background: var(--accent); color: var(--accent-ink); }
.cal-day .add { position: absolute; top: 8px; right: 8px; opacity: 0; width: 24px; height: 24px; border-radius: 6px; background: var(--surface-3); border: 0; color: var(--txt); cursor: pointer; font-weight: 800; line-height: 1; }
.cal-day.admin:hover .add { opacity: 1; }
.chip {
  display: flex; align-items: center; gap: 6px; border-radius: 7px; padding: 4px 7px; font-size: .78rem; font-weight: 600; cursor: pointer; min-width: 0;
  background: var(--surface-3); border-left: 3px solid var(--chip-color, #555); color: var(--txt-2); transition: .12s; text-align: left;
}
.chip:hover { filter: brightness(1.15); transform: translateY(-1px); }
.chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chip .h { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; font-size: .72rem; }
.chip.mine { background: rgba(204,255,0,.14); border-left-color: var(--accent); color: var(--txt); box-shadow: inset 0 0 0 1px rgba(204,255,0,.35); }
.chip.mine .h { color: var(--accent); }
.chip.event { background: rgba(168,85,247,.16); border-left-color: var(--event); color: var(--txt); }
.chip.event.mine { box-shadow: inset 0 0 0 1px rgba(204,255,0,.5); }
.chip .ev { color: var(--event); font-size: .7rem; }
.chip .req { color: var(--info); font-size: .72rem; }
.chip.other { cursor: default; opacity: .7; }
.chip.other:hover { filter: none; transform: none; }
.call-card.other { cursor: default; opacity: .75; }
.call-card.other:hover { border-color: var(--line); background: var(--surface); }
.tag.event { background: rgba(168,85,247,.18); color: #d8b4fe; }
.chip .dots { display: inline-flex; }
.chip .dots i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--surface); margin-left: -3px; display: inline-block; }
.chip .dots i:first-child { margin-left: 0; }
.chip .st { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.st.ok { background: var(--ok); } .st.warn { background: var(--warn); } .st.miss { background: var(--danger); } .st.none { background: #444; }
.st.live { background: var(--info); box-shadow: 0 0 0 3px rgba(42,108,255,.25); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(42,108,255,.1); } }
.more { color: var(--muted); font-size: .74rem; padding: 2px 6px; cursor: pointer; }
.more:hover { color: var(--txt); }

/* ---------------------------------------------------------------- Agenda / lists */
.agenda { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.agenda-day { display: grid; grid-template-columns: 74px 1fr; gap: 12px; }
.agenda-date { text-align: center; padding-top: 6px; }
.agenda-date b { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1; }
.agenda-date span { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.agenda-date.today b { color: var(--accent); }
.agenda-items { display: flex; flex-direction: column; gap: 8px; }
.call-card {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 0; cursor: pointer; transition: .15s; align-items: center; overflow: hidden;
}
.call-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.call-card .bar { align-self: stretch; background: var(--chip-color, #555); border-radius: 0 3px 3px 0; }
.call-card.mine { border-color: rgba(204,255,0,.35); background: linear-gradient(90deg, rgba(204,255,0,.07), transparent 40%); }
.call-card.mine .bar { background: var(--accent); }
.call-card .body { min-width: 0; }
.call-card .title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.call-card .meta { color: var(--muted); font-size: .82rem; margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.call-card .people { display: flex; align-items: center; gap: 4px; padding-right: 14px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--txt-2); }
.tag.accent { background: var(--accent); color: var(--accent-ink); }
.tag.ok { background: rgba(61,220,132,.15); color: var(--ok); }
.tag.warn { background: rgba(255,184,77,.15); color: var(--warn); }
.tag.danger { background: rgba(255,90,90,.15); color: var(--danger); }
.tag.info { background: rgba(42,108,255,.18); color: #8fb0ff; }
.tag.muted { background: var(--surface-3); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.empty b { display: block; font-size: 1.05rem; color: var(--txt-2); margin-bottom: 4px; }

/* ---------------------------------------------------------------- Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; background: var(--bg-2); position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { background: var(--bg-2); font-weight: 800; }
tr.group td { background: var(--surface-2); font-weight: 800; padding-top: 14px; }
.mono { font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }

/* ---------------------------------------------------------------- Users */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.user-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: .15s; }
.user-card:hover { border-color: var(--line-2); }
.user-card.inactive { opacity: .55; }
.user-card .top { display: flex; align-items: center; gap: 12px; }
.user-card .top .avatar { width: 44px; height: 44px; font-size: 1rem; }
.user-card .top b { display: block; font-size: 1rem; }
.user-card .top small { color: var(--muted); }
.user-card .meta { color: var(--muted); font-size: .8rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Drawer */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 40; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); border-left: 1px solid var(--line); z-index: 50; overflow-y: auto;
  padding: 22px 24px 40px; box-shadow: var(--shadow); animation: slideIn .2s ease-out;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.drawer-head h2 { margin: 0; font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; }
.drawer-head .sub { color: var(--muted); font-size: .9rem; margin-top: 4px; text-transform: capitalize; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
.info { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.info small { display: block; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.info b { display: block; margin-top: 2px; font-size: .98rem; font-variant-numeric: tabular-nums; }
.notes { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--txt-2); white-space: pre-wrap; font-size: .9rem; }
.section-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }

.assign { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg-2); margin-bottom: 10px; }
.assign.mine { border-color: rgba(204,255,0,.4); background: linear-gradient(180deg, rgba(204,255,0,.06), var(--bg-2) 60%); }
.assign .who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.assign .who b { flex: 1; }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-box { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; }
.time-box small { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 4px; }
.time-box .row { display: flex; gap: 6px; align-items: center; }
.time-box input[type=time] { flex: 1; background: transparent; border: 0; font-size: 1.25rem; font-weight: 800; padding: 0; color: var(--txt); outline: none; min-width: 0; }
.time-box input[type=time]:disabled { color: var(--txt-2); }
.time-box .now { padding: 4px 8px; font-size: .72rem; }
.time-box.filled { border-color: rgba(61,220,132,.45); }
.assign .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.assign .dur { font-weight: 800; font-variant-numeric: tabular-nums; }
.assign .dur small { color: var(--muted); font-weight: 600; margin-right: 6px; }
.assign textarea { margin-top: 10px; min-height: 56px; }
.assign .stamp { color: var(--muted); font-size: .74rem; margin-top: 8px; }
.verified-row { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- Richieste */
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800; margin-left: auto; }
.badge.info { background: var(--info); }
.bottom-nav .badge { position: absolute; top: 2px; right: 14%; margin: 0; }
/* notifiche */
.notice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.notice-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.notice-card .top { display: flex; align-items: center; gap: 12px; }
.notice-card .top b { display: block; }
.notice-card .top small { color: var(--muted); display: block; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-items { display: flex; flex-direction: column; gap: 6px; }
.notice-item { display: flex; align-items: center; gap: 10px; font-size: .88rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.notice-item .tag { flex: 0 0 auto; }
.notice-item .when { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.notice-item .what { color: var(--txt-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-item.cancelled .when { text-decoration: line-through; color: var(--muted); }
.notice-preview { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .86rem; white-space: pre-wrap; color: var(--txt-2); max-height: 260px; overflow: auto; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.notice-actions .btn.wa { background: #25d366; color: #062b14; border-color: transparent; }
.notice-actions .btn.wa:hover { filter: brightness(1.08); }
.contact-row { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.contact-row span { display: inline-flex; align-items: center; gap: 4px; }
.contact-row .missing { color: var(--warn); }
@media (max-width: 900px) { .notice-grid { grid-template-columns: 1fr; } .notice-item .what { white-space: normal; } }
.bottom-nav a { position: relative; }
.req-box { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: .9rem; }
.req-box.pending { border-color: rgba(42,108,255,.5); background: linear-gradient(180deg, rgba(42,108,255,.08), var(--bg-2) 70%); }
.req-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.req-body { color: var(--txt-2); margin-bottom: 8px; }
.req-box .btn-row { margin-top: 4px; }
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.req-card.pending { border-color: rgba(42,108,255,.45); }
.req-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.req-card .req-body { background: var(--bg-2); border-radius: 10px; padding: 10px 12px; }
.req-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kind-seg { display: inline-flex; }
.kind-seg button.active[data-kind=event] { background: rgba(168,85,247,.25); color: #e9d5ff; }
.kind-seg button.active[data-kind=call] { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- Modal */
.modal-backdrop { display: grid; place-items: center; padding: 20px; z-index: 60; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; box-shadow: var(--shadow); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal h2 { margin: 0 0 16px; font-size: 1.25rem; font-weight: 800; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.people-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; font-size: .85rem; font-weight: 600; user-select: none; transition: .12s; }
.pick input { display: none; }
.pick:hover { border-color: #555; }
.pick.on { background: rgba(204,255,0,.14); border-color: var(--accent); }
.more-fields { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 0 12px; margin-bottom: 14px; background: var(--bg-2); }
.more-fields summary { cursor: pointer; padding: 11px 0; font-size: .85rem; font-weight: 600; color: var(--txt-2); list-style: none; display: flex; align-items: center; gap: 8px; }
.more-fields summary::before { content: '▸'; color: var(--accent); transition: transform .15s; }
.more-fields[open] summary::before { transform: rotate(90deg); }
.more-fields[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: .12s; }
.color-dot.on { border-color: #fff; transform: scale(1.1); }
.cred-box { background: var(--bg-2); border: 1px dashed var(--accent); border-radius: 12px; padding: 14px; margin-top: 6px; }
.cred-box code { display: block; font-size: 1.2rem; font-weight: 800; letter-spacing: .04em; color: var(--accent); user-select: all; }
.cred-box small { color: var(--muted); }
.dates-multi { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dates-multi .tag { cursor: pointer; }

/* ---------------------------------------------------------------- Toast */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #1e1e1e; border: 1px solid var(--line-2); color: var(--txt); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; font-size: .9rem; animation: up .2s ease-out; pointer-events: auto; display: flex; align-items: center; white-space: nowrap; }
.toast.ok { border-color: rgba(61,220,132,.5); } .toast.err { border-color: rgba(255,90,90,.6); }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }

/* ---------------------------------------------------------------- Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field input, .filters .field select { padding: 9px 12px; }

.loading { color: var(--muted); text-align: center; padding: 40px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 16px 14px 90px; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; background: rgba(16,16,16,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30;
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .66rem; font-weight: 700; color: var(--muted); padding: 6px 2px; border-radius: 10px; }
  .bottom-nav a i { font-style: normal; font-size: 1.15rem; filter: grayscale(1) brightness(1.3); }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a.active i { filter: none; }
  .page-head h1 { font-size: 1.25rem; }
  .cal-grid { grid-auto-rows: minmax(68px, auto); }
  .cal-day { padding: 5px 4px; }
  .cal-day .dnum { width: 22px; height: 22px; font-size: .74rem; }
  .chip { padding: 3px 4px; font-size: 0; border-left-width: 0; border-radius: 4px; height: 6px; background: var(--chip-color, #555) !important; box-shadow: none !important; }
  .chip.mine { background: var(--accent) !important; }
  .chip *, .chip .dots i, .chip .st { display: none; }
  .more { font-size: .66rem; padding: 0 2px; }
  .cal-day .add { display: none; }
  .drawer { width: 100vw; border-left: 0; padding: 18px 16px 90px; }
  .times { grid-template-columns: 1fr 1fr; }
  .agenda-day { grid-template-columns: 56px 1fr; }
  .call-card .people { display: none; }
  .modal { padding: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 1.2rem; }
  .kpi small { font-size: .66rem; }
  .filters .field { flex: 1 1 140px; }
}
@media (max-width: 900px) {
  /* Su mobile il calendario mensile mostra solo i pallini; il tap sul giorno apre la lista */
  .cal-day { cursor: pointer; }
}
