/* src/styles.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f0f1f3;
  --border: #e2e4e8;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-light: #eef2ff;
  --accent-hover: #4f46e5;
  --tool-bg: #fef3c7;
  --tool-text: #92400e;
  --tool-bg-active: #fde68a;
  --tool-bg-done: #f0fdf4;
  --tool-text-done: #166534;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --success: #10b981;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px #0000000d;
  --shadow: 0 1px 3px #0000001a;
  --sidebar-width: 280px;
  --max-content: 720px;
}

body {
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
}

.app {
  display: flex;
  overflow: hidden;
  height: 100vh;
}

.app.embed .chat-area {
  width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-header h1 {
  letter-spacing: -.02em;
  font-size: 18px;
  font-weight: 600;
}

.sidebar-header .workspace-name {
  color: var(--text-secondary);
  margin-top: 2px;
  font-size: 12px;
}

.new-chat-btn {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  margin: 12px 16px;
  padding: 8px 12px;
  transition: background .15s;
  font-size: 13px;
  font-weight: 500;
}

.new-chat-btn:hover {
  background: var(--accent-hover);
}

.sidebar-filters {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding: 8px 16px;
}

.sidebar-filters select {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
}

.sidebar-filters select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

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

.session-item {
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items:  center;
  gap: 4px;
  padding: 8px 12px;
  transition: background .1s;
  font-size: 13px;
}

.session-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.session-item:hover {
  background: var(--bg-tertiary);
}

.session-item.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
}

.session-menu {
  position: relative;
  flex-shrink: 0;
}

.session-menu-btn {
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 0 4px;
  transition: opacity .1s;
  font-size: 16px;
  line-height: 1;
}

.session-item:hover .session-menu-btn, .session-menu-btn:focus, .chat-header .session-menu-btn, .input-inner .session-menu-btn {
  opacity: 1;
}

.session-menu-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.session-menu-dropdown {
  position: absolute;
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 120px;
  padding: 4px;
  top: 100%;
  right: 0;
  box-shadow: 0 4px 12px #0000001a;
}

.session-menu-dropdown button {
  display: block;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 4px;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
}

.session-menu-dropdown button:hover {
  background: var(--bg-secondary);
}

.session-menu-dropdown button.danger {
  color: #dc2626;
}

.session-menu-dropdown button.danger:hover {
  background: #fef2f2;
}

.session-menu-dropdown.drop-up {
  margin-bottom: 4px;
  top: auto;
  bottom: 100%;
}

.session-menu-inline {
  flex: 1;
  min-width: 0;
}

.session-rename-input {
  border: 1px solid var(--accent);
  outline: none;
  background: var(--bg);
  border-radius: 4px;
  width: 100%;
  padding: 2px 6px;
  font-size: 13px;
}

.chat-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  z-index: 10;
  align-items:  center;
  gap: 8px;
  padding: 8px 24px;
  top: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

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

.chat-header-title {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border: 1px solid #0000;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  font-weight: 500;
}

.chat-header-title:hover {
  background: var(--bg-secondary);
  border-color: var(--border);
}

.chat-header-edit {
  border: 1px solid var(--accent);
  outline: none;
  background: var(--bg);
  color: var(--text);
  border-radius: 4px;
  flex: 1;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}

.chat-header .session-menu-btn, .input-inner .session-menu-btn {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  opacity: 1;
  background: none;
  justify-content: center;
  align-items:  center;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.chat-header .session-menu-btn:hover, .input-inner .session-menu-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-x: auto;
  flex-shrink: 0;
  align-items: stretch;
  gap: 0;
  padding: 0 24px;
}

.tab-item {
  display: flex;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid #0000;
  align-items:  center;
  gap: 6px;
  padding: 8px 14px;
  transition: all .1s;
  font-size: 12px;
  font-weight: 500;
}

.tab-item:hover {
  color: var(--text);
  background: var(--bg-tertiary);
}

.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg);
}

.tab-icon {
  font-size: 13px;
}

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.tab-close {
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  background: none;
  border: none;
  border-radius: 2px;
  padding: 0 2px;
  transition: opacity .1s;
  font-size: 14px;
  line-height: 1;
}

.tab-item:hover .tab-close {
  opacity: 1;
}

.tab-close:hover {
  color: #dc2626;
  background: #dc26261a;
}

.agent-tab-btn {
  cursor: pointer;
  color: var(--text-muted);
  opacity: .5;
  background: none;
  border: none;
  border-radius: 2px;
  padding: 0 4px;
  transition: all .1s;
  font-size: 12px;
  line-height: 1;
}

.agent-tab-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.messages {
  overflow-y: auto;
  flex: 1;
  padding: 24px 0;
}

.messages-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 24px;
}

.message {
  margin-bottom: 24px;
}

.message-role {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
}

.message-role.user {
  color: var(--accent);
}

.message-content {
  font-size: 14px;
  line-height: 1.7;
}

.message-content p {
  margin-bottom: 8px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content code {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: JetBrains Mono, monospace;
  font-size: 13px;
}

.message-content pre {
  color: #cdd6f4;
  border-radius: var(--radius);
  overflow-x: auto;
  background: #1e1e2e;
  margin: 8px 0;
  padding: 16px;
}

.message-content pre code {
  color: inherit;
  background: none;
  padding: 0;
  font-size: 13px;
}

.message-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 13px;
}

.message-content thead {
  background: var(--bg-tertiary);
}

.message-content th {
  text-align: left;
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  font-weight: 600;
}

.message-content td {
  border-bottom: 1px solid var(--border);
  padding: 6px 12px;
}

.message-content tr:last-child td {
  border-bottom: none;
}

.message-content tbody tr:hover {
  background: var(--bg-secondary);
}

.message-content ul, .message-content ol {
  margin: 4px 0 8px 20px;
}

.message-content li {
  margin-bottom: 2px;
}

.message-content blockquote {
  border-left: 3px solid var(--border);
  color: var(--text-secondary);
  margin: 8px 0;
  padding-left: 12px;
}

.message-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.agent-group.compact {
  background: var(--bg-secondary, #f5f5f7);
  border: 1px solid var(--border, #e0e0e0);
  display: inline-flex;
  border-radius: 6px;
  margin: 6px 0;
  padding: 6px 12px;
  transition: background .15s;
}

.agent-group.compact:hover {
  background: var(--bg-hover, #eaeaed);
}

.agent-group.compact.active {
  border-color: var(--accent);
}

.agent-header {
  display: flex;
  align-items:  center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.agent-label {
  color: var(--text-primary, #1d1d1f);
}

.agent-summary {
  opacity: .5;
  margin-left: 4px;
  font-size: 12px;
}

.tool-activity {
  display: flex;
  border-radius: var(--radius);
  align-items:  center;
  gap: 8px;
  margin: 4px 0;
  padding: 6px 12px;
  transition: all .2s;
  font-size: 12px;
  font-weight: 500;
}

.tool-activity.active {
  background: var(--tool-bg-active);
  color: var(--tool-text);
  border-left: 3px solid #f59e0b;
}

.tool-activity.done {
  background: var(--tool-bg-done);
  color: var(--tool-text-done);
  border-left: 3px solid var(--success);
  opacity: .8;
}

.tool-activity .tool-icon {
  flex-shrink: 0;
  font-size: 14px;
}

.tool-activity .tool-desc {
  flex: 1;
}

.tool-activity .tool-check {
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
}

.tool-spinner {
  animation: spin .6s linear infinite;
  border: 2px solid #f59e0b44;
  border-top-color: #f59e0b;
  border-radius: 50%;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}

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

.thinking-indicator {
  display: flex;
  color: var(--text-muted);
  align-items:  center;
  gap: 10px;
  padding: 12px 0;
  font-size: 13px;
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  background: var(--accent);
  animation: bounce 1.4s ease-in-out infinite;
  border-radius: 50%;
  width: 6px;
  height: 6px;
}

.thinking-dots span:first-child {
  animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
  animation-delay: .2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: .4s;
}

@keyframes bounce {
  0%, 80%, 100% {
    opacity: .3;
    transform: scale(.8);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.streaming-cursor {
  display: inline-block;
  background: var(--accent);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  width: 6px;
  height: 16px;
  margin-left: 2px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.status-bar {
  display: flex;
  border-top: 1px solid var(--border);
  align-items:  center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 24px;
  font-size: 12px;
  font-weight: 500;
}

.status-bar.thinking, .status-bar.working {
  background: var(--accent-light);
  color: var(--accent);
}

.status-bar.streaming {
  color: #166534;
  background: #f0fdf4;
}

.status-bar.idle {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.status-bar.disconnected, .status-bar.stale {
  background: var(--error-bg);
  color: var(--error-text);
}

.status-cancel-btn {
  color: inherit;
  cursor: pointer;
  opacity: .8;
  background: none;
  border: 1px solid;
  border-radius: 4px;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

.status-cancel-btn:hover {
  opacity: 1;
  background: #0000000d;
}

.status-elapsed {
  font-variant-numeric: tabular-nums;
  opacity: .7;
}

.status-cost {
  opacity: .6;
  margin-left: auto;
}

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

.status-dot.green {
  background: var(--success);
}

.status-dot.red {
  background: var(--error-text);
}

.status-pulse {
  background: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
  border-radius: 50%;
  flex-shrink: 0;
  width: 8px;
  height: 8px;
}

.status-pulse.green {
  background: var(--success);
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: .5;
    transform: scale(.8);
  }
}

.audio-toggle-wrapper {
  display: flex;
  position: relative;
  align-items:  center;
  gap: 2px;
  margin-left: auto;
}

.audio-toggle-btn, .audio-settings-btn {
  cursor: pointer;
  opacity: .6;
  background: none;
  border: none;
  padding: 2px 4px;
  transition: opacity .15s;
  font-size: 14px;
  line-height: 1;
}

.audio-toggle-btn:hover, .audio-settings-btn:hover {
  opacity: 1;
}

.audio-settings-panel {
  position: absolute;
  background: var(--bg);
  border: 1px solid var(--border);
  z-index: 1000;
  border-radius: 8px;
  min-width: 280px;
  padding: 12px;
  font-size: 12px;
  bottom: 100%;
  right: 0;
  box-shadow: 0 4px 16px #00000040;
}

.audio-settings-header {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}

.audio-settings-close {
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 16px;
}

.audio-settings-section {
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.audio-settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.audio-settings-section-title {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
}

.audio-settings-row {
  display: flex;
  align-items:  center;
  gap: 8px;
  margin-bottom: 6px;
}

.audio-settings-row > span:first-child {
  color: var(--text-secondary);
  flex: 0 0 110px;
}

.audio-settings-row input[type="range"] {
  flex: 1;
  height: 4px;
}

.audio-settings-row input[type="checkbox"] {
  margin: 0;
}

.audio-settings-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  flex: 0 0 36px;
}

.audio-settings-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px;
  flex: 1;
  padding: 3px 6px;
  font-family: monospace;
  font-size: 11px;
}

.file-card {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items:  center;
  gap: 10px;
  margin: 6px 0;
  padding: 10px 14px;
}

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

.file-card .file-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1px;
}

.file-card .file-name {
  font-family: JetBrains Mono, monospace;
  font-size: 13px;
  font-weight: 500;
}

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

.file-card .file-actions {
  display: flex;
  align-items:  center;
  gap: 6px;
}

.file-card .file-action {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
  padding: 4px 10px;
  transition: background .15s;
  font-size: 12px;
  font-weight: 500;
}

.file-card .file-action:hover {
  background: var(--accent-hover);
}

.tool-history-block {
  max-width: var(--max-content);
  margin: 4px auto;
}

.tool-history-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  align-items:  center;
  gap: 6px;
  padding: 4px 10px;
  transition: all .1s;
  font-family: inherit;
  font-size: 12px;
}

.tool-history-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.tool-history-arrow {
  font-size: 10px;
}

.tool-history-list {
  border-left: 2px solid var(--border);
  margin-top: 4px;
  padding-left: 8px;
}

.tool-history-item {
  display: flex;
  color: var(--text-secondary);
  align-items:  center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
}

.tool-history-item .tool-icon {
  font-size: 12px;
}

.tool-history-item .tool-desc {
  flex: 1;
}

.tool-history-item .tool-check {
  color: var(--success);
  font-size: 11px;
}

.tool-group-block {
  max-width: var(--max-content);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 4px auto;
  transition: border-color .2s;
}

.tool-group-block.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px #6366f126;
}

.tool-group-block.collapsed, .tool-group-block.collapsed.active {
  border: none;
}

.tool-group-block.collapsed.active .tool-group-header {
  border-color: var(--accent);
}

.tool-group-header {
  display: flex;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  align-items:  center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.tool-group-block.collapsed .tool-group-header {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  background: none;
  padding: 4px 10px;
}

.tool-group-block.collapsed .tool-group-header:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.tool-group-list {
  padding: 2px 0;
}

.tool-group-item {
  display: flex;
  color: var(--text-secondary);
  align-items:  center;
  gap: 6px;
  padding: 3px 12px;
  font-size: 12px;
}

.tool-group-item.active {
  color: var(--text);
}

.tool-group-item .tool-icon {
  font-size: 12px;
}

.tool-group-item .tool-desc {
  flex: 1;
}

.tool-group-item .tool-check {
  color: var(--success);
  font-size: 11px;
}

.tool-group-item .tool-spinner, .tool-group-header .tool-spinner {
  border-width: 1.5px;
  width: 10px;
  height: 10px;
}

.question-card {
  max-width: var(--max-content);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  margin: 12px auto;
  padding: 16px;
}

.question-card.answered {
  opacity: .6;
  border-color: var(--border);
  background: var(--bg-secondary);
}

.question-label {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
}

.question-card.answered .question-label {
  color: var(--text-secondary);
}

.question-text {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.question-input-row {
  display: flex;
  gap: 8px;
}

.question-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
}

.question-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.question-submit {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
}

.question-submit:hover:not(:disabled) {
  background: var(--accent-hover);
}

.question-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.question-answered {
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.attachment-pill {
  display: inline-flex;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  align-items:  center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}

.pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  padding-bottom: 8px;
}

.pending-file {
  display: inline-flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--text-secondary);
  align-items:  center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 12px;
}

.pending-file-remove {
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}

.pending-file-remove:hover {
  color: var(--error-text);
}

.attach-btn {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  justify-content: center;
  align-items:  center;
  width: 42px;
  height: 42px;
  padding: 0;
  transition: all .15s;
  font-size: 16px;
  line-height: 1;
}

.attach-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.attach-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.attachments-panel {
  max-width: var(--max-content);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.attachments-toggle {
  display: inline-flex;
  cursor: pointer;
  color: var(--text-secondary);
  background: none;
  border: none;
  align-items:  center;
  gap: 6px;
  padding: 4px 0;
  font-family: inherit;
  font-size: 12px;
}

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

.attachments-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.attachment-item {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items:  center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.attachment-actions {
  display: flex;
  flex-shrink: 0;
  align-items:  center;
  gap: 6px;
  margin-left: auto;
}

.attachment-action-btn {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  transition: all .1s;
  font-size: 12px;
}

.attachment-action-btn:hover {
  background: var(--accent);
  color: #fff;
}

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

.attachment-size {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 12px;
  font-size: 11px;
}

.input-area {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
}

.input-inner {
  max-width: var(--max-content);
  display: flex;
  align-items:  flex-end;
  gap: 8px;
  margin: 0 auto;
}

.input-area textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
  outline: none;
  flex: 1;
  min-height: 42px;
  max-height: 200px;
  padding: 10px 14px;
  transition: border-color .15s;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.input-area textarea:focus {
  border-color: var(--accent);
}

.input-area.drag-over {
  background: var(--accent-light);
  border-top-color: var(--accent);
}

.input-area.drag-over textarea {
  border-color: var(--accent);
  border-style: dashed;
}

.send-btn {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  border: none;
  height: 42px;
  padding: 0 20px;
  transition: background .15s;
  font-size: 14px;
  font-weight: 500;
}

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

.send-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.mode-toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .5px;
  height: 42px;
  padding: 0 12px;
  transition: all .15s;
  font-size: 12px;
  font-weight: 600;
}

.mode-toggle.plan {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.mode-toggle.plan:hover {
  background: var(--accent);
  color: #fff;
}

.mode-toggle.execute {
  color: #166534;
  background: #f0fdf4;
  border-color: #16a34a;
}

.mode-toggle.execute:hover {
  color: #fff;
  background: #16a34a;
}

.session-section-label {
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 600;
}

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

.dot-thinking {
  background: var(--accent);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.dot-tool {
  animation: pulse-dot 1.2s ease-in-out infinite;
  background: #f59e0b;
}

.dot-streaming {
  animation: pulse-dot .8s ease-in-out infinite;
  background: #16a34a;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: .3;
  }
}

.session-close-btn {
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0;
  background: none;
  border: none;
  flex-shrink: 0;
  padding: 0 2px;
  transition: opacity .1s;
  font-size: 14px;
  line-height: 1;
}

.session-item:hover .session-close-btn {
  opacity: 1;
}

.session-close-btn:hover {
  color: #dc2626;
}

.login-screen {
  display: flex;
  background: var(--bg-secondary);
  justify-content: center;
  align-items:  center;
  height: 100vh;
}

.login-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 360px;
  padding: 40px;
}

.login-box h1 {
  margin-bottom: 8px;
  font-size: 24px;
  font-weight: 600;
}

.login-box p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 14px;
}

.login-box input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 14px;
  font-size: 14px;
}

.login-box input:focus {
  border-color: var(--accent);
}

.login-box button {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
}

.login-box .error {
  color: var(--error-text);
  background: var(--error-bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 8px 12px;
  font-size: 13px;
}

.empty-state {
  display: flex;
  color: var(--text-muted);
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  gap: 12px;
  height: 100%;
}

.empty-state h2 {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
}

.empty-state p {
  text-align: center;
  max-width: 400px;
  font-size: 14px;
}

.permission-dialog-container {
  max-width: var(--max-content);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 12px;
}

.permission-dialog {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fffbeb;
  border: 1px solid #f59e0b;
}

.permission-header {
  display: flex;
  color: #92400e;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  align-items:  center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
}

.permission-icon {
  font-size: 16px;
}

.permission-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}

.permission-tool {
  color: var(--text-secondary);
  font-size: 13px;
}

.permission-tool code {
  background: var(--bg-tertiary);
  color: var(--text);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: JetBrains Mono, monospace;
  font-size: 12px;
}

.permission-description {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.permission-preview {
  color: #cdd6f4;
  border-radius: var(--radius);
  overflow-x: auto;
  background: #1e1e2e;
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
}

.permission-preview code {
  color: inherit;
  background: none;
  padding: 0;
  font-family: JetBrains Mono, monospace;
  font-size: 12px;
}

.permission-actions {
  display: flex;
  border-top: 1px solid #f59e0b44;
  gap: 8px;
  padding: 10px 16px;
}

.btn-allow {
  background: var(--success);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  padding: 6px 20px;
  transition: background .15s;
  font-size: 13px;
  font-weight: 500;
}

.btn-allow:hover {
  background: #059669;
}

.btn-deny {
  color: #dc2626;
  border-radius: var(--radius);
  cursor: pointer;
  background: none;
  border: 1px solid #dc2626;
  padding: 6px 20px;
  transition: all .15s;
  font-size: 13px;
  font-weight: 500;
}

.btn-deny:hover {
  background: #fef2f2;
}

.thinking-block {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}

.thinking-block.streaming {
  border-color: var(--accent);
}

.thinking-toggle {
  display: flex;
  background: var(--bg-secondary);
  cursor: pointer;
  color: var(--text-secondary);
  text-align: left;
  border: none;
  align-items:  center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  transition: background .1s;
  font-family: inherit;
  font-size: 12px;
}

.thinking-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.thinking-icon {
  font-size: 14px;
}

.thinking-streaming {
  color: var(--accent);
  animation: blink 1s step-end infinite;
  font-weight: 600;
}

.thinking-chevron {
  opacity: .6;
  margin-left: auto;
  font-size: 10px;
}

.thinking-content {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
}

.thinking-content pre {
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  font-family: JetBrains Mono, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.cost-display {
  display: flex;
  color: var(--text-muted);
  flex-wrap: wrap;
  align-items:  center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}

.cost-tokens {
  font-variant-numeric: tabular-nums;
}

.cost-cache, .cost-cache-write {
  opacity: .8;
}

.cost-usd {
  color: var(--text-secondary);
  font-weight: 500;
}

.cost-duration {
  opacity: .7;
}

.user-question {
  max-width: var(--max-content);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  margin: 12px auto;
  padding: 16px;
}

.user-question .question-text {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.question-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-choice {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 16px;
  transition: all .15s;
  font-size: 13px;
  font-weight: 500;
}

.btn-choice:hover {
  background: var(--accent);
  color: #fff;
}

.question-input {
  display: flex;
  gap: 8px;
}

.question-input input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
}

.question-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.question-input button {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
}

.question-input button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.question-input button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.chat-header-id {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  padding-left: 6px;
  font-family: JetBrains Mono, monospace;
  font-size: 11px;
}

.chat-header-context {
  color: var(--text-muted);
  white-space: nowrap;
  background: #ffffff0d;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: JetBrains Mono, monospace;
  font-size: 11px;
}

.chat-header-context.warn {
  color: #e8a838;
  background: #e8a8381a;
}

.chat-header-context.critical {
  color: #e85838;
  background: #e8583826;
}

.chat-header-mode {
  letter-spacing: .05em;
  white-space: nowrap;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
}

.chat-header-mode.plan {
  color: #e8a838;
  background: #e8a83826;
}

.chat-header-mode.execute {
  color: #38c778;
  background: #38c77826;
}

.plan-card {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  margin: 12px 0;
  padding: 16px;
}

.plan-card.actioned {
  opacity: .6;
  border-color: var(--border);
  background: var(--bg-secondary);
}

.plan-label {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
}

.plan-card.actioned .plan-label {
  color: var(--text-secondary);
}

.plan-content {
  color: var(--text);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.7;
}

.plan-content p {
  margin-bottom: 8px;
}

.plan-content p:last-child {
  margin-bottom: 0;
}

.plan-content ul, .plan-content ol {
  margin: 4px 0 8px 20px;
}

.plan-content li {
  margin-bottom: 2px;
}

.plan-content pre {
  color: #cdd6f4;
  border-radius: var(--radius);
  overflow-x: auto;
  background: #1e1e2e;
  margin: 8px 0;
  padding: 12px;
  font-size: 13px;
}

.plan-content code {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: JetBrains Mono, monospace;
  font-size: 13px;
}

.plan-content pre code {
  color: inherit;
  background: none;
  padding: 0;
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.plan-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 16px;
  transition: all .15s;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
}

.plan-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.plan-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

.plan-btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.plan-btn-revise {
  color: var(--accent);
  border-color: var(--accent);
}

.plan-btn-revise:hover {
  background: var(--accent-light);
}

.plan-revise-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.plan-revise-input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--bg);
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
}

.plan-revise-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.plan-actioned-label {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
}

.checkpoint-card {
  border-radius: var(--radius-lg);
  margin: 12px 0;
  padding: 16px;
}

.checkpoint-card.active {
  background: #eff6ff;
  border: 1px solid #3b82f6;
}

.checkpoint-card.actioned {
  opacity: .6;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.checkpoint-phase {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #3b82f6;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
}

.checkpoint-card.actioned .checkpoint-phase {
  color: var(--text-secondary);
}

.checkpoint-label {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1e40af;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
}

.checkpoint-card.actioned .checkpoint-label {
  color: var(--text-secondary);
}

.checkpoint-instruction {
  color: var(--text);
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.checkpoint-context {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.checkpoint-context-path {
  color: #2563eb;
  background: #3b82f61a;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: monospace;
  font-size: 12px;
}

.checkpoint-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.checkpoint-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 13px;
}

.checkpoint-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.checkpoint-btn-primary {
  color: #fff;
  background: #3b82f6;
  border-color: #3b82f6;
}

.checkpoint-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.checkpoint-btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.checkpoint-btn-revise {
  color: #3b82f6;
  border-color: #3b82f6;
}

.checkpoint-btn-revise:hover {
  background: #eff6ff;
}

.checkpoint-revise-row {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

.checkpoint-revise-input {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
}

.checkpoint-revise-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px #eff6ff;
}

.checkpoint-decision-label {
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 8px;
  font-size: 12px;
  font-style: italic;
}

.split-pane {
  display: flex;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.split-pane-left {
  overflow-y: auto;
}

.split-pane-right {
  overflow-y: auto;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
}

.split-pane-divider {
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  width: 4px;
  transition: background .15s;
}

.split-pane-divider:hover {
  background: var(--accent);
}

.checkpoint-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.checkpoint-panel-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 16px 28px;
}

.checkpoint-panel-title {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 8px;
}

.checkpoint-panel-phase {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 600;
}

.checkpoint-panel-close {
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 16px;
}

.checkpoint-panel-close:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

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

.checkpoint-panel-content {
  overflow-y: auto;
  flex: 1;
  padding: 24px 28px;
}

.checkpoint-panel-loading {
  color: var(--text-muted);
  padding: 20px;
  font-style: italic;
}

.checkpoint-panel-empty {
  color: var(--text-secondary);
  padding: 20px;
}

.checkpoint-panel-empty code {
  display: block;
  margin-top: 8px;
}

.checkpoint-panel-actions {
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 28px;
}

.checkpoint-document-section {
  margin-bottom: 24px;
}

.checkpoint-document-path {
  color: var(--text-muted);
  background: var(--bg-tertiary);
  display: inline-block;
  border-radius: 4px;
  margin-bottom: 8px;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 12px;
}

.checkpoint-document-content {
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.checkpoint-document-content h1 {
  border-bottom: 1px solid var(--border);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  font-size: 1.5em;
  font-weight: 700;
}

.checkpoint-document-content h2 {
  border-bottom: 1px solid var(--border);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  font-size: 1.25em;
  font-weight: 600;
}

.checkpoint-document-content h3 {
  margin: 16px 0 8px;
  font-size: 1.1em;
  font-weight: 600;
}

.checkpoint-document-content p {
  margin-bottom: 12px;
}

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

.checkpoint-document-content li {
  margin-bottom: 4px;
}

.checkpoint-document-content code {
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: JetBrains Mono, Fira Code, monospace;
  font-size: .9em;
}

.checkpoint-document-content pre {
  color: #cdd6f4;
  overflow-x: auto;
  background: #1e1e2e;
  border-radius: 8px;
  margin: 12px 0;
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.checkpoint-document-content pre code {
  color: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
}

.checkpoint-document-content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 0 6px 6px 0;
  margin: 12px 0;
  padding: 8px 16px;
}

.checkpoint-document-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}

.checkpoint-document-content th {
  text-align: left;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
  font-weight: 600;
}

.checkpoint-document-content td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}

.checkpoint-document-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

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

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

.checkpoint-document-content strong {
  font-weight: 600;
}

.checkpoint-table-wrapper {
  overflow-x: auto;
}

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

.checkpoint-table th {
  text-align: left;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  padding: 8px 12px;
  font-weight: 600;
}

.checkpoint-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}

.checkpoint-table tr:hover td {
  background: var(--bg-secondary);
}

.checkpoint-gallery-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.checkpoint-gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.checkpoint-gallery-img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  width: 100%;
}

.checkpoint-gallery-label {
  color: var(--text-secondary);
  text-align: center;
  padding: 8px;
  font-size: 12px;
}

.checkpoint-diff-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.checkpoint-diff-pane {
  overflow-x: auto;
  border-right: 1px solid var(--border);
}

.checkpoint-diff-pane:last-child {
  border-right: none;
}

.checkpoint-diff-label {
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  top: 0;
}

.checkpoint-diff-lines {
  font-family: JetBrains Mono, Fira Code, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.checkpoint-diff-line {
  display: flex;
  min-height: 1.5em;
}

.diff-line-no {
  text-align: right;
  color: var(--text-muted);
  opacity: .5;
  user-select: none;
  flex-shrink: 0;
  width: 40px;
  padding-right: 8px;
  font-size: 12px;
}

.diff-line-text {
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  padding: 0 8px;
}

.checkpoint-diff-line.diff-remove {
  background: #fef2f2;
}

.checkpoint-diff-line.diff-remove .diff-line-text {
  color: #991b1b;
  background: #fee2e2;
}

.checkpoint-diff-line.diff-remove .diff-line-no {
  color: #b91c1c;
  opacity: .7;
}

.checkpoint-diff-line.diff-add {
  background: #f0fdf4;
}

.checkpoint-diff-line.diff-add .diff-line-text {
  color: #166534;
  background: #dcfce7;
}

.checkpoint-diff-line.diff-add .diff-line-no {
  color: #15803d;
  opacity: .7;
}

.checkpoint-iframe {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  width: 100%;
  height: 600px;
}

.checkpoint-raw {
  overflow-x: auto;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 12px;
  font-size: 13px;
}

.checkpoint-context-menu {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 160px;
  padding: 4px;
  box-shadow: 0 4px 16px #0000001f;
}

.checkpoint-context-menu-item {
  display: block;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 4px;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
}

.checkpoint-context-menu-item:hover {
  background: var(--bg-tertiary);
}

.checkpoint-context-menu-item:first-child {
  color: #3b82f6;
  font-weight: 500;
}

.checkpoint-context-menu-item:first-child:hover {
  background: #eff6ff;
}

.checkpoint-table-annotatable td.checkpoint-table-cell-clickable {
  cursor: pointer;
  transition: background .1s;
}

.checkpoint-table-cell-clickable:hover {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
  background: #eff6ff !important;
}

.checkpoint-gallery-annotatable {
  cursor: crosshair;
}

.checkpoint-gallery-img-container {
  position: relative;
  overflow: hidden;
  user-select: none;
}

.checkpoint-gallery-img-container img {
  pointer-events: none;
}

.checkpoint-region-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  background: #3b82f626;
  border: 2px solid #3b82f6;
}

.checkpoint-gallery-hint {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
}

.checkpoint-gallery-item.gallery-selected {
  border-width: 2px;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f633;
}

.gallery-selected-badge {
  position: absolute;
  color: #fff;
  z-index: 2;
  background: #3b82f6;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  top: 8px;
  right: 8px;
}

.checkpoint-btn-reject {
  color: #dc2626;
  border-color: #dc2626;
}

.checkpoint-btn-reject:hover {
  background: #fef2f2;
}

.checkpoint-btn-reject:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.checkpoint-doc-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  flex-shrink: 0;
  padding: 0 28px;
}

.checkpoint-doc-tab {
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 2px solid #0000;
  padding: 8px 16px;
  font-family: monospace;
  font-size: 13px;
}

.checkpoint-doc-tab:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.checkpoint-doc-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}

.annotation-input-bar {
  border-top: 1px solid var(--border);
  background: #eff6ff;
  flex-shrink: 0;
  padding: 12px 28px;
}

.annotation-input-selected {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
}

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

.annotation-input-textarea {
  background: var(--bg);
  resize: none;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
}

.annotation-input-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px #3b82f626;
}

.checkpoint-feedback-area {
  border-top: 1px solid var(--border);
  background: var(--bg);
  overflow-y: auto;
  flex-shrink: 0;
  max-height: 200px;
}

.checkpoint-annotations-list {
  padding: 8px 28px 0;
}

.checkpoint-annotations-header {
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
}

.checkpoint-annotation-item {
  display: flex;
  border-bottom: 1px solid var(--bg-tertiary);
  align-items:  flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}

.checkpoint-annotation-file {
  color: #3b82f6;
  background: #eff6ff;
  border-radius: 3px;
  flex-shrink: 0;
  align-self:  flex-start;
  margin-top: 2px;
  padding: 1px 6px;
  font-family: monospace;
  font-size: 11px;
}

.checkpoint-annotation-quote {
  color: var(--text-secondary);
  flex-shrink: 0;
  max-width: 35%;
  font-style: italic;
  line-height: 1.3;
}

.checkpoint-annotation-comment {
  color: var(--text);
  flex: 1;
  line-height: 1.3;
}

.checkpoint-annotation-remove {
  cursor: pointer;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 3px;
  flex-shrink: 0;
  padding: 2px 4px;
  font-size: 12px;
}

.checkpoint-annotation-remove:hover {
  background: var(--bg-tertiary);
  color: #ef4444;
}

.checkpoint-general-notes {
  border: none;
  border-top: 1px solid var(--bg-tertiary);
  background: var(--bg);
  resize: none;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 28px;
  font-family: inherit;
  font-size: 13px;
}

.checkpoint-general-notes:focus {
  outline: none;
  background: var(--bg-secondary);
}

.checkpoint-general-notes::placeholder {
  color: var(--text-muted);
}

.form-surface {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.form-required {
  color: #ef4444;
  margin-left: 2px;
}

.form-description {
  color: var(--text-muted);
  margin-bottom: 2px;
  font-size: 12px;
}

.form-input, .form-textarea, .form-select {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px #eff6ff;
}

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

.form-select {
  cursor: pointer;
}

.form-checkbox-label {
  display: flex;
  cursor: pointer;
  align-items:  center;
  gap: 8px;
  font-size: 14px;
}

.form-checkbox-label input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.form-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.voice-replay-btn {
  display: inline-flex;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 4px;
  align-items:  center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 10px;
  transition: background .15s, color .15s;
  font-size: 11px;
}

.voice-replay-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

@media (width <= 768px) {
  .sidebar {
    position: fixed;
    z-index: 100;
    transition: left .2s;
    top: 0;
    bottom: 0;
    left: -280px;
  }

  .sidebar.open {
    left: 0;
  }

  .messages-inner, .input-inner {
    padding: 0 16px;
  }
}
