:root{
  --bg:#141a26; --bg2:#202d42; --panel:#202d42; --panel2:#3b4556;
  --accent:#f2cc83; --accent2:#f7d89a; --text:#f9fafb; --muted:#9ca3af;
  --border:rgba(148,163,184,.5); --danger:#e34242; --ok:#22c55e;
  --shadow:0 18px 45px rgba(0,0,0,.22); --t:150ms ease-out;

  --btn-bg:var(--accent); --btn-text:#111827;
  --btn-shadow:0 12px 26px rgba(0,0,0,.28);
  --btn-hover-bg:var(--accent2); --btn-hover-shadow:0 16px 34px rgba(0,0,0,.34);
  --btn-active-shadow:0 10px 22px rgba(0,0,0,.28);

  --status-todo:#eab308; /* alter Farbton: #6b7280 (grau) */
  --status-doing:#3b82f6;
  --status-blocked:#ef4444;
  --status-canceled:#a78bfa;
  --status-done:#22c55e;
  --status-overdue:#f59e0b;

  --cell-h:34px;
  --head-h:32px;
  --date-extra:18px;
  --colw:28px;

  --head-total: calc(var(--head-h) * 4 + var(--date-extra));

  --thead-bg: rgba(242, 204, 131, .14);
  --thead-bg-2: rgba(242, 204, 131, .10);
  --thead-text: #f9fafb;
  --thead-muted: rgba(249, 250, 251, .74);

  --weekend-bg: rgba(255,255,255,.08);
  --holiday-bg: rgba(255,105,180,.22);

  --tasks-share: 60%;
  --tasks-min: 850px;
  --tasks-max: 1040px;

  --task-cols-expanded:
    30px 220px 120px 120px 95px 65px 50px 90px 90px 160px;

  --task-cols-collapsed:
    30px 220px 160px 0px 95px 65px 50px 90px 90px 160px;

  --task-cols: var(--task-cols-collapsed);

  --analytics-strong:#f9fafb;
  --analytics-value:#f9fafb;
  --analytics-label:#9ca3af;

  --analytics-card-min-h: 286px;
}

body.show-owner-col{ --task-cols: var(--task-cols-expanded); }

body.theme-light{
  --bg:#f7ecd4; --bg2:#faefdc; --panel:#fff7e7; --panel2:#f2cc83;
  --accent:#296117; --accent2:#3b7f22; --text:#111827; --muted:#4b5563;
  --border:rgba(148,119,81,.6); --danger:#b91c1c; --ok:#296117;

  --btn-bg:var(--accent); --btn-text:#ffffff;
  --btn-shadow:0 12px 26px rgba(0,0,0,.18);
  --btn-hover-bg:var(--accent2); --btn-hover-shadow:0 16px 34px rgba(0,0,0,.22);
  --btn-active-shadow:0 10px 22px rgba(0,0,0,.18);

  --thead-bg: rgba(41, 97, 23, .12);
  --thead-bg-2: rgba(41, 97, 23, .08);
  --thead-text: #111827;
  --thead-muted: rgba(17, 24, 39, .70);

  --weekend-bg: rgba(0,0,0,.06);
  --holiday-bg: rgba(255,105,180,.18);

  --status-todo:#eab308; /* alter Farbton: #6b7280 (grau) */
  --status-doing:#2563eb;
  --status-blocked:#dc2626;
  --status-canceled:#7c3aed;
  --status-done:#16a34a;
  --status-overdue:#d97706;

  --analytics-strong:#111827;
  --analytics-value:#111827;
  --analytics-label:#111827;
}

*{ box-sizing:border-box; }

html,body{
  margin:0; padding:0; min-height:100vh;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  background:var(--bg); color:var(--text);
  overflow-x:hidden;
}

body{ padding:18px; }

.wrap{ width:100%; display:flex; justify-content:center; }

.shell{
  max-width:2400px; width:100%;
  background:var(--bg2);
  border-radius:1.8rem;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  padding:18px 18px 20px;
  display:flex; flex-direction:column; gap:16px;
}

.topbar{
  display:flex; justify-content:space-between; gap:12px;
  flex-wrap:wrap; align-items:center;
}

