/* ── LuxGPT-OS v0.5b — brand redesign with Day/Night themes ───── */

/* Brand constants — mirror of BRAND.colorPrimary / BRAND.colorAccent
 * in modules/brand.js. Stylesheet rules read these CSS vars; JS-side
 * rendering reads BRAND.* . Keep both in sync when rebranding. */
:root {
  --lux-red: #ED2939;   /* Luxembourg flag red (official) — mirror of BRAND.colorPrimary */
  --gpt-blue: #00A1DE;  /* Luxembourg flag light blue (official) — mirror of BRAND.colorAccent */
}

/* ── NIGHT theme (default) ─────────────────────────────────── */
:root,
:root[data-theme="night"] {
  --bg:               #08080f;
  --bg-header:        rgba(8, 8, 15, 0.92);
  --bg-footer:        rgba(8, 8, 15, 0.96);
  --bg-input:         #0d0d18;
  --bg-msg-ai:        linear-gradient(135deg, #13131e, #0f0f1a);
  --bg-msg-user:      linear-gradient(135deg, #ED293922, #ED29390a);
  --bg-elevated:      #12121e;
  --border:           #1e1e2e;
  --border-strong:    #2e2e42;
  --border-msg-ai:    #2a2a3e;
  --border-msg-user:  #ED293960;
  --text-primary:     #d0d0de;
  --text-user:        #ededf4;
  --text-meta:        #7a7a92;
  --text-label:       #6a6a82;
  --scrollbar:        #3a3a50;
  --glow-blue:        #00A1DE10;
  --glow-red:         #ED293910;
  --logo-ink:         #ffffff;
  --logo-tagline:     #b0b4ba;
  --msg-shadow:       0 2px 14px rgba(0, 0, 0, 0.4);
  --theme-track-bg:   linear-gradient(135deg, #1a2244, #0f1730);
  --theme-thumb-bg:   linear-gradient(135deg, #233060, #0a1228);
}

/* ── DAY theme ─────────────────────────────────────────────── */
:root[data-theme="day"] {
  --bg:               #f0ede6;
  --bg-header:        rgba(240, 237, 230, 0.92);
  --bg-footer:        rgba(240, 237, 230, 0.96);
  --bg-input:         #ffffff;
  --bg-msg-ai:        linear-gradient(135deg, #ffffff, #f9f7f4);
  --bg-msg-user:      linear-gradient(135deg, #ED29391a, #ED293906);
  --bg-elevated:      #f7f4eb;
  --border:           #d0cbc0;
  --border-strong:    #b8b2a6;
  --border-msg-ai:    #e5e0d8;
  --border-msg-user:  #ED293950;
  --text-primary:     #2e2c24;
  --text-user:        #1a1410;
  --text-meta:        #706858;
  --text-label:       #887e6e;
  --scrollbar:        #ccc4b4;
  --glow-blue:        #00A1DE12;
  --glow-red:         #ED29390a;
  --logo-ink:         #111111;
  --logo-tagline:     #5F6368;
  --msg-shadow:       0 2px 14px rgba(0, 0, 0, 0.06);
  --theme-track-bg:   linear-gradient(135deg, #ffcb7a, #ff8a3d);
  --theme-thumb-bg:   linear-gradient(135deg, #fff4d0, #ffd27a);
}

/* ── Reset & base ──────────────────────────────────────────── */

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

html {
  transition: background-color 0.4s ease;
}

html, body {
  height: 100%;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg);
  transition: background 0.4s ease, color 0.4s ease;
}

body {
  display: flex;
  flex-direction: column;
  min-width: 640px;
  overflow: hidden;
  height: 100vh;
}

/* ── App layout with collapsible sidebar ─────────────────── */

#app-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  margin-left: 56px; /* reserve space for the fixed sidebar */
}

/* ── Ambient background glows ─────────────────────────────── */

.ambient-glow {
  position: fixed;
  width: 60vw;
  height: 60vw;
  max-width: 900px;
  max-height: 900px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  transition: background 0.4s ease;
}

.glow-blue {
  top: -20vw;
  left: -20vw;
  background: radial-gradient(circle, var(--glow-blue), transparent 70%);
}

.glow-red {
  bottom: -20vw;
  right: -20vw;
  background: radial-gradient(circle, var(--glow-red), transparent 70%);
}

/* ── Header ────────────────────────────────────────────────── */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  height: 54px;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.wordmark {
  font-family: 'DM Mono', monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

.wordmark-lux { color: var(--lux-red); }
.wordmark-gpt { color: var(--gpt-blue); }

.version-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-label);
  letter-spacing: 1px;
  margin-top: 1px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

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

/* ── Provider badge ───────────────────────────────────────── */

.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px 4px 8px;
  border-radius: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  white-space: nowrap;
  text-transform: uppercase;
  transition: background 0.4s ease, border-color 0.4s ease;
  cursor: pointer;
}

.provider-badge:hover {
  border-color: var(--gpt-blue);
}

.provider-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gpt-blue);
  box-shadow: 0 0 6px var(--gpt-blue);
}

.provider-badge.provider-badge-local::before {
  background: #5eda7f;
  box-shadow: 0 0 6px #5eda7f;
}

.provider-badge.provider-badge-external::before {
  background: var(--gpt-blue);
  box-shadow: 0 0 6px var(--gpt-blue);
}

.badge-level {
  font-size: 9px;
  margin-left: 4px;
  font-weight: 600;
  opacity: 0.9;
}

.badge-level-public              { color: #5eda7f; }
.badge-level-internal            { color: #ffb43c; }
.badge-level-confidential        { color: #e8853a; }
.badge-level-strictly_confidential { color: var(--lux-red); }
.badge-level-missing             { color: var(--lux-red); font-weight: 700; }

.change-level-btn {
  background: none;
  border: none;
  color: var(--text-meta);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.change-level-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.change-level-btn.hidden {
  display: none;
}

/* ── LLM dropdown (compact popup) ────────────────────────── */

.llm-dropdown {
  position: fixed;
  z-index: 1001;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 0;
  min-width: 240px;
  max-width: 340px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  animation: pm-pop 0.12s ease-out;
}

.llm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-primary);
  transition: background 0.1s;
}

.llm-dropdown-item:hover:not(.llm-dropdown-disabled) {
  background: var(--bg-input);
}

.llm-dropdown-disabled {
  opacity: 0.35;
  cursor: default;
}

.llm-dropdown-dot {
  font-size: 10px;
  flex-shrink: 0;
}

.llm-dropdown-name {
  flex: 1;
}

.llm-dropdown-suffix {
  font-size: 9px;
  color: var(--text-meta);
  margin-left: auto;
}

.llm-dropdown-check {
  color: #5eda7f;
  font-size: 13px;
  margin-left: auto;
}

/* ── Mode toggle (Single / Team) ──────────────────────────── */

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.mode-toggle button {
  background: transparent;
  border: none;
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 4px 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: background 0.15s, color 0.15s;
}

.mode-toggle button:hover {
  color: var(--text-primary);
}

.mode-toggle button.active {
  background: var(--gpt-blue);
  color: #fff;
  font-weight: 600;
}

.mode-toggle button[data-mode="team"].active {
  background: var(--lux-red);
}

/* ── Status indicator ─────────────────────────────────────── */

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5eda7f;
  box-shadow: 0 0 6px #5eda7f;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ── Theme toggle ─────────────────────────────────────────── */

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-block;
}

.theme-toggle-track {
  display: block;
  width: 52px;
  height: 26px;
  border-radius: 13px;
  background: var(--theme-track-bg);
  position: relative;
  transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-strong);
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--theme-thumb-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

:root[data-theme="day"] .theme-toggle-thumb {
  transform: translateX(26px);
}

.theme-icon-day  { display: none; }
.theme-icon-night { display: inline; color: #e8e8f0; }

:root[data-theme="day"] .theme-icon-day   { display: inline; color: #ff6a00; }
:root[data-theme="day"] .theme-icon-night { display: none; }

/* ── Icon buttons (audit, settings) ───────────────────────── */

.icon-btn {
  background: none;
  border: none;
  color: var(--text-meta);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ── Messages area ────────────────────────────────────────── */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 26px 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Consistent scrollbar styling across all scrollable areas (Firefox) */
#messages,
.admin-main,
.history-main,
.documents-main,
.skills-main,
.briefing-main,
.compliance-main,
.admin-table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

/* Consistent scrollbar styling across all scrollable areas (Webkit) */
#messages::-webkit-scrollbar,
.admin-main::-webkit-scrollbar,
.history-main::-webkit-scrollbar,
.documents-main::-webkit-scrollbar,
.skills-main::-webkit-scrollbar,
.briefing-main::-webkit-scrollbar,
.compliance-main::-webkit-scrollbar,
.admin-table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }

#messages::-webkit-scrollbar-track,
.admin-main::-webkit-scrollbar-track,
.history-main::-webkit-scrollbar-track,
.documents-main::-webkit-scrollbar-track,
.skills-main::-webkit-scrollbar-track,
.briefing-main::-webkit-scrollbar-track,
.compliance-main::-webkit-scrollbar-track,
.admin-table-wrapper::-webkit-scrollbar-track { background: transparent; }

#messages::-webkit-scrollbar-thumb,
.admin-main::-webkit-scrollbar-thumb,
.history-main::-webkit-scrollbar-thumb,
.documents-main::-webkit-scrollbar-thumb,
.skills-main::-webkit-scrollbar-thumb,
.briefing-main::-webkit-scrollbar-thumb,
.compliance-main::-webkit-scrollbar-thumb,
.admin-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

.date-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 660px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-label);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.date-line {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.date-text { flex-shrink: 0; }

.message {
  max-width: 72%;
  width: fit-content;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.75;
  font-family: 'Crimson Pro', Georgia, serif;
  word-wrap: break-word;
  /* No global pre-wrap — assistant bubbles render markdown HTML where
     pre-wrap turns inter-tag whitespace into visible blank lines.
     Plain-text bubbles (user / system / error) opt back in below so
     manual newlines from Shift+Enter still display. */
  border: 1px solid transparent;
  box-shadow: var(--msg-shadow);
  animation: fadeUp 0.3s ease;
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.message.user,
.message.system,
.message.error {
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: var(--bg-msg-user);
  border-color: var(--border-msg-user);
  color: var(--text-user);
  border-radius: 16px 4px 16px 16px;
  margin-right: calc(50% - 330px);
}

.message.assistant {
  align-self: flex-start;
  background: var(--bg-msg-ai);
  border-color: var(--border-msg-ai);
  color: var(--text-primary);
  border-radius: 4px 16px 16px 16px;
  margin-left: calc(50% - 330px);
  position: relative;
  padding-top: 32px;
}

.message.assistant::before {
  content: "◆ Luxios";
  position: absolute;
  top: 10px;
  left: 18px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-label);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.message.assistant.team-response::before {
  content: "◆ Virtual Company";
  color: var(--lux-red);
}

.message.system {
  align-self: center;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text-meta);
  font-size: 12px;
  font-style: italic;
  padding: 4px 12px;
  max-width: 90%;
  text-align: center;
}

.message.error {
  align-self: center;
  background: rgba(237, 41, 57, 0.12);
  border: 1px solid var(--border-msg-user);
  color: var(--lux-red);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: none;
}

/* Team-chat author label rendered above the bubble content (multi-user only).
   addMessage only emits this element when opts.username is passed. */
.message-header {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-meta);
  margin-bottom: 4px;
}

.message-content {
  /* Neutral wrapper — inherits the bubble's font/color. Exists so streaming
     callers can targetit without wiping the header / ::before badge. */
}

/* Tighten vertical spacing of markdown-rendered content inside assistant
   bubbles. Browser defaults (1em) plus the bubble's line-height: 1.75
   produce too much air between paragraphs / lists / headings. Selectors
   target direct + descendant children of .message-content so they apply
   to assistant markdown but don't leak into the message-header / sources
   block / timestamp block which sit alongside (not inside) it. */
.message-content > p {
  margin: 0.4em 0;
}
.message-content > p:first-child { margin-top: 0; }
.message-content > p:last-child  { margin-bottom: 0; }

.message-content > ul,
.message-content > ol {
  margin: 0.4em 0;
  padding-left: 1.5em;
}

.message-content li {
  margin: 0.15em 0;
}

.message-content > h1,
.message-content > h2,
.message-content > h3,
.message-content > h4 {
  margin-top: 0.9em;
  margin-bottom: 0.3em;
  line-height: 1.3;
}

.message-content > h1:first-child,
.message-content > h2:first-child,
.message-content > h3:first-child,
.message-content > h4:first-child {
  margin-top: 0;
}

.message-content > hr {
  margin: 0.7em 0;
  border: none;
  border-top: 1px solid var(--border-strong);
  opacity: 0.4;
}

.message-content > blockquote {
  margin: 0.5em 0;
  padding-left: 0.8em;
  border-left: 3px solid var(--border-strong);
  color: var(--text-meta);
}

.message-content > pre {
  margin: 0.5em 0;
}

.message-content table {
  margin: 0.5em 0;
}

/* @luxgpt mention highlight — only rendered in multi-user chats. */
.mention-luxgpt {
  color: var(--lux-red);
  background: rgba(237, 41, 57, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}

/* Typing indicator (Patch 7) — subtle italic line below the messages, above
   the composer. Intentionally understated; shouldn't compete with content. */
.typing-indicator {
  padding: 4px 16px 6px;
  color: var(--text-meta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 13px;
  line-height: 1.4;
}

/* Self-entry in participants popup: subtle red left border to distinguish
   "Du / You" from the other rows without shouting. */
.participants-popup-self {
  border-left: 2px solid var(--lux-red);
  padding-left: 10px;
}

/* Status-line colouring in the participants popup. */
.participant-status {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
}
.participant-status-active    { color: #5eda7f; }
.participant-status-caught_up { color: var(--text-meta); }
.participant-status-behind    { color: var(--lux-red); font-weight: 600; }
.participant-status-never     { color: var(--text-meta); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .message.user,
  .message.assistant {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ── Loading indicator ────────────────────────────────────── */

#loading {
  display: flex;
  gap: 6px;
  padding: 0 24px 8px;
  justify-content: center;
  flex-shrink: 0;
  z-index: 2;
}

#loading.hidden { display: none; }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-meta);
  animation: bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ── Input footer ─────────────────────────────────────────── */

#input-bar {
  background: var(--bg-footer);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 12px 22px 14px;
  flex-shrink: 0;
  z-index: 10;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.privacy-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.privacy-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #5eda7f;
  box-shadow: 0 0 6px #5eda7f;
}

.privacy-line.external .privacy-dot {
  background: var(--gpt-blue);
  box-shadow: 0 0 6px var(--gpt-blue);
}

.input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}

#message-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 11px 16px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-user);
  background: var(--bg-input);
  outline: none;
  max-height: 160px;
  transition: border-color 0.15s, background 0.4s ease, color 0.4s ease;
}

#message-input:focus {
  border-color: var(--gpt-blue);
  box-shadow: 0 0 0 3px rgba(0, 161, 222, 0.1);
}

#message-input::placeholder {
  color: var(--text-meta);
  font-style: italic;
}

#send-btn {
  background: linear-gradient(135deg, var(--lux-red), #c9222e);
  border: none;
  color: #fff;
  font-size: 16px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(237, 41, 57, 0.35);
  transition: opacity 0.15s, box-shadow 0.15s, background 0.15s;
}

#send-btn:hover {
  box-shadow: 0 3px 14px rgba(237, 41, 57, 0.5);
  opacity: 0.95;
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

#send-btn.stop-mode {
  background: linear-gradient(135deg, #444, #222);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#send-btn.stop-mode:hover {
  background: linear-gradient(135deg, #555, #333);
}

.input-hint {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-label);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

/* ── Settings modal ───────────────────────────────────────── */

/* Settings, approval, consent — overlay/positioning rules removed in
   Phase 2b (now provided by .modal-overlay from modules/modal.js). The
   `#settings-overlay` / `#approval-overlay` / `#consent-overlay` IDs
   no longer exist in the DOM. fade-in keyframe is shared with the
   modal primitive. */

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.settings-modal-card {
  width: 560px;
  max-width: 90vw;
  font-family: 'Crimson Pro', Georgia, serif;
}

/* v1.11 C.5.5 — My Bridge Activity section inside Settings */
.settings-bridge-activity-section { margin-top: 12px; }
.settings-bridge-activity-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-bridge-activity-header label { margin: 0 !important; flex: 1; }
.settings-bridge-activity-hint {
  margin: 4px 0 8px 0;
  font-size: 0.85em;
  color: var(--text-muted, var(--text-meta));
}
.settings-bridge-activity-table-wrapper {
  max-height: 260px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
}
.settings-bridge-activity-table {
  font-size: 10px;
  width: 100%;
}
.settings-bridge-activity-table th,
.settings-bridge-activity-table td {
  white-space: nowrap;
  padding: 4px 8px;
}

.settings-modal-card label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  margin-bottom: 4px;
}

.settings-modal-card label:first-child {
  margin-top: 0;
}

.settings-modal-card input,
.settings-modal-card select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-user);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.settings-modal-card input:focus,
.settings-modal-card select:focus {
  border-color: var(--gpt-blue);
}

.settings-modal-card select {
  appearance: none;
  cursor: pointer;
}

.settings-modal-card select option:disabled {
  color: var(--text-label);
}

.provider-info {
  font-size: 12px;
  color: var(--text-meta);
  margin-top: -4px;
  line-height: 1.4;
  font-style: italic;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: opacity 0.15s;
}

#settings-save {
  background: linear-gradient(135deg, var(--lux-red), #c9222e);
  color: #fff;
}

#settings-cancel {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.modal-actions button:hover { opacity: 0.85; }

/* ── Approval modal ───────────────────────────────────────── */

/* ── Approval modal (Phase 2b — overlay/positioning provided by .modal-overlay) */

.approval-modal-card {
  border: 1.5px solid rgba(255, 180, 60, 0.35);
  width: 440px;
}

.approval-modal-card .modal-title {
  color: #ffb43c;
}

#approval-summary {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.approval-modal-card details {
  font-size: 12px;
  color: var(--text-meta);
}

.approval-modal-card details summary {
  cursor: pointer;
  user-select: none;
  margin-bottom: 6px;
}

#approval-details {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-meta);
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.approval-modal-card .modal-actions button:nth-child(1) {
  background: #2ea043;
  color: #fff;
}

.approval-modal-card .modal-actions button:nth-child(2) {
  background: rgba(220, 60, 60, 0.25);
  color: var(--lux-red);
  border: none;
}

/* ── Consent modal (Phase 2b) ────────────────────────────── */

.consent-modal-card {
  border: 1.5px solid rgba(255, 180, 60, 0.35);
  width: 460px;
}

.consent-modal-card .modal-title {
  color: #ffb43c;
}

.consent-modal-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
}

.consent-details {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
}

.consent-details p {
  font-size: 12px;
  margin-bottom: 4px;
}

.consent-details p:last-child { margin-bottom: 0; }

.consent-modal-card .modal-actions button:nth-child(1) {
  background: rgba(255, 180, 60, 0.25);
  color: #ffb43c;
}

.consent-modal-card .modal-actions button:nth-child(2) {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

/* ── Capability modal (Phase 2b — overlay/positioning provided by .modal-overlay) */

.capability-modal-card {
  border: 1.5px solid rgba(255, 180, 60, 0.3);
  width: 500px;
}

.capability-modal-card .modal-title {
  color: #ffb43c;
}

.capability-modal-card .reason {
  font-size: 12px;
  color: var(--text-meta);
  font-style: italic;
}

.capability-modal-card .description {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.capability-modal-card .options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.capability-modal-card .option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
  background: var(--bg-input);
}

.capability-modal-card .option:hover {
  border-color: var(--gpt-blue);
}

.capability-modal-card .option input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--gpt-blue);
}

