/** 
 * Projects - VIEMME Design System
 */

:root {
    --bg: #0b0f14;
    --panel: rgba(255,255,255,0.06);
    --panel-strong: rgba(255,255,255,0.1);
    --text: #e8edf2;
    --muted: #a9b6c6;
    --brand: #ff7f00;
    --brand-2: #7d5cff;
    --ring: rgba(255,255,255,0.12);
    --shadow: 0 10px 30px rgba(0,0,0,0.3);
    --radius: 16px;
    --radius-sm: 12px;
    --maxw: 1200px;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 90% -10%, rgba(255,127,0,0.09), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(125,92,255,0.12), transparent 60%),
        var(--bg);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: none; }
a:hover { opacity: 0.9; }

.wrap {
    max-width: var(--maxw);
    margin-inline: auto;
    padding: 0 24px;
}

h1, h2, h3 { margin: 0 0 12px; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }

.muted { color: var(--muted); }
.sm { font-size: 0.85rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* HEADER */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(to bottom, rgba(11,15,20,0.9), rgba(11,15,20,0.6));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ring);
}

.header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #ffb266);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: #111;
}

.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); font-size: 0.9rem; }
.nav a:hover, .nav a.active { color: var(--text); }

/* Nav dropdown groups (Finance ▾, Admin ▾) */
.nav-group { position: relative; display: inline-flex; }
.nav-group > .nav-parent::after { content: ' ▾'; font-size: 0.7em; opacity: 0.7; }
.nav-parent {
    appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
    font: inherit; font-size: 0.9rem; color: var(--muted);
}
.nav-parent:hover, .nav-parent.active, .nav-group.open > .nav-parent { color: var(--text); }
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: -12px;
    display: none;
    flex-direction: column;
    min-width: 150px;
    padding: 6px 0;
    background: var(--panel, #12161c);
    border: 1px solid var(--ring);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.45);
    z-index: 60;
}
@media (hover: hover) { .nav-group:hover .nav-dropdown { display: flex; } }
.nav-group.open .nav-dropdown { display: flex; }
/* ponte invisibile fra voce e tendina, così il passaggio del mouse non la chiude */
.nav-dropdown::before { content: ''; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.nav-dropdown-right { left: auto; right: 0; }
.nav-dropdown form { margin: 0; }
.nav-dropdown-item {
    appearance: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
    font: inherit; font-size: 0.9rem; color: var(--muted); padding: 8px 14px;
}
.nav-dropdown-item:hover { background: rgba(255,127,0,0.08); color: var(--text); }
.nav-dropdown a { padding: 8px 14px; white-space: nowrap; color: var(--muted); font-size: 0.9rem; }
.nav-dropdown a:hover, .nav-dropdown a.active { color: var(--text); }
.nav-dropdown a:hover { background: rgba(255,127,0,0.08); }

.user-menu { display: flex; align-items: center; gap: 16px; }

.header-clock {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,127,0,0.12);
    border: 1px solid rgba(255,127,0,0.35);
    letter-spacing: 0.5px;
}
.user-name {
    color: var(--muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* CARDS */
.card {
    background: var(--panel);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ring);
    background: var(--panel-strong);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.1s;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.brand {
    background: linear-gradient(135deg, var(--brand), #ffb266);
    color: #111;
    border-color: transparent;
    font-weight: 600;
}

.btn.danger {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

.btn.sm { padding: 6px 10px; font-size: 0.8rem; }
.btn.icon { padding: 6px 10px; font-size: 1rem; line-height: 1; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.form-input, select.form-input, textarea.form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ring);
    background: rgba(0,0,0,0.25);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--brand); }
.form-input option, select.form-input option {
    background-color: #14181f;
    color: var(--text);
}
textarea.form-input { resize: vertical; }
.form-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* PILLS */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--panel-strong);
    border: 1px solid var(--ring);
    font-size: 0.75rem;
}
.pill.sm { font-size: 0.7rem; padding: 2px 8px; }
.pill.orange { background: rgba(255,127,0,0.18); color: #ffb266; border-color: rgba(255,127,0,0.4); }
.pill.purple { background: rgba(125,92,255,0.18); color: #b8a7ff; border-color: rgba(125,92,255,0.4); }
.pill.green { background: rgba(34,197,94,0.18); color: #86efac; border-color: rgba(34,197,94,0.4); }

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ring);
}
.alert.danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.4); color: #fca5a5; }
.alert.info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.4); color: #93c5fd; }

