/* Accenture Intelligence Platform — light theme, purple + white (Accenture brand) */
:root {
  --bg:          #F7F4FC;
  --panel:       #FFFFFF;
  --card:        #F3ECFB;
  --line:        #DCC9F5;
  --text:        #241536;
  --text-sec:    #4B3966;
  --muted:       #8577A0;
  --accent:      #A100FF;
  --accent-dark: #7B00C2;
  --accent-tint: #F0DFFF;
  --success:     #1E8E5A;
  --warn:        #B5622A;
  --danger:      #C0203A;
}
*, *::before, *::after { box-sizing: border-box }
body {
  margin: 0; font-family: "Segoe UI", system-ui, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
  height: 100vh; overflow: hidden;
}
a { color: var(--accent); text-decoration: none }
a:hover { text-decoration: underline }
code { background: var(--card); color: var(--accent-dark); padding: 1px 5px; border-radius: 4px; font-size: 12px }

/* ── TOP BAR ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px; height: 52px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20; flex-shrink: 0;
}
.brand a { font-weight: 700; font-size: 16px; color: var(--text) }
.topbar-change { font-size: 12px; color: var(--muted); font-family: Consolas, monospace }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px }
.skills-status { font-size: 12px; display: flex; align-items: center; gap: 6px }
.skills-status .skill-count { color: var(--success) }
.skills-status .skill-count.warn { color: var(--warn) }
.skills-status .skill-count.none { color: var(--muted) }

/* ── PHASE BAR ───────────────────────────────────────── */
.phases { list-style: none; display: flex; align-items: center; margin: 0; padding: 0; gap: 0 }
.phase-wrap { display: flex; align-items: center }
.phase-connector { width: 20px; height: 2px; background: var(--line); flex-shrink: 0 }
.phase-connector.dashed {
  background: repeating-linear-gradient(90deg, var(--line) 0, var(--line) 4px, transparent 4px, transparent 8px);
}
.phase {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  color: var(--muted); font-size: 12px;
}
.phase .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; color: transparent;
}
.phase.approved .dot, .phase.complete .dot { background: var(--success); color: #fff; font-size: 8px }
.phase.stub .dot { background: var(--warn) }
.phase.running .dot { background: var(--accent); animation: pulse 1s infinite }
.phase.error .dot { background: var(--danger) }
.phase.skipped { opacity: .4 }
.phase.current { color: var(--text) }
.phase.current .dot { box-shadow: 0 0 0 3px rgba(161,0,255,.25) }
@keyframes pulse { 50% { opacity: .3 } }

/* ── APP BODY / LAYOUT ───────────────────────────────── */
.app-body {
  display: flex; flex-direction: column;
  height: calc(100vh - 52px);
}
.layout {
  display: flex; flex: 1; min-height: 0; overflow: hidden;
}
.sidebar {
  width: 220px; flex: 0 0 220px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 14px; display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0 }
.main-content { flex: 1; padding: 22px 28px; overflow-y: auto }
.side-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 14px 0 6px; flex-shrink: 0;
}

/* ── SIDEBAR SECTIONS — three always-visible regions ─── */
/* 1) Buttons: fixed height, never scrolls */
.sidebar-buttons { flex-shrink: 0 }

/* 2) Recent changes: the only scrollable section, capped to ~5 rows */
.sidebar-recent {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
}
.sidebar-recent .history {
  flex: 1; min-height: 0; max-height: 260px; /* ≈ 5 history-item rows */
  overflow-y: auto;
}

/* 3) Feedback log + Settings: fixed height, pinned at the bottom, never scrolls */
.sidebar-bottom {
  flex-shrink: 0; padding-top: 10px;
}
.sidebar-link {
  display: block; padding: 7px 10px; border-radius: 8px;
  color: var(--muted); font-size: 13px; cursor: pointer;
  text-decoration: none;
}
.sidebar-link:hover { background: var(--card); color: var(--text); text-decoration: none }

