:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --subtle: #fffcf6;
  --ink: #1a2028;
  --muted: #5f6772;
  --line: #dccfb8;
  --accent: #166f5b;
  --accent-strong: #125949;
  --danger: #ab2f36;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, #f1e2c8 0, transparent 38%),
    radial-gradient(circle at 100% 100%, #d3eadf 0, transparent 44%),
    var(--bg);
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 24px rgba(39, 41, 48, 0.08);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Bitter", "Georgia", serif;
  letter-spacing: 0;
}

p {
  margin: 6px 0;
}

label {
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

form:not(.inline-form) {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

input,
select,
button,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  background: #fff;
  color: var(--ink);
  min-height: 36px;
}

textarea {
  resize: vertical;
  min-width: 0;
}

button {
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

button.secondary {
  background: #d4dfe3;
  color: #21323a;
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary:hover {
  background: #d4dfe3;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.selected-row {
  background: #f6efe2;
}

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

.small {
  color: var(--muted);
  font-size: 13px;
}

.status {
  min-height: 18px;
  font-weight: 600;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

#qr-image {
  max-width: 260px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.message-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--subtle);
}

.message-title {
  font-weight: 700;
}

.message-text,
.raw-json {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.raw-json {
  max-height: 260px;
}

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

  .inline-form,
  .panel-title-row,
  .two-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  table {
    min-width: 820px;
  }
}