/* LOGIN */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card { max-width: 420px; width: 100%; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { width: 56px; height: 56px; font-size: 28px; margin: 0 auto 16px; }
.login-logo h1 { margin: 0; }
.login-logo p { color: var(--muted); margin: 4px 0 0; font-size: 0.9rem; }

/* PAGE HEADER */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

/* BACK LINK */
.back-link {
    display: inline-block;
    color: var(--muted);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* DATA TABLE */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 8px;
    border-bottom: 1px solid var(--ring);
}
.data-table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.data-table tr:last-child td { border-bottom: 0; }

/* MODALS */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-content {
    background: #14181f;
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow);
}

/* MY WEEK */
.myweek-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.myweek-nav, .myweek-view-toggle { display: flex; gap: 6px; }
.myweek-user-picker { display: flex; align-items: center; gap: 8px; }
.myweek-user-picker select { width: auto; min-width: 180px; }

.myweek-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.myweek-cal-head {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
}
.myweek-cell {
    background: rgba(0,0,0,0.22);
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.myweek-cell.out { opacity: 0.35; }
.myweek-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.myweek-cell-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.myweek-cell-date { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.myweek-cell-total {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--brand);
    font-weight: 600;
    font-size: 0.78rem;
}
.myweek-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    padding: 2px 0;
}
.myweek-entry-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.myweek-entry-hours {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--muted);
    font-size: 0.72rem;
    flex-shrink: 0;
}
.myweek-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

/* Month view: smaller cells */
.myweek-cal-month .myweek-cell {
    min-height: 70px;
    padding: 6px 8px;
}
.myweek-cal-month .myweek-entry { font-size: 0.72rem; }

.myweek-bars {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.myweek-bar-row {
    display: grid;
    grid-template-columns: minmax(180px, 280px) 1fr 80px;
    gap: 12px;
    align-items: center;
}
.myweek-bar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.myweek-bar-label a { color: var(--text); }
.myweek-bar-track {
    background: rgba(0,0,0,0.3);
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
}
.myweek-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s;
}
.myweek-bar-value {
    text-align: right;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: var(--brand);
    font-weight: 600;
}

@media (max-width: 900px) {
    .myweek-cal { grid-template-columns: repeat(1, 1fr); }
    .myweek-cal-head { display: none; }
    .myweek-bar-row { grid-template-columns: 1fr 1fr 70px; }
}

/* FINANCE — modal line forms (revenue/cost item add row) */
.pf-line-form {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: end;
}
.pf-line-form > div { flex: 1 1 140px; min-width: 120px; }
.pf-line-form > div:first-of-type { flex: 2 1 200px; }
.pf-line-form > button { flex: 0 0 auto; align-self: end; height: 40px; }

/* FINANCE / KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--panel);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.kpi-card.positive { border-left: 4px solid var(--success); }
.kpi-card.negative { border-left: 4px solid var(--danger); }
.kpi-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.kpi-sub { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.margin-row { cursor: pointer; }
.margin-row:hover { background: rgba(255,255,255,0.03); }
.margin-pos { color: #86efac; }
.margin-neg { color: #fca5a5; }

/* TASK CHOOSER */
.chooser-list {
    margin: 12px 0 4px;
    max-height: 360px;
    overflow-y: auto;
}
.chooser-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.18);
    cursor: pointer;
}
.chooser-item:last-child { margin-bottom: 0; }
.chooser-item:hover { border-color: var(--brand); }
.chooser-item input[type=radio] { accent-color: var(--brand); flex-shrink: 0; }
.chooser-item > span { flex: 1; }

/* STATUS BOARD */
.status-board { display: flex; flex-direction: column; gap: 16px; }
.status-card { margin-bottom: 0; }
.status-card-head { margin-bottom: 12px; }
.status-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 1.1rem;
    font-weight: 600;
}
.status-card-title a { color: var(--text); }
.status-card-meta { margin-top: 4px; }

.status-current {
    background: rgba(0,0,0,0.22);
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 12px;
}
.status-note-text { white-space: pre-wrap; }

