/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface2:  #21262d;
  --surface3:  #30363d;
  --border:    #30363d;
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --accent:    #58a6ff;
  --green:     #3fb950;
  --yellow:    #d29922;
  --red:       #f85149;
  --purple:    #bc8cff;
  --cyan:      #39c5cf;
  --radius:    8px;
  --transition:0.18s ease;

  /* Category palette */
  --cat-design:      #58a6ff;
  --cat-construction:#d29922;
  --cat-power:       #f85149;
  --cat-market:      #3fb950;
  --cat-finance:     #bc8cff;
  --cat-ops:         #39c5cf;
}

/* ── Light mode overrides ───────────────────────────────────────────────────── */
html.light-mode {
  --bg:        #f6f8fa;
  --surface:   #ffffff;
  --surface2:  #f6f8fa;
  --surface3:  #eaeef2;
  --border:    #d0d7de;
  --text:      #1f2328;
  --text-muted:#636c76;
  --accent:    #0969da;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ── Top Nav ──────────────────────────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0;
  height: 52px;
  padding: 0 20px;
}
.brand {
  font-size: 1rem; font-weight: 700; color: var(--text);
  letter-spacing: .04em;
  display: flex; align-items: center; gap: 10px;
  margin-right: 32px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.nav-tabs { display: flex; gap: 4px; flex: 1; }
.nav-tab {
  padding: 6px 16px; border-radius: var(--radius);
  background: none; border: none; color: var(--text-muted);
  font-size: .9rem; font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}
.nav-tab:hover  { color: var(--text); background: var(--surface2); }
.nav-tab.active { color: var(--accent); background: var(--surface2); }

.nav-user {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
}
.nav-user-name {
  font-size: .85rem; color: var(--text-muted);
  padding-right: 4px;
}
.theme-toggle {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  padding: 4px 9px; font-size: .85rem; cursor: pointer;
  transition: var(--transition); line-height: 1;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }

/* Logo: navy-on-white PNG, inverted to white in dark mode */
.nav-logo { height: 24px; width: auto; display: block; }
html:not(.light-mode) .nav-logo { filter: brightness(0) invert(1); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.view { display: none; padding: 20px; }
.view.active { display: block; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title { font-size: .95rem; font-weight: 600; }
.section-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: .05em; text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.badge-blue   { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-green  { background: rgba(63,185,80,.15);  color: var(--green);  }
.badge-yellow { background: rgba(210,153,34,.15); color: var(--yellow); }
.badge-red    { background: rgba(248,81,73,.15);  color: var(--red);    }
.badge-purple { background: rgba(188,140,255,.15);color: var(--purple); }
.badge-gray   { background: var(--surface2);       color: var(--text-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; border: none;
  font-size: .875rem; font-weight: 500;
  transition: var(--transition);
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { opacity: .88; }
.btn-ghost {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }

/* ══════════════════════════════════════════════════════════════════════════════
   NEWS
══════════════════════════════════════════════════════════════════════════════ */
.news-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.news-toolbar input {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 7px 12px; width: 260px;
}
.news-toolbar input:focus { outline: none; border-color: var(--accent); }
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.news-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  transition: var(--transition);
  display: flex; flex-direction: column; gap: 8px;
}
.news-card:hover { border-color: var(--accent); }
.news-card-top {
  display: flex; align-items: center; justify-content: space-between;
}
.news-source { font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.news-date   { font-size: .72rem; color: var(--text-muted); }
.news-title  { font-size: .9rem; font-weight: 600; line-height: 1.4; color: var(--text); }
.news-title a { color: var(--text); }
.news-title a:hover { color: var(--accent); }
.news-summary { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.news-empty { color: var(--text-muted); padding: 40px 0; text-align: center; }
.spinner {
  border: 2px solid var(--surface3); border-top-color: var(--accent);
  border-radius: 50%; width: 20px; height: 20px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════════════
   GANTT
══════════════════════════════════════════════════════════════════════════════ */
.gantt-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.gantt-project-tabs {
  display: flex; gap: 4px;
}
.gantt-project-tab {
  padding: 3px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: none; color: var(--text-muted); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); letter-spacing: .03em;
}
.gantt-project-tab:hover { border-color: var(--text-muted); color: var(--text); }
.gantt-project-tab.active { background: var(--accent); border-color: var(--accent); color: #000; }
.gantt-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; }

.gantt-outer {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.gantt-wrap {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 65vh;
}
.gantt-labels {
  overflow: hidden; /* vertical scroll synced by JS */
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.gantt-chart-area {
  overflow: auto; /* scroll both axes */
  position: relative;
}

/* Header row in both panels */
.gantt-header {
  height: 52px; display: flex; align-items: flex-end;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; padding: 0 12px;
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
  letter-spacing: .04em; text-transform: uppercase;
}

/* Left label rows */
.gantt-label-row {
  height: 36px; display: flex; align-items: center;
  padding: 0 12px; gap: 6px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.gantt-label-row:hover  { background: var(--surface2); cursor: pointer; }
.gantt-label-cat {
  height: 28px; display: flex; align-items: center;
  padding: 0 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.label-sub  { font-size: .72rem; color: var(--text-muted); flex-shrink: 0; }
.label-task { font-size: .82rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status dot in label */
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.completed   { background: var(--green);  }
.status-dot.in-progress { background: var(--accent); }
.status-dot.planned     { background: var(--surface3); border: 1px solid var(--text-muted); }
.status-dot.on-hold     { background: var(--yellow); }

/* Timeline header inside chart area */
.gantt-timeline-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex; height: 52px;
}
.gantt-year-cell {
  position: absolute; top: 0; height: 24px;
  display: flex; align-items: center; padding: 0 6px;
  font-size: .72rem; font-weight: 700; color: var(--text-muted);
  border-right: 1px solid var(--border);
}
.gantt-month-cell {
  flex-shrink: 0; height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 6px;
  font-size: .72rem; color: var(--text-muted);
  border-right: 1px solid rgba(48,54,61,.5);
}
.gantt-month-cell.year-start { border-left: 1px solid var(--border); }

/* Bar rows */
.gantt-bar-row {
  height: 36px; position: relative;
  border-bottom: 1px solid var(--border);
}
.gantt-bar-row.cat-row {
  height: 28px; background: var(--surface2);
}
.gantt-bar {
  position: absolute; top: 7px; height: 22px;
  border-radius: 4px; display: flex; align-items: center;
  padding: 0 8px; cursor: pointer;
  transition: filter var(--transition);
  overflow: hidden;
}
.gantt-bar:hover { filter: brightness(1.2); }
.gantt-bar.completed   { opacity: .55; }
.gantt-bar.in-progress { opacity: 1;   }
.gantt-bar.planned     { opacity: .75; }
.gantt-bar-label {
  font-size: .72rem; font-weight: 600; color: #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-today {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: var(--red); opacity: .7; pointer-events: none;
  z-index: 5;
}
.gantt-today::before {
  content: 'Today';
  position: absolute; top: 4px; left: 4px;
  font-size: .65rem; color: var(--red); white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   TODOS
══════════════════════════════════════════════════════════════════════════════ */
.todos-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.todos-toolbar select, .todos-toolbar input {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 6px 10px; font-size: .875rem;
}
.todo-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}
.todo-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.todo-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.todo-col-title { font-size: .82rem; font-weight: 700; letter-spacing: .04em; }
.todo-count { font-size: .75rem; color: var(--text-muted); }

.todo-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
  border-left: 3px solid transparent;
  transition: var(--transition); cursor: pointer;
}
.todo-card:hover { border-color: var(--accent); }
.todo-card.priority-high   { border-left-color: var(--red);    }
.todo-card.priority-medium { border-left-color: var(--yellow); }
.todo-card.priority-low    { border-left-color: var(--surface3); }
.todo-card-title { font-size: .875rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.todo-card-meta  {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .75rem; color: var(--text-muted);
}
.todo-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #000; font-size: .65rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.todo-due { color: var(--text-muted); }
.todo-due.overdue { color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65); align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: min(560px, 95vw);
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* Form elements in modal */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 8px 10px; font-size: .875rem;
  transition: var(--transition); width: 100%;
}
.form-control:focus { outline: none; border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-control[readonly] { opacity: .55; }

/* History list in gantt modal */
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  background: var(--surface2); border-radius: 5px;
  padding: 8px 10px; font-size: .78rem; color: var(--text-muted);
}
.history-item strong { color: var(--text); }

/* ══════════════════════════════════════════════════════════════════════════════
   OVERVIEW
══════════════════════════════════════════════════════════════════════════════ */
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card-link { cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.stat-card-link:hover { border-color: var(--accent); background: var(--surface2); }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .75rem; color: var(--text-muted); }

.overview-bottom {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   OVERVIEW HEADER (gauge + stats side by side)
══════════════════════════════════════════════════════════════════════════════ */
.overview-header {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: center;
}
.gauge-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.gauge-svg { width: 100%; height: auto; display: block; }
.gauge-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted); margin-top: 2px;
}
.gauge-breakdown {
  font-size: .7rem; color: var(--text-muted); text-align: center; line-height: 1.7;
}
#gauge-needle { stroke: var(--text); }
#gauge-pivot  { fill: var(--text); }
.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CRM
══════════════════════════════════════════════════════════════════════════════ */
.crm-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  height: calc(100vh - 52px - 40px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.crm-list-panel {
  border-right: 1px solid var(--border);
  overflow-y: auto; display: flex; flex-direction: column;
}
.crm-panel-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface2); flex-shrink: 0;
}
.crm-company-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
  display: flex; flex-direction: column; gap: 4px;
}
.crm-company-item:hover  { background: var(--surface2); }
.crm-company-item.active { background: var(--surface2); border-left: 3px solid var(--accent); }
.crm-company-name { font-size: .875rem; font-weight: 600; }
.crm-company-meta { font-size: .72rem; color: var(--text-muted); }

.crm-detail-panel { overflow-y: auto; padding: 20px 24px; }
.crm-detail-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); font-size: .85rem;
}

.crm-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 12px;
}
.crm-detail-title { font-size: 1.3rem; font-weight: 700; }
.crm-detail-sub   { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

.crm-fields-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.crm-field { display: flex; flex-direction: column; gap: 3px; }
.crm-field-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.crm-field-value { font-size: .875rem; }

.crm-contacts-wrap {
  margin-bottom: 20px;
}
.crm-contact-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px 3px 5px;
  font-size: .78rem; margin: 3px;
  cursor: pointer; transition: border-color var(--transition);
}
.crm-contact-chip:hover { border-color: var(--accent); }
.crm-contact-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #000; font-size: .62rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.crm-log-section { margin-top: 4px; }
.crm-log-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.crm-log-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 10px 14px; margin-bottom: 8px;
  cursor: pointer; transition: border-color var(--transition);
}
.crm-log-item:hover { border-color: var(--accent); background: var(--surface3); }
.crm-log-item-date { font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.crm-log-item-text { font-size: .85rem; line-height: 1.5; white-space: pre-wrap; }

.crm-status-badge {
  font-size: .72rem; padding: 3px 9px; border-radius: 20px; font-weight: 700;
}
.crm-status-active   { background: rgba(63,185,80,.15); color: var(--green); }
.crm-status-inactive { background: var(--surface3); color: var(--text-muted); }
.crm-status-paused   { background: rgba(210,153,34,.15); color: var(--yellow); }

/* ══════════════════════════════════════════════════════════════════════════════
   WEEKLY UPDATES
══════════════════════════════════════════════════════════════════════════════ */
.upd-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  height: calc(100vh - 52px - 40px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.upd-list-panel {
  border-right: 1px solid var(--border);
  overflow-y: auto; display: flex; flex-direction: column;
}
.upd-detail-panel { overflow-y: auto; padding: 24px 28px; }

.upd-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.upd-detail-title { font-size: 1.2rem; font-weight: 700; }

.upd-cat-block { margin-bottom: 24px; }
.upd-cat-title {
  font-size: .75rem; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px; margin-bottom: 14px;
}
.upd-section-block { margin-bottom: 16px; padding-left: 4px; }
.upd-section-title {
  font-size: .85rem; font-weight: 700; color: var(--text);
  margin-bottom: 8px;
}
.upd-entry {
  font-size: .875rem; line-height: 1.6;
  padding: 8px 12px; border-radius: 6px;
  margin-bottom: 6px; background: var(--surface2);
  border-left: 3px solid var(--border);
}
.upd-entry.clickable { cursor: pointer; transition: var(--transition); }
.upd-entry.clickable:hover { border-left-color: var(--accent); background: var(--surface3); }
.upd-subsection { font-weight: 700; color: var(--text); }
.upd-content { color: var(--text); }
.upd-by { font-size: .72rem; color: var(--text-muted); margin-left: 8px; }

.upd-status-badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}
.upd-published { background: rgba(63,185,80,.15); color: var(--green); }
.upd-draft     { background: var(--surface3); color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════════════════════════
   DC MEETING
══════════════════════════════════════════════════════════════════════════════ */
.dcm-project-row {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 6px;
  background: var(--surface2); border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  cursor: pointer; transition: var(--transition);
}
.dcm-project-row:hover        { border-left-color: var(--accent); background: var(--surface3); }
.dcm-project-row.has-entry    { border-left-color: var(--accent); }
.dcm-project-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.dcm-project-name  { font-size: .875rem; font-weight: 700; }
.dcm-mw-badge {
  font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 20px;
  background: rgba(88,166,255,.15); color: var(--accent);
}
.dcm-location { font-size: .72rem; color: var(--text-muted); }
.dcm-no-entry { font-size: .72rem; color: var(--text-muted); font-style: italic; margin-left: auto; }
.dcm-entry-preview {
  font-size: .8rem; color: var(--text-muted); line-height: 1.5;
  white-space: pre-wrap; max-height: 72px; overflow: hidden;
}

/* ── Language ─────────────────────────────────────────────────────────────── */
.lang-pill {
  display: flex; background: var(--bg);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 2px; gap: 2px;
}
.lang-opt {
  border: none; background: transparent; color: var(--text-muted);
  border-radius: 18px; padding: 4px 10px;
  font-size: .75rem; cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.lang-opt.active { background: var(--accent); color: #000; font-weight: 600; }
.lang-opt:not(.active):hover { color: var(--text); }

.translate-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 14px; padding: 3px 10px;
  font-size: .75rem; color: var(--text-muted); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.translate-pill:hover { border-color: var(--accent); color: var(--accent); }
.translate-pill:disabled { opacity: .5; cursor: default; }

/* ── AI Search ────────────────────────────────────────────────────────────── */
.ai-search-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(99,179,237,.15); border: 1px solid rgba(99,179,237,.35);
  color: var(--accent); border-radius: 6px;
  padding: 4px 10px; font-size: .8rem; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ai-search-btn:hover { background: rgba(99,179,237,.28); border-color: var(--accent); }

.ai-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000;
}
.ai-overlay.open { display: block; }

.ai-panel {
  position: fixed; top: 0; right: -440px; width: 420px; height: 100vh;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 1001;
  transition: right .28s cubic-bezier(.4,0,.2,1);
  box-shadow: -4px 0 24px rgba(0,0,0,.35);
}
.ai-panel.open { right: 0; }

.ai-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .95rem; color: var(--text);
  background: var(--bg);
}

.ai-panel-body {
  flex: 1; overflow-y: auto; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 14px;
}

.ai-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: .76rem;
  color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.ai-chip:hover { border-color: var(--accent); color: var(--accent); }

.ai-response-area {
  flex: 1; min-height: 200px;
}
.ai-placeholder { color: var(--text-muted); font-size: .85rem; margin: 0; }

.ai-answer {
  font-size: .85rem; line-height: 1.65; color: var(--text);
}
.ai-answer h3 { font-size: .9rem; margin: 12px 0 4px; color: var(--accent); }
.ai-answer h4 { font-size: .85rem; margin: 10px 0 3px; color: var(--text); }
.ai-answer ul { margin: 4px 0; padding-left: 18px; }
.ai-answer li { margin: 3px 0; }
.ai-answer p { margin: 6px 0; }
.ai-answer strong { color: var(--text); }
.ai-answer code {
  background: var(--bg); padding: 1px 5px; border-radius: 3px;
  font-size: .8rem; font-family: monospace;
}

.ai-error { color: #f87171; font-size: .85rem; margin: 0; }

.ai-loading { display: flex; gap: 6px; align-items: center; padding: 8px 0; }
.ai-loading span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: ai-bounce .9s infinite ease-in-out;
}
.ai-loading span:nth-child(2) { animation-delay: .15s; }
.ai-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .4; }
  40%           { transform: scale(1);  opacity: 1; }
}

.ai-panel-footer {
  padding: 14px 18px; border-top: 1px solid var(--border); background: var(--bg);
}
.ai-input-row { display: flex; gap: 8px; }
.ai-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; color: var(--text); font-size: .85rem;
  outline: none; transition: border-color .15s;
}
.ai-input:focus { border-color: var(--accent); }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.w-full { width: 100%; }
