/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary: #0a0a0a;
  --color-accent: #6366f1;
  --color-accent-hover: #4f46e5;
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-border: #e5e5ea;
  --color-text: #1c1c1e;
  --color-text-secondary: #8e8e93;
  --color-bubble-user: var(--color-accent);
  --color-bubble-user-text: #ffffff;
  --color-bubble-bot: #f5f5f7;
  --color-bubble-bot-text: #1c1c1e;
  --color-danger: #ff3b30;
  --header-height: 60px;
  --input-min-height: 60px;
  --radius-bubble: 18px;
  --radius-small: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark mode — applied via [data-theme="dark"] on <html> (set by JS).
   Also respects system preference as the initial default. */
[data-theme="dark"] {
  --color-bg: #000000;
  --color-surface: #1c1c1e;
  --color-border: #2c2c2e;
  --color-text: #f5f5f7;
  --color-text-secondary: #8e8e93;
  --color-bubble-bot: #2c2c2e;
  --color-bubble-bot-text: #f5f5f7;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #000000;
    --color-surface: #1c1c1e;
    --color-border: #2c2c2e;
    --color-text: #f5f5f7;
    --color-text-secondary: #8e8e93;
    --color-bubble-bot: #2c2c2e;
    --color-bubble-bot-text: #f5f5f7;
  }
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-overscroll-behavior: none;
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 12px;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.3px;
}

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

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  transition: background .3s;
}
.connection-dot.connected { background: #34c759; }
.connection-dot.connecting { background: #ff9500; animation: pulse 1s infinite; }
.connection-dot.error { background: var(--color-danger); }

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

/* ── Dropdown menu ────────────────────────────────────────── */
.dropdown-menu {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 4px);
  right: 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
  animation: slideDown .15s ease;
}

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

.menu-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--color-text);
  cursor: pointer;
  transition: background .1s;
}
.menu-item:hover { background: var(--color-surface); }
.menu-item.danger { color: var(--color-danger); }
a.menu-item { text-decoration: none; display: block; }
.menu-item.menu-user {
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: default;
}
.menu-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* ── Messages ─────────────────────────────────────────────── */
.messages-area {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  left: 0; right: 0;
  bottom: var(--input-area-height, var(--input-min-height));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.messages-inner {
  padding: 20px 16px;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Welcome screen ───────────────────────────────────────── */
.welcome-msg {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--color-text-secondary);
}
.welcome-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
}
.welcome-icon img {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  object-fit: cover;
}
.welcome-msg h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.welcome-msg p {
  font-size: 16px;
  line-height: 1.5;
}

/* ── Message bubbles ──────────────────────────────────────── */
.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeInUp .2s ease;
}

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

.message-row.user {
  flex-direction: row-reverse;
}

.message-row + .message-row { margin-top: 4px; }
.message-row.user + .message-row:not(.user),
.message-row:not(.user) + .message-row.user {
  margin-top: 16px;
}

