/* Progetti: board, backlog, timesheet, indicatori. Usa i colori di enigma.css */

/* Barra di avanzamento (budget ore, sprint) */
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; min-width: 80px; }
.bar > span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--success); }
.bar.tone-warning > span { background: var(--warning); }
.bar.tone-danger > span { background: var(--danger); }
.bar-cell { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }

/* Intestazione della scheda progetto */
.project-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-card .stat-label { font-size: 12px; color: var(--tx2); }
.stat-card .stat-value { font-size: 20px; font-weight: 600; font-family: var(--font-display); }
.stat-card .stat-sub { font-size: 12px; color: var(--tx2); }
.tabs.scroll { overflow-x: auto; }
.tabs.scroll .tab { white-space: nowrap; }
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .cards-2 { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head .spacer { flex: 1; }

/* Grafico a barre semplice (ore per settimana) */
.week-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.week-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week-bars .col span.fill { width: 100%; max-width: 28px; background: var(--accent-strong); border-radius: 3px 3px 0 0; min-height: 2px; }
.week-bars .col small { font-size: 10px; color: var(--tx2); }
.person-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }

/* Board */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.board-col { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px; min-height: 240px; display: flex; flex-direction: column; gap: 8px; }
.board-col.drop { border-color: var(--primary); background: var(--accent-soft); }
.board-col.over-limit { border-color: var(--danger); }
.board-col-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; padding: 2px 4px 6px; }
.board-col-head .spacer { flex: 1; }
.work-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; font-size: 13px; }
.work-card:hover { border-color: var(--accent-strong); }
.work-card-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx2); }
.work-card-head .spacer { flex: 1; }
.work-card-title { font-weight: 500; line-height: 1.35; color: var(--tx); }
.work-card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tx2); }
.work-card-foot .spacer { flex: 1; }
.type-icon { font-size: 16px !important; }
.mini-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--onaccent); font-size: 10px; font-weight: 600; }

/* Backlog */
.rank-btns { display: inline-flex; gap: 2px; }
.grid td.wrap { white-space: normal; }
.grid tr.epic td { background: color-mix(in oklch, var(--warning) 5%, transparent); }