/* ── HISTORY PANEL ───────────────────────────────────── */
.history { list-style: none; margin: 0; padding: 0 }
.history li { margin-bottom: 3px }
.history-item {
  display: block; padding: 7px 10px; border-radius: 8px;
  color: var(--text); border: 1px solid transparent; text-decoration: none;
}
.history-item:hover { background: var(--card); border-color: var(--line); text-decoration: none }
.history-item.active { background: var(--card); border-color: var(--accent) }
.hist-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px }
.hist-id { font-weight: 600; font-size: 12px; font-family: Consolas, monospace }
.hist-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0 }
.hist-dot.running { background: var(--accent); animation: pulse 1s infinite }
.hist-dot.complete, .hist-dot.approved { background: var(--success) }
.hist-dot.error { background: var(--danger) }
.hist-phase { font-size: 11px; color: var(--muted) }
.hist-req {
  display: block; color: var(--muted); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── BOTTOM PANEL ────────────────────────────────────── */
.bottom-panel {
  height: 280px; flex-shrink: 0;
  background: var(--panel); border-top: 2px solid var(--line);
  display: flex; flex-direction: column;
  transition: height .2s ease;
}
.bottom-panel.collapsed { height: 36px !important } /* beat the inline height set by drag-resize */
.bottom-panel.resizing { transition: none; user-select: none }
.bottom-panel-resize {
  height: 8px; flex-shrink: 0; cursor: ns-resize;
  display: flex; align-items: center; justify-content: center;
  background: var(--line);
}
.bottom-panel-resize::before {
  content: ""; width: 40px; height: 3px; border-radius: 2px;
  background: var(--muted);
}
.bottom-panel-resize:hover { background: var(--accent) }
.bottom-panel-resize:hover::before { background: #fff }
.bottom-panel.collapsed .bottom-panel-resize { display: none }
.bottom-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; height: 36px; flex-shrink: 0;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--line);
}
.bottom-panel-header:hover { background: var(--card) }
.bottom-panel-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.bottom-panel-toggle {
  margin-left: auto; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px;
  transition: transform .2s;
}
.bottom-panel.collapsed .bottom-panel-toggle { transform: rotate(180deg) }
.bottom-panel-body { flex: 1; overflow-y: auto; padding: 10px 16px }
.bottom-panel.collapsed .bottom-panel-body { display: none }
.bottom-panel.hidden { display: none }

/* ── SETTINGS OVERLAY ────────────────────────────────── */
.settings-overlay {
  position: fixed; top: 0; right: -500px; width: 480px; height: 100vh;
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 100; display: flex; flex-direction: column;
  transition: right .25s ease; box-shadow: -6px 0 32px rgba(0,0,0,.5);
}
.settings-overlay.open { right: 0 }
.settings-header {
  display: flex; align-items: center; padding: 14px 20px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.settings-header h2 { margin: 0; font-size: 16px; flex: 1 }
.settings-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 22px; padding: 0; line-height: 1;
}
.settings-close:hover { color: var(--text) }
.settings-tabs {
  display: flex; border-bottom: 1px solid var(--line); flex-shrink: 0;
  overflow-x: auto;
}
.settings-tab {
  padding: 10px 14px; font-size: 12px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; flex-shrink: 0;
}
.settings-tab:hover { color: var(--text) }
.settings-tab.active { color: var(--accent); border-bottom-color: var(--accent) }
.settings-body { flex: 1; overflow-y: auto; padding: 14px 20px }
.settings-tab-panel { display: none }
.settings-tab-panel.active { display: block }

/* Skills tab */
.skill-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 5px; background: var(--card);
}
.skill-row-name { flex: 1; font-size: 13px }
.skill-row-mode { font-size: 11px; color: var(--muted) }
.skill-row-status { font-size: 12px; margin: 0 4px }
.skill-row-actions { display: flex; gap: 4px }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; font-size: 13px;
  font-family: inherit; text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--accent); text-decoration: none }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark) }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger) }
.btn.success { background: var(--success); border-color: var(--success); color: #fff }
.btn.block { display: flex; justify-content: center; margin-bottom: 8px }
.btn.sm { padding: 5px 10px; font-size: 12px }

/* ── FORMS ───────────────────────────────────────────── */
h1 { margin: 0 0 16px; font-size: 22px }
h2 { font-size: 18px; margin: 0 0 10px }
h3 { font-size: 14px; margin: 0 0 8px }
.field { margin: 10px 0 }
.field.inline { display: flex; align-items: center; gap: 8px; margin-top: 12px }
label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px }
input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%; padding: 8px 11px; background: #FFFFFF;
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: 13px; font-family: inherit;
}
select { width: auto }
textarea { resize: vertical }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 0 }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 0 }
.check input { width: auto }
.radio { display: block; padding: 5px 0; cursor: pointer }
.radio input { margin-right: 8px }