.capability-modal-card .option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.capability-modal-card .option .label {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-user);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.capability-modal-card .option .sublabel {
  font-size: 12px;
  color: var(--text-meta);
}

.capability-modal-card .option.level-public .label              { color: #5eda7f; }
.capability-modal-card .option.level-internal .label            { color: #ffb43c; }
.capability-modal-card .option.level-confidential .label        { color: #e8853a; }
.capability-modal-card .option.level-strictly_confidential .label { color: var(--lux-red); }

.capability-modal-card .buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.capability-modal-card .btn-primary {
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gpt-blue), #0081b8);
  color: #fff;
  transition: opacity 0.15s;
}

.capability-modal-card .btn-secondary {
  padding: 8px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: var(--bg-elevated);
  color: var(--text-primary);
  transition: opacity 0.15s;
}

.capability-modal-card .btn-primary:hover,
.capability-modal-card .btn-secondary:hover { opacity: 0.85; }

/* ── Shared animation keyframes ──────────────────────────── */

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pm-pop {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Audit viewer body styles (modal chrome via .modal-overlay/.modal-card,
      see Phase 1 / Phase 2b — the .audit-modal-overlay + .audit-modal
      wrapper rules were deleted with the migration). */

.audit-subtitle {
  font-size: 12px;
  color: var(--text-meta);
  margin-top: 2px;
  font-style: italic;
}

.audit-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.audit-entries {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-entry {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.audit-timestamp {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.3px;
}

.audit-provider-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  background: rgba(0, 161, 222, 0.15);
  color: var(--gpt-blue);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.audit-mid-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.audit-duration {
  color: var(--text-meta);
  font-weight: 400;
}

.audit-excerpt {
  font-size: 13px;
  color: var(--text-primary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  font-family: 'Crimson Pro', Georgia, serif;
}

.audit-error-detail {
  font-size: 11px;
  color: var(--lux-red);
  margin: 2px 0 0;
  font-family: 'DM Mono', monospace;
}

/* --- Audit-log: compact one-liner for action events ------------------- */
/*
 * Distinct from the provider-call card: transparent background, slim
 * padding, coloured left-border. Keeps compliance events visually
 * secondary to full LLM request/response records while remaining
 * scannable. Uses the design tokens actually defined in :root
 * (--text-meta, --border-strong, --gpt-blue, --bg-input) rather than
 * spec placeholders.
 */
.audit-action-entry {
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-left: 3px solid var(--text-meta);
  border-radius: 0;
  box-shadow: none;
  gap: 0;
}

.audit-action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  flex-wrap: wrap;
}

.audit-action-user {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.audit-action-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(122, 122, 146, 0.15);
  color: var(--text-meta);
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3px;
  text-transform: none;
}

.audit-action-details {
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.audit-empty-state {
  text-align: center;
  color: var(--text-meta);
  padding: 40px 20px;
  font-size: 14px;
  font-style: italic;
}

.audit-close-row {
  display: flex;
  justify-content: flex-end;
}

/* ── View system (tabs + containers) ─────────────────────── */

.view-tabs {
  display: flex;
  gap: 4px;
  margin-left: 10px;
}

.view-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.view-tab:hover {
  color: var(--text-primary);
  border-color: var(--text-meta);
}

.view-tab.active {
  background: var(--bg-input);
  color: var(--text-user);
  border-color: var(--text-meta);
}

.view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Briefing view ─────────────────────────────────────────── */

.briefing-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 26px 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-strong);
}

.briefing-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-user);
  text-transform: uppercase;
  margin: 0;
}

.briefing-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.briefing-meta {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  letter-spacing: 0.1em;
}

.briefing-refresh-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px;
  color: var(--text-primary);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.briefing-refresh-btn:hover {
  border-color: var(--text-meta);
  color: var(--text-user);
}

/* ── Header language selector ─────────────────────────────── */

.lang-select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  outline: none;
  appearance: auto;
}

.lang-select:focus {
  border-color: var(--gpt-blue);
}

/* ── Chat view header (controls bar) ───────────────────────── */

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px 0;
}

