/* Chat-specific styles — extends style.css dark theme variables */

/* Widen app container for chat (login/picker still look fine centered) */
#app { max-width: 900px; }

/* ===== Chat View ===== */
#chat-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
}

/* --- Header --- */
#hub-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

#hub-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #4aff7a;
  transition: background 0.2s;
}

#hub-header.provider-openai::after {
  background: #ff4a6a;
}

#chat-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
  transition: background 0.3s;
}
#chat-status-dot.connected { background: #4aff7a; }
#chat-status-dot.error { background: var(--danger); }

#chat-agent-label {
  font-size: 15px;
  font-weight: 600;
}

/* --- Activity state label --- */
#chat-activity-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}
#chat-activity-label.visible { opacity: 1; }
#chat-activity-label.state-processing { color: var(--text-dim); animation: think-pulse 1.2s ease-in-out infinite; }
#chat-activity-label.state-thinking { color: var(--accent); animation: think-pulse 1s ease-in-out infinite; }
#chat-activity-label.state-responding { color: #4aff7a; }
#chat-activity-label.state-speaking { color: #b78aff; animation: think-pulse 1.2s ease-in-out infinite; }

/* Status dot active states */
#chat-status-dot.active {
  animation: dot-pulse 1.5s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 255, 122, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(74, 255, 122, 0); }
}

.notif-btn {
  position: relative;
}

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ff5a6b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.chat-header-spacer { flex: 1; }

/* --- Messages area --- */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* --- Message containers --- */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}
.msg.user { align-self: flex-end; }
.msg.agent { align-self: flex-start; }

.msg-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.msg.user .msg-content {
  background: var(--user-bg);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.msg.user { cursor: default; -webkit-user-select: text; user-select: text; }

/* Copy toast (overrides style.css position for chat layout) */
#copy-toast {
  bottom: 80px;
}

.msg.agent .msg-content {
  background: var(--agent-bg);
  border-bottom-left-radius: 4px;
  user-select: text;
  -webkit-user-select: text;
}

.approval-card {
  border: 1px solid rgba(255, 201, 90, 0.45);
  background: rgba(255, 201, 90, 0.07);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}

.approval-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  color: #ffd474;
}

.approval-prompt {
  font-size: 14px;
  margin-bottom: 8px;
}

.approval-actions {
  display: flex;
  gap: 8px;
}

.approval-actions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.approval-actions button:hover {
  border-color: var(--accent);
}

.approval-preview {
  font-size: 13px;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.5;
  color: var(--text-secondary, #ccc);
}

.approval-edit {
  width: 100%;
  min-height: 150px;
  max-height: 400px;
  font-family: inherit;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  color: var(--text);
  resize: vertical;
  line-height: 1.5;
}

.approval-edit:focus {
  outline: none;
  border-color: var(--accent);
}

#notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

#notif-panel {
  position: absolute;
  top: 54px;
  right: 14px;
  width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: #101018;
  border-radius: 12px;
  padding: 10px;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.notif-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.notif-clear-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.notif-clear-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.notif-clear-btn.hidden { display: none; }

.notif-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.notif-item:last-child {
  margin-bottom: 0;
}

.notif-item h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
}

.notif-item p {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.notif-item-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.notif-item-header h4 { flex: 1; }
.notif-time {
  font-size: 10px;
  opacity: 0.45;
  white-space: nowrap;
}
.notif-cron {
  border-left: 3px solid rgba(74, 158, 255, 0.5);
}
.notif-status-label {
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.55;
  margin-left: auto;
  padding-right: 8px;
  white-space: nowrap;
}

/* --- Markdown rendering --- */
.msg.agent .msg-content .response-text p { margin: 0 0 8px 0; }
.msg.agent .msg-content .response-text p:last-child { margin-bottom: 0; }

.msg.agent .msg-content .response-text code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
}

.msg.agent .msg-content .response-text pre {
  background: #161622;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  position: relative;
}

.msg.agent .msg-content .response-text pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--border);
  border: none;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:active { background: var(--accent); color: white; }

/* Tables */
.msg.agent .msg-content table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
}
.msg.agent .msg-content th,
.msg.agent .msg-content td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  font-size: 13px;
}
.msg.agent .msg-content th { background: rgba(255, 255, 255, 0.05); }

/* Lists */
.msg.agent .msg-content ul,
.msg.agent .msg-content ol {
  padding-left: 20px;
  margin: 4px 0;
}

/* Links */
.msg.agent .msg-content a { color: var(--accent); text-decoration: none; }
.msg.agent .msg-content a:hover { text-decoration: underline; }

/* --- Thinking panel --- */
.thinking-panel {
  background: rgba(74, 158, 255, 0.06);
  border: 1px solid rgba(74, 158, 255, 0.15);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--accent);
  user-select: none;
  -webkit-user-select: none;
}