/* ── WIZARD STEPS ────────────────────────────────────── */
.wizard .step {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 12px;
}
.wizard h2 { margin: 0 0 10px; font-size: 14px; color: var(--accent) }
.side-h-form { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px }

/* ── BANNERS ─────────────────────────────────────────── */
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px }
.banner.ok { background: #E4F5EC; border: 1px solid #9DD9BA; color: #145C3B }
.banner.error { background: #FBE7E9; border: 1px solid #E9A6AE; color: #8A1424 }
.banner.warn { background: #FBECDF; border: 1px solid #E7BC94; color: #7A4118 }
.banner.info { background: var(--accent-tint); border: 1px solid #D3AFF5; color: var(--accent-dark) }

/* ── SKILL SETUP (STEP 0) ────────────────────────────── */
#skill-setup { display: none }
.skill-step {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 20px; margin-bottom: 12px;
}
.skill-step h2 { font-size: 14px; color: var(--accent); margin: 0 0 10px }
.skill-step p.sub { color: var(--muted); font-size: 13px; margin: 0 0 12px }
.skip-banner {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 16px;
}
.skip-banner-text { flex: 1 }
.skip-banner-text p { margin: 0 0 4px; font-size: 13px }
.skip-banner-text p.sub { color: var(--muted); margin: 0 }

/* Accordion */
.accordion { display: flex; flex-direction: column; gap: 4px }
.acc-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden }
details.acc-item summary { list-style: none }
details.acc-item summary::-webkit-details-marker { display: none }
.acc-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--panel);
  cursor: pointer; user-select: none;
}
.acc-header:hover { background: var(--card) }
details[open] .acc-header { background: var(--card); border-bottom: 1px solid var(--line) }
.acc-arrow { font-size: 9px; color: var(--muted); transition: transform .15s; flex-shrink: 0 }
details[open] .acc-arrow { transform: rotate(90deg) }
.acc-name { flex: 1; font-size: 13px; font-weight: 500 }
.acc-mode { font-size: 11px; color: var(--muted) }
.acc-status { font-size: 12px; white-space: nowrap }
.acc-body { padding: 14px; background: var(--bg) }
.acc-group { margin-bottom: 14px }
.acc-group h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 8px;
}
.source-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px }
.source-row input[type=text] { flex: 1 }
.source-row .hint-text { font-size: 11px; color: var(--muted); flex-shrink: 0 }
.btn.browse { padding: 6px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0 }
.prefix-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 }
.prefix-row label { margin: 0; white-space: nowrap }
.prefix-row input { width: 120px; flex-shrink: 0 }
.acc-warning {
  background: #FBECDF; border: 1px solid #E7BC94;
  border-radius: 6px; padding: 8px 12px; font-size: 12px;
  color: var(--warn); margin-bottom: 10px;
}

/* Skill summary table */
.skill-summary { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0 }
.skill-summary th {
  text-align: left; padding: 6px 12px; color: var(--muted);
  font-size: 11px; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.skill-summary td { padding: 7px 12px; border-bottom: 1px solid var(--line) }
.skill-summary tr:last-child td { border-bottom: none }
.status-ok { color: var(--success) }
.status-warn { color: var(--warn) }
.status-skip { color: var(--muted) }

/* ── CHANGE WORKSPACE ────────────────────────────────── */
.change-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px }
.pill {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 3px 12px; font-size: 12px; color: var(--muted);
}
.req-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 16px;
}
.req-text { white-space: pre-wrap; margin: 0; color: var(--text-sec); font-size: 13px }

/* Phase progress in main workspace */
.phase-progress { display: flex; flex-direction: column; gap: 8px; padding-bottom: 36px }
.phase-prog-item { display: flex; align-items: center; gap: 10px; font-size: 13px }
.phase-prog-item .pp-icon { width: 22px; text-align: center; flex-shrink: 0 }
.phase-prog-item .pp-label { color: var(--text-sec) }
.phase-prog-item.pending .pp-label { color: var(--muted) }

