/* ================================================================
   wizcast.css  —  WizCast self-contained stylesheet
   Incorporates all design tokens, shell chrome, and page-specific
   styles.  Does NOT depend on blank.css.  auth.js is still loaded
   separately for Cognito wiring.
   ================================================================ */


/* ════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ════════════════════════════════════════════════════════════════ */
:root {
  /* ── Brand colours ──────────────────────────────────────────── */
  --primary-blue:   #1a237e;
  --secondary-blue: #3949ab;
  --light-blue:     #e8eaf6;
  --dark-blue:      #0d1554;
  --dark-grey:      #1f2937;
  --medium-grey:    #6b7280;
  --light-grey:     #f3f4f6;
  --text-grey:      #9ca3af;
  --border-color:   #e5e7eb;
  --success-green:  #10b981;
  --accent-color:   #00bcd4;
  --danger-red:     #ef4444;

  /* ── Left toolbar ───────────────────────────────────────────── */
  --rail-width:      56px;
  --panel-width:     268px;
  --rail-bg:         var(--dark-blue);
  --rail-icon-color: rgba(255,255,255,0.52);
  --rail-icon-hover: rgba(255,255,255,0.95);
  --rail-active-bg:  rgba(255,255,255,0.12);

  /* ── Shadows ────────────────────────────────────────────────── */
  --input-shadow:       0 2px 12px rgba(0,0,0,0.07), 0 0 0 1px var(--border-color);
  --input-shadow-focus: 0 4px 20px rgba(26,35,126,0.12), 0 0 0 2px var(--secondary-blue);

  /* ── Transitions ────────────────────────────────────────────── */
  --trans-fast:  0.15s ease;
  --trans-panel: 0.22s cubic-bezier(0.4,0,0.2,1);
  --trans-split: 0.3s cubic-bezier(0.4,0,0.2,1);

  /* ── Layout ─────────────────────────────────────────────────── */
  --content-col-max: 1440px;
  --section-h-pad:   clamp(1.25rem, 3vw, 2.5rem);

  /* ── Typography ─────────────────────────────────────────────── */
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
}


/* ════════════════════════════════════════════════════════════════
   2. RESET
   ════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--dark-grey);
  background: #f4f5f8;
  -webkit-font-smoothing: antialiased;
}


/* ════════════════════════════════════════════════════════════════
   3. LOGIN SCREEN
   ════════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--dark-blue) 0%, var(--secondary-blue) 100%);
  z-index: 9000;
}
.login-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 1.25rem; padding: 3rem 2.5rem;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  min-width: 280px; text-align: center;
}
.login-logo-wrap  { height: 56px; display: flex; align-items: center; justify-content: center; }
.login-logo-img   { height: 56px; width: auto; filter: brightness(0) invert(1); }
.login-logo-text  { font-size: 2rem; font-weight: 700; color: white; }
.login-brand-name { font-size: 1.3rem; font-weight: 700; color: rgba(255,255,255,0.9); }
.brand-ai         { color: var(--accent-color); }
.login-spinner-wrap { display: flex; align-items: center; justify-content: center; }
.wiz-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-status { font-size: 0.875rem; color: rgba(255,255,255,0.65); }


/* ════════════════════════════════════════════════════════════════
   4. APP SHELL
   ════════════════════════════════════════════════════════════════ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }


/* ════════════════════════════════════════════════════════════════
   5. LEFT TOOLBAR — icon rail + slide-out panel
   ════════════════════════════════════════════════════════════════ */
.left-toolbar {
  display: flex; flex-direction: row;
  flex-shrink: 0; height: 100vh;
  position: relative; z-index: 200;
}

/* ── Icon Rail ──────────────────────────────────────────────── */
.icon-rail {
  display: flex; flex-direction: column; justify-content: space-between;
  width: var(--rail-width); flex-shrink: 0; height: 100%;
  background: var(--rail-bg);
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 0.5rem 0; overflow: hidden;
}
.rail-section { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rail-top     { padding-top: 0.25rem; }
.rail-bottom  { padding-bottom: 0.5rem; }

.rail-brand-link {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.75rem; border-radius: 9px; text-decoration: none;
  transition: background var(--trans-fast), box-shadow var(--trans-fast);
}
.rail-brand-link:hover {
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}
.rail-brand-img {
  width: 30px; height: 30px; object-fit: contain;
  filter: brightness(0) invert(1);
}
.rail-brand-fallback {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; font-weight: 800; color: white;
}
.rail-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none; background: transparent;
  cursor: pointer; border-radius: 10px;
  font-size: 1.125rem; color: var(--rail-icon-color); text-decoration: none;
  transition: background var(--trans-fast), color var(--trans-fast);
}
.rail-btn:hover  { background: var(--rail-active-bg); color: var(--rail-icon-hover); }
.rail-btn.active { background: var(--rail-active-bg); color: white; }
.rail-btn.rail-active { background: var(--rail-active-bg); color: white; }
.rail-user-btn { padding: 0; }
.user-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  font-size: 0.65rem; font-weight: 700; color: white; letter-spacing: 0.5px;
  pointer-events: none;
}

/* ── Slide-out panel (Versions in detail mode, History otherwise) */
.history-panel {
  width: 0; overflow: hidden;
  background: white; border-right: 1px solid var(--border-color);
  transition: width var(--trans-panel);
  display: flex; flex-direction: column;
}
.left-toolbar.panel-open .history-panel { width: var(--panel-width); }
.hp-inner {
  width: var(--panel-width); height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
.hp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.125rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.hp-title { font-size: 0.9375rem; font-weight: 700; color: var(--dark-grey); margin: 0; }
.hp-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; background: transparent;
  cursor: pointer; border-radius: 7px; color: var(--medium-grey); font-size: 0.75rem;
  transition: background var(--trans-fast), color var(--trans-fast);
}
.hp-close-btn:hover { background: var(--light-grey); color: var(--dark-grey); }
.hp-list-wrap {
  flex: 1; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.hp-list-wrap::-webkit-scrollbar       { width: 3px; }
.hp-list-wrap::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.hp-list { padding: 0.5rem 0; }
.hp-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 2rem 1rem; text-align: center;
  color: var(--text-grey); font-size: 0.8125rem;
}
.hp-empty-icon { font-size: 1.5rem; opacity: 0.45; }
.hp-footer { flex-shrink: 0; padding: 0.75rem; border-top: 1px solid var(--border-color); }


/* ════════════════════════════════════════════════════════════════
   6. USER POPOVER
   ════════════════════════════════════════════════════════════════ */
.user-popover {
  position: fixed;
  bottom: 4.5rem; left: calc(var(--rail-width) + 0.75rem);
  width: 230px; background: white;
  border: 1px solid var(--border-color); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  z-index: 1000; overflow: hidden;
  animation: popoverIn 0.18s ease both;
}
@keyframes popoverIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.up-avatar-row { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; }
.up-avatar {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--dark-grey); color: white;
  border-radius: 50%; font-size: 0.75rem; font-weight: 700;
}
.up-name  { font-size: 0.875rem; font-weight: 700; color: var(--dark-grey); }
.up-email { font-size: 0.7rem; color: var(--medium-grey); margin-top: 1px; }
.up-divider { height: 1px; background: var(--border-color); }
.up-action {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.75rem 1rem; border: none; background: transparent;
  font-family: var(--font-body); font-size: 0.85rem; color: var(--dark-grey);
  cursor: pointer; transition: background var(--trans-fast), color var(--trans-fast);
}
.up-action:hover { background: var(--light-grey); color: var(--primary-blue); }


