/* ===== TEAL PMS — GLOBAL STYLES ===== */

:root {
  --teal:       #0A9696;
  --teal-br:    #0DC8C8;
  --teal-dim:   #076f6f;
  --teal-ghost: rgba(10,150,150,.12);
  --teal-glow:  rgba(13,200,200,.18);

  --bg:         #091f1f;
  --bg-card:    #102e2e;
  --bg-sidebar: #061818;
  --bg-hover:   #153838;
  --bg-input:   #0e2828;
  --border:     #1e4444;
  --border-dim: #132e2e;

  --text:       #e6edf3;
  --text-dim:   #8b949e;
  --text-muted: #555e6d;

  --pass:   #3fb950;
  --warn:   #e3b341;
  --fail:   #f85149;
  --info:   #58a6ff;
  --purple: #bc8cff;

  --radius:   8px;
  --radius-lg:12px;
  --sidebar-w:240px;
  --banner-h: 36px;
  --topbar-h: 54px;

  --shadow: 0 4px 24px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
}

[data-theme="light"] {
  --bg:         #e6f4f4;
  --bg-card:    #f4fdfd;
  --bg-sidebar: #0A9696;
  --bg-hover:   #cceaea;
  --bg-input:   #dff4f4;
  --border:     #a8d8d8;
  --border-dim: #c6e8e8;

  --text:       #0a2e2e;
  --text-dim:   #2e6060;
  --text-muted: #5a9090;

  --shadow: 0 4px 24px rgba(10,150,150,.12);
  --shadow-sm: 0 2px 8px rgba(10,150,150,.08);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--teal-br); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }

/* ===== DEMO BANNER ===== */
.demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--banner-h);
  background: linear-gradient(90deg, #7c3900 0%, #b04400 50%, #7c3900 100%);
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  color: #ffe4b0;
  z-index: 1000;
}
.demo-banner span { opacity: .7; font-weight: 400; }

/* ===== TOPBAR ===== */
.topbar {
  position: fixed;
  top: var(--banner-h); left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 900;
}
.topbar .breadcrumb {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
}
.topbar .breadcrumb strong { color: var(--text); }
.topbar .breadcrumb .sep { opacity: .4; }

.topbar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.topbar .search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text-dim);
  font-size: 13px;
  width: 200px;
}
.topbar .search-box input {
  background: none; border: none; outline: none;
  color: var(--text); width: 100%;
}
.topbar .search-box input::placeholder { color: var(--text-muted); }

.btn-icon {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon:hover { background: var(--teal-ghost); color: var(--teal-br); border-color: var(--teal); }

.avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal);
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: var(--banner-h); left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 950;
  overflow-y: auto;
}
[data-theme="light"] .sidebar { background: #0A9696; border-right-color: #076f6f; }

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-br) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; color: #e6edf3; line-height: 1.2; }
.sidebar-logo .logo-sub { font-size: 10px; color: rgba(230,237,243,.45); font-weight: 400; }

.sidebar-section {
  padding: 12px 8px 4px;
}
.sidebar-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(230,237,243,.35);
  padding: 0 8px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: rgba(230,237,243,.65);
  font-size: 13px;
  transition: all .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #e6edf3; text-decoration: none; }