/* Conversation title shown at the left of the chat header (Patch v1.1).
   Hidden entirely when empty so "neue Chat" state stays clean. */
.chat-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-right: 16px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.chat-title:empty {
  display: none;
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Classification dropdown */
.chat-level-select {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
  transition: border-color 0.15s, color 0.15s;
}

.chat-level-select:hover { border-color: var(--gpt-blue); }

.chat-level-select.level-public                { color: #5eda7f; border-color: #5eda7f60; }
.chat-level-select.level-internal              { color: #ffb43c; border-color: #ffb43c60; }
.chat-level-select.level-confidential          { color: #e8853a; border-color: #e8853a60; }
.chat-level-select.level-strictly_confidential { color: var(--lux-red); border-color: #ED293960; }

/* Privacy toggle */
.chat-privacy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.chat-privacy-icon {
  font-size: 12px;
  line-height: 1;
}

.chat-privacy-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

.chat-privacy-btn:hover { border-color: var(--gpt-blue); }
.chat-privacy-btn.chat-privacy-active {
  border-color: var(--lux-red);
  background: rgba(237, 41, 57, 0.06);
}
.chat-privacy-btn.chat-privacy-active .chat-privacy-label {
  color: var(--lux-red);
}

.chat-newchat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 4px 12px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.chat-newchat-btn:hover {
  border-color: var(--gpt-blue);
  color: var(--text-user);
}

/* Export button */
.chat-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.chat-export-btn:hover { border-color: var(--gpt-blue); }

/* Export target dropdown */
.export-dropdown {
  position: fixed;
  z-index: 1001;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 200px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pm-pop 0.12s ease-out;
}
.export-dropdown-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Chat body (messages + side panel) ────────────────────── */

.chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── Side panel ───────────────────────────────────────────── */

.side-panel {
  width: 0;
  min-width: 0;
  border-left: 1px solid transparent;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease, min-width 0.25s ease, border-color 0.25s ease;
}

.side-panel.open {
  width: 42%;
  min-width: 340px;
  max-width: 520px;
  border-left-color: var(--border-strong);
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-strong);
  flex-shrink: 0;
}

.side-panel-title {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 500;
}

.side-panel-close {
  background: none;
  border: none;
  color: var(--text-meta);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.side-panel-close:hover { color: var(--text-primary); }

.side-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.side-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-strong);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Side panel buttons */
.sp-btn {
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.sp-btn:hover { border-color: var(--gpt-blue); color: var(--text-user); }
.sp-btn-primary {
  background: linear-gradient(135deg, var(--lux-red), rgba(237, 41, 57, 0.8));
  color: #fff;
  border: none;
}
.sp-btn-primary:hover { box-shadow: 0 3px 12px rgba(237, 41, 57, 0.4); }

/* Summary-specific panel content */
.sp-loading {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-meta);
  text-align: center;
  padding: 40px 0;
}
.sp-error {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--lux-red);
  padding: 20px 0;
}
.sp-summary-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sp-summary-textarea {
  flex: 1;
  width: 100%;
  min-height: 200px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px;
  resize: none;
}
.sp-summary-textarea:focus {
  outline: none;
  border-color: var(--gpt-blue);
}
.sp-summary-hint {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 11px;
  color: var(--text-meta);
  margin-top: 8px;
}

/* --- Summary export panel: split layout -------------------------------- */
/*
 * Two vertically stacked containers to physically isolate the exportable
 * report (top, solid border) from the non-exportable redaction log
 * (bottom, dashed border). Different borders + label colours + warning
 * hint make the intent visible without reading text. Save button in the
 * footer only consumes the top textarea's value, so the bottom section
 * cannot leak into an export by accident.
 */
.sp-summary-split {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 12px;
  min-height: 0;
}

.sp-summary-report-section {
  flex: 0 0 70%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px;
}

.sp-summary-log-section {
  /* 30% minus the 12px gap between sections */
  flex: 0 0 calc(30% - 12px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.04);
}

.sp-summary-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  flex: 0 0 auto;
}

.sp-summary-section-label-export {
  color: var(--gpt-blue);
}

.sp-summary-section-label-log {
  color: var(--text-meta);
}

/* v1.2 Phase 5a Patch 7 — skill drafting side panel widgets */
.sp-skill-phase1,
.sp-skill-phase2 {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}
.sp-skill-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sp-skill-input {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-user);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  box-sizing: border-box;
}
.sp-skill-types {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-user);
}
.sp-skill-types label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sp-token-counter {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: right;
  margin-top: 2px;
}
.sp-token-ok { color: var(--text-meta); }
.sp-token-amber { color: #d39c2a; }
.sp-token-danger { color: #c0392b; font-weight: 600; }

/* v1.4 — visual-only "action not ready" state for validation-gated
   buttons (introduced as .save-disabled in Wave 2.1.2, generalised
   here). The button stays clickable so its preflight handler can fire
   an explicit error toast — using the HTML `disabled` attribute would
   swallow the click silently. See client/src/modules/button_helpers.js
   for the helper pair (setButtonVisualDisabled / withValidation). */
.btn-action-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sp-validation-banner {
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid #c0392b;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  color: #c0392b;
}
.sp-validation-banner ul {
  margin: 6px 0 0 0;
  padding-left: 18px;
}

.sp-raw-output {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-meta);
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* v1.2 Phase 5a Patch 8 — active skills banner + picker popover */

.active-skills-banner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  margin: 0 0 6px 0;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}
:root[data-theme="day"] .active-skills-banner {
  background: rgba(0, 0, 0, 0.02);
}

.active-skills-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.active-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-user);
}

