/* ================================================================
   WORKSPACE - Area di Lavoro StrateCo
   Monday.com-style work management with StrateCo identity
   ================================================================ */

:root {
    /* ⛔ I `--ws-*` NON hanno piu' colori propri: sono nomi che puntano alla
       tavolozza di `foundation.css`. Erano un registro parallelo, e quando la
       chat e' passata alla luce calda il Planner e la Bacheca sono rimasti al
       bianco su grigio freddo. Chi rimette un HEX qui li ristacca di nuovo. */
    --ws-primary: var(--primary-color);
    --ws-primary-hover: var(--primary-hover);
    --ws-bg: var(--bg-primary);
    --ws-bg-secondary: var(--bg-secondary);
    --ws-bg-tertiary: var(--bg-tertiary);
    --ws-bg-hover: var(--bg-tertiary);
    --ws-text: var(--text-primary);
    --ws-text-secondary: var(--text-secondary);
    /* ⛔ Il grigio «tenue» è un TESTO (date, contatori, etichette, suggerimenti
       nei campi: 272 usi): non scende sotto il grigio secondario. Schiarito al
       62% verso il bianco faceva 2,1-2,5:1 sui fondi crema (audit 27/10).
       La chat lo chiama già così (`chat-inline.css`). Smoke:
       `tests/e2e/smoke/il-grigio-tenue-si-legge.spec.js`. */
    --ws-text-muted: var(--text-secondary);
    --ws-border: var(--border-color);
    --ws-border-light: var(--border-light);
    --ws-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
    --ws-shadow-lg: 0 8px 24px rgb(0 0 0 / 0.12);
    --ws-radius: 8px;
    --ws-radius-sm: 4px;

    --ws-status-done: #00c875;
    --ws-status-working: #fdab3d;
    --ws-status-stuck: #e2445c;
    --ws-status-not-started: #c4c4c4;
    --ws-status-waiting: #a25ddc;

    --ws-priority-critical: #e2445c;
    --ws-priority-high: #fdab3d;
    --ws-priority-medium: #579bfc;
    --ws-priority-low: #c4c4c4;

    --ws-accent: var(--primary-color);

    --ws-sidebar-width: 260px;
}

[data-theme="dark"] {
    /* Il buio lo decide la tavolozza: qui restano solo lo sfondo del passaggio
       del mouse e le ombre piu' marcate. */
    --ws-bg-hover: #2d3748;
    --ws-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
    --ws-shadow-lg: 0 8px 24px rgb(0 0 0 / 0.4);
}

/* ================================================================
   LAYOUT
   ================================================================ */

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

.workspace-container {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--ws-bg);
    color: var(--ws-text);
}

.workspace-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ================================================================
   BOARD HEADER
   ================================================================ */

.board-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10.5px 24px;
    border-bottom: 1px solid var(--ws-border);
    background: var(--ws-bg);
    flex-shrink: 0;
}

.board-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.board-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.board-emoji {
    font-size: 22px;
    cursor: pointer;
}

.board-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--ws-text);
    padding: 4px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
    min-width: 100px;
    font-family: inherit;
    border: none;
    background: transparent;
    outline: none;
    border-radius: var(--ws-radius-sm);
}

.board-name:hover {
    background: var(--ws-bg-hover);
}

.board-name:focus {
    background: var(--ws-bg-secondary);
    box-shadow: 0 0 0 2px var(--ws-primary);
}

.board-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* View tabs */
.view-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--ws-bg-tertiary);
    border-radius: var(--ws-radius);
    padding: 3px;
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-text-secondary);
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.view-tab:hover {
    color: var(--ws-text);
    background: var(--ws-bg-hover);
}

.view-tab.active {
    color: var(--ws-text);
    background: var(--ws-bg);
    box-shadow: var(--ws-shadow);
}

.view-tab svg {
    width: 16px;
    height: 16px;
}

/* Action buttons */
.ws-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--ws-border);
    background: var(--ws-bg);
    border-radius: var(--ws-radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-text);
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}

.ws-btn:hover {
    background: var(--ws-bg-hover);
    border-color: var(--ws-primary);
}

.ws-btn svg {
    width: 16px;
    height: 16px;
}

.ws-btn-primary {
    background: var(--ws-primary);
    color: #fff;
    border-color: var(--ws-primary);
}

.ws-btn-primary:hover {
    background: var(--ws-primary-hover);
    border-color: var(--ws-primary-hover);
}

.ws-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.ws-btn-icon {
    padding: 7px;
    border: none;
    background: transparent;
}

.ws-btn-icon:hover {
    background: var(--ws-bg-hover);
}

.theme-toggle {
    background: transparent;
    border: 0;
    border-radius: 8px;
    padding: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.theme-toggle:hover {
    background: var(--ws-bg-hover);
    transform: scale(1.05);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    stroke: var(--ws-text-secondary, var(--text-secondary));
}

/* ================================================================
   BOARD TOOLBAR
   ================================================================ */

.board-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 24px;
    border-bottom: 1px solid var(--ws-border-light);
    background: var(--ws-bg);
    flex-shrink: 0;
}

.toolbar-project-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.toolbar-project-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--ws-text-muted);
}
.toolbar-project-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.board-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--ws-bg-tertiary);
    border-radius: var(--ws-radius);
    border: 1px solid transparent;
    transition: all 0.15s;
    max-width: 280px;
}

.board-search:focus-within {
    border-color: var(--ws-primary);
    background: var(--ws-bg);
}

.board-search svg {
    width: 16px;
    height: 16px;
    color: var(--ws-text-muted);
    flex-shrink: 0;
}

.board-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    color: var(--ws-text);
    width: 160px;
    font-family: inherit;
}

.board-search input::placeholder {
    color: var(--ws-text-muted);
}


.filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}

.filter-btn:hover {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}

.filter-btn.active {
    background: rgba(143, 0, 255, 0.1);
    color: var(--ws-primary);
}

.filter-btn svg {
    width: 16px;
    height: 16px;
}

/* ================================================================
   TABLE VIEW
   ================================================================ */

.board-content {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.table-view {
    min-width: max-content;
}

/* Task Group */
.task-group {
    margin-bottom: 24px;
}

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 24px;
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    background: var(--ws-bg);
    z-index: 10;
}

.group-collapse-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ws-text-secondary);
    transition: transform 0.2s;
}

.group-collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.group-color-bar {
    width: 6px;
    height: 24px;
    border-radius: 3px;
    flex-shrink: 0;
}

.group-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--ws-text);
    border: none;
    background: transparent;
    outline: none;
    padding: 2px 6px;
    border-radius: var(--ws-radius-sm);
    font-family: inherit;
}

.group-name:hover {
    background: var(--ws-bg-hover);
}

.group-name:focus {
    box-shadow: 0 0 0 2px var(--ws-primary);
}

.group-count {
    font-size: 12px;
    color: var(--ws-text-muted);
    padding: 2px 8px;
    background: var(--ws-bg-tertiary);
    border-radius: 10px;
}

.group-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.group-header:hover .group-actions {
    opacity: 1;
}

.group-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    color: var(--ws-text-secondary);
}

.group-action-btn:hover {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}

.group-action-btn svg {
    width: 16px;
    height: 16px;
}

/* Table header row */
.table-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--ws-border);
    background: var(--ws-bg-secondary);
    padding-left: 24px;
    position: sticky;
    top: 42px;
    z-index: 9;
}

.table-header .col-checkbox {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.table-header .col-name {
    min-width: 150px;
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-header .col-field {
    width: 150px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-left: 1px solid var(--ws-border-light);
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.table-header .col-field:hover {
    background: var(--ws-bg-hover);
}

.col-add-btn {
    width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--ws-border-light);
    cursor: pointer;
    color: var(--ws-text-muted);
    flex-shrink: 0;
    padding: 8px 0;
}

.col-add-btn:hover {
    color: var(--ws-primary);
    background: var(--ws-bg-hover);
}

/* Column header menu button */
.col-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    padding: 2px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    vertical-align: middle;
}
.col-field:hover .col-menu-btn {
    opacity: 0.6;
}
.col-menu-btn:hover {
    opacity: 1 !important;
    background: var(--ws-bg-hover);
}

/* Column context menu */
.ws-col-context-menu {
    background: var(--ws-bg-secondary);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.ws-col-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text);
    transition: background 0.15s;
}
.ws-col-menu-item:hover {
    background: var(--ws-bg-hover);
}
.ws-col-menu-danger {
    color: #e2445c;
}
.ws-col-menu-danger:hover {
    background: rgba(226,68,92,0.1);
}

