:root {
  --bg: #f6f3ee;
  --surface: #fffdf8;
  --surface-muted: #f0ebe2;
  --text: #1f2933;
  --muted: #65727f;
  --border: #ded6c8;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --accent: #b7791f;
  --assistant: #edf7f5;
  --user: #fff6df;
  --danger: #9b2c2c;
  --shadow: 0 24px 70px rgba(40, 45, 53, 0.12);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(246, 243, 238, 0) 44%),
    var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.7;
}

button,
textarea,
input {
  font: inherit;
}

.file-protocol-warning {
  width: min(calc(100% - 24px), 920px);
  margin: 12px auto 0;
  padding: 12px 14px;
  border: 1px solid #f0b7b7;
  border-radius: var(--radius);
  background: #fff5f5;
  color: var(--danger);
  font-weight: 700;
  line-height: 1.7;
}

.assistant-shell {
  width: min(100%, 920px);
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 18px 14px 10px;
  display: flex;
  align-items: center;
}

.assistant-panel {
  width: 100%;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.assistant-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.09), rgba(183, 121, 31, 0.07)),
    var(--surface);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1;
}

.header-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4.5vw, 2.55rem);
  line-height: 1.25;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.chat-window {
  min-height: 330px;
  max-height: 50vh;
  padding: 18px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.22)),
    var(--surface);
}

.message {
  width: fit-content;
  max-width: min(100%, 720px);
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--assistant);
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.message-label {
  margin-bottom: 4px;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.user-message {
  margin-right: auto;
  background: var(--user);
}

.user-message .message-label {
  color: #8a5a10;
}

.error-message {
  background: #fff5f5;
  border-color: #f1c2c2;
}

.error-message .message-label {
  color: var(--danger);
}

.composer {
  display: grid;
  gap: 12px;
  padding: 16px 18px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}

.composer textarea {
  width: 100%;
  min-height: 62px;
  max-height: 180px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #cfc6b8;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
}

.composer textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.composer-actions {
  display: grid;
  grid-template-columns: minmax(132px, auto) 1fr;
  gap: 10px;
  align-items: center;
}

.mic-button,
.send-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}

.mic-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: #e4ded3;
  color: var(--text);
  white-space: nowrap;
}

.mic-button svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mic-button:hover,
.mic-button:focus-visible,
.mic-button.is-listening {
  background: #d9efe9;
  color: var(--primary-dark);
}

.mic-button:disabled,
.send-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.send-button {
  background: var(--primary);
  color: #fff;
  transition: background 160ms ease, transform 160ms ease;
}

.send-button:hover,
.send-button:focus-visible {
  background: var(--primary-dark);
}

.send-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.mic-instruction,
.mic-help,
.mic-tech-note,
.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.mic-instruction {
  color: var(--text);
  font-weight: 700;
}

.mic-tech-note {
  color: #6f7884;
}

.privacy-note {
  color: #59636f;
}

.voice-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d8d0c4;
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.74);
}

.auto-speak-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}

.auto-speak-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.voice-buttons {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
}

.secondary-button {
  padding: 0 14px;
  border: 1px solid #cfc6b8;
  background: #fff;
  color: var(--primary-dark);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--primary);
  background: #f5fbfa;
}

.note {
  margin: 0;
  padding: 0 18px 18px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .voice-controls {
    grid-template-columns: 1fr;
  }

  .voice-buttons {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .assistant-shell {
    min-height: calc(100vh - 60px);
    padding: 10px 8px 4px;
    align-items: stretch;
  }

  .assistant-panel {
    display: flex;
    min-height: calc(100vh - 74px);
    flex-direction: column;
  }

  .assistant-header {
    grid-template-columns: 1fr;
    padding: 18px 14px 14px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.94rem;
  }

  .chat-window {
    flex: 1;
    min-height: 230px;
    max-height: none;
    padding: 14px;
  }

  .composer {
    padding: 14px 14px 10px;
  }

  .composer-actions {
    grid-template-columns: 1fr;
  }

  .voice-buttons {
    grid-template-columns: 1fr;
  }

  .note {
    padding: 0 14px 14px;
  }
}
