/* ==========================================================================
   ASEAN Visa AI Platform - Stylesheet
   Design Baseline: design.md & ai_web_development_guide.md
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-main: #0a0f1d;
  --bg-surface: #10182c;
  --bg-card: #15223c;
  --bg-elevated: #1c2d50;
  --bg-hover: #223762;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #38bdf8;

  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-brand: #38bdf8;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.35);

  --accent-teal: #14b8a6;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;

  /* Sizing & Radius */
  --header-height: 64px;
  --sidebar-width: 290px;
  --telemetry-width: 380px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header & Top Bar
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 40;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  user-select: none;
}

.brand-logo {
  position: relative;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0ea5e9, #0d9488);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.3);
}

.logo-globe {
  font-size: 1.25rem;
}

.brand-badge-ai {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #f43f5e;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-surface);
}

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

.brand-title span {
  color: var(--accent-teal);
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: -3px;
}

/* Telemetry Status Pills in Header */
.header-center {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.telemetry-pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.telemetry-pill .label {
  font-weight: 600;
  color: var(--text-muted);
}

.telemetry-pill .val {
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.header-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.header-select option {
  background: var(--bg-surface);
  color: #fff;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: #10b981; box-shadow: 0 0 6px #10b981; }
.status-dot.purple { background: #a855f7; box-shadow: 0 0 6px #a855f7; }
.status-dot.blue { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.status-dot.amber { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.status-dot.red { background: #f43f5e; box-shadow: 0 0 6px #f43f5e; }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0284c7);
  color: #fff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

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

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.btn-danger {
  background: #e11d48;
  color: #fff;
}

.btn-danger:hover {
  background: #be123c;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.w-full { width: 100%; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.hidden { display: none !important; }

/* ==========================================================================
   Application Layout (3-Column View)
   ========================================================================== */

.app-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
  width: 100vw;
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   Left Sidebar: Portals & Knowledge Base
   ========================================================================== */

.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 1rem;
  gap: 1.25rem;
  z-index: 20;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.25rem;
}

.country-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.country-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.country-item .flag {
  font-size: 1.25rem;
}

.country-item .country-info {
  display: flex;
  flex-direction: column;
}

.country-item .c-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.country-item .c-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.country-item:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.country-item.active {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.15);
}

.country-item.active .c-name {
  color: var(--text-brand);
}

/* Knowledge Base Card */
.kb-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.kb-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

.kb-label {
  color: var(--text-muted);
}

.kb-val {
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

/* Security Status */
.security-card {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.security-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.security-desc {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ==========================================================================
   Center Viewport: Chat & RAG Experience
   ========================================================================== */

.chat-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-main);
  position: relative;
  min-width: 0;
}

.chat-header {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(16, 24, 44, 0.6);
  backdrop-filter: blur(10px);
}

.chat-title-group {
  display: flex;
  flex-direction: column;
}

.chat-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

/* Messages Stream Window */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
}

.message-item {
  display: flex;
  gap: 1rem;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.message-item.assistant .message-avatar {
  background: linear-gradient(135deg, #0284c7, #0d9488);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

.message-item.user .message-avatar {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
}

.message-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.author-model-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  color: var(--text-brand);
  border: 1px solid var(--border-subtle);
}

.message-content {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-main);
  word-break: break-word;
}

.message-content p {
  margin-bottom: 0.75rem;
}

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

.message-content strong {
  color: #fff;
}

.message-content ul, .message-content ol {
  margin: 0.5rem 0 0.75rem 1.25rem;
}

.message-content li {
  margin-bottom: 0.25rem;
}

/* Tables in Assistant Response */
.message-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.85rem;
}

.message-content th, .message-content td {
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.message-content th {
  background: var(--bg-card);
  color: var(--text-brand);
  font-weight: 600;
}

.message-content tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Citations & Pills */
.citation-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--text-brand);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin: 0 0.2rem;
  transition: var(--transition-fast);
}

.citation-pill:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--text-brand);
}

/* Welcome Card Specifics */
.welcome-message .message-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.feature-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.prompt-instruction {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1rem;
}

.preset-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.preset-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  color: var(--text-main);
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.preset-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-focus);
  color: #fff;
  transform: translateY(-1px);
}

/* Active Typing / Cursor Animation */
.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background-color: var(--text-brand);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 0.8s infinite;
}

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

