/* ══════════════════════════════════════════════════
   SoftBee Agile Platform — Design System
   Material Design 3 Light, seed: Indigo-Blue
   Adattato da docs/mockup/agile-pm-md3-light.html
   Nessuna dipendenza da Bootstrap: grid/flexbox nativi.
   ══════════════════════════════════════════════════ */
:root {
  /* MD3 surface system */
  --md-sys-color-background:            #fbf8ff;
  --md-sys-color-on-background:         #1b1b23;
  --md-sys-color-surface:               #fbf8ff;
  --md-sys-color-surface-dim:           #dcd9e4;
  --md-sys-color-surface-bright:        #fbf8ff;
  --md-sys-color-surface-container-lowest:  #ffffff;
  --md-sys-color-surface-container-low:     #f5f2fd;
  --md-sys-color-surface-container:         #efedf7;
  --md-sys-color-surface-container-high:    #e9e7f2;
  --md-sys-color-surface-container-highest: #e3e1ec;
  --md-sys-color-on-surface:            #1b1b23;
  --md-sys-color-on-surface-variant:    #46464f;
  --md-sys-color-outline:               #777680;
  --md-sys-color-outline-variant:       #c7c5d0;

  /* Primary — Indigo */
  --md-sys-color-primary:               #4b49ac;
  --md-sys-color-on-primary:            #ffffff;
  --md-sys-color-primary-container:     #e0e0ff;
  --md-sys-color-on-primary-container:  #02006c;
  --md-sys-color-primary-fixed:         #e0e0ff;
  --md-sys-color-primary-fixed-dim:     #bec2ff;

  /* Secondary — Slate */
  --md-sys-color-secondary:             #5d5c72;
  --md-sys-color-on-secondary:          #ffffff;
  --md-sys-color-secondary-container:   #e2e0f9;
  --md-sys-color-on-secondary-container:#191a2c;

  /* Tertiary — Teal */
  --md-sys-color-tertiary:              #006a6a;
  --md-sys-color-on-tertiary:           #ffffff;
  --md-sys-color-tertiary-container:    #9cf1f0;
  --md-sys-color-on-tertiary-container: #002020;

  /* Error */
  --md-sys-color-error:                 #ba1a1a;
  --md-sys-color-on-error:              #ffffff;
  --md-sys-color-error-container:       #ffdad6;
  --md-sys-color-on-error-container:    #410002;

  /* Custom semantic tokens — vibrant on light bg */
  --epic-color:     #6750a4;
  --feature-color:  #4b49ac;
  --story-color:    #1a7a52;
  --task-color:     #006a6a;
  --bug-color:      #ba1a1a;
  --test-color:     #7a5900;
  --issue-color:    #8b4a00;

  /* Elevation overlays (MD3 tonal elevation — light) */
  --elev-1: rgba(75,73,172,.05);
  --elev-2: rgba(75,73,172,.08);
  --elev-3: rgba(75,73,172,.11);
  --elev-4: rgba(75,73,172,.12);
  --elev-5: rgba(75,73,172,.14);

  /* Shape */
  --shape-xs:   4px;
  --shape-sm:   8px;
  --shape-md:   12px;
  --shape-lg:   16px;
  --shape-xl:   28px;
  --shape-full: 50px;

  /* Type */
  --font-display: 'Figtree', 'Google Sans Display', system-ui, sans-serif;
  --font-body:    'Figtree', 'Google Sans Text', system-ui, sans-serif;
  --font-mono:    'Roboto Mono', monospace;

  /* Layout */
  --nav-w: 260px;
  --nav-w-rail: 80px;
  --top-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  height: 100vh; display: flex; overflow: hidden;
  font-size: 14px;
}

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--md-sys-color-outline-variant); border-radius: 4px; }

/* ══════════════════════════════════════
   NAVIGATION DRAWER (MD3)
   ══════════════════════════════════════ */
#nav-drawer {
  width: var(--nav-w);
  background: var(--md-sys-color-surface-container-low);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
  transition: width .3s cubic-bezier(.2,0,0,1);
  position: relative; z-index: 10;
}
#nav-drawer.rail { width: var(--nav-w-rail); }

