/* ============ ClickDown — stile applicazione ============ */
:root {
  --accent: #7b68ee;
  --accent-600: #6a57dd;
  --accent-soft: rgba(123, 104, 238, .12);
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-sub: #f0f1f6;
  --bg-hover: #eef0f5;
  --sidebar-bg: #1f2333;
  --sidebar-fg: #c9cdd8;
  --sidebar-hover: rgba(255,255,255,.07);
  --sidebar-active: rgba(123,104,238,.28);
  --fg: #1f2333;
  --fg-muted: #6b7280;
  --fg-faint: #9aa1b1;
  --border: #e3e5ec;
  --border-strong: #cfd3dd;
  --danger: #e8505b;
  --warn: #f7b731;
  --ok: #1dc39f;
  --info: #4f8df7;
  --shadow: 0 8px 30px rgba(20, 24, 40, .12);
  --shadow-sm: 0 2px 8px rgba(20, 24, 40, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --topbar-h: 52px;
  --sidebar-w: 264px;
}
:root[data-theme="dark"] {
  --bg: #141722;
  --bg-elev: #1c2030;
  --bg-sub: #20243a;
  --bg-hover: #262b42;
  --sidebar-bg: #0f1119;
  --sidebar-fg: #b5bac8;
  --fg: #e6e8ef;
  --fg-muted: #9aa1b5;
  --fg-faint: #6b7287;
  --border: #2a2f45;
  --border-strong: #3a4060;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; }
::placeholder { color: var(--fg-faint); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input, textarea, select { outline: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--bg-sub); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--bg-sub); padding: 10px; border-radius: 8px; overflow: auto; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Boot / Auth ---------- */
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% 0%, rgba(123,104,238,.25), transparent), radial-gradient(900px 500px at 100% 100%, rgba(79,141,247,.25), transparent), var(--bg); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--bg-elev); border-radius: 16px; padding: 34px 32px; box-shadow: var(--shadow); }
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.auth-sub { color: var(--fg-muted); margin-bottom: 24px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 6px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--fg-muted); font-size: 13px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: 100vh; height: 100vh; }
.app.sidebar-collapsed { grid-template-columns: 0 1fr; }
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-fg); display: flex; flex-direction: column; overflow: hidden; transition: width .2s; min-width: 0; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-elev); flex-shrink: 0; }
.content { flex: 1; overflow: auto; position: relative; }
.page { padding: 20px 24px; max-width: 1400px; }
.page-wide { padding: 0; height: 100%; display: flex; flex-direction: column; }

/* Sidebar */
.sb-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px; }
.sb-ws { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; flex: 1; min-width: 0; color: #fff; font-weight: 700; }
.sb-ws:hover { background: var(--sidebar-hover); }
.sb-ws .ws-badge { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; color: #fff; flex-shrink: 0; }
.sb-ws .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-nav { padding: 4px 8px; }
.sb-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--sidebar-fg); font-weight: 500; cursor: pointer; user-select: none; width: 100%; text-align: left; position: relative; }
.sb-item:hover { background: var(--sidebar-hover); color: #fff; }
.sb-item.active { background: var(--sidebar-active); color: #fff; }
.sb-item .ico { width: 18px; text-align: center; opacity: .85; flex-shrink: 0; display: inline-flex; justify-content: center; }
.sb-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item .cnt { font-size: 11px; opacity: .6; }
.sb-item .badge { background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.sb-item .more { opacity: 0; padding: 2px 4px; border-radius: 4px; }
.sb-item:hover .more { opacity: .8; }
.sb-item .more:hover { background: rgba(255,255,255,.15); opacity: 1; }
.sb-section { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.45); font-weight: 700; }
.sb-section button { color: inherit; opacity: .7; padding: 2px 4px; border-radius: 4px; }
.sb-section button:hover { background: var(--sidebar-hover); opacity: 1; }
.sb-scroll { flex: 1; overflow: auto; padding-bottom: 20px; }
.sb-tree .sb-item { padding-left: 10px; }
.sb-tree .lvl1 { padding-left: 26px; }
.sb-tree .lvl2 { padding-left: 42px; }
.sb-tree .chev { width: 14px; font-size: 10px; opacity: .6; transition: transform .15s; display: inline-block; }
.sb-tree .open > .sb-item .chev { transform: rotate(90deg); }
.sb-tree .children { display: none; }
.sb-tree .open > .children { display: block; }
.space-dot { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }
.sb-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.sb-foot .sb-item { flex: 1; }
.sidebar .empty-hint { padding: 8px 18px; font-size: 12px; opacity: .5; }

/* Topbar */
.tb-toggle { padding: 6px 8px; border-radius: 6px; color: var(--fg-muted); }
.tb-toggle:hover { background: var(--bg-hover); color: var(--fg); }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--fg-muted); font-size: 13px; min-width: 0; flex: 1; }
.crumbs a { color: var(--fg-muted); white-space: nowrap; }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--fg); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search { display: flex; align-items: center; gap: 8px; background: var(--bg-sub); border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; width: 280px; color: var(--fg-muted); cursor: text; }
.tb-search:hover, .tb-search:focus-within { border-color: var(--border-strong); background: var(--bg-elev); }
.tb-search input { border: 0; background: transparent; flex: 1; min-width: 0; }
.tb-search kbd { font-size: 10px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--fg-faint); }
.tb-actions { display: flex; align-items: center; gap: 6px; }
.tb-btn { position: relative; padding: 6px 8px; border-radius: 7px; color: var(--fg-muted); display: inline-flex; align-items: center; gap: 6px; }
.tb-btn:hover { background: var(--bg-hover); color: var(--fg); }
.tb-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; display: grid; place-items: center; }
.timer-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 5px 10px; font-weight: 600; font-variant-numeric: tabular-nums; max-width: 260px; }
.timer-chip .t-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--fg); font-size: 13px; }
.timer-chip button { color: var(--danger); font-weight: 700; }