/* Build track progress */
.build-tracks { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 }
.track { display: flex; align-items: center; gap: 10px }
.track-label { width: 160px; font-size: 13px; color: var(--text-sec); flex-shrink: 0 }
.track-bar { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden }
.track-fill { height: 100%; background: var(--accent); border-radius: 4px }
.track-fill.done { background: var(--success) }
.track-pct { width: 36px; font-size: 12px; color: var(--muted); text-align: right }

/* ── OUTPUT VIEWER (bottom panel) ────────────────────── */
.panel .card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px;
}
.card.gate { border-color: var(--success) }
.card.error { border-color: var(--danger) }
.card h2 { margin: 0 0 8px; font-size: 13px }
.summary { font-size: 14px; font-weight: 600; margin: 0 0 8px }
.files { list-style: none; margin: 8px 0; padding: 0 }
.files li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 8px; margin-bottom: 4px; background: var(--panel);
}
.files .fi { font-size: 14px; flex-shrink: 0 }
.files .fn { flex: 1; font-family: Consolas, monospace; font-size: 12px }
.files .fa { display: flex; align-items: center; gap: 8px; flex-shrink: 0 }
.files .fa a { font-size: 12px }

/* Status badges */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.badge.pass { background: #E4F5EC; color: var(--success); border: 1px solid #9DD9BA }
.badge.warning { background: #FBECDF; color: var(--warn); border: 1px solid #E7BC94 }
.badge.fail { background: #FBE7E9; color: var(--danger); border: 1px solid #E9A6AE }
.badge.pending { background: var(--panel); color: var(--muted); border: 1px solid var(--line) }

.reject-box { margin: 8px 0 }
.gate-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px }

/* Read-only badge shown in historical phase view (no action buttons) */
.historical-badge {
  margin-top: 14px; padding: 9px 14px; border-radius: 8px;
  background: #E4F5EC; border: 1px solid #9DD9BA;
  color: #145C3B; font-size: 12px; font-weight: 600;
}
.err { white-space: pre-wrap; background: #FBE7E9; padding: 10px; border-radius: 8px; color: #8A1424; font-size: 12px }

/* Inline markdown editor */
.md-editor { display: none; flex-direction: column; gap: 6px; margin-top: 8px }
.md-editor.open { display: flex }
.md-editor textarea { min-height: 100px; font-family: Consolas, monospace; font-size: 12px }
.md-editor-actions { display: flex; gap: 6px; justify-content: flex-end }

/* ── JIRA PANEL ──────────────────────────────────────── */
.jira-panel {
  margin-top: 10px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); font-size: 12px;
}
.jira-panel.connected { border-color: var(--success) }
.jira-panel.disconnected { border-color: var(--line) }
.jira-panel .jp-actions { margin-top: 6px; display: flex; gap: 6px }

/* ── FILE VIEWER ─────────────────────────────────────── */
.filebody {
  white-space: pre-wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; font-family: Consolas, monospace;
  font-size: 13px; line-height: 1.5; margin: 0;
}

/* ── INLINE OUTPUT VIEWER ────────────────────────────── */
.output-viewer-section {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 2px solid var(--line);
}
.output-viewer-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.output-viewer-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.output-viewer-phase-label {
  font-size: 12px; color: var(--accent); font-style: italic;
}

/* Clickable phase history links in phase-progress list */
.phase-hist-link {
  color: var(--accent); text-decoration: none;
}
.phase-hist-link:hover { text-decoration: underline }

/* ── SPINNER ─────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg) } }
.muted { color: var(--muted) }

/* ── VIEW SECTIONS ───────────────────────────────────── */
.view { display: none }

/* ── PRIMARY NAV (sidebar) ───────────────────────────── */
.nav-primary { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-sec); font-size: 13px; font-weight: 500;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.nav-btn:hover { background: var(--card); border-color: var(--line); text-decoration: none }
.nav-btn.active { background: var(--card); border-color: var(--accent); color: var(--accent) }
.nav-btn .nav-icon { font-size: 16px; flex-shrink: 0 }
.sidebar-divider { height: 1px; background: var(--line); margin: 8px 0 }

/* ── OPTION CARDS (home page) ────────────────────────── */
.home-welcome { margin-bottom: 24px }
.home-welcome h1 { margin: 0 0 6px; font-size: 24px }
.home-welcome p { margin: 0; color: var(--muted); font-size: 14px }
.option-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px }
.option-card {
  background: var(--card); border: 2px solid var(--line);
  border-radius: 16px; padding: 28px 24px;
  cursor: pointer; transition: border-color .2s, transform .15s;
  display: flex; flex-direction: column; text-decoration: none;
}
.option-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none }
.option-card.primary-action { border-color: var(--accent) }
.oc-icon { font-size: 36px; margin-bottom: 14px }
.oc-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px }
.oc-desc { color: var(--text-sec); font-size: 13px; line-height: 1.65; flex: 1 }
.oc-flow { color: var(--muted); font-size: 12px; margin: 10px 0 0 }
.oc-cta { margin-top: 22px }
.oc-cta .btn { pointer-events: none }

