:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d8dce1;
  --text: #1f2430;
  --text-dim: #5b6472;
  --accent: #1f5fa8;
  --accent-dim: #eaf1fb;
  --radius: 10px;
  --brand-yellow: #f4b400;
  --brand-black: #1a1a1a;

  --status-on_track: #1a7f37;
  --status-on_track-bg: #e6f6ea;
  --status-at_risk: #9a6700;
  --status-at_risk-bg: #fff6e0;
  --status-delayed: #b3261e;
  --status-delayed-bg: #fdeceb;
  --status-complete: #3d5a80;
  --status-complete-bg: #e8edf5;
  --status-on_hold: #5b6472;
  --status-on_hold-bg: #eceef0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

/* ---------- header (shared pattern) ---------- */
.app-header {
  background: var(--brand-black);
  color: white;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 4px solid var(--brand-yellow);
}
.app-logo { height: 44px; width: auto; background: white; padding: 6px 10px; border-radius: 4px; flex-shrink: 0; }
.app-header-text { flex: 1; min-width: 0; }
.app-header h1 { margin: 0 0 4px; font-size: 1.25rem; }
.app-header .subtitle { margin: 0; opacity: 0.85; font-size: 0.88rem; }
.back-to-hub {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.82rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 6px 10px;
}
.back-to-hub:hover { color: white; border-color: white; }
.powered-by { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.powered-by-label { font-size: 0.7rem; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.erogn-logo { height: 28px; width: auto; border-radius: 3px; }

.edit-auth { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; }
#signInBtn {
  background: none;
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 400;
}
#signInBtn:hover { color: white; border-color: rgba(255, 255, 255, 0.6); background: none; }
.editor-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(244, 180, 0, 0.15);
  color: var(--brand-yellow);
  border: 1px solid rgba(244, 180, 0, 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}
.editor-badge .btn-link { color: rgba(255, 255, 255, 0.7); font-weight: 400; text-decoration: underline; }
.editor-badge .btn-link:hover { color: white; }
.mode-toggle { display: flex; background: rgba(0, 0, 0, 0.18); border-radius: 999px; padding: 2px; gap: 2px; }
.mode-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(244, 180, 0, 0.7);
  padding: 4px 10px;
  border-radius: 999px;
}
.mode-toggle-btn:hover { color: var(--brand-yellow); }
.mode-toggle-btn.active { background: var(--brand-yellow); color: var(--brand-black); }
.mode-toggle-btn.active:hover { color: var(--brand-black); }

.status-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: var(--brand-black);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.status-toast.info { background: var(--accent); }
.status-toast.success { background: var(--status-on_track); }
.status-toast.error { background: var(--status-delayed); }

main { max-width: 1200px; margin: 24px auto; padding: 0 20px 60px; }
.view.hidden { display: none; }
.hidden { display: none !important; }

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-header-row h2, .panel-header-row h3 { margin: 0; }
.header-row-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger, .btn-link {
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
}
.btn-primary { background: var(--brand-black); color: white; padding: 9px 16px; font-size: 0.88rem; }
.btn-primary:hover { background: #333; }
.btn-secondary { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); padding: 8px 14px; font-size: 0.85rem; }
.btn-secondary:hover { background: var(--accent); color: white; }
.btn-danger { background: var(--status-delayed-bg); color: var(--status-delayed); border-color: var(--status-delayed); padding: 8px 14px; font-size: 0.85rem; }
.btn-danger:hover { background: var(--status-delayed); color: white; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 0.85rem; text-decoration: underline; font-weight: 400; padding: 4px 0; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 0.95rem; padding: 2px 6px; }
.btn-icon:hover { color: var(--status-delayed); }
.btn-icon.btn-share { font-size: 1rem; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; }
.btn-icon.btn-share:hover { color: var(--accent); border-color: var(--accent); }
.action-divider { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

/* ---------- dropdown menu (Import ▾) ---------- */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.15);
  min-width: 200px;
  padding: 6px;
  z-index: 30;
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
}
.dropdown-item:hover { background: var(--accent-dim); color: var(--accent); }