/* Column wrapper so timestamp can sit below the bubble */
.bubble-col {
  display: flex;
  flex-direction: column;
  max-width: min(75vw, 540px);
}
.message-row.user .bubble-col {
  align-items: flex-end;
}
.message-row.bot .bubble-col {
  align-items: flex-start;
  max-width: 100%;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  margin-top: 4px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Bot avatar: uses brand logo, transparent bg */
.avatar-bot {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

/* User avatar: distinct accent color */
.avatar-user {
  background: #0ea5e9; /* sky-500 — distinct from the indigo accent */
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.bubble {
  padding: 10px 14px;
  border-radius: var(--radius-bubble);
  line-height: 1.5;
  font-size: 15px;
  word-break: break-word;
  position: relative;
}

.bubble.user {
  background: var(--color-bubble-user);
  color: var(--color-bubble-user-text);
  border-bottom-right-radius: 5px;
  white-space: pre-wrap;
}

.bubble.bot {
  background: var(--color-bubble-bot);
  color: var(--color-bubble-bot-text);
  border-bottom-left-radius: 5px;
  white-space: normal;
  border-left: 3px solid transparent; /* placeholder — mobile gets the accent */
}

/* Mobile: subtle accent border on bot messages to distinguish from user */
@media (max-width: 699px) {
  .bubble.bot {
    border-left-color: var(--color-accent);
  }
}

.bubble.error {
  background: rgba(255,59,48,0.1);
  color: var(--color-danger);
  border-radius: var(--radius-bubble);
  white-space: pre-wrap;
}

.bubble-time {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 3px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity .15s;
}
.message-row:hover .bubble-time { opacity: 1; }
.message-row.user .bubble-time { text-align: right; }

/* ── NUC-256: Response Feedback Bar ────────────────────────────────────────── */
.feedback-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 0 2px;
  opacity: 0;
  transition: opacity .15s;
  flex-wrap: wrap;
}
.message-row:hover .feedback-bar { opacity: 1; }
.feedback-bar:has(.feedback-btn--active) { opacity: 1; }
.feedback-bar:has(.feedback-comment-wrap) { opacity: 1; }

.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s, transform .15s;
}
.feedback-btn svg { width: 14px; height: 14px; pointer-events: none; }
.feedback-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-2, rgba(255,255,255,.06));
  border-color: var(--color-border, rgba(255,255,255,.1));
}
.feedback-btn--active {
  color: var(--color-accent, #6366f1) !important;
  border-color: var(--color-accent, #6366f1) !important;
}
.feedback-btn--active svg { fill: var(--color-accent, #6366f1); }
.feedback-btn--inactive {
  opacity: 0.3;
}
@keyframes feedback-pulse {
  0%   { transform: scale(1);    }
  35%  { transform: scale(1.35); }
  65%  { transform: scale(0.9);  }
  100% { transform: scale(1);    }
}
.feedback-btn--pulse { animation: feedback-pulse 0.5s ease; }

/* Thumbs-down free-text comment field */
.feedback-comment-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.feedback-comment-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--color-surface-2, rgba(255,255,255,.05));
  border: 1px solid var(--color-border, rgba(255,255,255,.12));
  border-radius: 8px;
  color: var(--color-text);
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
.feedback-comment-input:focus { border-color: var(--color-accent, #6366f1); }
.feedback-comment-btns {
  display: flex;
  gap: 6px;
}
.feedback-comment-submit,
.feedback-comment-skip {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--color-border, rgba(255,255,255,.12));
  transition: background .15s;
}
.feedback-comment-submit {
  background: var(--color-accent, #6366f1);
  color: #fff;
  border-color: transparent;
}
.feedback-comment-submit:hover { opacity: .85; }
.feedback-comment-skip {
  background: transparent;
  color: var(--color-text-secondary);
}
.feedback-comment-skip:hover {
  background: var(--color-surface-2, rgba(255,255,255,.05));
}

/* Streaming cursor */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: currentColor;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: blink .7s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* pop-in animation for new messages */
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.95) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.message-row.pop-in { animation: pop-in .18s ease; }

/* ── Action buttons inside bubble ─────────────────────────── */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.action-btn {
  padding: 8px 18px;
  border: 1.5px solid var(--color-accent);
  border-radius: 20px;
  background: transparent;
  color: var(--color-accent);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.message-row.user .action-btn {
  border-color: rgba(255,255,255,.6);
  color: #fff;
}
.action-btn:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.action-btn:active { transform: scale(.97); }
.action-btn.used { opacity: .5; pointer-events: none; }

/* ── File attachment chip inside bubble ───────────────────── */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.08);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  margin-bottom: 6px;
}
.message-row.user .file-chip { background: rgba(255,255,255,.2); }

/* File chips shown inside the user bubble after send */
.bubble-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.bubble-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Status pill ──────────────────────────────────────────── */
.status-pill {
  position: fixed;
  bottom: calc(var(--input-min-height) + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  z-index: 50;
  animation: fadeInUp .2s ease;
  white-space: nowrap;
}

.status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Typing dots ──────────────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--color-bubble-bot);
  border-radius: var(--radius-bubble);
  border-bottom-left-radius: 5px;
  width: fit-content;
  margin: 6px 36px;
  animation: fadeInUp .2s ease;
}
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--color-text-secondary);
  border-radius: 50%;
  animation: bounce .8s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* ── Input area ───────────────────────────────────────────── */
.input-area {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  z-index: 100;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--color-surface);
  border-radius: 10px;
}
.upload-bar {
  flex: 1;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}