/* Task rows */
.task-list-sortable {
    min-height: 8px;
}
.task-list-sortable.drag-active {
    min-height: 40px;
    border: 2px dashed var(--ws-border);
    border-radius: 6px;
    margin: 2px 0;
}
.task-drag-handle {
    display: flex; align-items: center; justify-content: center;
    width: 16px; align-self: center; flex-shrink: 0; cursor: grab;
    color: var(--ws-text-muted); opacity: 0; transition: opacity 0.15s;
    margin-left: -20px; margin-right: 4px;
}
.task-row:hover .task-drag-handle { opacity: 0.6; }
.task-drag-handle:hover { opacity: 1 !important; }
.task-drag-handle:active { cursor: grabbing; }
/* Su touch non c'è hover: l'handle deve restare visibile per riordinare */
@media (hover: none) {
    .task-drag-handle { opacity: 0.6; }
}
.sortable-ghost {
    opacity: 0.4;
    background: var(--ws-primary) !important;
    border-radius: 4px;
}
.sortable-chosen {
    background: var(--ws-bg-hover);
}
.task-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--ws-border-light);
    padding-left: 24px;
    transition: background 0.1s;
    min-height: 38px;
}

.task-row:hover {
    background: var(--ws-bg-hover);
}

.task-row.selected {
    background: rgba(143, 0, 255, 0.06);
}

.task-row.subtask {
    padding-left: 52px;
}

.task-row.subtask .cell-name::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border-left: 2px solid var(--ws-border);
    border-bottom: 2px solid var(--ws-border);
    margin-right: 8px;
    flex-shrink: 0;
    border-radius: 0 0 0 4px;
}

.task-checkbox {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.task-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ws-primary);
    cursor: pointer;
}

.cell-name {
    min-width: 150px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    overflow: hidden;
}

.task-expand-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    color: var(--ws-text-muted);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}

.task-row:hover .task-expand-btn,
.task-expand-btn.has-subtasks {
    opacity: 1;
}

.task-expand-btn:hover {
    background: var(--ws-bg-tertiary);
    color: var(--ws-text);
}

.task-name-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--ws-text);
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-name-input:focus {
    background: var(--ws-bg);
    text-overflow: clip;
}

.task-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.task-ai-badge.pending {
    background: rgba(253, 171, 61, 0.15);
    color: #fdab3d;
}

.task-ai-badge.running {
    background: rgba(87, 155, 252, 0.15);
    color: #579bfc;
    animation: pulse-badge 1.5s infinite;
}

.task-ai-badge.completed {
    background: rgba(0, 200, 117, 0.15);
    color: #00c875;
}

.task-ai-badge.failed {
    background: rgba(226, 68, 92, 0.15);
    color: #e2445c;
}
.task-ai-badge.waiting_input {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

/* ADR-301 (proposta 4): la Lista raggruppata per stato. */
.ws-lista-sezione { margin-bottom: 20px; }
.ws-lista-titolo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 14px 16px 6px;
    font-size: var(--fs-xs, 12px);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ws-text-muted);
}
.ws-lista-titolo span { font-variant-numeric: tabular-nums; font-weight: 500; }

/* ADR-301 (proposta 2): il pannello del compito è uno solo. */
.ws-pannello-fatti {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 12px;
    align-items: center;
    margin: 12px;
    font-size: var(--fs-sm, 14px);
}
.ws-pannello-fatti dt { color: var(--ws-text-muted); }
.ws-pannello-fatti dd { margin: 0; min-width: 0; }
.ws-pannello-scelta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--ws-text);
    font: inherit;
    cursor: pointer;
}
.ws-pannello-scelta:focus-visible { outline: 2px solid var(--ws-primary); outline-offset: 2px; border-radius: 4px; }
.ws-pannello-scelta svg { color: var(--ws-text-muted); flex: none; }
.ws-pannello-iniziali {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 10px;
    color: #fff;
    flex: none;
}
.ws-pannello-vuoto { color: var(--ws-text-muted); }
.ws-pannello-data {
    border: 1px solid var(--ws-border-light);
    border-radius: 6px;
    padding: 3px 8px;
    font: inherit;
    font-variant-numeric: tabular-nums;
    background: var(--ws-bg);
    color: var(--ws-text);
}
.ws-pannello-stato {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: var(--fs-xs, 12px);
    color: #fff;
}
.ws-pannello-avvia { margin: 0 12px 4px; width: calc(100% - 24px); justify-content: center; }
.ws-pannello-approva,
.ws-pannello-approvato {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px;
    padding: 10px 12px;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius, 8px);
    font-size: var(--fs-sm, 14px);
}
.ws-pannello-approva span { flex: 1; color: var(--color-warning, var(--ws-text)); font-weight: 600; }
.ws-pannello-approvato { color: var(--ws-text-secondary); }
.ws-pannello-elimina {
    margin: 8px 12px 20px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-danger, var(--ws-text-muted));
    font: inherit;
    font-size: var(--fs-sm, 14px);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.qa-badge-in-chat { display: inline-block; margin-top: 6px; }

/* ADR-301: dove sta il risultato di un compito (chat e pagina dell'output). */
.ws-collegamenti {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    flex-shrink: 0;
}
.kanban-card .ws-collegamenti { display: flex; margin: 4px 0 2px; }
.ws-collegamento {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 2px 9px;
    border: 1px solid var(--ws-border);
    border-radius: 999px;
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: var(--fs-xs, 12px);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
}
.ws-collegamento:hover { border-color: var(--ws-text); }
.ws-collegamento:focus-visible { outline: 2px solid var(--ws-primary); outline-offset: 2px; }
.ws-collegamento svg { flex: none; }
.ws-collegamento--in-corso { color: var(--color-info, var(--ws-text)); border-color: transparent; background: var(--ws-bg-tertiary); }
.ws-collegamento--avviso { color: var(--color-warning, var(--ws-text)); }

.ws-risultato {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px;
}
.ws-risultato h4 {
    margin: 0;
    font-size: var(--fs-xs, 12px);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ws-text-muted);
}
.ws-risultato-stato {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-sm, 14px);
    color: var(--color-info, var(--ws-text));
}
.ws-risultato-stato--avviso { color: var(--color-warning, var(--ws-text)); }
.ws-risultato-voce {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius, 10px);
    background: var(--ws-bg);
    color: var(--ws-text);
    text-decoration: none;
    font-size: var(--fs-sm, 14px);
    font-weight: 500;
}
.ws-risultato-voce:hover { border-color: var(--ws-text); }
.ws-risultato-voce:focus-visible { outline: 2px solid var(--ws-primary); outline-offset: 2px; }
.ws-risultato-voce small { display: block; font-weight: 400; color: var(--ws-text-muted); font-size: var(--fs-xs, 12px); }
.ws-risultato-freccia { margin-left: auto; color: var(--ws-text-muted); }

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Generic cell */
.cell-field {
    width: 150px;
    padding: 0;
    border-left: 1px solid var(--ws-border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    font-size: 13px;
}

.cell-field:hover {
    background: var(--ws-bg-hover);
}

/* Status cell */
.cell-status {
    padding: 4px;
}

.status-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 30px;
    padding: 8px;
    border-radius: var(--ws-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-transform: none;
    letter-spacing: normal;
}

/* Person cell */
.cell-person {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.person-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.person-avatar.ai-agent {
    background: linear-gradient(135deg, #8f00ff, #579bfc);
    font-size: 14px;
}

.person-avatar-empty {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px dashed var(--ws-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ws-text-muted);
}

/* Date cell */
.cell-date-value {
    font-size: 13px;
    color: var(--ws-text);
    padding: 4px 8px;
}

.cell-date-value.overdue {
    color: var(--ws-status-stuck);
    font-weight: 600;
}

/* Timeline cell */
.timeline-bar-container {
    width: 100%;
    padding: 4px 6px;
    cursor: pointer;
}

.timeline-bar {
    height: 22px;
    border-radius: 11px;
    background: var(--ws-primary);
    min-width: 100%;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: opacity 0.15s;
    overflow: hidden;
}

.timeline-bar:hover {
    opacity: 0.85;
}

.timeline-bar.overdue {
    background: #e2445c !important;
}

.timeline-bar-label {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    padding: 0 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Number cell */
.cell-number-value {
    font-size: 13px;
    color: var(--ws-text);
    font-variant-numeric: tabular-nums;
}

/* Text cell */
.cell-text-value {
    font-size: 13px;
    color: var(--ws-text);
    padding: 4px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Dropdown cell */
.cell-dropdown-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--ws-bg-tertiary);
    color: var(--ws-text);
}

/* Add task row */
.add-task-row {
    display: flex;
    align-items: center;
    padding: 6px 24px 6px 64px;
    border-bottom: 1px solid var(--ws-border-light);
    cursor: pointer;
    transition: background 0.1s;
}

.add-task-row:hover {
    background: var(--ws-bg-hover);
}

.add-task-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--ws-text-muted);
    flex: 1;
    padding: 8px 0;
    font-family: inherit;
}

.add-task-input::placeholder {
    color: var(--ws-text-muted);
}

.add-task-input:focus {
    color: var(--ws-text);
}

/* Add group button */
.add-group-row {
    padding: 16px 24px;
}

.add-group-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 2px dashed var(--ws-border);
    background: transparent;
    border-radius: var(--ws-radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--ws-text-secondary);
    transition: all 0.15s;
    font-family: inherit;
}