/* ── SKILLS CONTEXT PICKER ───────────────────────────── */
.skills-page-header { margin-bottom: 20px }
.skills-page-header h1 { margin: 0 0 4px; font-size: 22px }
.skills-page-header p { margin: 0; color: var(--muted); font-size: 13px }
.context-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px }
.context-card {
  background: var(--card); border: 2px solid var(--line);
  border-radius: 14px; padding: 26px 22px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.context-card:hover { border-color: var(--accent) }
.context-card.selected { border-color: var(--accent); background: var(--accent-tint) }
.cc-icon { font-size: 30px; margin-bottom: 12px }
.cc-title { font-size: 16px; font-weight: 700; margin-bottom: 8px }
.cc-desc { color: var(--muted); font-size: 13px; line-height: 1.55 }
.cc-best { margin-top: 10px; font-size: 12px; color: var(--text-sec); padding-top: 10px; border-top: 1px solid var(--line) }
.cc-best strong { color: var(--text) }

/* ── SKILL CARDS (configure view) ────────────────────── */
.skills-configure-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.skills-configure-header h2 { margin: 0; font-size: 18px; flex: 1 }
.ctx-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px; font-size: 12px;
}
.ctx-badge.ootb { background: var(--accent-tint); color: var(--accent-dark); border: 1px solid var(--accent) }
.ctx-badge.project { background: #E4F5EC; color: var(--success); border: 1px solid var(--success) }

.skills-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 80px }
.skill-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden }
.skill-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--panel);
  cursor: pointer; user-select: none;
}
.skill-card-header:hover { background: var(--card) }
.skill-card.expanded .skill-card-header { border-bottom: 1px solid var(--line) }
.skill-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.skill-num.done { background: var(--success); color: #fff }
.sk-name { flex: 1; font-size: 13px; font-weight: 600 }
.sk-status { font-size: 12px; color: var(--muted) }
.sk-status.done { color: var(--success) }
.sk-arrow { font-size: 10px; color: var(--muted); transition: transform .2s; flex-shrink: 0; margin-left: 4px }
.skill-card.expanded .sk-arrow { transform: rotate(90deg) }
.skill-card-body { padding: 16px 18px; display: none }
.skill-card.expanded .skill-card-body { display: block }
.sk-purpose { color: var(--muted); font-size: 12px; margin: 0 0 14px; line-height: 1.5 }
.sk-auto-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px;
  background: #0a2e22; color: var(--success); border: 1px solid #0e4a2e;
  margin-bottom: 10px;
}

