:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #d8dee8;
  --bg: #eef2f7;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.3;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.actions, .mini-actions, .publish-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

button, select {
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  padding: 0 13px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #94a3b8;
}

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

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.ghost {
  background: #f8fafc;
}

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

.pane, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.pane-title {
  min-height: 54px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

h2 {
  font-size: 16px;
}

textarea {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 520px;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 18px;
  line-height: 1.75;
  font-size: 15px;
  color: var(--ink);
}

.phone-shell {
  height: calc(100vh - 190px);
  min-height: 520px;
  overflow: auto;
  padding: 18px;
  background: #f8fafc;
}

.preview {
  width: min(100%, 677px);
  min-height: 100%;
  margin: 0 auto;
  padding: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.preview.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.insights {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  padding: 0 18px 24px;
}

.panel {
  padding: 16px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--accent);
}

.card ul {
  margin: 0;
  padding-left: 18px;
}

.card li, .card p {
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  margin: 4px 0;
}

.prompt {
  white-space: pre-wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

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

input {
  width: 100%;
  height: 38px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  outline: none;
  color: var(--ink);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.publish-row {
  margin-top: 14px;
}

#status {
  color: var(--muted);
  font-size: 14px;
}

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

@media (max-width: 980px) {
  .topbar, .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
  }

  .layout, .insights {
    grid-template-columns: 1fr;
  }

  textarea, .phone-shell {
    height: 460px;
    min-height: 460px;
  }

  .analysis-grid, .form-grid {
    grid-template-columns: 1fr;
  }
}