.add-group-btn:hover {
    border-color: var(--ws-primary);
    color: var(--ws-primary);
    background: rgba(143, 0, 255, 0.04);
}

/* ================================================================
   KANBAN VIEW
   ================================================================ */

.kanban-view {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    min-width: max-content;
    height: 100%;
    align-items: flex-start;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
    background: var(--ws-bg-secondary);
    border-radius: var(--ws-radius);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 3px solid;
}

.kanban-column-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-text);
    flex: 1;
}

.kanban-column-count {
    font-size: 12px;
    color: var(--ws-text-muted);
    background: var(--ws-bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.kanban-card {
    background: var(--ws-bg);
    border: 1px solid var(--ws-border-light);
    border-radius: var(--ws-radius);
    padding: 12px;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
}

.kanban-card:hover {
    box-shadow: var(--ws-shadow-lg);
    transform: translateY(-1px);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ws-text);
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.kanban-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.kanban-card-date {
    font-size: 12px;
    color: var(--ws-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--ws-border-light);
}

.kanban-add-card {
    padding: 8px 12px;
    margin: 0 12px 12px;
    border: 2px dashed var(--ws-border);
    border-radius: var(--ws-radius);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text-muted);
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
    width: calc(100% - 24px);
}

.kanban-add-card:hover {
    border-color: var(--ws-primary);
    color: var(--ws-primary);
}

/* ================================================================
   GANTT VIEW
   ================================================================ */







/* ================================================================
   CALENDAR VIEW
   ================================================================ */

.calendar-view {
    padding: 20px 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ws-border);
    background: var(--ws-bg);
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    color: var(--ws-text);
}

.calendar-nav-btn:hover {
    background: var(--ws-bg-hover);
}

.calendar-month-label {
    font-size: 18px;
    font-weight: 600;
    color: var(--ws-text);
}

.calendar-today-btn {
    padding: 7px 12px;
    border: 1px solid var(--ws-border);
    background: var(--ws-bg);
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text);
    font-family: inherit;
}

.calendar-today-btn:hover {
    background: var(--ws-bg-hover);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    overflow: hidden;
}

.calendar-day-header {
    padding: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    background: var(--ws-bg-secondary);
    border-bottom: 1px solid var(--ws-border);
    text-transform: uppercase;
}

.calendar-day {
    min-height: 100px;
    padding: 4px;
    border-bottom: 1px solid var(--ws-border-light);
    border-right: 1px solid var(--ws-border-light);
    background: var(--ws-bg);
    cursor: pointer;
    transition: background 0.1s;
}

.calendar-day:hover {
    background: var(--ws-bg-hover);
}

.calendar-day.other-month {
    background: var(--ws-bg-secondary);
    opacity: 0.5;
}

.calendar-day.today {
    background: rgba(143, 0, 255, 0.04);
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-text-secondary);
    padding: 4px;
}

.calendar-day.today .calendar-day-number {
    background: var(--ws-primary);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-task-item {
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: var(--ws-radius-sm);
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-task-item:hover {
    opacity: 0.8;
}

/* ================================================================
   AI PANEL (right sidebar)
   ================================================================ */
































/* ================================================================
   MODALS
   ================================================================ */


.ws-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.ws-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ws-text);
}

.ws-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    color: var(--ws-text-secondary);
}

.ws-modal-close:hover {
    background: var(--ws-bg-hover);
}

.ws-modal-body {
    padding: 20px 24px;
}

.ws-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 20px;
}

.ws-form-group {
    margin-bottom: 16px;
}

.ws-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-text);
    margin-bottom: 6px;
}

.ws-form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.ws-form-input:focus {
    border-color: var(--ws-primary);
    box-shadow: 0 0 0 3px rgba(143, 0, 255, 0.1);
}

.ws-form-input::placeholder {
    color: var(--ws-text-muted);
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Dropdown menus */
.ws-dropdown {
    position: absolute;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: var(--ws-shadow-lg);
    z-index: 1000;
    min-width: 160px;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.15s;
}

.ws-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ws-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--ws-radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text);
    transition: background 0.1s;
}

.ws-dropdown-item:hover {
    background: var(--ws-bg-hover);
}

.ws-dropdown-item .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Project share toggle in dropdown */
.ws-project-item {
    position: relative;
}
.ws-project-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ws-project-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(143, 0, 255, 0.08);
    border: 1px solid rgba(143, 0, 255, 0.18);
    color: var(--ws-primary);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}
.ws-project-share-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.ws-project-share-btn:hover {
    background: rgba(143, 0, 255, 0.16);
    border-color: rgba(143, 0, 255, 0.32);
}
.ws-project-share-btn.active {
    background: var(--ws-primary);
    border-color: var(--ws-primary);
    color: #fff;
}
.ws-project-share-btn.active:hover {
    background: var(--ws-primary-hover, #7700e9);
    border-color: var(--ws-primary-hover, #7700e9);
}
.ws-shared-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    background: rgba(143, 0, 255, 0.1);
    color: var(--ws-primary);
    flex-shrink: 0;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ================================================================
   BULK ACTIONS BAR
   ================================================================ */

.bulk-actions-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--ws-text);
    color: var(--ws-bg);
    border-radius: 12px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transition: transform 0.3s ease;
}

.bulk-actions-bar.show {
    transform: translateX(-50%) translateY(0);
}

.bulk-count {
    font-size: 14px;
    font-weight: 600;
}

.bulk-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    border-radius: var(--ws-radius);
    cursor: pointer;
    font-size: 13px;
    color: inherit;
    transition: background 0.15s;
    font-family: inherit;
}

.bulk-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

.bulk-action svg {
    width: 16px;
    height: 16px;
}

/* ================================================================
   EMPTY STATE
   ================================================================ */

.board-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.board-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.board-empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--ws-text);
    margin-bottom: 8px;
}

.board-empty-text {
    font-size: 14px;
    color: var(--ws-text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
}

/* Project selector */
.project-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    cursor: pointer;
    font-size: 13px;
    color: var(--ws-text);
    background: var(--ws-bg);
    transition: all 0.15s;
    position: relative;
}

.project-selector:hover {
    border-color: var(--ws-primary);
}

.project-selector-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.project-selector-icon img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
}

.project-selector-name {
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-selector-arrow {
    width: 16px;
    height: 16px;
    color: var(--ws-text-muted);
}

/* ================================================================
   TASK DETAIL PANEL
   ================================================================ */

.task-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

.task-detail-overlay.show {
    opacity: 1;
    visibility: visible;
}

.task-detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 680px;
    max-width: 90vw;
    background: var(--ws-bg);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid var(--ws-border);
}

.task-detail-panel.show {
    transform: translateX(0);
}

.task-detail-header {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--ws-border);
}

.task-detail-expand {
    position: absolute;
    right: 50px;
    top: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ws-text-muted);
    border: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.task-detail-expand:hover {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}

.task-detail-panel.expanded {
    width: calc(100vw - 52px);
    max-width: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
}

.task-detail-close {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ws-text-muted);
    transition: all 0.15s;
}

.task-detail-close:hover {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}

.task-detail-title-row {
    padding: 22px 56px 14px 24px;
    display: flex;
    align-items: center;
}
.task-detail-hdr-icon {
    position: absolute;
    top: 15px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--ws-bg-tertiary);
    color: var(--ws-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
    z-index: 2;
}
.task-detail-hdr-icon:hover {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}
.task-detail-hdr-status  { right: 92px; }
.task-detail-hdr-subtask { right: 124px; }
.task-detail-hdr-project { right: 156px; overflow: hidden; cursor: default; font-size: 10px; font-weight: 700; color: var(--ws-text-muted); }