.nav-header {
  height: var(--top-h); display: flex; align-items: center;
  padding: 0 28px; gap: 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.nav-logo-mark {
  width: 36px; height: 36px; border-radius: var(--shape-sm);
  background: var(--md-sys-color-primary-container);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.nav-logo-mark .material-icons-round { color: var(--md-sys-color-on-primary-container); font-size: 20px; }
.nav-logo-text {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  color: var(--md-sys-color-on-surface); white-space: nowrap; overflow: hidden;
  transition: opacity .2s;
}
#nav-drawer.rail .nav-logo-text { opacity: 0; pointer-events: none; }

.nav-section-label {
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  padding: 20px 28px 6px; white-space: nowrap; overflow: hidden;
  transition: opacity .2s;
}
#nav-drawer.rail .nav-section-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  margin: 1px 12px; padding: 0 16px; height: 56px;
  border-radius: var(--shape-full);
  cursor: pointer; position: relative; overflow: hidden;
  transition: background .2s;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
}
.nav-item::before {
  content: ''; position: absolute; inset: 0;
  background: var(--md-sys-color-on-surface);
  opacity: 0; transition: opacity .2s; border-radius: inherit;
}
.nav-item:hover::before { opacity: .08; }
.nav-item.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.nav-item.active::before { display: none; }
.nav-item-icon {
  width: 24px; text-align: center; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item-icon .material-icons-round { font-size: 22px; }
.nav-item-label {
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; flex: 1;
  transition: opacity .2s;
}
#nav-drawer.rail .nav-item-label { opacity: 0; pointer-events: none; }
.nav-badge {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: 11px; font-weight: 700;
  padding: 0 6px; min-width: 20px; height: 20px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  transition: opacity .2s;
}
#nav-drawer.rail .nav-badge { opacity: 0; }

.nav-project-chip {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 12px; padding: 8px 16px;
  border-radius: var(--shape-md);
  cursor: pointer; overflow: hidden;
  transition: background .2s;
  color: var(--md-sys-color-on-surface-variant); font-size: 13px;
}
.nav-project-chip:hover { background: var(--elev-2); }
.nav-project-chip.active { color: var(--md-sys-color-on-surface); }
.project-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.project-name { flex: 1; overflow: hidden; white-space: nowrap; font-weight: 500; transition: opacity .2s; }
#nav-drawer.rail .project-name { opacity: 0; }

/* ══════════════════════════════════════
   TOP APP BAR (MD3)
   ══════════════════════════════════════ */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#top-bar {
  height: var(--top-h);
  background: var(--md-sys-color-surface-container);
  display: flex; align-items: center; padding: 0 16px; gap: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  flex-shrink: 0; position: relative;
}

.md-icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  position: relative; overflow: hidden; transition: color .2s;
}
.md-icon-btn::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; opacity: 0; transition: opacity .2s;
}
.md-icon-btn:hover::before { opacity: .08; }
.md-icon-btn:hover { color: var(--md-sys-color-on-surface); }
.md-icon-btn .material-icons-round { font-size: 22px; position: relative; }

.top-bar-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 400;
  color: var(--md-sys-color-on-surface); flex: 1;
}

.md-btn {
  height: 40px; padding: 0 24px; border-radius: var(--shape-full);
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; position: relative; overflow: hidden;
  transition: box-shadow .2s;
}
.md-btn::before {
  content: ''; position: absolute; inset: 0;
  background: currentColor; opacity: 0; transition: opacity .2s;
  border-radius: inherit;
}
.md-btn:hover::before { opacity: .08; }
.md-btn .material-icons-round { font-size: 18px; position: relative; }
.md-btn span { position: relative; }

.md-btn-filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.md-btn-filled:hover { box-shadow: 0 2px 8px rgba(0,0,0,.4); }

.md-btn-tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.md-btn-outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
  padding: 0 23px;
}

.avatar-md3 {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}