/* ════════════════════════════════════════════════════════════════
   7. SHARED BUTTONS  —  .wiz-btn variants
   ════════════════════════════════════════════════════════════════ */
.wiz-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.25rem; border-radius: 10px; border: 1.5px solid transparent;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 600;
  cursor: pointer; transition: all var(--trans-fast); white-space: nowrap;
}
.wiz-btn-primary { background: var(--primary-blue); color: white; border-color: var(--primary-blue); }
.wiz-btn-primary:hover { background: var(--dark-blue); box-shadow: 0 4px 12px rgba(26,35,126,0.25); }
.wiz-btn-ghost   { background: transparent; color: var(--dark-grey); border-color: var(--border-color); }
.wiz-btn-ghost:hover { background: var(--light-grey); }
.wiz-btn-danger  { background: var(--danger-red); color: white; border-color: var(--danger-red); }
.wiz-btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.wiz-btn-danger-ghost { background: transparent; color: var(--danger-red); border-color: transparent; padding: 0.5rem 0.875rem; }
.wiz-btn-danger-ghost:hover { background: #fef2f2; border-color: #fecaca; }


/* ════════════════════════════════════════════════════════════════
   8. WIZCAST MAIN LAYOUT
   ════════════════════════════════════════════════════════════════ */
.wc-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #f4f5f8;
}

.wc-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}





/* ════════════════════════════════════════════════════════════════
   2. LIST VIEW — TOOLBAR
   ════════════════════════════════════════════════════════════════ */
.bm-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem var(--section-h-pad) 0;
  flex-shrink: 0;
  width: 100%;
  flex-wrap: wrap;
}

/* Search */
.bm-search-wrap { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.bm-search-icon {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 0.82rem; color: var(--text-grey); pointer-events: none;
}
.bm-search-input {
  width: 100%; padding: 0.5rem 2rem 0.5rem 2.1rem;
  border: 1.5px solid var(--border-color); border-radius: 10px;
  font-family: var(--font-body); font-size: 0.82rem; color: var(--dark-grey); background: white;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}
.bm-search-input::placeholder { color: var(--text-grey); }
.bm-search-input:focus { outline: none; border-color: var(--secondary-blue); box-shadow: 0 0 0 3px rgba(57,73,171,.1); }
.bm-search-clear {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  font-size: 0.78rem; color: var(--text-grey); padding: 2px;
  transition: color var(--trans-fast);
}
.bm-search-clear:hover { color: var(--dark-grey); }

/* Right cluster */
.bm-toolbar-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

/* Filter/sort selects */
.bm-ctrl-select {
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border: 1.5px solid var(--border-color); border-radius: 10px;
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 500; color: var(--dark-grey);
  background: white; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.625rem center; background-color: white;
  transition: border-color var(--trans-fast);
}
.bm-ctrl-select:focus { outline: none; border-color: var(--secondary-blue); }

/* View toggle */
.bm-view-toggle { display: flex; border: 1.5px solid var(--border-color); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.bm-view-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: none; background: white;
  cursor: pointer; font-size: 0.9rem; color: var(--medium-grey);
  transition: background var(--trans-fast), color var(--trans-fast);
}
.bm-view-btn:first-child { border-right: 1px solid var(--border-color); }
.bm-view-btn.active { background: var(--light-blue); color: var(--secondary-blue); }
.bm-view-btn:hover:not(.active) { background: var(--light-grey); color: var(--dark-grey); }

/* New button */
.bm-btn-new {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.875rem; border-radius: 10px;
  border: 1.5px solid var(--primary-blue); background: var(--primary-blue);
  color: white; font-family: var(--font-body); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background var(--trans-fast), border-color var(--trans-fast), box-shadow var(--trans-fast);
}
.bm-btn-new i { font-size: 0.85rem; }
.bm-btn-new:hover { background: var(--secondary-blue); border-color: var(--secondary-blue); box-shadow: 0 4px 12px rgba(26,35,126,.2); }


/* ════════════════════════════════════════════════════════════════
   3. LIST VIEW — CONTENT AREA
   ════════════════════════════════════════════════════════════════ */
.bm-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem var(--section-h-pad) 2rem;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.bm-content-area::-webkit-scrollbar { width: 4px; }
.bm-content-area::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* ── Shared card component ────────────────────────────────────── */
.wiz-card { background: white; border: 1px solid var(--border-color); border-radius: 14px; overflow: hidden; }
.wiz-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem; font-weight: 700; color: var(--dark-grey);
}
.wiz-card-body { padding: 1.25rem; }

/* ── Generic data table ───────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th {
  padding: 0.6rem 0.875rem; background: var(--light-grey);
  font-size: 0.72rem; font-weight: 700; color: var(--medium-grey);
  text-transform: uppercase; letter-spacing: 0.4px; text-align: left;
  border-bottom: 1px solid var(--border-color); white-space: nowrap;
}
.data-table td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--border-color); color: var(--dark-grey); vertical-align: middle; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Projects table row interactions ─────────────────────────── */
.projects-table tbody tr.proj-row { cursor: pointer; transition: background var(--trans-fast); }
.projects-table tbody tr.proj-row:hover { background: var(--light-blue) !important; }
.projects-table tbody tr.proj-row:focus-visible { outline: 2px solid var(--secondary-blue); outline-offset: -2px; }
.projects-table tbody tr.proj-row-closed { opacity: 0.6; }
.projects-table tbody tr.proj-row-closed:hover { background: var(--light-grey) !important; opacity: 0.8; }