.task-detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ws-text);
    border: none;
    background: transparent;
    outline: none;
    width: 78%;
    padding: 4px 8px;
    margin: -8px 0px 0px -10px;
    border-radius: var(--ws-radius-sm);
    font-family: inherit;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-detail-title:focus {
    background: var(--ws-bg-secondary);
    box-shadow: 0 0 0 2px var(--ws-primary);
}

.task-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.task-detail-tab-content {
    display: none;
    padding: 24px;
}

.task-detail-tab-content.active {
    display: block;
    max-width: 100%;
    margin: 0 auto;
}

/* Updates tab */
.task-updates-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.task-updates-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: var(--ws-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 32px;
}

.task-updates-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ws-text);
    margin-bottom: 6px;
}

.task-updates-empty-text {
    font-size: 13px;
    color: var(--ws-text-muted);
    max-width: 300px;
    line-height: 1.5;
}

/* ── Discussion tab: fill panel height, composer pinned at bottom ── */
.task-detail-body.discussion-active {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.task-detail-body.discussion-active .task-detail-tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    padding: 0;
    overflow: hidden;
    width: 100%;
}
.task-discussion-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0 28px;
    margin-bottom: 0;
}
.task-discussion-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Chat composer ── */
.ws-chat-composer {
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    padding: 0 15% 20px;
    border-top: 0;
    background: linear-gradient(to bottom, transparent, var(--ws-bg) 90%);
    z-index: 20;
}
.ws-chat-composer::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -60px;
    height: 60px;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent 0%, var(--ws-bg) 100%);
}
.ws-chat-composer-box {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--ws-border);
    border-radius: 14px;
    background: var(--ws-bg-secondary);
    transition: border-color 0.15s;
    position: relative;
}
.ws-chat-composer-box:focus-within {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px rgba(143,0,255,0.08);
}
.ws-chat-icon-btn {
    position: relative;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ws-text-muted);
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.ws-chat-icon-btn:hover { background: var(--ws-bg-hover); color: var(--ws-text); }
.ws-chat-composer-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--ws-text);
    outline: none;
    min-height: 44px;
    max-height: 200px;
    line-height: 1.55;
    padding: 12px 14px 6px;
    overflow-y: auto;
    display: block;
    border-radius: 14px 14px 0 0;
    transition: min-height 0.15s;
    word-break: break-word;
    white-space: pre-wrap;
}
.ws-chat-composer-box:focus-within .ws-chat-composer-input { min-height: 100px; }
.ws-chat-composer-input[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: var(--ws-text-muted);
    pointer-events: none;
}
.mention-chip {
    display: inline;
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    font-weight: 700;
    border-radius: 4px;
    padding: 1px 4px;
    font-size: inherit;
    cursor: default;
    user-select: none;
}
.ws-chat-send-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ws-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.1s;
}
.ws-chat-send-btn:hover { opacity: 0.85; transform: scale(1.05); }
.ws-chat-input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    background: transparent;
    overflow: hidden;
}
.ws-chat-cmd {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border: 1px solid var(--ws-border-light);
    background: transparent;
    cursor: pointer;
    border-radius: 20px;
    font-size: 11px;
    color: var(--ws-text-muted);
    font-family: inherit;
    transition: border-color 0.12s, color 0.12s;
    white-space: nowrap;
}
.ws-chat-cmd:hover { border-color: var(--ws-accent); color: var(--ws-accent); }

@keyframes ws-dictate-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
    50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}
.ws-chat-icon-btn.is-dictating {
    color: var(--color-danger);
    border-radius: 7px;
    animation: ws-dictate-pulse 1.5s ease-in-out infinite;
}

/* Composer + — tooltip (allineato a components.css) */
.composer-plus-tip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    background: rgba(0, 0, 0, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10001;
}

.ws-chat-icon-btn.composer-plus-btn:hover .composer-plus-tip,
.ws-chat-icon-btn.composer-plus-btn:focus-visible .composer-plus-tip {
    opacity: 1;
}

.composer-plus-btn.is-sc-open .composer-plus-tip {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
}

.composer-plus-tip-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    color: #fff;
    background: transparent;
}

.ws-chat-composer-box.drag-over {
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px rgba(143,0,255,0.12);
}
.ws-chat-drop-overlay {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: rgba(143,0,255,0.07);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-accent);
    pointer-events: none;
    z-index: 10;
}

/* legacy, kept for any residual refs */
.task-update-compose { display: none; }
.task-update-input { display: none; }
.task-update-actions { display: none; }

/* === WORKSPACE ACTIONS MODAL === */
.qa-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}
.qa-modal {
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 16px;
    width: min(520px, 92vw);
    max-height: 80vh;
    display: flex; flex-direction: column;
    box-shadow: var(--ws-shadow-lg);
    overflow: hidden;
}
.qa-modal-wide { width: min(860px, 95vw); max-height: 82vh; }
.qa-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; padding: 18px 20px 16px;
    border-bottom: 1px solid var(--ws-border);
    flex-shrink: 0;
}
.qa-modal-header-left {
    display: flex; align-items: flex-start; gap: 12px;
    flex: 1; min-width: 0;
}
.qa-modal-avatar-wrap {
    flex-shrink: 0; width: 34px; height: 34px;
}
.qa-modal-avatar-wrap picture {
    display: block; width: 34px; height: 34px;
}
.qa-modal-avatar,
.qa-modal-avatar-wrap img {
    width: 34px; height: 34px;
    border-radius: 50%; object-fit: cover; display: block;
}
.qa-modal-header-text { display: flex; flex-direction: column; gap: 3px; }
.qa-modal-title { font-size: 15px; font-weight: 600; color: var(--ws-text); }
.qa-modal-subtitle { font-size: 13px; color: var(--ws-text-secondary); }
.qa-modal-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-top: 2px; }
.qa-search-input {
    padding: 5px 12px;
    border: 1px solid var(--ws-border);
    border-radius: 20px;
    background: var(--ws-bg-secondary);
    color: var(--ws-text);
    font-family: inherit; font-size: 13px;
    width: 170px; outline: none;
    transition: border-color 0.15s;
}
.qa-search-input::placeholder { color: var(--ws-text-muted); }
.qa-search-input:focus { border-color: var(--ws-accent); }
.qa-modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--ws-text-secondary);
    padding: 4px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.15s;
}
.qa-modal-close:hover { color: var(--ws-text); }
/* Barra pill tag (dominio) — asse 2 del filtro combinato. Stile filtro home. */
.qa-tag-filters {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; flex-shrink: 0;
    border-bottom: 1px solid var(--ws-border);
    overflow-x: auto; scrollbar-width: none;
}
.qa-tag-filters::-webkit-scrollbar { display: none; }
.qa-tag-filter {
    padding: 5px 13px; border-radius: 999px;
    border: 1px solid var(--ws-border); background: transparent;
    color: var(--ws-text-secondary);
    font-family: inherit; font-size: 12px; font-weight: 500;
    cursor: pointer; white-space: nowrap; line-height: 1.4;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.qa-tag-filter:hover { border-color: var(--ws-text-secondary); color: var(--ws-text); }
.qa-tag-filter.active { background: var(--ws-text); color: var(--ws-bg); border-color: var(--ws-text); }

.qa-modal-layout { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.qa-modal-nav {
    min-width: 236px; flex-shrink: 0;
    background: var(--ws-bg-secondary);
    padding: 12px 10px;
    display: flex; flex-direction: column; gap: 2px;
    border-right: 1px solid var(--ws-border);
}
.qa-modal-nav-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px;
    background: none; border: none; border-radius: 8px;
    cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500;
    color: var(--ws-text-secondary); text-align: left;
    transition: background 0.15s, color 0.15s; width: 100%;
}
.qa-modal-nav-item:hover { background: var(--ws-bg-hover); color: var(--ws-text); }
.qa-modal-nav-item.active { background: var(--ws-bg-hover); color: var(--ws-text); font-weight: 600; }
.qa-modal-nav-badge {
    font-size: 11px; font-weight: 500;
    color: var(--ws-text-muted);
    background: var(--ws-bg-tertiary);
    border-radius: 10px; padding: 1px 6px;
    min-width: 20px; text-align: center;
}
.qa-modal-nav-item.active .qa-modal-nav-badge { color: var(--ws-text-secondary); }
.qa-modal-cards {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: 14px 16px 16px;
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; align-content: start;
}
.qa-cat-header {
    grid-column: 1 / -1;
    font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
    text-transform: uppercase; color: var(--ws-text-muted);
    padding: 14px 0 4px;
    border-top: 1px solid var(--ws-border);
    margin-top: 4px; opacity: 0.7;
}
.qa-cat-header:first-child { padding-top: 0; border-top: none; margin-top: 0; }
.qa-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px 14px 11px;
    background: var(--ws-bg-secondary);
    border: 1px solid var(--ws-border);
    border-radius: 12px;
    cursor: pointer; text-align: left; font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.qa-card:hover {
    border-color: var(--ws-accent);
    background: var(--ws-bg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.qa-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.qa-card-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.qa-card-title { font-size: 13px; font-weight: 600; color: var(--ws-text); line-height: 1.3; min-width: 0; }
.qa-card-desc { font-size: 12px; color: var(--ws-text-secondary); line-height: 1.45; margin: 0; }
.qa-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.qa-badge {
    font-size: 10.5px; font-weight: 500; color: var(--ws-text-secondary);
    background: var(--ws-bg-tertiary);
    border: 1px solid var(--ws-border); border-radius: 6px;
    padding: 2px 7px; white-space: nowrap;
}
.qa-modal-body { overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 16px; }
.qa-modal-section { display: flex; flex-direction: column; gap: 4px; }
.qa-modal-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 12px; background: none;
    border: 1px solid transparent; border-radius: 10px;
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
    font-family: inherit; width: 100%; text-align: left;
}
.qa-modal-item:hover { background: var(--ws-bg-secondary); border-color: var(--ws-border); }
.qa-modal-item-left { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.qa-modal-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qa-modal-item-name { font-size: 13px; font-weight: 500; color: var(--ws-text); }
.qa-modal-item-sub { font-size: 11.5px; color: var(--ws-text-secondary); line-height: 1.35; white-space: normal; }
.qa-modal-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.quick-action-credit-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; position: relative; cursor: default; }

.task-comment-item {
    padding: 24px;
    border-bottom: 1px solid var(--ws-border-light);
}
.task-comment-item.is-mine {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.task-comment-item.is-mine .task-comment-header {
    flex-direction: row-reverse;
}
.task-comment-item.is-mine .task-comment-body {
    background: var(--ws-accent);
    color: #fff;
    border-radius: 16px 2px 16px 16px;
    padding: 8px 14px;
    max-width: 75%;
    padding-left: 14px;
}

.task-comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.task-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ws-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.task-comment-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-text);
}

.task-comment-time {
    font-size: 12px;
    color: var(--ws-text-muted);
    margin-left: auto;
}

.task-comment-body {
    font-size: 14px;
    color: var(--ws-text);
    line-height: 1.6;
    padding-left: 16px;
}

/* Formatted AI output */
.ai-formatted-output p {
    margin: 4px 0;
}
.ai-formatted-output h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 20px 0 8px;
    color: var(--ws-text);
}
.ai-formatted-output h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 16px 0 6px;
    color: var(--ws-text);
}
.ai-formatted-output h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 12px 0 4px;
    color: var(--ws-text);
}
.ai-formatted-output ul, .ai-formatted-output ol {
    margin: 6px 0;
    padding-left: 22px;
}
.ai-formatted-output li {
    margin-bottom: 3px;
}
.ai-formatted-output hr {
    border: none;
    border-top: 1px solid var(--ws-border);
    margin: 16px 0;
}
.ai-formatted-output code {
    background: var(--ws-bg-secondary);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'SF Mono', Monaco, monospace;
}
.ai-formatted-output strong {
    font-weight: 700;
}
.ai-formatted-output em {
    font-style: italic;
}
.ai-formatted-output br + br {
    display: none;
}