.brand{
  display:inline-flex; align-items:center; gap:10px;
  text-decoration:none; color:inherit; max-width:100%;
}
.brand img{
  width:26px; height:26px; border-radius:8px;
  border:1px solid var(--border); object-fit:cover;
}
.bt{ display:inline-flex; flex-direction:column; line-height:1.1; min-width:0; }
.bt strong{
  font-weight:900; font-size:.92rem;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.bt span{
  color:var(--muted); font-size:.75rem;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.actions{ display:inline-flex; flex-wrap:wrap; gap:8px; align-items:center; }

.fileBtnLabel{ cursor:pointer; }
.visuallyHiddenFileInput{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.calcHeader{
  display:flex; justify-content:space-between; gap:16px;
  flex-wrap:wrap; align-items:flex-start;
}
.title{
  display:flex; flex-direction:column; gap:6px;
  min-width:0; flex:1 1 520px;
}
h1{ margin:0; font-size:1.6rem; font-weight:900; letter-spacing:.02em; }
h1 .em{ color:var(--accent); }
.subtitle{
  margin:0; color:var(--muted); font-size:.9rem;
  max-width:1200px; line-height:1.35;
}
.right{
  display:flex; flex-direction:column; align-items:flex-end;
  gap:10px; font-size:.85rem;
}
.pill{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px;
  border:1px solid var(--border);
  background:var(--panel2); color:var(--muted);
}
.pill strong{ color:var(--text); }

.layout{ display:grid; grid-template-columns:1fr; gap:16px; }

.panel{
  background:var(--panel);
  border-radius:1.4rem;
  border:1px solid var(--border);
  padding:14px 16px 16px;
  box-shadow:0 12px 30px rgba(0,0,0,.25);
}
.panel.half{ grid-column:span 1; }
.panel.full{ grid-column:1 / -1; }


.panelHead{
  display:flex; justify-content:space-between; gap:8px;
  align-items:center; margin-bottom:10px;
}

.projectOverviewHead{
  gap:14px;
  flex-wrap:wrap;
}

.projectOverviewHeadLeft{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
  flex:1 1 auto;
}

.projectSelHead{
  width:auto;
  min-width:220px;
  max-width:340px;
}


.panelHead h2{
  margin:0; font-size:.95rem; letter-spacing:.08em; text-transform:uppercase;
}
.panelHead .headActions{
  display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end;
  margin-left:auto;
}

#projectOverviewContent{
  display:block;
}

.status{
  font-size:.8rem; color:var(--muted);
  min-height:1.2em; overflow-wrap:anywhere;
}
.status.bad{ color:var(--danger); }

.btn{
  border:none; cursor:pointer;
  padding:10px 14px; border-radius:1rem;
  background:var(--btn-bg); color:var(--btn-text);
  font-weight:900; letter-spacing:.02em;
  box-shadow:var(--btn-shadow);
  transition:transform var(--t), box-shadow var(--t), filter var(--t), background var(--t);
  text-decoration:none;
  display:inline-flex; align-items:center; gap:8px;
}
.btn:hover{
  transform:translateY(-1px);
  background:var(--btn-hover-bg);
  box-shadow:var(--btn-hover-shadow);
  filter:saturate(1.05);
}
.btn:active{ transform:translateY(0); box-shadow:var(--btn-active-shadow); }
.btn.ghost{ background:transparent; border:1px solid var(--border); box-shadow:none; color:var(--text); }
.btn.ghost:hover{ background:var(--panel2); box-shadow:0 10px 22px rgba(0,0,0,.18); }
.btn.danger{ background:var(--danger); color:#fff; }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none !important; }
.btn.small{ padding:7px 10px; border-radius:.9rem; font-size:.82rem; font-weight:850; }
.btn.mini{ padding:5px 8px; border-radius:.7rem; font-size:.75rem; font-weight:800; }
.btn.mini.active{ background:var(--accent); color:var(--btn-text); }

input[type=text], input[type=date], input[type=number], select{
  width:100%;
  padding:8px 10px;
  border-radius:.75rem;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  font-size:.85rem;
  outline:none;
  transition:border-color var(--t), box-shadow var(--t), transform var(--t);
  appearance:none;
  font-family:inherit;
}
input:focus, select:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent2), 0 0 0 5px rgba(0,0,0,.25);
  transform:translateY(-1px);
}
input[type=date]{ color-scheme:dark; }
body.theme-light input[type=date]{ color-scheme:light; }

.note{ color:var(--muted); font-size:.78rem; line-height:1.35; margin-top:6px; }

.labT{
  font-size:.72rem; text-transform:uppercase; letter-spacing:.1em;
  color:var(--accent); white-space:nowrap;
}

.overviewRow1{
  display:grid; grid-template-columns:minmax(260px, 360px) 1fr;
  gap:14px; align-items:start;
}
.boxCell{
  border:1px solid var(--border);
  border-radius:1rem;
  background:rgba(0,0,0,.06);
  padding:10px 10px;
}
body.theme-light .boxCell{ background:rgba(0,0,0,.03); }
.boxCell .val{
  margin-top:6px; font-weight:950; font-variant-numeric:tabular-nums;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:1.02rem;
}

.kpiGrid{
  display:grid; grid-template-columns:repeat(4, minmax(160px, 1fr));
  gap:10px; align-items:start;
}

.metaRow2{
  margin-top:12px; display:grid; grid-template-columns:1fr 1fr;
  gap:14px; align-items:stretch;
}
.metaBox{
  border:1px solid var(--border);
  border-radius:1rem;
  background:rgba(0,0,0,.06);
  overflow:hidden;
}
body.theme-light .metaBox{ background:rgba(0,0,0,.03); }
.metaBoxHead{
  background:rgba(0,0,0,.06);
  border-bottom:1px solid var(--border);
  padding:8px 10px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
body.theme-light .metaBoxHead{ background:rgba(0,0,0,.03); }
.metaBoxHead .ttl{
  font-size:.72rem; text-transform:uppercase; letter-spacing:.1em;
  color:var(--accent); font-weight:950; white-space:nowrap;
}
.metaBoxBody{
  padding:10px 10px;
  display:grid; grid-template-columns:140px 1fr;
  row-gap:10px; column-gap:10px; align-items:center;
}
.metaLbl{ color:var(--muted); font-size:.78rem; }
.metaVal{
  font-weight:950; font-variant-numeric:tabular-nums;
  border:1px solid var(--border);
  border-radius:.85rem; padding:8px 10px;
  background:var(--panel2); white-space:nowrap;
}
.metaBoxFoot{ padding:0 10px 10px; display:flex; justify-content:flex-end; }

.workTop{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; flex-wrap:wrap; margin-bottom:10px;
}
.workTop .left{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.workTitle, .rightTitle{
  font-size:.95rem; letter-spacing:.08em; text-transform:uppercase;
  font-weight:950; white-space:nowrap;
}
.workTop .btns{ display:flex; gap:8px; flex-wrap:wrap; }
.workTop .rightControls{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
.zoomControls{ display:flex; align-items:center; gap:6px; }
.zoomLabel{ font-size:.78rem; color:var(--muted); margin-right:4px; }

.filterBar{
  background:rgba(0,0,0,.06);
  border:1px solid var(--border);
  border-radius:1rem;
  padding:12px 14px;
  margin-bottom:12px;
}
body.theme-light .filterBar{ background:rgba(0,0,0,.03); }

.filterGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr));
  gap:10px 14px;
  align-items:end;
}
.filterItem{ display:flex; flex-direction:column; gap:4px; }
.filterItem label{
  font-size:.75rem; color:var(--muted);
  text-transform:uppercase; letter-spacing:.06em;
}
.filterActions{ display:flex; align-items:flex-end; }

.phaseMultiFilterItem{
  position:relative;
}

.multiSelect{
  position:relative;
  width:100%;
}

.multiSelectBtn{
  width:100%;
  min-height:38px;
  padding:8px 10px;
  border-radius:.75rem;
  border:1px solid var(--border);
  background:var(--panel2);
  color:var(--text);
  font-size:.85rem;
  text-align:left;
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  cursor:pointer;
  transition:border-color var(--t), box-shadow var(--t), transform var(--t);
}
.multiSelectBtn:hover{ filter:saturate(1.03); }
.multiSelectBtn:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent2), 0 0 0 5px rgba(0,0,0,.25);
  transform:translateY(-1px);
}