/* Path groups within skill card */
.path-group { margin-bottom: 16px }
.path-group:last-child { margin-bottom: 0 }
.path-group-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.pg-badge {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.pg-badge.ootb { background: #0d2040; color: #5ba7f5; border: 1px solid #194070 }
.pg-badge.project { background: #0a2e22; color: #00d4a8; border: 1px solid #0e4a2e }
.pg-label-text { font-size: 12px; color: var(--muted); font-weight: 600 }

.path-item { margin-bottom: 10px }
.path-item > label { color: var(--text-sec); font-size: 12px; margin-bottom: 4px; font-weight: 500 }
.path-item .path-suggest { color: var(--muted); font-size: 11px; margin: 3px 0 0 }
.path-input-row { display: flex; gap: 8px; align-items: center }
.path-input-row input[type=text] { flex: 1 }
.path-input-row .btn.browse { flex-shrink: 0 }

/* Mixed file box */
.mixed-file-box {
  background: #1c1800; border: 1px solid #6b5312;
  border-radius: 10px; padding: 14px 16px; margin: 10px 0;
}
.mf-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--warn); font-size: 13px; margin-bottom: 8px;
}
.mf-explain {
  color: var(--text-sec); font-size: 12px; line-height: 1.65; margin-bottom: 12px;
}
.mf-explain strong { color: var(--warn) }
.mf-prefix-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
.mf-prefix-row label { color: var(--text-sec); font-size: 13px; white-space: nowrap; margin: 0 }
.mf-prefix-row input { width: 130px }
.mf-example {
  margin-top: 10px; padding: 8px 10px; border-radius: 6px;
  background: #0a1520; font-size: 11px; color: var(--muted);
  min-height: 30px; line-height: 1.6;
}
.mf-example .ex-custom { color: var(--warn) }
.mf-example .ex-ootb { color: var(--success) }

/* Per-skill save action row (injected by JS) */
.skill-card-actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
}
.skill-save-status { font-size: 12px; color: var(--muted) }
.skill-save-status.ok  { color: var(--success) }
.skill-save-status.err { color: var(--danger)  }

/* Skill progress & save bar */
.skills-save-bar {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--panel); border-top: 2px solid var(--line);
  padding: 12px 18px; display: flex; align-items: center; gap: 14px;
  margin: 0 -28px;
}
.skill-dots { display: flex; gap: 5px; align-items: center }
.skill-dots .sd { width: 8px; height: 8px; border-radius: 50%; background: var(--line) }
.skill-dots .sd.done { background: var(--success) }
.skill-dots .sd.auto { background: var(--accent) }
.skill-dots-label { font-size: 12px; color: var(--muted) }
.skills-save-bar .spacer { flex: 1 }

/* ── KNOWLEDGE BASE CHATBOT ──────────────────────────── */
.chat-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  transition: transform .12s ease, background .12s ease;
}
.chat-fab:hover { transform: scale(1.06); background: #0a74c9 }

.chat-widget {
  position: fixed; bottom: 22px; right: 22px; z-index: 61;
  width: 380px; max-width: calc(100vw - 32px);
  height: 540px; max-height: calc(100vh - 90px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.55);
  display: none; flex-direction: column; overflow: hidden;
}
.chat-widget.open { display: flex }

.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--card);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.chat-title { font-weight: 700; font-size: 14px; flex: 1 }
.chat-close {
  background: none; border: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.chat-close:hover { color: var(--text) }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 88%; padding: 10px 13px; border-radius: 12px;
  font-size: 13px; line-height: 1.6; word-wrap: break-word; white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.bot {
  align-self: flex-start; background: var(--card); color: var(--text-sec);
  border: 1px solid var(--line); border-bottom-left-radius: 3px;
}
.chat-msg.bot.thinking { color: var(--muted) }
.chat-msg.bot.error { border-color: var(--danger); color: var(--warn) }

.chat-citations {
  margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line);
}
.chat-citations .cite-head {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.chat-citations ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px }
.chat-citations li { font-size: 12px; line-height: 1.5 }
.chat-citations .cite-src {
  display: block; color: var(--accent); font-family: Consolas, monospace;
  font-size: 11px; word-break: break-all;
}
.chat-citations .cite-snippet { display: block; color: var(--muted); font-size: 11px; margin-top: 2px }

.chat-input-row {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px; border-top: 1px solid var(--line);
  background: var(--card); flex-shrink: 0;
}
.chat-input-row textarea {
  flex: 1; resize: none; max-height: 120px;
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
  font-family: inherit; line-height: 1.5;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--accent) }
.chat-input-row .btn { flex-shrink: 0 }

