body { font-family: "Inter", "Segoe UI", Arial, sans-serif; background: #0b1020; color: #e2e8f0; margin: 0; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; min-width: 230px; max-width: 230px; background: var(--panel); color: var(--text); padding: 20px 16px; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; transition: width 0.2s ease, min-width 0.2s ease, max-width 0.2s ease; }
.brand { font-weight: 700; font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.brand span { white-space: nowrap; }
.brand-logo { width: 28px; height: 28px; object-fit: contain; }
.sidebar-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.sidebar-toggle { background: var(--panel); border: 1px solid var(--stroke2); color: var(--muted); }
.sidebar-toggle:hover { background: var(--card); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.nav-link:hover { background: rgba(148, 163, 184, 0.12); }
.nav-link.active { background: rgba(59, 130, 246, 0.2); color: #fff; font-weight: 600; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--muted); }
.nav-link.active .nav-icon { color: #e2e8f0; }

.sidebar.collapsed { width: 72px; min-width: 72px; max-width: 72px; padding: 24px 12px; }
.sidebar.collapsed .brand { justify-content: center; margin-bottom: 12px; gap: 0; }
.sidebar.collapsed .brand span { display: none; }
.sidebar.collapsed .brand-logo { width: 26px; height: 26px; }
.sidebar.collapsed .sidebar-actions { justify-content: center; }
.sidebar.collapsed .nav-link { justify-content: center; gap: 0; padding: 10px; font-size: 0; }
.sidebar.collapsed .nav-icon { width: 20px; height: 20px; }
.content { flex: 1; padding: 24px; }
.container { text-align: left; }
.card { text-align: left; }
.modal-card { text-align: left; }
.container { max-width: none; width: 100%; margin: 24px 0; background: var(--card); padding: 24px; border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid var(--stroke); }
.login-container { max-width: 420px; margin: 40px auto; }
input, select, textarea { 
  padding: 8px 12px; 
  width: 260px; 
  background: var(--panel); 
  color: var(--text); 
  border: 1px solid var(--stroke2); 
  border-radius: 8px; 
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

input:disabled, select:disabled, textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg);
}

select option {
  background: var(--panel);
  color: var(--text);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.input-full-width {
  width: 100% !important;
}

.input-min-width {
  min-width: 140px;
}
button { padding: 10px 14px; cursor: pointer; background: var(--primary); color: #fff; border: none; border-radius: 8px; }
button:hover { background: #2563eb; }
.secondary { background: var(--panel); border: 1px solid var(--stroke); }
.secondary:hover { background: var(--card); }
.danger { background: var(--bad); }
.danger:hover { background: #dc2626; }
.small { padding: 6px 10px; font-size: 12px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row.align-center { align-items: center; }
.row.space-between { justify-content: space-between; }
.admin-user-picker { text-align: left; }
.dashboard-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 18px; flex-wrap: wrap; }
.dashboard-toolbar .toolbar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #cbd5f5; background: #0f172a; border: 1px solid #1f2937; border-radius: 999px; padding: 6px 10px; }
.check-toggle input { width: auto; margin: 0; }
.calendar-actions { display: flex; gap: 10px; margin: 12px 0 18px; flex-wrap: wrap; }
.dashboard-subnav { display: flex; gap: 10px; margin: 0 0 14px; }
.subnav-link { padding: 6px 12px; border-radius: 999px; border: 1px solid #1f2937; text-decoration: none; color: #cbd5f5; font-size: 12px; }
.subnav-link.active { background: #2563eb; border-color: #2563eb; color: #fff; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-header .hint { margin: 0; }
.hide-hours .hours-col { display: none; }
.hide-tasks .tasks-section { display: none; }
.hide-expenses .expenses-section { display: none; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: 150px; }
.inline-form input[type="file"] { width: 220px; }
.receipt-preview { display: flex; flex-direction: column; gap: 6px; }
.receipt-preview img { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid #1f2937; cursor: pointer; }
.alert { background: #3f1d1d; border: 1px solid #7f1d1d; color: #fecaca; }
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #334155; color: #e2e8f0; }
.status-bozza { background: #334155; color: #e2e8f0; }
.status-inviata { background: #1e293b; color: #38bdf8; }
.status-approvata { background: #052e1a; color: #4ade80; }
.status-rifiutata { background: #3f1d1d; color: #f87171; }
.status-open { background: #065f46; color: #86efac; }
.status-waiting_invoice { background: #713f12; color: #fde047; }
.status-invoice_issued { background: #1e40af; color: #93c5fd; }
.status-invoice_paid { background: #15803d; color: #86efac; }
.status-hold { background: #78350f; color: #fbbf24; }
.status-closed { background: #374151; color: #9ca3af; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; }
.card { background: var(--card); border: 1px solid var(--stroke); padding: 16px; border-radius: var(--r); }
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 12px; background: #101a2d; border-radius: 12px; overflow: hidden; border: 1px solid #2a3a54; }
th, td { border-bottom: 1px solid #2a3a54; padding: 10px; text-align: left; color: #e2e8f0; }
th { background: #0f172a; text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; color: #94a3b8; }
tbody tr:nth-child(odd) { background: #132033; }
tbody tr:nth-child(even) { background: #162438; }
tbody tr:hover { background: #1e2d45; }
.table-scroll { 
    position: relative; 
    min-height: 448px; 
    max-height: 600px; 
    overflow-y: scroll; 
    overflow-x: auto; 
    border-radius: 12px; 
    border: 1px solid var(--stroke2); 
    z-index: 1; 
}
.table-scroll table { 
    margin-top: 0; 
    border-radius: 0; 
    border: none; 
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky table headers - base */
.table-scroll thead th { 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    background: #0f172a;
    border-bottom: 2px solid var(--stroke2);
}

/* Quando ci sono controlli sticky sopra, l'header della tabella deve essere sotto */
.table-with-controls thead th {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Filter rows sticky below header */
.filter-row th { 
    position: sticky; 
    top: 34px; 
    z-index: 99; 
    background: #111b31; 
}
.filter-row input, .filter-row select { 
    width: 100%; 
    padding: 6px; 
    font-size: 10px; 
}
.filter-row select { 
    height: 70px; 
}
.filter-row .date-filter { 
    display: grid; 
    gap: 4px; 
}
.filter-row input:disabled { 
    opacity: 0.35; 
    cursor: not-allowed; 
}

/* Table collapsible container */
.table-collapsible { 
    display: grid; 
    gap: 8px; 
}

/* Wrapper per sezione tabella con controlli separati */
.table-section-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Controlli sticky sopra la tabella - SEPARATI */
.table-controls-bar { 
    display: flex; 
    justify-content: flex-end; 
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg);
    padding: 8px 16px;
    border-bottom: 2px solid var(--stroke);
    margin-bottom: 0;
}

/* Container tabella scrollabile */
.table-scroll-container {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--stroke2);
    border-radius: 0 0 12px 12px;
    position: relative;
}

.table-scroll-container thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #0f172a;
    border-bottom: 2px solid var(--stroke2);
}

.table-scroll-container table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Tabella con controlli sopra - header sticky con offset */
.table-with-controls {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
}

.table-collapsible.collapsed tbody tr:nth-child(n+4) { 
    display: none; 
}

/* Fix for select dropdowns - ensure they appear above table */
.table-scroll select,
.table-scroll input[type="date"],
.table-scroll input[type="time"] {
    position: relative;
    z-index: 50;
}

.table-scroll select:focus,
.table-scroll input:focus {
    z-index: 200;
}

/* Container for proper overflow handling */
.table-scroll-container {
    position: relative;
    overflow: visible;
}

.table-scroll-container .table-scroll {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Ensure action buttons in table are visible */
.table-scroll .actions-col {
    position: relative;
    z-index: 10;
}

.table-scroll .actions-col button,
.table-scroll .actions-col input {
    position: relative;
    z-index: 20;
}

/* Fix per header separato sticky */
.table-compact {
    border-collapse: separate;
    border-spacing: 0;
}

/* Sticky header per tabelle compatte */
.table-compact thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #0f172a;
    border-bottom: 2px solid var(--stroke2);
}

.input-readonly { opacity: 0.8; background: #0b1220; }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.perf-card { background: #0f172a; border: 1px solid #1f2937; border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.perf-card.best { border-color: #22c55e; box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.4); }
.perf-title { font-weight: 600; }
.perf-sub { font-size: 11px; color: #94a3b8; }
.perf-row { display: grid; grid-template-columns: 92px 1fr 60px; gap: 8px; align-items: center; font-size: 11px; }
.perf-bar { height: 8px; background: #111827; border-radius: 999px; overflow: hidden; }
.perf-bar-fill { display: block; height: 100%; border-radius: 999px; }
.perf-bar-fill.ordinary { background: #38bdf8; }
.perf-bar-fill.overtime { background: #f87171; }
.perf-bar-fill.travel { background: #fbbf24; }
.perf-bar-fill.positive { background: #22c55e; }
.perf-bar-fill.warning { background: #f59e0b; }
.perf-bar-fill.negative { background: #ef4444; }
.hint { color: #94a3b8; font-size: 12px; margin-top: 12px; }
.table-compact th, .table-compact td { font-size: 10px; }
.table-compact input, .table-compact select, .table-compact button { font-size: 10px; }
.table-compact .hint { font-size: 10px; }
.table-compact th, .table-compact td { padding: 6px; }
.table-compact input, .table-compact select { width: 110px; }
.table-compact input[type="date"], .table-compact input[type="time"] { width: 105px; }
.table-compact input[type="number"] { width: 80px; }
.table-compact input[name="description"] { width: 140px; }
.table-compact input[name="receipt_currency"] { width: 60px; }
.table-compact input[name="exchange_rate"] { width: 70px; }
.table-compact input[data-expense-total] { width: 80px; }
.table-compact th.col-id, .table-compact td.col-id { width: 46px; max-width: 46px; }
.table-compact th.col-user, .table-compact td.col-user { width: 90px; max-width: 90px; }
.table-compact th.col-id, .table-compact td.col-id,
.table-compact th.col-user, .table-compact td.col-user { white-space: nowrap; }
.actions-col { text-align: center; width: 32px; }
.table-compact .actions-col { padding: 4px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; }
.icon-button svg, .icon-label svg { width: 14px; height: 14px; }
.icon-label { display: inline-flex; align-items: center; justify-content: center; color: #94a3b8; }
.ocr-filled { border-color: #38bdf8; box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2); }
.button-link { display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 8px; text-decoration: none; gap: 6px; }

.calendar-panel { margin-bottom: 24px; }
.calendar-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.calendar-title { font-weight: bold; font-size: 20px; margin-left: 0; margin-right: auto; }
.calendar-header .nav { background: #0f172a; border: 1px solid #1f2937; border-radius: 6px; padding: 6px 10px; color: #e2e8f0; }
.calendar-header .today { font-weight: 600; }
.calendar-grid { display: grid; grid-template-columns: 48px repeat(7, minmax(0, 1fr)); gap: 10px 10px; }
.calendar-weekdays span { font-size: 14px; color: var(--muted); text-align: center; padding: 8px 4px; background: transparent; }
.calendar-days { grid-auto-rows: 120px; }
.calendar-days button { border: none; background: transparent; padding: 0; text-align: left; font-size: 14px; cursor: pointer; color: var(--text); height: 100%; }
.calendar-days .calendar-empty { height: 100%; border-radius: 12px; background: transparent; }
.calendar-days button.other-month { opacity: 0.5; }
.calendar-days button.selected .airs-calendar-day { box-shadow: var(--focus); }
.calendar-days button.today .airs-calendar-day { border-color: var(--primary); }
.calendar-week-label { display: flex; align-items: center; justify-content: center; font-size: 14px; color: #94a3b8; background: #0b1220; border-right: 1px solid #1f2937; border-bottom: 1px solid #1f2937; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 14px; color: #94a3b8; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-box { width: 14px; height: 14px; border-radius: 4px; border: 2px solid #1f2937; }
.legend-box.under { border-color: #f59e0b; }
.legend-box.festive { border-color: #22c55e; }
.legend-box.malattia { border-color: #ef4444; }
.legend-box.permesso { border-color: #facc15; }
.legend-box.ferie { border-color: #c084fc; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.72); }
.modal-card { position: relative; z-index: 1; background: #0f172a; border: 1px solid #1f2937; border-radius: 12px; padding: 16px; width: min(520px, 92vw); box-shadow: 0 25px 70px rgba(15, 23, 42, 0.6); }
.modal-card.wide { width: min(820px, 96vw); min-height: 520px; max-height: 90vh; overflow: auto; }
.wizard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.wizard-title { font-size: 13px; font-weight: 600; color: #e2e8f0; }
.wizard-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: #94a3b8; background: #111827; padding: 4px 10px; border-radius: 999px; }
.wizard-progress-bar { display: inline-flex; width: 64px; height: 6px; background: #1f2937; border-radius: 999px; overflow: hidden; }
.wizard-progress-bar span { display: block; height: 100%; background: #38bdf8; width: 50%; }
.wizard-step.hidden { display: none; }
.wizard-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.ocr-form-section { background: #111827; padding: 12px; border-radius: 8px; margin-bottom: 12px; }
.ocr-form-section .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ocr-form-section label { font-size: 12px; color: #94a3b8; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-card h4 { margin: 0; font-size: 14px; }
.receipt-modal-body { display: flex; justify-content: center; }
.receipt-modal-body img { width: min(90vw, 640px); max-height: 80vh; border-radius: 10px; border: 1px solid #1f2937; object-fit: contain; }
.receipt-browser { display: grid; grid-template-columns: minmax(240px, 1fr) 3fr; gap: 16px; }
.receipt-tree { background: #0f172a; border: 1px solid #1f2937; border-radius: 12px; padding: 12px; max-height: 70vh; overflow: auto; }
.tree-root, .tree-root ul { list-style: none; margin: 0; padding-left: 16px; }
.tree-file button { background: transparent; border: none; color: #e2e8f0; padding: 4px 0; cursor: pointer; text-align: left; width: 100%; }
.tree-file button:hover { color: #38bdf8; }
.tree-empty { color: #64748b; font-size: 11px; padding: 4px 0; }
.receipt-preview-pane { background: #0f172a; border: 1px solid #1f2937; border-radius: 12px; padding: 12px; min-height: 320px; display: flex; align-items: center; justify-content: center; }
.receipt-preview-pane img { max-width: 100%; max-height: 70vh; border-radius: 10px; border: 1px solid #1f2937; }
.receipt-preview-pane iframe { width: 100%; height: 70vh; border: none; background: #0b1220; }
.project-row td { background: #0b1220; }
.preview-placeholder { color: #94a3b8; font-size: 12px; text-align: left; }
.summary-grid { display: grid; gap: 8px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.summary-label { color: #94a3b8; }
.summary-value { color: #e2e8f0; font-weight: 600; }
.summary-section { margin-top: 12px; }
.summary-section-title { font-size: 12px; font-weight: 600; color: #e2e8f0; margin-bottom: 6px; }
.summary-list { display: grid; gap: 6px; }
.summary-item { background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; padding: 8px; display: grid; gap: 4px; }
.summary-item[data-edit-task-id], .summary-item[data-edit-expense-id] { cursor: pointer; }
.summary-main { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.summary-title { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.summary-meta { font-size: 11px; color: #94a3b8; }
.summary-sub { font-size: 11px; color: #cbd5f5; }
.summary-empty { font-size: 11px; color: #64748b; }
.summary-item { background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; padding: 8px 28px 8px 8px; display: grid; gap: 4px; position: relative; }
.summary-item .delete-btn { position: absolute; bottom: 6px; right: 6px; background: transparent; border: none; cursor: pointer; font-size: 12px; padding: 2px; opacity: 0.6; transition: opacity 0.2s; z-index: 10; line-height: 1; }
.delete-btn:hover { opacity: 1; }

/* ── Rendering perf: skip off-screen table rows ── */
.summary-table-scroll tbody tr { content-visibility: auto; contain-intrinsic-size: 0 38px; }

/* ── Summary view tabs ── */
.summary-view-tabs { display: flex; border-bottom: 2px solid var(--stroke2); margin-bottom: 12px; gap: 0; }
.sv-tab { padding: 8px 20px; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; font-size: 13px; font-weight: 500; color: #94a3b8; transition: color .15s, border-color .15s; }
.sv-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; }
.sv-tab:hover:not(.active) { color: #cbd5e1; }

/* ── Row flash on save ── */
@keyframes row-saved-flash { 0%,100%{background:inherit} 30%{background:#052e16} }
tr.row-saved { animation: row-saved-flash 1.2s ease; }
tr.row-error { animation: row-saved-flash 1.2s ease; }
tr.row-error { animation: none; background: #3b1218 !important; }

/* ── Toast notification ── */
#airs-toast { position: fixed; bottom: 24px; right: 24px; background: #1e293b; color: #e2e8f0; padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; z-index: 9999; border: 1px solid #334155; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
#airs-toast.visible { opacity: 1; transform: translateY(0); }
#airs-toast.toast-error { border-color: #dc2626; color: #fca5a5; }
#airs-toast.toast-success { border-color: #16a34a; color: #86efac; }

.column-picker-body { max-height: 320px; overflow: auto; padding: 4px 2px; }
.column-picker-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 8px 12px; align-items: start; max-width: 720px; margin: 0; }
@media (max-width: 820px) {
  .column-picker-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}
@media (max-width: 560px) {
  .column-picker-grid { grid-template-columns: minmax(0, 1fr); }
}
.column-picker-item { display: grid; grid-template-columns: 16px 1fr; gap: 4px; align-items: center; font-size: 13px; justify-items: start; }
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.template-actions .inline-actions { margin-top: 6px; }
.template-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.template-row { display: flex; gap: 8px; align-items: flex-start; flex-direction: column; border: 1px solid var(--stroke2); border-radius: 8px; padding: 8px; }
.template-row > div:first-child { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
.template-row input[type=text] { flex: 1; min-width: 0; }

/* Kanban Board */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; min-height: 420px; }
.kanban-column { flex: 1; min-width: 250px; background: var(--panel, #0b1220); border: 1px solid var(--stroke2, #1f2937); border-radius: 12px; display: flex; flex-direction: column; }
.kanban-column-header { padding: 12px 14px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid; display: flex; align-items: center; justify-content: space-between; border-radius: 12px 12px 0 0; }
.kanban-column-header .count { background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.kanban-column[data-status="PENDING"] .kanban-column-header { border-color: #38bdf8; color: #38bdf8; background: rgba(56, 189, 248, 0.06); }
.kanban-column[data-status="IN_PROGRESS"] .kanban-column-header { border-color: #f59e0b; color: #f59e0b; background: rgba(245, 158, 11, 0.06); }
.kanban-column[data-status="AWAITING_CONFIRMATION"] .kanban-column-header { border-color: #a78bfa; color: #a78bfa; background: rgba(167, 139, 250, 0.06); }
.kanban-column[data-status="COMPLETED"] .kanban-column-header { border-color: #4ade80; color: #4ade80; background: rgba(74, 222, 128, 0.06); }
.kanban-cards { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; transition: background 0.15s; }
.kanban-cards.drag-over { background: rgba(37, 99, 235, 0.08); border-radius: 0 0 12px 12px; }
.kanban-card { background: var(--card, #111827); border: 1px solid var(--stroke2, #1f2937); border-radius: 10px; padding: 12px; cursor: grab; transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s; position: relative; }
.kanban-card:hover { border-color: #334155; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.4; transform: scale(0.96); }
.kanban-card .card-title { font-weight: 600; font-size: 13px; color: var(--text, #e2e8f0); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kanban-card .card-meta { font-size: 11px; color: var(--muted, #94a3b8); display: flex; flex-direction: column; gap: 3px; }
.kanban-card .card-meta span { display: flex; align-items: center; gap: 4px; }
.kanban-card .card-hours { display: inline-flex; align-items: center; justify-content: center; background: #1e293b; color: #38bdf8; font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; }
.kanban-card .card-id { font-size: 10px; color: #475569; }
.kanban-card .card-client { color: #a78bfa; }
.kanban-card .card-date { color: #64748b; }
.kanban-card .card-actions { margin-top: 8px; display: flex; gap: 4px; }
.kanban-card .card-actions button { padding: 4px 8px; font-size: 11px; }
.todo-cat-badge { background: #1e293b; color: #94a3b8; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.todo-prio-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; }
/* ─── Barra mobile in cima (hamburger a sinistra) ────────────────── */
.mobile-top-bar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 48px;
    background: var(--panel);
    border-bottom: 1px solid var(--stroke2);
    z-index: 1100;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(2, 6, 23, 0.35);
}
.mobile-top-bar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-overlay, .sidebar-mobile-trigger { display: none; }
/* Il trigger diventa un pulsante inline nella top bar */
.sidebar-mobile-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    padding: 8px;
    border-radius: 8px;
    min-height: 36px;
    min-width: 36px;
    box-shadow: none;
    position: static;
}
.sidebar-mobile-trigger:hover { background: rgba(148, 163, 184, 0.12); }

@media (max-width: 960px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: min(320px, 86vw);
        min-width: 0;
        max-width: none;
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        max-height: none;
        overflow: auto;
        padding: 14px 12px;
        transform: translateX(-106%);
        transition: transform 0.22s ease;
        z-index: 1200;
        box-shadow: 16px 0 34px rgba(2, 6, 23, 0.45);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar.collapsed { width: min(320px, 86vw); min-width: 0; max-width: none; padding: 14px 12px; }
    .sidebar .nav-link { min-height: 44px; font-size: 15px; }
    .sidebar .sidebar-submenu > a { min-height: 40px; }
    .sidebar-actions { position: sticky; top: 0; z-index: 1; background: var(--panel); padding-bottom: 8px; }
    .content { padding: 12px; }
    .container { margin: 12px 0; padding: 14px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .row { gap: 10px; }
    .row > * { flex: 1 1 100%; min-width: 0; }
    .inline-form { display: flex; width: 100%; align-items: flex-start; }
    .inline-form input, .inline-form select { width: 100%; max-width: none; }
    input, select, textarea { width: 100%; box-sizing: border-box; min-height: 42px; }
    button { min-height: 42px; }
    .check-toggle { font-size: 13px; padding: 7px 12px; }
    .dashboard-subnav { flex-wrap: wrap; }
    .calendar-header { flex-wrap: wrap; gap: 8px; }
    .calendar-header .nav { min-height: 40px; }
    .table-scroll { min-height: 260px; max-height: 420px; }
    .table-compact th, .table-compact td { font-size: 11px; }
    .table-compact input, .table-compact select, .table-compact button { font-size: 11px; }
    .modal-card { width: min(96vw, 560px); max-height: 92vh; overflow: auto; }
    .modal-card.wide { width: 96vw; min-height: 0; max-height: 92vh; }
    .receipt-browser { grid-template-columns: 1fr; }
    .calendar-grid { grid-template-columns: 32px repeat(7, minmax(0, 1fr)); }
    .calendar-days { grid-auto-rows: 110px; }
    .kanban-board { flex-direction: column; }
    .kanban-column { min-width: unset; }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 1150;
    }
    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }
    /* Barra mobile visibile in portrait */
    .mobile-top-bar { display: flex; }
    /* Il contenuto scende sotto la barra (48px) */
    .content { padding-top: 60px; }
    body.sidebar-open { overflow: hidden; }
    /* Calendario: mostra solo numero + colore di stato, dettaglio al tap */
    .airs-calendar-chips { display: none; }
    .airs-calendar-hours { display: none; }
    .calendar-days { grid-auto-rows: 52px; }
    .airs-calendar-day .day-number { font-size: 16px; font-weight: 700; }
    /* Sezione Amministrazione nascosta su mobile */
    .sidebar-admin-section { display: none; }
}

/* ─── LANDSCAPE mobile (telefono ruotato) ─────────────────────────── */
@media (orientation: landscape) and (max-width: 959px) {
    /* Sidebar permanente a sinistra — non più drawer */
    .layout { flex-direction: row; }
    .sidebar {
        position: relative !important;
        transform: none !important;
        width: 190px;
        min-width: 190px;
        max-width: 190px;
        height: 100dvh;
        transition: none !important;
        box-shadow: none !important;
        overflow-y: auto;
    }
    /* Nascondi top bar e overlay in landscape (sidebar è permanente) */
    .mobile-top-bar { display: none !important; }
    .sidebar-mobile-trigger { display: none !important; }
    .sidebar-overlay { opacity: 0 !important; pointer-events: none !important; }
    body.sidebar-open { overflow: auto; }
    /* Compatta i nav link per l'altezza ridotta */
    .sidebar .nav-link { min-height: 34px; padding: 7px 10px; font-size: 13px; }
    .sidebar .brand { font-size: 14px; margin-bottom: 8px; }
    .sidebar-actions { margin-bottom: 8px; }
    .sidebar .sidebar-submenu > a { min-height: 30px; font-size: 12px; }
    /* Riduce padding del contenuto */
    .content { padding: 8px; }
    .container { margin: 6px 0; padding: 12px; border-radius: 8px; }
    /* Tabelle più compatte */
    .table-scroll { max-height: 52vh; min-height: 200px; }
    .calendar-days { grid-auto-rows: 72px; }
    .dashboard-toolbar { margin: 6px 0 10px; }
}

@media (max-width: 640px) {
    .inline-actions { width: 100%; }
    .inline-actions button, .inline-actions .button-link { width: 100%; }
    .table-controls-bar { flex-wrap: wrap; justify-content: stretch; padding: 8px; }
}

@media (max-width: 480px) {
    .content { padding: 8px; }
    .container { margin: 8px 0; padding: 10px; border-radius: 10px; }
    .dashboard-toolbar { gap: 8px; margin: 8px 0 12px; }
    .table-scroll { max-height: 58vh; min-height: 220px; }
    .calendar-grid { gap: 6px; }
    .calendar-days { grid-auto-rows: 44px; }
}

/* ─── Schermi desktop con altezza ≤ 900px (es. 1280×800) ─────────── */
@media (max-height: 900px) and (min-width: 960px) {
    .airs-header { padding: 8px 16px; }
    .airs-kpi-grid { gap: 6px; }
    .airs-kpi-card { padding: 6px 8px; gap: 1px; }
    .airs-kpi-value { font-size: 13px; }
    .airs-kpi-label { font-size: 9px; }
    .card.calendar-panel { padding: 10px; }
    .calendar-grid { gap: 6px; }
    .airs-calendar-day .day-number { font-size: 15px; }
}

/* ─── Suggerimento rotazione (portrait + schermo stretto) ──────────── */
.rotate-hint {
    display: none;
    background: #1e3a8a;
    color: #bfdbfe;
    padding: 9px 16px;
    font-size: 13px;
    gap: 8px;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 800;
    border-bottom: 1px solid #1d4ed8;
    text-align: center;
    user-select: none;
}
.rotate-hint svg { flex-shrink: 0; }
@media (orientation: portrait) and (max-width: 600px) {
    .rotate-hint { display: flex; }
}
@media (orientation: landscape) {
    .rotate-hint { display: none !important; }
}

/* ─── Performance KPI cards ──────────────────────────────────── */
.kpi-cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 16px 20px; }
.kpi-card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.kpi-card-value { font-size: 22px; font-weight: 700; color: var(--text); }
.kpi-card--value { border-left: 3px solid #3b82f6; }
.kpi-card--cost { border-left: 3px solid #f97316; }
.kpi-card--margin { border-left: 3px solid #4ade80; }
.kpi-card--pct { border-left: 3px solid #a78bfa; }

/* ─── Performance page ───────────────────────────────────────── */
.perf-filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.perf-filters label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.perf-filters input, .perf-filters select { width: auto; min-width: 140px; }
.perf-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.perf-chart-box { background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px; padding: 16px; }
.perf-chart-box h4 { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.perf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.perf-table th { text-align: left; padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--stroke); }
.perf-table td { padding: 8px 10px; border-bottom: 1px solid var(--stroke); }
.perf-table tr:hover td { background: rgba(59,130,246,0.06); }
.perf-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.margin-ok { color: #4ade80; }
.margin-warn { color: #fbbf24; }
.margin-bad { color: #f87171; }
.perf-user-header { background: rgba(59,130,246,0.08); }
.perf-user-header td { font-weight: 600; font-size: 14px; }
@media (max-width: 900px) {
    .perf-charts-row { grid-template-columns: 1fr; }
}

/* ─── Performance inline edit panels ─────────────────────────── */
.perf-edit-panel { background: var(--bg); border: 1px solid var(--stroke); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.perf-edit-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); user-select: none; }
.perf-edit-header:hover { background: rgba(59,130,246,0.08); }
.perf-edit-chevron { font-size: 10px; color: var(--muted); }
.perf-edit-body { padding: 12px 16px 14px; border-top: 1px solid var(--stroke); }
.perf-edit-fields { }
.perf-edit-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.perf-edit-row label { display: flex; flex-direction: column; font-size: 10px; color: var(--muted); gap: 3px; min-width: 120px; flex: 1; }
.perf-edit-row input { width: 100%; min-width: 80px; padding: 6px 8px; font-size: 13px; background: var(--panel); color: var(--text); border: 1px solid var(--stroke2); border-radius: 6px; }
.perf-edit-row input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.2); }
.perf-edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.perf-edit-save { padding: 6px 16px; font-size: 12px; font-weight: 600; background: var(--primary); color: #fff; border: none; border-radius: 6px; cursor: pointer; }
.perf-edit-save:hover { filter: brightness(1.1); }
.perf-edit-feedback { font-size: 12px; color: var(--muted); }
.perf-edit-feedback--ok { color: #4ade80; font-weight: 600; }
.perf-edit-feedback--err { color: #f87171; font-weight: 600; }
.perf-edit-icon { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 4px; }
.perf-edit-icon:hover { color: var(--primary); background: rgba(59,130,246,0.1); }
.perf-rate-edit-row td { padding: 0 !important; }
.perf-rate-edit-cell { padding: 10px 12px !important; background: var(--bg); border-bottom: 1px solid var(--stroke) !important; }

/* Time slot multi-entry */
#time-slots-container { margin: 4px 0 2px; }
.time-slot-row { margin-bottom: 4px; }
.time-slot-fields {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: nowrap;
}
.time-slot-fields > div { flex: 1; min-width: 0; }
.time-slot-fields label { font-size: 0.82rem; color: var(--muted); margin-bottom: 2px; display: block; }
.time-slot-fields input { width: 100%; }
.slot-add-btn, .slot-remove-btn {
    width: 34px; height: 34px; min-width: 34px; padding: 0;
    font-size: 20px; font-weight: 700; line-height: 1;
    border: 2px solid var(--accent); border-radius: 8px;
    background: rgba(96,165,250,0.1); color: var(--accent);
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.15s;
}
.slot-add-btn:hover { background: var(--accent); color: #fff; transform: scale(1.1); }
.slot-remove-btn { color: #f87171; border-color: #f87171; background: rgba(248,113,113,0.1); }
.slot-remove-btn:hover { background: #f87171; color: #fff; transform: scale(1.1); }
.time-slots-total-row { margin: 4px 0 8px; }
.hours-totalizer {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 600; color: #38bdf8;
    background: rgba(56,189,248,0.08); border: 1px solid rgba(56,189,248,0.2);
    border-radius: 8px; padding: 5px 14px;
}

/* Diaria checkboxes */
.diaria-row { display: flex; gap: 20px; align-items: center; padding: 6px 0; margin: 4px 0; }
.diaria-label {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 13px; color: #38bdf8; background: rgba(56,189,248,0.08);
    border: 1px solid rgba(56,189,248,0.2); border-radius: 8px; padding: 6px 14px;
}
.diaria-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: #38bdf8; cursor: pointer; }
.diaria-label span { font-weight: 500; }

@media print {
    body { background: #fff; color: #000; }
    .sidebar, .calendar-panel, .admin-user-picker, button { display: none !important; }
    .container { box-shadow: none; border: none; background: #fff; color: #000; }
    table { background: #fff; }
    th, td { color: #000; }
}