/* ---------- project list ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.project-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); border-color: var(--accent); }
.card-actions-row { display: flex; gap: 8px; margin-top: 2px; }
.card-open-btn { flex: 1; text-align: center; }
.project-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-card-top-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.card-delete-btn { font-size: 1.1rem; line-height: 1; }
.project-card h3 { margin: 0; font-size: 1.05rem; }
.project-card .client { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-dim); }
.project-card-dates { margin: 0; font-size: 0.78rem; color: var(--text-dim); }
.progress-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); }
.project-card-meta { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--text-dim); }
.notes-hover-wrap { position: relative; }
.notes-hover-label { border-bottom: 1px dotted var(--text-dim); cursor: default; }
.notes-preview {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
  padding: 10px 12px;
  z-index: 20;
  text-align: left;
  white-space: normal;
}
.notes-hover-wrap:hover .notes-preview, .notes-hover-wrap.open .notes-preview { display: block; }
.notes-preview-item { padding: 5px 0; border-top: 1px solid var(--border); }
.notes-preview-item:first-child { border-top: none; padding-top: 0; }
.notes-preview-meta { font-size: 0.72rem; color: var(--text-dim); }
.notes-preview-text { font-size: 0.82rem; color: var(--text); margin-top: 2px; }
.notes-preview-more { font-size: 0.72rem; color: var(--text-dim); font-style: italic; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.empty-state { color: var(--text-dim); font-size: 0.9rem; padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-badge.on_track { background: var(--status-on_track-bg); color: var(--status-on_track); }
.status-badge.at_risk { background: var(--status-at_risk-bg); color: var(--status-at_risk); }
.status-badge.delayed { background: var(--status-delayed-bg); color: var(--status-delayed); }
.status-badge.complete { background: var(--status-complete-bg); color: var(--status-complete); }
.status-badge.on_hold { background: var(--status-on_hold-bg); color: var(--status-on_hold); }

/* ---------- detail view ---------- */
.detail-header {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.detail-title-row h2 { margin: 0; }
.detail-client { margin: 2px 0 0; color: var(--text-dim); font-size: 0.9rem; }
.detail-client-link { cursor: pointer; width: fit-content; }
.detail-client-link:hover { color: var(--accent); text-decoration: underline; }
.detail-description { margin: 12px 0 0; font-size: 0.88rem; color: var(--text-dim); }
.detail-source {
  display: block; margin: 6px 0 0; font-size: 0.82rem; color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-decoration: none; width: fit-content;
}
.detail-source:hover { color: var(--accent); text-decoration: underline; }
.completion-check-row {
  align-items: center;
  gap: 3px;
  overflow: hidden;
  white-space: nowrap;
  margin: 10px 0 0;
}
.completion-check {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #00c875;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}
.completion-check-counter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 15px;
  padding: 0 6px;
  border-radius: 999px;
  background: #00c875;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.detail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gantt-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 8px;
  margin-right: 4px;
}
.gantt-zoom-controls .btn-icon { font-size: 1rem; font-weight: 700; padding: 3px 8px; line-height: 1; }
.gantt-zoom-controls .btn-icon:hover { color: var(--accent); }
#projectGanttZoomLabel { font-size: 0.76rem; font-weight: 700; color: var(--text-dim); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
.gantt-zoom-controls .btn-link { font-size: 0.72rem; margin-left: 4px; }
.gantt-toolbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.status-select {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  text-transform: uppercase;
}
.status-select.on_track { background: var(--status-on_track-bg); color: var(--status-on_track); border-color: var(--status-on_track); }
.status-select.at_risk { background: var(--status-at_risk-bg); color: var(--status-at_risk); border-color: var(--status-at_risk); }
.status-select.delayed { background: var(--status-delayed-bg); color: var(--status-delayed); border-color: var(--status-delayed); }
.status-select.complete { background: var(--status-complete-bg); color: var(--status-complete); border-color: var(--status-complete); }
.status-select.on_hold { background: var(--status-on_hold-bg); color: var(--status-on_hold); border-color: var(--status-on_hold); }

.tab-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab-bar-tabs { display: flex; gap: 4px; }
.tab-bar-actions { display: flex; gap: 10px; align-items: center; padding-bottom: 8px; }
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel.hidden { display: none; }

/* ---------- task list ---------- */
.task-list { display: flex; flex-direction: column; gap: 14px; }
.current-marker {
  align-self: flex-start;
  margin-bottom: -6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--brand-black);
  background: var(--brand-yellow);
  border-radius: 999px;
  padding: 3px 10px;
}
.task-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
}
.task-card-content {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px 16px 26px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.07);
}
.task-swipe-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 26px;
  background: #00c875;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  border-radius: 14px;
}
.task-swipe-check { font-size: 1.25rem; }
.float-check-fx {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #00c875;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), 0 0 0 2px rgba(0, 0, 0, 0.06);
  transform: translate(-50%, -50%);
  animation: floatCheckFx 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes floatCheckFx {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-8deg); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1.35) rotate(4deg); }
  35% { opacity: 1; transform: translate(-50%, -80%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -170%) scale(1) rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .float-check-fx { animation-duration: 0.01s; }
}
.task-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border-radius: 50%;
  background: #00c875;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.task-card-stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }
