:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --text: #17211f;
  --muted: #687470;
  --line: #d9e0dc;
  --primary: #146c64;
  --primary-dark: #0d4d48;
  --accent: #c64a2f;
  --accent-soft: #fae7df;
  --focus: #f3bd38;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(20, 108, 100, 0.08), transparent 320px),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
}

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

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

button.secondary {
  color: var(--primary);
  border: 1px solid var(--line);
  background: #fff;
}

button.secondary:hover {
  border-color: var(--primary);
  background: #eef7f4;
}

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

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

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

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

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

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

.status-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 33, 31, 0.06);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 4px;
  background: #edf1ef;
}

.segmented button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 4px rgba(23, 33, 31, 0.08);
}

.form {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 164px;
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(243, 189, 56, 0.55);
  outline-offset: 2px;
}

.feed {
  display: grid;
  gap: 10px;
}

.feed-empty {
  margin: 0;
  color: var(--muted);
}

.message {
  border-left: 4px solid var(--primary);
  padding: 12px 14px;
  background: #f7faf8;
}

.message.local {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  margin: 0;
  border-radius: 8px;
  padding: 13px 15px;
  color: #fff;
  background: #17211f;
  box-shadow: 0 12px 34px rgba(23, 33, 31, 0.22);
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 640px);
    padding-top: 18px;
  }

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

  .status-grid,
  .workspace {
    grid-template-columns: 1fr;
  }
}
