/* ==========================================================================
   DASH Web Alpha — Minimalist Personal Assistant Theme
   Visual Palette:
   - Main Background:    #F2EDE3 (Warm Linen / Cream)
   - Panels & Composer:  #F7F4EE (Soft Warm Ivory)
   - Borders & Dividers: #D8D0BF (Warm Sandstone 1px)
   - Primary Text:       #16181C (Charcoal Deep Black)
   - Brand Accent:       #253E66 (Deep Restrained Navy)
   ========================================================================== */

:root {
  --bg-main: #F2EDE3;
  --bg-panel: #F7F4EE;
  --bg-hover: #ECE6D8;
  --bg-subtle: #EFEBE1;
  --border-color: #D8D0BF;
  --border-subtle: #E3DDD0;
  --text-primary: #16181C;
  --text-secondary: #625D52;
  --text-muted: #827C70;
  --brand-accent: #253E66;
  --brand-hover: #1B2E4D;
  --brand-light: #E2E9F3;
  --accent-green: #2A6B3C;
  --accent-green-bg: #EAF4EC;
  --accent-amber: #8A5E12;
  --accent-amber-bg: #FEF7E6;
  --accent-red: #9A2B2B;
  --accent-red-bg: #FCE8E6;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar-width: 280px;
  --inspector-width: 380px;
  --header-height: 56px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Minimal Scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* APP CONTAINER */
.app-container {
  display: flex;
  height: 100%;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-main);
}

/* DRAWER BACKDROPS */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(22, 24, 28, 0.35);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   LEFT SIDEBAR (COLLAPSIBLE)
   ========================================================================== */
.left-rail {
  width: var(--sidebar-width);
  background-color: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  transition: margin-left 0.25s ease, transform 0.25s ease;
  z-index: 100;
}

.left-rail.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-glyph {
  color: var(--brand-accent);
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--brand-accent);
  letter-spacing: -0.02em;
}
.brand-sub {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.rail-action-row {
  padding: 12px 16px;
}
.btn-new-chat {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}
.btn-new-chat:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* Rail Navigation Tabs */
.rail-nav-tabs {
  display: flex;
  padding: 0 16px;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
}
.rail-tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 4px;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}
.rail-tab-btn.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
  font-weight: 600;
}
.rail-tab-btn:hover {
  color: var(--text-primary);
}

/* Rail Scroll Content */
.rail-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.rail-panel {
  display: none;
}
.rail-panel.active {
  display: block;
}

