:root {
  /* Soft retro 70s palette */
  --bg: #FAF3E0;        /* cream */
  --panel: #FFF5E6;     /* pale peach */
  --panel-2: #F3E8D3;   /* parchment */
  --text: #40352A;      /* deep sepia */
  --muted: #6E5D4E;     /* muted brown */
  --accent: #D97C2B;    /* pumpkin orange */
  --border: #E6D8C3;    /* soft beige */
  --chip-bg: #F6EBDD;   /* light chip bg */
  --topbar-height: 52px;
  --sidebar-width: 320px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--panel-2));
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
}
body.nav-open { overflow: hidden; }
.hidden { display: none !important; }

/* Custom scrollbar styling for webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--panel-2);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid var(--panel-2);
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

::-webkit-scrollbar-thumb:active {
  background: var(--accent);
}

/* Scrollbar styling for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--panel-2);
}

.mobile-only { display: none !important; }
.desktop-only { display: inherit !important; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.04);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
  min-height: var(--topbar-height);
}
.brand { font-weight: 700; letter-spacing: 0.2px; }
.spacer { flex: 1; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.toolbar-actions button { cursor: pointer; }
.toolbar-actions .icon-btn { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; gap: 6px; }
.icon-btn { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 6px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn:hover { background: rgba(0,0,0,0.05); }
.icon-btn.ok { color: var(--accent); border-color: var(--accent); }
.icon-btn.destructive { color: #dc3545; border-color: #dc3545; }
.icon-btn.destructive:hover { background: rgba(220, 53, 69, 0.1); }

.layout {
  display: grid;
  grid-template-columns: minmax(260px, var(--sidebar-width)) 1fr;
  height: calc(100vh - var(--topbar-height));
  min-height: calc(100vh - var(--topbar-height));
}
.sidebar {
  border-right: 1px solid var(--border);
  overflow: auto;
  width: var(--sidebar-width);
  max-width: 100%;
  transition: transform 0.3s ease, background 0.2s ease, border-color 0.2s ease;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  z-index: 60;
  position: relative;
}

.sidebar.dragover {
  background: linear-gradient(180deg, rgba(217, 124, 43, 0.1), rgba(217, 124, 43, 0.05));
  border-right-color: var(--accent);
}

.sidebar.dragover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(217, 124, 43, 0.08);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  margin: 8px;
  pointer-events: none;
  z-index: 1000;
}

.sidebar .drag-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(217, 124, 43, 0.9);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  pointer-events: none;
}
.sidebar-inner { padding: 8px 8px 64px; position: relative; }
.filter { padding: 6px; position: sticky; top: 49px; background: linear-gradient(180deg, var(--bg), rgba(0,0,0,0)); z-index: 5; display: flex; align-items: center; gap: 4px; }
.filter input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.filter-clear-btn { display: none; padding: 4px 8px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; border-radius: 4px; min-width: 32px; min-height: 32px; align-items: center; justify-content: center; transition: background-color 0.2s; }
.filter-clear-btn:hover { background-color: var(--border); }
.filter input:not(:placeholder-shown) ~ .filter-clear-btn { display: flex; }

details.year, details.week, details.day { border-radius: 6px; }
details.year > summary, details.week > summary, details.day > summary {
  padding: 6px 6px; margin: 2px 0; cursor: pointer;
  background: transparent;
  border: none;
  display: flex; align-items: center; gap: 6px;
}
/* Hide all webkit markers */
summary::-webkit-details-marker {
  display: none;
}
.caret { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.7; }
.nav-title {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.async-update-item {
  background: rgba(217, 124, 43, 0.1);
  padding-left: 12px;
}

.async-update-item.selected {
  border-left: 3px solid var(--accent);
}
details.week { margin-left: 8px; }
details.week > summary {
  justify-content: space-between;
}
details.week .summary-range {
  font-size: 10px;
  margin-left: auto;
  text-align: right;
}
details.day { margin-left: 16px; }
.file-item {
  display: flex; justify-content: flex-start; gap: 10px; align-items: center;
  padding: 6px 10px; margin: 2px 0 2px 22px;
  background: transparent; cursor: pointer; border-radius: 6px;
}
.file-item:hover { background: rgba(217, 124, 43, 0.15); }
.file-item.selected { background: rgba(217,124,43,0.25); box-shadow: inset 2px 0 0 0 var(--accent); }
.file-item .name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .meta { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; }
.file-item .new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: 6px; box-shadow: 0 0 0 1px var(--panel-2); }

/* Note-specific styles */
.note-item {
  /* Use default colors, no special styling needed */
}

.note-content {
  padding: 20px;
}

.note-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.note-header h1 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.note-meta {
  color: var(--muted);
  font-size: 14px;
}

.note-body {
  line-height: 1.6;
  font-family: Georgia, serif;
  font-size: 16px;
}

