@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg: #f5f0eb;
  --surface: #fffdf9;
  --border: #e0d8cf;
  --text: #2a2118;
  --text-muted: #8a7a6a;
  --candy-1: #ff6b9d;
  --row-h: 44px;
  --row-pad: 4px;
  --sidebar-w: 680px;
  --header-h: 68px;
}

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

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP BAR */
#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 56px;
  background: var(--text);
  color: var(--bg);
  flex-shrink: 0;
  z-index: 100;
  flex-wrap: wrap;
}
#topbar h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: #fff;
  margin-right: 8px;
  cursor: pointer;
  user-select: none;
}
#topbar h1:hover { opacity: 0.85; }
#topbar h1 span { color: var(--candy-1); }

.tb-btn {
  padding: 6px 14px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tb-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }
.tb-btn.primary { background: var(--candy-1); border-color: var(--candy-1); color: #fff; }
.tb-btn.primary:hover { background: #ff4d8a; border-color: #ff4d8a; }

.tb-group { display: flex; align-items: center; gap: 8px; }
.tb-group-right { margin-left: auto; }
.tb-label { font-size: 11px; color: rgba(255,255,255,0.5); }

.tb-select {
  padding: 5px 28px 5px 10px;
  border-radius: 7px;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E") no-repeat right 9px center;
  -webkit-appearance: none;
  appearance: none;
  color: rgba(255,255,255,0.85);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  cursor: pointer;
}
.tb-select:focus { outline: none; border-color: rgba(255,255,255,0.5); }
.tb-select option { background: var(--text); color: #fff; }

#chart-title-display {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* HOME SCREEN */
#home-screen {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 40px 32px 86px;
}
#home-inner {
  max-width: 760px;
  margin: 0 auto;
}
#home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
#home-header h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
}
#home-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
#chart-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chart-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chart-card:hover {
  border-color: var(--candy-1);
  box-shadow: 0 2px 10px rgba(255,107,157,0.1);
}
.chart-card-info {
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.chart-card-name {
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.chart-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-danger {
  color: #e05555 !important;
  border-color: rgba(224,85,85,0.35) !important;
}
.btn-danger:hover {
  background: rgba(224,85,85,0.1) !important;
  border-color: #e05555 !important;
}

/* MAIN LAYOUT */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding-bottom: 46px;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-w);
  min-width: 200px;
  max-width: 70vw;
  display: flex;
  flex-direction: column;
  border-right: 1.5px solid var(--border);
  background: var(--surface);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
#sidebar-header {
  display: flex;
  align-items: center;
  height: 66px; /* must match #th-top(20) + #th-mid(26) + #th-days(20) = 66px */
  padding: 0 6px;
  border-bottom: 1.5px solid var(--border);
  background: #f0ebe3;
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.sh-cell { overflow: hidden; white-space: nowrap; }
.sh-num  { width: 32px; text-align: center; flex-shrink: 0; }
.sh-edit { width: 26px; flex-shrink: 0; }
.sh-name { flex: 1; }
.sh-date { width: 72px; flex-shrink: 0; padding: 0 4px; }
.sh-dur  { width: 72px; flex-shrink: 0; padding: 0 4px; }
.sh-pct  { width: 72px; flex-shrink: 0; padding: 0 4px; }
.sh-res  { width: 90px; flex-shrink: 0; padding: 0 4px; }
#sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar-resize {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
}
#sidebar-resize:hover,
#sidebar-resize.dragging { background: var(--candy-1); opacity: 0.5; }

/* SIDEBAR ROWS */
.task-row-side {
  display: flex;
  align-items: center;
  min-height: var(--row-h);
  padding: var(--row-pad) 6px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  user-select: none;
  position: relative;
  transition: background 0.1s;
}
.task-row-side:hover { background: #faf5ef; }
.task-row-side.dragging-row { opacity: 0.4; }
.task-row-side.drag-over-top { border-top: 2px solid var(--candy-1); }

.side-num {
  width: 32px; text-align: center;
  font-size: 10px; color: var(--text-muted);
  flex-shrink: 0;
}
.side-name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
}
.task-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.color-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.toggle-btn {
  background: none; border: none;
  font-size: 9px; color: var(--text-muted);
  cursor: pointer; padding: 2px 3px;
  flex-shrink: 0; line-height: 1;
}
.toggle-btn:hover { color: var(--text); }