/* Export bar */
.ai-export-bar {
    display: flex;
    gap: 6px;
    padding: 10px 0 0 0px;
    margin-top: 12px;
    border-top: 0;
}
.ai-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ws-text-muted);
    background: none;
    border: 1px solid var(--ws-border);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.ai-export-btn:hover {
    color: var(--ws-text);
    border-color: var(--ws-text-muted);
    background: var(--ws-bg-secondary);
}

/* Copy block (COPY_START/COPY_END markers) */
.ws-copy-block {
    margin: 14px 0;
    max-width: 700px;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: var(--ws-bg-secondary, rgba(255,255,255,0.02));
    overflow: hidden;
}
.ws-copy-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: var(--ws-bg-tertiary, rgba(99,102,241,0.06));
    border-bottom: 1px solid var(--ws-border-light, var(--ws-border));
    flex-wrap: wrap;
}
.ws-copy-block-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ws-copy-block-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.ws-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ws-text-muted);
    background: transparent;
    border: 1px solid var(--ws-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.ws-copy-btn:hover {
    color: var(--ws-text);
    border-color: var(--ws-text-muted);
    background: var(--ws-bg-secondary);
}
.ws-copy-block-content {
    padding: 14px 16px;
    line-height: 1.6;
}
.ws-copy-block-content[contenteditable="true"] {
    cursor: text;
    min-height: 60px;
}
.ws-copy-block-footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--ws-border-light, var(--ws-border));
    background: var(--ws-bg-tertiary, rgba(99,102,241,0.04));
}
.ws-copy-footer-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.ws-copy-publish-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    font-family: inherit;
}
.ws-copy-publish-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0.95;
}
.ws-copy-publish-btn.ws-pub-ig {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.ws-copy-publish-btn.ws-pub-fb {
    background: #1877F2;
}
.ws-copy-publish-btn.ws-pub-li {
    background: #0A66C2;
}
.ws-copy-publish-btn.ws-pub-wp {
    background: #21759B;
}

/* AI comment styles */
.task-comment-avatar-img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.task-comment-avatar-img img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.task-comment-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.task-comment-role {
    font-size: 11px;
    color: var(--ws-text-muted);
}
.comment-type-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
}
.comment-badge-output {
    background: rgba(0, 200, 117, 0.15);
    color: #00c875;
}
.comment-badge-question {
    background: rgba(253, 171, 61, 0.15);
    color: #fdab3d;
}
.comment-badge-mention {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}
.comment-ai-output {
    background: rgba(0, 200, 117, 0.03);
    border: 1px solid var(--border-color); margin-bottom: 10px;
}
.comment-ai-mention {
    background: rgba(139, 92, 246, 0.05);
    }
.comment-ai-dashboard .ai-dashboard-content {
    --bg-primary: #1e1e2e;
    --bg-secondary: #181825;
    --text-primary: #cdd6f4;
    --text-secondary: #a6adc8;
    --border-color: rgba(255,255,255,0.08);
    --primary-color: #00c875;
    padding: 4px 0;
    font-size: 13px;
    overflow-x: hidden;
}
.comment-ai-dashboard .ai-dashboard-content h2 { font-size: 16px; margin: 12px 0 8px; }
.comment-ai-dashboard .ai-dashboard-content h3 { font-size: 13px; margin: 10px 0 6px; }
.comment-ai-dashboard .ai-dashboard-content h4 { font-size: 14px; margin: 8px 0 6px; }
.comment-ai-dashboard .ai-dashboard-content table { font-size: 12px; }
.comment-ai-dashboard .ai-dashboard-content table th,
.comment-ai-dashboard .ai-dashboard-content table td { padding: 8px 6px !important; }
.comment-ai-question {
    background: rgba(253, 171, 61, 0.05);
    border: 1px solid var(--border-color); }