.task-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task-card-title { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.task-select-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 12px;
  margin: -12px 0 -12px -12px;
  cursor: pointer;
}
.task-select-checkbox { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent, #2563eb); }
.task-card.is-selected .task-card-content { box-shadow: 0 0 0 2px var(--accent, #2563eb) inset, 0 2px 8px rgba(16, 24, 40, 0.07); }
.task-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.task-bulk-actions { display: flex; align-items: center; gap: 8px; font-weight: 400; flex-wrap: wrap; }
.task-bulk-actions button { min-height: 40px; }

/* ---------- gantt view (fully editable timeline) ---------- */
/* Break out of <main>'s centered 1200px column so the Gantt view alone
   spans the full viewport width -- there's rarely such a thing as too
   much room for a timeline. */
#ganttView, #projectGanttView, #manpowerGanttView {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 24px;
  box-sizing: border-box;
}
/* True fullscreen (via the Fullscreen API): the element becomes its own
   top-level viewport, so it needs to size and lay itself out explicitly
   instead of relying on the page around it. The grid gets a fixed-height
   flex column with its own internal scroll so rows fill the screen. */
#projectGanttView:fullscreen, #manpowerGanttView:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  margin: 0;
  padding: 20px 24px;
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
#projectGanttView:fullscreen .gantt-full, #manpowerGanttView:fullscreen .gantt-full {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  overflow-y: auto;
}
.gantt-full { display: flex; align-items: flex-start; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.gantt-full-labels { flex-shrink: 0; width: 460px; border-right: 1px solid var(--border); }
.gantt-full-label-header, .gantt-full-label-row {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--border);
}
.gantt-full-label-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
}
.gantt-full-label-row.is-selected { background: var(--accent-dim); }
.gantt-select { flex-shrink: 0; width: 14px; height: 14px; cursor: pointer; }
.gantt-row-num { flex-shrink: 0; font-size: 0.72rem; color: var(--text-dim); width: 16px; text-align: right; white-space: nowrap; }
.gantt-col-check, .gantt-col-num { flex-shrink: 0; width: 16px; }
.gantt-col-name { flex: 1 1 auto; min-width: 0; }
.gantt-col-resp { flex: 0 0 78px; }
.gantt-col-pred, .gantt-col-succ { flex: 0 0 56px; }
.gantt-col-pcount { flex: 0 0 64px; text-align: center; }
.gantt-col-del { flex-shrink: 0; width: 16px; }
.project-gantt-labels { width: 560px; }
.gantt-manpower-count, .gantt-traveler-count {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 2px;
  cursor: pointer;
  font: inherit;
}
.gantt-manpower-count:hover, .gantt-traveler-count:hover { border-color: var(--border); color: var(--text); }
.gantt-name-input, .gantt-resp-input, .gantt-pred-input {
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  color: inherit;
  padding: 4px 5px;
  border-radius: 4px;
  min-width: 0;
  width: 100%;
}
.gantt-name-input { font-weight: 600; font-size: 0.82rem; }
.gantt-resp-input, .gantt-pred-input { font-size: 0.74rem; color: var(--text-dim); }
.gantt-name-input:hover, .gantt-resp-input:hover, .gantt-pred-input:hover { border-color: var(--border); }
.gantt-name-input:focus, .gantt-resp-input:focus, .gantt-pred-input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.gantt-succ-display { font-size: 0.74rem; color: var(--text-dim); padding: 4px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-row-del { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 0.95rem; padding: 2px 4px; }
.gantt-row-del:hover { color: var(--status-delayed); }
.gantt-full-right-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gantt-full-header-clip {
  overflow-x: hidden;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
}
.gantt-full-scroll { flex: 1; min-width: 0; overflow-x: auto; }
.gantt-full-header-row { display: flex; border-bottom: 1px solid var(--border); }
.gantt-full-day {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-dim);
  padding-bottom: 4px;
  height: 40px;
  box-sizing: border-box;
  border-right: 1px solid var(--border);
}
.gantt-full-day.weekend { background: var(--bg); }
.gantt-full-day.today { color: var(--accent); font-weight: 700; }
.gantt-full-month { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 2px; }
.gantt-full-body-inner { position: relative; }
.gantt-full-row { height: 40px; position: relative; border-bottom: 1px solid var(--border); }
.gantt-full-row.row-alt { background: var(--bg); }
.gantt-full-row.is-selected { background: var(--accent-dim); }
.gantt-full-label-row.row-alt { background: var(--bg); }

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(16, 24, 40, 0.18);
  cursor: grab;
  touch-action: none;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
}
/* Dimmed look for locked (auto-scheduled) bars, via an overlay rather than
   `opacity` -- opacity < 1 creates a new stacking context, which used to
   trap the bar's z-index:20 popover inside it so a later row in the DOM
   could paint right over the open popover. */