.nav-item.active {
  background: var(--teal-ghost);
  color: var(--teal-br);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--teal-br);
}
.nav-item .nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--fail);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.nav-badge.warn { background: var(--warn); color: #1a1400; }
.nav-badge.info { background: var(--teal); }

.sidebar-project {
  margin: 10px 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.08);
}
.sidebar-project .proj-label { font-size: 10px; color: rgba(230,237,243,.4); text-transform: uppercase; letter-spacing: .8px; }
.sidebar-project .proj-name { font-size: 12px; font-weight: 600; color: #e6edf3; margin-top: 2px; }
.sidebar-project .proj-hull { font-size: 11px; color: var(--teal-br); margin-top: 2px; }

.sidebar-bottom {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ===== MAIN CONTENT ===== */
/* .main is injected by buildNav as a structural shell — keep it neutral */
.main { display: contents; }

.main-content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--banner-h) + var(--topbar-h) + 24px) 24px 40px;
  min-height: 100vh;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: flex-start;
  gap: 16px; margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.page-sub { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.page-header-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-sm { padding: 14px 16px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ===== STAT TILES ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}
.stat-tile::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent, var(--teal));
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-tile.pass { --accent: var(--pass); }
.stat-tile.warn { --accent: var(--warn); }
.stat-tile.fail { --accent: var(--fail); }
.stat-tile.info { --accent: var(--info); }

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ===== BADGES / PILLS ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-open      { background: rgba(88,166,255,.15); color: #58a6ff; }
.badge-progress  { background: rgba(227,179,65,.15);  color: #e3b341; }
.badge-closed    { background: rgba(63,185,80,.15);   color: #3fb950; }
.badge-overdue   { background: rgba(248,81,73,.15);   color: #f85149; }
.badge-upcoming  { background: rgba(139,148,158,.15); color: #8b949e; }
.badge-completed { background: rgba(63,185,80,.15);   color: #3fb950; }
.badge-blocked   { background: rgba(248,81,73,.15);   color: #f85149; }
.badge-review    { background: rgba(188,140,255,.15); color: #bc8cff; }

.priority-critical { color: #f85149; }
.priority-high     { color: #e3b341; }
.priority-medium   { color: #58a6ff; }
.priority-low      { color: #8b949e; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--teal); color: #fff; border-color: var(--teal);
}
.btn-primary:hover { background: var(--teal-dim); }
.btn-outline {
  background: transparent; color: var(--text-dim); border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text); border-color: var(--teal); }
.btn-ghost {
  background: transparent; color: var(--text-dim); border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger {
  background: rgba(248,81,73,.12); color: #f85149; border-color: rgba(248,81,73,.3);
}
.btn-danger:hover { background: rgba(248,81,73,.2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead tr { border-bottom: 1px solid var(--border); }
th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-dim);
  background: var(--bg-card);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--text); }
th.sort-asc::after  { content: ' ↑'; color: var(--teal-br); }
th.sort-desc::after { content: ' ↓'; color: var(--teal-br); }
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-dim);
  font-size: 13px; color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ===== TASK ROW ===== */
.task-row td { vertical-align: middle; }
.task-name-cell {
  display: flex; align-items: center; gap: 8px;
  max-width: 380px;
}
.task-id { font-size: 10px; color: var(--text-muted); font-family: monospace; white-space: nowrap; }
.task-name-text {
  font-size: 13px; font-weight: 500; color: var(--text);
  cursor: pointer;
}
.task-name-text:hover { color: var(--teal-br); }
.task-parent-row td { background: rgba(10,150,150,.05); font-weight: 600; }
.task-parent-row td:first-child { padding-left: 10px; }
.task-child-row td:first-child .task-name-cell { padding-left: 20px; }
.progress-bar-wrap {
  background: var(--bg-hover); border-radius: 4px;
  height: 6px; width: 80px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal-br) 100%);
  transition: width .3s;
}

/* ===== ASSIGNEE AVATARS ===== */
.avatar-stack { display: flex; gap: -4px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  border: 2px solid var(--bg-card);
  flex-shrink: 0; margin-left: -4px;
  cursor: default;
}
.avatar:first-child { margin-left: 0; }

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.filter-select, .filter-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.filter-select:focus, .filter-input:focus { border-color: var(--teal); }
.filter-input { width: 200px; }
.filter-label { font-size: 12px; color: var(--text-dim); }
.active-filters { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 12px;
  background: var(--teal-ghost); border: 1px solid var(--teal);
  color: var(--teal-br); font-size: 11px; font-weight: 500;
  cursor: pointer;
}
.filter-chip:hover { background: var(--teal); color: #fff; }

/* ===== KANBAN BOARD ===== */
.kanban-board {
  display: flex; gap: 12px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 200px);
  align-items: flex-start;
}
.kanban-col {
  flex-shrink: 0; width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 200px);
}
.kanban-col-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kanban-col-title { font-size: 13px; font-weight: 600; }
.kanban-count {
  margin-left: auto;
  background: var(--bg-hover); color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
}
.kanban-cards {
  flex: 1; overflow-y: auto;
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.kanban-cards.drag-over { background: var(--teal-ghost); border-radius: 6px; }
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: all .15s;
  position: relative;
}
.kanban-card:hover {
  border-color: var(--teal);
  box-shadow: 0 2px 12px var(--teal-glow);
}
.kanban-card.dragging { opacity: .4; cursor: grabbing; }
.kanban-card-id { font-size: 10px; color: var(--text-muted); font-family: monospace; margin-bottom: 6px; }
.kanban-card-name { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; margin-bottom: 10px; }
.kanban-card-footer {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.kanban-card-phase {
  font-size: 10px; color: var(--text-dim);
  background: var(--bg-hover); padding: 1px 6px; border-radius: 4px;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kanban-add-btn {
  width: 100%;
  background: transparent; border: 1px dashed var(--border);
  color: var(--text-dim); padding: 8px;
  border-radius: 6px; font-size: 12px;
  transition: all .15s; margin-top: 6px; flex-shrink: 0;
}
.kanban-add-btn:hover { border-color: var(--teal); color: var(--teal-br); background: var(--teal-ghost); }

/* ===== GANTT ===== */
.gantt-wrap { overflow: auto; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); }
.gantt-header-row {
  display: flex; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10; background: var(--bg-card);
}
.gantt-label-col { flex-shrink: 0; width: 280px; border-right: 1px solid var(--border); padding: 8px 12px; font-weight: 600; font-size: 12px; }
.gantt-months-row { display: flex; flex: 1; overflow: hidden; }
.gantt-month { text-align: center; font-size: 11px; color: var(--text-dim); font-weight: 600; border-right: 1px solid var(--border-dim); padding: 6px 0; white-space: nowrap; }
.gantt-row { display: flex; border-bottom: 1px solid var(--border-dim); min-height: 34px; align-items: center; }
.gantt-row:hover { background: var(--bg-hover); }
.gantt-row.phase-row { background: rgba(10,150,150,.06); font-weight: 600; }
.gantt-row-label {
  flex-shrink: 0; width: 280px; border-right: 1px solid var(--border);
  padding: 6px 12px; font-size: 12px; color: var(--text);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden;
}
.gantt-row.phase-row .gantt-row-label { font-weight: 600; color: var(--teal-br); }
.gantt-row-label .task-indent { padding-left: 14px; }
.gantt-chart-area { flex: 1; position: relative; min-height: 34px; }
.gantt-bar {
  position: absolute; height: 16px; top: 50%; transform: translateY(-50%);
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal-br) 100%);
  border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; padding: 0 6px;
  font-size: 10px; color: rgba(255,255,255,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: filter .15s;
}
.gantt-bar:hover { filter: brightness(1.2); }
.gantt-bar.phase-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--teal-dim) 0%, var(--teal) 100%);
  border-radius: 2px;
  opacity: .6;
}
.gantt-bar.closed { background: linear-gradient(90deg, #1e7a2e 0%, #3fb950 100%); }
.gantt-bar.overdue { background: linear-gradient(90deg, #8b1a1a 0%, #f85149 100%); }
.gantt-bar.open { opacity: .65; }
.gantt-today-line {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: #f85149;
  z-index: 5;
}
.gantt-grid-line {
  position: absolute; top: 0; bottom: 0;
  width: 1px; background: var(--border-dim);
}
.gantt-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.gantt-controls select { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 10px; font-size: 12px; }

/* ===== MILESTONES ===== */
.milestone-timeline {
  position: relative;
  padding-left: 28px;
}
.milestone-timeline::before {
  content: '';
  position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.milestone-item {
  position: relative; margin-bottom: 24px;
}
.milestone-dot {
  position: absolute; left: -24px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  transform: rotate(45deg);
  border-radius: 3px;
}
.milestone-dot.completed { background: var(--pass); border-color: var(--pass); }
.milestone-dot.active    { background: var(--teal); border-color: var(--teal-br); }
.milestone-dot.overdue   { background: var(--fail); border-color: var(--fail); }
.milestone-dot.upcoming  { background: var(--bg-card); border-color: var(--text-muted); }

.milestone-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color .15s;
}
.milestone-card:hover { border-color: var(--teal); }
.milestone-title { font-size: 14px; font-weight: 600; color: var(--text); }
.milestone-date  { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.milestone-meta  { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ===== PROGRESS RING ===== */
.progress-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.progress-ring-text { position: absolute; font-size: 14px; font-weight: 700; color: var(--text); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 60px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 740px; max-width: 95vw;
  max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transform: translateY(-12px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 15px; font-weight: 600; flex: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  flex-shrink: 0;
}
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 18px; cursor: pointer; padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Task detail panels */
.task-detail-grid {
  display: grid; grid-template-columns: 1fr 240px; gap: 20px;
}
.task-detail-meta { display: flex; flex-direction: column; gap: 14px; }
.detail-field label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-dim); display: block; margin-bottom: 4px;
}
.detail-field .val { font-size: 13px; color: var(--text); }

.comments-section { margin-top: 20px; }
.comment-item {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.comment-body {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px;
}
.comment-author { font-size: 12px; font-weight: 600; color: var(--teal-br); }
.comment-time { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.comment-text { font-size: 13px; color: var(--text); margin-top: 4px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; font-weight: 500; }
.form-control {
  width: 100%; padding: 8px 12px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .15s;
}
.form-control:focus { border-color: var(--teal); }
.form-control::placeholder { color: var(--text-muted); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }

/* ===== TEAM ===== */
.team-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: border-color .15s;
}
.team-card:hover { border-color: var(--teal); }
.avatar-lg {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.team-info .name { font-size: 14px; font-weight: 600; color: var(--text); }
.team-info .role { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.workload-bar {
  margin-top: 10px; background: var(--bg-hover);
  border-radius: 4px; height: 5px; overflow: hidden;
}
.workload-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal-br) 100%);
}

/* ===== CHARTS AREA ===== */
.chart-wrap { position: relative; height: 220px; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-dim); text-align: center;
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-dim); max-width: 300px; }

/* ===== PHASE PROGRESS ===== */
.phase-progress-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border-dim);
}
.phase-progress-item:last-child { border-bottom: none; }
.phase-name { font-size: 13px; color: var(--text); flex: 1; min-width: 0; }
.phase-name-overflow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-pct { font-size: 12px; color: var(--text-dim); width: 36px; text-align: right; }
.phase-bar-wrap { width: 100px; background: var(--bg-hover); border-radius: 4px; height: 6px; overflow: hidden; flex-shrink: 0; }
.phase-bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal) 0%, var(--teal-br) 100%); border-radius: 4px; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; color: var(--text);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
  min-width: 220px;
  animation: toastIn .2s ease;
  border-left: 3px solid var(--teal);
}
.toast.error { border-left-color: var(--fail); }
.toast.warn  { border-left-color: var(--warn); }
.toast.pass  { border-left-color: var(--pass); }
@keyframes toastIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ===== GUIDE ===== */
.guide-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.guide-toc { position: sticky; top: calc(var(--banner-h) + var(--topbar-h) + 24px); height: fit-content; }
.guide-toc a {
  display: block; font-size: 12px; color: var(--text-dim);
  padding: 5px 8px; border-radius: 5px; margin-bottom: 2px;
}
.guide-toc a:hover, .guide-toc a.active { background: var(--teal-ghost); color: var(--teal-br); text-decoration: none; }
.guide-section { margin-bottom: 32px; scroll-margin-top: calc(var(--banner-h) + var(--topbar-h) + 16px); }
.guide-section h2 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.guide-section h3 { font-size: 14px; font-weight: 600; color: var(--teal-br); margin: 14px 0 6px; }
.guide-section p { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin-bottom: 10px; }
.tip, .warn-box {
  padding: 10px 14px; border-radius: 6px;
  font-size: 13px; margin: 10px 0;
  border-left: 3px solid var(--pass);
  background: rgba(63,185,80,.07);
  color: var(--text);
}
.warn-box { border-left-color: var(--warn); background: rgba(227,179,65,.07); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { left: 0; }
  .task-detail-grid { grid-template-columns: 1fr; }
  .guide-layout { grid-template-columns: 1fr; }
  .guide-toc { display: none; }
}