/* Project name cell */
.proj-status-cell { white-space: nowrap; }
.proj-name-cell { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.proj-name { font-size: 0.875rem; font-weight: 700; color: var(--dark-grey); }
.proj-meta { font-size: 0.75rem; color: var(--medium-grey); display: flex; align-items: center; gap: 0.125rem; }
.proj-datetime { display: flex; align-items: center; gap: 0.275rem; font-size: 0.72rem; color: var(--text-grey); margin-top: 0.1rem; }
.proj-datetime .bi { font-size: 0.68rem; flex-shrink: 0; }

/* CRUD action buttons on rows */
.proj-actions-cell { white-space: nowrap; text-align: right; }
.proj-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; background: transparent; cursor: pointer;
  border-radius: 7px; font-size: 0.78rem; color: var(--text-grey);
  opacity: 0; transition: opacity var(--trans-fast), background var(--trans-fast), color var(--trans-fast);
}
.projects-table tbody tr:hover .proj-action-btn { opacity: 1; }
.proj-action-btn:hover { background: var(--light-grey); color: var(--dark-grey); }
.proj-action-delete:hover { background: #fee2e2 !important; color: #dc2626 !important; }

/* ── Status badges ────────────────────────────────────────────── */
.proj-status-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.65rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2px; white-space: nowrap;
}
.status-assigned { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.status-assigned .bi { color: #3b82f6; }
.status-open     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-open .bi { color: #22c55e; }
.status-pending  { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-pending .bi { color: #f59e0b; }
.status-closed   { background: var(--light-grey); color: var(--medium-grey); border: 1px solid var(--border-color); }
.status-closed .bi { color: var(--text-grey); }

/* ── Card view grid ───────────────────────────────────────────── */
.proj-cards-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
@media (max-width: 1024px) { .proj-cards-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px)  { .proj-cards-grid { grid-template-columns: 1fr; } }

.proj-card {
  background: white; border: 1px solid var(--border-color); border-radius: 14px;
  padding: 1.125rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem;
  cursor: pointer; transition: box-shadow var(--trans-fast), transform var(--trans-fast), border-color var(--trans-fast);
}
.proj-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); border-color: var(--secondary-blue); }
.proj-card:focus-visible { outline: 2px solid var(--secondary-blue); outline-offset: 2px; }
.proj-card.proj-card-closed { opacity: 0.6; }
.proj-card.proj-card-closed:hover { border-color: var(--border-color); box-shadow: 0 2px 8px rgba(0,0,0,.04); opacity: 0.8; transform: none; }
.proj-card-top { display: flex; align-items: center; justify-content: space-between; }
.proj-card-name { font-size: 0.9rem; font-weight: 700; color: var(--dark-grey); line-height: 1.35; word-break: break-word; }
.proj-card-meta { display: flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--medium-grey); }
.proj-card-datetime { display: flex; align-items: center; gap: 0.275rem; font-size: 0.72rem; color: var(--text-grey); margin-top: auto; padding-top: 0.25rem; }
.proj-card-datetime .bi { font-size: 0.68rem; flex-shrink: 0; }
.proj-card-actions {
  display: flex; gap: 0.25rem; justify-content: flex-end;
  opacity: 0; transition: opacity var(--trans-fast);
}
.proj-card:hover .proj-card-actions { opacity: 1; }

/* ── Misc shared components ───────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem; padding: 3rem 1rem; text-align: center; color: var(--medium-grey); }
.empty-state i { font-size: 2rem; opacity: 0.4; }
.empty-state p { font-size: 0.875rem; margin: 0; }
.inline-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
.inline-spinner.dark { border-color: rgba(26,35,126,.2); border-top-color: var(--primary-blue); }
.wiz-badge { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.3px; }
.wiz-badge-success { background: #d1fae5; color: #065f46; }
.wiz-badge-info    { background: var(--light-blue); color: var(--primary-blue); }
.wiz-badge-grey    { background: var(--light-grey); color: var(--medium-grey); }


/* ════════════════════════════════════════════════════════════════
   4. NEW PROJECT — prompt chips + interpreted badge
   ════════════════════════════════════════════════════════════════ */
.wc-prompt-chips {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin-top: 0.625rem;
}
.wc-prompt-chip {
  padding: 0.3rem 0.75rem;
  background: var(--light-blue); color: var(--primary-blue);
  border: 1.5px solid transparent; border-radius: 20px;
  font-family: var(--font-body); font-size: 0.76rem; font-weight: 600;
  cursor: pointer; transition: background var(--trans-fast), border-color var(--trans-fast);
  white-space: nowrap;
}
.wc-prompt-chip:hover { background: #d8dcf5; border-color: var(--secondary-blue); }

.wc-interpreted-badge {
  display: flex; align-items: center; gap: 0.4rem;
  margin-top: 0.75rem; padding: 0.55rem 0.875rem;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; font-size: 0.8rem; color: var(--dark-grey);
  animation: fadeInUp 0.2s ease both;
}
@keyframes fadeInUp { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }


/* ════════════════════════════════════════════════════════════════
   5. CRUD — delete confirm + header edit/delete buttons
   ════════════════════════════════════════════════════════════════ */
.wc-delete-icon {
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 14px;
  background: #fee2e2; color: #dc2626;
  margin: 0 auto 1rem; font-size: 1.4rem;
}

/* Icon-only header buttons in detail view */
.hc-header-icon-btn {
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  line-height: 1;
}
.hc-header-icon-btn-danger:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}


/* ════════════════════════════════════════════════════════════════
   6. DETAIL VIEW — HEADER / TABS / SHELL
   ════════════════════════════════════════════════════════════════ */
.hc-header {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 1.25rem; background: white;
  border-bottom: 1px solid var(--border-color); flex-shrink: 0; z-index: 10;
}
.hc-breadcrumb { font-size: 0.9375rem; font-weight: 700; color: var(--dark-grey); }
.hc-meta-tag {
  display: inline-flex; align-items: center; padding: 0.2rem 0.6rem;
  background: var(--light-grey); border-radius: 6px;
  font-size: 0.75rem; font-weight: 600; color: var(--medium-grey);
}
.hc-active-chip {
  font-size: 0.8rem; font-weight: 700; padding: 0.2rem 0.65rem; border-radius: 20px;
  background: rgba(59,130,246,.1); color: var(--secondary-blue); border: 1.5px solid rgba(59,130,246,.3);
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-body); cursor: pointer; line-height: 1.4;
}
.hc-active-chip:hover { background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.5); }
.hc-save-version-btn { padding: 0.3rem 0.625rem; font-size: 0.9rem; line-height: 1; min-width: 0; }

#btnAssumptions.active { background: var(--light-blue); border-color: var(--secondary-blue); color: var(--secondary-blue); }

/* L1 tab bar */
.hc-tabs-l1 {
  display: flex; align-items: flex-end; padding: 0 1.25rem;
  background: white; border-bottom: 2px solid var(--border-color); flex-shrink: 0;
}
.hc-tab-l1 {
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 600;
  color: var(--medium-grey); padding: 0.75rem 1.125rem 0.625rem;
  border: none; background: none; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
  transition: color var(--trans-fast), border-color var(--trans-fast);
}
.hc-tab-l1:hover:not(.active) { color: var(--dark-grey); border-bottom-color: var(--border-color); }
.hc-tab-l1.active { color: var(--primary-blue); border-bottom-color: var(--primary-blue); }

/* L2 tab bar */
.hc-tabs-l2 {
  display: flex; align-items: flex-end; padding: 0 1.25rem;
  background: var(--light-grey); border-bottom: 1px solid var(--border-color);
  flex-shrink: 0; overflow-x: auto; scrollbar-width: none;
}
.hc-tabs-l2::-webkit-scrollbar { display: none; }
.hc-tab-l2 {
  font-family: var(--font-body); font-size: 0.8rem; font-weight: 600;
  color: var(--medium-grey); padding: 0.5rem 0.875rem 0.4375rem;
  border: none; background: none; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
  transition: color var(--trans-fast), border-color var(--trans-fast), background var(--trans-fast);
}
.hc-tab-l2:hover:not(.active) { color: var(--dark-grey); background: rgba(0,0,0,.04); }
.hc-tab-l2.active { color: var(--secondary-blue); border-bottom-color: var(--secondary-blue); background: white; }