.status-history {
    border-left: 2px solid var(--ring);
    margin: 8px 0 12px 6px;
    padding-left: 14px;
}
.status-history-item {
    padding: 8px 0;
    border-bottom: 1px dashed var(--ring);
}
.status-history-item:last-child { border-bottom: 0; }
.status-history-toggle { color: var(--brand); }

.status-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.status-add-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.form-checkbox.sm { font-size: 0.8rem; color: var(--muted); }

/* Status line under project title (project view) */
.project-status-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.status-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255,127,0,0.16);
    color: #ffb266;
    border: 1px solid rgba(255,127,0,0.35);
    font-size: 0.75rem;
    font-weight: 600;
}

/* DASHBOARD TOOLBAR */
.dashboard-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.dashboard-toolbar .form-input {
    max-width: 480px;
}

/* PROJECT CLUSTERS */
.project-cluster {
    margin-bottom: 32px;
}
.cluster-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ring);
}
.cluster-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1rem;
}
.cluster-header h2 .status-badge { font-size: 0.85rem; padding: 4px 14px; }
.cluster-count { font-weight: 400; }

/* PROJECT GRID */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.project-card {
    display: block;
    background: var(--panel);
    border: 1px solid var(--ring);
    border-left: 4px solid var(--info);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.project-card.status-done { border-left-color: var(--success); }
.project-card.status-late { border-left-color: var(--danger); }
.project-card.status-progress { border-left-color: var(--info); }

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.project-card h3 { margin: 0; font-size: 1.05rem; }

/* STATUS BADGE */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59,130,246,0.18);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.4);
}
.status-badge.status-done {
    background: rgba(34,197,94,0.18);
    color: #86efac;
    border-color: rgba(34,197,94,0.4);
}
.status-badge.status-late {
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.4);
}

/* PROGRESS BAR */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}
.progress-fill {
    height: 100%;
    background: var(--info);
    transition: width 0.3s;
}
.progress-fill.status-done { background: var(--success); }
.progress-fill.status-late { background: var(--danger); }
.progress-fill.status-progress { background: var(--info); }

.progress-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.8rem;
}

/* PROJECT HEADER (single project view) */
.project-header { padding: 28px; }
.status-done-border { border-left: 5px solid var(--success); }
.status-late-border { border-left: 5px solid var(--danger); }
.status-progress-border { border-left: 5px solid var(--info); }

.project-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.project-status { text-align: right; }

.working-on {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 20px;
}
.workers-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}
.workers-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--ring);
}
.workers-list li:last-child { border-bottom: 0; }

.timer {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--brand);
    font-weight: 600;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--ring);
    border-bottom: 1px solid var(--ring);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.project-description { margin-top: 16px; }
.project-description p { color: var(--muted); margin: 0; }

/* TASKS */
.add-task-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.add-task-form .form-input { flex: 1; }

.task-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.task-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--ring);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.task-item.done { opacity: 0.7; }
.task-item.done .task-title { text-decoration: line-through; }
.task-item.generic {
    border-style: dashed;
    background: rgba(125,92,255,0.06);
}
.task-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--brand-2);
    font-size: 14px;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.task-check {
    width: 20px;
    height: 20px;
    accent-color: var(--brand);
    cursor: pointer;
    flex-shrink: 0;
}
.task-title-block { flex: 1; min-width: 0; }
.task-title { font-weight: 500; }
.task-actions { display: flex; gap: 6px; flex-shrink: 0; }

