:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0d16;
  --bg-card: #121a29;
  --bg-raised: #1b2738;
  --text-primary: #ffffff;
  --text-secondary: #bdc9d6;
  --accent-primary: #a78bfa;
  --accent-secondary: #62f2ae;
  --danger: #ff6577;
  --focus-glow: rgba(167, 139, 250, 0.45);
  --radius: 14px;
}

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

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, textarea, select {
  color: inherit;
  font: inherit;
  border: 0;
}

.app-root {
  width: 600px;
  height: 600px;
  padding: 8px;
  position: relative;
}

.screen {
  position: absolute;
  inset: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hidden { display: none !important; }

.header {
  min-height: 58px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header.compact { min-height: 50px; }
.header h1 { font-size: 20px; flex: 1; }
.eyebrow { color: var(--accent-primary); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; margin-bottom: 2px; }
.badge {
  border-radius: 14px;
  background: rgba(167, 139, 250, 0.18);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
}
.badge.ok { color: var(--accent-secondary); background: rgba(98, 242, 174, 0.15); }
.badge.warn { color: #ffb4bc; background: rgba(255, 101, 119, 0.18); }

.content {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 6px 0;
}

.home-content { justify-content: flex-start; overflow-y: auto; padding-bottom: 8px; }
.helper, .hint {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
}
.hint code { color: var(--accent-primary); font-size: 12px; }

.focusable {
  border: 2px solid transparent;
  transition: border-color 160ms ease, transform 160ms ease;
}
.focusable:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--focus-glow);
  transform: scale(0.98);
}

.action-card {
  min-height: 64px;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  text-align: left;
}
.primary-action { background: #2a2240; }
.action-title { font-size: 18px; font-weight: 650; display: block; }
.action-detail { font-size: 13px; color: var(--text-secondary); margin-top: 3px; display: block; }

.back-btn {
  min-width: 46px;
  min-height: 42px;
  border-radius: 10px;
  background: var(--bg-raised);
  font-size: 22px;
}

.field-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-top: 6px; }
.text-input, .prompt-input {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  font-size: 15px;
}
.prompt-input { resize: none; min-height: 52px; max-height: 72px; }

.settings-content { overflow-y: auto; padding-bottom: 8px; }
.row-actions { display: flex; gap: 8px; margin-top: 8px; }
.nav-item {
  flex: 1;
  min-height: 48px;
  border-radius: 12px;
  background: var(--bg-raised);
  font-weight: 650;
}
.nav-item.primary { background: var(--accent-primary); color: #120a24; }
.nav-item:disabled { opacity: 0.45; }

.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px;
  margin-top: 8px;
}

.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.user { align-self: flex-end; background: #2a2240; }
.bubble.assistant { align-self: flex-start; background: var(--bg-card); color: var(--text-secondary); }
.bubble.error { align-self: stretch; background: #3a1820; color: #ffb4bc; }

.composer {
  flex-shrink: 0;
  padding: 6px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quick-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  font-size: 12px;
}
.voice-chip { flex-shrink: 0; border: 2px solid transparent; }
.voice-chip.active { background: rgba(98, 242, 174, 0.2); color: var(--accent-secondary); }

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-card);
  font-size: 14px;
  line-height: 1.35;
}
.toggle-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent-primary); }

.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  z-index: 20;
  max-width: 520px;
  padding: 10px 16px;
  border-radius: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--accent-primary);
  transform: translate(-50%, -120px);
  transition: transform 200ms ease;
  font-size: 14px;
}
.toast.visible { transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); }
