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

body {
  font-family: Arial, sans-serif;
  background: #F5F4F0;
  color: #38112A;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #1565C0;
  color: #fff;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header h1 {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.02em;
}
header .subtitle {
  font-size: 13px;
  color: #BBDEFB;
  margin-top: 2px;
}
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: bold;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary   { background: #1976D2; color: #fff; }
.btn-secondary { background: #E3F2FD; color: #1565C0; }
.btn-ghost     { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.btn-danger    { background: #c0392b; color: #fff; }
.btn-sm        { padding: 5px 11px; font-size: 12px; }

/* ── User avatar chip ── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.35);
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: background 0.15s;
}
.user-chip:hover { background: rgba(255,255,255,0.12); }
.user-chip-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-chip-name  { font-size: 12px; color: #fff; }
.user-chip-caret { font-size: 9px; color: rgba(255,255,255,0.6); }
.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0ddd4;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 140px;
  z-index: 999;
  overflow: hidden;
}
.user-menu.open { display: block; }
.user-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; font-size: 13px; color: #333;
  background: none; border: none; cursor: pointer;
}
.user-menu-item:hover { background: #f5f4ef; }

/* ── Toolbar ── */
.toolbar {
  background: #fff;
  border-bottom: 1px solid #DFDDD2;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar label { font-size: 13px; font-weight: bold; color: #38112A; }
.toolbar select, .toolbar input[type=range] {
  font-family: Arial, sans-serif;
  font-size: 13px;
  border: 1px solid #DFDDD2;
  border-radius: 4px;
  padding: 4px 8px;
  color: #38112A;
  background: #fff;
}
.toolbar .sep { width: 1px; height: 24px; background: #DFDDD2; margin: 0 4px; }
.today-label {
  font-size: 12px;
  background: #000;
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: bold;
  margin-left: auto;
  transition: background 0.15s;
}
.today-label:hover { background: #333; }

/* ── Main layout ── */
.main { display: flex; height: calc(100vh - 112px); overflow: hidden; }

/* ── Sidebar ── */
/* Sidebar removed — nav lives in the sticky row-label column */

/* ── Gantt label-column resize handle (fixed overlay) ── */
.gantt-label-resize-handle {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 200;
  background: transparent;
  transition: none;
}
.gantt-label-resize-handle::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.15s;
}
.gantt-label-resize-handle:hover::after,
.gantt-label-resize-handle.dragging::after {
  background: rgba(21, 101, 192, 0.45);
}
.gantt-label-resize-handle.dragging {
  background: rgba(21, 101, 192, 0.08);
}

/* ── Header spacer label (replaces sidebar title area) ── */
.hdr-cap-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 10px 0 14px;
}
.hdr-cap-label {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.85);
}
.hdr-cap-actions { display: flex; gap: 3px; }
.hdr-cap-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.4;
}
.hdr-cap-btn:hover { background: rgba(255,255,255,0.28); }

/* ── Section divider rows (Active / Inactive) ── */
.section-divider-row.active-section-divider {
  position: sticky;
  top: 52px;
  z-index: 9;
}
.section-divider-row {
  display: flex;
  background: #F0EDE6;
  border-bottom: 1px solid #DFDDD2;
  border-top: 1px solid #DFDDD2;
}
.section-label-sticky {
  position: sticky;
  left: 0;
  flex-shrink: 0;
  background: #F0EDE6;
  border-right: 2px solid #DFDDD2;
  padding: 4px 10px 4px 14px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #888;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-label-fill { flex: 1; }

/* ── Frozen footer (New Timeline / Templates) ── */
#gantt-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: #fff;
  border-top: 2px solid #DFDDD2;
  min-height: 48px;
}
/* Legacy class kept for inline rows that reference it; #gantt-footer is the live element */
.add-footer-row {
  display: flex;
  border-top: 1px solid #DFDDD2;
  background: #fff;
}
.add-footer-sticky {
  position: sticky;
  left: 0;
  flex-shrink: 0;
  align-items: center;
  background: #fff;
  border-right: 2px solid #DFDDD2;
  padding: 6px 10px;
  display: flex;
  gap: 6px;
  z-index: 6;
}
.add-footer-fill { flex: 1; }
.add-rl-btn {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid #DFDDD2;
  background: none;
  cursor: pointer;
  color: #1565C0;
  font-weight: bold;
  white-space: nowrap;
}
.add-rl-btn:hover { background: #E3F2FD; border-color: #90CAF9; }

/* ── Row-label (unified nav panel) ── */
.row-label.personal-row { background: #F0F7FF; }
.project-row:hover .row-label.personal-row { background: #E3F2FD; }

/* ── Timeline area ── */
.timeline-area {
  flex: 1;
  overflow-x: scroll;
  overflow-y: auto;
  background: #F5F4F0;
  position: relative;
}

.timeline-wrapper {
  padding: 0;
  display: inline-block;
  min-width: 100%;
}

/* Month header row */
.month-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1565C0;
}
.month-cell {
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  padding: 8px 4px;
  border-right: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}
/* Day tick sub-row */
.day-header {
  display: flex;
  position: sticky;
  top: 33px;
  z-index: 10;
  background: #1976D2;
  border-bottom: 2px solid #90CAF9;
}
.day-cell {
  font-size: 9px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 3px 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.day-cell.monday { color: rgba(255,255,255,0.8); }

/* Project rows */
.project-row {
  display: flex;
  border-bottom: 1px solid #DFDDD2;
  background: #fff;
  min-height: 48px;
  position: relative;
  transition: background 0.12s;
}
.project-row:hover { background: #fdf9f6; }
.project-row:hover .row-label { background: #fdf9f6; }
.project-row.dimmed { opacity: 0.35; }
.project-row.collapsed-row { min-height: 0 !important; }
.collapsed-row .row-label { height: 24px !important; opacity: 0.7; }
.collapsed-summary {
  font-size: 10px; color: #aaa; font-style: italic;
  position: absolute; top: 50%; left: 170px; transform: translateY(-50%);
  pointer-events: none; white-space: nowrap;
}

/* Sticky project label column — now the unified nav panel */
.row-label {
  position: sticky;
  left: 0;
  z-index: 6;
  width: 220px; /* overridden dynamically by JS */
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 8px 7px 14px;
  background: #fff;
  border-right: 2px solid #DFDDD2;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}
.row-label:hover { background: #fdf9f6; }
.row-label-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.row-label-body { flex: 1; overflow: hidden; padding-right: 68px; }
.row-label-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3;
}
.row-label-meta {
  font-size: 10px; color: #aaa; font-weight: normal;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
/* Right side: absolutely positioned so it's always a single horizontal line at top-right */
.row-label-right {
  position: absolute;
  top: 4px;
  right: 6px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1px;
}
.row-label-badge {
  font-size: 10px;
  font-weight: bold;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.row-label-actions { display: contents; } /* legacy — flattened into row-label-right */
.rl-hover-icon { opacity: 0; transition: opacity 0.1s; }
.project-row:hover .rl-hover-icon,
.collapsed-row:hover .rl-hover-icon { opacity: 1; }
.row-label-edit {
  font-size: 11px; color: #888; background: none;
  border: none; cursor: pointer; padding: 2px 3px; flex-shrink: 0;
  border-radius: 3px; line-height: 1;
}
.row-label-edit:hover { background: #F5F4F0; color: #38112A; }
.rl-drag-handle {
  font-size: 13px; color: #ccc; cursor: grab; padding: 1px 2px; line-height: 1;
  flex-shrink: 0;
}
.rl-drag-handle:hover { color: #888; }
.rl-collapse-btn {
  font-size: 10px; color: #aaa; background: none; border: none;
  cursor: pointer; padding: 2px 3px; line-height: 1; border-radius: 3px;
}
.rl-collapse-btn:hover { background: #F5F4F0; color: #38112A; }

/* Sticky header spacer aligns with label column */
.header-spacer {
  position: sticky;
  left: 0;
  flex-shrink: 0;
  width: 220px; /* overridden dynamically by JS */
  border-right: 2px solid rgba(255,255,255,0.2);
  z-index: 11;
  display: flex;
  align-items: center;
}
.header-spacer.month { background: #1565C0; }
.header-spacer.day   { background: #1976D2; }

/* Click-to-add ghost bar */
.row-grid { cursor: crosshair; }
.click-hint {
  position: absolute;
  height: 26px;
  border-radius: 4px;
  border: 2px dashed rgba(56,17,42,0.3);
  background: rgba(255,191,150,0.25);
  pointer-events: none;
  z-index: 1;
  display: none;
  min-width: 4px;
}

/* Grid columns inside row */
.row-grid {
  display: flex;
  flex: 1;
  position: relative;
}
.grid-day-col {
  flex-shrink: 0;
  height: 100%;
  border-right: 1px solid rgba(0,0,0,0.04);
  position: relative;
  pointer-events: none;
}
.grid-day-col.monday { border-right-color: rgba(0,0,0,0.1); }
.grid-day-col.weekend { background: rgba(0,0,0,0.035); }
.grid-day-col.today-col { }

/* Task bars */
.task-bar {
  position: absolute;
  height: 26px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab;
  transition: filter 0.12s;
  z-index: 2;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.task-bar:hover { filter: brightness(1.1); z-index: 5; }
.task-bar.dragging { opacity: 0.75; cursor: grabbing !important; transition: none; box-shadow: 0 4px 16px rgba(0,0,0,0.25); z-index: 50 !important; }
.milestone-marker.dragging { opacity: 0.75; cursor: grabbing !important; transition: none; z-index: 50 !important; }
.drag-date-badge {
  position: fixed; background: #1565C0; color: #E3F2FD;
  font-size: 11px; font-weight: bold; padding: 3px 8px;
  border-radius: 4px; pointer-events: none; z-index: 9999;
  white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.task-bar.dark-text { color: #38112A; }
.task-bar.due-soon { box-shadow: 0 0 0 2px #FF9E33, 0 1px 3px rgba(0,0,0,0.15); }
.task-bar .recur-icon { font-size: 9px; opacity: 0.75; margin-left: 3px; flex-shrink: 0; pointer-events: none; }
.task-bar span { pointer-events: none; }
.resize-handle {
  position: absolute; top: 0; bottom: 0; width: 7px;
  cursor: ew-resize; z-index: 4; border-radius: 4px;
}
.resize-handle.left  { left: 0;  border-radius: 4px 0 0 4px; }
.resize-handle.right { right: 0; border-radius: 0 4px 4px 0; }
.resize-handle:hover { background: rgba(255,255,255,0.35); }
.task-bar.resizing { cursor: ew-resize !important; transition: none; z-index: 50 !important; opacity: 0.85; }

/* Milestone diamond */
.milestone-marker {
  position: absolute;
  width: 14px; height: 14px;
  transform: rotate(45deg);
  cursor: pointer;
  z-index: 3;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.milestone-marker:hover { filter: brightness(1.2); z-index: 5; }
.milestone-marker.due-soon { box-shadow: 0 0 0 2px #FF9E33, 0 1px 4px rgba(0,0,0,0.2); animation: duepulse 2s infinite; }
@keyframes duepulse { 0%,100% { box-shadow: 0 0 0 2px #FF9E33; } 50% { box-shadow: 0 0 0 4px rgba(255,158,51,0.4); } }

/* ── Task status styles ─────────────────────────────────────────────────────── */
.task-bar.status-in-progress  { border-left: 3px solid rgba(255,255,255,0.7); }
.task-bar.status-done          { opacity: 0.55; }
.milestone-marker.status-done  { opacity: 0.55; }
.task-bar.status-blocked       { box-shadow: 0 0 0 2px #e53935 inset; }
.milestone-marker.status-blocked { box-shadow: 0 0 0 2px #e53935; }
.task-bar.status-overdue,
.milestone-marker.status-overdue { box-shadow: 0 0 0 2px #e65100 inset; }


/* Today line */
.today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #000;
  z-index: 7;
  pointer-events: none;
}
.today-line-labeled::before {
  content: 'TODAY';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  background: #000;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  z-index: 21;
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: #fff;
  color: #000;
  border: 1px solid #1565C0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 9999;
  max-width: 300px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: none;
}
.tooltip strong { color: #1565C0; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 14px;
}
.empty-state h3 { color: #38112A; margin-bottom: 8px; font-size: 18px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(56,17,42,0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(56,17,42,0.25);
}
.modal-header {
  background: #1976D2;
  color: #fff;
  padding: 16px 20px;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 15px; }
.modal-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: bold; color: #38112A; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 10px;
  border: 1px solid #DFDDD2; border-radius: 4px;
  font-family: Arial, sans-serif; font-size: 13px; color: #38112A;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #38112A;
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #DFDDD2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.color-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch {
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: #38112A; transform: scale(1.15); }

/* ── Import/Export ── */
#file-import { display: none; }

/* ── Member checkbox picker (task modal) ── */
.member-pick-list { display: flex; flex-direction: column; gap: 5px; }
.member-pick-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border: 1px solid #DFDDD2; border-radius: 4px;
  cursor: pointer; font-size: 13px; transition: background 0.1s;
  user-select: none;
}
.member-pick-item:hover { background: #F5F4F0; }
.member-pick-item.checked { background: #BBDEFB; border-color: #1565C0; font-weight: bold; }
.member-pick-item input[type=checkbox] { accent-color: #38112A; width: 14px; height: 14px; flex-shrink: 0; }

/* ── Admin / member table ── */
.member-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.member-table th {
  text-align: left; font-size: 11px; font-weight: bold; text-transform: uppercase;
  letter-spacing: 0.05em; color: #888; padding: 6px 8px;
  border-bottom: 2px solid #DFDDD2;
}
.member-table td { padding: 8px 8px; border-bottom: 1px solid #DFDDD2; vertical-align: middle; }
.member-table tr:last-child td { border-bottom: none; }
.member-table tr:hover td { background: #F5F4F0; }
.badge-admin {
  font-size: 10px; font-weight: bold; background: #38112A; color: #fff;
  padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-you {
  font-size: 10px; font-weight: bold; background: #BBDEFB; color: #1565C0;
  padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.04em;
}
.member-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #BBDEFB;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: bold; color: #38112A; flex-shrink: 0;
}

/* ── AI Agent Panel ── */
.ai-panel {
  width: 320px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid #DFDDD2;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
  overflow: hidden;
}
.ai-panel.collapsed { width: 0; border-left: none; }
.ai-panel-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: #38112A;
  color: #fff;
  writing-mode: vertical-rl;
  padding: 14px 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.06em;
  border-radius: 6px 0 0 6px;
  z-index: 200;
  transition: opacity 0.15s;
  user-select: none;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
}
.ai-panel-tab:hover { opacity: 0.85; }
.ai-panel-tab.hidden { display: none; }
.ai-panel-header {
  background: #38112A;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.ai-panel-title { font-size: 14px; font-weight: bold; display: flex; align-items: center; gap: 7px; }
.ai-panel-subtitle { font-size: 10px; color: #90CAF9; margin-top: 1px; }
.ai-collapse-btn {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.ai-collapse-btn:hover { color: #fff; background: rgba(255,255,255,0.15); }
.ai-key-setup { padding: 20px 16px; flex: 1; overflow-y: auto; }
.ai-key-setup h4 { font-size: 13px; color: #38112A; margin-bottom: 8px; }
.ai-key-setup p { font-size: 12px; color: #666; line-height: 1.5; margin-bottom: 12px; }
.ai-key-input {
  width: 100%; padding: 8px 10px;
  border: 1px solid #DFDDD2; border-radius: 4px;
  font-size: 11px; font-family: monospace; color: #38112A; margin-bottom: 10px;
}
.ai-chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.ai-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 0;
}
.ai-msg {
  max-width: 92%; padding: 8px 11px;
  font-size: 12px; line-height: 1.5;
}
.ai-msg.user {
  background: #38112A; color: #fff;
  align-self: flex-end; border-radius: 10px 10px 2px 10px;
}
.ai-msg.assistant {
  background: #F5F4F0; color: #38112A;
  align-self: flex-start; border-radius: 10px 10px 10px 2px;
}
.ai-msg.ai-error {
  background: #fde8e8; color: #c0392b;
  align-self: stretch; border-radius: 6px;
  font-size: 11px; text-align: center;
}
.ai-thinking {
  display: flex; gap: 4px; padding: 10px 12px;
  background: #F5F4F0; border-radius: 10px 10px 10px 2px;
  align-self: flex-start;
}
.ai-thinking span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #42A5F5; animation: nagidot 1.2s infinite;
}
.ai-thinking span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes nagidot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(1); }
  30% { opacity: 1; transform: scale(1.3); }
}
.ai-suggestions {
  padding: 6px 12px 4px;
  display: flex; flex-wrap: wrap; gap: 5px;
  flex-shrink: 0; border-top: 1px solid #F5F4F0;
}
.ai-suggestion-chip {
  font-size: 10px; padding: 3px 9px;
  background: #BBDEFB; color: #1565C0;
  border-radius: 10px; cursor: pointer; border: none;
  font-family: Arial, sans-serif; font-weight: bold;
  white-space: nowrap; transition: background 0.12s;
}
.ai-suggestion-chip:hover { background: #1565C0; color: #fff; }
.ai-input-area {
  padding: 10px 12px; border-top: 1px solid #DFDDD2;
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.ai-input {
  flex: 1; padding: 7px 10px;
  border: 1px solid #DFDDD2; border-radius: 6px;
  font-family: Arial, sans-serif; font-size: 12px; color: #38112A;
  resize: none; line-height: 1.4; max-height: 72px; overflow-y: auto;
}
.ai-input:focus { outline: none; border-color: #38112A; }
.ai-send-btn {
  background: #38112A; color: #fff; border: none;
  border-radius: 6px; width: 32px; height: 32px;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; line-height: 1;
}
.ai-send-btn:hover { background: #1565C0; }
.ai-send-btn:disabled { background: #DFDDD2; cursor: default; }
.ai-action-tag {
  display: inline-flex; align-items: center; gap: 3px;
  background: #E3F2FD; color: #1565C0;
  padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: bold; margin-top: 3px;
}

/* ── Export dropdown ── */
.export-dropdown { position: relative; }
.export-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #DFDDD2;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(56,17,42,0.15);
  min-width: 240px;
  z-index: 500;
  overflow: hidden;
}
.export-menu.open { display: block; }
.export-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #38112A;
  transition: background 0.1s;
}
.export-menu-item:hover { background: #F5F4F0; }
.export-menu-item + .export-menu-item { border-top: 1px solid #F0EDE8; }
.export-icon { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }
.export-sub { font-size: 11px; color: #888; margin-top: 1px; font-weight: normal; }

/* ── Help modal ── */
.help-section {
  border-bottom: 1px solid #F0EDE8;
  padding: 14px 20px;
}
.help-section-title {
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #38112A;
  margin-bottom: 10px;
}
.help-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 0;
  font-size: 13px;
  color: #444;
}
.help-row .help-desc {
  flex: 0 0 220px;
  color: #38112A;
  font-weight: bold;
  font-size: 12px;
}
.help-row .help-val {
  flex: 1;
  color: #555;
  font-size: 12px;
}
.help-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 2px 7px;
  background: #F5F4F0;
  border: 1px solid #DFDDD2;
  border-bottom: 2px solid #c8c5bc;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  font-weight: bold;
  color: #38112A;
  flex-shrink: 0;
}

/* ── Task vertical reorder ── */
.lane-insert-line {
  position: fixed;
  height: 2px;
  background: #38112A;
  border-radius: 1px;
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.5);
}

/* ── Row-label drag-to-reorder ── */
.proj-row-dragging .row-label { opacity: 0.4; }
.proj-row-drag-over .row-label { border-top: 2px solid #38112A; }

/* ── Inactive row-label dimming ── */
.project-row.inactive-proj .row-label { opacity: 0.6; }

/* ── Status select ── */
.status-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #DFDDD2;
  font-family: Arial, sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* ── Settings modal sections ── */
.settings-section {
  padding: 12px 0;
  border-bottom: 1px solid #F0EDE8;
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 11px; font-weight: bold;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: #38112A; margin-bottom: 10px;
}
.settings-section-desc {
  font-size: 12px; color: #888; line-height: 1.5; margin-bottom: 10px;
}
.settings-row {
  display: flex; align-items: flex-start; gap: 16px; justify-content: space-between;
}
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 13px; font-weight: bold; color: #38112A; margin-bottom: 3px; }
.settings-row-desc  { font-size: 12px; color: #888; line-height: 1.4; }
.status-select-sm   { width: 100px; flex-shrink: 0; font-size: 12px; padding: 5px 8px; }

/* ── Milestone conflict marker ── */
.milestone-conflict {
  box-shadow: 0 0 0 3px #c0392b, 0 0 0 5px rgba(192,57,43,0.25) !important;
  animation: conflictpulse 2s infinite;
}
@keyframes conflictpulse {
  0%,100% { box-shadow: 0 0 0 3px #c0392b, 0 0 0 5px rgba(192,57,43,0.2); }
  50%      { box-shadow: 0 0 0 3px #c0392b, 0 0 0 8px rgba(192,57,43,0.0); }
}

/* ── Toast notification ── */
#horizon-toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: #1565C0; color: #E3F2FD;
  font-size: 12px; font-weight: bold;
  padding: 8px 18px; border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 9998; pointer-events: none;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
#horizon-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Legend ── */
.legend {
  padding: 6px 28px;
  background: #fff;
  border-top: 1px solid #DFDDD2;
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: #666;
  align-items: center;
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-bar { width: 20px; height: 10px; border-radius: 2px; background: #42A5F5; }
.legend-diamond { width: 10px; height: 10px; background: #38112A; transform: rotate(45deg); border-radius: 1px; }

/* ── Login Screen ─────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #F0F4FF;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(21,101,192,0.12);
  padding: 40px 44px 32px;
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 0;
}
.login-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 32px;
}
.login-logo-mark {
  width: 44px; height: 44px; border-radius: 10px;
  background: #1565C0; color: #fff;
  font-size: 22px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.login-title {
  font-size: 18px; font-weight: bold; color: #1565C0; line-height: 1.2;
}
.login-subtitle {
  font-size: 11px; color: #90CAF9; letter-spacing: 0.04em;
}
.login-desc {
  font-size: 13px; color: #555; margin: 0 0 20px; line-height: 1.5;
}
.login-input {
  width: 100%; box-sizing: border-box;
  padding: 11px 14px; border-radius: 8px;
  border: 1.5px solid #BBDEFB; font-size: 14px;
  outline: none; transition: border-color 0.15s;
  margin-bottom: 12px;
}
.login-input:focus { border-color: #1565C0; }
.login-btn-primary {
  width: 100%; padding: 12px; border-radius: 8px;
  background: #1565C0; color: #fff;
  font-size: 14px; font-weight: bold;
  border: none; cursor: pointer; transition: background 0.15s;
  margin-bottom: 16px;
}
.login-btn-primary:hover { background: #1976D2; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; color: #bbb; font-size: 12px;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: #E3F2FD;
}
.login-btn-google {
  width: 100%; padding: 11px; border-radius: 8px;
  background: #fff; color: #333;
  font-size: 14px; font-weight: 500;
  border: 1.5px solid #E0E0E0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.login-btn-google:hover { background: #F5F5F5; border-color: #BDBDBD; }
.login-sent-icon { font-size: 40px; text-align: center; margin-bottom: 12px; }
.login-sent-title { font-size: 17px; font-weight: bold; color: #1565C0; text-align: center; margin: 0 0 8px; }
.login-sent-desc { font-size: 13px; color: #555; text-align: center; line-height: 1.5; margin: 0 0 20px; }
.login-btn-secondary {
  width: 100%; padding: 10px; border-radius: 8px;
  background: #E3F2FD; color: #1565C0;
  font-size: 13px; font-weight: bold;
  border: none; cursor: pointer; transition: background 0.15s;
}
.login-btn-secondary:hover { background: #BBDEFB; }
.login-footer {
  font-size: 11px; color: #aaa; text-align: center;
  margin: 24px 0 0; line-height: 1.5;
}
.login-footer a { color: #90CAF9; text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* ── Suggestions ── */
.sug-section-title { font-weight:bold;font-size:13px;color:#38112A;margin-bottom:10px; }
.sug-loading { font-size:13px;color:#aaa;padding:8px 0; }
.sug-item {
  display:flex;align-items:flex-start;gap:12px;
  padding:10px 0;border-bottom:1px solid #F0EDE8;
}
.sug-item:last-child { border-bottom:none; }
.sug-vote {
  display:flex;flex-direction:column;align-items:center;gap:2px;
  min-width:36px;flex-shrink:0;
}
.sug-vote-btn {
  width:32px;height:32px;border-radius:6px;border:1.5px solid #DFDDD2;
  background:#fff;cursor:pointer;font-size:14px;
  display:flex;align-items:center;justify-content:center;
  transition:all 0.15s;
}
.sug-vote-btn:hover { border-color:#1565C0;color:#1565C0; }
.sug-vote-btn.voted { background:#1565C0;border-color:#1565C0;color:#fff; }
.sug-vote-count { font-size:11px;font-weight:bold;color:#888; }
.sug-body { flex:1;min-width:0; }
.sug-title { font-size:13px;font-weight:bold;color:#38112A;margin-bottom:3px; }
.sug-desc { font-size:12px;color:#666;line-height:1.4; }
.sug-meta { display:flex;align-items:center;gap:8px;margin-top:6px; }
.sug-status {
  font-size:10px;font-weight:bold;padding:2px 8px;border-radius:10px;
  text-transform:uppercase;letter-spacing:0.04em;
}
.sug-status.considering { background:#E3F2FD;color:#1565C0; }
.sug-status.planned     { background:#E8EAF6;color:#3949AB; }
.sug-status.shipped     { background:#E8F5E9;color:#2E7D32; }
.sug-status.descoped    { background:#EFEBE9;color:#795548; }
.sug-status-select {
  font-size:11px;padding:2px 6px;border:1px solid #DFDDD2;border-radius:4px;
  background:#fff;color:#38112A;cursor:pointer;
}
.sug-toggle-label { display:flex;align-items:center;gap:8px;cursor:pointer;font-size:12px;color:#555; }
.sug-toggle-label input[type=checkbox] { width:14px;height:14px;cursor:pointer;accent-color:#1565C0; }
.sug-empty { font-size:13px;color:#aaa;padding:6px 0; }

/* ── Invite / Team Modal ── */
.invite-member-row, .invite-pending-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #F0EDE8;
}
.invite-member-row:last-child, .invite-pending-row:last-child { border-bottom: none; }
.invite-member-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1565C0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: bold; flex-shrink: 0;
}
.invite-member-info { flex: 1; min-width: 0; }
.invite-member-name { font-size: 13px; font-weight: bold; color: #38112A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite-member-email { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite-role-badge {
  font-size: 10px; font-weight: bold; padding: 2px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0;
}
.invite-role-badge.role-admin   { background: #E8EAF6; color: #3949AB; }
.invite-role-badge.role-member  { background: #E8F5E9; color: #2E7D32; }
.invite-role-badge.role-guest   { background: #FFF3E0; color: #E65100; }
.invite-section-title { font-weight: bold; font-size: 13px; color: #38112A; margin: 16px 0 8px; }
.invite-section-title:first-child { margin-top: 0; }
.invite-success { color: #2e7d32; font-size: 13px; padding: 6px 0; }
.invite-role-desc { font-size: 12px; color: #888; margin: 6px 0 12px; min-height: 16px; }

/* ── Templates ── */
.tpl-from-btn {
  margin-top: 6px;
  background: transparent;
  border: 1.5px dashed #BBDEFB;
  color: #1565C0;
}
.tpl-from-btn:hover { background: #E3F2FD; border-color: #1565C0; }

/* Templates modal layout */
.tpl-modal { width: 900px; max-width: 96vw; }
.tpl-modal-body {
  display: flex; gap: 0;
  height: 540px; overflow: hidden;
}
.tpl-left {
  width: 340px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid #EFEFEC;
}
.tpl-right {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 0;
}

/* Category tabs */
.tpl-cat-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid #EFEFEC;
}
.tpl-cat-tab {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  border: 1.5px solid #DFDDD2; background: #fff; color: #555;
  cursor: pointer; transition: all 0.12s; font-weight: 500;
}
.tpl-cat-tab:hover   { border-color: #1565C0; color: #1565C0; }
.tpl-cat-tab.active  { background: #1565C0; border-color: #1565C0; color: #fff; }

/* Template card list */
.tpl-grid { flex: 1; overflow-y: auto; padding: 10px 8px; }
.tpl-card {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  border: 1.5px solid transparent; margin-bottom: 4px;
  transition: all 0.12s; background: #FAFAF8;
}
.tpl-card:hover   { background: #F0F7FF; border-color: #BBDEFB; }
.tpl-card.selected { background: #E3F2FD; border-color: #1565C0; }
.tpl-card-name { font-size: 13px; font-weight: bold; color: #38112A; margin-bottom: 3px; }
.tpl-card-desc { font-size: 11px; color: #777; line-height: 1.4; margin-bottom: 6px; }
.tpl-card-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: #aaa;
}
.tpl-badge {
  font-size: 9px; font-weight: bold; padding: 1px 6px; border-radius: 8px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.tpl-badge-system    { background: #EDE7F6; color: #6A1B9A; }
.tpl-badge-workspace { background: #E8F5E9; color: #2E7D32; }
.tpl-badge-public    { background: #E3F2FD; color: #1565C0; }
.tpl-empty { font-size: 13px; color: #aaa; padding: 20px 12px; }

/* Template preview pane */
.tpl-preview {
  flex: 1;
}
.tpl-preview-header { margin-bottom: 16px; }
.tpl-preview-title { font-size: 16px; font-weight: bold; color: #38112A; margin-bottom: 4px; }
.tpl-preview-desc  { font-size: 12px; color: #666; line-height: 1.5; }
.tpl-preview-tasks { display: flex; flex-direction: column; gap: 2px; }
.tpl-preview-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 12px;
}
.tpl-preview-row:hover { background: #F5F5F3; }
.tpl-preview-icon {
  font-size: 10px; flex-shrink: 0; width: 16px; text-align: center;
}
.tpl-preview-icon.task { color: #1565C0; font-size: 14px; }
.tpl-preview-icon.ms   { color: #38112A; font-size: 10px; }
.tpl-preview-name   { flex: 1; color: #333; }
.tpl-preview-offset { font-size: 11px; color: #aaa; white-space: nowrap; flex-shrink: 0; }

/* Use template form */
.tpl-use-form {
  margin-top: 20px;
  padding: 16px;
  background: #F0F7FF;
  border: 1px solid #BBDEFB;
  border-radius: 8px;
}

/* ── Notification bell ── */
.notif-bell-wrap { display: inline-flex; align-items: center; }
.notif-bell-btn  { position: relative; padding: 4px 8px !important; }
.notif-badge {
  position: absolute; top: 0; right: 0;
  background: #c0392b; color: #fff;
  font-size: 9px; font-weight: bold;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  transform: translate(4px, -4px);
  pointer-events: none;
}

/* Notification dropdown panel */
.notif-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 340px; background: #fff;
  border: 1px solid #DFDDD2; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000; overflow: hidden;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #EFEFEC;
  font-weight: bold; font-size: 13px; color: #38112A;
}
.notif-mark-all {
  font-size: 11px; color: #1565C0; background: none; border: none;
  cursor: pointer; padding: 0; font-weight: normal;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-bottom: 1px solid #F5F5F3;
  cursor: pointer; transition: background 0.1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover      { background: #F8F8F6; }
.notif-item.unread     { background: #F0F7FF; }
.notif-item.unread:hover { background: #E3F0FF; }
.notif-icon  { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.notif-body  { flex: 1; min-width: 0; }
.notif-text  { font-size: 12px; color: #333; line-height: 1.4; }
.notif-time  { font-size: 11px; color: #aaa; margin-top: 3px; }
.notif-dot   {
  width: 7px; height: 7px; border-radius: 50%;
  background: #1565C0; flex-shrink: 0; margin-top: 5px;
}
.notif-empty { font-size: 13px; color: #aaa; padding: 20px 14px; text-align: center; }

/* ── Task comments ── */
.comment-section-title {
  font-size: 12px; font-weight: bold; color: #38112A;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.comment-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.comment-item {
  display: flex; gap: 8px; align-items: flex-start;
}
.comment-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #1565C0; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: bold;
}
.comment-bubble {
  flex: 1; background: #F5F5F3; border-radius: 0 8px 8px 8px;
  padding: 8px 10px; font-size: 12px; line-height: 1.5;
}
.comment-bubble.is-blocker {
  background: #FFF3F3; border: 1px solid #FFCDD2;
}
.comment-meta {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 3px;
}
.comment-author { font-weight: bold; color: #38112A; font-size: 11px; }
.comment-time   { color: #aaa; font-size: 11px; }
.comment-blocker-flag {
  font-size: 10px; font-weight: bold; color: #c0392b;
  background: #FFCDD2; padding: 1px 6px; border-radius: 8px;
}
.comment-text   { color: #333; white-space: pre-wrap; word-break: break-word; }
.comment-mention { color: #1565C0; font-weight: bold; }
.comment-input  {
  width: 100%; border: 1px solid #DFDDD2; border-radius: 6px;
  padding: 8px 10px; font-size: 13px; color: #38112A;
  resize: vertical; font-family: inherit; box-sizing: border-box;
}
.comment-input:focus { outline: none; border-color: #1565C0; }
.comment-blocker-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #555; cursor: pointer;
}
.comment-blocker-label input { cursor: pointer; accent-color: #c0392b; }
.comment-loading { font-size: 12px; color: #aaa; padding: 4px 0; }

/* @mention dropdown */
.mention-dropdown {
  position: absolute; bottom: calc(100% + 4px); left: 0;
  background: #fff; border: 1px solid #DFDDD2; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 100; min-width: 200px; overflow: hidden;
}
.mention-option {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.mention-option:hover { background: #F0F7FF; }
.mention-option-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: #1565C0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: bold; flex-shrink: 0;
}
