:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #6b7280;
  --border: #d9dee7;
  --border-strong: #c5ccd8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --shadow: 0 16px 42px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial,
    sans-serif;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  min-height: 100vh;
  padding: 20px;
}

.topbar,
.commandbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar,
.commandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  padding: 16px 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.topbar-actions,
.commandbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 16px;
  min-height: 0;
}

.metadata-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
}

.panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
}

.metadata-panel {
  grid-template-rows: auto auto;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 13px 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  letter-spacing: 0;
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

textarea {
  width: 100%;
  min-height: 520px;
  border: 0;
  outline: 0;
  resize: none;
  padding: 18px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.8;
}

.metadata-field {
  min-height: 72px;
  resize: vertical;
  padding: 14px;
  font-size: 15px;
  line-height: 1.7;
}

.title-field {
  min-height: 58px;
  font-weight: 700;
}

.summary-field {
  min-height: 92px;
}

textarea::placeholder {
  color: #9aa3b2;
}

.wechat-frame {
  min-height: 520px;
  overflow: auto;
  padding: 26px 0 34px;
  background: #fff;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 300px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 16px;
}

.empty-state span {
  max-width: 260px;
  font-size: 14px;
  line-height: 1.6;
}

.status {
  min-width: 180px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
}

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

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

.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border-strong);
}

.secondary:hover {
  background: #f8fafc;
}

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

  .topbar,
  .commandbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .commandbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button,
  .commandbar-actions button {
    flex: 1;
  }

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

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  textarea,
  .wechat-frame {
    min-height: 420px;
  }
}