.sprint-chip {
  height: 32px; padding: 0 16px; border-radius: var(--shape-full);
  background: var(--md-sys-color-surface-container-high);
  border: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all .2s;
}
.sprint-chip:hover { background: var(--md-sys-color-surface-container-highest); }
.sprint-chip .material-icons-round { font-size: 16px; color: var(--md-sys-color-primary); }

/* ══════════════════════════════════════
   CONTENT
   ══════════════════════════════════════ */
#content { flex: 1; overflow-y: auto; background: var(--md-sys-color-background); }
.page { padding: 24px; max-width: 1400px; }

/* ══════════════════════════════════════
   MD3 CARDS
   ══════════════════════════════════════ */
.md-card {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--shape-lg);
  position: relative; overflow: hidden;
}
.md-card-elevated {
  background: color-mix(in srgb, var(--md-sys-color-surface) 100%, var(--md-sys-color-primary) 5%);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.15);
  border-radius: var(--shape-lg);
}
.md-card-filled {
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--shape-lg);
}
.md-card-outlined {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--shape-lg);
}

/* ══════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 28px; }

.stat-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--shape-lg); padding: 20px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden; cursor: pointer;
  transition: background .2s;
}
.stat-card:hover { background: var(--md-sys-color-surface-container-high); }
.stat-card .stat-num {
  font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: 1;
}
.stat-card .stat-label {
  font-size: 12px; font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: var(--shape-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.stat-card .stat-icon .material-icons-round { font-size: 22px; }

/* ══════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════ */
.title-large { font-family: var(--font-display); font-size: 22px; font-weight: 400; color: var(--md-sys-color-on-surface); }
.title-medium { font-family: var(--font-body); font-size: 16px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.title-small { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--md-sys-color-on-surface); }
.label-large { font-family: var(--font-body); font-size: 14px; font-weight: 500; }
.label-medium { font-family: var(--font-body); font-size: 12px; font-weight: 500; }
.body-medium { font-size: 14px; color: var(--md-sys-color-on-surface-variant); }
.body-small { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }

.section-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-row .spacer { flex: 1; }

/* ══════════════════════════════════════
   MD3 CHIPS / BADGES
   ══════════════════════════════════════ */
.chip {
  height: 32px; padding: 0 12px; border-radius: var(--shape-full);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer; transition: background .2s;
}
.chip:hover { background: var(--elev-2); }
.chip .material-icons-round { font-size: 16px; }
.chip-input {
  background: var(--md-sys-color-surface-container-high);
  border-color: transparent;
}

.item-badge {
  height: 24px; padding: 0 10px; border-radius: var(--shape-full);
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
}
.badge-epic    { background: rgba(103,80,164,.12); color: var(--epic-color);    border: 1px solid rgba(103,80,164,.25); }
.badge-feature { background: rgba(75,73,172,.12);  color: var(--feature-color); border: 1px solid rgba(75,73,172,.25); }
.badge-story   { background: rgba(26,122,82,.12);  color: var(--story-color);   border: 1px solid rgba(26,122,82,.25); }
.badge-task    { background: rgba(0,106,106,.12);  color: var(--task-color);    border: 1px solid rgba(0,106,106,.25); }
.badge-bug     { background: rgba(186,26,26,.12);  color: var(--bug-color);     border: 1px solid rgba(186,26,26,.25); }
.badge-test    { background: rgba(122,89,0,.12);   color: var(--test-color);    border: 1px solid rgba(122,89,0,.25); }
.badge-issue   { background: rgba(139,74,0,.12);   color: var(--issue-color);   border: 1px solid rgba(139,74,0,.25); }

