/* ==========================================================================
   Executive Slate Dark Theme - FastAPI AI Micro-Tools Kit
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #151d30;
  --bg-hover: #243047;

  --border-color: #1f293d;
  --border-focus: #38bdf8;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --accent-blue: #38bdf8;
  --accent-blue-hover: #0ea5e9;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.4);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge-live {
  background-color: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}
.badge-live .status-dot {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.badge-demo {
  background-color: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}
.badge-demo .status-dot {
  background-color: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.badge-loading {
  background-color: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
}
.badge-loading .status-dot {
  background-color: #9ca3af;
}

.badge-neutral {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border-color: #38bdf8;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

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

.btn-outline {
  background-color: transparent;
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.4);
}
.btn-outline:hover {
  background-color: rgba(56, 189, 248, 0.1);
  border-color: var(--accent-blue);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
}
.btn-success:hover {
  background: #047857;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 5px 10px;
}
.btn-xs {
  font-size: 0.72rem;
  padding: 3px 8px;
}

/* Main Layout */
.main-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Tabs */
.tool-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.05);
}

/* Panels */
.panels-wrapper {
  flex: 1;
}

.tab-panel {
  display: none;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.tab-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Split View */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  min-height: 520px;
}

@media (max-width: 960px) {
  .split-view {
    grid-template-columns: 1fr;
  }
}

.split-pane {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pane-bar {
  background-color: var(--bg-tertiary);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.pane-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code-textarea {
  flex: 1;
  background-color: #0c121e;
  border: none;
  padding: 12px;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: none;
  line-height: 1.6;
}

.code-textarea:focus {
  outline: 1px solid var(--border-focus);
}

.custom-fields-bar {
  padding: 8px 12px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.action-footer {
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Empty & Loading States */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.summary-banner {
  background-color: rgba(56, 189, 248, 0.08);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #bae6fd;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  text-align: left;
}

.data-table th {
  background-color: rgba(17, 24, 39, 0.8);
  color: var(--text-muted);
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: top;
}

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.conf-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.conf-high {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.conf-med {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

/* Triage Cards */
.triage-cards-grid {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 580px;
}

.triage-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  transition: all 0.2s ease;
}

.triage-card:hover {
  border-color: var(--accent-blue);
}

.triage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.triage-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.cat-outage { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.cat-billing { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.cat-bug { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.cat-feature { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.cat-inquiry { background: rgba(156, 163, 175, 0.2); color: #9ca3af; }

.triage-reply-box {
  background-color: #0b111e;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.8rem;
  color: #e2e8f0;
  margin-top: 8px;
  position: relative;
}

.btn-copy-reply {
  position: absolute;
  right: 6px;
  top: 6px;
  background: var(--bg-tertiary);
  border: none;
  color: var(--accent-blue);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  background-color: rgba(56, 189, 248, 0.05);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.stat-item {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.stat-item strong {
  color: var(--accent-blue);
}

.anomaly-box {
  background-color: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--accent-amber);
  padding: 8px 12px;
  font-size: 0.78rem;
  color: #fde68a;
  max-height: 120px;
  overflow-y: auto;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-card);
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.select-input, .text-input {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.select-input:focus, .text-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

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

.hidden {
  display: none !important;
}