/* ---------- Componenti ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--fg); font-weight: 600; font-size: 13px; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--fg-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--fg); border-color: transparent; }
.btn-sm { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 6px; border-radius: 6px; color: var(--fg-muted); display: inline-flex; }
.btn-icon:hover { background: var(--bg-hover); color: var(--fg); }
.btn-group { display: inline-flex; gap: 4px; }

.field label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-muted); margin-bottom: 5px; }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=number], .field input[type=date], .field input[type=datetime-local], .field select, .field textarea, textarea.input, select.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); color: var(--fg); font-size: 14px;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { min-height: 80px; resize: vertical; }
.field + .field { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.small { font-size: 12px; }
.bold { font-weight: 700; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-1 { flex: 1; }
.wrap { flex-wrap: wrap; }
.ml-auto { margin-left: auto; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.empty { text-align: center; color: var(--fg-muted); padding: 50px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .03em; color: #fff; text-transform: uppercase; white-space: nowrap; cursor: pointer; }
.status-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; cursor: pointer; }
.prio-flag { width: 14px; height: 14px; display: inline-block; }
.prio-1 { color: #e8505b; } .prio-2 { color: #f7b731; } .prio-3 { color: #4f8df7; } .prio-4 { color: #87909e; } .prio-0 { color: var(--fg-faint); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex-shrink: 0; letter-spacing: .02em; border: 2px solid var(--bg-elev); }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.avatar.sm { width: 20px; height: 20px; font-size: 8px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -8px; }
.avatar.empty-av { background: transparent; border: 1px dashed var(--border-strong); color: var(--fg-faint); }
.due { font-size: 12px; color: var(--fg-muted); white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }
.progress { height: 6px; background: var(--bg-sub); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); border-radius: 4px; transition: width .3s; }
.checkbox { width: 16px; height: 16px; border: 1.5px solid var(--border-strong); border-radius: 4px; display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; background: var(--bg-elev); }
.checkbox.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.checkbox.on::after { content: "✓"; font-size: 11px; font-weight: 800; }
.kbd { font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--fg-muted); }
.icon { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; }
.icon.lg { width: 20px; height: 20px; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.color-swatches span { width: 22px; height: 22px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.color-swatches span.on { border-color: var(--fg); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 8px 12px; color: var(--fg-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--fg); }
.toggle { position: relative; width: 36px; height: 20px; background: var(--border-strong); border-radius: 10px; cursor: pointer; transition: background .15s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 18px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 700; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--bg-sub); }

/* Modali */
.modal-back { position: fixed; inset: 0; background: rgba(15, 18, 30, .55); display: grid; place-items: center; z-index: 100; animation: fade .12s; padding: 20px; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg-elev); border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: pop .15s; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.modal-foot .left { margin-right: auto; }

