:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d8dee9;
  --brand: #1f7a68;
  --brand-dark: #145c4d;
  --warm: #f6c85f;
  --blue: #d8ecff;
  --pink: #ffe0e3;
  --green: #dcf8df;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.1;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.nav-tab,
.ghost-btn,
.primary-btn,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 13px;
}

.nav-tab.active,
.primary-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.ghost-btn:hover,
.nav-tab:hover,
.icon-btn:hover {
  border-color: #aab4c4;
  background: #f8fafc;
}

.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.article-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.article-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.article-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7f9fc;
  padding: 12px;
  text-align: left;
}

.article-item.active {
  border-color: var(--brand);
  background: #edf8f4;
}

.article-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.workspace {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 22px 28px;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.top-actions,
.button-row,
.import-row,
.new-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.view {
  display: none;
  min-height: 0;
  flex: 1;
  padding: 24px 28px;
}

.view.active {
  display: block;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.98fr) minmax(330px, 1.02fr);
  gap: 20px;
  height: calc(100vh - 126px);
}

.editor-panel,
.preview-panel,
.platform-column,
.settings-panel,
.export-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.editor-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 104, 0.14);
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.65;
}

#bodyInput {
  min-height: 330px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
}

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

.import-row input {
  flex: 1;
  min-width: 0;
}

.field-hint {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.field-hint.active {
  color: var(--brand);
  font-weight: 700;
}

.preview-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.preview-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  color: var(--muted);
  font-weight: 700;
}

.rendered {
  overflow: auto;
  padding: 24px 28px;
  line-height: 1.86;
}

.rendered h1,
.rendered h2,
.rendered h3 {
  line-height: 1.25;
}

.rendered img {
  max-width: 100%;
  border-radius: 8px;
}

.rendered blockquote {
  margin: 18px 0;
  border-left: 4px solid var(--brand);
  background: #f2f7f5;
  padding: 10px 16px;
  color: #344054;
}

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

.platform-column {
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr);
  min-height: 390px;
  overflow: hidden;
}

.platform-column header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  font-weight: 800;
}

.platform-column input,
.platform-column textarea {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.platform-column input {
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.platform-column textarea {
  min-height: 100%;
}

.settings-layout,
.export-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
}

.settings-panel,
.export-panel {
  padding: 20px;
}

.settings-panel h3,
.export-panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
}

.settings-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.check-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.check-row span {
  flex: 1;
}

.new-account-row input {
  min-width: 0;
}

.export-panel ol {
  margin: 0 0 20px;
  padding-left: 22px;
  color: #344054;
  line-height: 1.8;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .article-list {
    max-height: 180px;
  }

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

  .editor-layout,
  .platform-grid,
  .settings-layout,
  .export-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
}

@media (max-width: 620px) {
  .view,
  .topbar {
    padding-inline: 16px;
  }

  .top-actions,
  .button-row,
  .import-row,
  .new-account-row {
    align-items: stretch;
    flex-direction: column;
  }

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