/* ════════════════════════════════════════════════════════════════
   6. DETAIL VIEW — SPLIT CONTAINER
   Wiz Agent on left, data panels on right, draggable divider.
   Matches chat.html split-panel UX exactly.
   ════════════════════════════════════════════════════════════════ */
.wc-split-container {
  flex: 1; display: flex; flex-direction: row;
  height: 100%; overflow: hidden; min-width: 0; position: relative;
}

/* ── LEFT PANE: Wiz Agent ─────────────────────────────────────── */
.wc-split-left {
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
  background: #fafafa; flex-shrink: 0;
  width: 100%; min-width: 280px; position: relative;
  transition: width var(--trans-split);
}

/* Floating restore button: top-right of left pane, when right is closed */
.float-restore-btn {
  position: absolute; top: 0.625rem; right: 0.875rem; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: white;
  border: 1.5px solid var(--border-color); border-radius: 10px;
  cursor: pointer; color: var(--secondary-blue); font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.09); transition: all var(--trans-fast);
}
.float-restore-btn:hover {
  background: var(--light-blue); border-color: var(--secondary-blue);
  box-shadow: 0 4px 14px rgba(57,73,171,0.15); transform: scale(1.06);
}
.float-restore-btn:active { transform: scale(0.95); }

/* LP top bar — always visible in detail mode; houses back button + collapse/restore controls */
.lp-topbar {
  display: flex; flex-shrink: 0; height: 38px; padding: 0 0.875rem;
  align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-color); background: #fafafa; gap: 0.5rem;
}
.lp-topbar-spacer { flex: 1; }
.lp-topbar-right  { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }

/* Agent version badge */
.agent-ver-badge {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.6;
  text-transform: uppercase; border: 1.5px solid transparent; white-space: nowrap;
}
.agent-ver-badge[data-ver="v1"] {
  background: #eff6ff; color: #3949ab; border-color: #c7d2fe;
}
.agent-ver-badge[data-ver="v2"] {
  background: #f0fdf4; color: #166534; border-color: #bbf7d0;
}

/* "Data View" restore pill */
.restore-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.28rem 0.75rem 0.28rem 0.55rem;
  background: white; border: 1.5px solid var(--border-color); border-radius: 20px;
  cursor: pointer; font-family: var(--font-body); font-size: 0.75rem; font-weight: 600;
  color: var(--secondary-blue); box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all var(--trans-fast); white-space: nowrap;
}
.restore-pill i { font-size: 0.85rem; }
.restore-pill:hover {
  background: var(--light-blue); border-color: var(--secondary-blue);
  box-shadow: 0 2px 8px rgba(57,73,171,0.12); transform: translateY(-1px);
}

/* Collapse/restore icon buttons (topbar + data header) */
.lp-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; background: transparent;
  cursor: pointer; border-radius: 7px; font-size: 0.95rem;
  color: var(--text-grey); transition: background var(--trans-fast), color var(--trans-fast);
}
.lp-icon-btn:hover { background: var(--light-grey); color: var(--dark-grey); }

/* ── DRAG DIVIDER ─────────────────────────────────────────────── */
.split-divider {
  flex-shrink: 0; width: 6px; height: 100%;
  background: var(--border-color); cursor: col-resize; position: relative; z-index: 10;
  display: none; user-select: none; transition: background var(--trans-fast);
}
.split-divider.visible { display: flex; align-items: center; justify-content: center; }
.split-divider:hover,
.split-divider.dragging { background: var(--secondary-blue); }
.divider-handle { display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.divider-handle span {
  display: block; width: 3px; height: 3px; border-radius: 50%;
  background: var(--medium-grey); transition: background var(--trans-fast);
}
.split-divider:hover .divider-handle span,
.split-divider.dragging .divider-handle span { background: white; }

/* ── RIGHT PANE: Data View ────────────────────────────────────── */
.wc-split-right {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden; min-width: 0;
  background: #f4f5f8;
  border-left: 1px solid var(--border-color);
  width: 0;
  transition: width var(--trans-split);
}
.wc-split-right.open { min-width: 300px; }

/* "Restore Wiz Agent" button inside data view header */
.rp-restore-left {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0; border: none; background: transparent;
  cursor: pointer; color: var(--text-grey); border-radius: 6px; font-size: 0.95rem;
  transition: background var(--trans-fast), color var(--trans-fast);
}
.rp-restore-left:hover { background: var(--light-grey); color: var(--secondary-blue); }

/* Close data-view button — rightmost element in hc-header */
.rp-close-btn {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; background: transparent;
  cursor: pointer; color: var(--text-grey); border-radius: 6px; font-size: 0.85rem;
  flex-shrink: 0; transition: background var(--trans-fast), color var(--trans-fast);
}
.rp-close-btn:hover { background: var(--light-grey); color: var(--dark-grey); }

/* Content area that wraps the tab panels in the right pane */
.hc-content-area {
  flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}

/* Tab panels */
.hc-tab-panel { display: none; flex: 1; min-height: 0; overflow: hidden; }
.hc-tab-panel.active {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.hc-tab-panel.active::-webkit-scrollbar { width: 5px; }
.hc-tab-panel.active::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 99px; }

/* Placeholder panel */
.hc-placeholder-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem 1rem; }
.hc-placeholder { text-align: center; max-width: 360px; }
.hc-placeholder-icon {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--light-blue); color: var(--secondary-blue); font-size: 1.5rem; margin: 0 auto 1rem;
}
.hc-placeholder-title { font-size: 1rem; font-weight: 700; color: var(--dark-grey); margin-bottom: 0.375rem; }
.hc-placeholder-sub   { font-size: 0.82rem; color: var(--medium-grey); line-height: 1.65; }


/* ════════════════════════════════════════════════════════════════
   7. HEADCOUNT TABLE
   ════════════════════════════════════════════════════════════════ */