/* Popover / menu */
.popover { position: fixed; z-index: 200; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 200px; max-width: 360px; max-height: 70vh; overflow: auto; padding: 6px; animation: pop .12s; }
.popover .menu-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; width: 100%; text-align: left; font-weight: 500; color: var(--fg); }
.popover .menu-item:hover { background: var(--bg-hover); }
.popover .menu-item.danger { color: var(--danger); }
.popover .menu-item.on { background: var(--accent-soft); }
.popover .menu-item .ico { width: 18px; display: inline-flex; justify-content: center; color: var(--fg-muted); }
.popover .menu-sep { height: 1px; background: var(--border); margin: 5px 0; }
.popover .menu-title { font-size: 11px; text-transform: uppercase; color: var(--fg-faint); padding: 6px 10px 2px; font-weight: 700; letter-spacing: .05em; }
.popover .search { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 8px 10px; background: transparent; margin-bottom: 4px; }
.popover .pop-pad { padding: 8px; }
.popover .mi-check { margin-left: auto; color: var(--accent); font-weight: 800; }

/* Toast */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 500; }
.toast { background: #1f2333; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 500; display: flex; align-items: center; gap: 10px; animation: pop .15s; max-width: 360px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.toast button { color: #fff; opacity: .8; font-weight: 700; }

/* ---------- Pagina lista / viste ---------- */
.view-head { padding: 14px 24px 0; background: var(--bg-elev); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.view-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.view-title h1 { font-size: 20px; }
.view-title h1[contenteditable]:focus { outline: 2px solid var(--accent-soft); border-radius: 4px; }
.view-tabs { display: flex; align-items: center; gap: 2px; }
.view-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--fg-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 6px 6px 0 0; }
.view-tabs button:hover { color: var(--fg); background: var(--bg-sub); }
.view-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.view-tools { display: flex; align-items: center; gap: 6px; padding: 8px 24px; border-bottom: 1px solid var(--border); background: var(--bg-elev); flex-wrap: wrap; flex-shrink: 0; }
.view-tools .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.view-tools .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.view-body { flex: 1; overflow: auto; padding: 14px 24px 60px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12px; }
.filter-chip button { color: inherit; font-weight: 800; }

/* Vista Lista */
.group { margin-bottom: 18px; }
.group-head { display: flex; align-items: center; gap: 10px; padding: 6px 0; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.group-head .status-pill { font-size: 11px; }
.group-head .cnt { color: var(--fg-muted); font-size: 12px; font-weight: 600; }
.group-head .chev { font-size: 11px; color: var(--fg-muted); transition: transform .15s; cursor: pointer; width: 16px; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .group-rows, .group.collapsed .add-row { display: none; }
.trow { display: grid; grid-template-columns: 28px minmax(260px, 1fr) 110px 110px 90px 90px 60px; align-items: center; gap: 8px; padding: 0 8px; min-height: 38px; border-bottom: 1px solid var(--border); background: var(--bg-elev); cursor: pointer; }
.trow.has-cf { grid-template-columns: 28px minmax(260px, 1fr) 110px 110px 90px 90px 60px var(--cf-cols); }
.trow:first-child { border-radius: 8px 8px 0 0; }
.trow:last-child { border-radius: 0 0 8px 8px; }
.trow:hover { background: var(--bg-sub); }
.trow.selected { background: var(--accent-soft); }
.trow.dragging { opacity: .4; }
.trow.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.trow.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.trow.sub { padding-left: 32px; }
.trow .t-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.trow .t-title .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.trow .t-title .txt[contenteditable]:focus { outline: 1px solid var(--accent); border-radius: 3px; padding: 0 3px; white-space: normal; }
.trow .t-key { font-size: 11px; color: var(--fg-faint); font-weight: 600; }
.trow .meta { display: inline-flex; gap: 8px; align-items: center; font-size: 11px; color: var(--fg-faint); }
.trow .meta span { display: inline-flex; align-items: center; gap: 3px; }
.trow .sub-toggle { font-size: 10px; color: var(--fg-muted); width: 16px; height: 16px; display: inline-grid; place-items: center; border-radius: 4px; }
.trow .sub-toggle:hover { background: var(--bg-hover); }
.trow .sub-toggle.open { transform: rotate(90deg); }
.trow .cell { font-size: 12px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .cell-cf { font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .cell-cf:hover { background: var(--bg-hover); }
.trow .cell-cf .faint { font-weight: 400; }
.thead { display: grid; grid-template-columns: 28px minmax(260px, 1fr) 110px 110px 90px 90px 60px; gap: 8px; padding: 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); font-weight: 700; margin-bottom: 4px; }
.thead.has-cf { grid-template-columns: 28px minmax(260px, 1fr) 110px 110px 90px 90px 60px var(--cf-cols); }
.thead span { padding: 4px 0; }
.add-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 36px; color: var(--fg-muted); cursor: text; border-radius: 0 0 8px 8px; }
.add-row:hover { color: var(--fg); background: var(--bg-sub); }
.add-row input { flex: 1; border: 0; background: transparent; font-size: 13px; padding: 4px 0; }
.title-inline-edit { border: 1px solid var(--accent); border-radius: 4px; padding: 2px 6px; background: var(--bg-elev); font: inherit; width: 100%; }
.bulk-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2333; color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; z-index: 50; animation: pop .15s; }
.bulk-bar .btn { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.2); }

/* Board */
.board { display: flex; gap: 14px; align-items: flex-start; height: 100%; padding-bottom: 10px; min-height: 400px; }
.bcol { width: 290px; flex: none; background: var(--bg-sub); border-radius: 10px; display: flex; flex-direction: column; max-height: 100%; border: 1px solid var(--border); }
.bcol.drop { background: var(--accent-soft); }
.bcol-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-top: 3px solid; border-radius: 10px 10px 0 0; }
.bcol-head .cnt { color: var(--fg-muted); font-weight: 600; }
.bcol-body { overflow: auto; padding: 6px 8px; flex: 1; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.bcard { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; }
.bcard:hover { border-color: var(--border-strong); }
.bcard.dragging { opacity: .4; }
.bcard .title { font-weight: 600; line-height: 1.35; word-break: break-word; }
.bcard .bc-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 11px; color: var(--fg-faint); }
.bcard .bc-foot .l { display: inline-flex; gap: 8px; align-items: center; }
.bcard .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.bcard .key { font-size: 10px; color: var(--fg-faint); font-weight: 700; }
.bcol .add-card { padding: 8px 12px; color: var(--fg-muted); font-weight: 600; font-size: 13px; text-align: left; border-radius: 0 0 10px 10px; }
.bcol .add-card:hover { background: var(--bg-hover); color: var(--fg); }
.bcol .add-card input { width: 100%; border: 1px solid var(--accent); border-radius: 6px; padding: 6px 8px; background: var(--bg-elev); }

