:root {
  color-scheme: light;
  --ink: #172b43;
  --muted: #485c72;
  --blue: #164d84;
  --blue-deep: #153b64;
  --blue-soft: #edf5ff;
  --orange: #f4a348;
  --orange-deep: #df8731;
  --orange-soft: #fff2df;
  --paper: #f3f6fa;
  --white: #fff;
  --line: #d7e1ec;
  --green: #185a40;
  --green-soft: #e5f3ea;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 "Segoe UI", system-ui, sans-serif;
}

.shell {
  width: min(1110px, calc(100% - 48px));
  margin-inline: auto;
}

p { margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.24; }
h1 { font-size: clamp(1.9rem, 3.7vw, 2.85rem); letter-spacing: -0.04em; }
h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }

.site-header-inner, .page-intro, .panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.site-header-inner { min-height: 66px; align-items: center; }
.brand { color: var(--blue-deep); font-size: 1.0625rem; font-weight: 750; }

.demo-label {
  padding: 0.28rem 0.68rem;
  border-radius: 6px;
  background: var(--orange-soft);
  color: #754616;
  font-size: 0.8125rem;
  font-weight: 650;
}

.page-intro { margin: 31px 0 22px; align-items: end; }
.page-intro > button { flex-shrink: 0; }
.business-name { margin-bottom: 5px; color: var(--blue); font-size: 0.875rem; font-weight: 700; }
.intro-note { margin-top: 9px; color: var(--muted); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr);
  align-items: start;
  gap: 18px;
}

.card {
  min-width: 0;
  padding: 22px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

button, textarea { font: inherit; }

button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--white);
  color: var(--blue-deep);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
}

button:not(:disabled):hover { background: var(--blue-soft); }
button:disabled { cursor: not-allowed; opacity: 0.56; }
button:focus-visible, textarea:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.button-primary { border-color: #bc6619; background: var(--orange); color: #21170e; }
.button-primary:not(:disabled):hover { background: var(--orange-deep); }

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.suggestion { border-color: #a9bbcf; }

.question-form { display: grid; gap: 12px; margin-top: 17px; }
.question-form > button { justify-self: start; }
.field { display: grid; gap: 5px; min-width: 0; }
label { font-weight: 650; font-size: 0.9rem; }

textarea {
  width: 100%;
  min-height: 84px;
  padding: 8px 10px;
  border: 1px solid #a9bbcf;
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  resize: vertical;
}

textarea::placeholder { color: #576b81; }
.section-note { color: var(--muted); font-size: 0.875rem; }

.answer-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #c3d5e8;
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  background: #f6faff;
}

.panel-heading { align-items: baseline; flex-wrap: wrap; gap: 5px 12px; }
.answer-panel > p { margin-top: 9px; }
.answer-panel > button { margin-top: 12px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge[data-state="pending"] { background: var(--orange-soft); color: #754616; }

.queue-count { color: var(--blue-deep); font-size: 0.875rem; font-weight: 700; }
.queue-note { margin-top: 4px; }

.ticket-list, .ticket-history { margin: 12px 0 0; padding: 0; list-style: none; }
.ticket-list { display: grid; gap: 9px; }

.ticket, .empty-state {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.empty-state { background: var(--paper); color: var(--muted); font-size: 0.9rem; }
.ticket .section-note { margin-top: 6px; }
.ticket > button { margin-top: 10px; }

.ticket-history {
  padding-left: 9px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
}

.ticket-history time { display: block; }
.ticket-history li + li { margin-top: 6px; }

.status-message:not(:empty) {
  margin-bottom: 16px;
  padding: 9px 13px;
  border: 1px solid #b7cce2;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 0.9rem;
}

.status-message.error { background: #fff0eb; border-color: #e6b3a3; color: #852d1c; }
.site-footer { padding-block: 22px; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 750px) {
  .shell { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card { padding: 17px; }
}

@media (max-width: 520px) {
  .page-intro { align-items: start; flex-direction: column; margin-top: 22px; }
}
