:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --text: #18212f;
  --muted: #637083;
  --line: #d8e0ea;
  --brand: #116466;
  --brand-dark: #0b4748;
  --danger: #b3261e;
  --success: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat-shell {
  width: min(760px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(24, 33, 47, 0.12);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e6f4f1;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.messages {
  display: grid;
  gap: 12px;
  padding: 22px 24px 0;
}

.message {
  max-width: 92%;
  padding: 13px 15px;
  border-radius: 8px;
}

.message p {
  margin: 0;
}

.message.assistant {
  background: #edf7f5;
}

.message.system {
  border: 1px solid var(--line);
  background: #f8fafc;
}

.message.system.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--success);
}

.message.system.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.hidden {
  display: none;
}

.booking-form {
  display: grid;
  gap: 16px;
  padding: 22px 24px 24px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  background: #ffffff;
}

input:focus,
textarea:focus {
  outline: 3px solid rgba(17, 100, 102, 0.18);
  border-color: var(--brand);
}

textarea {
  resize: vertical;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  background: var(--brand);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

button:disabled {
  background: #94a3b8;
  cursor: wait;
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
    place-items: start center;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-row {
    grid-template-columns: 1fr;
  }
}


.chat-page {
  place-items: start center;
}

.service-chat {
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto auto auto;
  min-height: min(860px, calc(100vh - 48px));
}

.chat-messages {
  align-content: start;
  max-height: 56vh;
  overflow-y: auto;
  padding-bottom: 18px;
}

.message.customer {
  justify-self: end;
  background: var(--brand);
  color: #ffffff;
}

.message.assistant {
  justify-self: start;
}

.chat-input-area {
  display: grid;
  gap: 8px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.chat-input-label {
  font-size: 13px;
}

.chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.secondary-button {
  background: #475569;
}

.secondary-button:hover {
  background: #334155;
}

.summary-panel {
  display: grid;
  gap: 14px;
  margin: 0 24px 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.summary-panel h2 {
  margin: 0;
  font-size: 18px;
}

.summary-panel dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px 18px;
  margin: 0;
}

.summary-panel dl > div {
  min-width: 0;
}

.summary-panel dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-panel dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.summary-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fallback-link {
  padding: 0 24px 22px;
  text-align: center;
}

.fallback-link a {
  color: var(--brand-dark);
  font-weight: 700;
}

@media (max-width: 640px) {
  .service-chat {
    min-height: calc(100vh - 24px);
  }

  .chat-messages {
    max-height: 50vh;
  }

  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .summary-panel dl {
    grid-template-columns: 1fr;
  }
}

.hidden {
  display: none !important;
}


.header-link {
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 700;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.status-shell {
  margin-top: 24px;
}

.status-details {
  display: grid;
  gap: 18px;
  padding: 0 24px 24px;
}

.status-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 8px;
}

.status-heading h2,
.compact-form h2 {
  margin: 0;
  font-size: 20px;
}

.customer-status-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-status-received { background: #e0f2fe; color: #075985; }
.customer-status-processing { background: #fef3c7; color: #92400e; }
.customer-status-cancelled { background: #fee2e2; color: #991b1b; }
.customer-status-rejected { background: #e5e7eb; color: #374151; }

.status-explanation {
  margin: 0;
  color: var(--muted);
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.summary-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.compact-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cancel-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
}

.cancel-box p {
  margin: 0;
}

.danger-button {
  background: #b3261e;
}

.danger-button:hover {
  background: #8f1f19;
}

@media (max-width: 640px) {
  .status-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-list {
    grid-template-columns: 1fr;
  }
}
