/* ==========================================================================
   APIFY AGENT STUDIO — LINEAR DESIGN SYSTEM
   Authentic tokens from awesome-design-md (linear.app)
   ========================================================================== */

:root {
  /* Color ladder */
  --canvas: #010102;
  --surface-1: #0f1011;
  --surface-2: #141516;
  --surface-3: #18191a;
  --surface-4: #191a1b;

  /* Borders & Dividers */
  --hairline: #23252a;
  --hairline-strong: #34343a;
  --hairline-tertiary: #3e3e44;
  --hairline-focus: #5e69d1;

  /* Typography Colors */
  --ink: #f7f8f8;
  --ink-muted: #d0d6e0;
  --ink-subtle: #8a8f98;
  --ink-tertiary: #62666d;

  /* Primary Brand Accent */
  --primary: #5e6ad2;
  --on-primary: #ffffff;
  --primary-hover: #828fff;
  --primary-focus: #5e69d1;
  --primary-glow: rgba(94, 106, 210, 0.22);
  --primary-subtle: rgba(94, 106, 210, 0.12);

  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.12);

  /* Corner Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 20px rgba(94, 106, 210, 0.25);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, "Liberation Mono", Menlo, monospace;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  background-color: var(--canvas);
  overflow: hidden;
}

/* Desktop Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--surface-1);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 15px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #434ba8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-tertiary);
  padding: 8px 12px 4px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-subtle);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  min-height: 40px;
}

.nav-item:hover {
  color: var(--ink);
  background-color: var(--surface-2);
}

.nav-item.active {
  color: var(--ink);
  background-color: var(--surface-3);
  font-weight: 600;
  border-left: 2px solid var(--primary);
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  color: var(--primary);
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-4);
  color: var(--ink-subtle);
  border: 1px solid var(--hairline);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-subtle);
}

.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger);
}

.status-dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: var(--canvas);
}

/* Top Header Bar */
.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--hairline);
  background-color: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Linear Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
  min-height: 34px;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

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

.btn-secondary {
  background-color: var(--surface-2);
  color: var(--ink);
  border-color: var(--hairline);
}

.btn-secondary:hover {
  background-color: var(--surface-3);
  border-color: var(--hairline-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-subtle);
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.btn-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
}

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

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* View Container & Tabs */
.view-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.view-pane.active {
  display: flex;
}

/* ==========================================================================
   CHAT TAB UI
   ========================================================================== */
.chat-workspace {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Sessions Drawer / Sidebar */
.chat-sessions-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--surface-1);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease;
  overflow: hidden;
  z-index: 10;
}

.chat-sessions-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  opacity: 0;
  pointer-events: none;
}

.sessions-sidebar-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-new-chat {
  width: 100%;
  justify-content: center;
  font-weight: 500;
  gap: 8px;
  padding: 8px 12px;
}

.sessions-sidebar-subheader {
  padding: 12px 16px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sessions-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-tertiary);
}

.sessions-count-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-subtle);
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.chat-sessions-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  position: relative;
}

.session-item:hover {
  background-color: var(--surface-2);
  color: var(--ink);
}

.session-item.active {
  background-color: var(--surface-2);
  border-color: var(--hairline-strong);
  color: var(--ink);
}

.session-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 2px 2px 0;
}

.session-item-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.session-item-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--ink-subtle);
}

.session-item.active .session-item-icon {
  color: var(--primary);
}

.session-item-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.session-item-meta {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--ink-tertiary);
  margin-left: 4px;
}

.session-item-actions {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
}

.session-item:hover .session-item-actions,
.session-item.active .session-item-actions {
  display: flex;
}

.session-action-btn {
  background: transparent;
  border: none;
  color: var(--ink-subtle);
  padding: 3px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.session-action-btn:hover {
  color: var(--ink);
  background-color: var(--surface-3);
}

.session-action-btn.delete:hover {
  color: var(--danger);
}

/* Chat Main Execution Area */
.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: var(--canvas);
}

