/* ═══════════════════════════════════════════════════════════════════════════
   Jarvis OS — Control Center  ·  Light Theme
   Design tokens → component styles → utilities
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Surface */
  --bg:              #F4F6F9;
  --surface:         #FFFFFF;
  --surface-raised:  #F8FAFC;
  --surface-hover:   #F1F5F9;

  /* Border */
  --border:          #E2E8F0;
  --border-light:    #EEF2F7;

  /* Text */
  --text:            #0F172A;
  --text-secondary:  #64748B;
  --text-muted:      #94A3B8;

  /* Accent — indigo-blue, monday-ish */
  --accent:          #3B5BDB;
  --accent-hover:    #2F4AC8;
  --accent-light:    #EEF2FF;
  --accent-border:   #C5D2F6;

  /* Status: Online */
  --green:           #059669;
  --green-bg:        #ECFDF5;
  --green-border:    #A7F3D0;

  /* Status: Offline / Error */
  --red:             #DC2626;
  --red-bg:          #FEF2F2;
  --red-border:      #FECACA;

  /* Status: Degraded / Warning */
  --yellow:          #B45309;
  --yellow-bg:       #FFFBEB;
  --yellow-border:   #FDE68A;

  /* Status: Provisioning / Info */
  --blue:            #2563EB;
  --blue-bg:         #EFF6FF;
  --blue-border:     #BFDBFE;

  /* Status: Paused */
  --slate:           #64748B;
  --slate-bg:        #F8FAFC;
  --slate-border:    #E2E8F0;

  /* Spacing scale (4px base) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --r-sm:   5px;
  --r:      8px;
  --r-lg:   12px;
  --r-xl:   16px;
  --r-full: 9999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:    0 4px 8px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 20px rgba(15, 23, 42, 0.07), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.09), 0 8px 16px rgba(15, 23, 42, 0.05);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Scale */
  --t-xs:   11px;
  --t-sm:   12px;
  --t-base: 14px;
  --t-md:   15px;
  --t-lg:   18px;
  --t-xl:   22px;
  --t-2xl:  28px;

  /* Transitions */
  --ease:      180ms ease;
  --ease-fast: 100ms ease;
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Shell ──────────────────────────────────────────────────────────────── */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--border);
  gap: var(--sp-4);
  flex-wrap: wrap;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Brand */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  text-decoration: none;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  user-select: none;
}

.brand-name {
  font-size: var(--t-lg);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.brand-tagline {
  font-size: var(--t-xs);
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

/* Center greeting */
.topbar-center {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.greeting-text {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.greeting-date {
  font-size: var(--t-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Right — status chips */
.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--ease-fast);
  white-space: nowrap;
}

.cost-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Status indicator dots */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--ease);
}
.dot-green { background: var(--green); }
.dot-blue  { background: var(--accent); }
.dot-red   { background: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════════
   SLIM STATUS BAR  (below topbar)
   ═══════════════════════════════════════════════════════════════════════════ */
.statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: var(--sp-1);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-light);
}

.sb-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 2px var(--sp-3);
  font-size: var(--t-xs);
  color: var(--text-secondary);
  white-space: nowrap;
}

.sb-item:first-child { padding-left: 0; }

.sb-key {
  color: var(--text-muted);
}

.sb-val {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sb-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════════════════════════════ */
.main {
  flex: 1;
  padding: var(--sp-8) 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-10);
}

/* ── Section ────────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.section-title {
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.section-subtitle {
  font-size: var(--t-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
  font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 7px var(--sp-4);
  border-radius: var(--r);
  font-family: var(--font);
  font-size: var(--t-sm);
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--ease-fast), border-color var(--ease-fast),
              box-shadow var(--ease-fast), color var(--ease-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

/* Secondary */
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: #C8D4E0;
}

/* Danger */
.btn-danger {
  background: var(--surface);
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red-bg);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--text);
}

/* Sizes */
.btn-sm {
  padding: 5px var(--sp-3);
  font-size: var(--t-xs);
}

/* Legacy aliases used by JS queries */
.btn-cancel  { /* inherits from .btn.btn-secondary */ }
.btn-confirm { /* inherits from .btn.btn-primary  */ }

/* ═══════════════════════════════════════════════════════════════════════════
   ROOMS GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}

.loading-state {
  grid-column: 1 / -1;
  padding: var(--sp-8);
  color: var(--text-muted);
  font-size: var(--t-sm);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Room Card ──────────────────────────────────────────────────────────── */
.room-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: box-shadow var(--ease), border-color var(--ease);
  position: relative;
}

.room-card:hover {
  box-shadow: var(--shadow);
  border-color: #C8D4E0;
}

/* Status left-accent stripe */
.room-card.status-online       { border-left: 3px solid var(--green); }
.room-card.status-offline      { border-left: 3px solid var(--red); }
.room-card.status-degraded     { border-left: 3px solid var(--yellow); }
.room-card.status-provisioning { border-left: 3px solid var(--blue); }
.room-card.status-paused       { border-left: 3px solid var(--slate); }
.room-card.status-error        { border-left: 3px solid var(--red); }