.status {
  height: 24px; padding: 0 10px; border-radius: var(--shape-full);
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
}
.status-todo    { background: var(--md-sys-color-surface-container-highest); color: var(--md-sys-color-on-surface-variant); }
.status-inprog  { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.status-review  { background: rgba(122,89,0,.12); color: var(--test-color); }
.status-done    { background: rgba(26,122,82,.12); color: var(--story-color); }
.status-blocked { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.status-hold    { background: rgba(139,74,0,.12); color: var(--issue-color); }

.prio { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.prio .material-icons-round { font-size: 14px; }
.prio-crit   { color: var(--md-sys-color-error); }
.prio-high   { color: var(--issue-color); }
.prio-med    { color: var(--test-color); }
.prio-low    { color: var(--md-sys-color-on-surface-variant); }

/* ══════════════════════════════════════
   MD3 DATA TABLE
   ══════════════════════════════════════ */
.md-table-wrap { overflow-x: auto; }
.md-table { width: 100%; border-collapse: collapse; }
.md-table thead th {
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  color: var(--md-sys-color-on-surface-variant); letter-spacing: .5px;
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  white-space: nowrap;
}
.md-table thead th:first-child { border-radius: var(--shape-md) 0 0 0; }
.md-table thead th:last-child  { border-radius: 0 var(--shape-md) 0 0; }
.md-table tbody tr {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  transition: background .15s;
  cursor: pointer;
}
.md-table tbody tr:last-child { border-bottom: none; }
.md-table tbody tr:hover { background: rgba(75,73,172,.05); }
.md-table tbody td { padding: 14px 16px; font-size: 13px; vertical-align: middle; }
.md-table tbody td:first-child { font-family: var(--font-mono); font-size: 11px; color: var(--md-sys-color-on-surface-variant); }

/* ══════════════════════════════════════
   PROGRESS INDICATOR
   ══════════════════════════════════════ */
.md-progress { height: 4px; border-radius: 2px; background: var(--md-sys-color-surface-container-highest); overflow: hidden; }
.md-progress-bar { height: 100%; border-radius: 2px; transition: width .4s cubic-bezier(.2,0,0,1); }

/* ══════════════════════════════════════
   KANBAN
   ══════════════════════════════════════ */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; height: calc(100vh - 148px); }
.kanban-col {
  min-width: 270px; max-width: 290px; flex-shrink: 0;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--shape-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.kanban-col-head { padding: 16px 16px 12px; display: flex; align-items: center; gap: 8px; }
.kanban-col-indicator { width: 12px; height: 12px; border-radius: 50%; }
.kanban-col-title { font-size: 13px; font-weight: 600; flex: 1; color: var(--md-sys-color-on-surface); }
.kanban-col-count {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}
.kanban-col-body { flex: 1; overflow-y: auto; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--shape-md); padding: 14px;
  cursor: pointer; transition: all .2s cubic-bezier(.2,0,0,1);
  position: relative;
}
.kanban-card:hover {
  background: var(--md-sys-color-surface-container-high);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.kanban-card .kc-type { margin-bottom: 8px; }
.kanban-card .kc-title { font-size: 13px; font-weight: 500; line-height: 1.5; margin-bottom: 10px; color: var(--md-sys-color-on-surface); }
.kanban-card .kc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-card .kc-id { font-family: var(--font-mono); font-size: 10px; color: var(--md-sys-color-on-surface-variant); flex: 1; }
.kanban-card .kc-pts {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.kanban-card .kc-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: #fff;
}
.kanban-add-btn {
  margin: 0 10px 10px; border: none;
  background: none; border-radius: var(--shape-md);
  padding: 10px; color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; width: calc(100% - 20px); display: flex;
  align-items: center; justify-content: center; gap: 6px;
  transition: background .2s;
}
.kanban-add-btn:hover { background: var(--elev-2); color: var(--md-sys-color-primary); }
.kanban-add-btn .material-icons-round { font-size: 18px; }

/* ══════════════════════════════════════
   HIERARCHY TREE
   ══════════════════════════════════════ */
.tree-node { margin-bottom: 2px; }
.tree-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--shape-md);
  cursor: pointer; transition: background .15s;
  color: var(--md-sys-color-on-surface);
}
.tree-row:hover { background: rgba(75,73,172,.06); }
.tree-toggle-btn {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  transition: transform .2s; flex-shrink: 0;
}
.tree-toggle-btn .material-icons-round { font-size: 16px; }
.tree-toggle-btn.open { transform: rotate(90deg); }
.tree-row .tr-title { flex: 1; font-size: 13px; font-weight: 500; }
.tree-row .tr-id { font-family: var(--font-mono); font-size: 10px; color: var(--md-sys-color-on-surface-variant); width: 56px; }
.tree-row .tr-pts { font-size: 12px; color: var(--md-sys-color-on-surface-variant); width: 30px; text-align: right; }
.tree-indent { padding-left: 20px; border-left: 1px solid var(--md-sys-color-outline-variant); margin-left: 20px; }

/* ══════════════════════════════════════
   MD3 FORM FIELDS
   ══════════════════════════════════════ */
.field-group { margin-bottom: 16px; }
.field-label { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--md-sys-color-on-surface-variant); margin-bottom: 6px; display: block; }
.md-field {
  width: 100%;
  background: var(--md-sys-color-surface-container-highest);
  border: none; border-bottom: 1px solid var(--md-sys-color-outline);
  border-radius: var(--shape-xs) var(--shape-xs) 0 0;
  padding: 14px 16px; color: var(--md-sys-color-on-surface);
  font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color .2s;
  display: block;
}
.md-field:focus { border-bottom: 2px solid var(--md-sys-color-primary); }
.md-field::placeholder { color: var(--md-sys-color-on-surface-variant); }
textarea.md-field { resize: vertical; min-height: 90px; }
select.md-field option { background: var(--md-sys-color-surface-container); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ══════════════════════════════════════
   PROJECT CARDS
   ══════════════════════════════════════ */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.proj-card {
  background: var(--md-sys-color-surface-container);
  border-radius: var(--shape-xl); padding: 20px;
  cursor: pointer; transition: all .2s cubic-bezier(.2,0,0,1);
  position: relative; overflow: hidden;
}
.proj-card:hover { background: var(--md-sys-color-surface-container-high); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.proj-card-accent { position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: var(--shape-xl) var(--shape-xl) 0 0; }
.proj-card-icon { width: 48px; height: 48px; border-radius: var(--shape-md); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.proj-card-icon .material-icons-round { font-size: 26px; }
.proj-card-name { font-family: var(--font-display); font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.proj-card-client { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-bottom: 12px; }
.proj-card-desc { font-size: 13px; color: var(--md-sys-color-on-surface-variant); line-height: 1.5; margin-bottom: 16px; }
.proj-card-foot { display: flex; align-items: center; gap: 8px; }

/* ══════════════════════════════════════
   DIALOG / MODAL (MD3)
   ══════════════════════════════════════ */
.md-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(2px);
}
.md-scrim.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.md-dialog {
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--shape-xl); padding: 24px;
  width: 100%; max-width: 680px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 8px 40px rgba(0,0,0,.3);
  animation: dialogIn .3s cubic-bezier(.2,0,0,1);
}
@keyframes dialogIn { from { opacity: 0; transform: scale(.92) translateY(12px); } to { opacity: 1; transform: none; } }

.dialog-headline { font-family: var(--font-display); font-size: 24px; font-weight: 400; margin-bottom: 20px; color: var(--md-sys-color-on-surface); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

/* ══════════════════════════════════════
   SPRINT TIMELINE
   ══════════════════════════════════════ */
.sprint-timeline-bar-wrap { background: var(--md-sys-color-surface-container-highest); border-radius: 4px; height: 28px; position: relative; overflow: hidden; }
.sprint-timeline-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; display: flex; align-items: center; padding: 0 10px; font-size: 11px; font-weight: 600; }

/* ══════════════════════════════════════
   GRID HELPERS
   ══════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.divider { border: none; border-top: 1px solid var(--md-sys-color-outline-variant); margin: 20px 0; }
.spacer { flex: 1; }
.mt-20 { margin-top: 20px; }

.av-sm { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }

.md-tab-bar { display: flex; border-bottom: 1px solid var(--md-sys-color-outline-variant); margin-bottom: 20px; }
.md-tab {
  padding: 12px 20px; font-size: 14px; font-weight: 500;
  color: var(--md-sys-color-on-surface-variant); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .2s;
  display: flex; align-items: center; gap: 6px;
}
.md-tab:hover { color: var(--md-sys-color-on-surface); background: var(--elev-1); }
.md-tab.active { color: var(--md-sys-color-primary); border-bottom-color: var(--md-sys-color-primary); }

.md-fab {
  position: fixed; bottom: 24px; right: 24px;
  height: 56px; padding: 0 20px;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  border-radius: var(--shape-lg); border: none;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  transition: all .2s cubic-bezier(.2,0,0,1);
  z-index: 50;
}
.md-fab:hover { box-shadow: 0 8px 24px rgba(0,0,0,.25); transform: translateY(-1px); }
.md-fab .material-icons-round { font-size: 24px; }

/* ══════════════════════════════════════
   RESPONSIVE (viewport stretto)
   ══════════════════════════════════════ */
@media (max-width: 900px) {
  #nav-drawer:not(.rail) { position: fixed; inset: 0 auto 0 0; box-shadow: 0 8px 40px rgba(0,0,0,.3); }
}

/* ===== Tema scuro: solo se l'utente lo sceglie (mai automatico) ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-background:            #131318;
  --md-sys-color-on-background:         #e4e1e9;
  --md-sys-color-surface:               #131318;
  --md-sys-color-surface-dim:           #131318;
  --md-sys-color-surface-bright:        #39383f;
  --md-sys-color-surface-container-lowest:  #0e0e13;
  --md-sys-color-surface-container-low:     #1b1b20;
  --md-sys-color-surface-container:         #1f1f25;
  --md-sys-color-surface-container-high:    #2a292f;
  --md-sys-color-surface-container-highest: #35343a;
  --md-sys-color-on-surface:            #e4e1e9;
  --md-sys-color-on-surface-variant:    #c7c5d0;
  --md-sys-color-outline:               #918f9a;
  --md-sys-color-outline-variant:       #46464f;
  --md-sys-color-primary:               #bec2ff;
  --md-sys-color-on-primary:            #1d1c70;
  --md-sys-color-primary-container:     #343390;
  --md-sys-color-on-primary-container:  #e0e0ff;
  --md-sys-color-primary-fixed:         #343390;
  --md-sys-color-primary-fixed-dim:     #bec2ff;
  --md-sys-color-secondary:             #c6c4dd;
  --md-sys-color-on-secondary:          #2e2f42;
  --md-sys-color-secondary-container:   #444559;
  --md-sys-color-on-secondary-container:#e2e0f9;
  --md-sys-color-tertiary:              #80d4d4;
  --md-sys-color-on-tertiary:           #003737;
  --md-sys-color-tertiary-container:    #004f4f;
  --md-sys-color-on-tertiary-container: #9cf1f0;
  --md-sys-color-error:                 #ffb4ab;
  --md-sys-color-on-error:              #690005;
  --md-sys-color-error-container:       #93000a;
  --md-sys-color-on-error-container:    #ffdad6;
  --epic-color:     #d0bcff;
  --feature-color:  #bec2ff;
  --story-color:    #7fd9ae;
  --task-color:     #80d4d4;
  --bug-color:      #ffb4ab;
  --test-color:     #f0c24b;
  --issue-color:    #ffb870;
  --elev-1: rgba(190,194,255,.05);
  --elev-2: rgba(190,194,255,.08);
  --elev-3: rgba(190,194,255,.11);
  --elev-4: rgba(190,194,255,.12);
  --elev-5: rgba(190,194,255,.14);
  --brand-honey: #f2b61f;
  --brand-honey-container: #5a4300;
  --brand-on-honey: #ffe9b0;
}
:root[data-theme="dark"] .md-table tbody tr:hover,
:root[data-theme="dark"] .tree-row:hover { background: rgba(190,194,255,.08); }

/* Tema scuro: le card del Kanban si staccano dalla colonna (stesso grigio = illeggibili a colpo d'occhio). */
:root[data-theme="dark"] .kanban-card { background: var(--md-sys-color-surface-container-high); border: 1px solid var(--md-sys-color-outline-variant); }
:root[data-theme="dark"] .kanban-card:hover { background: var(--md-sys-color-surface-container-highest); box-shadow: 0 4px 16px rgba(0,0,0,.45); }