.task-notes {
    list-style: none;
    margin: 12px 0 0;
    padding: 0 0 0 32px;
    border-left: 2px solid var(--ring);
    margin-left: 10px;
}
.task-notes li {
    padding: 8px 0 8px 12px;
    font-size: 0.85rem;
}
.note-type {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    background: var(--panel-strong);
    margin-right: 6px;
    text-transform: uppercase;
}
.note-type.note-release { background: rgba(245,158,11,0.18); color: #fcd34d; }
.note-type.note-done { background: rgba(34,197,94,0.18); color: #86efac; }
.note-type.note-comment { background: rgba(125,92,255,0.18); color: #b8a7ff; }
.note-type.note-assign { background: rgba(255,127,0,0.18); color: #ffb266; }

/* Visible project id (#12) shown before project names */
.proj-id {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.82em;
    color: var(--muted);
    opacity: 0.85;
    margin-right: 2px;
}

.task-add-note {
    margin-top: 10px;
    padding-left: 32px;
}
.task-add-note input {
    width: 100%;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--ring);
    background: rgba(0,0,0,0.25);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
}
.task-add-note input:focus { outline: none; border-color: var(--brand); }

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.chart-wrap {
    position: relative;
    height: 300px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--muted);
}
.legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.dot.starting { background: #94a3b8; }
.dot.progress { background: var(--info); }
.dot.late { background: var(--danger); }
.dot.done_ontime { background: var(--success); }
.dot.done_late { background: var(--warning); }

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--ring);
}
.timeline-item {
    position: relative;
    padding: 12px 0 12px 36px;
}
.timeline-dot {
    position: absolute;
    left: 4px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--info);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 2px var(--ring);
}
.tl-starting .timeline-dot { background: #94a3b8; }
.tl-progress .timeline-dot { background: var(--info); }
.tl-late .timeline-dot { background: var(--danger); }
.tl-done_ontime .timeline-dot { background: var(--success); }
.tl-done_late .timeline-dot { background: var(--warning); }

.timeline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}
.timeline-name { font-weight: 600; }

.tl-badge-starting { background: rgba(148,163,184,0.18); color: #cbd5e1; border-color: rgba(148,163,184,0.4); }
.tl-badge-progress { background: rgba(59,130,246,0.18); color: #93c5fd; border-color: rgba(59,130,246,0.4); }
.tl-badge-late { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.4); }
.tl-badge-done_ontime { background: rgba(34,197,94,0.18); color: #86efac; border-color: rgba(34,197,94,0.4); }
.tl-badge-done_late { background: rgba(245,158,11,0.18); color: #fcd34d; border-color: rgba(245,158,11,0.4); }

.tl-fill-starting { background: #94a3b8; }
.tl-fill-progress { background: var(--info); }
.tl-fill-late { background: var(--danger); }
.tl-fill-done_ontime { background: var(--success); }
.tl-fill-done_late { background: var(--warning); }

/* WORKING NOW ICON */
.working-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(34,197,94,0.18);
    border: 1px solid rgba(34,197,94,0.4);
    font-size: 0.75rem;
    vertical-align: middle;
}
.working-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,0.7);
    animation: pulse 1.6s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* PRIVATE PILL */
.private-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(239,68,68,0.18);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.4);
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* TIME PILL */
.time-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255,127,0,0.15);
    color: #ffb266;
    border: 1px solid rgba(255,127,0,0.35);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    vertical-align: middle;
    white-space: nowrap;
}

/* SESSION LOG */
.session-log {
    list-style: none;
    margin: 0;
    padding: 0;
}
.session-log li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--ring);
    font-size: 0.9rem;
}
.session-log li:last-child { border-bottom: 0; }
.session-duration {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--brand);
    font-weight: 600;
}

@media (max-width: 720px) {
    .header .wrap { flex-wrap: wrap; height: auto; padding: 12px 16px; }
    .nav { order: 3; width: 100%; flex-wrap: wrap; gap: 12px 18px; }
    .project-title-row { flex-direction: column; }
    .project-status { text-align: left; }
}

/* QUICK FILTERS (dashboard) */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.quick-filters-sep {
    width: 1px;
    height: 20px;
    background: var(--ring);
    margin: 0 4px;
}
.chip {
    appearance: none;
    border: 1px solid var(--ring);
    background: var(--panel);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--brand); }
.chip.active {
    background: rgba(255,127,0,0.18);
    border-color: var(--brand);
    color: #ffb266;
    font-weight: 600;
}
.chip-clear { border-style: dashed; }

/* NAV BADGE (pending approvals) */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--brand);
    color: #1a1005;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

.pill.red { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.4); }

/* TIME OFF */
.leave-type-toggle { display: flex; flex-direction: column; gap: 8px; }
.leave-fields-row { display: flex; flex-wrap: wrap; gap: 16px; }
.leave-fields-row > .form-group { flex: 1 1 180px; min-width: 150px; }
.leave-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.leave-filters .form-input { width: auto; min-width: 170px; }
.leave-row-pending { background: rgba(255,127,0,0.06); }