.comment-reply-area {
    margin-top: 10px;
    padding-left: 42px;
}
.comment-reply-toggle {
    font-size: 13px;
}
.comment-reply-form {
    margin-top: 8px;
}
.comment-edit-btn {
    background: none;
    border: none;
    color: var(--ws-text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: auto;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.task-comment-item:hover .comment-edit-btn { opacity: 1; }
.comment-edit-btn:hover { color: var(--ws-primary); background: rgba(0,200,117,.1); }

/* AI loader card (shown while a Frida shortcut / agent is running) */
.ai-loader-card {
    border: 1px solid var(--border-color); background: transparent;
}
.ai-loader-dots { display: inline-flex; gap: 4px; }
.ai-loader-dots span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--ws-text-muted);
    animation: aiLoaderDot 1.2s infinite ease-in-out both;
}
.ai-loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loader-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes aiLoaderDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* 🔽 Scroll to bottom */
.ws-scroll-to-bottom-wrap {
    position: relative;
    height: 0;
    overflow: visible;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 25;
}
.ws-scroll-to-bottom-btn {
    position: absolute;
    bottom: 12px;
    pointer-events: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ws-bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ws-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 0;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.15s ease;
}
.ws-scroll-to-bottom-wrap.is-visible .ws-scroll-to-bottom-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ws-scroll-to-bottom-wrap.is-visible .ws-scroll-to-bottom-btn:hover {
    transform: translateY(0) scale(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.ws-scroll-to-bottom-btn .stb-dot { background: var(--ws-text-muted); }
.ws-scroll-to-bottom-btn .stb-arrow { display: none; color: var(--ws-text-muted); }
.ws-scroll-to-bottom-btn.done .stb-dots { display: none; }
.ws-scroll-to-bottom-btn.done .stb-arrow { display: block; }

/* "Avviato con questi parametri" + 2-CTA confirmation card */
.task-params-confirm,
.task-params-edit,
.task-params-started {
    background: rgba(143, 0, 255, 0.05);
    border: 1px solid rgba(143, 0, 255, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
}
.task-params-list { margin: 6px 0 4px 18px; padding: 0; font-size: 13px; line-height: 1.6; }
.task-params-list li { margin: 0; }
.task-params-requester {
    margin: 8px 0 0 0;
    padding-top: 8px;
    border-top: 1px solid rgba(143, 0, 255, 0.15);
    font-size: 12px;
    color: var(--ws-text-muted);
}

.comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--ws-primary);
    border-radius: 8px;
    background: var(--ws-bg-secondary);
    color: var(--ws-text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.5;
}
.comment-edit-textarea:focus { outline: none; border-color: var(--ws-primary); box-shadow: 0 0 0 2px rgba(0,200,117,.15); }

.comment-reply-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: var(--ws-bg-secondary);
    color: var(--ws-text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.comment-reply-textarea:focus {
    border-color: var(--ws-primary);
}
.comment-reply-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Smart CTA buttons */
@keyframes smartCtaEnter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.smart-cta-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
}

.smart-cta-container .smart-cta-btn:nth-child(1) { animation-delay: 0ms; }
.smart-cta-container .smart-cta-btn:nth-child(2) { animation-delay: 65ms; }
.smart-cta-container .smart-cta-btn:nth-child(3) { animation-delay: 130ms; }
.smart-cta-container .smart-cta-btn:nth-child(4) { animation-delay: 195ms; }
.smart-cta-container .smart-cta-btn:nth-child(5) { animation-delay: 260ms; }
.smart-cta-container .smart-cta-btn:nth-child(6) { animation-delay: 325ms; }

.smart-cta-btn {
    opacity: 0;
    animation: smartCtaEnter 0.35s ease-out forwards;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    color: var(--ws-primary);
    background: transparent;
    border: 1px solid var(--ws-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.4;
}
.smart-cta-btn:hover {
    background: var(--ws-primary);
    color: white;
}
.smart-cta-btn:disabled {
    cursor: default;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .smart-cta-container .smart-cta-btn {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* @mention dropdown */
.comment-input-wrapper {
    position: relative;
}
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    min-height: 150px;
    max-height: 370px;
    overflow-y: auto;
    z-index: 100;
    margin-bottom: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.mention-item:hover {
    background: var(--ws-bg-hover);
}
.mention-item:first-child { border-radius: 8px 8px 0 0; }
.mention-item:last-child { border-radius: 0 0 8px 8px; }
.mention-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-text);
}
.mention-role {
    font-size: 11px;
    color: var(--ws-text-muted);
    margin-left: auto;
}
.mention-separator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 4px;
}
.mention-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ws-border);
}
.mention-separator span {
    font-size: 10px;
    font-weight: 600;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.mention-human-avatar {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.mention-chip--human {
    background: var(--ws-bg-hover);
    color: var(--ws-text);
}

/* AI execution banner */
.ai-execution-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin: 12px 12px 0;
    border-radius: 8px;
    border: 1px solid;
    background: var(--ws-bg-secondary);
    font-size: 13px;
}

/* Details tab */
.task-detail-section {
    margin-bottom: 24px;
}

.task-detail-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--ws-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ws-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-desc-edit-btn {
    background: none;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--ws-text-muted);
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
}
.task-desc-edit-btn:hover {
    color: var(--ws-primary);
    border-color: var(--ws-primary);
    background: rgba(143, 0, 255, 0.08);
}

.task-description-input {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: var(--ws-bg-secondary);
    color: var(--ws-text);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.task-description-input:focus {
    border-color: var(--ws-primary);
}
.task-description-input::placeholder {
    color: var(--ws-text-muted);
}
.task-description-readonly {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ws-text);
    padding: 8px 0;
}

.task-detail-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ws-border-light);
}

.task-detail-field:last-child {
    border-bottom: none;
}

.task-detail-field-label {
    width: 130px;
    font-size: 13px;
    color: var(--ws-text-secondary);
    flex-shrink: 0;
    font-weight: 500;
}

.task-detail-field-value {
    flex: 1;
    font-size: 14px;
    color: var(--ws-text);
}

/* Files tab */
.task-files-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.task-files-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: var(--ws-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 32px;
}

/* Activity log tab */
.task-activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--ws-border-light);
    font-size: 13px;
    color: var(--ws-text-secondary);
}

.task-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ws-primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.task-activity-text {
    flex: 1;
    line-height: 1.5;
}

.task-activity-text strong {
    color: var(--ws-text);
    font-weight: 600;
}

.task-activity-time {
    font-size: 12px;
    color: var(--ws-text-muted);
    white-space: nowrap;
}

/* Comments */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 10px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
}

.comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-text);
}

.comment-time {
    font-size: 11px;
    color: var(--ws-text-muted);
    margin-left: 8px;
}

.comment-text {
    font-size: 13px;
    color: var(--ws-text);
    line-height: 1.5;
    margin-top: 4px;
}

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.comment-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.comment-input:focus {
    border-color: var(--ws-primary);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
    .workspace-container .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        height: 100%;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .workspace-container .sidebar.show {
        transform: translateX(0);
    }

    .board-header {
        padding: 10px 16px;
        flex-wrap: wrap;
    }

    .view-tabs {
        order: 10;
        width: 100%;
    }

    .kanban-view {
        padding: 12px;
    }

    .kanban-column {
        min-width: 260px;
    }

    .cell-name {
        min-width: 200px;
    }

    .task-detail-panel {
        width: 100vw;
    }
}

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */

.board-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.board-content::-webkit-scrollbar:horizontal {
    height: 8px;
}

.kanban-cards::-webkit-scrollbar,
.task-detail-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.board-content::-webkit-scrollbar-track {
    background: var(--ws-bg-secondary);
    border-top: 1px solid var(--ws-border-light);
}

.kanban-cards::-webkit-scrollbar-track,
.task-detail-body::-webkit-scrollbar-track {
    background: transparent;
}

.board-content::-webkit-scrollbar-thumb {
    background: var(--ws-text-muted);
    border-radius: 12px;
    border: 0;
}

.board-content::-webkit-scrollbar-thumb:vertical {
    border-radius: 4px;
}

.board-content:hover::-webkit-scrollbar-thumb {
    background: var(--ws-text-muted);
}

.kanban-cards::-webkit-scrollbar-thumb,
.task-detail-body::-webkit-scrollbar-thumb {
    background: var(--ws-border);
    border-radius: 3px;
}

.board-content::-webkit-scrollbar-thumb:hover {
    background: var(--ws-text-muted);
}

.kanban-cards::-webkit-scrollbar-thumb:hover,
.task-detail-body::-webkit-scrollbar-thumb:hover {
    background: var(--ws-text-muted);
}

/* ================================================================
   LOADING / SKELETON
   ================================================================ */

.ws-skeleton {
    background: linear-gradient(90deg, var(--ws-bg-secondary) 25%, var(--ws-bg-tertiary) 50%, var(--ws-bg-secondary) 75%);
    background-size: 200% 100%;
    animation: ws-skeleton-loading 1.5s infinite;
    border-radius: var(--ws-radius-sm);
}

@keyframes ws-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================================
   DRAG & DROP
   ================================================================ */

.sortable-ghost {
    opacity: 0.3;
}

.sortable-chosen {
    background: rgba(143, 0, 255, 0.06) !important;
}

.sortable-drag {
    box-shadow: var(--ws-shadow-lg) !important;
}

/* ================================================================
   GENERIC MODAL
   ================================================================ */
.ws-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wsModalFadeIn 0.2s ease;
}

@keyframes wsModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ws-modal {
    background: var(--ws-bg);
    border-radius: 12px;
    border: 1px solid var(--ws-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 440px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: wsModalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wsModalSlideIn {
    from { transform: translateY(-20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.ws-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}

.ws-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ws-text);
    margin: 0;
}

.ws-modal-body {
    padding: 8px 24px 16px;
    font-size: 14px;
    color: var(--ws-text-secondary);
    line-height: 1.6;
    overflow-y: auto;
}

.ws-modal-body p {
    margin: 0 0 8px;
}

.ws-modal-body .ws-modal-warning {
    color: #e2445c;
    font-size: 13px;
}

.ws-modal-body input[type="text"],
.ws-modal-body select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: var(--ws-bg-secondary);
    color: var(--ws-text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-top: 8px;
    box-sizing: border-box;
}

.ws-modal-body input[type="text"]:focus,
.ws-modal-body select:focus {
    border-color: var(--ws-primary);
    box-shadow: 0 0 0 3px rgba(143, 0, 255, 0.1);
}

.ws-modal-body label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-text);
    display: block;
    margin-bottom: 4px;
}