.side-res { width: 90px; flex-shrink: 0; font-size: 11px; color: var(--text-muted); padding: 0 4px; white-space: nowrap; overflow: hidden; cursor: pointer; }
.side-res:hover { color: var(--text); }
.side-cell {
  width: 72px; flex-shrink: 0;
  font-size: 11px; color: var(--text-muted);
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.side-cell:hover { color: var(--text); }
.task-row-side [data-field] { cursor: pointer; align-self: stretch; display: flex; align-items: center; }
.task-row-side [data-field]:empty::after { content: '—'; opacity: 0.2; }
.task-row-side [data-field]:empty:hover::after { opacity: 0.5; }
.task-row-side [data-field]:hover { color: var(--text); }

.del-btn {
  width: 26px; height: 26px;
  border: none; background: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.task-row-side:hover .del-btn { opacity: 1; }
.del-btn:hover { background: var(--border); color: var(--text); }

.dep-warn-badge {
  font-size: 10px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
  cursor: help;
}

.side-name.editing .task-name-text { display: none; }
.side-name input.inline-edit-input {
  flex: 1; min-width: 0;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  border: 1.5px solid var(--candy-1);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.reparent-preview {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--candy-1);
  pointer-events: none;
  z-index: 5;
}
.reparent-preview::before {
  content: attr(data-label);
  position: absolute;
  right: 8px; bottom: 4px;
  font-size: 10px;
  color: var(--candy-1);
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.task-row-add {
  display: flex;
  align-items: center;
  min-height: var(--row-h);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.add-row-num {
  width: 32px; text-align: center;
  font-size: 10px; color: var(--text-muted);
  flex-shrink: 0;
}
.add-row-name { flex: 1; min-width: 0; }
.add-row-input {
  width: 100%;
  background: none; border: none;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  outline: none;
  padding: 2px 6px;
  cursor: text;
}
.add-row-input::placeholder { color: #c4b9ae; }
.add-row-input:focus { color: var(--text); }
.add-row-cell { width: 72px; flex-shrink: 0; }

/* CHART AREA */
#chart-wrap::-webkit-scrollbar { height: 10px; width: 10px; }
#chart-wrap::-webkit-scrollbar-track { background: var(--border); }
#chart-wrap::-webkit-scrollbar-thumb { background: #a09080; border-radius: 5px; }
#chart-wrap::-webkit-scrollbar-thumb:hover { background: #7a6a5a; }
#chart-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}
#chart-container {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  min-width: 100%;
}

#time-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  border-bottom: 1.5px solid var(--border);
}
#th-top  { background: #f0ebe3; border-bottom: 1px solid var(--border); }
#th-mid  { background: #ede8e0; border-bottom: 1px solid var(--border); }
#th-days { background: #ede8e0; }
#th-top, #th-mid, #th-days { display: flex; }

.th-cell {
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
#th-top  { height: 20px; }
#th-mid  { height: 26px; }
#th-days { height: 20px; }
#th-top  .th-cell { color: var(--text-muted); font-weight: 600; font-size: 10px; }
#th-mid  .th-cell { color: var(--text-muted); }
#th-days .th-cell { color: var(--text-muted); font-size: 9px; }
.th-cell.weekend  { background: rgba(0,0,0,0.04); }
.th-cell.today-hd { background: var(--candy-1); color: #fff !important; border-radius: 3px; }

#chart-rows { position: relative; }
.chart-row {
  display: flex;
  position: relative;
  min-height: var(--row-h);
  border-bottom: 1px solid var(--border);
}
.col-cell {
  flex-shrink: 0;
  border-right: 1px solid rgba(224,216,207,0.5);
  height: 100%;
  min-height: var(--row-h);
}
.col-cell.weekend   { background: rgba(0,0,0,0.025); }
.col-cell.today-col { background: rgba(255,107,157,0.06); }

.task-bar {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  cursor: grab;
  font-size: 11px;
  color: rgba(0,0,0,0.7);
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  transition: filter 0.15s;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.task-bar:hover { filter: brightness(1.06); }
.task-bar.dragging { cursor: grabbing; opacity: 0.85; z-index: 10; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.task-bar.level-1 { height: 24px; }
.task-bar.level-2 { height: 18px; border-radius: 4px; }
.task-bar.dep-violated { outline: 2px solid #e05555; outline-offset: 1px; }

.dep-warn-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 20;
  pointer-events: none;
}
.task-bar.dep-violated:hover .dep-warn-tip { display: block; }

.bar-handle-l,
.bar-handle-r {
  width: 7px; height: 100%;
  cursor: ew-resize; flex-shrink: 0;
  opacity: 0; transition: opacity 0.15s;
  background: rgba(0,0,0,0.15);
}
.bar-handle-l { border-radius: 6px 0 0 6px; }
.bar-handle-r { border-radius: 0 6px 6px 0; }
.task-bar:hover .bar-handle-l,
.task-bar:hover .bar-handle-r { opacity: 1; }

.bar-progress {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.18);
  border-radius: 6px 0 0 6px;
  pointer-events: none;
  z-index: 0;
}
.task-bar > * { position: relative; z-index: 1; }

.bar-resource {
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  padding-right: 4px;
  flex-shrink: 0;
}

/* Phase bar */
.phase-bar {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 16px;
  background: var(--phase-color, #888);
  filter: brightness(0.78) saturate(0.8);
  border-radius: 2px;
  cursor: grab;
  display: flex;
  align-items: center;
  z-index: 2;
  overflow: visible;
}
.phase-bar::before,
.phase-bar::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 0; height: 0;
  border-style: solid;
}
.phase-bar::before {
  left: 0;
  border-width: 6px 6px 0 0;
  border-color: inherit;
  border-color: var(--phase-color, #888);
  filter: brightness(0.78) saturate(0.8);
}
.phase-bar::after {
  right: 0;
  border-width: 6px 0 0 6px;
  border-color: inherit;
  border-color: var(--phase-color, #888);
  filter: brightness(0.78) saturate(0.8);
}
.phase-bar.dragging { cursor: grabbing; opacity: 0.85; z-index: 10; }

.phase-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(0,0,0,0.75);
  white-space: nowrap;
  padding: 0 6px;
  pointer-events: none;
}

#dep-svg {
  position: absolute;
  top: 66px; left: 0; /* offset by time-header height so arrows align with chart rows */
  pointer-events: none;
  z-index: 5;
}

#today-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(255,107,157,0.55);
  pointer-events: none;
  z-index: 4;
}

/* MODALS */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(42,33,24,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 32px;
  width: 420px;
  max-width: 96vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.modal-wide { width: 580px; }
.modal-xl   { width: 720px; max-height: 90vh; overflow-y: auto; }
.modal h2 {
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 700;
  margin-bottom: 18px;
}
.modal-hint {
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 16px; line-height: 1.5;
}
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--candy-1); }
.readonly-input { background: #ede8e0 !important; color: var(--text-muted) !important; }

.color-picker-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.color-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform 0.1s;
  flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); }

.modal-actions {
  display: flex; gap: 10px;
  margin-top: 20px; justify-content: flex-end;
}
.btn-cancel {
  padding: 8px 16px; border-radius: 7px;
  border: 1.5px solid var(--border);
  background: transparent;
  font-family: 'DM Mono', monospace; font-size: 12px;
  cursor: pointer; color: var(--text-muted);
}
.btn-cancel:hover { background: var(--bg); }
.btn-confirm {
  padding: 8px 18px; border-radius: 7px;
  border: none; background: var(--candy-1);
  color: #fff;
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.btn-confirm:hover { background: #ff4d8a; }

.dep-task-list { max-height: 220px; overflow-y: auto; }
.dep-task-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
}
.dep-task-item:hover { background: var(--bg); }
.dep-task-item input[type=checkbox] { accent-color: var(--candy-1); width: 14px; height: 14px; }

.code-textarea {
  width: 100%; height: 240px;
  font-family: 'DM Mono', monospace; font-size: 11px;
  border: 1.5px solid var(--border); border-radius: 7px;
  padding: 10px; background: var(--bg); color: var(--text);
  resize: vertical; line-height: 1.5;
}

.print-preview-wrap {
  overflow: auto;
  max-height: 62vh;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: #f0ebe3;
  text-align: center;
  padding: 12px;
  margin-bottom: 4px;
}
.print-preview-wrap img {
  max-width: 100%;
  border-radius: 5px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.13);
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 62px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text); color: #fff;
  padding: 9px 18px; border-radius: 7px;
  font-size: 12px; z-index: 999;
  transition: transform 0.28s, opacity 0.28s;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* PRINT */
@media print {
  #topbar { display: none; }
  body { overflow: visible; height: auto; }
  #main { overflow: visible; }
  #chart-wrap { overflow: visible; }
  #sidebar { overflow: visible; }
}

/* AUTH */
.tb-group-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
#auth-user-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-danger-soft {
  color: #ff9eae !important;
  border-color: rgba(255,107,157,0.3) !important;
}
.btn-danger-soft:hover {
  background: rgba(255,107,157,0.15) !important;
}

/* LOGIN SCREEN */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

#login-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 40px 44px;
  width: 380px;
  max-width: 94vw;
  box-shadow: 0 8px 40px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.login-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--text);
  margin-bottom: 6px;
}
.login-logo span { color: var(--candy-1); }