.gantt-bar.locked { cursor: grab; }
.gantt-bar.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.28);
  border-radius: inherit;
  pointer-events: none;
}
.gantt-bar.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 4px 12px rgba(16, 24, 40, 0.3); }
.gantt-bar-fill { position: absolute; inset: 0; width: 0; background: rgba(0, 0, 0, 0.22); border-radius: 5px 0 0 5px; pointer-events: none; }
.gantt-bar-label {
  position: relative;
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  line-height: 22px;
  padding: 0 8px 0 8px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}
.gantt-bar-label.outside {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 6px;
  color: var(--text);
  text-shadow: none;
  font-weight: 600;
}
.gantt-bar-resize {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  cursor: ew-resize;
  touch-action: none;
}
.gantt-bar-resize::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  right: 2px;
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.65);
}
.gantt-bar.locked .gantt-bar-resize { cursor: not-allowed; }

.gantt-bar.milestone { box-shadow: none; border: none; }
.gantt-diamond-shape {
  position: absolute;
  top: 3px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--brand-black);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.3);
}

.gantt-link-handle {
  position: absolute;
  top: 50%;
  left: 100%;
  margin-left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
  transform: translateY(-50%);
  cursor: crosshair;
  opacity: 0;
  transition: opacity 0.15s;
  touch-action: none;
}
.gantt-bar:hover .gantt-link-handle, .gantt-link-handle.linking { opacity: 1; }

/* z-index lifts the connector lines out of the z-index:auto layer they'd
   otherwise share with the row divs -- without it, rows painted later in
   the DOM (any row below the first) draw their background right over the
   lines, since plain position:relative rows with no z-index paint in DOM
   order at that shared stack level. */
.gantt-links-svg { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none; overflow: visible; }
.gantt-link-path { fill: none; stroke: var(--text-dim); stroke-width: 1.25; opacity: 0.6; }
.gantt-link-arrow { fill: var(--text-dim); opacity: 0.6; }