.chat-session-header {
  padding: 8px 16px;
  border-bottom: 1px solid var(--hairline);
  background-color: var(--surface-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 46px;
}

.session-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.session-title-container {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.active-session-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

.rename-session-btn {
  padding: 2px 4px;
  color: var(--ink-subtle);
}

.rename-session-btn:hover {
  color: var(--ink);
}

.session-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-xs {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
}

/* Legacy .chat-layout fallback */
.chat-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 0 20px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.chat-welcome {
  text-align: center;
  margin: auto 0;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.welcome-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.welcome-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.welcome-subtitle {
  font-size: 14px;
  color: var(--ink-subtle);
  max-width: 500px;
  line-height: 1.6;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  max-width: 680px;
}

.prompt-chip {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-chip:hover {
  background-color: var(--surface-2);
  border-color: var(--primary);
  color: var(--ink);
  transform: translateY(-1px);
}

/* Chat Message Bubbles */
.message-row {
  display: flex;
  gap: 14px;
  width: 100%;
}

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
}

.message-avatar.assistant {
  background-color: var(--primary-subtle);
  border: 1px solid rgba(94, 106, 210, 0.3);
  color: var(--primary-hover);
}

.message-avatar.user {
  background-color: var(--surface-3);
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
}

.message-bubble {
  max-width: 82%;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
}

.message-row.assistant .message-bubble {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  color: var(--ink);
}

.message-row.user .message-bubble {
  background-color: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
}

/* Markdown Formatted Content Inside Message Text */
.message-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: break-word;
}

.message-text p {
  margin: 8px 0;
}

.message-text p:first-child {
  margin-top: 0;
}

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

.message-text h1, .message-text h2, .message-text h3, .message-text h4 {
  color: var(--ink);
  margin: 16px 0 8px 0;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.message-text h1 { font-size: 18px; }
.message-text h2 { font-size: 16px; }
.message-text h3 { font-size: 14.5px; }

.message-text ul, .message-text ol {
  margin: 8px 0;
  padding-left: 22px;
}

.message-text li {
  margin: 4px 0;
}

.message-text blockquote {
  border-left: 3px solid var(--primary);
  margin: 10px 0;
  padding: 6px 14px;
  background-color: var(--surface-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--ink-muted);
}

.message-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 12.5px;
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}

.message-text th {
  background-color: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}

.message-text td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-muted);
  vertical-align: top;
}

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

.message-text tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}

.message-text pre {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  margin: 10px 0;
}

.message-text code {
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary-hover);
}

/* Collapsible Tool Call Accordion / Pill */
.tool-call-card {
  margin: 10px 0;
  background-color: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 12.5px;
}

.tool-call-header {
  padding: 8px 12px;
  background-color: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.tool-call-header:hover {
  background-color: var(--surface-3);
}

.tool-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  background-color: var(--primary-subtle);
  color: var(--primary-hover);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(94, 106, 210, 0.2);
}

.tool-call-body {
  padding: 10px 12px;
  background-color: var(--canvas);
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* Chat Input Bar */
.chat-input-container {
  padding: 16px 0 24px 0;
  flex-shrink: 0;
}

.chat-input-box {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input-box:focus-within {
  border-color: var(--hairline-focus);
  box-shadow: var(--shadow-glow);
}

.chat-textarea {
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 48px;
  max-height: 180px;
  line-height: 1.5;
}

.chat-textarea::placeholder {
  color: var(--ink-tertiary);
}

.chat-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--hairline);
  padding-top: 8px;
}

.active-provider-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-subtle);
}

/* ==========================================================================
   DASHBOARD TAB UI
   ========================================================================== */
.dashboard-layout {
  padding: 24px;
  overflow-y: auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.metric-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
}

.metric-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.metric-footer {
  font-size: 12px;
  color: var(--ink-tertiary);
}

/* Dashboard Panels */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.panel-card {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.panel-body {
  padding: 16px 20px;
  overflow-y: auto;
}

/* Tag Cloud Pills */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-badge:hover {
  background-color: var(--surface-3);
  border-color: var(--primary);
  color: var(--ink);
}

.tag-badge .tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.tag-badge .tag-count {
  font-size: 10.5px;
  color: var(--ink-tertiary);
}

/* ==========================================================================
   HISTORY TAB UI & DATA TABLES
   ========================================================================== */
.history-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 24px;
  gap: 16px;
  overflow: hidden;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input {
  width: 100%;
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  color: var(--ink);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.search-input:focus {
  border-color: var(--hairline-focus);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-tertiary);
  pointer-events: none;
}

.tag-filter-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.table-wrapper {
  flex: 1;
  background-color: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: auto;
}

.linear-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.linear-table th {
  background-color: var(--surface-2);
  color: var(--ink-subtle);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 2;
}

.linear-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-muted);
  vertical-align: middle;
}

.linear-table tr:hover td {
  background-color: var(--surface-2);
  color: var(--ink);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.succeeded {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.failed {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.status-badge.running {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ==========================================================================
   MODALS & DATA INSPECTOR
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(1, 1, 2, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background-color: var(--surface-1);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
}

.modal-card.large {
  max-width: 1040px;
  height: 85vh;
}

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

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--surface-2);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.form-input, .form-select {
  background-color: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--hairline-focus);
}

.form-hint {
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background-color: var(--surface-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease-out;
}

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

/* Mobile Bottom Navigation Bar (Mandatory 44pt Touch Targets) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: var(--bottom-nav-height);
  background-color: var(--surface-1);
  border-top: 1px solid var(--hairline);
  z-index: 50;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-items {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-subtle);
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 500;
  min-width: 64px;
  min-height: 44px; /* Strict 44pt minimum touch target */
  cursor: pointer;
  transition: color 0.15s ease;
}

.mobile-nav-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.mobile-nav-btn svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }
  
  .mobile-bottom-nav {
    display: block;
  }

  .view-container {
    padding-bottom: var(--bottom-nav-height);
  }

  .chat-layout {
    padding: 0 12px;
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .history-layout {
    padding: 16px;
  }
}