.active-skill-chip-close {
  border: none;
  background: transparent;
  color: var(--text-meta);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.active-skill-chip-close:hover { color: var(--text-user); }

.active-skills-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
}

.active-skills-add {
  border: none;
  background: transparent;
  color: var(--text-meta);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 0;
}
.active-skills-add:hover { color: var(--text-user); }

.active-skills-tokens { letter-spacing: 0.05em; }
.active-skills-tokens.amber { color: #d39c2a; }
.active-skills-tokens.danger { color: #c0392b; font-weight: 600; }

.skill-picker-popover {
  position: absolute;
  bottom: 70px;
  left: 16px;
  right: 16px;
  max-width: 420px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 200;
}

.skill-picker-empty {
  padding: 14px 16px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  color: var(--text-meta);
}

.skill-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.skill-picker-item:last-child { border-bottom: none; }

.skill-picker-item-info { min-width: 0; flex: 1; }
.skill-picker-item-name {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-user);
}
.skill-picker-item-desc {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  color: var(--text-meta);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-picker-item-action {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--text-meta);
  cursor: pointer;
}
.skill-picker-item-action:hover {
  background: var(--bg-input);
  color: var(--text-user);
}
.skill-picker-item-action[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

/* v1.3 Phase 5b Patch 6 — source pill next to picker item names */
.skill-picker-source {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.05em;
  vertical-align: middle;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-meta);
}
.skill-picker-source-own {
  border-color: var(--lux-red);
  color: var(--lux-red);
}
.skill-picker-source-global {
  border-color: #2ea043;
  color: #2ea043;
}
.skill-picker-source-group {
  border-color: #3a79de;
  color: #3a79de;
}

.sp-summary-textarea-report {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.6;
  padding: 8px;
  resize: none;
  box-sizing: border-box;
}
.sp-summary-textarea-report:focus {
  outline: none;
  border-color: var(--gpt-blue);
}

.sp-summary-log-display {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px;
  color: var(--text-meta);
  white-space: pre-wrap;
  background: transparent;
  /* Allow copy-selection for auditors who genuinely want it; the button
     in the footer still only operates on the top textarea, so this is
     only a text-selection affordance, not an export affordance. */
  user-select: text;
}

.sp-summary-hint-warning {
  color: var(--lux-red);
  font-weight: 600;
}

.briefing-content {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}

.briefing-content h1,
.briefing-content h2,
.briefing-content h3 {
  color: var(--text-user);
  font-family: 'Crimson Pro', Georgia, serif;
}

.briefing-content h1 { font-size: 22px; margin: 18px 0 12px; }
.briefing-content h2 { font-size: 18px; margin: 24px 0 10px; }
.briefing-content h3 { font-size: 15px; margin: 16px 0 8px; }

.briefing-content p  { margin: 8px 0; }
.briefing-content ul,
.briefing-content ol { margin: 8px 0; padding-left: 20px; }
.briefing-content li { margin: 4px 0; }
.briefing-content hr {
  border: none;
  border-top: 1px solid var(--border-strong);
  margin: 18px 0;
}

.briefing-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-meta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
}

/* ── Reports modal ────────────────────────────────────────── */

/* Reports modal — Phase 2b. Overlay/positioning + chrome (header/title/
   close button) provided by .modal-overlay/.modal-card via openModal.
   Card-level sizing applied through the .reports-modal-card modalClass. */

.reports-modal-card {
  width: 80vw;
  max-width: 900px;
  height: 80vh;
}

.reports-modal-filters {
  display: flex;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.reports-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.reports-filter-group label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-meta);
}

.reports-filter-group select {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}

.reports-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.reports-modal-content::-webkit-scrollbar { width: 8px; }
.reports-modal-content::-webkit-scrollbar-track { background: transparent; }
.reports-modal-content::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

/* Markdown rendering inside reports modal (reuse briefing-content styles) */
.reports-modal-content h1,
.reports-modal-content h2,
.reports-modal-content h3 {
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.05em;
  color: var(--text-user);
}
.reports-modal-content h1 { font-size: 20px; margin: 18px 0 12px; }
.reports-modal-content h2 { font-size: 16px; margin: 24px 0 10px; color: var(--gpt-blue); }
.reports-modal-content h3 { font-size: 14px; margin: 16px 0 8px; }
.reports-modal-content p  { margin: 8px 0; font-family: 'Crimson Pro', Georgia, serif; font-size: 15px; line-height: 1.7; }
.reports-modal-content ul,
.reports-modal-content ol { margin: 8px 0; padding-left: 20px; font-family: 'Crimson Pro', Georgia, serif; font-size: 15px; }
.reports-modal-content li { margin: 4px 0; }
.reports-modal-content hr { border: none; border-top: 1px solid var(--border-strong); margin: 18px 0; }
.reports-modal-content a { color: var(--gpt-blue); text-decoration: none; }
.reports-modal-content a:hover { text-decoration: underline; }

.compliance-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 26px 40px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.compliance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-strong);
}

.compliance-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.compliance-subtitle {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  color: var(--text-meta);
}

.compliance-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compliance-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
}

.compliance-content {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}

.briefing-trigger-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--lux-red), #c9222e);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.briefing-trigger-btn:hover {
  box-shadow: 0 4px 16px rgba(237, 41, 57, 0.4);
  opacity: 0.95;
}

/* ── Markdown tables (chat messages + briefing content) ──── */

.message table,
.briefing-content table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
}

.message th,
.message td,
.briefing-content th,
.briefing-content td {
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  text-align: left;
}

.message th,
.briefing-content th {
  background: var(--bg-input);
  font-weight: 600;
  color: var(--text-user);
}

.message tr:nth-child(even) td,
.briefing-content tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

:root[data-theme="day"] .message tr:nth-child(even) td,
:root[data-theme="day"] .briefing-content tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.02);
}

/* Inline code / code blocks inside markdown messages */
.message code,
.briefing-content code {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 4px;
}

.message pre,
.briefing-content pre {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  margin: 10px 0;
}

.message pre code,
.briefing-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

/* ── Sidebar navigation ───────────────────────────────────── */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 56px;
  background: var(--bg-header);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 0;
  overflow: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar:hover {
  width: 220px;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-strong);
  margin: 12px 14px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-meta);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  width: 100%;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  font-family: inherit;
}

.sidebar-item:hover {
  background: var(--bg-input);
  color: var(--text-user);
}

.sidebar-item.active {
  background: var(--bg-input);
  color: var(--lux-red);
  border-color: rgba(237, 41, 57, 0.3);
}

/* v1.3 Phase 5b — pending-count pill on the Skill Reviews sidebar entry */
.sidebar-badge {
  display: inline-block;
  margin-left: auto;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 9px;
  background: var(--lux-red);
  color: white;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.sidebar-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.sidebar-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}

.sidebar:hover .sidebar-label {
  opacity: 1;
}

