:root {
  --ink: #202523;
  --muted: #6e7772;
  --paper: #f3f5f2;
  --surface: #ffffff;
  --line: #dce1dc;
  --green: #176b4b;
  --green-soft: #e3f1e9;
  --red: #a8443a;
  --amber: #b87919;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; }
button, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { height: 68px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; color: white; background: var(--green); border-radius: 6px; font-family: serif; font-size: 20px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.connection span:first-child { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.connection.online span:first-child { background: var(--green); }

main { min-height: calc(100vh - 68px); display: grid; grid-template-columns: minmax(290px, 0.82fr) minmax(480px, 1.65fr) minmax(250px, 0.72fr); }
.device-column, .inspector { padding: 40px 28px; }
.device-column { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e8ebe7; border-right: 1px solid var(--line); }
.device-shell { width: min(350px, 100%); aspect-ratio: 1 / 1; padding: 36px; position: relative; background: #1e2220; border: 1px solid #343a36; box-shadow: 0 18px 50px rgba(32,37,35,.18); border-radius: 8px; }
.device-screen { width: 100%; aspect-ratio: 4 / 3; padding: 12px 14px; display: flex; flex-direction: column; align-items: center; position: relative; overflow: hidden; background: #f5f8f3; border-radius: 3px; }
.screen-head { width: 100%; display: flex; justify-content: space-between; font-size: 10px; color: #5d6b63; }
.face { width: 92px; height: 62px; margin-top: 9px; position: relative; }
.face i { width: 12px; height: 18px; top: 11px; position: absolute; background: var(--green); border-radius: 50%; }
.face i:first-child { left: 19px; }
.face i:nth-child(2) { right: 19px; }
.face b { width: 38px; height: 17px; left: 27px; top: 31px; position: absolute; border-bottom: 4px solid var(--green); border-radius: 50%; }
.screen-state { min-height: 28px; margin: 1px 0 4px; text-align: center; font-size: 11px; line-height: 1.35; }
.screen-wave { height: 18px; display: flex; align-items: center; gap: 3px; opacity: 0; }
.screen-wave span { width: 3px; height: 6px; background: var(--green); animation: wave .65s infinite alternate; }
.screen-wave span:nth-child(2), .screen-wave span:nth-child(4) { animation-delay: .2s; }
.screen-wave span:nth-child(3) { animation-delay: .4s; }
.device-screen.listening .screen-wave { opacity: 1; }
.talk-button { min-width: 100px; height: 30px; margin-top: auto; border: 0; border-radius: 4px; color: white; background: var(--green); font-size: 11px; }
.talk-button:active { transform: translateY(1px); }
.hardware-label { bottom: 13px; left: 0; right: 0; position: absolute; text-align: center; color: #8f9792; font-size: 10px; }
.device-note { margin-top: 16px; color: var(--muted); font-size: 12px; }

.workspace { min-height: calc(100vh - 68px); display: grid; grid-template-rows: auto 1fr auto auto; background: var(--surface); }
.mode-tabs { min-height: 58px; padding: 12px 24px 0; display: flex; align-items: end; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.mode-tabs button { padding: 12px 13px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; white-space: nowrap; font-size: 13px; }
.mode-tabs button.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.conversation { padding: 28px; overflow-y: auto; }
.message { max-width: 86%; margin-bottom: 22px; display: flex; gap: 10px; align-items: flex-start; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.avatar { flex: 0 0 30px; height: 30px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 4px; font-family: serif; font-size: 14px; }
.user .avatar { color: var(--ink); background: #e5e7e4; font-family: inherit; }
.message p { margin: 0; padding: 12px 14px; background: #f1f4f1; border-radius: 4px; line-height: 1.65; font-size: 14px; }
.message.user p { background: var(--green-soft); }
.message small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.composer { margin: 0 24px; padding: 8px; display: grid; grid-template-columns: 1fr auto; gap: 8px; border: 1px solid #cfd5cf; background: white; }
.composer:focus-within { border-color: var(--green); }
.composer textarea { min-height: 50px; padding: 8px; resize: none; border: 0; outline: 0; line-height: 1.45; }
.composer button { width: 64px; border: 0; color: white; background: var(--green); border-radius: 3px; }
.privacy-row { padding: 10px 24px 18px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.privacy-row button { padding: 0; border: 0; color: var(--muted); background: transparent; text-decoration: underline; }

.inspector { background: #f7f8f6; border-left: 1px solid var(--line); }
.inspector h2 { margin: 0 0 24px; font-size: 15px; }
.inspector dl { margin: 0; }
.inspector dl div { padding: 12px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); font-size: 12px; }
.inspector dt { color: var(--muted); }
.inspector dd { margin: 0; font-weight: 600; }
.insight { margin-top: 24px; padding: 16px; background: var(--green-soft); border-left: 3px solid var(--green); }
.insight span, .citation-panel h3 { color: var(--green); font-size: 11px; font-weight: 700; }
.insight p { margin: 8px 0 0; line-height: 1.6; font-size: 12px; }
.citation-panel { margin-top: 26px; }
.citation-panel h3 { color: var(--ink); }
.citation-panel p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.limits { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 7px; }
.limits span { padding: 5px 7px; color: var(--muted); background: #e7eae6; font-size: 10px; border-radius: 3px; }
@keyframes wave { to { height: 16px; } }

@media (max-width: 980px) {
  main { grid-template-columns: 310px 1fr; }
  .inspector { display: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; }
  main { display: block; }
  .device-column { min-height: 430px; border-right: 0; }
  .workspace { min-height: 650px; }
  .device-shell { width: 310px; }
  .conversation { min-height: 340px; }
}
