:root {
  color-scheme: light;
  --ink: #18221e;
  --muted: #61706a;
  --line: #dfe7e2;
  --surface: #ffffff;
  --surface-soft: #f4f7f5;
  --green: #0d7a4f;
  --green-dark: #075b3a;
  --green-soft: #dff4e9;
  --blue: #246bfd;
  --blue-soft: #e8efff;
  --amber: #aa6513;
  --shadow: 0 18px 50px rgba(19, 47, 36, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(128, 215, 174, 0.24), transparent 35%),
    linear-gradient(145deg, #eef5f1 0%, #f8faf9 56%, #edf2f0 100%);
}

button, input { font: inherit; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: var(--green);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 30px rgba(13, 122, 79, 0.22);
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(24px, 4vw, 34px); letter-spacing: -0.03em; }
h2 { margin-bottom: 8px; font-size: 19px; }
.subtitle, .muted { color: var(--muted); }
.subtitle { margin-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #17a66a; }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; }
.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(211, 224, 216, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.sidebar { padding: 20px; }
.chat-card {
  padding: 15px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.chat-card strong { display: block; margin-bottom: 5px; }
.chat-card span { color: var(--muted); font-size: 13px; }

.token-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input {
  width: 100%;
  border: 1px solid #cfd9d3;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  background: white;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(13, 122, 79, 0.12); }

.button {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: white; }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: #e9efeb; color: var(--ink); }
.button-danger { background: #fff0ef; color: #a3342a; }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.chat-panel { min-height: 680px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.chat-header { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; }
.chat-title { font-weight: 800; }
.chat-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.chat-controls { display: flex; align-items: center; gap: 10px; }
.sound-toggle { min-width: 104px; padding: 9px 12px; white-space: nowrap; }
.messages { padding: 24px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.message { max-width: min(76%, 580px); padding: 12px 14px; border-radius: 16px; line-height: 1.45; }
.message-buyer { align-self: flex-end; background: var(--green); color: white; border-bottom-right-radius: 5px; }
.message-operator { align-self: flex-start; background: var(--blue-soft); color: #183b86; border-bottom-left-radius: 5px; }
.message-system { align-self: center; max-width: 90%; background: var(--surface-soft); color: var(--muted); font-size: 13px; text-align: center; }
.message-time { display: block; margin-top: 6px; opacity: .72; font-size: 11px; }

.composer { padding: 18px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.composer input { min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.status-card { padding: 20px; }
.status-value { margin-top: 18px; font-size: 20px; font-weight: 850; }
.status-value.ok { color: var(--green); }
.status-value.warn { color: var(--amber); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.section { padding: 22px; margin-top: 18px; }
.timeline { list-style: none; padding: 0; margin: 18px 0 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding-bottom: 16px; color: var(--muted); }
.timeline li::before { content: ""; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.notice { padding: 12px 14px; border-radius: 12px; background: #fff6dd; color: #775012; font-size: 13px; }

@media (max-width: 780px) {
  .layout, .grid { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .chat-panel { min-height: 620px; }
  .message { max-width: 88%; }
  .chat-header { align-items: flex-start; }
  .chat-controls { align-items: flex-end; flex-direction: column-reverse; }
}