.section-subhead {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

/* Filter pills */
.task-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.task-pill {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.task-pill.active {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}

/* Card styles inside sidebar */
.task-card, .calendar-card, .conn-card {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}
.task-card:hover, .calendar-card:hover {
  border-color: var(--text-muted);
}
.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.task-card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.task-status-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-waiting {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
}
.status-auto {
  background: var(--brand-light);
  color: var(--brand-accent);
}
.status-completed {
  background: var(--accent-green-bg);
  color: var(--accent-green);
}
.status-paused, .status-cancelled {
  background: var(--bg-hover);
  color: var(--text-muted);
}
.task-action-note {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}
.task-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.task-time-hint {
  font-size: 10px;
  color: var(--text-muted);
}
.task-ctrl-btns {
  display: flex;
  gap: 4px;
}
.btn-task-action {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-task-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-task-action.danger:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* Calendar Card */
.calendar-time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--brand-accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.calendar-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.calendar-location {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Connections Vault */
.vault-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.privacy-callout {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.conn-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conn-provider-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.conn-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-green);
  display: inline-block;
}
.conn-meta {
  font-size: 10.5px;
  color: var(--text-muted);
}
.btn-revoke {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-revoke:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* Honest Empty State */
.empty-state {
  text-align: center;
  padding: 24px 12px;
}
.empty-state-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Rail Footer / Profile */
.rail-footer {
  border-top: 1px solid var(--border-color);
  padding: 12px 16px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-accent);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   MAIN CONVERSATION WORKSPACE
   ========================================================================== */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background-color: var(--bg-main);
  position: relative;
}

/* Header */
.chat-header {
  height: var(--header-height);
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.header-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--brand-accent);
  background: var(--brand-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.08em;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.datetime-badge {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot-sep {
  color: var(--border-color);
}
.btn-inspector {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.btn-inspector:hover {
  background: var(--bg-hover);
}
.badge-num {
  background: var(--brand-accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 10px;
}

/* Messages Stream */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 140px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Centered content constraint (760-840px) */
.messages-container > * {
  max-width: 800px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Conversation Starter Box */
.conversation-starter {
  text-align: center;
  padding: 48px 16px 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.starter-logo {
  color: var(--brand-accent);
  margin-bottom: 4px;
}
.starter-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.starter-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 480px;
  line-height: 1.5;
}

/* Message Rows */
.msg-row {
  display: flex;
  gap: 12px;
  width: 100%;
}
.msg-row.user {
  justify-content: flex-end;
}
.msg-row.assistant {
  justify-content: flex-start;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-row.assistant .msg-avatar {
  background: var(--brand-accent);
  color: #fff;
}
.msg-row.user .msg-avatar {
  background: var(--border-color);
  color: var(--text-primary);
  order: 2;
}

.msg-body {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg-row.user .msg-body {
  align-items: flex-end;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--border-color);
  word-break: break-word;
}
.msg-row.assistant .msg-bubble {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.msg-row.user .msg-bubble {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Read Aloud Button */
.msg-meta {
  display: flex;
  gap: 8px;
  padding-left: 2px;
}
.btn-read-aloud {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.btn-read-aloud:hover {
  color: var(--text-primary);
}

/* Approval Card */
.approval-card {
  background: #FFFDF8;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--brand-accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 6px;
}
.approval-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-accent);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.approval-destination {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.approval-summary {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}
.approval-hash {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 12px;
}
.approval-actions {
  display: flex;
  gap: 8px;
}
.btn-approve {
  background: var(--brand-accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.btn-approve:hover {
  background: var(--brand-hover);
}
.btn-reject {
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
.btn-reject:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

/* Markdown formatting in messages */
.md-p {
  margin-bottom: 6px;
}
.md-p:last-child {
  margin-bottom: 0;
}
.md-h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 10px 0 6px 0;
  color: var(--brand-accent);
}
.md-h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 8px 0 4px 0;
}
.md-h4 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 6px 0 4px 0;
}
.md-ul, .md-ol {
  margin: 6px 0 8px 20px;
}
.md-ul li, .md-ol li {
  margin-bottom: 3px;
}
.chat-link {
  color: var(--brand-accent);
  text-decoration: underline;
  font-weight: 500;
}
.chat-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-accent);
  color: #ffffff !important;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  font-weight: 600;
  font-size: 13px;
  margin: 6px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.15s ease;
}
.chat-btn-link:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.code-block {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 6px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
}
.inline-code {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.md-quote {
  border-left: 2px solid var(--border-color);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ==========================================================================
   COMPOSER (ANCHORED AT BOTTOM)
   ========================================================================== */
.chat-composer-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 20px 20px 20px;
  pointer-events: none;
  z-index: 50;
}

.chat-composer {
  pointer-events: auto;
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.attachment-preview img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 2px;
}
.preview-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  font-size: 11.5px;
}

.composer-input-row {
  display: flex;
  align-items: center;
}
.composer-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--text-primary);
  resize: none;
  min-height: 24px;
  max-height: 140px;
  line-height: 1.5;
}
.composer-textarea::placeholder {
  color: var(--text-muted);
}

.composer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
}
.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-tool {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-tool:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-tool.recording {
  color: var(--accent-red);
}

.composer-tools-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.audio-toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-send {
  background: var(--brand-accent);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-send:hover {
  background: var(--brand-hover);
}
.btn-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   INSPECTOR DRAWER (OPENS ONLY ON REQUEST)
   ========================================================================== */
.inspector {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--inspector-width);
  background-color: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 120;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.05);
  transition: transform 0.25s ease;
}
.inspector.collapsed {
  transform: translateX(100%);
  pointer-events: none;
}

.inspector-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}
.inspector-title-group h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.turn-id-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.inspector-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.tab-btn.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
  font-weight: 600;
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

.metric-group {
  margin-bottom: 14px;
}
.metric-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.metric-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.metric-value.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.metric-value.highlight {
  color: var(--brand-accent);
  font-weight: 700;
}

/* Steps Timeline */
.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.timeline-step {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.timeline-step-type {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-accent);
}
.timeline-step-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Usage Grid */
.usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.usage-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.box-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}
.box-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Latency Bars */
.latency-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.latency-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.lat-label {
  width: 110px;
  color: var(--text-secondary);
}
.lat-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
}
.lat-bar {
  height: 100%;
  background: var(--brand-accent);
  border-radius: 3px;
}
.lat-val {
  width: 45px;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.total-latency-box {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

/* Memory Items */
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.memory-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.btn-forget {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-forget:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(22, 24, 28, 0.4);
  backdrop-filter: blur(2px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}
.modal-header {
  padding: 24px 20px 12px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-header p {
  font-size: 12.5px;
  color: var(--text-secondary);
}
.modal-body {
  padding: 12px 20px 20px 20px;
}
.modal-footer {
  padding: 0 20px 20px 20px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.token-input, .form-select {
  width: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}
.token-input:focus, .form-select:focus {
  border-color: var(--brand-accent);
}

.btn-primary {
  background: var(--brand-accent);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: var(--brand-hover);
}
.btn-primary.full {
  width: 100%;
  text-align: center;
}
.btn-secondary {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
}
.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-secondary.full {
  width: 100%;
}
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  color: var(--text-primary);
}
.btn-mini-primary {
  background: var(--brand-accent);
  color: #fff;
  border: none;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
}

/* ==========================================================================
   RESPONSIVE (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
  .left-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  .left-rail.open {
    transform: translateX(0);
  }
  .left-rail.collapsed {
    margin-left: 0;
  }
  .mobile-only {
    display: block !important;
  }
  .inspector {
    width: 100vw;
  }
  .chat-composer-wrapper {
    padding: 0 10px 10px 10px;
  }
  .messages-container {
    padding: 16px 12px 130px 12px;
  }
  .msg-body {
    max-width: 90%;
  }
}

@media (max-width: 640px) {
  .datetime-badge {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* ==========================================================================
   DASH Notification Toasts
   ========================================================================== */
.notification-toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}

.notif-toast {
  pointer-events: auto;
  background-color: var(--bg-panel);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 14px rgba(22, 24, 28, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideInToast 0.25s ease-out;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  color: var(--brand-accent);
}

.notif-toast-body {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notif-toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}

.notif-toast-close:hover {
  color: var(--text-primary);
}

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

/* ==========================================================================
   Channel Switcher & WhatsApp Integration Styles
   ========================================================================== */
.channel-switch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-main);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.channel-switch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.channel-segmented-control {
  display: flex;
  background: var(--bg-hover);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.btn-channel {
  background: transparent;
  border: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-channel:hover {
  color: var(--text-primary);
}

.btn-channel.active {
  background: var(--bg-panel);
  color: var(--brand-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.channel-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background: var(--bg-panel);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background-color: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-dot.amber {
  background-color: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.status-dot.red {
  background-color: #ef4444;
}

.link-open-whatsapp {
  font-size: 11.5px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #bbf7d0;
  transition: background 0.15s ease;
}

.link-open-whatsapp:hover {
  background: #bbf7d0;
  text-decoration: none;
}

.btn-mini-pair {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-accent);
  background: var(--brand-light);
  border: 1px solid var(--brand-accent);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mini-pair:hover {
  background: var(--brand-accent);
  color: #ffffff;
}

/* Inactive Composer Overlay */
.composer-inactive-banner {
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  padding: 8px 12px;
  animation: fadeIn 0.2s ease;
}

.inactive-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-icon {
  font-size: 18px;
}

.banner-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.banner-title {
  font-size: 12px;
  font-weight: 600;
  color: #854d0e;
}

.banner-sub {
  font-size: 11px;
  color: #a16207;
  line-height: 1.3;
}

.btn-switch-back {
  background: #854d0e;
  color: #ffffff;
  border: none;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.btn-switch-back:hover {
  background: #713f12;
}

/* WhatsApp Pairing Modal */
.pairing-code-box {
  background: var(--bg-main);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.pairing-code-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pairing-code-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--brand-accent);
  margin-bottom: 4px;
}

.pairing-code-exp {
  font-size: 11px;
  color: var(--text-secondary);
}

.pairing-steps-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.pairing-step-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

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