.multiSelectCaret{
  opacity:.85;
  font-size:.82rem;
  flex:0 0 auto;
  transition:transform var(--t);
}
.multiSelect[data-open="true"] .multiSelectCaret{
  transform:rotate(180deg);
}

.multiSelectPanel{
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  z-index:80;
  border:1px solid var(--border);
  border-radius:.9rem;
  background:var(--panel);
  box-shadow:0 18px 45px rgba(0,0,0,.28);
  padding:6px;
  max-height:260px;
  overflow:auto;
}

.msOption{
  display:grid;
  grid-template-columns:18px minmax(0, 1fr);
  align-items:center;
  column-gap:8px;
  row-gap:0;
  padding:7px 8px;
  border-radius:.65rem;
  cursor:pointer;
  user-select:none;
  font-size:.83rem;
  color:var(--text);
  line-height:1.2;
}
.msOption span{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.msOption:hover{ background:rgba(255,255,255,.05); }
body.theme-light .msOption:hover{ background:rgba(0,0,0,.04); }

.msOption input[type="checkbox"]{
  width:15px;
  height:15px;
  margin:0;
  accent-color:var(--accent);
  cursor:pointer;
  align-self:center;
  justify-self:center;
}

.msOptionAll{
  border-bottom:1px solid var(--border);
  margin-bottom:4px;
  padding-bottom:8px;
}

.phaseRow.filtered,
.ganttPhaseRow.filtered{
  display:none !important;
}

.miniKpiBar{ display:flex; justify-content:flex-start; margin:6px 0 10px; }
.miniKpi{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:999px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.06);
  color:var(--muted);
  font-size:.82rem; font-weight:850;
}
body.theme-light .miniKpi{ background:rgba(0,0,0,.03); }

.miniKpi.positive{
  color:var(--ok);
  border-color:rgba(34,197,94,.35);
  background:rgba(34,197,94,.10);
}
body.theme-light .miniKpi.positive{
  color:var(--ok);
  border-color:rgba(41,97,23,.35);
  background:rgba(41,97,23,.10);
}

.miniKpi.negative{
  color:#fff;
  border-color:rgba(227,66,66,.6);
  background:rgba(227,66,66,.22);
}
body.theme-light .miniKpi.negative{
  color:#fff;
  border-color:rgba(185,28,28,.65);
  background:rgba(185,28,28,.22);
}