/* Provider badge becomes clickable to open the capability modal */
.provider-badge {
  cursor: pointer;
}

/* Elements removed from the header in v0.6 — kept for any lingering markup */
#theme-toggle,
.theme-toggle,
#header .status-indicator,
#change-level-btn,
.change-level-btn,
.view-tabs {
  display: none !important;
}

/* ── Login / Reset overlays ──────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  overflow-y: auto;
}

.login-card {
  margin: auto;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 36px 36px 28px 36px;
  width: 360px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-logo {
  text-align: center;
  margin: 0 0 20px 0;
}

.login-logo-img {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0 auto;
}

/* Theme-aware logo swap. data-theme lives on <html>, values night|day. */
.login-logo-night { display: none; }
:root[data-theme="night"] .login-logo-day   { display: none; }
:root[data-theme="night"] .login-logo-night { display: block; }

.login-logo .wordmark {
  font-family: 'DM Mono', monospace;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.login-subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  letter-spacing: 0.15em;
  margin-bottom: 6px;
  margin-top: 14px;
}

.login-input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  transition: border-color 0.2s;
}

.login-input:focus {
  outline: none;
  border-color: var(--gpt-blue);
}

.login-btn {
  margin-top: 24px;
  padding: 12px;
  background: linear-gradient(135deg, var(--lux-red), rgba(237, 41, 57, 0.8));
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: box-shadow 0.2s, opacity 0.2s;
}

.login-btn:hover {
  box-shadow: 0 4px 18px rgba(237, 41, 57, 0.4);
}

.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-error {
  background: rgba(237, 41, 57, 0.1);
  border: 1px solid rgba(237, 41, 57, 0.4);
  color: var(--lux-red);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  margin-bottom: 10px;
}

.reset-hint {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  text-align: center;
  margin-bottom: 16px;
  margin-top: -8px;
}

/* ── User avatar in sidebar ──────────────────────────────── */

.user-avatar-btn {
  padding: 10px 14px !important;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lux-red), var(--gpt-blue));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: -1px;
}

/* ── User popup ──────────────────────────────────────────── */

.user-popup {
  position: fixed;
  bottom: 70px;
  left: 60px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 200;
}

.user-popup-header {
  padding: 10px 14px 8px;
}

.user-popup-name {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-user);
  font-weight: 600;
}

.user-popup-username {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.user-popup-divider {
  height: 1px;
  background: var(--border-strong);
  margin: 6px 0;
}

.user-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}

.user-popup-item:hover {
  background: var(--bg);
}

/* ── Admin view ──────────────────────────────────────────── */

.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 36px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
}

.admin-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-user);
  text-transform: uppercase;
  margin: 0;
}

.admin-tabs {
  display: flex;
  gap: 6px;
}

.admin-tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.admin-tab:hover { color: var(--text-primary); }

.admin-tab.active {
  background: var(--bg-input);
  color: var(--text-user);
  border-color: var(--text-meta);
}

.admin-actions { margin-bottom: 16px; }

.admin-create-btn {
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--lux-red), rgba(237, 41, 57, 0.8));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.admin-create-btn:hover {
  box-shadow: 0 4px 14px rgba(237, 41, 57, 0.4);
}

.admin-table-wrapper {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
}

.admin-table thead th {
  background: var(--bg);
  color: var(--text-meta);
  font-weight: 400;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  letter-spacing: 0.08em;
}

.admin-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

:root[data-theme="day"] .admin-table tbody tr:hover td { background: rgba(0, 0, 0, 0.02); }

.admin-empty {
  text-align: center;
  color: var(--text-meta);
  font-style: italic;
  padding: 30px !important;
}

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.admin-badge.admin { background: rgba(237, 41, 57, 0.15); color: var(--lux-red); }
.admin-badge.user  { background: rgba(0, 161, 222, 0.15); color: var(--gpt-blue); }
.admin-badge.active   { color: #16a34a; }
.admin-badge.inactive { color: var(--text-meta); }

/* v1.11 C.5 — Bridge admin tab */
.admin-bridge-section { margin-bottom: 24px; }
.admin-bridge-section > h3 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
}
.admin-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.admin-section-header h3 { margin: 0; }
.admin-section-hint {
  color: var(--text-meta);
  font-size: 12px;
  margin: 0 0 10px 0;
}
.admin-refresh-btn {
  background: transparent;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 2px 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.2;
}
.admin-refresh-btn:hover { border-color: var(--gpt-blue); color: var(--gpt-blue); }
.admin-bridge-filters {
  display: flex;
  gap: 8px;
  margin: 8px 0 10px 0;
  flex-wrap: wrap;
}
.admin-bridge-filters input {
  padding: 4px 8px;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  min-width: 160px;
}
.admin-bridge-filters input:focus {
  outline: none;
  border-color: var(--gpt-blue);
}
.admin-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.admin-tag-cloud   { background: rgba(255, 152, 0, 0.18); color: #ff9800; }
.admin-tag-local   { background: rgba(46, 160, 67, 0.18); color: #2ea043; }
.admin-tag-allowed { background: rgba(46, 160, 67, 0.22); color: #2ea043; }
.admin-tag-denied  { background: rgba(248, 81, 73, 0.18); color: #f85149; }
.admin-action-code {
  font-family: ui-monospace, 'SF Mono', 'DM Mono', monospace;
  font-size: 11px;
  background: var(--bg-elevated);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-primary);
}

.admin-stats-cell {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-meta);
  white-space: nowrap;
}

.admin-row-actions { display: flex; gap: 4px; }

.admin-row-action {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.admin-row-action:hover { border-color: var(--text-meta); color: var(--text-user); }
.admin-row-action.danger:hover { border-color: var(--lux-red); color: var(--lux-red); }

/* Admin modal */
/* Admin / upload / invite / participants / confirm modals — Phase 2b.
   Overlay positioning + chrome (header/title/close) provided by
   .modal-overlay/.modal-card via openModal. The .admin-modal-card class
   below applies the admin-specific sizing/background that callers want
   via openModal({ modalClass: "admin-modal-card" }). The body-content
   classes (.admin-modal-body, .admin-modal-footer, .admin-modal-btn,
   .admin-modal-error, .admin-form-*) below remain in active use inside
   the bodyEl/footerEl that admin.js renders. */

.admin-modal-card {
  background: var(--bg-input);
  width: 480px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.upload-modal-card {
  width: 520px;
}

.invite-modal-card {
  width: 480px;
}

.participants-modal-card {
  width: 480px;
}

.admin-modal-close {
  background: transparent;
  border: none;
  color: var(--text-meta);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.admin-modal-close:hover { color: var(--text-user); }

.admin-modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  flex: 1;
}

.admin-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--border-strong);
}

/* Confirm-modal footer (built by appConfirm() in utils.js).
   Matches .modal-actions and .admin-modal-footer conventions. */
.modal-footer-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.admin-form-group { margin-bottom: 14px; }

.admin-form-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  letter-spacing: 0.1em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.admin-form-input,
.admin-form-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  box-sizing: border-box;
}

.admin-form-input:focus,
.admin-form-select:focus {
  outline: none;
  border-color: var(--gpt-blue);
}

.admin-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-form-checkbox label {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-primary);
}

.admin-form-multiselect {
  max-height: 160px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
}

.admin-form-multiselect label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.admin-form-multiselect input { accent-color: var(--lux-red); }

.admin-provider-data-levels { display: flex; flex-direction: column; gap: 6px; }
.admin-pdl-row { display: flex; align-items: center; gap: 10px; }
.admin-pdl-name {
  font-family: 'DM Mono', monospace; font-size: 11px;
  min-width: 90px; color: var(--text-primary);
}
.admin-form-hint {
  font-family: 'Crimson Pro', Georgia, serif; font-size: 11px;
  color: var(--text-meta); margin-top: 4px;
}

/* Agent cards (unified admin tab) */
.agent-card {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 16px;
  max-width: 600px;
}
.agent-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.agent-card-icon { font-size: 18px; }
.agent-card-name {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.agent-card-desc {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  color: var(--text-meta);
  margin-bottom: 16px;
}
.agent-card-body { /* contains form groups */ }
.agent-card-status {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.agent-card-meta {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-meta);
  margin-bottom: 3px;
}

.admin-modal-btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: box-shadow 0.15s, opacity 0.15s;
}

.admin-modal-btn.primary {
  background: linear-gradient(135deg, var(--lux-red), rgba(237, 41, 57, 0.8));
  color: #fff;
  border: none;
}

.admin-modal-btn.primary:hover { box-shadow: 0 3px 12px rgba(237, 41, 57, 0.4); }

.admin-modal-btn.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.admin-modal-btn.secondary:hover { border-color: var(--text-meta); }

.admin-modal-error {
  background: rgba(237, 41, 57, 0.1);
  border: 1px solid rgba(237, 41, 57, 0.4);
  color: var(--lux-red);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  margin-bottom: 12px;
}

/* ── History view ────────────────────────────────────────── */

.history-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 36px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.history-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
}

.history-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-user);
  text-transform: uppercase;
  margin: 0 0 14px 0;
}

.history-search {
  position: relative;
  display: flex;
  align-items: center;
}