.thinking-header .arrow {
  transition: transform 0.15s;
  font-size: 10px;
}
.thinking-panel.open .thinking-header .arrow {
  transform: rotate(90deg);
}

.thinking-body {
  display: none;
  padding: 0 12px 10px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}
.thinking-panel.open .thinking-body { display: block; }

.thinking-spinner {
  display: inline-block;
  animation: think-pulse 1s ease-in-out infinite;
}
@keyframes think-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.thinking-expand-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.thinking-expand-btn:hover { opacity: 1; }

/* --- Thinking modal --- */
#thinking-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

#thinking-modal {
  width: min(640px, calc(100vw - 32px));
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: #101018;
  border: 1px solid rgba(74, 158, 255, 0.25);
  border-radius: 12px;
  overflow: hidden;
}

.thinking-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.thinking-modal-status {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.thinking-modal-tokens {
  font-size: 12px;
  color: var(--text-dim);
}

.thinking-modal-close {
  margin-left: auto;
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.thinking-modal-close:hover {
  background: var(--danger);
  color: #fff;
}

.thinking-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
}

/* --- Tool panel --- */
.tool-panel {
  border-radius: 8px;
  margin: 6px 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  user-select: none;
  -webkit-user-select: none;
}

.tool-header .arrow {
  transition: transform 0.15s;
  font-size: 10px;
}
.tool-panel.open .tool-header .arrow {
  transform: rotate(90deg);
}

.tool-panel.running .tool-header {
  color: var(--accent);
  background: rgba(74, 158, 255, 0.06);
}
.tool-panel.success .tool-header {
  color: #4aff7a;
  background: rgba(74, 255, 122, 0.06);
}
.tool-panel.error .tool-header {
  color: var(--danger);
  background: rgba(255, 74, 106, 0.06);
}

.tool-body {
  display: none;
  padding: 8px 10px;
  font-size: 12px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  color: var(--text-dim);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  background: #161622;
}
.tool-panel.open .tool-body { display: block; }

.tool-input-summary {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.tool-duration {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
}

/* --- Input bar --- */
#input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 150px;
  min-height: 42px;
  -webkit-user-select: text;
  user-select: text;
}
#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-dim); }

#send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#send-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}
#send-btn:not(:disabled):active { transform: scale(0.92); }

/* --- Processing indicator (animated dots) --- */
.processing-indicator {
  padding: 4px 0;
}

.processing-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  height: 24px;
}
.processing-dots.clickable {
  cursor: pointer;
}

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

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

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

/* --- Streaming cursor --- */
.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 15px;
  background: var(--accent);
  border-radius: 1px;
  animation: cursor-blink 0.8s ease-in-out infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Sessions sidebar --- */
#sessions-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
}
#sessions-overlay.open { display: block; }

#sessions-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100dvh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 101;
  transition: right 0.2s ease;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}
#sessions-overlay.open #sessions-panel { right: 0; }

.sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sessions-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.sessions-new-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.sessions-new-btn:active { opacity: 0.7; }

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: all 0.15s;
}
.session-item.active {
  border-color: var(--accent);
  background: rgba(74, 158, 255, 0.1);
}

.session-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-item-text {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.session-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-time {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.session-delete-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.session-delete-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}
.session-delete-btn.confirming {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(255, 74, 106, 0.1);
  font-weight: 700;
}

/* --- Attach button --- */
#attach-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#attach-btn:hover { color: var(--text); }

/* --- Voice toggle buttons (mic / speaker) --- */
.voice-toggle-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
}
.voice-toggle-btn:hover { color: var(--text); }
.voice-toggle-btn.active {
  color: var(--accent);
  background: rgba(74, 158, 255, 0.12);
}
#mic-btn.recording {
  color: #ff4a6a;
  background: rgba(255, 74, 106, 0.12);
  animation: mic-pulse 1.5s ease-in-out infinite;
}
#tts-btn.speaking {
  color: #b78aff;
  background: rgba(183, 138, 255, 0.12);
  animation: tts-pulse 1.5s ease-in-out infinite;
}
@keyframes tts-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(183, 138, 255, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(183, 138, 255, 0); }
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 74, 106, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(255, 74, 106, 0); }
}

/* --- STT listening bar --- */
#stt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 74, 106, 0.06);
  flex-shrink: 0;
}
#stt-bar.hidden { display: none; }
#stt-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 14px;
}
.stt-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4a6a;
  animation: stt-blink 1s ease-in-out infinite;
}
@keyframes stt-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.stt-stop-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
}
.stt-stop-btn:active { transform: scale(0.95); }

