:root {
  color-scheme: dark;
  --bg-primary: #020617;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --border-color: #334155;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
}
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}
.layout {
  display: grid;
  grid-template-columns: 3fr 1fr;
  height: 100vh;
  gap: 0;
}
.preview-pane {
  position: relative;
  border-right: 1px solid var(--border-color);
}
.preview-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  height: 100vh;
  overflow: hidden;
}
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-header h1 {
  font-size: 16px;
  margin: 0 0 4px 0;
  font-weight: 600;
}
.sidebar-header p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}
.section:last-child {
  border-bottom: none;
}
.section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 0;
  color: var(--text-secondary);
}

/* Audits List */
.audits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.audit-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}
.audit-item.active {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.audit-item.completed {
  opacity: 0.7;
}
.audit-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.audit-item.completed .audit-checkbox {
  background: var(--success);
  border-color: var(--success);
}
.audit-checkbox svg {
  display: none;
  width: 12px;
  height: 12px;
  stroke: white;
  stroke-width: 3;
}
.audit-item.completed .audit-checkbox svg {
  display: block;
}
.audit-content {
  flex: 1;
  min-width: 0;
}
.audit-title {
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 2px 0;
  color: var(--text-primary);
}
.audit-description {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.audit-selector {
  font-size: 10px;
  color: var(--accent);
  margin: 2px 0 0 0;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.8;
}
.audit-priority {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  flex-shrink: 0;
}
.priority-high {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.priority-medium {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.priority-low {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}
.no-audits {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* Chat Section */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
  min-height: 150px;
}
.chat-message {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 95%;
  word-wrap: break-word;
}
.chat-message.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-message.assistant {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-message.system {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
  align-self: center;
  text-align: center;
}
.chat-message.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--error);
  color: #fca5a5;
}
.chat-message pre {
  margin: 8px 0 0 0;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
}
.chat-message code {
  font-family: "SF Mono", Monaco, Consolas, monospace;
}
.chat-input-container {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
}
.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.chat-send-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
}
.chat-send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chat-send-btn svg {
  width: 18px;
  height: 18px;
}
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
