:root {
  --bg: #09090b;
  --panel: #111113;
  --surface: #18181b;
  --surface-hover: #222226;
  --border: #232329;
  --border-strong: #32323a;
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --crimson: #e11d48;
  --crimson-dim: rgba(225, 29, 72, 0.14);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ── ÜST SİSTEM ÇUBUĞU ── */
.topbar {
  height: 52px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

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

.status-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.status-led.online {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.status-led.offline {
  background: var(--crimson);
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.6);
}

.brand-titles {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.brand-name .sep {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 2px;
}

.brand-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.sys-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.sys-badge.online,
.status-pill.online {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.sys-badge.offline,
.status-pill.offline {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Orta Kontroller */
.center-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

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

.seg-btn.active {
  background: var(--text);
  color: var(--bg);
}

.sys-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.sys-select.full {
  width: 100%;
}

/* Sağ Üst */
.right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-readout {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot-sep {
  color: var(--text-muted);
}

.action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

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

/* ── ANA ÇALIŞMA ALANI (3 SÜTUN) ── */
.workspace {
  height: calc(100vh - 52px);
  padding: 12px;
  display: grid;
  grid-template-columns: 290px 1fr 290px;
  gap: 12px;
}

.panel-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.panel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-card.grow {
  flex: 1;
  min-height: 0;
}

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

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.panel-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Sekme Şeridi */
.tab-strip {
  display: inline-flex;
  background: var(--bg);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  gap: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--surface-hover);
  color: var(--text);
  font-weight: 600;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}

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

/* Donanım Metrikleri */
.metrics-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.metric-row strong {
  color: var(--text);
  font-weight: 600;
}

.progress-bg {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--text);
  transition: width 0.3s ease;
}

/* ── MERKEZ PANEL ── */
.center-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.core-stage {
  flex: 1.15;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.core-visualizer {
  width: 240px;
  height: 240px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#orb-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.core-info {
  text-align: center;
  margin-top: 6px;
}

.core-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
}

.core-status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.stream-banner {
  background: var(--surface);
  border-left: 2px solid var(--crimson);
  color: var(--text);
  padding: 7px 12px;
  font-size: 12.5px;
  margin-top: 10px;
}

/* İletişim Akışı */
.chat-feed {
  flex: 0.85;
  min-height: 120px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 2px;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  border: 1px solid var(--border);
}

.chat-msg.user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.chat-msg.ai {
  align-self: flex-start;
  max-width: 84%;
  background: var(--bg);
  color: var(--text);
  border-left: 2px solid var(--crimson);
}

.chat-msg.sys {
  align-self: stretch;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  padding: 2px 4px;
}

.msg-who {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* Hızlı Komut Çubuğu */
.quick-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.quick-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.quick-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

/* Alt Giriş Barı */
.input-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  padding: 5px;
  border-radius: 7px;
  flex-shrink: 0;
}

.dock-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  height: 34px;
  padding: 0 12px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  flex-shrink: 0;
}

.dock-btn.icon-only {
  width: 34px;
  padding: 0;
}

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

.dock-btn.active-rec {
  background: var(--crimson);
  border-color: var(--crimson);
  color: #ffffff;
}

#command-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
}

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

.send-trigger {
  background: var(--text);
  border: none;
  color: var(--bg);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  height: 34px;
  padding: 0 14px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.send-trigger:hover {
  opacity: 0.9;
}

/* ── SAĞ PANEL ── */
.vision-frame {
  width: 100%;
  height: 140px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vision-frame video,
.vision-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vision-placeholder {
  font-size: 11.5px;
  color: var(--text-muted);
}

.vision-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.env-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
}

.env-city {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.env-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sistem Başlatıcı & Medya */
.launcher-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.launch-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.launch-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.transport-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.transport-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
}

.transport-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* Formlar & Listeler */
input[type="text"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 7px 9px;
  border-radius: 5px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--border-strong);
}

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

.form-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.mt-8 { margin-top: 8px; }

.btn-xs {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-xs:hover {
  background: var(--surface-hover);
}

.btn-xs.primary, .btn-primary {
  background: var(--text);
  border: 1px solid var(--text);
  color: var(--bg);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 5px;
  cursor: pointer;
}

.data-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.list-item {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 7px 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.list-item-title {
  color: var(--text);
  font-weight: 500;
}

.list-item-sub, .empty-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.empty-hint {
  padding: 12px 4px;
}

.del-btn, .icon-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
}

.del-btn:hover, .icon-close:hover {
  color: var(--text);
}

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

.modal-window {
  width: 92%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.modal-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 3px;
}

.ext-link {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-decoration: underline;
}

.modal-footer {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}

.link-btn {
  text-decoration: none;
  text-align: center;
  justify-content: center;
  flex: 1;
}

::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* ── KOMPAKT KONSOL MODU (?mode=compact) ── */
html.mode-compact,
body.mode-compact {
  height: 100%;
  overflow: hidden;
}

html.mode-compact .panel-col,
body.mode-compact .panel-col {
  display: none !important;
}

html.mode-compact .workspace,
body.mode-compact .workspace {
  grid-template-columns: 1fr !important;
  height: calc(100vh - 52px);
  padding: 8px 14px;
  gap: 0;
  max-width: 100%;
}

html.mode-compact .center-panel,
body.mode-compact .center-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 1fr auto auto;
  gap: 10px 18px;
  padding: 12px 18px;
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

html.mode-compact .core-stage,
body.mode-compact .core-stage {
  grid-column: 1;
  grid-row: 1 / 4;
  border-bottom: none;
  border-right: 1px solid var(--border);
  padding: 10px 18px 10px 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

html.mode-compact .core-visualizer,
body.mode-compact .core-visualizer {
  width: 170px;
  height: 170px;
}

html.mode-compact .chat-feed,
body.mode-compact .chat-feed {
  grid-column: 2;
  grid-row: 1;
  min-height: 140px;
  max-height: 100%;
  overflow-y: auto;
}

html.mode-compact .quick-bar,
body.mode-compact .quick-bar {
  grid-column: 2;
  grid-row: 2;
  padding-top: 6px;
}

html.mode-compact .input-dock,
body.mode-compact .input-dock {
  grid-column: 2;
  grid-row: 3;
  margin-top: 6px;
}

/* ── MOBİL VE KOMPAKT RESPONSIVE GELİŞTİRMELER ── */
@media (max-width: 768px) {
  .topbar {
    padding: 0 10px;
    height: 48px;
    gap: 8px;
  }

  .brand-group {
    gap: 8px;
    flex-shrink: 0;
  }

  .brand-titles .brand-meta {
    display: none;
  }

  #conn-badge {
    display: none;
  }

  .right-controls {
    display: none !important;
  }

  #voice-select {
    display: none !important;
  }

  .center-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
  }

  .segmented-control {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 2px;
    border-radius: 8px;
    display: inline-flex;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  }

  .seg-btn {
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 700;
    min-width: 64px;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .seg-btn.active {
    background: #ffffff;
    color: #09090b;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.3);
  }

  html.mode-compact .center-panel,
  body.mode-compact .center-panel {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
  }

  html.mode-compact .core-stage,
  body.mode-compact .core-stage {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
  }

  html.mode-compact .core-visualizer,
  body.mode-compact .core-visualizer {
    width: 110px;
    height: 110px;
  }

  .input-dock {
    padding: 4px;
    gap: 5px;
  }

  .dock-btn {
    height: 38px;
    font-size: 12.5px;
  }

  #btn-cam,
  #btn-screen-vision {
    display: none !important;
  }

  #btn-mic {
    padding: 0 12px;
    font-weight: 600;
  }

  #btn-mic.active-rec {
    background: #e11d48 !important;
    border-color: #f43f5e !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(225, 29, 72, 0.8) !important;
    animation: mic-pulse 1.2s infinite ease-in-out;
  }

  #command-input {
    font-size: 13.5px;
    padding: 6px 6px;
  }

  .send-trigger {
    height: 38px;
    padding: 0 12px;
    font-size: 12.5px;
  }
}

@keyframes mic-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