.history-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 36px 10px 14px;
  color: var(--text-primary);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  box-sizing: border-box;
}

.history-search-input:focus {
  outline: none;
  border-color: var(--gpt-blue);
}

.history-search-input::placeholder {
  color: var(--text-meta);
  font-style: italic;
}

.history-search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-meta);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 6px;
}

.history-search-clear:hover { color: var(--text-user); }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-meta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
}

.history-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 14px;
}

.history-item:hover {
  border-color: var(--border-strong);
  background: var(--bg);
}

.history-item.active {
  border-color: var(--lux-red);
  background: rgba(237, 41, 57, 0.05);
}

/* v1.2 Wave 2.1 Patch 3 — sidebar visual differentiation for skill-drafting */
.history-item.skill-draft .history-item-title {
  font-style: italic;
}
.history-item.skill-draft {
  opacity: 0.85;
}
.history-item.skill-draft.active {
  opacity: 1;
}

/* v1.2 Wave 2.1 Patch 3 — Skill Editor mode banner (label left, exit right) */
.chat-drafting-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(237, 41, 57, 0.08);
  border-bottom: 1px solid var(--border-strong);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lux-red);
  font-weight: 600;
}
.chat-drafting-banner-label-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.chat-drafting-banner-icon { font-size: 14px; }

.chat-drafting-banner-exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--lux-red);
  border-radius: 4px;
  background: transparent;
  color: var(--lux-red);
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.chat-drafting-banner-exit:hover {
  background: rgba(237, 41, 57, 0.12);
}

.history-item-content {
  flex: 1;
  min-width: 0;
}

.history-item-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  color: var(--text-user);
  font-weight: 600;
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.05em;
  display: flex;
  gap: 14px;
}

.history-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.history-item-action {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.history-item-action:hover {
  color: var(--text-user);
  border-color: var(--text-meta);
}

.history-item-action.danger:hover {
  border-color: var(--lux-red);
  color: var(--lux-red);
}

.history-item-excerpt {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  color: var(--text-meta);
  margin-top: 6px;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Documents view ──────────────────────────────────────── */

.documents-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 36px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.documents-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
}

.documents-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-user);
  text-transform: uppercase;
  margin: 0 0 6px 0;
}

.documents-subtitle {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  font-style: italic;
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documents-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-meta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
}

.document-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s;
}

.document-item:hover { border-color: var(--border-strong); }

.document-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 161, 222, 0.1);
  color: var(--gpt-blue);
  border-radius: 6px;
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.document-item-content {
  flex: 1;
  min-width: 0;
}

.document-item-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 15px;
  color: var(--text-user);
  font-weight: 600;
  margin: 0 0 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-item-filename {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.document-item-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  letter-spacing: 0.05em;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.document-item-confidentiality {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.05);
}

:root[data-theme="day"] .document-item-confidentiality {
  background: rgba(0, 0, 0, 0.05);
}

/* v1.2 Phase 5a — Skills Library + Detail */

.skills-main {
  flex: 1;
  overflow-y: auto;
  padding: 30px 36px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

.skills-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
}

.skills-title {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--text-user);
  text-transform: uppercase;
  margin: 0 0 6px 0;
}

.skills-subtitle {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  font-style: italic;
}

.skills-create-btn {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-user);
  cursor: pointer;
}
.skills-create-btn:hover { background: var(--border); }

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skills-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-meta);
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
}

.skill-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.skill-card:hover { border-color: var(--border-strong); }

.skill-card-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.skill-card-name {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-user);
  margin: 0;
}

.skill-card-description {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  margin: 4px 0 8px 0;
}

.skill-card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-meta);
}

.skill-tag-chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: var(--text-meta);
}

.skill-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-meta);
}
:root[data-theme="day"] .skill-type-badge { background: rgba(0, 0, 0, 0.05); }

.skill-card-actions {
  display: flex;
  gap: 6px;
}
.skill-card-action {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--text-meta);
  cursor: pointer;
}
.skill-card-action:hover { background: var(--bg-input); color: var(--text-user); }
.skill-card-action.danger { color: #c0392b; }
.skill-card-action.danger:hover { background: rgba(192, 57, 43, 0.08); color: #c0392b; }

/* v1.3 Phase 5b — status badges next to skill name */
.skill-status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  font-weight: 600;
}
.skill-status-pending {
  background: rgba(211, 156, 42, 0.15);
  color: #d39c2a;
  border: 1px solid #d39c2a;
}
.skill-status-published {
  background: rgba(46, 160, 67, 0.15);
  color: #2ea043;
  border: 1px solid #2ea043;
}
:root[data-theme="day"] .skill-status-pending { background: rgba(211, 156, 42, 0.18); }
:root[data-theme="day"] .skill-status-published { background: rgba(46, 160, 67, 0.18); }

/* Detail modal — full visibility line */
.skill-detail-visibility {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-user);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
}

/* Locked banner above detail body when pending/published */
.skill-locked-banner {
  padding: 10px 14px;
  margin-bottom: 14px;
  border-left: 3px solid #d39c2a;
  background: rgba(211, 156, 42, 0.08);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-user);
}

/* Greyed-out fieldset when read-only */
.skill-detail-fieldset-locked {
  opacity: 0.7;
}

/* Hint shown in published-detail with the Create-New-Version pattern */
.skill-detail-create-new-version-hint {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--bg-input);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  font-style: italic;
}

/* Promotion history timeline */
.skill-history-empty {
  padding: 10px 14px;
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  color: var(--text-meta);
}
.skill-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.skill-history-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  line-height: 1.4;
}
.skill-history-list li:last-child { border-bottom: none; }

.skill-history-event {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 8px;
  vertical-align: baseline;
}
.skill-history-event-submitted {
  background: rgba(58, 121, 222, 0.15);
  color: #3a79de;
  border: 1px solid #3a79de;
}
.skill-history-event-approved {
  background: rgba(46, 160, 67, 0.15);
  color: #2ea043;
  border: 1px solid #2ea043;
}
.skill-history-event-rejected {
  background: rgba(192, 57, 43, 0.15);
  color: #c0392b;
  border: 1px solid #c0392b;
}
.skill-history-event-unpublished {
  background: rgba(150, 150, 150, 0.15);
  color: var(--text-meta);
  border: 1px solid var(--border-strong);
}
.skill-history-meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
}
.skill-history-comment {
  display: block;
  margin-top: 4px;
  margin-left: 4px;
  color: var(--text-user);
  font-style: italic;
}

/* Submit modal */
.skill-submit-modal-hint {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  margin-bottom: 12px;
}

/* v1.3 Phase 5b Patch 5 — admin Skill-Reviews list + approve modal */
.skill-review-author {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-meta);
}
.skill-review-comment {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-user);
  font-style: italic;
  margin-top: 6px;
  padding: 6px 10px;
  border-left: 3px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}
:root[data-theme="day"] .skill-review-comment { background: rgba(0, 0, 0, 0.02); }

.skill-review-modal { width: 720px; max-width: 95vw; }

.skill-review-section { margin-bottom: 16px; }
.skill-review-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-meta);
  margin-bottom: 6px;
}
.skill-review-decision-groups {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
}
.skill-review-decision-groups label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  cursor: pointer;
}
.skill-review-validation {
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #c0392b;
  display: none;
}
.skill-review-validation.visible { display: block; }

/* Skill Detail modal */
.skill-detail-modal { width: 760px; max-width: 95vw; }

.skill-detail-section {
  margin-bottom: 18px;
}

.skill-detail-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-meta);
  margin-bottom: 8px;
}

.skill-detail-content {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  max-height: 360px;
  overflow-y: auto;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-user);
}
.skill-detail-content > *:first-child { margin-top: 0; }
.skill-detail-content > *:last-child { margin-bottom: 0; }

.skill-detail-meta-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 14px;
  align-items: start;
}

.skill-detail-meta-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-meta);
  padding-top: 7px;
}

.skill-detail-meta-input,
.skill-detail-meta-textarea {
  width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-user);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  box-sizing: border-box;
}

.skill-detail-meta-textarea {
  resize: vertical;
  min-height: 56px;
  font-family: 'Crimson Pro', Georgia, serif;
}

.skill-detail-meta-checkboxes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-user);
  padding-top: 4px;
}
.skill-detail-meta-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* v1.1 — ephemeral-upload note inside the upload modal. */
.upload-ephemeral-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--border-strong);
  font-size: 12px;
  color: var(--text-meta);
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="day"] .upload-ephemeral-note {
  background: rgba(0, 0, 0, 0.03);
}

/* v1.1 — pasted-image thumbnail tray above the chat composer. */
.paste-thumb-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-basis: 100%;
  margin-bottom: 6px;
}

.paste-thumb-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-meta);
  background: rgba(255, 255, 255, 0.04);
}

.paste-thumb-pill.uploading { opacity: 0.6; }
.paste-thumb-pill.ready { opacity: 1; }
.paste-thumb-pill.error {
  border-color: #c0392b;
  color: #c0392b;
}

/* A1.4 — OCR badge for documents that went through OCR. */
.doc-ocr-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.85em;
  cursor: help;
  user-select: none;
  vertical-align: baseline;
  opacity: 0.85;
}
.doc-ocr-badge:hover {
  opacity: 1;
}

