:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #142c2b;
  background: #f2f4ee;
  --ink: #142c2b;
  --muted: #687775;
  --paper: #fffdf7;
  --line: #d8ded5;
  --teal: #0c7169;
  --teal-dark: #07534f;
  --lime: #d8ef90;
  --orange: #f09a62;
  --shadow: 0 22px 60px rgba(20, 44, 43, 0.11);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 10% 0%, #dcefdc 0, transparent 30%), #f2f4ee; }
button, select, textarea, input { font: inherit; }
button, select, input { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); gap: 36px; align-items: end; margin-bottom: 24px; }
.eyebrow, .kicker { margin: 0 0 8px; color: var(--teal); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -0.035em; }
h1 { font-size: clamp(2.7rem, 7vw, 5.5rem); line-height: 0.92; }
h1 span { color: var(--teal); }
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); }
.intro { max-width: 650px; margin: 20px 0 0; color: var(--muted); font-size: 1.04rem; line-height: 1.65; }

.privacy-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px; border: 1px solid rgba(12, 113, 105, 0.18); border-radius: 20px; background: rgba(255, 253, 247, 0.75); backdrop-filter: blur(12px); }
.privacy-card div { min-width: 0; }
.privacy-card strong, .privacy-card small { display: block; }
.privacy-card strong { font-size: 0.92rem; }
.privacy-card small { margin-top: 4px; color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.privacy-card > span { color: var(--teal); font-weight: 900; }

.control-panel, .conversation-panel { border: 1px solid rgba(20, 44, 43, 0.1); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.control-panel { padding: 28px; }
.conversation-panel { margin-top: 22px; padding: 28px; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.settings-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 24px; }
label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
select, textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
select { padding: 0 12px; }
input { padding: 0 12px; }
textarea { resize: vertical; padding: 12px 14px; line-height: 1.45; }
select:focus, textarea:focus, input:focus, button:focus-visible { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(12, 113, 105, 0.15); outline: none; }

.login-shell { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.login-card { width: min(460px, 100%); padding: 34px; border: 1px solid rgba(20, 44, 43, 0.1); border-radius: 26px; background: var(--paper); box-shadow: var(--shadow); }
.login-card h1 { font-size: clamp(2.4rem, 11vw, 4.5rem); }
.login-card .intro { margin-bottom: 24px; }
.login-card label { display: block; margin-top: 15px; }
.login-card button { width: 100%; margin-top: 22px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 800; }
.login-card .sso-login { display: block; margin-top: 22px; padding: 14px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 800; text-align: center; text-decoration: none; }
.login-error { min-height: 1.4em; margin: 12px 0 0; color: #a43a24; font-size: 0.85rem; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.badge { padding: 7px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 800; }
.badge.waiting { background: #edf0e9; color: #5d6a68; }
.badge.ready { background: #d8efe8; color: #075b51; }
.badge.error { background: #ffe2d5; color: #98401c; }
.system-status { margin: 14px 0 0; color: var(--muted); font-size: 0.88rem; }
.system-status.error { color: #a43a24; }
.progress-wrap { height: 5px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: #e7ebe4; }
.progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--teal), #51ac82); transition: width 180ms ease; }
.usage-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.usage-row div { padding: 12px 14px; border-radius: 14px; background: #f2f4ee; }
.usage-row strong, .usage-row span { display: block; }
.usage-row strong { color: var(--teal-dark); font-size: 1.25rem; }
.usage-row span { margin-top: 2px; color: var(--muted); font-size: 0.74rem; font-weight: 700; }

.messages { min-height: 230px; max-height: 47vh; margin: 24px 0; padding: 18px; overflow-y: auto; border-radius: 18px; background: #f5f6f0; }
.message { display: flex; gap: 12px; max-width: 86%; margin-bottom: 18px; }
.message.user { flex-direction: row-reverse; margin-left: auto; }
.message > div { padding: 12px 15px; border-radius: 4px 16px 16px; background: #fff; box-shadow: 0 5px 18px rgba(20, 44, 43, 0.06); }
.message.user > div { border-radius: 16px 4px 16px 16px; background: #dcefe8; }
.message small { color: var(--teal); font-size: 0.7rem; font-weight: 800; }
.message p { margin: 5px 0 0; line-height: 1.55; white-space: pre-wrap; }
.speak-message { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: #f7f8f4; color: var(--teal-dark); font-size: 0.75rem; font-weight: 800; cursor: pointer; }
.speak-message:hover:not(:disabled) { border-color: var(--teal); background: #eaf4ef; }
.speak-message:disabled { cursor: default; opacity: 0.5; }
.speak-message.speaking { border-color: var(--teal); background: #d8efe8; }
.message.user .speak-message { background: rgba(255, 255, 255, 0.55); }
.avatar { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--ink); color: #fff; font-size: 0.72rem; font-weight: 900; }
.message.user .avatar { background: var(--teal); }
.error-message > div { border: 1px solid #e69b7d; }

.composer { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.talk-button { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 72px; border: 0; border-radius: 16px; background: var(--ink); color: #fff; transition: transform 120ms ease, background 120ms ease; touch-action: none; }
.talk-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.talk-button.recording { background: #bd5032; transform: scale(0.985); }
.talk-button.wake-waiting { background: #6550a5; }
.talk-button.wake-waiting:hover { background: #6550a5; transform: none; }
.talk-button.wake-command { background: #bd5032; }
.talk-button strong, .talk-button small { display: block; text-align: left; }
.talk-button small { margin-top: 3px; color: #d7e1dd; }
.mic-icon { position: relative; width: 19px; height: 27px; border: 2px solid currentColor; border-radius: 12px; }
.mic-icon::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 15px; height: 9px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 10px 10px; transform: translateX(-50%); }
.text-composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.text-composer button { padding: 0 24px; border: 0; border-radius: 14px; background: var(--lime); color: var(--ink); font-weight: 900; }
.quiet-button { padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--ink); font-size: 0.82rem; font-weight: 800; }
.download-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.stop-button { border-color: #d39179; color: #9b3f25; }
.stop-button:hover:not(:disabled) { border-color: #bd5032; background: #fff0e9; }
.switch { display: flex; align-items: center; gap: 8px; }
.switch span { margin: 0; }
.conversation-switches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 18px; }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1120px); padding-top: 24px; }
  .privacy-card { overflow-x: auto; }
  .control-panel, .conversation-panel { padding: 20px; border-radius: 20px; }
  .settings-grid, .composer { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .conversation-switches { justify-content: flex-start; }
  .message { max-width: 96%; }
  .talk-button { min-height: 66px; }
  .text-composer { grid-template-columns: 1fr; }
  .text-composer button { min-height: 50px; }
}