/* Context Drawer (System Prompt & Vector Preview) */
.context-drawer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  max-width: 860px;
  width: calc(100% - 3rem);
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.context-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.95rem;
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
}

.context-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.drawer-chevron {
  font-size: 0.65rem;
  transition: transform var(--transition-fast);
}

.context-drawer.collapsed .context-drawer-body {
  display: none;
}

.context-drawer.collapsed .drawer-chevron {
  transform: rotate(-90deg);
}

.context-drawer-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.context-tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.4rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.tab-content {
  display: none;
}

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

.code-block {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #cbd5e1;
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
}

/* ==========================================================================
   Input Tray & Controls
   ========================================================================== */

.chat-input-wrapper {
  padding: 1rem 1.5rem 1.25rem;
  background: linear-gradient(180deg, transparent, var(--bg-main) 30%);
}

.chat-form {
  max-width: 860px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color var(--transition-fast);
}

.chat-form:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.15);
}

.input-controls-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-brand);
}

.remove-att {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.remove-att:hover {
  color: #f43f5e;
}

.input-tags {
  margin-left: auto;
  display: flex;
  gap: 0.35rem;
}

.tag-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}

#prompt-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  resize: none;
  max-height: 140px;
  min-height: 24px;
  line-height: 1.5;
}

#prompt-input::placeholder {
  color: var(--text-muted);
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-subtle);
}

.delimiter-guard-indicator code {
  color: var(--accent-emerald);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Right Panel: Architecture & Telemetry Inspector
   ========================================================================== */

.app-telemetry-sidebar {
  width: var(--telemetry-width);
  min-width: var(--telemetry-width);
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 20;
}

.telemetry-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.telemetry-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.telemetry-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.metric-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-brand);
  font-family: var(--font-mono);
  margin: 0.15rem 0;
}

.metric-target {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Cache Details */
.cache-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.72rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.detail-row strong {
  font-family: var(--font-mono);
  color: #fff;
}

/* RAG Candidate Visualizer */
.rag-candidate-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rag-empty-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
}

.rag-chunk-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rag-chunk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
}

.rag-chunk-title {
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.rag-score-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.rag-score-bar-bg {
  height: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.rag-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
}

.rag-chunk-snippet {
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Circuit Breaker UI */
.telemetry-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.circuit-status-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin: 0.25rem 0;
}

.circuit-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.node-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.circuit-node.active .node-indicator {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.circuit-node.failed .node-indicator {
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
}

.circuit-node .node-name {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.circuit-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* SSE Terminal */
.sse-raw-terminal {
  background: #060913;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #a5f3fc;
  height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pulse-indicator.active {
  background: #10b981;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

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

.modal-title {
  font-size: 1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition-fast);
}

.drop-zone:hover {
  border-color: var(--border-focus);
  background: var(--bg-hover);
}

.drop-icon {
  font-size: 2rem;
  margin-bottom: 0.35rem;
}

.drop-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.drop-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.hidden-file-input {
  display: none;
}

.ingest-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.progress-bar-bg {
  height: 6px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #10b981);
  transition: width 0.2s ease;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bg-card);
}

/* Form Groups in Settings Modal */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
}

.form-help {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
  .app-telemetry-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
  }

  .app-telemetry-sidebar.open {
    transform: translateX(0);
  }
}

@media (max-width: 860px) {
  .app-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .header-center {
    display: none;
  }

  .mobile-only {
    display: inline-flex !important;
  }
}

@media (min-width: 861px) {
  .mobile-only {
    display: none !important;
  }
}