/* Timesheet */
.ts-grid { min-width: 980px; }
.ts-grid td, .ts-grid th { height: 40px; }
.ts-grid th.day, .ts-grid td.day { width: 78px; text-align: center; }
.ts-grid th.day.weekend, .ts-grid td.day.weekend { background: color-mix(in oklch, var(--hover) 60%, transparent); }
.ts-cell { width: 60px; height: 30px; text-align: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--tx); font: inherit; font-size: 13px; }
.ts-cell:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.ts-cell.has-note { border-bottom: 2px solid var(--info); }
.ts-cell.selected { border-color: var(--primary); }
.ts-grid tfoot td { font-weight: 600; background: var(--bg); }
.ts-grid tbody tr { cursor: default; }
.ts-row-label { display: flex; flex-direction: column; gap: 4px; min-width: 260px; }
.ts-note { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.ts-note .input { flex: 1; }
.ts-summary { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }

/* Burndown */
.burndown svg { width: 100%; height: 180px; display: block; }
.burndown .ideal { stroke: var(--neutral); stroke-dasharray: 4 4; fill: none; }
.burndown .actual { stroke: var(--info); stroke-width: 2; fill: none; }
.burndown .grid-line { stroke: var(--border); }

/* Tracciabilità */
.trace-items { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.trace-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.record-lock { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--success); }
.record-lock .material-symbols-outlined { font-size: 15px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }

/* ---- Stile Jira: tipi, stati, priorità, epic ---- */
.issue-type { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 3px; color: #fff; flex: none; }
.issue-type .material-symbols-outlined { font-size: 12px !important; font-variation-settings: 'FILL' 1, 'wght' 600; }
.issue-type.t-epic { background: #904EE2; }
.issue-type.t-story { background: #63BA3C; }
.issue-type.t-task { background: #4BADE8; }
.issue-type.t-bug { background: #E5493A; }
.issue-type.t-subtask { background: #4BADE8; border-radius: 50%; }
.lozenge { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.lozenge.s-todo { background: #DFE1E6; color: #42526E; }
.lozenge.s-progress { background: #DEEBFF; color: #0747A6; }
.lozenge.s-review { background: #EAE6FF; color: #403294; }
.lozenge.s-done { background: #E3FCEF; color: #006644; }
[data-theme="dark"] .lozenge.s-todo { background: #3B4048; color: #C7D1DB; }
[data-theme="dark"] .lozenge.s-progress { background: #09326C; color: #85B8FF; }
[data-theme="dark"] .lozenge.s-review { background: #352C63; color: #B8ACF6; }
[data-theme="dark"] .lozenge.s-done { background: #164B35; color: #7EE2B8; }
.prio { font-size: 16px !important; }
.prio.p-critical { color: #E5493A; } .prio.p-high { color: #FF7452; } .prio.p-normal { color: #FFAB00; } .prio.p-low { color: #2684FF; }
.epic-chip { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epic-chip.c0 { background: #EAE6FF; color: #403294; } .epic-chip.c1 { background: #DEEBFF; color: #0747A6; }
.epic-chip.c2 { background: #E3FCEF; color: #006644; } .epic-chip.c3 { background: #E6FCFF; color: #065769; }
.epic-chip.c4 { background: #FFF0B3; color: #7A4F01; } .epic-chip.c5 { background: #FFEBE6; color: #BF2600; }
.label-chip { display: inline-flex; align-items: center; gap: 2px; height: 18px; padding: 0 6px; border-radius: 3px; font-size: 11.5px; background: var(--hover); color: var(--tx2); }
.issue-key { font-size: 12px; color: var(--tx2); font-weight: 500; white-space: nowrap; }
a.issue-key:hover, a.issue-link:hover { text-decoration: underline; }
a.issue-link { color: var(--tx); text-decoration: none; }
.points-pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--hover); font-size: 11px; font-weight: 600; color: var(--tx2); }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .mini-avatar { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); margin-left: -6px; cursor: pointer; }
.avatar-stack .mini-avatar:first-child { margin-left: 0; }
.avatar-stack .mini-avatar.on { outline: 2px solid var(--primary); outline-offset: 1px; z-index: 1; }
.mini-avatar.empty { background: var(--hover); color: var(--tx2); }

/* Board stile Jira */
.board.jira { grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 8px; }
.board.jira .board-col { background: var(--bg); border: 0; border-radius: 6px; padding: 6px; min-height: 120px; gap: 6px; }
[data-theme="dark"] .board.jira .board-col { background: color-mix(in oklch, var(--surface) 70%, var(--bg)); }
.board.jira .board-col-head { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--tx2); padding: 6px 6px 4px; letter-spacing: .02em; }
.board.jira .work-card { border-radius: 4px; box-shadow: 0 1px 1px rgba(9,30,66,.25); border: 0; padding: 10px; gap: 6px; }
.board.jira .work-card:hover { background: var(--hover); }
.board.jira .work-card.dragging { opacity: .4; }
.board.jira .work-card-foot { gap: 6px; }
.swimlane-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.swimlane-head .muted { font-weight: 400; }
.quick-create { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 4px; background: var(--surface); box-shadow: 0 1px 1px rgba(9,30,66,.25); }
.quick-create-row { display: flex; gap: 6px; align-items: center; }
.quick-create .input { height: 30px; }
.add-btn { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--tx2); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.add-btn:hover { background: var(--hover); color: var(--tx); }

/* Backlog stile Jira */
.bl-section { background: var(--bg); border-radius: 6px; padding: 8px; margin-bottom: 12px; }
[data-theme="dark"] .bl-section { background: color-mix(in oklch, var(--surface) 70%, var(--bg)); }
.bl-section.drop { outline: 2px dashed var(--primary); }
.bl-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px; font-size: 13px; }
.bl-head .spacer { flex: 1; }
.bl-head .bl-title { font-weight: 600; }
.bl-rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.bl-row { display: grid; grid-template-columns: 16px 16px 90px minmax(0, 1fr) auto auto 24px 24px 28px; align-items: center; gap: 8px; padding: 0 10px; min-height: 38px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.bl-row:last-child { border-bottom: 0; }
.bl-row:hover { background: var(--hover); }
.bl-row.drop-before { box-shadow: inset 0 2px 0 var(--primary); }
.bl-row .drag { color: var(--tx2); cursor: grab; font-size: 16px; opacity: .5; }
.bl-row:hover .drag { opacity: 1; }
.bl-row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row .title.done { text-decoration: line-through; color: var(--tx2); }
.bl-row .tags { display: flex; gap: 4px; justify-content: flex-end; overflow: hidden; }
.bl-empty { padding: 14px; text-align: center; font-size: 13px; color: var(--tx2); border: 1px dashed var(--border); border-radius: 4px; }
.bl-totals { display: inline-flex; gap: 4px; }
.bl-totals span { min-width: 22px; text-align: center; border-radius: 9px; font-size: 11px; font-weight: 600; padding: 1px 6px; }
.bl-totals .t-todo { background: #DFE1E6; color: #42526E; } .bl-totals .t-progress { background: #DEEBFF; color: #0747A6; } .bl-totals .t-done { background: #E3FCEF; color: #006644; }

/* Pagina dell'elemento stile Jira */
.issue-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 1100px) { .issue-page { grid-template-columns: 1fr; } }
.issue-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--tx2); margin-bottom: 10px; flex-wrap: wrap; }
.issue-crumbs a { color: var(--tx2); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.issue-crumbs a:hover { text-decoration: underline; }
.issue-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 0 0 12px; padding: 4px 6px; margin-left: -6px; border-radius: 4px; cursor: text; }
.issue-title:hover { background: var(--hover); }
.issue-title-input { font-family: var(--font-display); font-size: 24px; font-weight: 600; width: 100%; padding: 4px 6px; margin: 0 0 12px -6px; border: 2px solid var(--primary); border-radius: 4px; background: var(--surface); color: var(--tx); box-sizing: border-box; }
.issue-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.issue-section { margin-bottom: 26px; }
.issue-section > h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.issue-section > h3 .spacer { flex: 1; }
.rich { font-size: 14px; line-height: 1.6; padding: 6px 8px; margin-left: -8px; border-radius: 4px; overflow-wrap: anywhere; }
.rich.editable { cursor: text; }
.rich.editable:hover { background: var(--hover); }
.rich p:first-child { margin-top: 0; } .rich p:last-child { margin-bottom: 0; }
.rich .placeholder { color: var(--tx2); }
.editor textarea { width: 100%; min-height: 160px; box-sizing: border-box; font-family: var(--mono); font-size: 13px; }
.editor-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.child-list { border: 1px solid var(--border); border-radius: 4px; }
.child-row { display: grid; grid-template-columns: 16px 80px minmax(0, 1fr) auto 24px auto; gap: 8px; align-items: center; padding: 0 10px; min-height: 36px; border-bottom: 1px solid var(--border); font-size: 13px; }
.child-row:last-child { border-bottom: 0; }
.child-row:hover { background: var(--hover); }
.progress-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--tx2); margin-bottom: 8px; }
.progress-line .bar { flex: 1; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.attach-card { border: 1px solid var(--border); border-radius: 4px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; position: relative; }
.attach-card a { color: var(--tx); text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-card .material-symbols-outlined.file { font-size: 28px; color: var(--tx2); }
.attach-card .icon-btn { position: absolute; top: 4px; right: 4px; }
.activity-tabs { display: flex; gap: 6px; margin-bottom: 14px; align-items: center; }
.activity-tabs .chip { height: 28px; }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.comment .mini-avatar { width: 32px; height: 32px; font-size: 12px; }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; margin-bottom: 4px; }
.comment-body { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 6px; }
.comment-actions { display: flex; gap: 10px; margin-top: 4px; font-size: 12px; }
.comment-actions button { border: 0; background: none; padding: 0; color: var(--tx2); font: inherit; cursor: pointer; }
.comment-actions button:hover { text-decoration: underline; color: var(--tx); }
.composer textarea { width: 100%; min-height: 80px; box-sizing: border-box; }
.mention-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mention-bar button { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; font: inherit; font-size: 11.5px; padding: 1px 8px; cursor: pointer; color: var(--tx2); }
.history-item { font-size: 13px; margin-bottom: 14px; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.history-change { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 12.5px; }
.history-change .old { text-decoration: line-through; color: var(--tx2); }
.issue-side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 12px; }
.status-select { appearance: none; height: 32px; padding: 0 30px 0 12px; border: 0; border-radius: 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.status-select.s-todo { background-color: #DFE1E6; color: #42526E; }
.status-select.s-progress { background-color: #0052CC; color: #fff; }
.status-select.s-review { background-color: #5243AA; color: #fff; }
.status-select.s-done { background-color: #00875A; color: #fff; }
.details { border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.details-head { padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.details-body { padding: 8px 14px 12px; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 4px 10px; align-items: center; font-size: 13px; }
.details-body > .k { color: var(--tx2); padding: 6px 0; }
.details-body > .v { min-height: 30px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.details-body .inline-input { width: 100%; height: 30px; border: 1px solid transparent; background: transparent; border-radius: 3px; font: inherit; font-size: 13px; color: var(--tx); padding: 0 6px; margin-left: -6px; }
.details-body .inline-input:hover:not(:disabled) { background: var(--hover); }
.details-body .inline-input:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.link-btn { border: 0; background: none; padding: 0; color: var(--info); font: inherit; font-size: 12px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.time-track { display: flex; flex-direction: column; gap: 4px; width: 100%; cursor: pointer; }
.time-track .bar > span { background: #0065FF; }
.time-track .bar.over > span { background: #FF5630; }
.time-track .row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--tx2); }
.meta-foot { font-size: 12px; color: var(--tx2); display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.worklog-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; margin-bottom: 14px; font-size: 13px; }

/* Lavoro fatto con un agente AI (task, commenti, ore) */
.ai-badge { display: inline-flex; align-items: center; gap: 2px; height: 18px; padding: 0 6px 0 4px; border-radius: 9px; font-size: 11px; font-weight: 700; background: #EAE6FF; color: #403294; vertical-align: middle; white-space: nowrap; }
.ai-badge .material-symbols-outlined { font-size: 13px; }