.gantt-bar-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
  padding: 12px 14px;
  z-index: 20;
  cursor: default;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
}
.gantt-bar-popover.open { display: block; }
.gantt-bar-popover label { display: flex; flex-direction: column; gap: 3px; font-size: 0.76rem; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; }
.gantt-bar-popover label:last-child { margin-bottom: 0; }
.gantt-bar-popover select, .gantt-bar-popover input[type="number"] {
  font: inherit;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-weight: 400;
}
.gantt-bar-popover .checkbox-row { flex-direction: row; align-items: center; font-weight: 400; color: var(--text); margin-bottom: 0; }
.gantt-popover-preds { max-height: 140px; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 10px; }

.gantt-mini-popover-wrap { position: relative; }
.gantt-mini-popover {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  width: 210px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
  padding: 10px 12px;
  z-index: 25;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
  cursor: default;
}
.gantt-mini-popover.open { display: block; }
.gantt-mini-popover-item { padding: 5px 0; border-top: 1px solid var(--border); }
.gantt-mini-popover-item:first-child { border-top: none; padding-top: 0; }
.gantt-traveler-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gantt-traveler-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-traveler-item-pct { flex-shrink: 0; font-weight: 700; font-size: 0.72rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.gantt-mini-popover select { width: 100%; font: inherit; font-size: 0.76rem; padding: 5px 6px; border: 1px solid var(--border); border-radius: 5px; margin-top: 4px; }

/* ---------- man power gantt (one row per person, plus an assignable "Unassigned Tasks" bucket) ---------- */
.mp-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.mp-label-row.row-alt { background: var(--bg); }
.mp-avatar-wrap { position: relative; flex-shrink: 0; display: inline-flex; }
.mp-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: white;
}
/* Shop-icon badge pinned to an avatar's corner, showing which department
   (Machine Shop / Fab Shop / Engineering) that person belongs to. */
.mp-avatar-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  padding: 2px;
  box-sizing: border-box;
  object-fit: contain;
}
.dept-header-icon { width: 20px; height: 20px; object-fit: contain; vertical-align: -5px; margin-right: 6px; }
.mp-name { font-weight: 600; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.mp-count { flex-shrink: 0; font-size: 0.68rem; color: var(--text-dim); }
/* Department banner -- a vertical strip pinned to the far-left edge of the
   label column, running the full height of that department's run of rows
   (not a horizontal divider between them), so the shop icon stays visible
   the whole time its people are on screen. */
/* Lines the "Name" column header up with the avatar/name text below it,
   which is pushed right by the strip -- this header row has no strip of
   its own (it's not part of any one department). */
#manpowerGanttView .gantt-full-label-header { padding-left: calc(26px + 64px + 12px); }
/* A visible seam between one department's strip and the next -- without
   this, two groups sitting right on top of each other (an unmapped
   custom department next to the Unassigned Tasks bucket, say) read as one
   continuous band instead of two. */
.mp-dept-group + .mp-dept-group .mp-dept-strip { border-top: 2px solid var(--panel); }
.mp-dept-group { display: flex; align-items: stretch; }
.mp-dept-group-rows { flex: 1 1 auto; min-width: 0; }
/* The shop name, outside the colored strip entirely -- its own plain
   column to the left of it, not printed over the banner fill. */
.mp-dept-title {
  flex-shrink: 0;
  width: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  border-right: 1px solid var(--border);
  box-sizing: border-box;
}
.mp-dept-strip {
  flex-shrink: 0;
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  /* background-color comes from the inline style per department -- an
     unmapped department gets no fill at all (see deptColor), not a solid
     black block standing in for nothing. */
  border-right: 2px solid var(--brand-yellow);
  box-sizing: border-box;
  overflow: hidden;
}
.mp-dept-strip-icon {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 5px;
  box-sizing: border-box;
}
.mp-row { position: relative; border-bottom: 1px solid var(--border); box-sizing: border-box; }
.mp-row.row-alt { background: var(--bg); }
.mp-bar {
  position: absolute;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(16, 24, 40, 0.18);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
}
/* Dragged straight up/down to reassign to another person's row -- only
   `transform` ever moves during that drag, never `left`/`width`, so the
   task's dates can't change this way. */
.mp-bar.dragging { cursor: grabbing; z-index: 6; box-shadow: 0 6px 16px rgba(16, 24, 40, 0.35); }
.mp-row.mp-row-drop-target { background: var(--accent-dim); outline: 2px dashed var(--accent); outline-offset: -2px; }
.mp-bar-label {
  font-size: 0.64rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  min-width: 0;
  flex: 1 1 auto;
}
.mp-bar-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 230px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18);
  padding: 12px 14px;
  z-index: 20;
  cursor: default;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text);
}
.mp-bar-popover.open { display: block; }
.mp-pop-title { font-weight: 700; margin-bottom: 6px; }
.mp-pop-meta { color: var(--text-dim); margin-bottom: 3px; }
.mp-pop-assign { margin: 8px 0; }
.mp-pop-assign-label { display: block; font-size: 0.68rem; color: var(--text-dim); margin-bottom: 3px; }
.mp-pop-assign-input { width: 100%; font: inherit; font-size: 0.8rem; padding: 5px 7px; border: 1px solid var(--border); border-radius: 5px; box-sizing: border-box; }
.mp-pop-link { margin-top: 6px; }
.mp-empty { padding: 40px; text-align: center; color: var(--text-dim); }
.mp-avatar-unassigned { background: var(--border) !important; color: var(--text-dim); }
.mp-bar-unassigned { border: 1px dashed rgba(16, 24, 40, 0.4); opacity: 0.85; }

