/* companion.css — mobile-first shell styled ENTIRELY from syna-theme-kit tokens
 * (tokens.css). No hardcoded brand colors — proves token-contract inheritance. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-width: 0 0 1px 0;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand strong { font-family: var(--font-heading); letter-spacing: 0.02em; }
.dot {
  width: 10px; height: 10px; border-radius: var(--radius-full, 9999px);
  background: var(--status-error);
  box-shadow: 0 0 8px var(--status-error);
  transition: background var(--motion-fast) var(--motion-ease);
}
.dot.on { background: var(--status-success); box-shadow: 0 0 10px var(--status-success); }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 9999px;
  background: var(--panel-surface); color: var(--text-secondary);
  border: 1px solid var(--panel-border);
}

/* Layout */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}
.card { border-radius: var(--radius-lg, 16px); padding: 14px 16px; }
.card h2 {
  margin: 0 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-secondary); font-weight: 600;
}
.grow-card { flex: 1; display: flex; flex-direction: column; min-height: 220px; }

.row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; flex-wrap: wrap; }
.row:last-child { margin-bottom: 0; }
.row.btns { gap: 10px; }
.grow { flex: 1; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); flex: 1; }
input {
  background: var(--panel-surface);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  border-radius: var(--radius-md, 12px);
  padding: 10px 12px; font-size: 15px; font-family: inherit;
  transition: border-color var(--motion-fast) var(--motion-ease);
  min-width: 0;
}
input:focus { outline: none; border-color: var(--accent-cyan); box-shadow: 0 0 0 3px rgba(var(--accent-cyan-rgb), 0.18); }

/* Buttons */
.btn {
  appearance: none; cursor: pointer;
  background: var(--panel-bg); color: var(--text-primary);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md, 12px);
  padding: 11px 16px; font-size: 15px; font-family: inherit; font-weight: 500;
  transition: transform var(--motion-fast) var(--motion-ease),
              border-color var(--motion-fast) var(--motion-ease),
              background var(--motion-fast) var(--motion-ease);
  flex: 1;
}
.btn:not(:disabled):active { transform: translateY(1px); }
.btn:not(:disabled):hover { border-color: var(--panel-border-hover); background: var(--panel-bg-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: transparent; }
.btn.warn { color: var(--status-warning); border-color: var(--status-warning); }
.icon-btn {
  appearance: none; cursor: pointer; font-size: 20px; line-height: 1;
  background: transparent; border: none; color: var(--text-secondary);
  padding: 4px 6px;
}

/* Lists */
.machines, .log { list-style: none; margin: 0; padding: 0; }
.machines li {
  padding: 8px 10px; border-radius: var(--radius-sm, 8px);
  background: var(--panel-surface); margin-bottom: 6px; font-size: 14px;
}
.machines li.muted, .muted { color: var(--text-muted); background: transparent; }

.log {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
  padding: 4px 2px; margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 13px;
}
.log li { padding: 5px 8px; border-radius: var(--radius-sm, 8px); word-break: break-word; }
.log-sys { color: var(--text-muted); }
.log-in  { color: var(--text-primary); background: var(--panel-surface); }
.log-out { color: var(--accent-cyan); }
.log-err { color: var(--status-error); }

.status { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.hint { margin: 0 0 10px; font-size: 12px; color: var(--text-muted); }
.send { margin-top: auto; }

/* Avatar head card (Phase 3 — ENABLE_SYNA_COMPANION) */
.avatar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow: hidden;
  height: 260px;
  background: transparent;
  border-color: var(--glass-border);
}
#avatar-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.avatar-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