.hc-table-wrap { flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.hc-table-wrap::-webkit-scrollbar { height: 5px; width: 5px; }
.hc-table-wrap::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.hc-table-loading { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 3rem; font-size: 0.875rem; color: var(--medium-grey); }

.hc-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; white-space: nowrap; }
.hc-table thead th {
  position: sticky; top: 0; z-index: 5; padding: 0.5rem 0.875rem;
  background: var(--light-grey); font-size: 0.7rem; font-weight: 700; color: var(--medium-grey);
  text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--border-color); text-align: right;
}
.hc-table thead th:first-child { text-align: left; min-width: 160px; position: sticky; left: 0; z-index: 6; }
.hc-col-group { padding: 0.35rem 0.875rem; font-size: 0.68rem; font-weight: 700; color: var(--medium-grey); background: #fafafa; border-bottom: 1px solid var(--border-color); text-align: center; letter-spacing: 0.5px; text-transform: uppercase; }
.hc-table td { padding: 0.5rem 0.875rem; border-bottom: 1px solid var(--border-color); color: var(--dark-grey); text-align: right; vertical-align: middle; font-weight: 400; }
.hc-table td:first-child { text-align: left; position: sticky; left: 0; background: white; z-index: 1; }
/* font-weight is set only by depth — no other rule should override it */
.hc-row-depth-0 td             { font-weight: 700; }
.hc-row-depth-0 td:first-child { font-weight: 800; }
.hc-row-depth-1 td:first-child { font-weight: 700; padding-left: 1.75rem; border-left: 4px solid #3949ab; }
.hc-row-depth-2 td:first-child { font-weight: 600; padding-left: 3rem;    border-left: 4px solid #7986cb; }
.hc-row-depth-3 td:first-child { font-weight: 400; padding-left: 4.25rem; border-left: 4px solid #c5cae9; color: var(--medium-grey); }
/* backgrounds by depth */
.hc-row-depth-0 td { background: #e8eaf6; }
.hc-row-depth-1 td { background: #f0f2ff; }
.hc-row-depth-2 td { background: #f7f8fe; }
.hc-row-depth-3 td { background: #ffffff; font-size: 0.775rem; }
/* node-type classes: borders only — no font-weight */
.hc-row-total td { border-top: 2px solid var(--secondary-blue); }
.hc-row-group td { border-top: 1px solid #dde2ec; }
/* subtotal rows (e.g. Gross Profit) */
tr.hc-row-subtotal td { background: #eaf3e8; border-top: 2px solid #5aa672; font-weight: 600; }
/* percent_row (e.g. Gross Margin %) */
tr.hc-row-percent-row td { background: #f2faf0; font-style: italic; color: #3a7a55; font-size: 0.82rem; }
/* Direct Cost — % of Rev column highlight */
.dc-rev-pct-high { color: #c0392b; font-weight: 700; }
/* Direct Cost FLAG banners */
.dc-flag-banner {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: #fff8e1; border: 1.5px solid #f59e0b; border-radius: 8px;
  padding: 0.5rem 0.75rem; margin: 0.5rem 0.75rem 0; font-size: 0.825rem; color: #7c4a00;
  line-height: 1.4;
}
.dc-flag-banner i { font-size: 0.9rem; color: #f59e0b; flex-shrink: 0; margin-top: 0.1rem; }
.hc-row-expandable { cursor: pointer; user-select: none; }
.hc-row-expandable:hover { color: var(--primary-blue); }
.hc-row-chevron-spacer { display: inline-block; width: 0.95rem; margin-right: 0.35rem; }
.hc-row-chevron { font-size: 0.7rem; margin-right: 0.35rem; color: var(--medium-grey); transition: transform var(--trans-fast); display: inline-block; }
.hc-row-chevron.open { transform: rotate(90deg); }
.hc-col-reference { color: var(--medium-grey); font-style: italic; }
.hc-col-computed  { color: var(--primary-blue); font-weight: 600; background: #f0f4ff; }
.hc-col-editable  { cursor: text; }

/* Revenue pivot toolbar */
.hc-table-toolbar { padding: 0.625rem 0.875rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.hc-grain-dropdown-wrap { margin-left: auto; }
.hc-grain-dropdown {
  appearance: none; -webkit-appearance: none;
  padding: 0.3rem 2rem 0.3rem 0.75rem;
  border: 1.5px solid var(--border-color, #dde1e7);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.6rem center;
  background-size: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-color, #2d3748);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.hc-grain-dropdown:hover, .hc-grain-dropdown:focus { border-color: var(--primary-color, #2d3748); }
.hc-segmented {
  display: inline-flex;
  background: var(--light-grey);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.hc-segmented-btn {
  padding: 0.3rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--medium-grey);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.hc-segmented-btn:hover:not(.active) { color: var(--dark-grey); background: rgba(255,255,255,0.7); }
.hc-segmented-btn.active {
  background: white;
  color: var(--primary-blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* Financial summary table */
.hc-summary-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.hc-summary-table-wrap { flex: 1; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.hc-summary-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; white-space: nowrap; }
.hc-summary-table thead th { position: sticky; top: 0; padding: 0.5rem 0.875rem; background: var(--light-grey); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--medium-grey); border-bottom: 1px solid var(--border-color); z-index: 2; }
.hc-summary-table thead th:first-child { text-align: left; min-width: 180px; }
.hc-summary-table tbody td { padding: 0.5rem 0.875rem; border-bottom: 1px solid var(--border-color); color: var(--dark-grey); }
.hc-summary-table tbody tr:last-child td { border-bottom: none; }


/* ════════════════════════════════════════════════════════════════
   8. ASSUMPTIONS PANEL
   ════════════════════════════════════════════════════════════════ */
.assumptions-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border-color); background: white;
}
.assumptions-title { font-size: 0.875rem; font-weight: 700; color: var(--dark-grey); }
.assumptions-panel { flex-shrink: 0; padding: 0.875rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.625rem; }

/* Accordion group */
.assump-group { background: white; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.assump-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; cursor: pointer; user-select: none;
  font-size: 0.8125rem; font-weight: 700; color: var(--dark-grey);
  transition: background var(--trans-fast);
}
.assump-group-header:hover { background: var(--light-grey); }
.assump-group-header .toggle-icon { transition: transform var(--trans-fast); color: var(--medium-grey); }
.assump-group-header.open .toggle-icon { transform: rotate(90deg); }
.assump-group-body { display: none; border-top: 1px solid var(--border-color); }
.assump-group-body.open { display: block; }

/* Matrix table */
.assump-matrix-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }
.assump-matrix-wrap::-webkit-scrollbar { height: 4px; }
.assump-matrix-wrap::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }
.assump-matrix-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; white-space: nowrap; }
.assump-matrix-table thead th {
  padding: 0.45rem 0.75rem; background: var(--light-grey);
  font-size: 0.69rem; font-weight: 700; color: var(--medium-grey);
  text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--border-color); text-align: right;
}
.assump-matrix-table thead th.assump-cc-col { text-align: left; min-width: 180px; position: sticky; left: 0; z-index: 2; background: var(--light-grey); }
.assump-col-unit { display: block; font-size: 0.64rem; font-weight: 400; color: var(--text-grey); text-transform: none; letter-spacing: 0; margin-top: 1px; }
.assump-col-header { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.assump-col-label { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.35rem; max-width: 100%; }
.assump-help-wrap {
  position: relative;
  width: 0.95rem; height: 0.95rem; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-grey); cursor: help; outline: none; flex-shrink: 0;
}
.assump-help-icon { font-size: 0.8rem; }
.assump-help-tooltip {
  position: absolute; top: calc(100% + 0.45rem); right: 0;
  width: 240px; padding: 0.65rem 0.75rem; border-radius: 10px;
  background: #1f2a44; color: #f7f9fd; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.24);
  font-size: 0.72rem; font-weight: 400; text-transform: none; letter-spacing: 0; line-height: 1.45;
  white-space: normal; text-align: left; z-index: 20; opacity: 0; pointer-events: none;
  transform: translateY(4px); transition: opacity var(--trans-fast), transform var(--trans-fast);
}
.assump-help-wrap:hover .assump-help-tooltip,
.assump-help-wrap:focus .assump-help-tooltip,
.assump-help-wrap:focus-visible .assump-help-tooltip {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.assump-help-title { display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.35px; text-transform: uppercase; color: #b8c7f0; margin-bottom: 0.18rem; }
.assump-help-copy + .assump-help-title { margin-top: 0.45rem; }
.assump-help-copy { display: block; }
.assump-matrix-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border-color); color: var(--dark-grey); vertical-align: middle; }
.assump-matrix-table tbody tr:last-child td { border-bottom: none; }
.assump-val-col { text-align: right; font-family: var(--font-mono); font-size: 0.78rem; min-width: 80px; }
.assump-matrix-table td.assump-cc-col { text-align: left; font-family: var(--font-body); position: sticky; left: 0; background: white; z-index: 1; }
.assump-cc-cell { display: flex; align-items: center; gap: 0.3rem; }
.assump-cc-label { white-space: nowrap; }
.assump-expand-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 17px; height: 17px; border: 1px solid var(--border-color); border-radius: 4px;
  background: white; font-size: 0.7rem; font-weight: 700; line-height: 1; cursor: pointer;
  color: var(--medium-grey); transition: background var(--trans-fast), color var(--trans-fast), border-color var(--trans-fast);
}
.assump-expand-btn:hover { background: var(--light-blue); border-color: var(--secondary-blue); color: var(--secondary-blue); }
.assump-expand-placeholder { display: inline-block; width: 17px; flex-shrink: 0; }
.assump-row-level-0 td { font-weight: 700; background: #f8f9fb; }
.assump-row-level-0 td.assump-cc-col { background: #f8f9fb; }
.assump-row-level-1 td { font-weight: 600; }
.assump-row-level-2 td { font-weight: 400; color: var(--medium-grey); }
.assump-row-level-2 td.assump-cc-col { color: var(--dark-grey); }
.assump-row-hidden { display: none !important; }

/* ════════════════════════════════════════════════════════════════
   DC AUDIT TRACE PANEL
   ════════════════════════════════════════════════════════════════ */

/* Traceable cells get a cursor + subtle hover signal */
td.dc-traceable { cursor: pointer; }
td.dc-traceable:hover { background: #eef3ff !important; }

/* Page backdrop while the audit panel is open */
.dc-trace-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
  z-index: 499;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.dc-trace-backdrop.open { opacity: 1; pointer-events: auto; }

/* Slide-in panel anchored to right edge */
.dc-trace-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 440px; max-width: 94vw;
  background: #fff; box-shadow: -4px 0 32px rgba(15, 23, 42, 0.14);
  z-index: 500; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.22s ease;
  pointer-events: none;
}
.dc-trace-panel.open { transform: translateX(0); pointer-events: auto; }

.dc-trace-inner { padding: 1.25rem 1.25rem 2rem; display: flex; flex-direction: column; gap: 1rem; }

/* Header */
.dc-trace-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
}
.dc-trace-header-titles { display: flex; flex-direction: column; gap: 0.15rem; }
.dc-trace-meta-row { display: flex; align-items: center; gap: 0.45rem; }
.dc-trace-row-name { font-size: 0.95rem; font-weight: 700; color: var(--dark-grey); line-height: 1.3; }
.dc-trace-col-name { font-size: 0.75rem; color: var(--medium-grey); font-weight: 500; letter-spacing: 0.2px; }
.dc-trace-module-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.12rem 0.5rem; border-radius: 999px;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em;
  text-transform: uppercase; border: 1px solid transparent;
}
.dc-trace-module-pill--headcount { background: #eef2ff; color: #3949ab; border-color: #c7d2fe; }
.dc-trace-module-pill--revenue { background: #ecfeff; color: #0f766e; border-color: #a5f3fc; }
.dc-trace-module-pill--direct-cost { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.dc-trace-close {
  flex-shrink: 0; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--light-grey); border-radius: 50%;
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--medium-grey);
  transition: background var(--trans-fast), color var(--trans-fast);
}
.dc-trace-close:hover { background: #fee2e2; color: #dc2626; }

/* Locked column note */
.dc-trace-col-locked-note {
  display: flex; align-items: center; gap: 0.5rem;
  background: #fff8e1; border: 1.5px solid #f59e0b; border-radius: 8px;
  padding: 0.5rem 0.75rem; font-size: 0.78rem; color: #7c4a00; line-height: 1.4;
}
.dc-trace-col-locked-note .bi-lock-fill { color: #f59e0b; flex-shrink: 0; }

/* Formula line */
.dc-trace-formula {
  font-size: 0.8rem; color: var(--text-grey); font-style: italic;
  padding: 0.5rem 0.75rem; background: var(--light-grey); border-radius: 8px;
  line-height: 1.4;
}

/* Steps list */
.dc-trace-steps-list { display: flex; flex-direction: column; gap: 0.3rem; }

.dc-trace-step { padding: 0.45rem 0; border-bottom: 1px solid var(--border-color); }
.dc-trace-step:last-of-type { border-bottom: none; }
.dc-trace-step-main {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem;
}
.dc-trace-step-label {
  flex: 1; color: var(--dark-grey); display: flex; align-items: center; gap: 0.3rem;
}
.dc-trace-lock { font-size: 0.65rem; color: #f59e0b; flex-shrink: 0; }
.dc-trace-step-value {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--primary-blue);
  font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.dc-trace-step-note {
  font-size: 0.7rem; color: var(--text-grey); font-style: italic; margin-top: 0.15rem; padding-left: 0.2rem;
}
.dc-trace-inline-breakdown {
  margin-top: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: #fafcff;
}
.dc-trace-inline-breakdown summary {
  padding: 0.45rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary-blue);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.dc-trace-inline-breakdown summary::marker,
.dc-trace-inline-breakdown summary::-webkit-details-marker { display: none; }
.dc-trace-inline-breakdown summary::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.6rem;
  transition: transform 0.15s ease;
}
.dc-trace-inline-breakdown[open] summary::before { transform: rotate(90deg); }
.dc-trace-inline-body {
  padding: 0.55rem 0.75rem 0.7rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* Locked (actual) step gets muted styling */
.dc-trace-step--actual .dc-trace-step-label { color: var(--medium-grey); }
.dc-trace-step--actual .dc-trace-step-value { color: var(--medium-grey); font-weight: 500; }

/* Kind badges */
.dc-trace-badge {
  flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.3px;
  text-transform: uppercase; padding: 0.1rem 0.45rem; border-radius: 20px;
}
.dc-trace-badge--actual     { background: #fee2e2; color: #b91c1c; }
.dc-trace-badge--assumption { background: #dbeafe; color: #1d4ed8; }
.dc-trace-badge--computed   { background: #d1fae5; color: #065f46; }
.dc-trace-badge--allocation { background: #ede9fe; color: #6d28d9; }

/* Divider + result row */
.dc-trace-divider { border: none; border-top: 2px solid var(--border-color); margin: 0.3rem 0; }
.dc-trace-result {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.4rem 0; font-weight: 700; font-size: 0.88rem; color: var(--dark-grey);
}
.dc-trace-result-val { font-family: var(--font-mono); color: var(--primary-blue); }

/* Origin chain (parent trace for dept rows) */
.dc-trace-origin-chain {
  border: 1.5px solid var(--border-color); border-radius: 10px;
  overflow: hidden;
}
.dc-trace-origin-chain summary {
  padding: 0.6rem 0.85rem; font-size: 0.78rem; font-weight: 600;
  color: var(--medium-grey); cursor: pointer; user-select: none;
  list-style: none; display: flex; align-items: center; gap: 0.4rem;
}
.dc-trace-origin-chain summary::before {
  content: '\25B6'; font-size: 0.6rem; transition: transform 0.15s ease;
}
.dc-trace-origin-chain[open] summary::before { transform: rotate(90deg); }
.dc-trace-origin-chain summary em { color: var(--dark-grey); font-style: normal; }
.dc-trace-origin-body {
  padding: 0.5rem 0.85rem 0.75rem; display: flex; flex-direction: column; gap: 0.3rem;
  border-top: 1px solid var(--border-color); background: #fafbff;
}
.dc-trace-formula-sub { font-size: 0.75rem; color: var(--text-grey); font-style: italic; margin-bottom: 0.2rem; }


/* ════════════════════════════════════════════════════════════════
   9. WIZ AGENT — CHAT PANEL (in left pane)
   ════════════════════════════════════════════════════════════════ */
/* Scrollable messages area */
.wc-chat-messages {
  flex: 1; overflow-y: auto; padding: 0.875rem 1rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  background: #fafafa;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.wc-chat-messages::-webkit-scrollbar { width: 3px; }
.wc-chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* Chat bubbles — matches chat.html visual language */
.chat-bubble {
  max-width: 88%; padding: 0.625rem 0.875rem;
  border-radius: 12px; font-size: 0.8125rem; line-height: 1.55; word-break: break-word;
}
.chat-bubble.user    { align-self: flex-end; background: var(--dark-blue); color: white; border-bottom-right-radius: 4px; }
.chat-bubble.model   { align-self: flex-start; background: white; color: var(--dark-grey); border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid var(--border-color); }
.chat-bubble.thinking{ align-self: flex-start; background: var(--light-grey); color: var(--medium-grey); font-style: italic; border-bottom-left-radius: 4px; display: flex; align-items: center; gap: 0.5rem; }
.chat-thinking-spinner { display: inline-block; width: 0.85rem; height: 0.85rem; border: 2px solid #c8cdd6; border-top-color: var(--primary-blue); border-radius: 50%; animation: chat-spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
.chat-bubble.model h1,
.chat-bubble.model h2,
.chat-bubble.model h3,
.chat-bubble.model h4 {
  margin: 0.25rem 0 0.45rem;
  line-height: 1.25;
  font-weight: 700;
}
.chat-bubble.model h1 { font-size: 1.05rem; }
.chat-bubble.model h2 { font-size: 0.98rem; }
.chat-bubble.model h3 { font-size: 0.91rem; }
.chat-bubble.model h4 { font-size: 0.86rem; }
.chat-bubble.model p,
.chat-bubble.model ul,
.chat-bubble.model ol,
.chat-bubble.model table,
.chat-bubble.model blockquote,
.chat-bubble.model pre {
  margin: 0 0 0.5rem;
}
.chat-bubble.model p:last-child,
.chat-bubble.model ul:last-child,
.chat-bubble.model ol:last-child,
.chat-bubble.model table:last-child,
.chat-bubble.model blockquote:last-child,
.chat-bubble.model pre:last-child {
  margin-bottom: 0;
}
.chat-bubble.model ul,
.chat-bubble.model ol {
  padding-left: 1.1rem;
}
.chat-bubble.model li + li {
  margin-top: 0.15rem;
}

/* Rich HTML bubbles */
.chat-bubble.chat-bubble-rich { max-width: 97%; padding: 0.75rem 0.875rem; }
.chat-bubble-rich p    { font-size: 0.8rem; margin-bottom: 0.4rem; }
.chat-bubble-rich p:last-child { margin-bottom: 0; }
.chat-bubble-rich ul   { font-size: 0.78rem; padding-left: 1.2rem; margin-bottom: 0.5rem; }
.chat-bubble-rich li   { margin-bottom: 0.2rem; }
.chat-bubble-rich .table { margin-bottom: 0; }
.chat-bubble-rich .table-responsive { border-radius: 6px; overflow: hidden; }
.chat-bubble-rich .table th, .chat-bubble-rich .table td { padding: 0.3rem 0.5rem; }
.chat-bubble-rich .table-primary { background: var(--light-blue); }

/* Context chips — populated by JS per active tab */
.chat-chips { padding: 0.5rem 1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; border-top: 1px solid var(--border-color); flex-shrink: 0; min-height: 0; }
.chat-chips:empty { padding: 0; border-top: none; }
.chat-chip {
  padding: 0.3rem 0.7rem; background: var(--light-blue); color: var(--primary-blue);
  border: 1.5px solid transparent; border-radius: 20px; font-size: 0.74rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background var(--trans-fast), border-color var(--trans-fast);
}
.chat-chip:hover { background: #d8dcf5; border-color: var(--secondary-blue); }

/* Input area — #fafafa background, chat.html input-box style */
.wc-input-area { flex-shrink: 0; padding: 0 0.875rem 0.875rem; background: #fafafa; }
.input-box {
  background: white; border-radius: 14px;
  box-shadow: var(--input-shadow); padding: 0.75rem 0.75rem 0.5rem 1rem;
  transition: box-shadow var(--trans-fast);
}
.input-box:focus-within { box-shadow: var(--input-shadow-focus); }
.chat-textarea {
  display: block; width: 100%; border: none; outline: none; background: transparent;
  font-family: var(--font-body); font-size: 0.9rem; color: var(--dark-grey);
  line-height: 1.6; resize: none; overflow-y: hidden; min-height: 26px; max-height: 160px;
}
.chat-textarea::placeholder { color: var(--text-grey); }
.input-footer-row { display: flex; align-items: center; justify-content: space-between; margin-top: 0.35rem; }
.char-hint { font-size: 0.7rem; color: var(--text-grey); }
.char-hint.near-limit { color: #f59e0b; }
.char-hint.at-limit   { color: #ef4444; }
/* Send button — exact match to chat.html .send-btn */
.send-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: none; border-radius: 10px;
  cursor: pointer; font-size: 1.05rem; background: var(--primary-blue); color: white;
  flex-shrink: 0; transition: all var(--trans-fast);
}
.send-btn:disabled { background: var(--border-color); color: var(--text-grey); cursor: not-allowed; }
.send-btn:not(:disabled):hover { background: var(--dark-blue); transform: scale(1.05); box-shadow: 0 4px 12px rgba(26,35,126,0.25); }
.send-btn:not(:disabled):active { transform: scale(0.95); }


/* ════════════════════════════════════════════════════════════════
   10. VERSIONS PANEL (slide-in)
   ════════════════════════════════════════════════════════════════ */
.sn-selector-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 1040; }
.sn-selector-panel {
  position: fixed; top: 0; right: 0; height: 100%; width: 420px; max-width: 100vw;
  background: white; z-index: 1050; display: flex; flex-direction: column;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.sn-selector-panel.open { transform: translateX(0); }
.sn-selector-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 1.25rem 1.25rem 0.875rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.sn-selector-title { font-size: 1rem; font-weight: 700; color: var(--dark-grey); }
.sn-selector-sub   { font-size: 0.78rem; color: var(--medium-grey); margin-top: 0.2rem; }
.sn-selector-search-wrap { position: relative; padding: 0.75rem 1.25rem 0.5rem; flex-shrink: 0; }
.sn-search-icon { position: absolute; left: 1.85rem; top: 50%; transform: translateY(-50%); color: var(--medium-grey); font-size: 0.8rem; pointer-events: none; }
.sn-selector-search { width: 100%; padding: 0.45rem 0.75rem 0.45rem 2rem; font-size: 0.8125rem; font-family: var(--font-body); border: 1.5px solid var(--border-color); border-radius: 8px; outline: none; transition: border-color .15s; }
.sn-selector-search:focus { border-color: var(--secondary-blue); }
.sn-selector-list { flex: 1; overflow-y: auto; padding: 0.25rem 0; }
.sn-sel-row { display: flex; align-items: center; padding: 0.6rem 1.25rem; cursor: pointer; border-bottom: 1px solid transparent; transition: background .1s; gap: 0.25rem; }
.sn-sel-row:hover { background: #f4f6fb; }
.sn-sel-row:hover .sn-sel-activate-hint { opacity: 1; }
.sn-sel-row-active { background: rgba(59,130,246,.06); }
.sn-sel-row-active:hover { background: rgba(59,130,246,.1); }
.sn-sel-row-compare { cursor: default !important; }
.sn-sel-info { flex: 1; min-width: 0; }
.sn-sel-name { font-size: 0.875rem; font-weight: 600; color: var(--dark-grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-sel-row-active .sn-sel-name { color: var(--secondary-blue); }
.sn-sel-summary { font-size: 0.75rem; color: var(--medium-grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 0.1rem; }
.sn-sel-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex-shrink: 0; margin-left: 0.5rem; }
.sn-sel-date        { font-size: 0.72rem; color: #b0b4bb; }
.sn-sel-active-chip { font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 5px; background: var(--secondary-blue); color: white; white-space: nowrap; }
.sn-sel-activate-hint { font-size: 0.72rem; color: var(--secondary-blue); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.sn-sel-empty { padding: 2rem; text-align: center; font-size: 0.8rem; color: var(--medium-grey); }
.sn-selector-footer { padding: 0.875rem 1.25rem; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; flex-shrink: 0; }
.sn-sel-meta { display: flex; align-items: center; gap: 0.6rem; font-size: 0.72rem; color: var(--medium-grey); margin-top: 2px; }
.sn-status-badge { display: inline-flex; align-items: center; padding: 0.15rem 0.55rem; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.sn-status-draft     { background: #fef3c7; color: #b45309; }
.sn-status-submitted { background: #dcfce7; color: #15803d; }

/* Compare mode */
.sn-icon-btn { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1.5px solid var(--border-color); border-radius: 8px; background: transparent; color: var(--medium-grey); font-size: 0.85rem; cursor: pointer; transition: all var(--trans-fast); flex-shrink: 0; }
.sn-icon-btn:hover { background: var(--light-grey); color: var(--dark-grey); }
.sn-icon-btn.active { background: var(--light-blue); border-color: var(--secondary-blue); color: var(--secondary-blue); }
.sn-compare-check { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--secondary-blue); cursor: pointer; margin-right: 0.5rem; }
.sn-edit-btn { background: none; border: 1px solid var(--border-color); border-radius: 6px; padding: 0.2rem 0.45rem; font-size: 0.7rem; color: var(--medium-grey); cursor: pointer; line-height: 1; margin-left: 4px; opacity: 0; transition: opacity .15s; }
.sn-sel-row:hover .sn-edit-btn { opacity: 1; }
.sn-edit-btn:hover { background: var(--light-grey); color: var(--secondary-blue); }

/* Comparison results */
.sn-compare-view { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.sn-compare-header { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.sn-compare-back { display: inline-flex; align-items: center; border: none; background: transparent; font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--secondary-blue); cursor: pointer; padding: 0; white-space: nowrap; }
.sn-compare-back:hover { color: var(--primary-blue); }
.sn-compare-title { font-size: 0.875rem; font-weight: 700; color: var(--dark-grey); }
.sn-compare-scope { font-size: 0.75rem; color: var(--medium-grey); margin-left: auto; white-space: nowrap; }
.sn-compare-note { padding: 0.5rem 1.25rem 0.25rem; font-size: 0.75rem; color: var(--medium-grey); flex-shrink: 0; background: #fafafa; border-bottom: 1px solid var(--border-color); }
.sn-compare-table-wrap { flex: 1; overflow: auto; padding: 0.75rem 1.25rem 1.5rem; }
.sn-compare-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.sn-compare-table th { padding: 0.45rem 0.625rem; background: var(--light-grey); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--medium-grey); border-bottom: 1px solid var(--border-color); text-align: left; white-space: nowrap; }
.sn-compare-table td { padding: 0.5rem 0.625rem; border-bottom: 1px solid var(--border-color); color: var(--dark-grey); vertical-align: top; }
.sn-compare-table tbody tr:last-child td { border-bottom: none; }


/* ════════════════════════════════════════════════════════════════
   11. RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
/* Mobile: icon-only status badge */
@media (max-width: 600px) {
  .proj-status-label { display: none; }
  .proj-status-badge { padding: 0.25rem 0.4rem; gap: 0; }
  .projects-table th:first-child { width: 36px !important; min-width: 0 !important; padding-left: 0.5rem; padding-right: 0.25rem; }
  .projects-table td:first-child { width: 36px !important; min-width: 0 !important; padding-left: 0.5rem; padding-right: 0.25rem; }
  /* Detail view: on mobile, Wiz Agent fills screen; data view accessible via float button */
  .wc-split-left  { width: 100% !important; min-width: 0 !important; }
  .wc-split-right { width: 0 !important; }
  .split-divider  { display: none !important; }
  .lp-topbar      { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — wide & ultra-wide breakpoints
   ════════════════════════════════════════════════════════════════ */

/* ── Mobile ≤768px — panel overlays instead of pushing content ── */
@media (max-width: 768px) {
  .left-toolbar.panel-open .history-panel {
    position: fixed;
    left: var(--rail-width); top: 0; bottom: 0;
    z-index: 300;
    width: min(var(--panel-width), calc(100vw - var(--rail-width)));
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  :root { --section-h-pad: 1rem; }
}

/* ── Wide ≥1920px ─────────────────────────────────────────────── */
@media (min-width: 1920px) {
  :root {
    --section-h-pad:   clamp(2rem, 4vw, 5rem);
    --content-col-max: 1600px;
  }
}

/* ── Ultra-wide ≥2560px ───────────────────────────────────────── */
@media (min-width: 2560px) {
  :root {
    --section-h-pad:   clamp(3rem, 5vw, 7rem);
    --content-col-max: 1800px;
  }
}

/* ── 4K ≥3840px ───────────────────────────────────────────────── */
@media (min-width: 3840px) {
  :root {
    --section-h-pad:   clamp(4rem, 6vw, 10rem);
    --content-col-max: 2200px;
  }
  .rail-btn { width: 46px; height: 46px; font-size: 1.3rem; }
  body      { font-size: 18px; }
}