.document-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.document-item-action {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-meta);
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.document-item-action:hover {
  color: var(--text-user);
  border-color: var(--text-meta);
}

.document-item-action.danger:hover {
  border-color: var(--lux-red);
  color: var(--lux-red);
}

.document-item-source {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--text-meta);
  margin-top: 6px;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.75;
}

.document-item-error {
  color: var(--lux-red);
  font-size: 10px;
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
}

/* ── Upload button in chat footer ────────────────────────── */

.upload-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-meta);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.upload-btn:hover {
  color: var(--text-user);
  border-color: var(--text-meta);
}

.upload-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Upload modal ────────────────────────────────────────── */

.upload-file-info {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-file-icon {
  width: 32px;
  height: 32px;
  background: rgba(0, 161, 222, 0.1);
  color: var(--gpt-blue);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  flex-shrink: 0;
}

.upload-file-meta {
  flex: 1;
  min-width: 0;
}

.upload-file-name {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 14px;
  color: var(--text-user);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-size {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  margin-top: 2px;
}

.upload-choose-btn {
  padding: 10px 16px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-align: center;
  width: 100%;
  text-transform: uppercase;
  margin-bottom: 14px;
  transition: border-color 0.15s, color 0.15s;
}

.upload-choose-btn:hover {
  border-color: var(--gpt-blue);
  color: var(--gpt-blue);
}

/* Upload progress */
.upload-progress {
  padding: 20px;
  text-align: center;
}

.upload-progress-icon {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--gpt-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.upload-progress-status {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-user);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.upload-progress-detail {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 12px;
  color: var(--text-meta);
  font-style: italic;
}

/* ── Toast notifications ─────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-slide 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 12px;
}

@keyframes toast-slide {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 3px solid #16a34a; }
.toast.error   { border-left: 3px solid var(--lux-red); }

.toast-icon { font-size: 20px; flex-shrink: 0; }

.toast-content { flex: 1; min-width: 0; }

.toast-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-user);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.toast-message {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === Team Chat ============================================================ */

/* Chat-header team controls (Details / Invite / AI-mode) */
.chat-team-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
}

.chat-team-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chat-team-btn:hover { border-color: var(--gpt-blue); color: var(--text-user); }
.chat-team-btn .chat-team-icon { font-size: 12px; }
.chat-team-btn .chat-team-count {
  font-size: 10px;
  color: var(--text-meta);
  margin-left: 2px;
}

.chat-ai-mode-select {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 6px;
  cursor: pointer;
}
.chat-ai-mode-select:hover { border-color: var(--gpt-blue); }

/* Sidebar (history) multi-user indicators */
.history-item.team .history-item-title { color: var(--text-primary); }

.history-unread-badge {
  display: inline-block;
  background: var(--lux-red);
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.history-team-pill,
.history-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 6px;
}

.history-team-pill::before {
  content: "\1F465";  /* 👥 */
  margin-right: 3px;
  font-size: 10px;
}

/* Participants popup */
.participants-modal { width: 480px; }

.participants-loading,
.participants-error {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  color: var(--text-meta);
  padding: 20px 4px;
  text-align: center;
}
.participants-error { color: var(--lux-red); }

.participants-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.participant-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
}

.participant-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.participant-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
}

.participant-username { font-weight: 600; letter-spacing: 0.04em; }

.participant-role {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-meta);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 1px 6px;
}
.participant-role.role-owner { color: var(--gpt-blue); border-color: var(--gpt-blue); }

.participant-viewing {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: #5eda7f;
}

.participant-meta {
  display: flex;
  gap: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-meta);
}

.participant-unread {
  color: var(--lux-red);
  font-weight: 600;
}

.participant-actions {
  display: flex;
  align-items: center;
}

.participant-remove {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--lux-red);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
}
.participant-remove:hover { border-color: var(--lux-red); }

/* Invite modal — user picker */
.invite-user-search {
  width: 100%;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.invite-user-search:focus {
  outline: none;
  border-color: var(--gpt-blue);
}

.invite-user-list {
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invite-user-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 120ms ease, border-color 120ms ease;
}
.invite-user-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}
.invite-user-item.is-participant {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.invite-user-item-username {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.invite-user-item-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-meta);
}

.invite-user-empty {
  padding: 16px;
  text-align: center;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 13px;
  font-style: italic;
  color: var(--text-meta);
}

/* ── Shared modal primitive (modules/modal.js) ──
   Generalised from .audit-modal-overlay / .audit-modal. The audit-viewer
   pilot consumes these via openModal({ modalClass: "modal-card-wide" }).
   Other modal surfaces will migrate in subsequent prompts. */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 300;
  animation: fade-in 0.15s ease;
}

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 24px;
  width: 520px;
  max-width: 94vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text-primary);
}

.modal-card-wide {
  width: 720px;
}

.modal-card-narrow {
  width: 380px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-user);
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  flex: 1;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Debug inspector overlay (modules/debug-panel.js) ──
   Cmd+Shift+D toggles. Sits above modals (z-index 9999) so the inspector
   stays usable while debugging modal flows. Only activates when
   localStorage.luxgpt_debug = "1" — see debug.js init. */

.dbg-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40vh;
  z-index: 9999;
  background: rgba(15, 17, 22, 0.96);
  border-top: 2px solid var(--border-strong);
  color: #d8d8df;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
}

.dbg-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid #2a2c33;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.dbg-title {
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
}

.dbg-buf-count {
  color: #9aa0a6;
  font-weight: 400;
}

.dbg-remote-badge {
  background: rgba(255, 180, 60, 0.2);
  color: #ffb43c;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.dbg-filters {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.dbg-chip {
  background: transparent;
  border: 1px solid #2a2c33;
  border-radius: 3px;
  padding: 2px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: opacity 0.1s;
}

.dbg-chip-on  { opacity: 1; }
.dbg-chip-off { opacity: 0.3; text-decoration: line-through; }

.dbg-autoscroll {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #9aa0a6;
  cursor: pointer;
}

.dbg-btn {
  background: #1f2128;
  border: 1px solid #2a2c33;
  color: #d8d8df;
  padding: 3px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  border-radius: 3px;
}

.dbg-btn:hover { background: #2a2c33; }
.dbg-close { font-size: 14px; padding: 1px 9px; line-height: 1; }

.dbg-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  scrollbar-width: thin;
  scrollbar-color: #2a2c33 transparent;
}