/* ── PROFILE DROPDOWN ─────────────────────────────────── */
.profile { position: relative }
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--text);
  cursor: pointer; font: inherit; padding: 4px 6px; border-radius: 8px;
}
.profile-btn:hover { background: var(--card) }
.profile-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.profile-name { font-size: 13px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.profile-caret { font-size: 10px; color: var(--muted) }
.profile-menu {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
  min-width: 240px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.55); z-index: 50;
  overflow: hidden; padding: 6px;
}
.profile-menu.open { display: block }
.profile-info {
  display: flex; gap: 12px; align-items: center;
  padding: 16px 14px;
  background: linear-gradient(135deg, rgba(161,0,255,.18), rgba(161,0,255,0));
  border-radius: 8px; margin-bottom: 6px;
}
.profile-info-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #6C5CE7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  box-shadow: 0 0 0 3px rgba(161,0,255,.25);
}
.profile-info-text { min-width: 0 }
.profile-info-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.profile-info-email { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px }
.profile-info-text .role-badge { margin-top: 7px }
.profile-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; font-size: 13px; color: var(--text-sec);
  border-radius: 8px; transition: background .12s ease, color .12s ease;
}
.profile-item:hover { background: var(--card); color: var(--text); text-decoration: none }
.profile-item-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; opacity: .8 }

