:root {
  --ink: #17201d;
  --muted: #66726c;
  --paper: #f4f0e8;
  --surface: #fffdf8;
  --surface-soft: #f8f6ef;
  --line: #d9d0c3;
  --sage: #385d50;
  --sage-deep: #28473d;
  --sage-soft: #e3ece5;
  --clay: #b76845;
  --amber: #d99228;
  --shadow: 0 24px 70px rgba(30, 34, 29, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--paper);
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 253, 248, 0.95), rgba(255, 253, 248, 0) 32rem),
    linear-gradient(135deg, #f8f5ee 0%, #ebe5d9 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(18px, 3vw, 34px);
  padding: clamp(16px, 3vw, 38px);
}

.chat-panel,
.side-panel {
  min-width: 0;
}

.chat-panel {
  height: calc(100dvh - clamp(32px, 6vw, 76px));
  min-height: 0;
  display: grid;
  grid-template-areas:
    "header"
    "strip"
    "messages"
    "composer";
  grid-template-rows: auto auto minmax(340px, 1fr) auto;
  overflow: hidden;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(217, 208, 195, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.chat-header,
.salon-strip,
.composer {
  padding: 20px clamp(20px, 3vw, 32px);
}

.chat-header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 1), rgba(248, 246, 239, 0.72));
  border-bottom: 1px solid var(--line);
}

.kicker {
  margin: 0 0 8px;
  color: var(--clay);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 0.96;
}

h2 {
  font-size: 24px;
  line-height: 1.08;
}

.header-copy {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.status {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  border: 1px solid rgba(56, 93, 80, 0.14);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.salon-strip {
  grid-area: strip;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  background: rgba(248, 246, 239, 0.75);
  border-bottom: 1px solid var(--line);
}

.salon-strip strong {
  color: var(--ink);
}

.messages {
  grid-area: messages;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: clamp(20px, 3vw, 32px);
  background:
    linear-gradient(180deg, rgba(232, 238, 232, 0.55), rgba(255, 253, 248, 0.78) 34%, rgba(255, 253, 248, 0.95));
}

.message {
  position: relative;
  width: min(720px, 88%);
  padding: 16px 18px;
  border: 1px solid rgba(217, 208, 195, 0.98);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: 0 10px 26px rgba(30, 34, 29, 0.06);
}

.message.assistant {
  align-self: flex-start;
  margin-left: 28px;
}

.message.assistant::before,
.message.system::before {
  content: "E";
  position: absolute;
  left: -28px;
  top: 14px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.message.user {
  align-self: flex-end;
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
  box-shadow: 0 14px 30px rgba(40, 71, 61, 0.18);
}

.message.system {
  align-self: flex-start;
  margin-left: 28px;
  border-color: rgba(183, 104, 69, 0.28);
  background: #fff8f3;
}

.message.typing {
  width: auto;
  min-width: 112px;
}

.message-meta {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.message.user .message-meta {
  color: rgba(255, 255, 255, 0.74);
}

.quick-actions {
  grid-area: quick;
  min-height: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  background: transparent;
  border-top: 0;
  scrollbar-width: none;
  transition: opacity 0.16s ease;
}

.quick-actions[hidden] {
  display: none;
}

.quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-actions.is-secondary {
  opacity: 0.72;
}

.quick-actions button,
.secondary-action {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffefa;
  color: var(--ink);
  padding: 0 12px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.quick-actions button:hover,
.secondary-action:hover {
  border-color: rgba(56, 93, 80, 0.55);
  background: var(--sage-soft);
}

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

.quick-actions button {
  flex: 0 0 auto;
  min-width: 94px;
  white-space: nowrap;
}

.composer {
  grid-area: composer;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "input send"
    "quick quick"
    "human human";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 12px;
  background: #fffefa;
  border-top: 1px solid var(--line);
}

.composer input {
  grid-area: input;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 15px;
  outline: none;
}

.composer input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217, 146, 40, 0.14);
}

.composer button {
  grid-area: send;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  padding: 0 22px;
  font-weight: 850;
}

.composer button:hover {
  background: var(--sage-deep);
}

.composer .human-action {
  grid-area: human;
  justify-self: start;
  min-height: 34px;
  border: 1px solid rgba(56, 93, 80, 0.28) !important;
  border-radius: 999px !important;
  background: var(--sage-soft) !important;
  color: var(--sage-deep) !important;
  padding: 0 13px !important;
  font-size: 14px;
}

.composer .human-action:hover {
  background: #d8e6dc !important;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 18px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-pulse 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.guide-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.guide-card p {
  margin: 14px 0 0;
  color: var(--muted);
}

.muted-card {
  background: rgba(248, 246, 239, 0.92);
}

.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.guide-actions span {
  padding: 7px 10px;
  border: 1px solid rgba(56, 93, 80, 0.16);
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 13px;
  font-weight: 750;
}

.client-rules {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  margin: 0 0 18px;
  color: var(--muted);
}

.secondary-action {
  width: 100%;
  min-height: 42px;
}

.sr-only {
  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: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    height: 100%;
    min-height: 0;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    padding: 0;
    overflow: hidden;
  }

  .chat-panel,
  .guide-card {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .chat-panel {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto 0 minmax(180px, 1fr) auto;
  }

  .chat-header,
  .salon-strip,
  .messages,
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .chat-header {
    gap: 0;
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .chat-header .kicker,
  .header-copy,
  .status,
  .salon-strip {
    display: none;
  }

  h1 {
    font-size: 26px;
    line-height: 1;
  }

  .messages {
    min-height: 0;
    gap: 12px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .chat-header,
  .composer {
    display: grid;
  }

  .salon-strip {
    display: none;
  }

  .side-panel {
    display: none;
  }

  .composer {
    grid-template-areas:
      "input"
      "quick"
      "human"
      "send";
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .composer button {
    width: 100%;
  }

  .composer .human-action {
    width: auto !important;
  }

  .quick-actions {
    padding: 0;
  }

  .quick-actions button {
    min-height: 31px;
    min-width: 92px;
    font-size: 14px;
  }

  .message {
    width: calc(100% - 28px);
    padding: 14px 16px;
    border-radius: 10px;
  }

  .message.user {
    width: min(100%, 92%);
  }

  .message-meta {
    font-size: 11px;
  }
}