.ws-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 20px;
}

.ws-modal-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
}

.ws-modal-btn-secondary {
    background: var(--ws-bg-tertiary);
    color: var(--ws-text);
}

.ws-modal-btn-secondary:hover {
    background: var(--ws-bg-hover);
}

.ws-modal-btn-primary {
    background: var(--ws-primary);
    color: #fff;
}

.ws-modal-btn-primary:hover {
    opacity: 0.9;
}

.ws-modal-btn-danger {
    background: #e2445c;
    color: #fff;
}

.ws-modal-btn-danger:hover {
    background: #c73a4e;
}

/* Files Manager */
.ws-dropzone {
    border: 2px dashed var(--ws-border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ws-dropzone:hover,
.ws-dropzone-active {
    border-color: var(--ws-primary);
    background: rgba(143, 0, 255, 0.04);
}

.ws-dropzone-text {
    font-size: 13px;
    color: var(--ws-text-secondary);
}

.ws-dropzone-btn {
    font-size: 13px !important;
    padding: 6px 16px !important;
}

.ws-files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.ws-files-empty {
    text-align: center;
    padding: 16px;
    color: var(--ws-text-muted);
    font-size: 13px;
}

.ws-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--ws-bg-secondary);
    transition: background 0.15s;
}

.ws-file-item:hover {
    background: var(--ws-bg-hover);
}

.ws-file-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.ws-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ws-file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ws-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-file-name:hover {
    color: var(--ws-primary);
    text-decoration: underline;
}

.ws-file-size {
    font-size: 11px;
    color: var(--ws-text-muted);
}

.ws-file-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ws-text-muted);
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s;
}

.ws-file-item:hover .ws-file-delete {
    opacity: 1;
}

.ws-file-delete:hover {
    color: #e2445c;
    background: rgba(226, 68, 92, 0.1);
}

.ws-upload-bar {
    height: 4px;
    background: var(--ws-bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.ws-upload-bar-fill {
    height: 100%;
    background: var(--ws-primary);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

.ws-upload-text {
    font-size: 12px;
    color: var(--ws-text-secondary);
    margin-top: 4px;
    text-align: center;
}

/* ================================================================
   TEAM DASHBOARD (owner-only) — slider + content
   ================================================================ */

/* Trigger sidebar */
.sidebar-team-dashboard-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 16px);
    margin: 8px 8px 4px 8px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    color: var(--ws-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.sidebar-team-dashboard-btn:hover {
    background: var(--ws-bg-hover);
    border-color: var(--ws-primary);
    color: var(--ws-primary);
}
.sidebar.collapsed .sidebar-team-dashboard-btn { display: none !important; }

/* Slider overlay + panel: replica del .task-detail-panel */
.team-dashboard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}
.team-dashboard-overlay.show {
    opacity: 1;
    visibility: visible;
}

.team-dashboard-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 880px;
    max-width: 95vw;
    background: var(--ws-bg);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid var(--ws-border);
}
.team-dashboard-panel.show { transform: translateX(0); }

.team-dashboard-header {
    position: relative;
    padding: 18px 22px 0 22px;
    border-bottom: 1px solid var(--ws-border);
    background: var(--ws-bg);
    flex-shrink: 0;
}
.team-dashboard-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--ws-text-muted);
    border: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.team-dashboard-close:hover { background: var(--ws-bg-hover); color: var(--ws-text); }

.team-dashboard-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-right: 40px;
}
.team-dashboard-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ws-text);
}
.team-dashboard-title svg { color: var(--ws-primary); }

.team-dashboard-period {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: 13px;
    cursor: pointer;
}

.team-dashboard-tabs {
    display: flex;
    gap: 4px;
    border-bottom: none;
    overflow-x: auto;
}
.team-dashboard-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--ws-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.team-dashboard-tab:hover { color: var(--ws-text); }
.team-dashboard-tab.active {
    color: var(--ws-primary);
    border-bottom-color: var(--ws-primary);
}

.team-dashboard-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px 28px 22px;
    background: var(--ws-bg-secondary);
}

/* Loading + error */
.team-dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 20px;
    color: var(--ws-text-secondary);
    font-size: 13px;
}
.team-dashboard-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--ws-border);
    border-top-color: var(--ws-primary);
    border-radius: 50%;
    animation: td-spin 0.8s linear infinite;
}
@keyframes td-spin { to { transform: rotate(360deg); } }

.team-dashboard-error {
    text-align: center;
    padding: 60px 20px;
    color: var(--ws-text-secondary);
}
.team-dashboard-error svg { color: #e2445c; opacity: 0.85; margin-bottom: 12px; }
.team-dashboard-error h4 { margin: 0 0 6px; color: var(--ws-text); font-size: 15px; }
.team-dashboard-error p  { margin: 0; font-size: 13px; }

/* KPI cards */
.team-dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}
.td-kpi {
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    padding: 14px 16px;
    transition: border-color .15s, transform .15s;
}
.td-kpi:hover { border-color: var(--ws-primary); transform: translateY(-1px); }
.td-kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ws-text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.td-kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--ws-text);
    line-height: 1.1;
}
.td-kpi-of {
    font-size: 14px;
    font-weight: 500;
    color: var(--ws-text-muted);
    margin-left: 2px;
}
.td-kpi-sub {
    margin-top: 4px;
    font-size: 11px;
    color: var(--ws-text-muted);
}

@media (max-width: 768px) {
    .team-dashboard-kpis { grid-template-columns: repeat(2, 1fr); }
}

/* Sezioni */
.team-dashboard-section {
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.td-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.td-section-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ws-text);
}
.td-section-hint {
    font-size: 11px;
    color: var(--ws-text-muted);
}

/* Chart container */
.team-dashboard-chart {
    width: 100%;
    height: 280px;
}

/* Tabella membri */
.team-dashboard-table-wrap {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--ws-border-light);
}
.team-dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.team-dashboard-table thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--ws-bg-tertiary);
    color: var(--ws-text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--ws-border);
}
.team-dashboard-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--ws-border-light);
    color: var(--ws-text);
    vertical-align: middle;
}
.team-dashboard-table tbody tr:last-child td { border-bottom: none; }
.team-dashboard-table tbody tr:hover { background: var(--ws-bg-hover); }
.td-num   { text-align: right; font-variant-numeric: tabular-nums; }
.td-strong{ font-weight: 600; color: var(--ws-text); }
.td-rel   { color: var(--ws-text-secondary); font-size: 12px; white-space: nowrap; }
.td-empty { text-align: center; color: var(--ws-text-muted); padding: 24px !important; }

