:root {
  color-scheme: light;
  --bg: #f3f1eb;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #fffdf7;
  --ink: #171612;
  --muted: #746f66;
  --line: rgba(61, 54, 43, 0.14);
  --green: #4f9c5a;
  --green-soft: #e2f3df;
  --gold: #b39a5f;
  --danger: #9a3a32;
  --shadow: 0 20px 60px rgba(50, 45, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(79, 156, 90, 0.12), transparent 30%),
    linear-gradient(135deg, #f8f7f2, var(--bg));
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.login-panel {
  width: min(520px, calc(100vw - 40px));
  margin: 8vh auto 0;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, #fffaf0, #e7dcc3);
  color: #6f5f32;
  font-size: 34px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 16px 32px rgba(179, 154, 95, 0.18);
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  font-size: 24px;
}

.eyebrow {
  margin: 24px 0 8px;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 5vw, 46px);
}

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

h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.muted,
.hint,
.panel-title span,
.brand-row span {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 18px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select,
.filter-row input,
.filter-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  outline: none;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.field textarea {
  resize: vertical;
  line-height: 1.7;
}

.primary,
.secondary,
.ghost {
  min-height: 46px;
  border-radius: 15px;
  padding: 0 18px;
  font-weight: 800;
}

.primary {
  background: #15130f;
  color: #fffef8;
}

.secondary {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.ghost.danger {
  color: var(--danger);
}

.wide {
  width: 100%;
  margin-top: 22px;
}

.console {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar,
.workspace,
.panel,
.editor-form,
.preview-panel,
.post-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar {
  position: sticky;
  top: 28px;
  height: calc(100vh - 56px);
  border-radius: 28px;
  padding: 20px;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.nav {
  width: 100%;
  margin-bottom: 10px;
  min-height: 48px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 16px;
  font-weight: 800;
}

.nav.active {
  background: var(--green-soft);
  color: #2d7439;
}

.workspace {
  min-height: calc(100vh - 56px);
  border-radius: 30px;
  padding: 24px;
}

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

.topbar .eyebrow {
  margin-top: 0;
}

.topbar-actions,
.action-row,
.upload-row,
.filter-row,
.split-fields {
  display: flex;
  gap: 12px;
  align-items: center;
}

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

.metric {
  min-height: 126px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
}

.panel {
  margin-top: 14px;
  padding: 22px;
  border-radius: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.75fr);
  gap: 14px;
}

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

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
}

.segment {
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.segment.active {
  background: var(--green-soft);
  color: #2d7439;
}

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

.bar-row {
  display: grid;
  grid-template-columns: 96px 1fr 56px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(79, 156, 90, 0.12);
}

.bar-track.ai {
  background: rgba(179, 154, 95, 0.16);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.bar-track.ai .bar-fill {
  background: linear-gradient(90deg, #15130f, var(--gold));
}

.filter-row {
  margin-bottom: 16px;
}

.filter-row input {
  flex: 1;
}

.quick-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.quick-filter {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-weight: 800;
}

.quick-filter.active {
  background: var(--green-soft);
  color: #2d7439;
  border-color: rgba(79, 156, 90, 0.2);
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border-radius: 22px;
  padding: 18px;
}

.post-card p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #2d7439;
  font-weight: 800;
}

.status.draft {
  background: #f1ead8;
  color: #806a2d;
}

.status.archived {
  background: #eee;
  color: #777;
}

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

.editor-form,
.preview-panel {
  border-radius: 24px;
  padding: 22px;
}

.split-fields .field {
  flex: 1;
  margin-top: 0;
}

.split-fields .compact {
  max-width: 220px;
}

.check-field {
  display: flex;
  align-items: center;
  padding-top: 28px;
}

.check-field input {
  width: 20px;
  height: 20px;
}

.upload-row {
  justify-content: space-between;
  margin-top: 14px;
}

.upload-row input {
  flex: 1;
}

.action-row {
  margin-top: 18px;
  flex-wrap: wrap;
}

.preview-panel {
  align-self: start;
  position: sticky;
  top: 28px;
}

.phone-preview {
  min-height: 620px;
  padding: 24px;
  border-radius: 34px;
  background: linear-gradient(180deg, #fffdf8, #f3f0e8);
  border: 10px solid #171612;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.preview-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--green-soft);
  color: #2d7439;
  font-weight: 800;
}

.phone-preview h3 {
  margin-top: 18px;
  font-size: 30px;
}

.preview-body {
  margin-top: 20px;
  white-space: pre-wrap;
  color: #3c3932;
  line-height: 1.8;
}

.post-rank {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.health-grid,
.editor-checklist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.health-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.health-item span,
.health-item small {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.health-item strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
}

.editor-checklist {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.editor-checklist span {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(154, 58, 50, 0.18);
  border-radius: 14px;
  background: rgba(154, 58, 50, 0.05);
  color: var(--danger);
  font-weight: 800;
}

.editor-checklist span.ok {
  border-color: rgba(79, 156, 90, 0.2);
  background: rgba(226, 243, 223, 0.58);
  color: #2d7439;
}

.audit-list {
  display: grid;
  gap: 12px;
}

.online-list {
  display: grid;
  gap: 10px;
}

.online-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.online-row span {
  font-weight: 900;
}

.online-row small {
  color: var(--muted);
}

.audit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.audit-row strong,
.audit-row small {
  display: block;
}

.audit-row small {
  margin-top: 5px;
  color: var(--muted);
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 18, 14, 0.42);
  backdrop-filter: blur(14px);
}

.confirm-dialog {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.confirm-dialog .eyebrow {
  margin-top: 0;
}

.confirm-preview {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(79, 156, 90, 0.18);
  border-radius: 18px;
  background: rgba(226, 243, 223, 0.48);
}

.confirm-preview span {
  color: var(--muted);
  line-height: 1.6;
}

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

  .console,
  .editor-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar,
  .panel-title,
  .post-card,
  .split-fields,
  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .health-grid,
  .editor-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-fields .compact {
    max-width: none;
  }

  .editor-grid {
    display: block;
  }

  .preview-panel {
    position: static;
    margin-top: 16px;
  }
}

@media (max-width: 560px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .health-grid,
  .editor-checklist {
    grid-template-columns: 1fr;
  }

  .workspace,
  .login-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .topbar-actions,
  .action-row,
  .upload-row {
    align-items: stretch;
    flex-direction: column;
  }
}
