:root {
  --bg: #eff3f8;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(18, 32, 61, 0.08);
  --text: #172033;
  --muted: #6a7488;
  --accent: #2458e8;
  --accent-strong: #163ea7;
  --accent-soft: rgba(36, 88, 232, 0.08);
  --success: #118560;
  --danger: #cc3f46;
  --warning: #b98512;
  --shadow: 0 24px 60px rgba(17, 31, 58, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(36, 88, 232, 0.12), transparent 24%),
    radial-gradient(circle at right center, rgba(17, 133, 96, 0.08), transparent 20%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--text);
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 88, 232, 0.3);
}

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.primary:hover {
  background: var(--accent-strong);
}

button.ghost {
  background: rgba(36, 88, 232, 0.06);
  border-color: rgba(36, 88, 232, 0.16);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

textarea {
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar,
.main-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(10px);
}

.hero-panel {
  min-height: 180px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(36, 88, 232, 0.12), rgba(255, 255, 255, 0.96) 42%),
    var(--panel);
}

.hero-panel::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  bottom: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36, 88, 232, 0.22), rgba(36, 88, 232, 0));
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 48px;
  line-height: 0.94;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.small-text {
  font-size: 12px;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: auto;
}

.checkbox-field span {
  margin: 0;
}

.panel-header,
.button-row,
.chat-topbar,
.two-columns {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.two-columns > * {
  flex: 1 1 220px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(17, 133, 96, 0.12);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.muted-badge {
  background: rgba(18, 32, 61, 0.06);
  color: var(--muted);
}

.chats-panel {
  flex: 1 1 auto;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 54vh;
  overflow: auto;
}

.chat-card {
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 14px;
  background: rgba(246, 248, 252, 0.92);
  cursor: pointer;
  text-align: left;
}

.chat-card.active {
  border-color: rgba(36, 88, 232, 0.35);
  background: linear-gradient(180deg, rgba(36, 88, 232, 0.12), rgba(36, 88, 232, 0.06));
}

.chat-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.chat-preview {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.chat-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

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

.messages {
  min-height: 420px;
  max-height: 58vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(18, 32, 61, 0.06);
  background:
    linear-gradient(180deg, rgba(244, 247, 252, 0.9), rgba(255, 255, 255, 0.45));
}

.message {
  align-self: flex-start;
  width: min(72%, 720px);
  padding: 14px 16px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 22px rgba(17, 31, 58, 0.05);
}

.message.domain-card {
  align-self: center;
  width: min(84%, 760px);
  background: linear-gradient(180deg, rgba(36, 88, 232, 0.07), rgba(255, 255, 255, 0.98));
  border-color: rgba(36, 88, 232, 0.16);
}

.message.is-own {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(36, 88, 232, 0.14), rgba(36, 88, 232, 0.08));
  border-color: rgba(36, 88, 232, 0.25);
}

.message.is-system {
  align-self: center;
  width: min(82%, 760px);
  background: rgba(18, 32, 61, 0.06);
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 17px;
  line-height: 1.45;
}

.message-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.message-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.card-body {
  margin-top: 10px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(18, 32, 61, 0.08);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.card-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
}

.split-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.attachment-form {
  display: flex;
  flex-direction: column;
}

.three-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

pre {
  margin: 0;
  min-height: 120px;
  padding: 14px;
  border-radius: 18px;
  background: #1d2432;
  color: #edf2ff;
  overflow: auto;
}

.request-log {
  max-height: 420px;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 32px;
  border: 1px dashed var(--panel-border);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #1d2432;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .split-panels,
  .three-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .panel {
    padding: 16px;
  }

  h1 {
    font-size: 40px;
  }

  .messages {
    min-height: 340px;
    max-height: 44vh;
  }

  .message,
  .message.is-system {
    width: 100%;
  }
}