.td-member-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
}
.td-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.td-member-info { min-width: 0; }
.td-member-name {
    font-weight: 500;
    color: var(--ws-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.td-member-email {
    font-size: 11px;
    color: var(--ws-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.td-owner-pill {
    display: inline-block;
    padding: 1px 6px;
    background: var(--ws-primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Activity tab */
.team-dashboard-activity-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
}
.td-filter {
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: 12px;
    cursor: pointer;
}
.td-filter-reset {
    margin-left: auto;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    color: var(--ws-text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.td-filter-reset:hover { background: var(--ws-bg-hover); color: var(--ws-text); }

.team-dashboard-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    overflow: hidden;
}
.td-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ws-border-light);
}
.td-feed-item:last-child { border-bottom: none; }
.td-feed-item:hover { background: var(--ws-bg-hover); }

.td-feed-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.td-feed-body { flex: 1; min-width: 0; }
.td-feed-line {
    font-size: 13px;
    color: var(--ws-text);
    line-height: 1.45;
    word-break: break-word;
}
.td-feed-line strong { font-weight: 600; margin-right: 4px; }
.td-feed-action { color: var(--ws-text-secondary); margin: 0 4px 0 0; }
.td-feed-title { color: var(--ws-text); }
.td-feed-amount {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    background: rgba(226, 68, 92, 0.10);
    color: #e2445c;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.td-feed-time {
    margin-top: 2px;
    font-size: 11px;
    color: var(--ws-text-muted);
}
.td-empty-feed {
    padding: 30px 18px;
    text-align: center;
    color: var(--ws-text-muted);
    background: var(--ws-bg);
    border: 1px dashed var(--ws-border);
    border-radius: 8px;
    font-size: 13px;
}

/* Balances tab */
.td-balances-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.td-bal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--ws-bg-secondary);
    border: 1px solid var(--ws-border-light);
    border-radius: 8px;
}
.td-bal-main { flex: 1; min-width: 0; }
.td-bal-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.td-bal-name {
    font-weight: 500;
    color: var(--ws-text);
    font-size: 13px;
}
.td-bal-amount {
    font-weight: 600;
    color: var(--ws-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.td-bal-eur {
    font-weight: 400;
    color: var(--ws-text-muted);
    font-size: 11px;
    margin-left: 4px;
}
.td-bal-bar {
    height: 6px;
    background: var(--ws-border-light);
    border-radius: 3px;
    overflow: hidden;
}
.td-bal-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .3s ease;
}
.td-bal-pct {
    margin-top: 4px;
    font-size: 10px;
    color: var(--ws-text-muted);
}
.td-bal-transfer {
    padding: 6px 12px;
    background: var(--ws-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
}
.td-bal-transfer:hover { background: var(--ws-primary-hover); }

.td-transfers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    overflow: hidden;
}
.td-transfer-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ws-border-light);
}
.td-transfer-item:last-child { border-bottom: none; }
.td-transfer-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(143, 0, 255, 0.10);
    color: var(--ws-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.td-transfer-body { flex: 1; min-width: 0; }
.td-transfer-line {
    font-size: 13px;
    color: var(--ws-text);
}
.td-transfer-arrow { color: var(--ws-text-muted); margin: 0 6px; }
.td-transfer-amount {
    margin-left: auto;
    float: right;
    font-weight: 600;
    color: var(--ws-primary);
    font-variant-numeric: tabular-nums;
}
.td-transfer-time {
    margin-top: 2px;
    font-size: 11px;
    color: var(--ws-text-muted);
}

/* Mobile */
@media (max-width: 768px) {
    .team-dashboard-panel { width: 100vw; max-width: 100vw; }
    .team-dashboard-body  { padding: 14px; }
    .team-dashboard-table-wrap { font-size: 12px; }
}

/* ── Workspace interactive forms (same forms as chat, remapped to --ws-* vars) ── */
#wsFormModal .interactive-form {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    animation: none;
}
#wsFormModal .interactive-form h4 {
    color: var(--ws-text);
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 600;
    border: none;
}
#wsFormModal .form-field {
    margin-bottom: 14px;
}
#wsFormModal .form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--ws-text);
    font-size: 13px;
}
#wsFormModal .form-field input,
#wsFormModal .form-field select,
#wsFormModal .form-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    background: var(--ws-bg);
    color: var(--ws-text);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
    outline: none;
}
#wsFormModal .form-field input:focus,
#wsFormModal .form-field select:focus,
#wsFormModal .form-field textarea:focus {
    border-color: var(--ws-accent);
}
#wsFormModal .form-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
#wsFormModal .form-field textarea {
    min-height: 80px;
    resize: vertical;
}
#wsFormModal .form-help {
    font-size: 11px;
    color: var(--ws-text-muted);
    margin-top: 4px;
}
#wsFormModal .form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ws-border);
}
#wsFormModal .btn-form {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: opacity 0.15s;
}
#wsFormModal .btn-form:hover { opacity: 0.85; }
#wsFormModal .btn-secondary {
    background: var(--ws-bg-tertiary);
    color: var(--ws-text-muted);
}
#wsFormModal .btn-primary {
    background: var(--ws-accent);
    color: #fff;
}
#wsFormModal .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
#wsFormModal .checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: border-color 0.15s;
}
#wsFormModal .checkbox-item:hover { border-color: var(--ws-accent); }
#wsFormModal .checkbox-item.checked { border-color: var(--ws-accent); color: var(--ws-accent); }
#wsFormModal .checkbox-item input[type="checkbox"] { width: auto; margin: 0; }

/* ── Global drag-to-attach overlay ── */
.ws-drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.ws-drag-overlay.active {
    display: flex;
}
.ws-drag-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px 56px;
    border: 2px dashed rgba(143,0,255,0.6);
    border-radius: 20px;
    background: rgba(143,0,255,0.08);
    text-align: center;
    color: #fff;
    animation: wsDragPulse 1.8s ease-in-out infinite;
}
@keyframes wsDragPulse {
    0%, 100% { border-color: rgba(143,0,255,0.6); }
    50%       { border-color: rgba(143,0,255,1); }
}
.ws-drag-overlay-content svg {
    width: 48px; height: 48px;
    opacity: 0.9;
    color: var(--ws-primary);
}
.ws-drag-overlay-content p {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin: 0;
}
.ws-drag-overlay-content span {
    font-size: 14px;
    opacity: 0.7;
    margin: 0;
}

/* ── Composer attachment preview strip ── */
.ws-attachments-preview {
    padding: 10px 12px 0;
    border-bottom: 0;
}
.ws-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Attachment card (doc) ── */
.ws-attachment-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ws-bg);
    border: 1px solid var(--ws-border);
    border-radius: 12px;
    font-size: 13px;
    color: var(--ws-text);
    animation: wsFadeInUp 0.18s ease-out;
    min-width: 160px;
    max-width: 260px;
}
@keyframes wsFadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ws-attachment-icon-wrapper {
    width: 36px; height: 36px; min-width: 36px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #10a37f, #1a7f64);
    border-radius: 8px;
    flex-shrink: 0;
}
.ws-attachment-icon-wrapper svg { width: 18px; height: 18px; color: #fff; }
.ws-attachment-icon-wrapper.pdf  { background: linear-gradient(135deg, var(--color-danger), #dc2626); }
.ws-attachment-icon-wrapper.excel { background: linear-gradient(135deg, #22c55e, #16a34a); }
.ws-attachment-icon-wrapper.word  { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.ws-attachment-icon-wrapper.ppt   { background: linear-gradient(135deg, #f97316, #ea580c); }
.ws-attachment-icon-wrapper.text  { background: linear-gradient(135deg, #6b7280, #4b5563); }
.ws-attachment-icon-wrapper.zip   { background: linear-gradient(135deg, #a855f7, #7c3aed); }
.ws-attachment-file-info {
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden; flex: 1;
}
.ws-attachment-file-name {
    font-weight: 500; font-size: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--ws-text);
}
.ws-attachment-file-type { font-size: 11px; color: var(--ws-text-muted); }
.ws-remove-file {
    position: absolute; top: -6px; right: -6px;
    width: 20px; height: 20px;
    background: var(--ws-bg-secondary);
    border: 1px solid var(--ws-border);
    border-radius: 50%;
    color: var(--ws-text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.ws-remove-file:hover { background: var(--color-danger); border-color: var(--color-danger); color: #fff; transform: scale(1.1); }
.ws-remove-file svg { width: 10px; height: 10px; }

/* ── Attachment card (image thumbnail) ── */
.ws-attachment-item.image-preview {
    padding: 0; min-width: auto; max-width: none;
    width: 64px; height: 64px; border-radius: 10px;
    overflow: visible; cursor: pointer; background: none;
}
.ws-attachment-item.image-preview img {
    width: 64px; height: 64px; border-radius: 10px;
    object-fit: cover; display: block;
    border: 1px solid var(--ws-border);
}
.ws-attachment-item.image-preview .ws-remove-file { top: -5px; right: -5px; }

/* ── Lightbox ── */
.ws-attachment-lightbox {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(0,0,0,0.88);
    display: flex; align-items: center; justify-content: center;
    animation: wsFadeInUp 0.12s ease;
    cursor: zoom-out;
}
.ws-attachment-lightbox img {
    max-width: 90vw; max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    object-fit: contain;
}
.ws-attachment-lightbox-close {
    position: fixed; top: 20px; right: 20px;
    width: 38px; height: 38px;
    border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,0.12); color: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.ws-attachment-lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* PED "Crea automaticamente tutti i post": disabilitato finché recurring è in beta.
   Regola globale (non solo inline) per nascondere anche i PED già salvati e
   ri-renderizzati verbatim dalla cronologia (l'HTML persistito conserva il pulsante visibile). */
button[onclick*="createAllPosts"] { display: none !important; }

/* ============================================================================
   P1 MOBILE — bottom-sheet per le modali workspace. SOLO ≤768px:
   il desktop mantiene le modali centrate identiche a prima.
   ============================================================================ */
@media (max-width: 768px) {
    .ws-modal-overlay,
    .qa-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .ws-modal,
    .qa-modal {
        width: 100%;
        max-width: none;
        max-height: 92dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 16px 16px 0 0;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}