#login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

#login-msg {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.login-submit {
  width: 100%;
  padding: 10px;
  font-size: 13px;
  margin-top: 8px;
  border-radius: 9px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-ms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  margin-bottom: 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-ms:hover { background: var(--bg-hover); }
.btn-ms:disabled { opacity: 0.6; cursor: default; }

/* Row insert indicator */
.row-insert-indicator {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--candy-1);
  z-index: 20;
  pointer-events: none;
}
.row-insert-btn {
  position: absolute;
  left: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--candy-1);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  z-index: 21;
  transform: translateY(-50%);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  border: none;
  padding: 0;
  display: none;
}
/* insert btn visibility controlled by JS mousemove only */
.row-insert-btn:hover { filter: brightness(1.1); }

/* Drag snap preview label */
.reparent-preview {
  position: absolute;
  right: 30px;
  top: 50%; transform: translateY(-50%);
  background: var(--candy-1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 30;
}
.reparent-preview::before { content: attr(data-label); }

/* BOTTOM BAR */
#bottombar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 46px;
  background: var(--text);
  z-index: 200;
}

.bb-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bb-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ADMIN SCREEN */
#admin-screen {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 40px 32px 86px;
}
#admin-inner {
  max-width: 800px;
  margin: 0 auto;
}
#admin-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}
#admin-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
#admin-invite-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 28px;
}
#admin-invite-box h3 {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#admin-invite-box .form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
#admin-invite-box .form-group {
  margin: 0;
}
.inline-select {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.admin-user-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.admin-user-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.admin-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.admin-role-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.admin-role-badge.admin {
  background: rgba(255,107,157,0.15);
  color: var(--candy-1);
}
.admin-role-badge.user {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
}
.admin-loading,
.admin-error,
.admin-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 24px 0;
  text-align: center;
}
.admin-error { color: #ff9eae; }

/* MILESTONES */
.milestone-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 3;
}