.workFrame{
  border:1px solid var(--border);
  border-radius:1rem;
  overflow:hidden;
  background:var(--panel);
}
.workHeader{
  position:sticky; top:0; z-index:20;
  background:var(--panel);
  border-bottom:1px solid var(--border);
}
.workSplit{
  display:grid; width:100%;
  grid-template-columns:clamp(var(--tasks-min), var(--tasks-share), var(--tasks-max)) 1fr;
}
.workSplit > *{ min-width:0; }
.workSplit.body{ align-items:start; }
.workVScroll{ max-height:620px; overflow-y:auto; overflow-x:hidden; }

.taskHead{
  height:var(--head-total);
  background:var(--thead-bg);
  display:flex; align-items:stretch;
  border-right:1px solid var(--border);
}
.taskHeadGrid{
  width:100%;
  display:grid; grid-template-columns:var(--task-cols);
}
.taskHeadCell{
  padding:8px 8px; border-right:1px solid var(--border);
  display:flex; align-items:center;
  font-size:.72rem; text-transform:uppercase; letter-spacing:.08em;
  color:var(--thead-text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.taskHeadCell.num{ justify-content:flex-end; }
.taskHeadCell:last-child{ border-right:none; }
.taskHeadCell.infoHead{ justify-content:center; padding-left:4px; padding-right:4px; }
.taskHeadCell.wrapHead{
  white-space:normal;
  line-height:1.1;
  align-items:center;
}
.taskHeadCell.wrapHead > span{ min-width:0; }

.firmHead{ justify-content:space-between; gap:8px; }

.colToggle{
  flex:0 0 auto; width:22px; height:22px;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:6px; border:1px solid var(--border);
  background:transparent; color:var(--text);
  cursor:pointer; font-weight:900; line-height:1; padding:0;
}
.colToggle:hover{ background:var(--panel2); }

.ganttHScrollHead{
  height:var(--head-total);
  overflow-x:auto; overflow-y:hidden;
  background:var(--panel);
}
.ganttHeadCanvas{ width:max-content; min-height:var(--head-total); --days:0; }

.gSpanRow{
  display:grid; grid-template-columns:repeat(var(--days), var(--colw));
  height:var(--head-h);
  border-bottom:1px solid var(--border);
  background:var(--thead-bg);
}
.gSpan{
  border-right:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:.72rem; color:var(--thead-text);
  text-transform:uppercase; letter-spacing:.08em;
  white-space:nowrap; overflow:hidden;
}

.ganttHeadRow{
  display:grid; grid-auto-flow:column; grid-auto-columns:var(--colw);
  height:var(--head-h);
  align-items:stretch;
  border-bottom:1px solid var(--border);
  background:var(--thead-bg-2);
}
.ganttHeadRow:last-child{ border-bottom:none; }
.ganttHeadRow.is-date{ height: calc(var(--head-h) + var(--date-extra)); }

.gHeadCell{
  border-right:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:.72rem; color:var(--thead-text);
  white-space:nowrap; user-select:none;
}
.gHeadCell.weekend{ background:var(--weekend-bg); }
.gHeadCell.holiday{ background:var(--holiday-bg); }

.ganttHeadRow.is-date .gHeadCell{
  writing-mode:vertical-rl;
  text-orientation:mixed;
  transform:rotate(180deg);
  font-size:.70rem;
  line-height:1;
  padding:6px 0;
}

.taskBody{ border-right:1px solid var(--border); background:var(--panel); }

.phaseRow{
  height:var(--cell-h);
  display:grid; grid-template-columns:var(--task-cols);
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,.12);
  font-weight:900;
  cursor:pointer;
  transition:background .15s ease;
}
.phaseRow:hover{ background:rgba(0,0,0,.18); }
body.theme-light .phaseRow{ background:rgba(0,0,0,.06); }
body.theme-light .phaseRow:hover{ background:rgba(0,0,0,.10); }
.phaseRow.complete{ background:rgba(34, 197, 94, .14); }
body.theme-light .phaseRow.complete{ background:rgba(41, 97, 23, .14); }

.phaseRow.collapsed .phaseToggle::before{ content:"▶"; }
.phaseRow .phaseToggle::before{ content:"▼"; }

.phaseIdCell{ justify-content:center; gap:6px; }
.phaseToggle{
  width:100%;
  display:flex; align-items:center; justify-content:center;
  font-size:.9rem; line-height:1; opacity:.95;
}

.phaseCell{
  border-right:1px solid var(--border);
  display:flex; align-items:center; padding:0 8px; gap:8px; min-width:0;
}
.phaseCell:last-child{ border-right:none; }
.phaseName{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.phaseCell.phaseEndActions{ padding-left:6px; padding-right:6px; }
.phaseActions{ display:flex; gap:6px; }
.phaseActions .mini{ padding:4px 8px; font-size:.7rem; }

.phaseHint{
  font-size:.78rem; color:var(--thead-muted); font-weight:850;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.phasePctCell{ padding:0; }
.phasePctFill{
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:flex-end;
  padding:0 8px;
  font-variant-numeric:tabular-nums;
  font-weight:950; font-size:.82rem;
}
.phasePctFill.ok{
  justify-content:center;
  background:var(--ok);
  color:#fff;
  border-radius:0;
}

.taskRow{
  height:var(--cell-h);
  display:grid; grid-template-columns:var(--task-cols);
  border-bottom:1px solid var(--border);
}
.taskRow:last-child{ border-bottom:none; }
.taskRow.filtered{ display:none; }
.taskRow.collapsed{ display:none; }

.tCell{
  border-right:1px solid var(--border);
  display:flex; align-items:stretch;
  padding:0; min-width:0;
}
.tCell:last-child{ border-right:none; }

.tId{
  width:100%;
  display:flex; align-items:center; justify-content:center;
  font-variant-numeric:tabular-nums;
  font-weight:900; color:var(--thead-muted); font-size:.82rem;
}

.tDays{
  width:100%;
  display:flex; align-items:center; justify-content:flex-end;
  padding:0 8px;
  font-variant-numeric:tabular-nums;
  font-weight:950; font-size:.82rem;
}

.tCell > input, .tCell > select{
  border:none; border-radius:0;
  background:transparent; box-shadow:none;
  height:100%;
  padding:6px 8px;
  font-size:.82rem;
  outline:none;
  color:var(--text);
}

.tCell > input:focus, .tCell > select:focus{
  box-shadow:inset 0 0 0 2px var(--accent2);
  transform:none;
}
.tCell select{ padding-right:22px; }

.pctCell{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:0;
  padding:0 1px;
}

.pctCell input{
  width:44px;
  min-height:26px;
  text-align:center;
  border:none !important;
  background:transparent !important;
  box-shadow:none !important;
  outline:none !important;
  padding:5px 2px 5px 2px;
  height:auto;
  font-variant-numeric:tabular-nums;
  font-weight:900;
  font-size:.82rem;
  line-height:1;
  color:var(--text);
  border-radius:.4rem;
  transition:background var(--t), color var(--t), border-color var(--t);
}

.pctCell input[readonly]{
  cursor:default;
  opacity:1;
}

.pctCell input[readonly]:focus{
  box-shadow:none !important;
}

.pctCell .pct{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  min-height:26px;
  padding:5px 4px 5px 0;
  line-height:1;
  font-weight:900;
  font-size:.8rem;
  color:var(--thead-muted);
  min-width:12px;
  text-align:left;
}

.pctCell.progressWarn{
  background:var(--danger);
}
.pctCell.progressDone{
  background:var(--ok);
}

.pctCell.progressWarn input,
.pctCell.progressWarn .pct,
.pctCell.progressDone input,
.pctCell.progressDone .pct{
  background:transparent !important;
  color:#fff !important;
  border:none !important;
  font-weight:950;
}

.endCellWrap{
  width:100%;
  display:flex; align-items:center; gap:6px;
  padding:0;
}
.endCellWrap .dateHybrid{ flex:1 1 auto; min-width:0; }

.completionCellWrap{
  width:100%;
  display:flex;
  align-items:center;
  gap:6px;
  padding:0 6px;
}
.completionCellWrap .dateHybrid{
  flex:1 1 auto;
  min-width:0;
}
.completionActions{
  flex:0 0 auto;
  display:flex;
  gap:6px;
  align-items:center;
}

.taskDelBtn{
  flex:0 0 auto;
  padding:4px 7px; border-radius:.7rem;
  border:1px solid var(--border);
  background:transparent; color:var(--text);
  cursor:pointer; font-weight:900; font-size:.75rem;
}
.taskDelBtn:hover{
  background:rgba(227,66,66,.18);
  border-color:rgba(227,66,66,.55);
}
body.theme-light .taskDelBtn:hover{
  background:rgba(185,28,28,.16);
  border-color:rgba(185,28,28,.55);
}

body:not(.show-owner-col) .taskHeadGrid > :nth-child(4),
body:not(.show-owner-col) .taskRow > :nth-child(4),
body:not(.show-owner-col) .phaseRow > :nth-child(4){
  padding:0 !important;
  border-right:none !important;
  overflow:hidden !important;
}
body:not(.show-owner-col) .taskRow > :nth-child(4) input,
body:not(.show-owner-col) .taskRow > :nth-child(4) select{
  display:none !important;
}

.ganttHScrollBody{
  position:relative;
  overflow-x:auto; overflow-y:hidden;
  background:var(--panel);
}
.ganttBodyCanvas{ width:max-content; position:relative; }

.ganttPhaseRow{
  position:relative;
  display:grid; grid-auto-flow:column; grid-auto-columns:var(--colw);
  height:var(--cell-h); align-items:stretch;
  border-bottom:1px solid var(--border);
  background:rgba(0,0,0,.12);
}
body.theme-light .ganttPhaseRow{ background:rgba(0,0,0,.06); }

.ganttRow{
  position:relative;
  display:grid; grid-auto-flow:column; grid-auto-columns:var(--colw);
  height:var(--cell-h); align-items:stretch;
  border-bottom:1px solid var(--border);
}
.ganttRow:last-child{ border-bottom:none; }
.ganttRow.filtered{ display:none; }
.ganttRow.collapsed{ display:none; }

.gCell{ border-right:1px solid var(--border); }
.gCell.weekend{ background:var(--weekend-bg); }
.gCell.holiday{ background:var(--holiday-bg); }

.gBar{
  position:absolute; top:7px; height:20px;
  border-radius:999px;
  box-shadow:0 10px 22px rgba(0,0,0,.22);
  background:var(--status-todo);
  cursor:grab; user-select:none; overflow:hidden;
  transition:box-shadow .15s ease;
}
.gBar:hover{ box-shadow:0 14px 28px rgba(0,0,0,.32); }
.gBar.dragging{
  cursor:grabbing;
  opacity:.85;
  box-shadow:0 18px 36px rgba(0,0,0,.42);
}
.gBar.status-todo{ background:var(--status-todo); }
.gBar.status-doing{ background:var(--status-doing); }
.gBar.status-blocked{ background:var(--status-blocked); }
.gBar.status-canceled{ background:var(--status-canceled); }
.gBar.status-done{ background:var(--status-done); }
.gBar.status-overdue{ background:var(--status-overdue); }

.gBarProgress{
  position:absolute; top:0; left:0; bottom:0;
  background:rgba(255,255,255,.25);
  border-radius:999px 0 0 999px;
  pointer-events:none;
}

.gBarHandle{
  position:absolute; top:0; bottom:0; width:8px;
  cursor:ew-resize; z-index:2;
}
.gBarHandle.left{ left:0; }
.gBarHandle.right{ right:0; }

.gPhaseBar{
  position:absolute; top:9px; height:16px;
  border-radius:999px;
  background:rgba(255,255,255,.20);
  border:1px solid rgba(255,255,255,.25);
  box-shadow:0 10px 18px rgba(0,0,0,.18);
  overflow:hidden; pointer-events:none;
}
body.theme-light .gPhaseBar{
  background:rgba(0,0,0,.10);
  border:1px solid rgba(0,0,0,.18);
}
.gPhaseBarFill{
  position:absolute; left:0; top:0; bottom:0;
  width:0%;
  background:rgba(34,197,94,.55);
}
body.theme-light .gPhaseBarFill{ background:rgba(41,97,23,.55); }

.todayLine{
  position:absolute; top:0; bottom:0; width:2px;
  background:var(--danger);
  opacity:.95; pointer-events:none; z-index:50;
  box-shadow:0 0 0 3px rgba(227,66,66,.12);
  display:none;
}

.teamWorkload{ display:flex; flex-direction:column; gap:10px; }

.teamMember{
  display:grid; grid-template-columns:auto 1fr auto;
  gap:10px; align-items:start;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:.9rem;
  background:rgba(0,0,0,.04);
}
body.theme-light .teamMember{ background:rgba(0,0,0,.02); }

.teamAvatar{
  width:32px; height:32px; border-radius:50%;
  background:var(--accent); color:var(--btn-text);
  display:flex; align-items:center; justify-content:center;
  font-weight:900; font-size:.85rem;
}

.teamInfo{
  display:grid;
  grid-template-columns:160px 220px 220px;
  grid-template-areas:
    "name name name"
    "role dept1 dept2";
  column-gap:16px;
  row-gap:2px;
  min-width:0;
  align-items:start;
  justify-content:start;
}

.teamName{
  grid-area:name;
  font-weight:900;
  font-size:.85rem;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.teamRole{
  grid-area:role;
  font-size:.72rem;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  align-self:start;
}

.teamDept{
  font-size:.72rem;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  justify-self:start;
  text-align:left;
}
.teamDept:nth-of-type(1){
  grid-area:dept1;
}
.teamDept:nth-of-type(2){
  grid-area:dept2;
}

.teamLoad{
  font-size:.78rem; font-variant-numeric:tabular-nums;
  color:var(--muted); align-self:start; white-space:nowrap;
}

.teamList{ display:flex; flex-direction:column; gap:8px; }
.teamListItem{
  display:grid;
  grid-template-columns:minmax(140px,1.2fr) minmax(120px,1fr) minmax(140px,1fr) minmax(140px,1fr) auto;
  gap:8px; align-items:center;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:.8rem;
  background:rgba(0,0,0,.04);
}
body.theme-light .teamListItem{ background:rgba(0,0,0,.02); }

.analyticsContent{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  align-items:stretch;
}

.chartBox{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:0;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
}

.compactAnalyticsCard{
  gap:5px;
  min-height:var(--analytics-card-min-h);
  height:100%;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
}

.compactAnalyticsCard .chartLabel{
  font-size:.70rem;
  line-height:1.2;
  font-family:inherit;
}

.compactAnalyticsCard .svgCard{
  padding:5px;
  border-radius:.75rem;
  min-height:var(--analytics-card-min-h);
  height:var(--analytics-card-min-h);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  font-family:inherit;
}

.compactAnalyticsCard .chartLegend{
  gap:4px;
  font-size:.74rem;
}

.compactAnalyticsCard .chartNote{
  font-size:.72rem;
  line-height:1.3;
  font-family:inherit;
}

.chartLabel{
  font-size:.78rem; color:var(--muted);
  text-transform:uppercase; letter-spacing:.08em;
  font-family:inherit;
}
.svgCard{
  border:1px solid var(--border);
  border-radius:.9rem;
  background:rgba(0,0,0,.04);
  padding:8px;
  font-family:inherit;
}
body.theme-light .svgCard{ background:rgba(0,0,0,.02); }

.svgCard svg{
  width:100%;
  height:100%;
  display:block;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
}

.chartLegend{
  display:flex; flex-direction:column; gap:6px;
  font-size:.80rem; color:var(--muted);
  font-family:inherit;
}
.legendRow{ display:flex; align-items:center; gap:8px; }
.legendSwatch{
  width:10px; height:10px;
  border-radius:3px;
  border:1px solid var(--border);
  flex:0 0 auto;
}
.legendText{
  display:flex; justify-content:space-between; width:100%;
  gap:10px; font-variant-numeric:tabular-nums;
}
.chartNote{ font-size:.78rem; color:var(--muted); line-height:1.35; font-family:inherit; }

.chartNote.negative{ color:var(--danger); font-weight:900; }
.chartNote.positive{ color:var(--ok); font-weight:900; }

.isCollapsedSection{
  display:none !important;
}

.phaseRankingCard{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:100%;
  height:100%;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
  overflow:hidden;
}

.phaseRankingHead{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  flex:0 0 auto;
  font-family:inherit;
}

.phaseRankingSortWrap{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:.76rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.06em;
  font-family:inherit;
}

.phaseRankingSort{
  min-width:132px;
  width:auto;
  padding:6px 28px 6px 10px;
  font-size:.8rem;
  border-radius:.7rem;
  font-family:inherit;
}

.phaseRankingList{
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding-right:14px;
  margin-right:2px;
  scrollbar-gutter:stable;
  font-family:inherit;
}

.phaseRankingEmpty{
  color:var(--muted);
  font-size:.82rem;
  font-weight:700;
  padding:8px 2px;
  font-family:inherit;
}

.phaseRankingRow{
  display:grid;
  grid-template-columns:minmax(0, 1.05fr) minmax(120px, 1.55fr) 52px;
  gap:12px;
  align-items:center;
  min-width:0;
  font-family:inherit;
}

.phaseRankingName{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:.82rem;
  font-weight:800;
  color:var(--text);
  font-family:inherit;
}

.phaseRankingBarTrack{
  position:relative;
  height:12px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.06);
  overflow:hidden;
  min-width:0;
}
body.theme-light .phaseRankingBarTrack{
  background:rgba(0,0,0,.04);
}

.phaseRankingBarFill{
  position:absolute;
  top:0; left:0; bottom:0;
  width:0%;
  border-radius:999px;
  background:var(--accent);
}

.phaseRankingValue{
  text-align:right;
  padding-right:14px;
  font-variant-numeric:tabular-nums;
  font-size:.82rem;
  font-weight:950;
  color:var(--text);
  font-family:inherit;
  white-space:nowrap;
  position:relative;
  z-index:1;
}

.phaseRankingSummary{
  margin-top:auto;
  padding-top:6px;
  padding-right:14px;
  border-top:1px solid var(--border);
  font-size:.76rem;
  color:var(--muted);
  font-weight:800;
  display:grid;
  grid-template-columns:minmax(0, 1.05fr) minmax(120px, 1.55fr) 52px;
  gap:12px;
  align-items:center;
  flex:0 0 auto;
  font-family:inherit;
}

.phaseRankingSummaryLeft{
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-family:inherit;
}

.phaseRankingSummaryMid{
  min-width:0;
}

.phaseRankingSummaryRight{
  text-align:right;
  padding-right:14px;
  font-variant-numeric:tabular-nums;
  color:var(--text);
  font-weight:950;
  font-family:inherit;
  white-space:nowrap;
}

dialog{
  border:none; border-radius:1.2rem; padding:0;
  width:min(760px, calc(100vw - 24px));
  background:var(--panel); color:var(--text);
  box-shadow:0 24px 70px rgba(0,0,0,.55);
}
dialog::backdrop{ background:rgba(0,0,0,.55); }

.dlgHead{
  display:flex; justify-content:space-between; gap:10px; align-items:center;
  padding:12px 14px; border-bottom:1px solid var(--border);
}
.dlgHead h3{
  margin:0; font-size:1rem; font-weight:950; letter-spacing:.02em;
}
.dlgBody{
  padding:12px 14px 6px;
  max-height:70vh;
  overflow-y:auto;
}
.dlgFoot{
  display:flex; justify-content:flex-end; gap:10px;
  padding:12px 14px;
  border-top:1px solid var(--border);
}
.dlgFootSpread{
  justify-content:space-between; align-items:center; gap:12px;
}
.dlgFootRight{ display:flex; gap:10px; align-items:center; }

.mini{
  padding:7px 10px;
  border-radius:.85rem;
  border:1px solid var(--border);
  background:transparent; color:var(--text);
  cursor:pointer;
  transition:background var(--t), transform var(--t);
  font-weight:800; font-size:.78rem;
  white-space:nowrap;
}
.mini:hover{ background:var(--panel2); transform:translateY(-1px); }

.grid{
  display:grid; grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px 12px;
}
label{ display:flex; flex-direction:column; gap:4px; font-size:.82rem; }
.labRow{ display:flex; justify-content:space-between; gap:8px; }
.labRow strong{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.labRow .hint{
  font-size:.72rem; color:var(--muted);
  white-space:nowrap; flex:0 0 auto;
}

@media (max-width:1100px){
  :root{
    --tasks-share:100%;
    --tasks-min:0px;
    --tasks-max:9999px;
  }

  .workSplit{ grid-template-columns:1fr; }
  .taskHead{ border-right:none; }
  .taskBody{ border-right:none; }
  .ganttHScrollHead{ border-top:1px solid var(--border); }
  .ganttHScrollBody{ border-top:1px solid var(--border); }

  .metaRow2{ grid-template-columns:1fr; }
  .overviewRow1{ grid-template-columns:1fr; }
  .kpiGrid{ grid-template-columns:repeat(2, minmax(160px, 1fr)); }
  .layout{ grid-template-columns:1fr; }
  .panel.half{ grid-column:1; }

  .phaseMultiFilterItem{
    min-width:220px;
  }

  .analyticsContent{
    grid-template-columns:repeat(auto-fit, minmax(210px, 1fr));
    gap:10px;
    align-items:stretch;
  }

  .teamListItem{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .teamListItem .btn{
    justify-self:start;
  }
}

@media (max-width:560px){
  .kpiGrid{ grid-template-columns:1fr; }
  body{ padding:10px; }
  .shell{ padding:12px; border-radius:1.2rem; }
  .grid{ grid-template-columns:1fr; }
  .filterGrid{ grid-template-columns:1fr; }

  .multiSelectPanel{
    left:0; right:0;
    width:auto; max-width:none;
  }

  .phaseMultiFilterItem{
    min-width:0;
    max-width:none;
  }

  .panel{
    padding:12px 12px 13px;
    border-radius:1.1rem;
  }

  .panelHead{
    align-items:flex-start;
    gap:10px;
  }

  .panelHead .headActions{
    width:100%;
    justify-content:flex-start;
  }

    .projectOverviewHead{
    align-items:flex-start;
  }

  .projectOverviewHeadLeft{
    width:100%;
    flex-wrap:wrap;
    gap:8px;
  }

  .projectSelHead{
    width:100%;
    max-width:none;
    min-width:0;
  }

  .compactAnalyticsCard{
    gap:4px;
    min-height:var(--analytics-card-min-h);
  }

  .compactAnalyticsCard .chartLabel{
    font-size:.66rem;
    letter-spacing:.06em;
  }

  .compactAnalyticsCard .svgCard{
    padding:4px;
    border-radius:.7rem;
    min-height:var(--analytics-card-min-h);
    height:var(--analytics-card-min-h);
  }

  .compactAnalyticsCard .chartNote{
    font-size:.68rem;
    line-height:1.25;
  }

  .analyticsContent{
    grid-template-columns:1fr;
    gap:8px;
  }

  .miniKpi{
    font-size:.76rem;
    padding:5px 8px;
  }

  .btn.small{
    padding:6px 9px;
    font-size:.78rem;
  }

  .btn.mini{
    padding:4px 7px;
    font-size:.72rem;
  }

  .phaseRankingRow{
    grid-template-columns:minmax(0, 1fr) minmax(84px, 1.35fr) 72px;
    gap:8px;
  }

  .phaseRankingSummary{
    grid-template-columns:minmax(0, 1fr) minmax(84px, 1.35fr) 72px;
    gap:8px;
    padding-right:28px;
  }

  .phaseRankingList{
    padding-right:28px;
  }

  .phaseRankingSort{
    min-width:118px;
  }

  .teamListItem{
    grid-template-columns:1fr;
  }

  .teamInfo{
    grid-template-columns:minmax(0, 1fr);
    grid-template-areas:
      "name"
      "role"
      "dept1"
      "dept2";
  }

  .teamDept{
    justify-self:start;
  }
}