/* Card header */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.card-name {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

/* Status badge pills */
.card-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-online       { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-offline      { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-provisioning { background: var(--blue-bg);   color: var(--blue);   border: 1px solid var(--blue-border); }
.badge-degraded     { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.badge-paused       { background: var(--slate-bg);  color: var(--slate);  border: 1px solid var(--slate-border); }
.badge-error        { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }

/* Card metadata grid */
.card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3) var(--sp-4);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: var(--t-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: var(--t-sm);
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.meta-value.cost {
  color: var(--accent);
  font-weight: 600;
}

.meta-value.cost.over-alert {
  color: var(--red);
}

/* Card footer actions */
.card-footer {
  display: flex;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-light);
}

.card-footer .btn { flex: 1; }

/* ── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-12) var(--sp-8);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.empty-state-title {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.empty-state-hint {
  font-size: var(--t-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TELEMETRY (metric cards)
   ═══════════════════════════════════════════════════════════════════════════ */
.telem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.telem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease);
}

.telem-card:hover {
  box-shadow: var(--shadow-sm);
}

.telem-label {
  font-size: var(--t-xs);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
}

.telem-val {
  font-size: var(--t-2xl);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOCTOR PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.doctor-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  min-height: 88px;
}

.doctor-placeholder {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.ph-icon {
  font-size: 28px;
  opacity: 0.35;
  flex-shrink: 0;
}

.ph-label {
  font-size: var(--t-base);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.ph-sub {
  font-size: var(--t-xs);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.footer {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--border-light);
  font-size: var(--t-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.footer-sep {
  color: var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal {
  display: none;
  position: fixed;
  z-index: 101;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 96vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal.open,
.modal-backdrop.open { display: block; }

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: var(--t-lg);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast);
  line-height: 1;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Modal body */
.modal-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field-label {
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.field-hint {
  font-size: var(--t-xs);
  color: var(--text-muted);
  font-weight: 400;
}

.field-input {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-sm);
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}

.field-input::placeholder {
  color: var(--text-muted);
}

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

.field-note {
  font-size: var(--t-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  padding: var(--sp-3);
  background: var(--surface-raised);
  border-radius: var(--r);
  border: 1px solid var(--border-light);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--t-xs);
  color: var(--red);
  padding: var(--sp-2) var(--sp-3);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--r);
  line-height: 1.5;
}

/* Modal footer */
.modal-footer {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-light);
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   JARVIS CHAT
   ═══════════════════════════════════════════════════════════════════════════ */

/* Quick-action chips row */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.chat-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r-full);
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ease-fast), border-color var(--ease-fast),
              transform var(--ease-fast);
  white-space: nowrap;
}

.chat-chip:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.chat-chip:active { transform: translateY(0); }

/* Chat panel container */
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Messages area */
.chat-messages {
  padding: var(--sp-5);
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  scroll-behavior: smooth;
}

/* Individual message row */
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 78%;
  animation: msgIn 140ms ease both;
}

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

.chat-msg-user   { align-self: flex-end; align-items: flex-end; }
.chat-msg-jarvis { align-self: flex-start; align-items: flex-start; }
.chat-msg-error  { align-self: flex-start; align-items: flex-start; }

/* Sender + timestamp row */
.chat-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 4px;
}

.chat-sender {
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.chat-msg-user .chat-sender    { color: var(--accent); }
.chat-msg-jarvis .chat-sender  { color: var(--green); }
.chat-msg-error .chat-sender   { color: var(--red); }

.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Bubble */
.chat-bubble {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  font-size: var(--t-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user .chat-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--r-sm);
}

.chat-msg-jarvis .chat-bubble {
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  border-bottom-left-radius: var(--r-sm);
}

.chat-msg-error .chat-bubble {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  border-bottom-left-radius: var(--r-sm);
}

/* Typing indicator */
.chat-typing {
  display: none;
  padding: 0 var(--sp-5) var(--sp-3);
}

.chat-typing.visible { display: block; }

.chat-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-sm);
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Input bar */
.chat-inputbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-light);
  background: var(--surface-raised);
}

.chat-input {
  flex: 1;
  height: 38px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-sm);
  outline: none;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}

.chat-input::placeholder { color: var(--text-muted); }

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

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--ease-fast), transform var(--ease-fast),
              box-shadow var(--ease-fast);
  box-shadow: var(--shadow-sm);
}

.chat-send-btn:hover  { background: var(--accent-hover); transform: scale(1.05); }
.chat-send-btn:active { transform: scale(0.97); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   VERSION BADGE
   ═══════════════════════════════════════════════════════════════════════════ */
.version-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-raised);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  padding: 11px 18px;
  border-radius: var(--r);
  font-size: var(--t-sm);
  font-weight: 500;
  font-family: var(--font);
  max-width: 360px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--ease), transform var(--ease);
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-info  { background: var(--accent); color: #fff; }
.toast-error { background: var(--red);    color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════════
   DOT PULSE ANIMATION (NATS connected)
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.dot-pulse {
  animation: dot-pulse 2s ease-in-out infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: #C0C8D4; }

/* Focus */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Responsive — tighter on small screens */
@media (max-width: 640px) {
  .shell { padding: 0 var(--sp-4); }
  .topbar-center { display: none; }
  .telem-grid { grid-template-columns: 1fr 1fr; }
  .card-meta { grid-template-columns: 1fr; }
}