.milestone-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  border-left: 1.5px dashed rgba(255,255,255,0.25);
}

.milestone-diamond {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  pointer-events: all;
  cursor: pointer;
  z-index: 4;
}

.milestone-label {
  position: absolute;
  top: calc(50% - 20px);
  left: 0;
  transform: translate(-50%, -100%);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0,0,0,0.45);
  pointer-events: none;
  line-height: 1.4;
}

/* Phase name bold in sidebar */
.task-row-side[data-phase="1"] .task-name-text {
  font-weight: 700;
  color: var(--text);
}
.task-row-side[data-phase="1"] .side-cell {
  font-weight: 600;
  color: var(--text-muted);
  font-style: italic;
}

/* Phase dot in sidebar */
.phase-dot {
  width: 12px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
  opacity: 0.85;
}

/* Milestone dot in sidebar (replaces colour dot) */
.milestone-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  transform: rotate(45deg);
  flex-shrink: 0;
  display: inline-block;
}

/* Milestone checkbox in task modal */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--candy-1);
  cursor: pointer;
}

/* Edit icon image inside pencil button */
.del-btn img {
  width: 14px;
  height: 14px;
  opacity: 0.45;
  display: block;
  transition: opacity 0.15s;
}
.task-row-side:hover .del-btn img { opacity: 0.75; }
.del-btn:hover img { opacity: 1 !important; }

/* Row density */
body.rows-compact { --row-h: 32px; --row-pad: 1px; }
body.rows-loose   { --row-h: 56px; --row-pad: 10px; }

/* Editable chart title */
#chart-title-display {
  cursor: pointer;
}
#chart-title-display:hover {
  opacity: 0.75;
}
#chart-title-edit {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(255,255,255,0.5);
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  outline: none;
  min-width: 80px;
  max-width: 300px;
  padding: 0 2px;
}