/* --- Warming indicator --- */
.warming-indicator {
  padding: 4px 0;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

/* --- Image preview strip --- */
#image-preview-strip {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
#image-preview-strip.hidden { display: none; }

.preview-thumb {
  position: relative;
  flex-shrink: 0;
}
.preview-thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- User message images --- */
.msg-images {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.msg-image-thumb {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

/* --- File chips (text/markdown attachments) --- */
.preview-file-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 28px 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  flex-shrink: 0;
}
.preview-file-chip .file-icon { font-size: 16px; }
.msg-files {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.msg-file-chip {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--fg-dim, var(--fg));
}

/* --- Drag-drop overlay --- */
#chat-view.drag-over::after {
  content: "Drop file here";
  position: absolute;
  inset: 0;
  background: rgba(74, 158, 255, 0.08);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--accent);
  z-index: 10;
  pointer-events: none;
}

/* --- Briefing card (pinned) --- */
.briefing-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid rgba(74, 255, 122, 0.35);
  background: rgba(74, 255, 122, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

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

.briefing-card-title {
  font-weight: 700;
  font-size: 13px;
  color: #4aff7a;
  margin-bottom: 4px;
}

.briefing-card-body {
  font-size: 13px;
  color: var(--text-dim);
  max-height: 400px;
  overflow-y: auto;
}
.briefing-card-body h1,
.briefing-card-body h2,
.briefing-card-body h3 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; color: var(--text); }
.briefing-card-body h1 { font-size: 15px; }
.briefing-card-body p { margin: 4px 0; }
.briefing-card-body ul, .briefing-card-body ol { padding-left: 20px; margin: 4px 0; }
.briefing-card-body li { margin: 2px 0; }
.briefing-card-body a { color: #4fc3f7; }
.briefing-card-body code { background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.briefing-card-body pre { background: #161622; border-radius: 6px; padding: 8px; overflow-x: auto; margin: 6px 0; position: relative; }
.briefing-card-body pre code { background: none; padding: 0; font-size: 12px; }
.briefing-card-body strong { color: var(--text); }

.briefing-card-dismiss,
.card-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.briefing-card-dismiss:hover,
.card-dismiss:hover {
  color: var(--text);
}

/* Position dismiss button in inline cards (task, bookmark, approval, tweet) */
.task-card,
.bookmark-card,
.approval-card,
/* Review notification (compact card linking to /review) */
.review-notification {
  margin: 8px 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 210, 60, 0.2);
  background: rgba(255, 210, 60, 0.04);
  font-size: 0.88em;
}
.review-notif-header {
  display: flex; align-items: center; gap: 8px;
}
.review-notif-icon { font-size: 1em; }
.review-notif-title {
  font-weight: 600; color: #e8e8e8; font-size: 0.92em;
}
.review-notif-preview {
  color: rgba(255,255,255,0.45); font-size: 0.85em;
  margin-top: 4px; line-height: 1.3;
}
.review-notif-link {
  display: inline-block; margin-top: 6px;
  color: #7cb8ff; font-size: 0.82em; font-weight: 500;
  text-decoration: none;
}
.review-notif-link:hover { text-decoration: underline; }

.tweet-card,
.cron-run-card {
  position: relative;
}

.task-card > .card-dismiss,
.bookmark-card > .card-dismiss,
.approval-card > .card-dismiss,
.tweet-card > .card-dismiss,
.cron-run-card > .card-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.task-card:hover > .card-dismiss,
.bookmark-card:hover > .card-dismiss,
.approval-card:hover > .card-dismiss,
.tweet-card:hover > .card-dismiss,
.cron-run-card:hover > .card-dismiss {
  opacity: 1;
}

/* --- Card timestamps --- */
.card-timestamp {
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.7;
  margin-bottom: 4px;
}

/* --- Cron run cards (inline in chat) --- */
.cron-run-card {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.cron-run-card.cron-ok {
  border: 1px solid rgba(74, 255, 122, 0.35);
  background: rgba(74, 255, 122, 0.05);
}
.cron-run-card.cron-error {
  border: 1px solid rgba(255, 90, 107, 0.45);
  background: rgba(255, 90, 107, 0.07);
}
.cron-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.cron-status-label {
  font-size: 11px;
  opacity: 0.6;
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cron-summary {
  margin: 6px 0;
  opacity: 0.85;
  font-size: 12px;
  white-space: pre-wrap;
}
.cron-error-msg {
  margin: 6px 0;
  color: #ff5a6b;
  font-size: 12px;
  white-space: pre-wrap;
}
.cron-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.5;
}
.cron-detail {
  white-space: nowrap;
}

/* --- Tasks button --- */
.tasks-btn {
  position: relative;
  margin-left: 4px;
}

.tasks-btn svg {
  display: block;
}

/* --- Task cards (inline in chat) --- */
.task-card {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}

.task-card.task-created,
.task-card.task-updated {
  border: 1px solid rgba(74, 158, 255, 0.4);
  background: rgba(74, 158, 255, 0.06);
}

.task-card.task-completed {
  border: 1px solid rgba(74, 255, 122, 0.4);
  background: rgba(74, 255, 122, 0.06);
}

.task-card.task-deleted {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.task-card.task-due-soon {
  border: 1px solid rgba(255, 201, 90, 0.45);
  background: rgba(255, 201, 90, 0.07);
}

.task-card.task-overdue {
  border: 1px solid rgba(255, 74, 106, 0.45);
  background: rgba(255, 74, 106, 0.07);
}

.task-card-label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.task-created .task-card-label,
.task-updated .task-card-label { color: var(--accent); }
.task-completed .task-card-label { color: #4aff7a; }
.task-deleted .task-card-label { color: var(--text-dim); }
.task-due-soon .task-card-label { color: #ffd474; }
.task-overdue .task-card-label { color: #ff5a6b; }

.task-card-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.task-card-meta {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

.task-priority-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.task-priority-badge.high {
  background: rgba(255, 74, 106, 0.15);
  color: #ff5a6b;
}

.task-priority-badge.low {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

/* --- Bookmark cards --- */
.bookmark-card {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.bookmark-card.bookmark-created {
  border: 1px solid rgba(138, 92, 246, 0.4);
  background: rgba(138, 92, 246, 0.06);
}
.bookmark-card.bookmark-updated {
  border: 1px solid rgba(74, 158, 255, 0.4);
  background: rgba(74, 158, 255, 0.06);
}
.bookmark-card.bookmark-deleted {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.bookmark-card-label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
  color: #8a5cf6;
}
.bookmark-deleted .bookmark-card-label { color: var(--text-dim); }
.bookmark-card-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}
.bookmark-card-url {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.bookmark-card-url a {
  color: var(--accent);
  text-decoration: none;
}
.bookmark-card-url a:hover { text-decoration: underline; }
.bookmark-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.bookmark-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(138, 92, 246, 0.15);
  color: #a78bfa;
}

/* --- Bookmarks panel overlay --- */
#bookmarks-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
#bookmarks-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(90vw, 460px);
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px;
}
#bookmarks-panel h3 {
  font-size: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.bookmarks-panel-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.bookmarks-panel-item:last-child { border-bottom: none; }
.bookmarks-panel-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.bookmarks-panel-title:hover { color: var(--accent); }
.bookmarks-panel-host {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.bookmarks-panel-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.bookmarks-panel-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 20px 0;
}

/* --- Tweet draft cards --- */
.tweet-card {
  border: 1px solid rgba(29, 161, 242, 0.4);
  background: rgba(29, 161, 242, 0.07);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.tweet-card-posted {
  border-color: rgba(74, 255, 122, 0.4);
  background: rgba(74, 255, 122, 0.07);
}
.tweet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.tweet-card-label {
  font-weight: 700;
  font-size: 13px;
  color: #1da1f2;
}
.tweet-card-posted .tweet-card-label { color: #4aff7a; }
.tweet-card-chars {
  font-size: 11px;
  color: var(--text-dim);
}
.tweet-card-image {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.tweet-card-image img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.tweet-card-text {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 8px;
  line-height: 1.4;
}
.tweet-card-edit {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.4;
  box-sizing: border-box;
}
.tweet-card-actions {
  display: flex;
  gap: 8px;
}
.tweet-card-actions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.tweet-card-actions button:hover { background: var(--hover); }
.tweet-btn-publish {
  background: rgba(29, 161, 242, 0.2) !important;
  border-color: rgba(29, 161, 242, 0.5) !important;
}
.tweet-btn-publish:hover { background: rgba(29, 161, 242, 0.35) !important; }
.tweet-card-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.tweet-card-status {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}
.tweet-status-pending { color: var(--text-dim); }
.tweet-status-posted { color: #4aff7a; }
.tweet-status-error { color: #ff5a6b; }

/* --- Daily post draft cards --- */
.daily-post-card {
  border: 1px solid rgba(138, 43, 226, 0.4);
  background: rgba(138, 43, 226, 0.07);
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.daily-post-card-posted {
  border-color: rgba(74, 255, 122, 0.4);
  background: rgba(74, 255, 122, 0.07);
}
.daily-post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.daily-post-label {
  font-weight: 700;
  font-size: 13px;
  color: #b380ff;
}
.daily-post-card-posted .daily-post-label { color: #4aff7a; }
.daily-post-chars {
  font-size: 11px;
  color: var(--text-dim);
}
.daily-post-image {
  margin-bottom: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.daily-post-image img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.daily-post-text {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 8px;
  line-height: 1.4;
  max-height: 300px;
  overflow-y: auto;
}
.daily-post-edit {
  width: 100%;
  min-height: 120px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.4;
  box-sizing: border-box;
}
.daily-post-actions {
  display: flex;
  gap: 8px;
}
.daily-post-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.daily-post-btn:hover { background: var(--hover); }
.daily-post-btn-publish {
  background: rgba(138, 43, 226, 0.2) !important;
  border-color: rgba(138, 43, 226, 0.5) !important;
}
.daily-post-btn-publish:hover { background: rgba(138, 43, 226, 0.35) !important; }
.daily-post-btn-skip {
  background: rgba(255, 90, 107, 0.1) !important;
  border-color: rgba(255, 90, 107, 0.3) !important;
}
.daily-post-btn-skip:hover { background: rgba(255, 90, 107, 0.2) !important; }
.daily-post-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.daily-post-status {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}
.daily-post-status-pending { color: var(--text-dim); }
.daily-post-status-posted { color: #4aff7a; }
.daily-post-status-skipped { color: var(--text-dim); }
.daily-post-status-error { color: #ff5a6b; }

/* --- LinkedIn outreach cards --- */
.li-card {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  position: relative;
}
.li-card > .card-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
  line-height: 1;
}
.li-card:hover > .card-dismiss { opacity: 1; }
.li-campaign-card {
  border: 1px solid rgba(0, 119, 181, 0.4);
  background: rgba(0, 119, 181, 0.07);
}
.li-outreach-card {
  border: 1px solid rgba(255, 201, 90, 0.45);
  background: rgba(255, 201, 90, 0.07);
}
.li-outreach-sent {
  border-color: rgba(74, 255, 122, 0.4) !important;
  background: rgba(74, 255, 122, 0.07) !important;
}
.li-outreach-skipped {
  border-color: rgba(128, 128, 128, 0.3) !important;
  background: rgba(128, 128, 128, 0.05) !important;
}
.li-sent-card {
  border: 1px solid rgba(74, 255, 122, 0.4);
  background: rgba(74, 255, 122, 0.07);
}
.li-reply-card {
  border: 1px solid rgba(74, 255, 122, 0.5);
  background: rgba(74, 255, 122, 0.1);
}
.li-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.li-card-label {
  font-weight: 700;
  font-size: 13px;
  color: #0077b5;
}
.li-label-sent { color: #4aff7a; }
.li-label-reply { color: #4aff7a; }
.li-card-step {
  font-size: 11px;
  color: var(--text-dim);
}
.li-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.li-status-active { background: rgba(74, 255, 122, 0.15); color: #4aff7a; }
.li-status-paused { background: rgba(255, 201, 90, 0.15); color: #ffd474; }
.li-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.li-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.li-card-body {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}
.li-contact-info { margin-bottom: 8px; }
.li-contact-name { font-size: 14px; font-weight: 600; }
.li-contact-detail { font-size: 12px; color: var(--text-dim); }
.li-card-chars {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-bottom: 2px;
}
.li-msg-text {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 8px;
  line-height: 1.4;
}
.li-msg-edit {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.4;
  box-sizing: border-box;
}
.li-card-actions {
  display: flex;
  gap: 8px;
}
.li-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.li-btn:hover { background: var(--hover); }
.li-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.li-btn-approve {
  background: rgba(0, 119, 181, 0.2) !important;
  border-color: rgba(0, 119, 181, 0.5) !important;
}
.li-btn-approve:hover { background: rgba(0, 119, 181, 0.35) !important; }
.li-btn-skip {
  background: rgba(128, 128, 128, 0.1) !important;
  border-color: rgba(128, 128, 128, 0.3) !important;
}
.li-card-status {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}
.li-status-pending { color: var(--text-dim); }
.li-status-sent { color: #4aff7a; }
.li-status-skipped { color: #888; }
.li-status-error { color: #ff5a6b; }

/* --- X/Twitter outreach cards --- */
.x-card {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  position: relative;
}
.x-card > .card-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
  line-height: 1;
}
.x-card:hover > .card-dismiss { opacity: 1; }
.x-campaign-card {
  border: 1px solid rgba(29, 161, 242, 0.4);
  background: rgba(29, 161, 242, 0.07);
}
.x-outreach-card {
  border: 1px solid rgba(255, 201, 90, 0.45);
  background: rgba(255, 201, 90, 0.07);
}
.x-outreach-sent {
  border-color: rgba(74, 255, 122, 0.4) !important;
  background: rgba(74, 255, 122, 0.07) !important;
}
.x-outreach-skipped {
  border-color: rgba(128, 128, 128, 0.3) !important;
  background: rgba(128, 128, 128, 0.05) !important;
}
.x-sent-card {
  border: 1px solid rgba(74, 255, 122, 0.4);
  background: rgba(74, 255, 122, 0.07);
}
.x-reply-card {
  border: 1px solid rgba(74, 255, 122, 0.5);
  background: rgba(74, 255, 122, 0.1);
}
.x-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.x-card-label {
  font-weight: 700;
  font-size: 13px;
  color: #1da1f2;
}
.x-label-sent { color: #4aff7a; }
.x-label-reply { color: #4aff7a; }
.x-card-step {
  font-size: 11px;
  color: var(--text-dim);
}
.x-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.x-badge-active { background: rgba(74, 255, 122, 0.15); color: #4aff7a; }
.x-badge-paused { background: rgba(255, 201, 90, 0.15); color: #ffd474; }
.x-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.x-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.x-card-body {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}
.x-target-info { margin-bottom: 8px; }
.x-target-name { font-size: 14px; font-weight: 600; }
.x-target-display { font-weight: 400; color: var(--text-dim); font-size: 13px; }
.x-target-bio { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.x-context-label { font-size: 11px; color: var(--text-dim); margin: 6px 0 4px; font-weight: 600; }
.x-context-tweet {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 8px;
  border-left: 2px solid rgba(29, 161, 242, 0.3);
  margin-bottom: 4px;
  line-height: 1.3;
}
.x-card-chars {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-bottom: 2px;
}
.x-msg-text {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 8px;
  line-height: 1.4;
}
.x-msg-edit {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.4;
  box-sizing: border-box;
}
.x-card-actions {
  display: flex;
  gap: 8px;
}
.x-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.x-btn:hover { background: var(--hover); }
.x-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.x-btn-approve {
  background: rgba(29, 161, 242, 0.2) !important;
  border-color: rgba(29, 161, 242, 0.5) !important;
}
.x-btn-approve:hover { background: rgba(29, 161, 242, 0.35) !important; }
.x-btn-skip {
  background: rgba(128, 128, 128, 0.1) !important;
  border-color: rgba(128, 128, 128, 0.3) !important;
}
.x-card-status {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}
.x-status-pending { color: var(--text-dim); }
.x-status-sent { color: #4aff7a; }
.x-status-skipped { color: #888; }
.x-status-error { color: #ff5a6b; }

/* --- Task panel (overlay) --- */
#tasks-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

#tasks-panel {
  position: absolute;
  top: 54px;
  right: 14px;
  width: min(420px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: #101018;
  border-radius: 12px;
  padding: 10px;
}

#tasks-panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px 4px;
  color: var(--text);
}

.tasks-quick-add {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.tasks-quick-row {
  display: flex;
  gap: 8px;
}

.tasks-quick-add input[type="text"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
}

.tasks-quick-add input[type="text"]:focus {
  border-color: var(--accent);
}

.tasks-quick-add input[type="datetime-local"] {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
  color-scheme: dark;
}

.tasks-quick-add input[type="datetime-local"]:focus {
  border-color: var(--accent);
  color: var(--text);
}

.tasks-quick-add button {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.task-due-edit {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  width: 100%;
  color-scheme: dark;
}

.tasks-panel-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

.tasks-panel-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #000;
}

.task-checkbox:hover {
  border-color: var(--accent);
}

.task-checkbox.checked {
  background: #4aff7a;
  border-color: #4aff7a;
}

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

.tasks-panel-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.tasks-panel-title.completed {
  text-decoration: line-through;
  opacity: 0.5;
}

.tasks-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.tasks-panel-due {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 0;
}

.tasks-panel-source {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(125, 183, 255, 0.12);
  border: 1px solid rgba(125, 183, 255, 0.28);
  color: #9ac5ff;
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tasks-panel-source:hover {
  text-decoration: none;
  background: rgba(125, 183, 255, 0.18);
}

.tasks-panel-due.overdue {
  color: #ff5a6b;
}

.tasks-panel-due.due-soon {
  color: #ffc15a;
}

.task-item-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.tasks-panel-item:hover .task-item-actions {
  opacity: 1;
}

.task-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

.task-delete-btn:hover {
  color: #ff5a6b;
}

.task-priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.task-priority-dot.normal {
  background: #555;
}

.task-priority-dot.high {
  background: #ff5a6b;
}

.task-priority-dot.low {
  background: #4a9eff;
}

.task-completing {
  opacity: 0.5;
  transition: opacity 0.5s;
}

.tasks-panel-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px 0;
}

/* --- Briefings panel overlay --- */
#briefings-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}
#briefings-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(92vw, 560px);
  max-height: 75vh;
  overflow-y: auto;
  padding: 16px;
}
.briefings-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.briefings-panel-header h3 { font-size: 16px; margin: 0; }
.briefings-panel-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 24px 0;
}
.briefings-date-sep {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 0 4px;
}
.briefings-date-sep:first-child { padding-top: 0; }
.briefings-panel-item {
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.briefings-panel-item:hover {
  background: rgba(74, 255, 122, 0.04);
  border-color: rgba(74, 255, 122, 0.15);
}
.briefings-panel-item.expanded {
  background: rgba(74, 255, 122, 0.06);
  border-color: rgba(74, 255, 122, 0.25);
  cursor: default;
}
.briefings-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.briefings-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #4aff7a;
}
.briefings-item-meta {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.briefings-item-preview {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
}
.briefings-item-body {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  max-height: 50vh;
  overflow-y: auto;
  line-height: 1.5;
}
/* Reuse briefing card body styles for panel body */
.briefings-item-body h1,
.briefings-item-body h2,
.briefings-item-body h3 { font-size: 14px; font-weight: 600; margin: 10px 0 4px; color: var(--text); }
.briefings-item-body h1 { font-size: 15px; }
.briefings-item-body p { margin: 4px 0; }
.briefings-item-body ul, .briefings-item-body ol { padding-left: 20px; margin: 4px 0; }
.briefings-item-body li { margin: 2px 0; }
.briefings-item-body a { color: #4fc3f7; }
.briefings-item-body code { background: rgba(255,255,255,0.08); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.briefings-item-body pre { background: #161622; border-radius: 6px; padding: 8px; overflow-x: auto; margin: 6px 0; position: relative; }
.briefings-item-body pre code { background: none; padding: 0; font-size: 12px; }
.briefings-item-body strong { color: var(--text); }
.briefings-item-body table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.briefings-item-body th, .briefings-item-body td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.briefings-item-body th { background: rgba(255,255,255,0.04); font-weight: 600; color: var(--text); }

/* --- Briefings button --- */
.briefings-btn { color: var(--text-dim); }
.briefings-btn:hover { color: #4aff7a; }

/* --- Replay banner --- */
.replay-banner {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
  animation: think-pulse 1s ease-in-out infinite;
}

/* --- Mobile quick-access strip (above input bar) --- */
#mobile-quick-strip {
  display: none;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .msg { max-width: 95%; }
  .tool-input-summary { max-width: 150px; }
  #hub-header { gap: 4px; padding: 8px 10px; }
  #hub-header .mode-switch { font-size: 12px; gap: 2px; }
  #hub-header .mode-switch .mode-btn { padding: 4px 8px; }
  #chat-agent-label { font-size: 13px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #chat-activity-label { display: none; }

  /* Hide data panel buttons from header on mobile */
  #hub-header .briefings-btn,
  #hub-header .bookmarks-btn,
  #hub-header .tasks-btn,
  #hub-header .notif-btn { display: none; }

  /* Show mobile quick-access strip */
  #mobile-quick-strip {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 4px;
    padding: 6px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
  }
  .mobile-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 44px;
    border: none;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .mobile-quick-btn:active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
  }
  .mobile-quick-btn svg { width: 20px; height: 20px; }
  .mobile-quick-btn span {
    font-size: 9px;
    margin-top: 2px;
    letter-spacing: 0.3px;
  }
  .mobile-quick-btn .notif-count {
    position: absolute;
    top: 2px;
    right: 10px;
  }

  /* Panels fill more of the screen on mobile */
  #briefings-panel, #tasks-panel, #bookmarks-panel, #notif-panel {
    width: 95vw !important;
    max-height: 80vh !important;
    top: 40px !important;
    right: auto !important;
  }
  #briefings-overlay, #tasks-overlay, #bookmarks-overlay, #notif-overlay {
    padding-top: 30px;
    align-items: flex-start;
    justify-content: center;
  }

  .task-checkbox {
    width: 28px;
    height: 28px;
  }

  .task-item-actions {
    opacity: 1;
  }

  .task-delete-btn {
    padding: 8px;
  }
}

/* --- Email triage cards --- */
.em-card {
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  position: relative;
}
.em-card > .card-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
  line-height: 1;
}
.em-card:hover > .card-dismiss { opacity: 1; }
.em-triage-card {
  border: 1px solid rgba(0, 120, 212, 0.4);
  background: rgba(0, 120, 212, 0.07);
}
.em-triage-card.em-urgent {
  border-color: rgba(255, 140, 0, 0.5);
  background: rgba(255, 140, 0, 0.08);
}
.em-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.em-card-label {
  font-weight: 700;
  font-size: 13px;
  color: #0078d4;
}
.em-card-urgency {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.em-urgency-high {
  background: rgba(255, 140, 0, 0.2);
  color: #ff8c00;
}
.em-urgency-normal {
  background: rgba(0, 120, 212, 0.15);
  color: #5ba3d9;
}
.em-from {
  font-size: 14px;
  font-weight: 600;
}
.em-subject {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.em-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.em-preview {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
}
.em-reason {
  font-size: 12px;
  color: #ff8c00;
  margin-bottom: 6px;
  font-style: italic;
}
.em-reply-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.em-reply-text {
  font-size: 14px;
  white-space: pre-wrap;
  margin-bottom: 8px;
  line-height: 1.4;
}
.em-reply-edit {
  width: 100%;
  min-height: 80px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
  line-height: 1.4;
  box-sizing: border-box;
}
.em-card-actions {
  display: flex;
  gap: 8px;
}
.em-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.em-btn:hover { background: var(--hover); }
.em-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.em-btn-send {
  background: rgba(0, 120, 212, 0.2) !important;
  border-color: rgba(0, 120, 212, 0.5) !important;
}
.em-btn-send:hover { background: rgba(0, 120, 212, 0.35) !important; }
.em-btn-delete {
  background: rgba(255, 90, 107, 0.1) !important;
  border-color: rgba(255, 90, 107, 0.3) !important;
}
.em-btn-delete:hover { background: rgba(255, 90, 107, 0.2) !important; }
.em-btn-skip {
  background: rgba(128, 128, 128, 0.1) !important;
  border-color: rgba(128, 128, 128, 0.3) !important;
}
.em-card-status {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 600;
}
.em-status-pending { color: var(--text-dim); }
.em-status-done { color: #4aff7a; }
.em-status-error { color: #ff5a6b; }

/* ── Media Panel (Images + Videos) ─────────────────────────────────── */

.media-tabs {
  display: flex;
  gap: 4px;
}
.media-tab {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--text-dim, #888);
  font-size: 14px;
  padding: 4px 16px;
  cursor: pointer;
  transition: all 0.15s;
}
.media-tab:hover { color: var(--text-primary, #e0e0e0); background: rgba(255,255,255,0.1); }
.media-tab.active {
  color: #fff;
  background: rgba(126,207,255,0.15);
  border-color: rgba(126,207,255,0.4);
}

.video-card-thumb-wrap {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #0a0a15;
  cursor: pointer;
  position: relative;
}
.video-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  transition: background 0.2s;
}
.video-card-thumb-wrap:hover .video-play-icon {
  background: rgba(0,0,0,0.15);
}

/* ── Image Gallery ─────────────────────────────────────────────────── */

#images-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  overflow-y: auto;
}

#images-panel {
  background: var(--bg-chat, #1a1a2e);
  border-radius: 12px;
  width: 90%;
  max-width: 860px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.images-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.images-panel-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-primary, #e0e0e0);
}
.images-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.images-panel-close {
  background: none;
  border: none;
  color: var(--text-dim, #888);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.images-panel-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.images-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 600px) {
  .images-grid { grid-template-columns: repeat(2, 1fr); }
}

.images-loading, .images-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim, #888);
  padding: 40px 0;
}

.image-card {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  transition: border-color 0.2s;
}
.image-card:hover {
  border-color: rgba(255,255,255,0.2);
}

.image-card-thumb-wrap {
  aspect-ratio: 1;
  overflow: hidden;
  background: #0a0a15;
  cursor: pointer;
}
.image-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.image-card-thumb:hover {
  transform: scale(1.05);
}

.image-card-info {
  padding: 8px 10px 4px;
}
.image-card-name {
  font-size: 12px;
  color: var(--text-primary, #e0e0e0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.image-card-meta {
  font-size: 11px;
  color: var(--text-dim, #888);
  margin-top: 2px;
}

.image-card-actions {
  display: flex;
  gap: 4px;
  padding: 6px 10px 10px;
}
.img-act-btn {
  flex: 1;
  padding: 4px 0;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  color: var(--text-primary, #e0e0e0);
  cursor: pointer;
  transition: background 0.15s;
}
.img-act-btn:hover {
  background: rgba(255,255,255,0.12);
}
.img-attach { color: #7ecfff; border-color: rgba(126,207,255,0.3); }
.img-attach:hover { background: rgba(126,207,255,0.15); }
.img-delete { color: #ff5a6b; border-color: rgba(255,90,107,0.3); }
.img-delete:hover { background: rgba(255,90,107,0.15); }

/* ── Image Lightbox ─────────────────────────────────────────────────── */

#image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 12px;
  padding: 0 4px;
}
.lightbox-name {
  color: var(--text-dim, #888);
  font-size: 13px;
}
.lightbox-actions {
  display: flex;
  gap: 8px;
}
.lightbox-actions .img-act-btn {
  padding: 6px 14px;
  font-size: 13px;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 32px;
  cursor: pointer;
}
.lightbox-close:hover { color: #fff; }

/* Model upgrade hint (lite → local/hq suggestion) */
.model-upgrade-hint {
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #999;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.model-upgrade-hint em { font-style: italic; }
.model-upgrade-hint strong { color: #bbb; }
.model-upgrade-hint a { color: #7cacf8; text-decoration: none; }
.model-upgrade-hint a:hover { text-decoration: underline; }