/* Calendario */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cal-head h2 { font-size: 16px; text-transform: capitalize; min-width: 180px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-elev); }
.cal .dow { padding: 6px; text-align: center; font-size: 11px; text-transform: uppercase; color: var(--fg-faint); font-weight: 700; border-bottom: 1px solid var(--border); background: var(--bg-sub); }
.cal .day { min-height: 110px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: var(--bg-sub); opacity: .7; }
.cal .day.drop { background: var(--accent-soft); }
.cal .day .dn { font-size: 12px; font-weight: 700; color: var(--fg-muted); padding: 2px 4px; display: flex; justify-content: space-between; align-items: center; }
.cal .day.today .dn span { background: var(--accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cal .day .dn button { opacity: 0; color: var(--fg-muted); }
.cal .day:hover .dn button { opacity: 1; }
.cal-ev { font-size: 11px; padding: 2px 6px; border-radius: 4px; color: #fff; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; border-left: 3px solid rgba(0,0,0,.2); }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
.cal-ev.dragging { opacity: .4; }
.cal .more-ev { font-size: 11px; color: var(--fg-muted); padding: 0 6px; cursor: pointer; }

/* Gantt / timeline */
.gantt { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-elev); }
.gantt-left { border-right: 1px solid var(--border); }
.gantt-right { overflow-x: auto; }
.gantt-row { height: 36px; display: flex; align-items: center; border-bottom: 1px solid var(--border); font-size: 13px; padding: 0 10px; gap: 8px; }
.gantt-row .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-days { display: flex; height: 36px; border-bottom: 1px solid var(--border); }
.gantt-days > div { width: 34px; flex: none; text-align: center; font-size: 10px; color: var(--fg-faint); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: center; }
.gantt-days > div.we { background: var(--bg-sub); }
.gantt-days > div.today { color: var(--accent); font-weight: 800; }
.gantt-grid { position: relative; }
.gantt-line { position: relative; height: 36px; border-bottom: 1px solid var(--border); background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 34px 100%; }
.gantt-bar { position: absolute; top: 7px; height: 22px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow-sm); }
.gantt-bar .handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.gantt-bar .handle.l { left: 0; } .gantt-bar .handle.r { right: 0; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .6; z-index: 1; }

/* Tabella */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-elev); }
.tbl { border-collapse: collapse; min-width: 100%; }
.tbl th, .tbl td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.tbl th { background: var(--bg-sub); text-align: left; font-size: 11px; text-transform: uppercase; color: var(--fg-muted); position: sticky; top: 0; z-index: 1; }
.tbl td { cursor: pointer; }
.tbl tr:hover td { background: var(--bg-sub); }
.tbl td.title { font-weight: 600; min-width: 260px; white-space: normal; }