.dbg-list::-webkit-scrollbar { width: 8px; }
.dbg-list::-webkit-scrollbar-track { background: transparent; }
.dbg-list::-webkit-scrollbar-thumb { background: #2a2c33; border-radius: 4px; }

.dbg-row {
  display: grid;
  grid-template-columns: 90px 70px 1fr;
  gap: 8px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(42, 44, 51, 0.4);
  align-items: baseline;
}

.dbg-ts {
  color: #6c7079;
  font-size: 10px;
}

.dbg-cat {
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.dbg-body {
  color: #d8d8df;
  word-break: break-all;
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.4;
}

/* ── Message footer chrome (v1.2.1 chat UX polish) ──
   Author header (group chats only), source-citation footer block, and
   timestamp footer. All token-driven so day/night themes inherit. */

.msg-author {
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  color: var(--text-meta);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.msg-timestamp {
  font-family: 'DM Mono', monospace;
  font-size: 0.75em;
  color: var(--text-meta);
  text-align: right;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.msg-sources-block {
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.85em;
  color: var(--text-meta);
}

.msg-sources-header {
  font-style: italic;
  margin-bottom: 4px;
  opacity: 0.85;
}

.msg-source-line {
  padding: 4px 0;
  word-break: break-word;
}

/* ── v1.10 Block B.2: Coder-Pane ─────────────────────────────── */

.coder-pane {
  --coder-pane-split: 0.6;
  display: flex;
  flex-direction: column;
  flex: 0 0 360px;
  max-width: 480px;
  min-width: 280px;
  border-left: 1px solid var(--border, #2a2a2a);
  background: var(--bg-elevated);
  overflow: hidden;
}
@media (max-width: 1024px) {
  #app-layout {
    flex-wrap: wrap;
  }
  .coder-pane {
    flex: 1 1 100%;
    max-width: 100%;
    height: 40vh;
    border-left: none;
    border-top: 1px solid var(--border, #2a2a2a);
  }
}

.coder-pane-zone {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.coder-pane-upper {
  flex: calc(var(--coder-pane-split) * 100) 1 0;
}
.coder-pane-lower {
  flex: calc((1 - var(--coder-pane-split)) * 100) 1 0;
}
.coder-pane-zone-title {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-meta);
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.coder-pane-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.coder-pane-empty,
.coder-pane-loading,
.coder-pane-error {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-meta);
}
.coder-pane-error { color: var(--lux-red, #d04040); }

.coder-pane-dragbar {
  height: 6px;
  background: transparent;
  cursor: row-resize;
  border-top: 1px solid var(--border, #2a2a2a);
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.coder-pane-dragbar:hover { background: var(--gpt-blue); opacity: 0.5; }

/* Welcome hint (upper zone — first card until dismissed) */
.coder-pane-hint {
  margin: 0 0 12px 0;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border, #2a2a2a);
  border-left: 3px solid var(--gpt-blue);
  border-radius: 6px;
  font-size: 12px;
}
.coder-pane-hint-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
}
.coder-pane-hint-icon {
  font-size: 14px;
  color: var(--gpt-blue);
}
.coder-pane-hint-title { flex: 1; }
.coder-pane-hint-dismiss {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-meta);
  font-size: 12px;
  padding: 0 4px;
}
.coder-pane-hint-dismiss:hover { color: var(--text-primary); }
.coder-pane-hint-body p {
  margin: 4px 0;
  color: var(--text-primary);
}
.coder-pane-hint-body ul {
  margin: 4px 0;
  padding-left: 20px;
}
.coder-pane-hint-body li { margin: 2px 0; }
.coder-pane-hint-body code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  background: rgba(0, 161, 222, 0.15);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Prompt cards (upper zone) */
.coder-prompt-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.coder-prompt-card.sent {
  opacity: 0.7;
}
.coder-prompt-meta {
  font-size: 11px;
  color: var(--text-meta);
  margin-bottom: 6px;
}
.coder-prompt-body {
  font-size: 13px;
  line-height: 1.45;
}
.coder-prompt-body pre, .coder-prompt-body code {
  font-size: 12px;
}
.coder-prompt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.coder-prompt-sent-marker {
  font-size: 11px;
  color: var(--text-meta);
}

/* Mirror bubbles (lower zone) */
.coder-pane-mirror { padding: 8px 12px; }
.coder-mirror-bubble {
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: 4px;
  word-wrap: break-word;
}
.coder-mirror-user {
  background: rgba(70, 110, 160, 0.15);
  margin-left: 24px;
}
.coder-mirror-assistant {
  background: rgba(255, 255, 255, 0.03);
  margin-right: 24px;
}
.coder-mirror-bubble.streaming::after {
  content: " ▍";
  opacity: 0.6;
  animation: coder-blink 1s steps(2, start) infinite;
}
@keyframes coder-blink {
  to { visibility: hidden; }
}
/* Subdued code blocks per Decision 9 */
.coder-mirror-bubble pre {
  background: var(--bg-elevated);
  padding: 6px 8px;
  border-radius: 3px;
  margin: 4px 0;
  overflow-x: auto;
}
.coder-mirror-bubble pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-primary);
}
.coder-mirror-code-expand {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-meta);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.coder-mirror-code-expand:hover { color: var(--gpt-blue); }

/* Input row */
.coder-pane-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border, #2a2a2a);
  background: rgba(255, 255, 255, 0.02);
}
.coder-pane-input-row textarea {
  flex: 1;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 4px;
  padding: 6px 8px;
}
.coder-pane-input-row textarea:disabled {
  opacity: 0.5;
}

/* Header toggle button */
.chat-coder-pane-toggle {
  background: transparent;
  border: 1px solid var(--border, #2a2a2a);
  color: var(--text-meta);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.chat-coder-pane-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ── v1.10 Block B.1: Coder API Keys + coder-link helpers ───── */

.coder-api-keys-hint, .coder-link-popover-empty {
  font-size: 12px;
  color: var(--text-meta);
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.coder-api-keys-actions { margin-bottom: 10px; }
.coder-api-keys-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.coder-api-keys-table th,
.coder-api-keys-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border, #2a2a2a);
}
.coder-api-keys-table tr.revoked { opacity: 0.5; }
.coder-api-keys-table .badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.coder-api-keys-table .badge.active { background: rgba(70, 180, 90, 0.2); color: #6ada80; }
.coder-api-keys-table .badge.revoked { background: rgba(180, 70, 70, 0.2); color: #da6a6a; }
.coder-api-keys-plaintext-box {
  display: flex;
  gap: 6px;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: 4px;
  margin: 8px 0;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
}
.coder-api-keys-save-toggle {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--text-meta);
}

.coder-link-popover {
  background: var(--bg-elevated);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 4px;
  padding: 6px 0;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.coder-link-popover-title {
  padding: 4px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-meta);
}
.coder-link-popover-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.coder-link-popover-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}
.coder-link-popover-item:hover { background: var(--bg-msg-ai); }
.coder-link-popover-item .ws-name { display: block; }
.coder-link-popover-item .ws-meta {
  display: block;
  font-size: 10px;
  color: var(--text-meta);
}

/* ── v1.11 C.4: <Code> label in conversation header ───────────── */

.chat-coder-link-btn {
  /* Match sibling header buttons (.chat-export-btn, .chat-team-btn) so
   * the <Code> control reads as a peer in the conversation header row. */
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.chat-coder-link-btn:hover {
  border-color: var(--gpt-blue);
}

.chat-coder-link-icon {
  font-family: ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-meta);
  letter-spacing: 0.2px;
}

.chat-coder-link-btn.linked .chat-coder-link-icon {
  background: rgba(46, 160, 67, 0.15);
  color: var(--text-primary);
}

.chat-coder-link-btn.linked.bridge-connected .chat-coder-link-icon {
  background: rgba(46, 160, 67, 0.30);
  color: var(--text-primary);
  box-shadow: 0 0 0 1px rgba(46, 160, 67, 0.6);
}

.chat-coder-link-label {
  font-size: 12px;
  color: var(--text-primary);
}

.chat-coder-link-status {
  display: inline-block;
  font-size: 10px;
  color: var(--text-meta);
}

.chat-coder-link-btn.linked.bridge-connected .chat-coder-link-status::before {
  content: "● ";
  color: #2ea043;
}

.chat-coder-link-btn.linked:not(.bridge-connected) .chat-coder-link-status::before {
  content: "○ ";
  color: var(--text-meta);
}

/* Day-theme variants — slightly stronger contrast for the linked
 * highlight, otherwise green-on-cream washes out. */
:root[data-theme="day"] .chat-coder-link-btn.linked .chat-coder-link-icon {
  background: rgba(46, 160, 67, 0.20);
}

:root[data-theme="day"] .chat-coder-link-btn.linked.bridge-connected .chat-coder-link-icon {
  background: rgba(46, 160, 67, 0.35);
}

/* ── v1.11 C.4: dual-master approval card (inline in chat bubble) ─ */

.approval-card {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  font-size: 13px;
}

.approval-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.approval-card-tool {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 600;
  color: var(--gpt-blue);
}

.approval-card-meta {
  font-size: 11px;
  color: var(--text-meta);
}

.approval-card-summary {
  margin: 4px 0 8px;
  color: var(--text-primary);
}

.approval-card-warning {
  margin: 4px 0 8px;
  padding: 6px 8px;
  background: rgba(217, 156, 34, 0.15);
  border-left: 3px solid #d39c22;
  font-size: 12px;
  color: var(--text-primary);
}

.approval-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.approval-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
}

.approval-btn:hover:not(:disabled) {
  background: var(--bg-msg-ai);
}

.approval-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.approval-yes  { background: rgba(46, 160, 67, 0.20); }
.approval-no   { background: rgba(237, 41, 57, 0.18); }
.approval-always { background: rgba(0, 161, 222, 0.18); }

.approval-card.dismissed {
  opacity: 0.55;
}

.approval-card.dismissed .approval-card-actions {
  display: none;
}

/* ── v1.11 C.4: bridge delivery marker in sources block ─────── */

.msg-source-bridge {
  margin-bottom: 4px;
}

.tool-call-bridge-marker {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 6px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  border-radius: 3px;
  background: rgba(46, 160, 67, 0.18);
  color: var(--text-primary);
}

/* ── v1.11 Block 1 Commit 1.3: bridge-activity log in pane ────── */

.bridge-activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  color: var(--text-primary);
}

.bridge-activity-row {
  display: grid;
  grid-template-columns: 56px 14px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
}

.bridge-activity-row:last-child {
  border-bottom: none;
}

.bridge-activity-time {
  color: var(--text-meta);
  font-variant-numeric: tabular-nums;
}

.bridge-activity-icon {
  text-align: center;
  width: 14px;
}

.bridge-activity-msg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icon coloring by kind */
.bridge-activity-row[data-kind="tool_dispatched"] .bridge-activity-icon { color: var(--gpt-blue); }
.bridge-activity-row[data-kind="tool_result"] .bridge-activity-icon { color: #2ea043; }
.bridge-activity-row[data-kind="tool_timeout"] .bridge-activity-icon,
.bridge-activity-row[data-kind="approval_timeout"] .bridge-activity-icon { color: #d29922; }
.bridge-activity-row[data-kind="tool_blocked"] .bridge-activity-icon,
.bridge-activity-row[data-kind="approval_rejected"] .bridge-activity-icon { color: #f85149; }
.bridge-activity-row[data-kind="approval_requested"] .bridge-activity-icon { color: #d29922; }
.bridge-activity-row[data-kind="approval_granted"] .bridge-activity-icon,
.bridge-activity-row[data-kind="approval_session_grant"] .bridge-activity-icon,
.bridge-activity-row[data-kind="approval_decided"] .bridge-activity-icon { color: #2ea043; }