.upload-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width .2s;
  width: 0%;
}
.upload-name {
  font-size: 12px;
  color: var(--color-text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-cancel {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
}

.attached-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.attached-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  max-width: 180px;
}
.attached-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attached-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 14px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.textarea-wrapper {
  flex: 1;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 22px;
  padding: 8px 14px;
  transition: border-color .15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.textarea-wrapper:focus-within {
  border-color: var(--color-accent);
}

textarea#message-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font);
  font-size: 15px;
  color: var(--color-text);
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
}

textarea#message-input::placeholder { color: var(--color-text-secondary); }

/* ── Buttons ──────────────────────────────────────────────── */
.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:hover { background: var(--color-surface); }

.upload-label { cursor: pointer; }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s, opacity .15s;
  opacity: .5;
}
.send-btn:not(:disabled) { opacity: 1; }
.send-btn:not(:disabled):hover { background: var(--color-accent-hover); }
.send-btn:not(:disabled):active { transform: scale(.94); }
.send-btn:disabled { cursor: not-allowed; }

/* ── Stop button mode ─────────────────────────────────────── */
.send-btn.stop-mode {
  background: var(--color-danger);
  opacity: 1;
}
.send-btn.stop-mode:hover { background: #cc2a20; }

/* ── Bubble timestamps ────────────────────────────────────── */
.bubble-time {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 3px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity .15s;
}

/* ── Scroll-to-bottom button ──────────────────────────────── */
.scroll-btn {
  position: fixed;
  bottom: calc(var(--input-min-height) + 16px);
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity .2s, transform .2s;
}
.scroll-btn:hover {
  color: var(--color-text);
  transform: translateY(-2px);
}
.scroll-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
}

/* ── Approval toast ────────────────────────────────────────── */
.approval-toast {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid #f59e0b;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-md);
  z-index: 300;
  max-width: min(420px, calc(100vw - 32px));
  width: 100%;
  animation: slideDown .2s ease;
}
.approval-toast-icon { font-size: 20px; flex-shrink: 0; }
.approval-toast-body { flex: 1; min-width: 0; }
.approval-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}
.approval-toast-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.approval-toast-btn {
  flex-shrink: 0;
  padding: 7px 16px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.approval-toast-btn:hover { opacity: .85; }
.approval-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  line-height: 1;
}