/* A bar standing in for 2+ overlapping same-person tasks, expanding into a
   dropdown list instead of stacking into separate lanes. */
.mp-bar-combined { border-style: double; border-width: 3px; }
.mp-bar-popover-combined { width: 280px; padding: 10px 0; max-height: 280px; overflow-y: auto; }
.mp-bar-popover-combined .mp-pop-title { padding: 0 14px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.mp-pop-combined-list { display: flex; flex-direction: column; }
.mp-pop-combined-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 7px 14px;
}
.mp-pop-combined-item:hover { background: var(--accent-dim); }
.mp-pop-combined-dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; }
.mp-pop-combined-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mp-pop-combined-name { font-weight: 700; font-size: 0.8rem; }
.mp-pop-combined-ctx, .mp-pop-combined-dates { font-size: 0.7rem; color: var(--text-dim); }

/* ---------- team roster modal ---------- */
.team-add-row { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.team-add-row input, .team-add-row select { flex: 1 1 auto; min-width: 0; }
.team-roster-list { max-height: 320px; overflow-y: auto; margin-top: 14px; }
.team-person-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.team-person-row input {
  font: inherit;
  font-size: 0.8rem;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  min-width: 0;
}
.team-person-row input:hover { border-color: var(--border); }
.team-person-row input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.team-person-name { flex: 1 1 auto; font-weight: 600; }
.team-person-dept { flex: 0 0 130px; color: var(--text-dim); }
.team-person-del { flex-shrink: 0; background: none; border: none; cursor: pointer; color: var(--text-dim); font-size: 0.95rem; padding: 2px 6px; }
.team-person-del:hover { color: var(--status-delayed); }
.project-month-seg { font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; }
/* Only shrunk to make room for a day-number row underneath -- a lone month
   row (no day numbers yet, still zoomed out) keeps the full 40px. */
.project-month-seg.compact { height: 22px; border-bottom: 1px solid var(--border); }
.project-day-seg { height: 20px; font-size: 0.62rem; font-weight: 400; }
.project-day-seg.weekend { background: var(--bg); }
.project-day-seg.today { color: var(--accent); font-weight: 700; }
.gantt-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0.55; pointer-events: none; z-index: 1; }
.task-table-no-impact { color: var(--text-dim); font-size: 0.55rem; margin-left: 3px; vertical-align: middle; }
.task-card-title .status-dot { margin-top: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.task-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  flex: 1 1 0%;
  min-width: 0;
}
.task-number { flex-shrink: 0; font-size: 0.8rem; font-weight: 700; color: var(--text-muted, #888); background: var(--surface-2, rgba(127,127,127,0.15)); border-radius: 4px; padding: 1px 6px; }
.no-impact-badge {
  flex-shrink: 0;
  align-self: center;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.task-actions { display: flex; gap: 2px; flex-shrink: 0; }
.task-card-owner-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.avatar-group { display: flex; align-items: center; flex-shrink: 0; }
.avatar-group .avatar { border: 2px solid var(--panel); margin-left: -6px; }
.avatar-group .avatar:first-child { margin-left: 0; }
.task-owner { font-size: 0.8rem; color: var(--text-dim); }
.task-owner.unassigned { font-style: italic; opacity: 0.7; }
.task-card-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.task-card-progress .progress-bar { flex: 1; height: 10px; border-radius: 999px; }
.task-card-progress .progress-bar-fill { border-radius: 999px; background: #00c875; transition: width 0.15s ease; }
.task-card-pct { font-size: 0.78rem; font-weight: 700; color: var(--text-dim); min-width: 34px; text-align: right; }
.task-card-dates { margin-top: 6px; font-size: 0.78rem; color: var(--text-dim); }
.task-card-dates.is-today { font-weight: 700; color: var(--text); }
.task-card-links { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 0.76rem; color: var(--text-dim); }

.task-card-sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.task-sub-item { border-left: 3px solid var(--border); background: var(--bg); border-radius: 6px; padding: 8px 10px; }
.task-sub-item.delay { border-left-color: var(--status-delayed); }
.task-sub-item.note { border-left-color: var(--accent); }
.task-sub-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 2px; }
.task-card-actions { display: flex; gap: 8px; }
.btn-chip {
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.76rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  padding: 4px 12px;
}
.btn-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ---------- delay/note logs ---------- */
.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}
.log-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.log-item-meta { font-size: 0.76rem; color: var(--text-dim); }
.log-item-text { font-size: 0.88rem; }
.log-item.delay { border-left: 3px solid var(--status-delayed); }
.log-item.note { border-left: 3px solid var(--accent); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
}
.modal {
  background: white;
  border-radius: var(--radius);
  padding: 22px 24px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal h3 { margin: 0 0 14px; font-size: 1.05rem; }
.modal-error { color: var(--status-delayed); font-size: 0.82rem; margin: -6px 0 12px; }
.modal-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.modal-field label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.modal-field input, .modal-field select, .modal-field textarea {
  font-family: inherit;
  font-size: 1rem; /* 16px — anything smaller triggers iOS auto-zoom-on-focus */
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 100%;
}
.modal-field textarea { resize: vertical; min-height: 60px; }
.modal-row { display: flex; gap: 10px; }
.modal-row .modal-field { flex: 1; min-width: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.modal-label-hint { font-weight: 400; text-transform: none; color: var(--text-dim); }
.checkbox-list {
  max-height: 140px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.88rem; font-weight: 400; }
.checkbox-group-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--text-dim); margin: 8px 0 2px; }
.checkbox-group-label:first-child { margin-top: 0; }
.checkbox-row input { width: auto; flex-shrink: 0; }
.modal-hint { margin: 4px 0; font-size: 0.82rem; color: var(--text-dim); }

footer { text-align: center; color: var(--text-dim); font-size: 0.78rem; padding: 20px; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .app-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
  .app-header-text { order: 1; flex-basis: 100%; }
  .edit-auth { order: 2; margin-left: 0; }
  .powered-by { order: 3; margin-left: auto; }

  main { margin: 16px auto; padding: 0 12px 40px; }

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

  .detail-header { padding: 14px 16px; }
  .detail-title-row { flex-direction: column; align-items: stretch; }
  .detail-actions { justify-content: flex-start; }
  .action-divider { display: none; }

  .tab-bar { flex-direction: column; align-items: stretch; overflow-x: visible; }
  .tab-bar-tabs { overflow-x: auto; }
  .tab-bar-actions { padding-bottom: 10px; }
  .tab-btn { padding: 10px 12px; white-space: nowrap; }

  .modal { padding: 18px 16px; }
  .modal-row { flex-direction: column; gap: 0; }

  .task-bulk-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 15;
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.1);
  }
  .task-bulk-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .task-bulk-actions button { width: 100%; }

  .status-toast {
    left: 12px;
    right: 12px;
    top: 12px;
    text-align: center;
  }
}