/* Workload */
.workload { display: grid; gap: 10px; }
.wl-row { display: grid; grid-template-columns: 220px 1fr 80px; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; }
.wl-bar { height: 14px; background: var(--bg-sub); border-radius: 7px; overflow: hidden; display: flex; }
.wl-bar > div { height: 100%; }

/* ---------- Task modal ---------- */
.task-modal { max-width: 1140px; height: calc(100vh - 40px); }
.task-modal .modal-body { padding: 0; display: grid; grid-template-columns: 1fr 340px; overflow: hidden; flex: 1; min-height: 0; }
.task-main { overflow: auto; padding: 20px 28px 40px; min-height: 0; }
.task-side { min-height: 0; }
.task-side { border-left: 1px solid var(--border); background: var(--bg-sub); overflow: auto; display: flex; flex-direction: column; }
.task-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--fg-muted); }
.task-top .crumb { display: inline-flex; align-items: center; gap: 4px; }
.task-title { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 10px 0 14px; padding: 4px 6px; margin-left: -6px; border-radius: 6px; word-break: break-word; }
.task-title:hover { background: var(--bg-sub); }
.task-title:focus { outline: 2px solid var(--accent-soft); background: var(--bg-elev); }
.task-title:empty::before { content: "Nome del task"; color: var(--fg-faint); }
.props { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 20px; }
.prop { display: flex; flex-direction: column; gap: 4px; }
.prop .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); font-weight: 700; }
.prop .v { min-height: 30px; display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin-left: -6px; border-radius: 6px; cursor: pointer; flex-wrap: wrap; }
.prop .v:hover { background: var(--bg-sub); }
.prop .v.empty-v { color: var(--fg-faint); }
.section-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin: 24px 0 8px; color: var(--fg); }
.section-h .ml-auto { margin-left: auto; }
.editor { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); }
.editor.borderless { border-color: transparent; }
.editor.borderless:hover { border-color: var(--border); }
.editor.borderless:focus-within { border-color: var(--border); }
.editor-toolbar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor-toolbar button { padding: 4px 7px; border-radius: 5px; color: var(--fg-muted); font-size: 13px; min-width: 28px; }
.editor-toolbar button:hover { background: var(--bg-hover); color: var(--fg); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 2px 4px; }
.editor-body { min-height: 90px; padding: 10px 12px; outline: none; line-height: 1.55; }
.editor-body.big { min-height: 400px; font-size: 15px; }
.editor-body:empty::before { content: attr(data-placeholder); color: var(--fg-faint); }
.editor-body p { margin: 0 0 .5em; }
.editor-body ul, .editor-body ol { margin: 0 0 .5em; padding-left: 1.5em; }
.editor-body h1 { font-size: 1.6em; margin: .6em 0 .3em; } .editor-body h2 { font-size: 1.3em; margin: .6em 0 .3em; } .editor-body h3 { font-size: 1.1em; margin: .5em 0 .3em; }
.editor-body blockquote { border-left: 3px solid var(--accent); margin: .5em 0; padding: 2px 12px; color: var(--fg-muted); }
.editor-body img { border-radius: 6px; max-height: 400px; }
.editor-body a { text-decoration: underline; }
.editor-body input[type=checkbox] { margin-right: 6px; }
.editor-body table { border-collapse: collapse; margin: .5em 0; } .editor-body td, .editor-body th { border: 1px solid var(--border); padding: 4px 8px; }
.editor-body .mention { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 4px; font-weight: 600; }
.rich { line-height: 1.55; word-break: break-word; }
.rich p { margin: 0 0 .4em; } .rich ul, .rich ol { margin: 0 0 .4em; padding-left: 1.4em; } .rich img { border-radius: 6px; max-height: 300px; }
.rich .mention { background: var(--accent-soft); color: var(--accent); padding: 0 4px; border-radius: 4px; font-weight: 600; }
.rich blockquote { border-left: 3px solid var(--accent); margin: .4em 0; padding: 2px 10px; color: var(--fg-muted); }
.rich table { border-collapse: collapse; } .rich td, .rich th { border: 1px solid var(--border); padding: 4px 8px; }
.subtask-list .trow { grid-template-columns: 28px 1fr 100px 90px 90px 30px; }
.cl { margin-bottom: 14px; }
.cl-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.cl-head .progress { width: 90px; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.cl-item .txt { flex: 1; }
.cl-item.done .txt { text-decoration: line-through; color: var(--fg-muted); }
.cl-item .del { opacity: 0; color: var(--fg-faint); }
.cl-item:hover .del { opacity: 1; }
.cl-add { display: flex; gap: 8px; align-items: center; padding: 3px 0 3px 24px; }
.cl-add input { flex: 1; border: 0; background: transparent; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.att { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-elev); position: relative; }
.att .thumb { height: 90px; display: grid; place-items: center; background: var(--bg-sub); font-size: 26px; overflow: hidden; }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att .nm { font-size: 12px; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.att .sz { font-size: 11px; color: var(--fg-faint); padding: 0 8px 6px; }
.att .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.5); color: #fff; border-radius: 4px; padding: 2px 6px; opacity: 0; }
.att:hover .del { opacity: 1; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--fg-muted); cursor: pointer; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.activity { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; flex: 1; }
.act { display: flex; gap: 10px; font-size: 12px; color: var(--fg-muted); align-items: flex-start; }
.act .avatar { margin-top: 1px; }
.act b { color: var(--fg); font-weight: 600; }
.act .when { color: var(--fg-faint); margin-left: auto; white-space: nowrap; font-size: 11px; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .body { flex: 1; min-width: 0; }
.comment .ch { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; }
.comment .ch b { color: var(--fg); }
.comment .ch .when { color: var(--fg-faint); }
.comment .ch .acts { margin-left: auto; opacity: 0; display: flex; gap: 2px; }
.comment:hover .ch .acts { opacity: 1; }
.comment.resolved { opacity: .6; }
.comment-box { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.comment-box .editor-body { min-height: 60px; }
.comment-box .send { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; align-items: center; }
.side-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.side-tabs button { flex: 1; padding: 10px; font-weight: 700; color: var(--fg-muted); border-bottom: 2px solid transparent; font-size: 13px; }
.side-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.side-scroll { flex: 1; overflow: auto; }
.time-entry { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.time-entry .dur { font-weight: 700; font-variant-numeric: tabular-nums; margin-left: auto; }
.dep { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 4px; background: var(--bg-elev); cursor: pointer; font-size: 13px; }
.dep .x { margin-left: auto; color: var(--fg-faint); }
.cf-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.cf-row .k { width: 130px; font-size: 12px; color: var(--fg-muted); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.cf-row .v { flex: 1; cursor: pointer; padding: 3px 6px; border-radius: 6px; min-height: 26px; display: flex; align-items: center; gap: 6px; }
.cf-row .v:hover { background: var(--bg-sub); }
.cf-row .v input, .cf-row .v select { width: 100%; border: 1px solid var(--accent); border-radius: 4px; padding: 3px 6px; background: var(--bg-elev); }
.rating { display: inline-flex; gap: 2px; }
.rating span { cursor: pointer; color: var(--border-strong); font-size: 16px; }
.rating span.on { color: var(--warn); }

/* ---------- Home / Inbox / Dashboard ---------- */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-grid .card h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.home-grid .card h3 .cnt { color: var(--fg-muted); font-weight: 600; font-size: 12px; }
.mini-task { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 6px; cursor: pointer; }
.mini-task:hover { background: var(--bg-sub); }
.mini-task .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mini-task .lst { font-size: 11px; color: var(--fg-faint); white-space: nowrap; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.notif:hover { background: var(--bg-sub); }
.notif.unread { background: var(--accent-soft); }
.notif .msg { flex: 1; font-size: 13px; line-height: 1.4; }
.notif .msg .t { display: block; font-size: 11px; color: var(--fg-faint); margin-top: 2px; }
.notif .ndot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.stat .n { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--fg-muted); font-weight: 600; margin-top: 4px; }
.stat.danger .n { color: var(--danger); }
.stat.ok .n { color: var(--ok); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.dash-grid .card h3 { font-size: 14px; margin-bottom: 12px; }
.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-chart .br { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; }
.bar-chart .br .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-chart .br .trk { height: 12px; background: var(--bg-sub); border-radius: 6px; overflow: hidden; }
.bar-chart .br .trk > div { height: 100%; border-radius: 6px; }
.bar-chart .br .n { text-align: right; font-weight: 700; color: var(--fg-muted); }
.donut { display: flex; align-items: center; gap: 20px; }
.donut svg { width: 140px; height: 140px; flex: none; }
.donut .leg { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.donut .leg span { display: flex; align-items: center; gap: 8px; }
.donut .leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sparkline { width: 100%; height: 90px; }
.goal { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.goal .gh { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.goal .gh h3 { font-size: 15px; flex: 1; }
.goal .pct { font-weight: 800; font-size: 18px; }
.goal .target { display: grid; grid-template-columns: 1fr 160px 60px 30px; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); font-size: 13px; }

/* Docs */
.docs-layout { display: grid; grid-template-columns: 260px 1fr; height: 100%; }
.docs-side { border-right: 1px solid var(--border); overflow: auto; padding: 12px; background: var(--bg-elev); }
.doc-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.doc-item:hover { background: var(--bg-sub); }
.doc-item.active { background: var(--accent-soft); color: var(--accent); }
.doc-item.child { padding-left: 26px; }
.doc-main { overflow: auto; padding: 30px 40px; }
.doc-title { font-size: 32px; font-weight: 800; border: 0; background: transparent; width: 100%; padding: 4px 0; margin-bottom: 8px; }
.doc-meta { color: var(--fg-faint); font-size: 12px; margin-bottom: 20px; display: flex; gap: 12px; align-items: center; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.settings-nav .sb-item { color: var(--fg-muted); }
.settings-nav .sb-item:hover { background: var(--bg-sub); color: var(--fg); }
.settings-nav .sb-item.active { background: var(--accent-soft); color: var(--accent); }
.status-edit { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.status-edit input[type=text] { flex: 1; }
.status-edit select { width: 120px; }
.status-edit .color-dot { width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 2px solid var(--border); flex: none; }
.status-edit .grip { cursor: grab; color: var(--fg-faint); }

/* Search palette */
.palette { max-width: 640px; align-self: start; margin-top: 8vh; }
.palette .modal-body { padding: 0; }
.palette input.big { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 16px 20px; font-size: 17px; background: transparent; }
.palette .results { max-height: 60vh; overflow: auto; padding: 8px; }
.palette .res { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette .res:hover, .palette .res.sel { background: var(--bg-sub); }
.palette .res .ico { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; background: var(--bg-sub); font-size: 13px; flex: none; }
.palette .res .txt { flex: 1; min-width: 0; }
.palette .res .txt small { display: block; color: var(--fg-faint); }

/* Context */
.ctx-hint { font-size: 12px; color: var(--fg-faint); margin-top: 4px; }
.date-pop { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.date-pop .quick { display: flex; flex-wrap: wrap; gap: 4px; }
.date-pop .quick button { padding: 4px 8px; border-radius: 6px; background: var(--bg-sub); font-size: 12px; font-weight: 600; }
.date-pop .quick button:hover { background: var(--bg-hover); }

/* Archivio file */
.files-layout { display: grid; grid-template-columns: 240px 1fr; height: 100%; min-height: 0; }
.files-side { border-right: 1px solid var(--border); overflow: auto; padding: 12px; background: var(--bg-elev); }
.files-main { overflow: auto; padding: 16px 24px 60px; position: relative; }
.files-main.drop::after { content: "Rilascia qui i file per caricarli nell'archivio"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); display: grid; place-items: center; font-weight: 700; color: var(--accent); pointer-events: none; }
.files-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.files-head .view-tabs { border-bottom: 0; }
.files-head select, .files-head input[type=search] { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--fg); font-size: 13px; }
.files-head input[type=search] { flex: 1; min-width: 160px; }
.files-head .count { white-space: nowrap; }
.files-crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--fg-muted); margin: 4px 0 12px; flex-wrap: wrap; }
.files-crumbs a { cursor: pointer; color: var(--fg-muted); }
.files-crumbs a:hover { color: var(--accent); }
.files-crumbs b { color: var(--fg); }
.fcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.fcard { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); cursor: pointer; font-weight: 600; font-size: 13px; }
.fcard:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.fcard .cnt { color: var(--fg-faint); font-weight: 500; font-size: 12px; }
.fcard .more { margin-left: auto; opacity: .5; }
.fcard .more:hover { opacity: 1; }
.ftree .doc-item { padding-right: 4px; }
.ftree .doc-item .more { opacity: 0; }
.ftree .doc-item:hover .more { opacity: .7; }
.att .meta { font-size: 11px; color: var(--fg-faint); padding: 0 8px 6px; display: flex; flex-direction: column; gap: 2px; }
.att .meta a { color: var(--accent); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .act { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.5); color: #fff; border-radius: 4px; padding: 2px 6px; opacity: 0; }
.att:hover .act { opacity: 1; }

@media (max-width: 900px) {
  .app { grid-template-columns: 0 1fr; }
  .app.sidebar-open { grid-template-columns: var(--sidebar-w) 1fr; }
  .app.sidebar-open .sidebar { position: fixed; z-index: 90; height: 100vh; width: var(--sidebar-w); box-shadow: var(--shadow); }
  .app.sidebar-open .main::before { content: ''; position: fixed; inset: 0; background: rgba(15, 18, 30, .4); z-index: 80; }
  .tb-search { width: auto; flex: 1; }
  .tb-search kbd { display: none; }
  /* Modali: a tutto schermo per il task, quasi a tutto schermo per le altre; mai più larghe dello schermo */
  .modal-back { padding: 0; }
  .modal { max-height: 100vh; min-width: 0; max-width: calc(100vw - 24px); }
  .task-modal { max-width: 100vw; height: 100vh; border-radius: 0; }
  .task-modal .modal-body { display: block; overflow: auto; }
  .task-main { overflow: visible; padding: 14px 16px 24px; }
  .task-side { display: flex; border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  .task-top { flex-wrap: wrap; row-gap: 6px; padding: 10px 12px; }
  .task-title { font-size: 20px; }
  .props { grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .home-grid, .docs-layout, .settings-layout, .files-layout { grid-template-columns: 1fr; }
  .files-side { border-right: 0; border-bottom: 1px solid var(--border); max-height: 40vh; }
  /* Vista Lista: titolo (a capo se serve), assegnatario e scadenza; via ID e contatori */
  .trow, .thead { grid-template-columns: 28px 1fr 60px 72px !important; }
  .trow > :nth-child(n+5), .thead > :nth-child(n+5) { display: none; }
  .trow .t-title { flex-wrap: wrap; row-gap: 2px; }
  .trow .t-title .txt { white-space: normal; flex: 1 1 100px; }
  .trow .t-title .t-key, .trow .t-title .meta { display: none; }
  .thead span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Intestazione viste: schede che scorrono in orizzontale, strumenti compatti */
  .view-head { padding: 10px 12px 0; }
  .view-tabs { overflow-x: auto; scrollbar-width: none; }
  .view-tabs::-webkit-scrollbar { display: none; }
  .view-tabs button { flex: none; }
  .view-tools { padding: 8px 12px; gap: 6px; }
  .view-tools .sep { display: none; }
  .view-tools .tb-search { width: 100% !important; }
  .view-body { padding: 10px 12px 60px; }
  .page { padding: 14px; }
  /* Bacheca: una colonna per schermata con scorrimento a scatti */
  .board { scroll-snap-type: x mandatory; gap: 10px; }
  .bcol { width: 84vw; scroll-snap-align: start; }
  /* Calendario e Gantt */
  .cal .day { min-height: 64px; }
  .cal-hint { display: none; }
  .gantt { grid-template-columns: 150px 1fr; }
  /* Home e Dashboard: contatori su due colonne */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .n { font-size: 24px; }
}
@media print { .sidebar, .topbar, .view-tools { display: none !important; } .app { grid-template-columns: 1fr; } }