/* ── Notification bell ─────────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
}

#notif-bell-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

.notif-drawer {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  animation: slideDown .15s ease;
}

.notif-drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--color-bg);
}

.notif-drawer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.notif-clear-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  color: var(--color-accent);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background .1s;
}
.notif-clear-btn:hover { background: var(--color-surface); }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background .1s;
  border-left: 3px solid transparent;
}
.notif-item:hover { background: var(--color-surface); }
.notif-item.unread { border-left-color: #ef4444; }
.notif-item:last-child { border-bottom: none; }

/* Type-based left-border colour coding */
.notif-item.notif-type-system  { border-left-color: #6b7280; }
.notif-item.notif-type-info    { border-left-color: #3b82f6; }
.notif-item.notif-type-agent-complete { border-left-color: #22c55e; }
.notif-item.notif-type-error   { border-left-color: #ef4444; }
/* unread overrides type colour with a brighter accent */
.notif-item.unread.notif-type-system  { border-left-color: #9ca3af; }
.notif-item.unread.notif-type-info    { border-left-color: #60a5fa; }
.notif-item.unread.notif-type-agent-complete { border-left-color: #4ade80; }
.notif-item.unread.notif-type-error   { border-left-color: #f87171; }

.notif-view-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--color-accent, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.notif-view-btn:hover { opacity: 0.85; }

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.notif-item-time {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.notif-item-preview {
  font-size: 12px;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Scrollbar (WebKit) ───────────────────────────────────── */
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* ── Tablet / Desktop — ChatGPT/Claude layout ─────────────── */
@media (min-width: 700px) {
  /* Constrain the content column */
  .messages-inner {
    padding: 40px 24px 24px;
    max-width: 720px;
  }

  /* Input bar matches the content column width */
  .input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .input-area > * {
    width: 100%;
    max-width: 720px;
  }

  /* Bot messages: no bubble on desktop, just clean text */
  .bubble.bot {
    background: transparent;
    border-radius: 0;
    padding: 4px 0;
    font-size: 16px;
    line-height: 1.75;
  }

  /* Hide avatars on desktop (layout is clean text, no bubbles for bot) */

  /* User messages: tighter pill, right-aligned */
  .bubble.user {
    max-width: 60%;
    font-size: 15px;
  }

  /* More vertical breathing room between turns */
  .message-row.bot { padding: 8px 0; }
  .message-row.user { padding: 4px 0; }
  .message-row.user + .message-row:not(.user),
  .message-row:not(.user) + .message-row.user {
    margin-top: 24px;
  }
}

/* ── Code blocks inside bubbles ───────────────────────────── */
.bubble code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: rgba(0,0,0,.08);
  padding: 2px 5px;
  border-radius: 4px;
}
.bubble.user code { background: rgba(255,255,255,.2); }

.bubble pre {
  background: rgba(0,0,0,.08);
  border-radius: 10px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
}
.bubble.user pre { background: rgba(255,255,255,.15); }

/* ── Rich content inside bot bubble ──────────────────────── */
.bubble.bot h1, .bubble.bot h2, .bubble.bot h3,
.bubble.bot h4, .bubble.bot h5, .bubble.bot h6 {
  margin: 12px 0 4px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text);
}
.bubble.bot h1 { font-size: 1.5em; }
.bubble.bot h2 { font-size: 1.3em; }
.bubble.bot h3 { font-size: 1.1em; }
.bubble.bot h4, .bubble.bot h5, .bubble.bot h6 { font-size: 1em; }

.bubble.bot ul, .bubble.bot ol {
  margin: 6px 0 6px 20px;
  padding: 0;
}
.bubble.bot li { margin: 2px 0; line-height: 1.55; }

.bubble.bot blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 8px 0;
  padding: 6px 12px;
  background: rgba(0,0,0,.04);
  border-radius: 0 6px 6px 0;
  color: var(--color-text-secondary);
  font-style: italic;
}
[data-theme="dark"] .bubble.bot blockquote { background: rgba(255,255,255,.04); }

.bubble.bot hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 12px 0;
}

.bubble.bot a, .bubble.user a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.bubble.user a { color: rgba(255,255,255,.9); }
.bubble.bot a:hover { opacity: .8; }

.bubble.bot p { min-height: 0.5em; }

/* ── First heading in bot bubble — no top margin ──────────── */
.bubble.bot h1:first-child,
.bubble.bot h2:first-child,
.bubble.bot h3:first-child { margin-top: 0; }

/* ── Mermaid diagrams ─────────────────────────────────────── */
.mermaid-wrap {
  margin: 12px 0;
  background: rgba(0,0,0,.25);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  text-align: center;
}
.mermaid-wrap svg {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ── Connect screen ────────────────────────────────────────── */
.connect-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.connect-screen.hidden {
  display: none;
}

.connect-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.connect-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
}

.connect-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.connect-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.connect-sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-align: center;
}

.connect-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.connect-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.connect-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.connect-field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}

.connect-field input:focus {
  border-color: var(--color-accent);
}

.connect-error {
  font-size: 13px;
  color: var(--color-danger);
  padding: 10px 12px;
  background: rgba(255, 59, 48, 0.08);
  border-radius: 8px;
}

.connect-error.hidden {
  display: none;
}

.connect-btn {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 4px;
}

.connect-btn:hover {
  background: var(--color-accent-hover);
}

.connect-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Suggested prompts ──────────────────────────────────────────── */
.suggestions-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.2s ease, padding 0.2s ease, opacity 0.2s ease;
  opacity: 1;
}

.suggestions-row.collapsed {
  max-height: 0;
  padding-bottom: 0;
  opacity: 0;
}

.suggestions-toggle {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 0 6px;
}

.suggestions-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.suggestions-toggle-btn:hover {
  color: var(--color-text);
}

.suggestions-toggle-btn .chevron {
  display: inline-block;
  transition: transform 0.2s ease;
  font-style: normal;
}

.suggestions-toggle-btn.collapsed .chevron {
  transform: rotate(180deg);
}

.suggestion-chip {
  font-size: 13px;
  font-family: var(--font);
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.3;
}

.suggestion-chip:hover {
  background: var(--color-border);
  border-color: var(--color-text-secondary);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.hidden { display: none; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  padding-top: var(--safe-top);
}

.sidebar:not(.hidden) {
  transform: translateX(0);
}

.sidebar.hidden {
  /* keep in DOM but off-screen -- transition works */
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.sidebar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.new-chat-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.new-chat-sidebar-btn:hover {
  background: var(--color-border);
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}

/* ── Conversation status dots ─────────────────────────────── */
.conv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: transparent;
}

.conv-dot--working {
  background: #34c759;
  animation: conv-dot-pulse 1.2s ease-in-out infinite;
}

.conv-dot--unread {
  background: #ff6b8a;
}

@keyframes conv-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}


.conversation-item:hover {
  background: var(--color-surface);
}

.conversation-item.active {
  background: var(--color-surface);
}

.conversation-item-title {
  flex: 1;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item-date {
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.conversation-delete-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.conversation-item:hover .conversation-delete-btn {
  display: block;
}

.conversation-delete-btn:hover {
  color: var(--color-danger);
  background: rgba(255,59,48,0.08);
}

.conversation-rename-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.conversation-item:hover .conversation-rename-btn {
  display: block;
}

.conversation-rename-btn:hover {
  color: var(--color-accent);
  background: rgba(99,102,241,0.08);
}

.conversation-share-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.conversation-item:hover .conversation-share-btn {
  display: block;
}

.conversation-share-btn:hover {
  color: var(--color-accent);
  background: rgba(99,102,241,0.08);
}

.conversation-rename-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
}



/* ── Code block with header ────────────────────────────────── */
.code-block {
  margin: 8px 0;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0,0,0,.08);
}
[data-theme="dark"] .code-block { background: rgba(255,255,255,.05); }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0,0,0,.12);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
[data-theme="dark"] .code-header {
  background: rgba(255,255,255,.06);
  border-bottom-color: rgba(255,255,255,.06);
}

.code-lang {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-copy-btn {
  font-size: 11px;
  font-family: var(--font);
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
  margin-left: auto;
}
.code-copy-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.code-block pre {
  margin: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px;
  overflow-x: auto;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
}

/* ── Markdown tables ───────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.bubble.bot table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.bubble.bot th,
.bubble.bot td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.bubble.bot th {
  font-weight: 600;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.bubble.bot tr:last-child td { border-bottom: none; }
.bubble.bot tr:hover td { background: rgba(0,0,0,.03); }
[data-theme="dark"] .bubble.bot tr:hover td { background: rgba(255,255,255,.03); }

/* ── Desktop: hide user avatar (user side already right-aligned) */
@media (min-width: 700px) {
  .message-row.bot .avatar { display: none; }
  .message-row.user .avatar { display: none; }
}

/* ── Task lists ──────────────────────────────────────────────── */
.bubble.bot ul.task-list {
  list-style: none;
  padding-left: 4px;
}
.bubble.bot li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 3px 0;
}
.task-checkbox {
  margin-top: 3px;
  flex-shrink: 0;
  cursor: default;
  accent-color: var(--color-accent);
}

/* ── Strikethrough ───────────────────────────────────────────── */
.bubble.bot del, .bubble.user del {
  text-decoration: line-through;
  opacity: 0.6;
}

/* ── hljs overrides: keep our code-block container styles ────── */
.code-block pre code.hljs {
  background: transparent;
  padding: 0;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  line-height: 1.5;
}
.code-block {
  background: #0d1117;
}
[data-theme="light"] .code-block {
  background: #f6f8fa;
}
[data-theme="light"] .code-header {
  background: rgba(0,0,0,.06);
  border-bottom-color: rgba(0,0,0,.1);
}

/* ── Paragraph spacing cleanup ───────────────────────────────── */
.bubble.bot p {
  margin: 0 0 6px 0;
  line-height: 1.6;
}
.bubble.bot p:last-child { margin-bottom: 0; }

/* ── PWA Install Banner ───────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.12);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.pwa-install-banner.visible {
  transform: translateY(0);
}
.pwa-install-banner.hidden {
  display: none;
}
.pwa-install-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}
.pwa-install-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}
.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-install-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.pwa-install-text span {
  font-size: 12px;
  color: var(--color-text-secondary);
}
.pwa-install-cta {
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: background .15s;
}
.pwa-install-cta:hover { background: var(--color-accent-hover); }
.pwa-install-dismiss {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  transition: background .15s;
}
.pwa-install-dismiss:hover { background: var(--color-border); }

/* ── Agent Status Badge ───────────────────────────────────── */
.agent-status-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  cursor: default;
  position: relative;
}
.agent-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  opacity: 0.4;
  transition: background .4s, opacity .4s;
}
.agent-status-wrap.active .agent-status-dot {
  background: #22c55e;
  opacity: 1;
  animation: agent-pulse 1.8s infinite;
}
.agent-status-wrap.flash .agent-status-dot {
  background: #22c55e;
  opacity: 1;
  animation: none;
}
@keyframes agent-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

