/* CollHub - Bacheca, Archivio and Persone views. */

.muted { color: var(--muted); font-size: 13px; }
.nowrap { white-space: nowrap; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; min-width: 0; }
.input-color { height: 38px; padding: 3px; cursor: pointer; }
.doc-icon { font-size: 22px; color: var(--primary); --fa-secondary-opacity: .35; }
.doc-icon.fa-file-pdf { color: #c0392b; }
.doc-icon.fa-file-image { color: #7b5ea7; }
.doc-icon.fa-file-excel { color: #2e8b57; }
.doc-icon.fa-file-word { color: #3b6fd6; }

/* =========================================================== Bacheca */
.home-hello { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.home-hello h2 { margin: 0; font-size: 26px; font-family: var(--font-brand); }
.home-hello p { margin: 3px 0 0; color: var(--muted); }
.home-hello .btn { margin-left: auto; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { --c: var(--primary); display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 14px 16px; box-shadow: var(--shadow-sm); color: var(--ink); position: relative; overflow: hidden; }
a.stat:hover { text-decoration: none; border-color: var(--c); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.stat > i { font-size: 26px; color: var(--c); --fa-secondary-opacity: .3; }
.stat div { display: flex; flex-direction: column; min-width: 0; }
.stat b { font-size: 24px; line-height: 1.1; }
.stat span { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.stat small { color: var(--muted); font-size: 12px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.home-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.home-grid .card-body { padding: 8px 10px 10px; }
.home-events, .home-pending-list, .home-unread-list, .home-docs-list, .home-online-list { display: flex; flex-direction: column; gap: 4px; }
.home-ev { --c: var(--primary); display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius); color: var(--ink); border-left: 4px solid var(--c); background: var(--surface-2); }
.home-ev:hover { text-decoration: none; background: var(--primary-50); }
.home-ev.is-mine { background: color-mix(in srgb, var(--c) 9%, #fff); }
.home-ev.is-past { opacity: .55; }
.home-ev.is-live { box-shadow: 0 0 0 2px var(--success) inset; }
.home-ev-time { width: 64px; flex: 0 0 64px; font-weight: 700; display: flex; flex-direction: column; font-size: 13.5px; }
.home-ev-time small { color: var(--muted); font-weight: 500; }
.home-ev-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-ev-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-ev-main small { color: var(--muted); }
.home-ev-ppl { display: flex; }
.home-ev-ppl .avatar { margin-left: -5px; border: 2px solid #fff; }
.home-pend { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--warning-50); flex-wrap: wrap; }
.home-pend-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; color: var(--ink); }
.home-pend-main:hover { text-decoration: none; }
.home-pend-main small { color: var(--ink-2); }
.home-pend-actions { display: flex; gap: 6px; }
.home-ch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); }
.home-ch:hover { background: var(--surface-2); text-decoration: none; }
.home-ch-hash { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-50); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; }
.home-ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-ch-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-ch-count { background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; min-width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.home-doc { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--radius); }
.home-doc:hover { background: var(--surface-2); }
.home-doc span { min-width: 0; display: flex; flex-direction: column; }
.home-doc b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-doc small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius); }
.home-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-person small { color: var(--muted); }

/* =========================================================== Archivio */
.docs-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: start; }
.docs-side { padding: 10px; position: sticky; top: 0; }
.docs-side-group { display: flex; flex-direction: column; gap: 2px; }
.docs-side-title { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.docs-side-empty { color: var(--muted); font-size: 13px; padding: 6px 10px; }
.docs-nav { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 8px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.docs-nav > i { width: 18px; text-align: center; color: var(--primary); --fa-secondary-opacity: .35; }
.docs-nav > span:first-of-type { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-nav small { color: var(--muted); font-weight: 600; }
.docs-nav:hover { background: var(--surface-2); }
.docs-nav.is-active { background: var(--primary-50); color: var(--primary); }
.docs-folder > i { color: var(--warning); }
.docs-folder-actions { display: none; gap: 2px; }
.docs-folder:hover .docs-folder-actions, .docs-folder.is-active .docs-folder-actions { display: inline-flex; }
.docs-folder:hover small, .docs-folder.is-active small { display: none; }
.docs-folder-actions button { background: none; border: 0; color: var(--muted); padding: 2px 5px; border-radius: 5px; }
.docs-folder-actions button:hover { background: var(--surface); color: var(--ink); }
.docs-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.docs-search { flex: 1; min-width: 220px; position: relative; }
.docs-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.docs-search .input { padding-left: 34px; }
.docs-info { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; display: flex; gap: 8px; align-items: flex-start; }
.docs-info i { color: var(--primary); margin-top: 2px; }
.docs-drop { cursor: pointer; margin-bottom: 14px; padding: 14px; font-weight: 600; }
.docs-drop i { font-size: 18px; margin-right: 6px; }
.docs-drop.is-busy { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.docs-heading { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.docs-heading i { color: var(--primary); }
.docs-count { margin-left: auto; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.docs-table-wrap { overflow-x: auto; }
.docs-table { width: 100%; border-collapse: collapse; }
.docs-table th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 700; }
.docs-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table tbody tr:hover { background: var(--surface-2); }
.docs-table .num { text-align: right; }
.docs-table tr.is-new { animation: docflash 2.2s ease-out; }
@keyframes docflash { 0%, 30% { background: var(--success-50); } }
.docs-name { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.docs-name button { background: none; border: 0; padding: 0; font-weight: 600; color: var(--ink); text-align: left; }
.docs-name button:hover { color: var(--primary); text-decoration: underline; }
.docs-src { max-width: 230px; }
.docs-src a, .docs-src span { font-size: 13px; color: var(--ink-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.docs-src a:hover { color: var(--primary); }
.docs-src i { color: var(--primary); margin-right: 3px; }
.docs-who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13px; }
.docs-actions { white-space: nowrap; text-align: right; }
.docs-actions .btn + .btn { margin-left: 2px; }
.docs-actions .btn, .doc-card-actions .btn { padding: 5px 8px; }
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.doc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.doc-card.is-new { animation: docflash 2.2s ease-out; }
.doc-thumb { height: 120px; background: var(--surface-2); border: 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .doc-icon { font-size: 50px; }
.doc-card-body { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.doc-card-body b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-body small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-body .badge { align-self: flex-start; margin-top: 4px; }
.doc-card-actions { display: flex; gap: 4px; padding: 6px 10px 10px; }

/* =========================================================== Persone */
.people-banner { display: flex; gap: 12px; align-items: flex-start; background: var(--primary-50); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; color: var(--ink-2); }
.people-banner > i { font-size: 22px; color: var(--primary); margin-top: 2px; }
.people-banner .badge { margin-left: 4px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 26px; }
.person { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.person.is-inactive { opacity: .6; }
.person-top { display: flex; gap: 14px; align-items: center; }
.person-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.person-id b { font-size: 15.5px; }
.person-id > span:not(.badge) { color: var(--muted); font-size: 13px; }
.person-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.person-meta i { width: 16px; color: var(--muted); }
.person-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-on { color: var(--success); font-weight: 600; }
.person-on i { font-size: 8px; vertical-align: middle; width: auto !important; color: var(--success) !important; margin-right: 4px; }
.person-off { color: var(--muted); }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.people-teams-head .muted { margin-left: 4px; }
.page-head .badge i { font-size: 7px; }
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.team { padding: 14px 16px; border-top: 4px solid var(--c); }
.team-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.team-top div { display: flex; flex-direction: column; flex: 1; }
.team-top small { color: var(--muted); }
.team-members { display: flex; flex-wrap: wrap; gap: 6px; }
.team-member { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px 3px 3px; font-size: 12.5px; font-weight: 600; }

/* =========================================================== responsive */
@media (max-width: 1100px) {
    .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-side { position: static; }
    .docs-side-group { flex-direction: row; flex-wrap: wrap; }
    .docs-nav { width: auto; }
    .docs-table th:nth-child(3), .docs-table td:nth-child(3), .docs-table th:nth-child(5), .docs-table td:nth-child(5) { display: none; }
}
@media (max-width: 520px) {
    .home-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat { padding: 10px; gap: 10px; }
    .stat b { font-size: 20px; }
    .home-hello .btn { margin-left: 0; }
    .docs-table th:nth-child(2), .docs-table td:nth-child(2), .docs-table th:nth-child(4), .docs-table td:nth-child(4) { display: none; }
    .docs-name { min-width: 0; }
    .people-grid, .teams-grid { grid-template-columns: 1fr; }
}