/* Role badge — shared by profile dropdown + users table, colour-coded by role */
.role-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 8px; border-radius: 10px; border: 1px solid currentColor;
}
.role-badge.role-admin   { color: var(--danger, #e5484d) }
.role-badge.role-builder { color: var(--accent) }
.role-badge.role-viewer  { color: var(--muted) }

/* ── USERS TABLE ──────────────────────────────────────── */
.users-table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden;
}
.users-table th, .users-table td {
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.users-table thead th { background: var(--panel) }
.users-table th {
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.users-table tbody tr:last-child td { border-bottom: none }
.users-table tbody tr { transition: background .12s ease }
.users-table tbody tr:hover { background: rgba(255,255,255,.03) }
.users-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap }
.users-table .users-actions .btn.sm { padding: 4px 8px; font-size: 12px }
/* username cell: avatar + name/subtitle stacked */
.user-cell { display: flex; align-items: center; gap: 10px }
.user-cell-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #6C5CE7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-cell-text { display: flex; flex-direction: column; min-width: 0 }
.user-cell-name { font-weight: 600; line-height: 1.3 }
.user-cell-sub { font-size: 11px; color: var(--muted); line-height: 1.3 }

/* ── MODAL ────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55); align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex }
.modal-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; width: 380px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.modal-header { display: flex; align-items: center; margin-bottom: 8px }
.modal-header h3 { flex: 1; margin: 0 }

/* ── LOGIN PAGE ───────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; overflow: auto; background: var(--bg);
}
.login-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 28px 32px; width: 340px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.login-card h1 { margin: 0 0 16px; font-size: 20px }
.login-error {
  background: #2b1414; border: 1px solid #5c1e1e;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; margin: 0 0 12px;
}

/* ── FEEDBACK BUTTON ──────────────────────────────────────────────── */
.btn.amber {
  background: #B7791F; color: #fff;
  border: 1px solid #B7791F;
}
.btn.amber:hover { background: #975A16; border-color: #975A16; }

/* ── FEEDBACK MODAL ───────────────────────────────────────────────── */
.fb-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
}
.fb-modal-backdrop.hidden { display: none; }
.fb-modal {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 28px 32px;
  width: 540px; max-width: 94vw; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 16px 52px rgba(0,0,0,.6);
}
.fb-steps { display: flex; gap: 5px; margin-bottom: 20px; }
.fb-step-dot {
  height: 4px; flex: 1; border-radius: 2px;
  background: var(--line); transition: background .2s;
}
.fb-step-dot.active { background: var(--accent); }
.fb-step-dot.done   { background: var(--success); }
.fb-modal-hdr { display: flex; align-items: center; margin-bottom: 4px; }
.fb-modal-hdr h3 { flex: 1; margin: 0; font-size: 17px; }
.fb-modal-hdr > button {
  background: none; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 0 2px;
}
.fb-modal-hdr > button:hover { color: var(--text); }
.fb-modal-sub { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.fb-view-all-link {
  display: block; text-align: right; font-size: 12px;
  color: var(--accent); cursor: pointer; margin-bottom: 14px; text-decoration: none;
}
.fb-view-all-link:hover { text-decoration: underline; }

/* Change request selection list */
.fb-change-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 20px; max-height: 300px; overflow-y: auto;
}
.fb-change-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.fb-change-item:hover  { border-color: var(--accent); background: rgba(161,0,255,.06); }
.fb-change-item.selected { border-color: var(--accent); background: rgba(161,0,255,.13); }
.fb-change-item input[type=radio] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.fb-change-meta { flex: 1; min-width: 0; }
.fb-change-id   { font-size: 13px; font-weight: 600; color: var(--text); }
.fb-change-name { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Ratings */
.fb-ratings {
  background: var(--panel); border-radius: 8px;
  padding: 12px 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.fb-rating-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fb-rating-label { width: 155px; flex-shrink: 0; color: var(--text-sec); }
.star-rating { display: flex; gap: 2px; }
.star-rating .star {
  font-size: 21px; cursor: pointer; color: var(--muted);
  transition: color .1s; user-select: none; line-height: 1;
}
.star-rating .star.lit   { color: #F6C90E; }
.star-rating .star:hover { color: #F6C90E; }
.reuse-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.reuse-btn {
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; cursor: pointer; background: transparent;
  color: var(--text-sec); transition: all .15s;
}
.reuse-btn:hover    { border-color: var(--accent); color: var(--text); }
.reuse-btn.selected { border-color: var(--accent); background: rgba(161,0,255,.15); color: var(--text); }

/* Text area */
.fb-textarea {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 10px 12px; font-size: 13px;
  font-family: inherit; box-sizing: border-box;
}
.fb-textarea:focus { border-color: var(--accent); outline: none; }
.fb-char-count { font-size: 11px; color: var(--muted); text-align: right; margin-top: 3px; }

/* Step 3 success */
.fb-success { text-align: center; padding: 20px 0 8px; }
.fb-tick { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.fb-success-path {
  font-size: 12px; color: var(--accent); background: var(--panel);
  padding: 6px 12px; border-radius: 6px; font-family: monospace;
  display: inline-block; margin: 0 0 12px; word-break: break-all;
}

/* Modal footer */
.fb-modal-footer { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.fb-modal-footer .spacer { flex: 1; }

/* ── FEEDBACK VIEWER ──────────────────────────────────────────────── */
.fb-viewer-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: var(--bg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .28s ease;
}
.fb-viewer-overlay.open { transform: translateX(0); }
.fb-viewer-header {
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
  background: var(--panel);
}
.fb-viewer-header h2 { margin: 0; flex: 1; font-size: 18px; }
.fb-viewer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.fb-filter-row { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.fb-filter-btn {
  padding: 5px 14px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; background: transparent; color: var(--text-sec); cursor: pointer;
  transition: all .15s;
}
.fb-filter-btn:hover  { border-color: var(--accent); color: var(--text); }
.fb-filter-btn.active { border-color: var(--accent); background: rgba(161,0,255,.15); color: var(--text); }

/* Entry cards */
.fb-entry {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 10px;
}
.fb-entry-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.fb-entry-id   { font-weight: 600; font-size: 13px; color: var(--accent); }
.fb-entry-time { font-size: 12px; color: var(--muted); flex: 1; }
.fb-entry-actions { display: flex; gap: 6px; }
.fb-entry-stars {
  display: flex; gap: 14px; font-size: 12px;
  color: var(--text-sec); margin-bottom: 7px; flex-wrap: wrap;
}
.fb-entry-comment {
  font-size: 13px; color: var(--text); line-height: 1.55;
  margin-bottom: 4px; white-space: pre-wrap; word-break: break-word;
}
.fb-entry-related { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 3px; }
.fb-entry-edited  { font-size: 11px; color: var(--warn); margin-top: 4px; }
.fb-entry-edit-area {
  width: 100%; min-height: 80px; resize: vertical;
  background: var(--bg); border: 1px solid var(--accent);
  border-radius: 6px; color: var(--text); padding: 8px 10px;
  font-size: 13px; font-family: inherit; box-sizing: border-box; margin-top: 8px;
}
.fb-entry-edit-actions { display: flex; gap: 6px; margin-top: 8px; }
.fb-confirm-delete {
  background: rgba(214,48,49,.1); border: 1px solid #D63031;
  border-radius: 6px; padding: 8px 12px; font-size: 12px;
  color: #ff7675; margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.fb-empty { text-align: center; padding: 56px 0; color: var(--muted); font-size: 14px; }
.sidebar-bottom .sidebar-link { display: block; margin-bottom: 2px; }