/* ── Activity Feed ────────────────────────────────────────── */
.activity-wrap {
  position: relative;
}

.activity-drawer {
  width: 360px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background .1s;
}
.activity-item:hover { background: var(--color-surface); }
.activity-item:last-child { border-bottom: none; }

.activity-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-task {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.activity-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.activity-sep { opacity: 0.4; }

.activity-time { color: var(--color-text-secondary); }

.activity-agent {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 10px;
}

.activity-id {
  font-size: 10px;
  color: var(--color-accent);
  margin-top: 2px;
  opacity: 0.8;
}

.activity-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.activity-status-done    { background: rgba(34,197,94,.15);  color: #22c55e; }
.activity-status-active  { background: rgba(234,179,8,.15);  color: #ca8a04; animation: activity-pulse 1.5s infinite; }
.activity-status-review  { background: rgba(99,102,241,.15); color: var(--color-accent); }
.activity-status-cancel  { background: rgba(156,163,175,.15); color: var(--color-text-secondary); }
.activity-status-default { background: var(--color-surface); color: var(--color-text-secondary); }

@keyframes activity-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── NUC-253: Command Palette ─────────────────────────────────────────────── */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  backdrop-filter: blur(2px);
  animation: overlay-in 0.12s ease;
}
.cmd-palette-overlay.hidden { display: none; }

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

.cmd-palette {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: min(560px, 92vw);
  overflow: hidden;
  animation: palette-in 0.12s ease;
}

@keyframes palette-in {
  from { transform: translateY(-12px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.cmd-palette-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.cmd-palette-icon {
  flex-shrink: 0;
  color: var(--color-text-secondary);
}

.cmd-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--color-text);
  font-family: var(--font);
}

.cmd-palette-input::placeholder { color: var(--color-text-secondary); }

.cmd-palette-esc-hint {
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font);
  cursor: default;
  flex-shrink: 0;
}

.cmd-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-palette-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.08s;
  font-size: 14px;
  color: var(--color-text);
}

.cmd-palette-item:hover,
.cmd-palette-item.selected {
  background: var(--color-surface);
}

.cmd-palette-item-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.cmd-palette-item-label { flex: 1; }

.cmd-palette-item-kbd {
  font-size: 11px;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font);
  flex-shrink: 0;
}