/* MY WEEK — leave highlighting */
.myweek-cell.leave-vacation {
    background: rgba(125,92,255,0.14);
    border-color: rgba(125,92,255,0.45);
}
.myweek-cell.leave-permit {
    background: rgba(59,130,246,0.12);
    border-color: rgba(59,130,246,0.4);
}
.myweek-cell.leave-pending {
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.05) 0 6px,
        transparent 6px 12px
    );
    border-style: dashed;
}
.myweek-leave {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbb9ff;
    background: rgba(125,92,255,0.18);
    border-radius: 6px;
    padding: 2px 6px;
    margin-bottom: 4px;
}
.myweek-cell.leave-permit .myweek-leave { color: #a9cbff; background: rgba(59,130,246,0.18); }
.myweek-leave.pending { opacity: 0.75; }
.myweek-leave-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.myweek-leave-flag {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.8;
}
.myweek-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: -8px 0 20px;
}
.myweek-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.myweek-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid var(--ring);
    display: inline-block;
}
.myweek-legend-swatch.leave-vacation { background: rgba(125,92,255,0.35); border-color: rgba(125,92,255,0.6); }
.myweek-legend-swatch.leave-permit { background: rgba(59,130,246,0.3); border-color: rgba(59,130,246,0.55); }
.myweek-legend-swatch.leave-pending {
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.25) 0 4px, transparent 4px 8px);
    border-style: dashed;
}

/* ─────────── Aggiunte versione Node ─────────── */

/* Toast in pagina (notifiche) */
#toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 340px; }
.toast {
    background: #1d1d20; color: var(--text); border: 1px solid var(--brand); border-radius: 10px;
    padding: 12px 14px; box-shadow: 0 4px 16px rgba(0,0,0,.4); cursor: pointer; font-size: 14px;
}
.toast strong { display: block; margin-bottom: 4px; }
.toast span { opacity: .8; }

/* Pallino "live" (SSE connesso) accanto all'orologio */
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; display: inline-block; }
.live-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25); }

/* Lista checkbox scrollabile (collaboratori) */
.checkbox-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--ring); border-radius: 8px; padding: 8px; }

/* Bottone logout dentro un form nell'header */
/* Pulsante utente: nome sopra, ruolo sotto; apre Profile / Logout */
.user-button {
    appearance: none; cursor: pointer; font: inherit; color: var(--text);
    display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
    padding: 6px 12px; border-radius: var(--radius-sm);
    background: var(--panel); border: 1px solid var(--ring);
    line-height: 1.1;
}
.user-button:hover, .user-group.open .user-button, .user-button.active { border-color: var(--brand); }
.user-button-name { font-size: 0.9rem; font-weight: 600; }
.user-button .pill { font-size: 0.65rem; padding: 1px 7px; }
.user-group .nav-dropdown { top: calc(100% + 6px); min-width: 160px; }

/* Login: rete animata sullo sfondo, card leggibile sopra */
#network-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.login-page .login-container { position: relative; z-index: 1; }
.login-page .login-card { background: rgba(14, 18, 24, 0.82); backdrop-filter: blur(6px); }

/* Logo: "by VIEMME" accanto al nome, versione sotto */
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-title { font-weight: 700; }
.logo-by { font-weight: 500; font-size: 0.72rem; color: var(--brand); letter-spacing: 0.3px; margin-left: 2px; }
.logo-version { font-size: 0.68rem; font-weight: 500; color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* Orologi CET + India impilati */
.clocks { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.clocks .header-clock { display: flex; justify-content: space-between; gap: 8px; padding: 3px 10px; font-size: 0.85rem; }
.clocks .header-clock.sub { font-size: 0.72rem; color: #b8a7ff; background: rgba(125,92,255,0.12); border-color: rgba(125,92,255,0.35); }
.clock-tz { font-size: 0.65rem; font-weight: 700; opacity: 0.75; align-self: center; }
.nav-parent .nav-badge { margin-left: 5px; }

/* My Week: giornate sotto le 8 ore e attività manuali */
.myweek-cell.short { border-color: rgba(245,158,11,0.55); }
.myweek-short { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: auto; padding-top: 4px; font-size: 0.72rem; color: #fcd34d; }
.myweek-short .btn { padding: 2px 8px; font-size: 0.7rem; }
.myweek-entry.manual .myweek-entry-name::after { content: ' ✎'; opacity: 0.7; }
.myweek-entry.pending { opacity: 0.6; font-style: italic; }
