:root {
  color-scheme: light;
  --ink: #20221f;
  --muted: #6f746e;
  --line: #e6e8e3;
  --soft: #f5f6f2;
  --paper: #fff;
  --accent: #e95151;
  --accent-soft: #fff1ef;
  --green: #2d8a61;
  --green-soft: #eef8f2;
  --amber: #9b6a20;
  --amber-soft: #fff8e8;
  --blue: #174b8a;
  --danger: #a23c35;
  --shadow: 0 20px 55px rgba(35, 39, 31, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #eceee9; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255,255,255,.9), transparent 28rem),
    #eceee9;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1500px, calc(100% - 40px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 30px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  padding: 26px 20px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(248,249,246,.9);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 14px; color: #fff; background: var(--ink); font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.main-nav { display: grid; gap: 5px; }
.nav-button {
  width: 100%; min-height: 44px; padding: 0 13px;
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 13px; color: #555a54; background: transparent;
  text-align: left; font-size: 14px;
}
.nav-button:hover { background: #fff; }
.nav-button.active { color: var(--ink); background: #fff; box-shadow: 0 7px 18px rgba(40,44,36,.06); font-weight: 700; }
.nav-button:disabled { cursor: not-allowed; opacity: .48; }
.nav-button:disabled:hover { background: transparent; }
.nav-index {
  width: 25px; height: 25px; display: grid; place-items: center;
  border-radius: 8px; color: #777c75; background: #eceee9; font-size: 11px; font-weight: 800;
}
.nav-button.active .nav-index { color: #fff; background: var(--accent); }
.nav-status { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: #d8dbd5; }
.nav-status.done { background: var(--green); }

.product-nav { margin-top: auto; padding-top: 18px; display: grid; gap: 5px; border-top: 1px solid var(--line); }
.product-nav a { min-height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 9px; border-radius: 11px; color: var(--muted); text-decoration: none; font-size: 12px; }
.product-nav a:hover, .product-nav a[aria-current="page"] { color: var(--ink); background: #fff; }
.product-nav a span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); font-size: 10px; font-weight: 800; }

.workspace { min-width: 0; padding: 28px 34px 44px; background: rgba(255,255,255,.84); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(25px, 3vw, 37px); letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.topbar-actions { display: flex; gap: 9px; }
.account-chip { max-width: 220px; padding: 0 12px; display: inline-flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: #fff; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.action-status { margin: 16px 0 -6px; color: var(--muted); font-size: 12px; }
.button {
  min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 13px;
  background: #fff; color: var(--ink); font-weight: 700; font-size: 13px;
}
.button:hover { transform: translateY(-1px); }
.button-dark { color: #fff; border-color: var(--ink); background: var(--ink); }
.button-accent { color: #fff; border-color: var(--accent); background: var(--accent); }
.button-ghost { background: transparent; }
.button-danger { color: var(--danger); border-color: #edc9c5; background: #fff6f5; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.button-row.end { justify-content: flex-end; }

.stepper { margin: 28px 0 22px; display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 8px; }
.step { height: 5px; border-radius: 99px; background: #e7e9e5; }
.step.done { background: #2f332e; }
.step.current { background: var(--accent); }

.view { min-height: 650px; }
.view-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(260px,.6fr); gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  box-shadow: 0 10px 28px rgba(45,49,42,.045);
}
.card-body { padding: 24px; }
.card-header { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.card-header h2, .card-header h3 { margin: 0; letter-spacing: -.025em; }
.card-header h2 { font-size: 21px; }
.card-header h3 { font-size: 16px; }
.card-header p, .section-intro { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.section-intro { margin-bottom: 18px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.metric { padding: 18px; border-radius: 17px; background: var(--soft); }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 11px; }
.metric strong { margin-top: 9px; font-size: 24px; }
.metric small { color: var(--muted); }

.empty-state { padding: 48px 24px; text-align: center; }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 19px; background: var(--accent-soft); font-size: 25px; }
.empty-state h2 { margin: 0; font-size: 22px; }
.empty-state p { max-width: 520px; margin: 10px auto 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 17px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { color: #41463f; font-size: 12px; font-weight: 800; }
.field label .required { color: var(--accent); }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select {
  width: 100%; border: 1px solid #dfe2dc; border-radius: 13px; outline: none; background: #fbfcfa; color: var(--ink);
}
.field input:not([type="checkbox"]):not([type="radio"]), .field select { height: 45px; padding: 0 13px; }
.field textarea { min-height: 112px; padding: 12px 13px; resize: vertical; line-height: 1.65; }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field textarea:focus, .field select:focus { border-color: #8e9689; background: #fff; box-shadow: 0 0 0 4px #f0f2ed; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-error { color: var(--danger)!important; }

.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.choice-card { position: relative; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice-card strong { display: block; font-size: 13px; }
.choice-card span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.account-picker { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.account-choice { min-height: 82px; padding: 14px; display: grid; align-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; text-align: left; }
.account-choice:hover, .account-choice.selected { border-color: #8e9689; box-shadow: 0 0 0 3px #f0f2ed; }
.account-choice strong, .account-choice span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-choice strong { font-size: 13px; }
.account-choice span { color: var(--muted); font-size: 11px; }
.account-choice-new { border-style: dashed; background: var(--soft); }

.notice { padding: 14px 16px; display: flex; gap: 11px; border-radius: 15px; font-size: 12px; line-height: 1.55; }
.notice strong { display: block; margin-bottom: 2px; }
.notice-info { color: #35586f; background: #eef6fa; }
.notice-warn { color: #795720; background: var(--amber-soft); }
.notice-danger { color: #873e37; background: #fff0ef; }
.notice-success { color: #276a4c; background: var(--green-soft); }

.topic-list { display: grid; gap: 13px; }
.topic-card { padding: 20px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 14px; align-items: start; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.topic-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic-card.blocked { border-color: #edc9c5; background: #fffafa; }
.topic-card.blocked .topic-number { color: var(--danger); background: #fff0ef; }
.topic-blocked-message { margin-top: 12px; }
.topic-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); font-size: 12px; font-weight: 800; }
.topic-card h3 { margin: 0; font-size: 16px; }
.topic-card p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.tag-row { margin-top: 11px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 8px; color: #5f665d; background: var(--soft); font-size: 10px; font-weight: 700; }
.tag.warn { color: var(--amber); background: var(--amber-soft); }
.tag.good { color: var(--green); background: var(--green-soft); }

.material-list { display: grid; gap: 11px; }
.material-row { padding: 15px; display: grid; grid-template-columns: minmax(0,1fr) 130px auto; gap: 10px; border: 1px solid var(--line); border-radius: 14px; }
.material-row input, .material-row select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.material-row-expanded { grid-template-columns: minmax(180px,1.4fr) 130px 130px; align-items: start; }
.material-row-expanded textarea { min-height: 78px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.material-row-expanded .material-check { min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.material-row-expanded .material-check input { width: 18px; height: 18px; padding: 0; }
.material-row-expanded .material-upload { min-height: 64px; display: grid; gap: 6px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; background: var(--soft); }
.material-row-expanded .material-upload input { height: auto; padding: 0; border: 0; background: transparent; }
.version-list { display: grid; gap: 10px; margin-top: 12px; }
.version-row { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.version-row p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.saved-task-list { display: grid; gap: 10px; }
.saved-task-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.saved-task-row h3 { margin: 9px 0 0; font-size: 14px; }
.saved-task-row p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.saved-task-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.saved-task-delete-confirm { grid-column: 1 / -1; }
.saved-task-delete-confirm .button-row { margin-top: 10px; }
.empty-state.compact { padding: 18px; }

.editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 290px; gap: 18px; }
.editor { min-height: 520px; }
.editor textarea { min-height: 360px; }
.editor-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.title-option { padding: 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; }
.title-option + .title-option { margin-top: 8px; }
.title-option input[type="radio"] { flex: 0 0 18px; width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
.title-option input[type="text"] { flex: 1; min-width: 0; width: auto; height: 36px; padding: 0 4px; border: 0; outline: none; background: transparent; }

.check-list { display: grid; gap: 10px; }
.check-row { padding: 14px; display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--line); border-radius: 13px; }
.check-row input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; padding: 0; margin-top: 1px; accent-color: var(--green); }
.check-row strong, .check-row span { display: block; }
.check-row strong { font-size: 12px; }
.check-row span { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }

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

.risk-item {
  padding: 15px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}

.risk-item > span {
  flex: 0 0 24px;
  font-size: 18px;
  line-height: 1.25;
}

.risk-item strong {
  display: block;
  font-size: 13px;
  line-height: 1.5;
}

.risk-item p {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.risk-item.warn {
  border-color: #efc5c1;
  background: #fff4f2;
}

.risk-item.warn strong {
  color: var(--danger);
}

.risk-item.warn p {
  color: #744740;
}

.risk-item.pass {
  border-color: #cbe4d5;
  background: var(--green-soft);
}

.risk-item.pass strong {
  color: var(--green);
}

.risk-item.pass p {
  color: #4d6b5c;
}

.package-section { padding: 18px 0; border-top: 1px solid var(--line); }
.package-section:first-child { padding-top: 0; border-top: 0; }
.package-section h3 { margin: 0 0 9px; font-size: 13px; }
.package-content { white-space: pre-wrap; color: #40453f; font-size: 13px; line-height: 1.75; }

.skeleton { overflow: hidden; position: relative; min-height: 16px; border-radius: 8px; background: #eef0ec; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.loading-copy { margin: 0; color: var(--muted); font-size: 13px; }
.loading-progress { width: 100%; height: 8px; overflow: hidden; border-radius: 999px; background: #e7eae5; }
.loading-progress-bar { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ef5350, #ff8a78); animation: loading-progress 1.35s cubic-bezier(.4,0,.2,1) infinite; }
@keyframes loading-progress {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(110%); }
  100% { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; transform: none; opacity: .45; }
  .loading-progress-bar { width: 58%; animation: none; transform: none; }
}

.toast { position: fixed; z-index: 30; left: 50%; bottom: 28px; transform: translate(-50%, 30px); padding: 11px 15px; border-radius: 12px; color: #fff; background: #282c27; opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.preview-dialog { width: min(1060px, calc(100vw - 36px)); max-height: calc(100vh - 36px); padding: 0; overflow: hidden; border: 0; border-radius: 25px; box-shadow: 0 30px 100px rgba(22,24,20,.32); }
.preview-dialog::backdrop { background: rgba(28,30,27,.67); backdrop-filter: blur(7px); }
.preview-toolbar { padding: 17px 20px; display: flex; justify-content: space-between; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); background: #fff; }
.preview-toolbar strong, .preview-toolbar span { display: block; }
.preview-toolbar span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.preview-toolbar-actions { display: flex; align-items: center; gap: 5px; }
.segmented, .icon-button { border: 0; background: var(--soft); }
.segmented { padding: 7px 10px; border-radius: 9px; color: var(--muted); font-size: 10px; }
.segmented.active { color: #fff; background: var(--ink); }
.icon-button { width: 34px; height: 34px; margin-left: 7px; border-radius: 50%; font-size: 21px; }
.preview-stage { padding: 25px; display: grid; grid-template-columns: minmax(320px,420px) minmax(250px,1fr); justify-content: center; gap: 28px; overflow: auto; max-height: calc(100vh - 110px); background: #eceee9; }
.phone-preview { width: 390px; min-height: 760px; margin: 0 auto; overflow: hidden; border: 10px solid #1d1f1c; border-radius: 35px; background: #fff; box-shadow: 0 22px 45px rgba(30,34,27,.2); }
.phone-preview.ios { border-radius: 45px; }
.phone-status { height: 34px; padding: 9px 18px 0; display: flex; justify-content: space-between; font-size: 10px; font-weight: 800; }
.phone-head { height: 50px; padding: 0 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f0f1ee; }
.phone-user { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.phone-avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--accent); font-size: 11px; }
.phone-media { aspect-ratio: 1 / 1; display: grid; place-items: center; color: #777c75; background: linear-gradient(135deg,#f1eee6,#dfe8e6); font-size: 12px; }
.phone-body { padding: 18px 17px 100px; }
.phone-body h2 { margin: 0 0 10px; font-size: 17px; line-height: 1.45; }
.phone-copy { color: #30342f; font-size: 14px; line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.topic-blue { color: #174b8a; }
.xhs-emoji { display: inline-grid; place-items: center; min-width: 1.15em; vertical-align: -.08em; }
.phone-meta { margin-top: 13px; color: #9a9e98; font-size: 10px; }
.phone-actions { position: sticky; bottom: 0; height: 58px; padding: 0 17px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); font-size: 18px; }
.preview-notes { display: grid; align-content: start; gap: 12px; }
.preview-note { padding: 16px; border-radius: 15px; background: #fff; }
.preview-note strong { display: block; font-size: 12px; }
.preview-note p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.count-line { display: flex; justify-content: space-between; gap: 10px; }
.count-line + .count-line { margin-top: 8px; }
.count-line span { color: var(--muted); font-size: 11px; }
.count-line strong { font-size: 12px; }
.count-line .over { color: var(--danger); }

@media (max-width: 980px) {
  .app-shell { width: calc(100% - 20px); margin: 10px auto; grid-template-columns: 88px minmax(0,1fr); border-radius: 22px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > div:last-child, .nav-button > span:not(.nav-index):not(.nav-status), .product-nav { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .nav-status { display: none; }
  .workspace { padding-inline: 22px; }
  .view-grid, .editor-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .app-shell { width: 100%; min-height: 100vh; margin: 0; display: block; border: 0; border-radius: 0; }
  .sidebar { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: 66px; padding: 7px 8px; border: 0; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
  .brand, .product-nav { display: none; }
  .main-nav { height: 100%; display: flex; overflow-x: auto; gap: 3px; }
  .main-nav { scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .nav-button { min-width: 56px; height: 50px; display: grid; place-items: center; align-content: center; gap: 2px; }
  .nav-button > span:not(.nav-index):not(.nav-status) { display: block; max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
  .nav-index { width: 22px; height: 22px; font-size: 9px; }
  .workspace { padding: 20px 15px 88px; }
  .topbar { align-items: flex-start; }
  .topbar-actions { display: grid; }
  .account-chip { max-width: 150px; min-height: 36px; }
  .button { min-height: 39px; padding-inline: 12px; }
  .stepper { margin-top: 20px; }
  .field-grid, .field-grid.three, .choice-grid, .metric-grid, .account-picker { grid-template-columns: 1fr; }
  .material-row { grid-template-columns: 1fr; }
  .saved-task-row { grid-template-columns: 1fr; }
  .saved-task-actions { justify-content: flex-start; }
  .topic-card { grid-template-columns: 30px minmax(0,1fr); }
  .topic-card > button { grid-column: 2; justify-self: start; }
  .card-body, .card-header { padding-left: 18px; padding-right: 18px; }
  .preview-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
  .preview-toolbar { align-items: flex-start; }
  .preview-toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .preview-stage { grid-template-columns: 1fr; padding: 10px; max-height: calc(100vh - 92px); }
  .phone-preview { width: min(390px, calc(100vw - 20px)); }
}