/* ── NUC-253: Shortcuts Help Overlay ─────────────────────────────────────── */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: overlay-in 0.12s ease;
}
.shortcuts-overlay.hidden { display: none; }

.shortcuts-modal {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: min(480px, 92vw);
  overflow: hidden;
  animation: palette-in 0.12s ease;
}

.shortcuts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--color-border);
}

.shortcuts-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.shortcuts-close {
  color: var(--color-text-secondary);
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shortcuts-table td {
  padding: 10px 18px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.shortcuts-table tr:last-child td { border-bottom: none; }

.shortcuts-table td:first-child {
  color: var(--color-text-secondary);
  white-space: nowrap;
  width: 1%;
  padding-right: 24px;
}

.shortcuts-table kbd {
  display: inline-block;
  font-size: 11px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: var(--font);
  margin: 0 2px;
}


/* ── Analytics modal (NUC-258) ─────────────────────────────────────────────── */
.analytics-body { padding: 8px 0 4px; }
.analytics-loading { color: var(--text-muted); text-align: center; padding: 24px 0; font-size: 14px; }
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.analytics-card {
  background: var(--bg-input, #f5f5f5);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.analytics-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent, #6366f1);
  line-height: 1.1;
}
.analytics-card-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.analytics-streak-badge {
  display: inline-block;
  font-size: 18px;
  margin-bottom: 2px;
}
.analytics-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 16px 0 8px;
}
.analytics-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.analytics-topic-pill {
  background: var(--accent, #6366f1);
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}
.analytics-time-saved {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
}