.note-body h1, .note-body h2, .note-body h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text);
}

.note-body h1 {
  font-size: 22px;
}

.note-body h2 {
  font-size: 20px;
}

.note-body h3 {
  font-size: 18px;
}

.note-body ul, .note-body ol {
  margin: 1em 0;
  padding-left: 2em;
}

.note-body p {
  margin: 1em 0;
}

.note-body strong {
  font-weight: 600;
}

.note-body em {
  font-style: italic;
}

.content { position: relative; padding: 0 0 80px 0; display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
.panel-stack { padding: 12px 20px 0; flex: 0 0 auto; }
.panel-stack.fill {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.panel-stack.fill .tab-panel {
  min-height: 100%;
}
.tab-panel { margin-bottom: 12px; }
.tab-panel.hidden { display: none !important; }
.file-header {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center;
  gap: 12px; padding: 8px 8px; margin: 0 0 8px; background: var(--panel-2);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.file-header .title { font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.file-header .pill { font-size: 12px; color: var(--muted); background: var(--chip-bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 999px; }
.speaker-pills { display: inline-flex; gap: 6px; overflow: hidden; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; row-gap: 6px; }
.speaker-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 999px; background: var(--chip-bg); border: 1px solid var(--border); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.speaker-pill .dot { width: 9px; height: 9px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
.speaker-pill-label { font-weight: 500; letter-spacing: 0.1px; }
.chip.more { color: var(--muted); }
.file-header .tabs { margin-left: auto; display: inline-flex; gap: 8px; flex: 0 0 auto; }
.file-header .tabs .icon-btn { border: 0; }
.file-header .tabs[style*="display: none"] + .more-menu,
.file-header .tabs[style*="display:none"] + .more-menu { margin-left: auto; }
.file-header .more-menu { margin-left: 8px; }
.tab { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; cursor: pointer; color: var(--muted); border-radius: 10px; border: 1px solid transparent; background: rgba(0,0,0,0.02); transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.tab .ms { font-size: 18px; }
.tab:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.tab:disabled { opacity: 0.45; cursor: not-allowed; }
.tab.active { color: var(--accent); background: rgba(217,124,43,0.16); border-color: rgba(217,124,43,0.25); box-shadow: 0 4px 14px rgba(217,124,43,0.2); }
.more-menu { position: relative; }
.more-menu .menu-btn { background: transparent; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.dropdown { position: absolute; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 200px; padding: 6px; display: none; z-index: 20; }
.dropdown.open { display: block; }
.dropdown .item { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.dropdown .item:hover { background: rgba(0,0,0,0.05); }
.dropdown .item.disabled { opacity: 0.5; cursor: default; }
.dropdown .item.disabled:hover { background: transparent; }
.dropdown .divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown .item.delete { color: #dc3545; }
.dropdown .item.delete:hover { background: rgba(220, 53, 69, 0.1); }

/* User menu dropdown */
.toolbar-actions { position: relative; }
#userMenuDropdown { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 220px; padding: 6px; z-index: 20; }
#userMenuDropdown:not(.hidden) { display: block; }
.dropdown-header { padding: 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.dropdown-item { width: 100%; padding: 8px 12px; border-radius: 6px; cursor: pointer; background: transparent; border: none; color: var(--text); display: flex; align-items: center; gap: 8px; font: inherit; text-align: left; }
.dropdown-item:hover { background: rgba(0,0,0,0.05); }
.dropdown-item .ms { font-size: 18px; }

.ai-content {
  padding: 12px 0 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-content .user {
  align-self: flex-end;
  max-width: 70%;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 10px 10px 0 10px;
}
.ai-content .assistant {
  align-self: stretch;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.assistant-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assistant-title {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.assistant-byline {
  margin: 0 0 12px 0;
  font-size: 0.95em;
  font-style: italic;
  color: var(--muted);
}

.assistant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.task-status {
  font-size: 14px;
  margin-left: 8px;
  cursor: help;
  transition: transform 0.2s ease;
}

.task-status:hover {
  transform: scale(1.2);
}

.task-status.status-new {
  opacity: 0.7;
}

.task-status.status-in_progress {
  animation: pulse 2s infinite;
}

.task-status.status-done {
  opacity: 1;
}

.task-status.status-cancelled {
  opacity: 0.5;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.assistant-summary p {
  margin: 6px 0;
  white-space: pre-wrap;
}
.assistant-section {
  margin-top: 12px;
}
.assistant-section h4 {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.assistant-actions {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assistant-subheading {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 6px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.assistant-action {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.assistant-action .ms {
  font-size: 18px;
  line-height: 1;
  color: var(--accent);
}
.assistant-action-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.assistant-action-meta {
  font-size: 12px;
  color: var(--muted);
}
.assistant-bullets {
  margin: 0;
  padding-left: 18px;
}
.assistant-bullets li {
  margin-bottom: 4px;
}
/* Action items with checkboxes */
.assistant-bullets li.action-item-with-checkbox {
  list-style: none;
  margin-left: -18px;
  padding-left: 18px;
}
.assistant-bullets li.action-item-with-checkbox .action-main-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 2px;
}
.assistant-bullets li.action-item-with-checkbox .action-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}
.assistant-bullets li.action-item-with-checkbox .action-checkbox:hover {
  transform: scale(1.1);
}
.assistant-bullets li.action-item-with-checkbox .action-text {
  flex: 1;
  font-weight: 600;
}
.assistant-bullets li.action-item-done .action-text {
  text-decoration: line-through;
  opacity: 0.6;
}
.assistant-bullets li.action-item-with-checkbox .assistant-action-meta {
  margin-left: 26px;
  margin-top: 2px;
}
.insights-card { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.insights-card .title { font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.insights-card .section { margin-top: 6px; }
.insights-card ul { margin: 4px 0 4px 18px; }
.insights-card .meta { color: var(--muted); font-size: 12px; }
.meta-content pre { background: var(--panel); border: 1px solid var(--border); padding: 12px; border-radius: 8px; overflow: auto; }
.meta-summary { display: grid; grid-auto-rows: minmax(12px, auto); gap: 6px; margin-bottom: 12px; }
.progress { width: 100%; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; display: block; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width 0.2s ease; }
.meta-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.meta-table th, .meta-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.meta-table th { font-weight: 600; background: rgba(0,0,0,0.03); }
.meta-table td:first-child { display: flex; align-items: center; gap: 6px; }
.color-chip { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }
#speaker-breakdown { margin-top: 8px; }
.speakers { display: flex; flex-direction: column; gap: 8px; }
.speaker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.speaker-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--progress-width, 0%);
  background: var(--speaker-color, var(--accent));
  opacity: 0.12;
  transition: width 0.2s ease;
  z-index: 0;
}
.speaker-row > * {
  position: relative;
  z-index: 1;
}
.speaker-row .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--speaker-color, var(--accent)); }
.speaker-row .speaker-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.speaker-row .pct { width: 50px; text-align: right; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.speaker-row .progress { display: none; }
.speaker-edit-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.speaker-row:hover .speaker-edit-btn {
  opacity: 1;
}
.speaker-edit-btn:hover {
  color: var(--text);
  background: var(--hover);
}
.speaker-edit-btn .ms {
  font-size: 16px;
}
/* Align speaker rows into columns: name | percent | bar */
.meta-summary .speaker-row { display: flex; align-items: center; column-gap: 8px; gap: 8px; }
.meta-summary .speaker-name { flex: 0 0 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-summary .speaker-pct { flex: 0 0 60px; color: var(--muted); font-size: 12px; text-align: left; }

/* AI input bar at bottom */
.bottom-input { position: absolute; left: 0; right: 0; bottom: 0; background: var(--panel-2); padding: 10px 20px; border-top: 1px solid var(--border); display: none; z-index: 12; flex: 0 0 auto; }
.bottom-input.active { display: block; }
.bottom-input .inner { display: flex; gap: 8px; }
.bottom-input select { padding: 10px 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; }
.bottom-input input[type="text"] { flex: 1; padding: 10px 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 8px; }
.bottom-input button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  transition: opacity 0.2s ease;
}
.bottom-input button .ms {
  font-size: 18px;
  line-height: 1;
}
.bottom-input button.busy {
  opacity: 0.5;
  cursor: default;
}

/* Context toggle checkbox */
.context-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  transition: background 0.2s ease;
  white-space: nowrap;
}
.context-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}
.context-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.context-toggle .label-text {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.context-toggle input[type="checkbox"]:checked + .label-text {
  color: var(--accent);
}

/* Spinner for AI send */
.spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { pointer-events: auto; min-width: 220px; max-width: 90vw; max-height: 80vh; padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(0,0,0,0.12); opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease, border-color .25s ease; overflow-y: auto; word-wrap: break-word; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.info { border-left: 4px solid var(--accent); }
.toast.success { border-left: 4px solid #2e7d32; }
.toast.error { border-left: 4px solid #c62828; }
.toast.progress { border-left: 4px solid var(--accent); min-width: 280px; }

.progress-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-message {
  font-weight: 500;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* Basic markdown rendering */
.ai-content h1, .ai-content h2, .ai-content h3 { margin: 8px 0; }
.ai-content p { margin: 6px 0; }
.ai-content ul { margin: 6px 0 6px 20px; }
.ai-content code { background: var(--panel); border: 1px solid var(--border); padding: 1px 4px; border-radius: 4px; }
.ai-content pre { background: var(--panel); border: 1px solid var(--border); padding: 10px; border-radius: 8px; overflow: auto; }
/* Transcript */
.segments-summary {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.transcript {
  padding: 12px 20px;
  display: grid;
  grid-auto-rows: max-content;
  gap: 12px;
  flex: 1 1 auto;
  overflow: auto;
}
.transcript > * { flex: 0 0 auto; }

.segment-group {
  border-left: 4px solid var(--group-border, var(--accent));
  border-radius: 16px;
  background: var(--group-bg, rgba(255, 255, 255, 0.55));
  box-shadow: 0 8px 22px rgba(64, 53, 42, 0.1);
  overflow: hidden;
}

.segment-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  justify-content: flex-start;
}
.segment-group-header .speaker-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}
.segment-group-header .speaker-chip .speaker-name {
  font-weight: 600;
  letter-spacing: 0.1px;
}

.segment-group-body {
  display: grid;
  gap: 4px;
  padding: 4px 14px 12px;
}
.segment-line {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: start;
  gap: 8px;
  padding: 6px 0;
  border-radius: 6px;
}
.segment-line:not(:first-child) { border-top: 1px solid rgba(0,0,0,0.04); padding-top: 8px; }
.segment-subtime {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}
.segment-text {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.6;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
  gap: 6px;
}
.chip .dot { flex: 0 0 auto; }
.speaker-chip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* Speakers panel */
.speakers { padding: 10px 20px; display: grid; gap: 10px; }
.speaker-row {
  display: grid;
  grid-template-columns: 16px 1fr 60px minmax(160px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.speaker-row > .dot { width: 10px; height: 10px; box-shadow: none; }
.speaker-row:last-child { border-bottom: none; }
.speaker-row .name-edit { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); }
.speaker-row .pct { color: var(--muted); font-size: 12px; text-align: right; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--text); border: 1px solid var(--border); border-radius: 12px; min-width: 320px; max-width: 92vw; padding: 16px; box-shadow: 0 14px 36px rgba(0,0,0,0.25); }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 6px 0 14px; }
.modal .modal-input { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 8px; width: 100%; margin: 6px 0 14px; font-size: 14px; }
.modal .modal-input:focus { outline: none; border-color: var(--accent); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Buttons */
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }
.btn-primary { background: var(--accent); color: #fff; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-danger { background: #c62828; color: #fff; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.btn-danger:hover { filter: brightness(0.95); }

.api-key-modal { display: grid; gap: 12px; min-width: clamp(260px, 82vw, 360px); }
.api-key-modal label { font-size: 13px; color: var(--muted); }
.api-key-modal input { background: var(--panel); border: 1px solid var(--border); color: var(--text); padding: 8px 10px; border-radius: 8px; width: 100%; }
.api-key-modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-height) 0 0 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 40;
}

body.nav-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .file-header .title { flex-basis: 100%; }
  .file-header .tabs { margin-left: 0; }
}

@media (max-width: 900px) {
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .layout {
    display: block;
    height: auto;
    min-height: calc(100vh - var(--topbar-height));
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    transform: translateX(-105%);
    width: min(85vw, var(--sidebar-width));
    box-shadow: 0 16px 36px rgba(0,0,0,0.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; }
  .topbar { gap: 8px; }
  .brand { font-size: 16px; }
  .spacer { display: none; }
  .toolbar-actions { flex: 0 0 auto; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
  .toolbar-actions button { width: auto; }
  .content { padding-bottom: 80px; }
}

@media (max-width: 700px) {
  .file-header { padding: 12px 12px; }
  .file-header .tabs {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .file-header .tabs .tab,
  .file-header .tabs .icon-btn { padding: 6px 8px; }
  .transcript { padding: 0 12px; }
  .segment-group-header { flex-wrap: wrap; }
  .segment-group-header .speaker-chip { justify-content: flex-start; }
  .segment-line { grid-template-columns: 1fr; padding: 10px; }
  .segment-subtime { order: -1; display: inline-block; font-size: 11px; }
    .speakers { padding: 12px 12px; }
  .speaker-row {
    grid-template-columns: 16px 1fr;
    grid-template-areas:
      'dot name'
      'dot pct'
      'progress progress';
    row-gap: 6px;
  }
  .speaker-row > .dot { grid-area: dot; }
  .speaker-row .name-edit { grid-area: name; }
  .speaker-row .pct { grid-area: pct; text-align: left; }
  .speaker-row .progress { grid-area: progress; width: 100%; display: block; }
}

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  margin: -8px -8px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 8px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
}

.sidebar-tab:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.sidebar-tab.active {
  color: var(--accent);
}

.sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.sidebar-tab-content {
  display: none;
}

.sidebar-tab-content.active {
  display: block;
}

/* Speakers tab styles */
.speakers-header, .jobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  margin-bottom: 8px;
}

.speakers-header h3, .jobs-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.icon-btn-small {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn-small:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.icon-btn-small .ms {
  font-size: 16px;
}

/* Speaker list compact styles */
.speaker-item {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  margin: 2px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.speaker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.speaker-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.speaker-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.speaker-count {
  color: var(--muted);
  font-size: 10px;
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 10px;
}

.speaker-actions {
  display: flex;
  gap: 2px;
}

.speaker-action-btn {
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speaker-action-btn:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text);
}

.speaker-action-btn .ms {
  font-size: 14px;
}

.speaker-count {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.speaker-count:hover {
  color: var(--accent);
}

.speaker-transcripts {
  width: 100%;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 4px;
}

.transcript-item {
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Speaker section styles */
.speaker-section {
  margin-bottom: 16px;
}

.speaker-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
  margin-bottom: 8px;
}

.speaker-section-header:hover {
  background: var(--panel);
}

.section-toggle-icon {
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.section-title {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.section-subtitle {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.speaker-section-content {
  padding-left: 8px;
}

.speaker-section-content.collapsed {
  display: none;
}

/* Dimmed styling for unknown speakers */
.speaker-section-unknown .speaker-item {
  opacity: 0.75;
}

.speaker-section-unknown .speaker-item:hover {
  opacity: 1;
}

/* Speaker toolbar */
.speaker-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--accent);
}

.toolbar-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.toolbar-btn .ms {
  font-size: 16px;
}

.toolbar-btn.merge-btn {
  margin-left: auto;
}

/* Speaker checkbox */
.speaker-checkbox {
  display: flex;
  align-items: center;
  margin-right: 8px;
  cursor: pointer;
}

.speaker-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

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

.speaker-checkbox input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}

.speaker-checkbox input:checked + .checkbox-custom::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.speaker-item.selected {
  background: rgba(0, 123, 255, 0.08);
  border-color: var(--accent);
}

/* Merge modal */
.merge-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.merge-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

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

.merge-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s ease;
}

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

.modal-close .ms {
  font-size: 20px;
}

.merge-modal-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.merge-step {
  margin-bottom: 24px;
}

.merge-step h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.merge-step p {
  margin: 0 0 12px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.primary-speaker-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.primary-speaker-option {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.primary-speaker-option:hover {
  background: var(--hover);
  border-color: var(--accent);
}

.primary-speaker-option input[type="radio"] {
  margin-right: 12px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.primary-speaker-option input[type="radio"]:checked ~ .speaker-option-content {
  font-weight: 600;
}

.speaker-option-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.speaker-option-content .speaker-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.speaker-details {
  flex: 1;
}

.speaker-details .speaker-name {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 2px;
}

.speaker-details .speaker-meta {
  font-size: 11px;
  color: var(--muted);
}

.merge-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.merge-preview h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.merge-summary p {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.merge-summary ul {
  margin: 8px 0;
  padding-left: 24px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}

.merge-summary ul li {
  margin-bottom: 4px;
}

.warning-text {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 4px;
  color: #856404;
  font-size: 12px;
  margin-top: 12px;
}

.warning-text .ms {
  font-size: 18px;
  color: #ffc107;
}

.merge-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.btn-secondary,
.btn-primary {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--hover);
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #0056b3;
  border-color: #0056b3;
}

.btn-primary .ms {
  font-size: 16px;
}

/* Collision modal specific styles */
.collision-info {
  margin-bottom: 20px;
}

.collision-message {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
}

.collision-message .ms {
  font-size: 20px;
}

.collision-speakers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.collision-speaker h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.speaker-info-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.speaker-info-card .speaker-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.speaker-info-card .speaker-details {
  flex: 1;
  min-width: 0;
}

.speaker-info-card .speaker-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speaker-info-card .speaker-meta {
  font-size: 11px;
  color: var(--muted);
}

.collision-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collision-option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.collision-option-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}

.collision-option-btn .ms {
  font-size: 24px;
  color: var(--text);
  flex-shrink: 0;
  margin-top: 2px;
}

.collision-option-btn.merge-option .ms {
  color: var(--accent);
}

.collision-option-btn.rename-option .ms {
  color: #ffc107;
}

.collision-option-btn.cancel-option .ms {
  color: var(--muted);
}

.option-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.option-text strong {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.option-text span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.transcript-item:last-child {
  border-bottom: none;
}

.transcript-item:hover {
  background: rgba(0,0,0,0.05);
}

.transcript-name {
  font-size: 11px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transcript-date {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.speaker-transcripts .loading,
.speaker-transcripts .no-transcripts,
.speaker-transcripts .error {
  padding: 12px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

.speaker-transcripts .error {
  color: #dc3545;
}

/* AI Loading Animation */
.ai-loading-message {
  font-style: italic;
  color: var(--muted);
  position: relative;
  padding-left: 20px;
  transition: opacity 0.3s ease;
}

.ai-loading-message::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: ai-spin 1s linear infinite;
}

@keyframes ai-spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

.ai-loading-message:hover {
  color: var(--text);
}

.ai-loading-message::after {
  content: "✨";
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  animation: ai-sparkle 2s ease-in-out infinite;
}

@keyframes ai-sparkle {
  0%, 100% { opacity: 0; transform: translateY(-50%) scale(0.8); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
}

/* Markdown styling within assistant responses */
.assistant-summary h1,
.assistant-summary h2,
.assistant-summary h3 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: var(--text);
}

.assistant-summary h1 {
  font-size: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.assistant-summary h2 {
  font-size: 16px;
}

.assistant-summary h3 {
  font-size: 14px;
}

.assistant-summary strong {
  font-weight: 600;
  color: var(--text);
}

.assistant-summary em {
  font-style: italic;
  color: var(--muted);
}

.assistant-summary code {
  background: var(--chip-bg);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
  color: var(--accent);
}

.assistant-summary pre {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
}

.assistant-summary pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--text);
}

.assistant-summary ul,
.assistant-summary ol {
  margin: 8px 0;
  padding-left: 20px;
}

.assistant-summary li {
  margin: 4px 0;
  line-height: 1.5;
}

.assistant-summary ul li {
  list-style-type: disc;
}

.assistant-summary ol li {
  list-style-type: decimal;
}

.assistant-summary p,
.assistant-summary .paragraph {
  margin: 8px 0;
  line-height: 1.5;
}

/* Simple-markdown may generate table elements */
.assistant-summary table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
}

.assistant-summary th,
.assistant-summary td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

.assistant-summary th {
  background: var(--panel-2);
  font-weight: 600;
}

.assistant-summary blockquote {
  margin: 12px 0;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
  margin-left: 8px;
}

.loading, .no-transcripts, .error {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.error {
  color: var(--error);
}

/* Job list compact styles */
.job-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin: 2px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.job-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.job-status.pending { background: var(--muted); }
.job-status.processing { background: var(--accent); animation: pulse 2s infinite; }
.job-status.completed { background: #4ade80; }
.job-status.failed { background: #ef4444; }

.job-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.job-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.job-detail {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-progress {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.ai-queue-status {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 6px;
  background: rgba(0,0,0,0.02);
}

.ai-queue-status .job-filename {
  font-style: italic;
  opacity: 0.8;
}

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

.no-speakers, .no-jobs {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 20px 8px;
  font-size: 12px;
}

@media (max-width: 540px) {
  .topbar { flex-wrap: wrap; align-items: flex-start; }
  .toolbar-actions { justify-content: flex-end; flex-wrap: wrap; }
  .toolbar-actions button { flex: 0 0 auto; }
  .bottom-input .inner { flex-wrap: wrap; }
  .bottom-input select,
  .bottom-input input[type="text"],
  .bottom-input button { flex: 1 1 100%; }
  .context-toggle { flex: 0 0 auto; padding: 6px; min-width: 28px; justify-content: center; }
  .context-toggle .label-text { display: none; }
  .segment-group { border-radius: 10px; }
  .segment-group-header { padding: 12px 12px 6px; }
  .segment-group-body { padding: 0 12px 12px; }
  .segment-line { padding: 8px 10px; }
  .segment-subtime { font-size: 10px; }
}

/* Modal styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(-20px);
  transition: transform 0.3s ease;
}

.modal-overlay.visible .modal-dialog {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-body input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: ui-monospace, 'SF Mono', Monaco, Consolas, monospace;
  transition: border-color 0.2s ease;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(217, 124, 43, 0.1);
}

.modal-body input[type="datetime-local"] {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
  cursor: pointer;
}

.modal-body input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.6);
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #c66d23;
  border-color: #c66d23;
}

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

/* Session Expired Overlay */
.session-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.session-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px 48px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: sessionModalAppear 0.3s ease;
}

@keyframes sessionModalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.session-icon {
  margin-bottom: 20px;
}

.session-icon .ms {
  font-size: 56px;
  color: var(--accent);
}

.session-modal h2 {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

.session-modal p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.session-modal .btn-primary {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1200;
  min-width: 180px;
  padding: 4px 0;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  color: var(--text);
  font-size: 14px;
}

.context-menu-item:hover:not(.disabled) {
  background: rgba(217, 124, 43, 0.1);
  color: var(--accent);
}

.context-menu-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.context-menu-item .ms {
  font-size: 18px;
  flex-shrink: 0;
}

/* Summaries section */
.summaries {
  margin-bottom: 0;
}

summary {
  font-weight: 600;
  color: var(--accent);
  padding: 8px 12px;
  background: rgba(217, 124, 43, 0.1);
  border-radius: 6px;
  margin-bottom: 8px;
}

.summary-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "icon title"
    "icon range";
  gap: 2px 8px;
  padding: 4px 16px;
  margin: 2px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s ease;
  font-size: 13px;
}

.summary-item:hover {
  background: rgba(217, 124, 43, 0.1);
}

.summary-item.selected {
  background: var(--accent);
  color: white;
}

.summary-item .ms {
  font-size: 16px;
  color: var(--accent);
  grid-area: icon;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-item.selected .ms {
  color: white;
}

.summary-title {
  font-weight: 500;
  grid-area: title;
  align-self: end;
}

.summary-range {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
  grid-area: range;
  align-self: start;
}

.summary-item.selected .summary-range {
  color: rgba(255, 255, 255, 0.8);
}

/* Summary content display */
.summary-content {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

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

.summary-header h2 {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
}

.summary-date-range {
  margin: 0 0 4px 0;
  color: var(--accent);
  font-weight: 500;
  font-size: 16px;
}

.summary-generated {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.summary-text {
  line-height: 1.6;
  color: var(--text);
}

.summary-text p {
  margin: 0 0 16px 0;
}

.summary-text strong {
  font-weight: 600;
  color: var(--text);
}

.summary-text em {
  font-style: italic;
  color: var(--muted);
}

.summary-strategy {
  margin: 8px 0 0 0;
  padding: 8px 12px;
  background: var(--chip-bg);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
  border-left: 3px solid var(--accent);
}

.strategy-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.strategy-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.strategy-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.strategy-section.ai-section {
  border-left: 4px solid #4CAF50;
}

.strategy-section.transcript-section {
  border-left: 4px solid #2196F3;
}

.strategy-content {
  font-size: 16px;
  line-height: 1.6;
}

.strategy-content p {
  margin: 0 0 12px 0;
}

@media (max-width: 768px) {
  .strategy-comparison {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Markdown content styling */
.summary-text {
  font-size: 16px;
  line-height: 1.6;
}

.summary-text h1,
.summary-text h2,
.summary-text h3,
.summary-text h4,
.summary-text h5,
.summary-text h6 {
  color: var(--text);
  margin: 24px 0 12px 0;
  font-weight: 600;
}

.summary-text h1 { font-size: 24px; }
.summary-text h2 {
  font-size: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.summary-text h3 { font-size: 18px; }
.summary-text h4 { font-size: 16px; }

.summary-text ul,
.summary-text ol {
  margin: 12px 0;
  padding-left: 24px;
}

.summary-text li {
  margin: 6px 0;
  line-height: 1.5;
}

.summary-text blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--chip-bg);
  border-left: 4px solid var(--accent);
  font-style: italic;
}

.summary-text code {
  background: var(--chip-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 13px;
}

.summary-text pre {
  background: var(--chip-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

.summary-text pre code {
  background: none;
  padding: 0;
}

.strategy-content h1,
.strategy-content h2,
.strategy-content h3,
.strategy-content h4 {
  color: var(--text);
  margin: 16px 0 8px 0;
  font-weight: 600;
}

.strategy-content h2 {
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.strategy-content h3 {
  font-size: 15px;
}

.strategy-content ul,
.strategy-content ol {
  margin: 8px 0;
  padding-left: 20px;
}

.strategy-content li {
  margin: 4px 0;
}

/* Note Modal Styles */
.note-modal {
  width: 600px;
  max-width: 90vw;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  color: var(--text);
}

.form-field input[type="text"],
.form-field input[type="datetime-local"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.form-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.note-editor {
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow-y: auto;
  white-space: pre-wrap;
}

.note-editor:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.note-editor:empty::before {
  content: attr(data-placeholder);
  color: #888;
  font-style: italic;
}

.note-editor p {
  margin: 0 0 8px 0;
}

.note-editor p:last-child {
  margin-bottom: 0;
}

/* Note item styles removed - using default styling */

/* Note content display */
.note-content {
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
}

.note-content h1, .note-content h2, .note-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text);
}

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

.note-content ul, .note-content ol {
  margin: 1em 0;
  padding-left: 2em;
}

.note-content li {
  margin: 0.25em 0;
}

.note-content p {
  margin: 0.75em 0;
}

.note-content a {
  color: var(--accent);
  text-decoration: none;
}

.note-content a:hover {
  text-decoration: underline;
}

/* Floating job status card */
.floating-job-card {
  position: fixed;
  bottom: 8px;
  left: 8px;
  width: calc(var(--sidebar-width) - 16px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 100;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-job-card.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

@media (max-width: 900px) {
  .floating-job-card {
    width: calc(min(85vw, var(--sidebar-width)) - 16px);
  }
}

.floating-job-header {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.floating-job-content {
  padding: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.floating-job-item {
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  background: var(--panel);
}

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

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

.floating-job-item .job-filename {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.floating-job-item .job-detail {
  font-size: 10px;
  color: var(--muted);
}

.floating-job-item .job-progress {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Retry button styles */
.job-retry-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: background-color 0.2s;
}

.job-retry-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.job-retry-btn .ms {
  font-size: 16px;
}

/* ============================================================================
   Vikunja Task Integration - Interactive Checkboxes
   ============================================================================ */

.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-right: 12px;
  flex-shrink: 0;
}

.task-checkbox:hover {
  transform: scale(1.1);
}

.assistant-action.task-loading {
  opacity: 0.6;
}

.assistant-action.task-done .task-description {
  text-decoration: line-through;
  opacity: 0.7;
}

.sync-indicator {
  flex-shrink: 0;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==============================================================
   All Tasks Modal
   ============================================================== */

.tasks-modal {
  max-width: 800px;
}

.tasks-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--muted);
}

.tasks-loading .ms {
  font-size: 48px;
}

.tasks-loading .spinning {
  animation: spin 1s linear infinite;
}

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

.tasks-content {
  display: none;
}

.tasks-summary {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}

.tasks-summary-item {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tasks-summary-count {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}

.tasks-summary-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tasks-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 152, 0, 0.1);
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #ff9800;
}

.tasks-warning .ms {
  font-size: 18px;
}

.tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--muted);
}

.tasks-empty .ms {
  font-size: 64px;
  opacity: 0.3;
}

.tasks-group {
  margin-bottom: 32px;
}

.tasks-group:last-child {
  margin-bottom: 0;
}

.tasks-group-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

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

.task-item.task-done {
  opacity: 0.6;
}

.task-item .task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.task-priority-icon {
  font-size: 20px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.task-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.task-item.task-done .task-text {
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}

.task-transcript {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}

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

.task-date {
  color: var(--muted);
}

.task-priority-label {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.task-priority-label {
  background: var(--border);
  color: var(--muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .tasks-modal {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .tasks-summary {
    flex-direction: column;
    gap: 12px;
  }

  .task-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* ========== Custom Query Styles ========== */

/* Query Modal */
.query-modal {
  min-width: 600px;
  max-width: 800px;
}

.query-modal .form-field {
  margin-bottom: 16px;
}

.query-modal label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
}

.query-modal input[type="text"],
.query-modal textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.query-modal textarea {
  resize: vertical;
  min-height: 80px;
}

.query-modal input[type="text"]:focus,
.query-modal textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(217, 124, 43, 0.1);
}

.query-modal .date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.query-modal input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.query-modal .preview-section {
  margin-top: 16px;
}

.query-modal .preview-result {
  margin-top: 12px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

.query-modal .preview-result p {
  margin: 4px 0;
}

.query-modal .preview-result details {
  margin-top: 8px;
}

.query-modal .preview-result summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}

.query-modal .preview-result ul {
  margin: 8px 0;
  padding-left: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.query-modal .advanced-options {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
}

.query-modal .advanced-options summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
}

.query-modal .model-selection {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.query-modal select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

/* Query Items in Nav (integrated with file items) */
.file-item.query-item {
  position: relative;
}

.file-item.query-item > .ms:first-child {
  color: #8b5cf6;  /* Purple accent for query icon */
}

.file-item.query-item .status-icon {
  font-size: 14px;
  margin-left: auto;
}

.file-item.query-item .status-icon.status-pending {
  color: var(--muted);
}

.file-item.query-item .status-icon.status-processing {
  color: #f59e0b;
  animation: spin 1s linear infinite;
}

.file-item.query-item .status-icon.status-completed {
  color: #10b981;
}

.file-item.query-item .status-icon.status-failed {
  color: #ef4444;
}

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

/* Query Results Display */
.query-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
}

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

.query-cost {
  color: var(--muted);
  font-size: 13px;
}

.query-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

/* Query Tabs */
.query-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.query-tabs .tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.15s ease;
  margin-bottom: -2px;
}

.query-tabs .tab:hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}

.query-tabs .tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Individual Results */
.individual-result {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.individual-result summary {
  cursor: pointer;
  font-weight: 500;
  padding: 4px;
  color: var(--text);
}

.individual-result summary:hover {
  color: var(--accent);
}

.individual-result .findings {
  margin-top: 12px;
  padding-left: 8px;
}

.finding {
  margin: 12px 0;
  padding: 12px;
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

.finding-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.finding-content {
  color: var(--text);
  line-height: 1.6;
}

.finding-content p {
  margin: 8px 0;
}

.finding-content ul,
.finding-content ol {
  margin: 8px 0;
  padding-left: 24px;
}

/* Loading and Info Messages */
.loading,
.info,
.error {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.error {
  color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
  .query-modal {
    min-width: unset;
    max-width: 100%;
    margin: 0;
  }

  .query-header {
    padding: 12px;
  }

  .query-tabs {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .query-tabs .tab {
    flex-shrink: 0;
    padding: 6px 12px;
  }

  .individual-result {
    padding: 8px;
  }

  .finding {
    padding: 8px;
  }
}
