/* Altran Gestionale — tema scuro stile monday, con variante chiara automatica */
:root {
  --bg: #181b34; --panel: #1f2240; --panel2: #292d4f; --row: #222543; --row-h: #2c3053;
  --line: #3a3e63; --text: #d5d8f0; --muted: #9699b8; --accent: #6161ff; --accent2: #7b7bff;
  --empty: #4a4e72; --danger: #e2445c; --namew: 340px; --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fb; --panel: #ffffff; --panel2: #eef0f6; --row: #ffffff; --row-h: #f3f4fb;
    --line: #d0d4e4; --text: #323338; --muted: #676879; --empty: #c4c4c4; color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 var(--font); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 12px; }
.splash { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.only-mobile { display: none !important; }

/* ---------- pulsanti ---------- */
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 6px; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.block { display: flex; width: 100%; justify-content: center; margin: 6px 0; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover, .btn.ghost.active { background: var(--panel2); }
.btn.ghost.active { color: var(--accent2); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 4px; color: var(--muted); line-height: 1; }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn:disabled { opacity: .3; }
.link-btn { border: 0; background: none; color: var(--accent2); cursor: pointer; padding: 6px 4px; text-align: left; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
select, input[type=text], input[type=date], input[type=time], input:not([type]), input[type=email], input[type=url], input[type=tel], textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select.small { padding: 4px 6px; font-size: 13px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--panel); padding: 40px 32px; border-radius: 16px; text-align: center; max-width: 380px; }
.login-box h1 { margin: 12px 0 6px; } .login-box p { color: var(--muted); margin-bottom: 26px; }
.logo { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 800; font-size: 28px; display: inline-grid; place-items: center; }
.logo.small { width: 28px; height: 28px; font-size: 15px; border-radius: 7px; }

/* ---------- layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar { width: 240px; flex: none; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 10px; gap: 8px; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; } .side-head b { flex: 1; }
.side-search { position: relative; } .side-search input { width: 100%; }
.search-res { position: absolute; z-index: 30; left: 0; right: 0; top: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 30px #0006; max-height: 60vh; overflow: auto; }
.search-res button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; }
.search-res button:hover { background: var(--row-h); } .search-res small { display: block; color: var(--muted); }
.board-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.board-list a { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.board-list a:hover { background: var(--panel2); } .board-list a.on { background: var(--accent); color: #fff; }
.side-add { border: 1px dashed var(--line); background: none; border-radius: 6px; padding: 7px; cursor: pointer; color: var(--muted); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-sync { border: 1px solid var(--line); background: var(--panel2); border-radius: 6px; padding: 8px; cursor: pointer; text-align: left; text-decoration: none; color: var(--text); }
.side-sync small { display: block; color: var(--muted); font-size: 11px; } .side-sync.warn { color: #fdab3d; }
.me { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.board { display: flex; flex-direction: column; height: 100%; }
.board-head { display: flex; align-items: center; gap: 8px; padding: 14px 24px 4px; }
.board-head h1 { font-size: 24px; margin: 0; font-weight: 600; }
.tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .vt-icon { font-size: 12px; opacity: .8; } .tabs .vt-more { padding: 0 4px; border-radius: 4px; } .tabs .vt-more:hover { background: var(--panel2); }
.tabs .add-view { font-size: 18px; padding: 4px 12px; }
.tabs.small { padding: 0; margin: 14px 0 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 24px; flex: none; }
.tb-search { width: 160px; padding: 5px 8px !important; }
.board-body { flex: 1; overflow: auto; padding: 4px 24px 80px; }

/* ---------- tabella ---------- */
.add-group-top { margin: 4px 0 6px; }
.section { margin: 18px 0 26px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; position: sticky; left: 0; }
.sec-head h3 { margin: 0; font-size: 17px; font-weight: 600; cursor: text; }
.sec-head .count { color: var(--muted); font-size: 12px; }
.section.collapsed .sec-head { border-left: 6px solid var(--gc); padding-left: 8px; background: var(--panel); border-radius: 6px; padding: 8px; }
.group-name-input { font-size: 17px; font-weight: 600; background: transparent !important; }
.grid-wrap { overflow-x: auto; }
.grid { display: inline-block; min-width: 100%; border-left: 6px solid var(--gc, var(--accent)); border-radius: 6px 0 0 6px; }
.hrow, .row, .summary { display: grid; grid-template-columns: var(--cols); }
.hrow { background: var(--panel); border-top: 1px solid var(--line); }
.hcell { padding: 8px 6px; text-align: center; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.hcell:hover { background: var(--panel2); }
.hcell.name { text-align: left; padding-left: 14px; cursor: default; position: sticky; left: 0; background: var(--panel); z-index: 2; }
.hcell.add { cursor: default; } .hcell.add:hover { background: none; }
.hcell .resize { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.hcell .resize:hover { background: var(--accent); }
.sort-ind { margin-left: 4px; color: var(--accent2); }
.row { background: var(--row); min-height: 38px; }
.row:hover { background: var(--row-h); }
.row-wrap { border-bottom: 1px solid var(--line); }
.cell { border-right: 1px solid var(--line); min-height: 38px; display: flex; align-items: center; padding: 0 8px; cursor: pointer; overflow: hidden; min-width: 0; }
.cell.center { justify-content: center; }
.cell.name { position: sticky; left: 0; z-index: 1; background: inherit; gap: 2px; padding: 0 4px 0 2px; cursor: default; }
.item-name { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 4px; }
.item-name:hover { text-decoration: underline dotted; }
.item-name.big { font-size: 20px; font-weight: 600; white-space: normal; padding: 0; }
.drag { cursor: grab; color: var(--muted); opacity: 0; padding: 0 4px; font-size: 11px; letter-spacing: -2px; }
.row:hover .drag { opacity: .8; }
.sub-toggle { font-size: 11px; width: 30px; } .sub-toggle small { margin-left: 2px; }
.sub-toggle:not(.has) { opacity: .35; } .row:hover .sub-toggle { opacity: 1; }
.upd { opacity: .35; } .upd.has { opacity: 1; } .row:hover .upd { opacity: 1; }
.upd small { font-size: 10px; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 4px; margin-left: 2px; }
.cell.text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-input { width: 100%; min-height: 36px; border-radius: 0 !important; }
.name-input.big { font-size: 20px; font-weight: 600; }
.cell.status { justify-content: center; color: #fff; font-weight: 500; border-right-color: var(--bg); text-align: center; }
.cell.status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 1px #0003; }
.cell.status:hover { filter: brightness(1.1); }
.cell.tags { gap: 4px; justify-content: center; flex-wrap: nowrap; }
.tag { padding: 2px 8px; border-radius: 10px; color: #fff; font-size: 12px; white-space: nowrap; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; flex: none; margin-left: -4px; border: 2px solid var(--row); }
.avatar.empty { background: var(--panel2); color: var(--muted); }
.cell.date { justify-content: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.cell.date .due { font-size: 11px; } .cell.date.late .due { color: var(--danger); }
.cell.date.done span:not(.due) { text-decoration: line-through; color: var(--muted); }
.gcal-dot { font-size: 9px; font-weight: 800; background: #4285f4; color: #fff; border-radius: 3px; padding: 0 3px; }
.ph { color: var(--muted); opacity: 0; } .cell:hover .ph { opacity: 1; }
.chk { width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 4px; display: inline-grid; place-items: center; color: #fff; font-size: 13px; }
.chk.on { background: #00c875; border-color: #00c875; }
.cell.timeline { justify-content: center; }
.tl-bar { position: relative; width: 100%; height: 22px; border-radius: 11px; background: var(--empty); overflow: hidden; display: grid; place-items: center; font-size: 12px; color: #fff; }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); } .tl-bar span { position: relative; }
.add-row input, .add-card input { width: 100%; border: 0 !important; border-radius: 0 !important; background: var(--row) !important; padding: 9px 12px 9px 40px; border-bottom: 1px solid var(--line) !important; }
.add-row input::placeholder { color: var(--muted); }
.summary { min-height: 34px; }
.sum-cell { display: flex; align-items: center; justify-content: center; padding: 4px 6px; font-size: 12px; gap: 3px; }
.dist { display: flex; width: 100%; height: 22px; gap: 1px; border-radius: 2px; overflow: hidden; } .dist span { min-width: 4px; }
.range { background: var(--panel2); border-radius: 10px; padding: 3px 10px; white-space: nowrap; }
.sub-table { padding: 8px 0 12px 52px; background: var(--bg); }
.sub-table .grid { border-left-color: var(--line); }
.drag-ghost { opacity: .4; }
.empty-state { color: var(--muted); padding: 40px; text-align: center; } .empty-state.small { padding: 16px; }

/* ---------- schede mobile ---------- */
.cards { display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--gc); padding-left: 6px; }
.card, .k-card { background: var(--panel); border-radius: 8px; padding: 10px 12px; cursor: pointer; border: 1px solid var(--line); }
.card-top { display: flex; align-items: center; gap: 8px; }
.card-name { flex: 1; font-weight: 500; }
.card-status .cell { min-height: 26px; border-radius: 13px; padding: 0 12px; font-size: 12px; border: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.card-chips:empty { display: none; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.plain { background: var(--panel2); color: var(--text); }
.chip.date.late { color: #ff8a9a; }
.add-card input { padding-left: 12px; margin-top: 6px; border-radius: 8px !important; border: 1px dashed var(--line) !important; background: transparent !important; }

/* ---------- popover e menu ---------- */
.pop-bg { position: fixed; inset: 0; z-index: 50; }
.popover { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 40px #0008; padding: 8px; max-height: 80vh; overflow: auto; }
.popover.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: auto !important; border-radius: 16px 16px 0 0; max-height: 75vh; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.pop-bg:has(.sheet) { background: #0007; }
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu > button, .menu .opt { border: 0; background: none; text-align: left; padding: 7px 8px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.menu > button:hover:not(:disabled), .menu .opt:hover { background: var(--panel2); }
.menu > button.danger { color: var(--danger); } .menu > button:disabled { opacity: .35; cursor: default; }
.menu-title { font-size: 12px; color: var(--muted); padding: 4px 8px; text-transform: uppercase; letter-spacing: .04em; }
.menu-sub { font-size: 12px; color: var(--muted); padding: 2px 8px 6px; }
.menu-input { margin: 2px 2px 4px; font-weight: 600; }
.menu select { margin: 4px; }
.ticon { width: 22px; display: inline-block; text-align: center; color: var(--accent2); }
.num-set { display: flex; gap: 4px; padding: 4px; } .num-set input { width: 50%; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 4px 2px; }
.picker { display: flex; flex-direction: column; gap: 4px; }
.pill { border: 0; border-radius: 4px; padding: 8px; color: #fff; cursor: pointer; font-weight: 500; text-align: center; min-height: 34px; }
.pill.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.pill.empty { background: var(--panel2); color: var(--muted); }
.pill.small { padding: 3px 8px; min-height: 0; font-size: 12px; border-radius: 10px; }
.pill.dim { opacity: .45; }
.picker .search { margin-bottom: 4px; }
.opt { display: flex; align-items: center; gap: 8px; padding: 5px 4px; cursor: pointer; }
.label-editor { display: flex; flex-direction: column; gap: 6px; }
.le-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; } .le-row input { flex: 1; min-width: 80px; }
.swatch { width: 24px; height: 24px; border-radius: 5px; border: 2px solid transparent; cursor: pointer; flex: none; padding: 0; }
.swatch.sel { border-color: var(--text); }
.palette { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; width: 100%; padding: 6px 0; }
.palette.inline { grid-template-columns: repeat(11, 1fr); padding: 4px; } .palette.inline .swatch { width: 100%; aspect-ratio: 1; height: auto; }
.le-default { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.row-end { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.date-picker input { width: 100%; } .quick { display: flex; gap: 4px; } .date-picker label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.filter-menu .f-col { padding: 6px 8px; } .f-opts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ---------- pannello elemento ---------- */
.drawer-bg { position: fixed; inset: 0; z-index: 40; background: #0005; display: flex; justify-content: flex-end; }
.drawer { width: min(620px, 100%); height: 100%; background: var(--panel); display: flex; flex-direction: column; box-shadow: -10px 0 40px #0006; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 8px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); padding-top: max(16px, env(safe-area-inset-top)); }
.drawer-title { flex: 1; min-width: 0; } .crumb { color: var(--muted); display: block; }
.drawer-body { flex: 1; overflow: auto; padding: 14px 18px 40px; }
.fields { display: flex; flex-direction: column; gap: 2px; }
.field { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; min-height: 38px; }
.field label { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-val { background: var(--row); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.field-val .cell { border-right: 0; justify-content: flex-start; }
.field-val .cell.status, .field-val .cell.date { justify-content: center; }
.field-val .cell.text span { white-space: normal; padding: 8px 0; }
.field-val.muted { padding: 8px; }
.group-select { width: 100%; }
.drawer-subs h4 { margin: 18px 0 6px; font-size: 14px; color: var(--muted); }
.drawer-subs .sub-table { padding: 0; background: none; } .drawer-subs .grid-wrap, .drawer-subs .sub-table { overflow-x: auto; }
.composer { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.composer textarea { width: 100%; border: 0; border-radius: 0; resize: vertical; background: var(--row); }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 6px; background: var(--panel2); } .composer-bar .primary { margin-left: auto; }
.pending { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 13px; color: var(--text); text-decoration: none; margin: 3px 4px 0 0; }
.file-chip small { color: var(--muted); }
.update { background: var(--row); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.update header { display: flex; justify-content: space-between; align-items: center; }
.when { font-size: 12px; color: var(--muted); }
.upd-body { margin: 6px 0; word-wrap: break-word; }
.edit-upd { width: 100%; margin: 6px 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin: 8px 0; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; cursor: zoom-in; background: var(--panel2); }
.files-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.file-tile { background: var(--row); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.file-tile img, .file-big { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: grid; place-items: center; font-size: 40px; text-decoration: none; background: var(--panel2); cursor: pointer; }
.ft-name { font-size: 12.5px; padding: 6px 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-meta { font-size: 11px; color: var(--muted); padding: 2px 4px 6px 8px; display: flex; align-items: center; gap: 4px; } .ft-meta a { margin-left: auto; text-decoration: none; }
.loading { color: var(--muted); padding: 20px; }

/* ---------- modali ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 60; background: #000a; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; max-width: min(720px, 100%); width: 100%; max-height: 90vh; overflow: auto; }
.modal:has(.lightbox) { background: none; max-width: 100%; max-height: 100%; }
.modal-small { padding: 18px; } .modal-small h3 { margin-top: 0; }
.lightbox { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 6px; }
.lb-bar { display: flex; gap: 8px; align-items: center; color: #fff; }
.settings header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; } .settings h2 { margin: 0; font-size: 18px; }
.settings .tabs { padding: 0 20px; margin: 10px 0 0; }
.settings-body { padding: 18px 20px 22px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form > label:not(.opt) { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.form > label input, .form > label select { color: var(--text); }
.auto-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--row); padding: 10px; border-radius: 8px; border: 1px solid var(--line); }
.small-list { padding-left: 18px; font-size: 13px; } .small-list li { margin: 4px 0; }
.arch-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); } .arch-row span { flex: 1; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #00a35c; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 90; box-shadow: 0 6px 24px #0007; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ---------- calendario ---------- */
.cal-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; } .cal-bar h3 { margin: 0 6px; min-width: 150px; text-align: center; }
.cal-bar.wrap { flex-wrap: wrap; } .cal-bar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-dow { background: var(--panel); text-align: center; padding: 6px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 108px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; background: var(--row); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { opacity: .45; } .cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.dnum { font-size: 12px; color: var(--muted); align-self: flex-end; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .dnum { background: var(--accent); color: #fff; }
.cal-ev { font-size: 12px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--c) 28%, var(--row)); border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; color: var(--text); text-decoration: none; }
.cal-ev.ov { --c: #8a8fb5; font-style: italic; }
.cal-day .more { font-size: 11px; color: var(--muted); }
.cal-add { width: 100%; font-size: 12px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; } .dots i { width: 6px; height: 6px; border-radius: 50%; } .dots i.ov { background: #8a8fb5; }
.agenda { margin-top: 14px; background: var(--panel); border-radius: 8px; padding: 10px 14px; }
.agenda-head { display: flex; justify-content: space-between; align-items: center; } .agenda h4 { margin: 4px 0; }
.agenda-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--text); text-decoration: none; }
.agenda-item i { width: 10px; height: 10px; border-radius: 50%; flex: none; } .agenda-item.ov i { background: #8a8fb5; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.lane { width: 270px; flex: none; background: var(--panel); border-radius: 8px; overflow: hidden; }
.lane-head { padding: 9px 12px; color: #fff; font-weight: 600; display: flex; justify-content: space-between; }
.lane-body { padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.k-card { background: var(--row); }
.lane-add { margin: 0 8px 8px; width: calc(100% - 16px); }

/* ---------- grafico ---------- */
.chart-view { max-width: 860px; }
.bars { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 90px; align-items: center; gap: 10px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--muted); }
.bar-track { background: var(--panel); border-radius: 6px; height: 30px; overflow: hidden; } .bar { height: 100%; border-radius: 6px; transition: width .3s; }
.bar-val { font-weight: 600; }
.pie { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pie-total { font-size: 22px; font-weight: 700; fill: var(--text); } .pie-sub { font-size: 11px; fill: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.legend li { display: flex; align-items: center; gap: 8px; } .legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend b { margin-left: auto; padding-left: 16px; } .legend small { color: var(--muted); width: 36px; text-align: right; }

.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 30px; box-shadow: 0 6px 20px #0008; z-index: 20; cursor: pointer; }

/* ---------- telefono ---------- */
@media (max-width: 760px) {
  .only-mobile { display: inline-flex !important; }
  .sidebar { position: fixed; z-index: 45; inset: 0 auto 0 0; width: 82vw; max-width: 300px; transform: translateX(-105%); transition: transform .2s; box-shadow: 10px 0 40px #0008; padding-top: max(12px, env(safe-area-inset-top)); }
  .side-open .sidebar { transform: none; }
  .side-open::after { content: ''; position: fixed; inset: 0; background: #0006; z-index: 44; }
  .board-head { padding: max(10px, env(safe-area-inset-top)) 12px 4px; } .board-head h1 { font-size: 20px; flex: 1; }
  .tabs { padding: 0 8px; } .toolbar { padding: 8px 12px; } .toolbar > .btn.primary { display: none; }
  .tb-search { flex: 1; min-width: 120px; }
  .board-body { padding: 4px 10px 90px; }
  .section { margin: 12px 0 18px; }
  .drawer { width: 100%; }
  .field { grid-template-columns: 100px 1fr; }
  .cal-day { min-height: 54px; padding: 2px; align-items: center; } .dnum { align-self: center; }
  .bar-row { grid-template-columns: 90px 1fr 70px; }
  .modal-bg { padding: 0; align-items: end; } .modal { border-radius: 16px 16px 0 0; max-height: 92vh; }
  .modal:has(.lightbox) { align-self: center; }
  .lane { width: 82vw; }
  input, select, textarea { font-size: 16px; } /* evita lo zoom automatico su iPhone */
}
