:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --ink: #18211d;
  --muted: #67716b;
  --line: #dde5df;
  --brand: #08715f;
  --brand-dark: #06483d;
  --warm: #d99a32;
  --warm-soft: #fff4df;
  --soft: #e7f2ee;
  --danger: #a94442;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #e6f1ec 0%, var(--bg) 42%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: 86px;
  box-shadow: 0 0 42px rgba(27, 51, 41, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 18px 12px;
}

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

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

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
}

.plain-icon {
  width: 56px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--brand-dark);
  color: #fff;
  font-weight: 800;
}

main {
  padding: 0 14px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.search {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search span,
.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.field textarea {
  min-height: 92px;
  resize: vertical;
}

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

.quick-grid button,
.industry-grid button,
.tabs button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.quick-grid button:first-child {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 10px 20px rgba(8, 113, 95, 0.16);
}

.business-grid {
  display: grid;
  gap: 10px;
}

.business-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 74px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 14px;
}

.business-card:first-child {
  border-color: rgba(13, 124, 102, 0.35);
  background: #f4fffb;
}

.business-card strong {
  font-size: 17px;
}

.business-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.content-section {
  margin-top: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.text-btn,
.back-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 800;
  padding: 8px 0;
}

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

.template-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.template-card:hover,
.business-card:hover,
.industry-grid button:hover {
  border-color: rgba(8, 113, 95, 0.38);
  box-shadow: 0 10px 24px rgba(27, 51, 41, 0.08);
  transform: translateY(-1px);
}

.template-card h3 {
  margin-bottom: 7px;
}

.template-card p {
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.industry-pack-card {
  border: 1px solid rgba(13, 124, 102, 0.28);
  border-radius: 8px;
  background: #f5fffb;
  padding: 14px;
}

.industry-pack-card h3 {
  margin: 0 0 7px;
  font-size: 18px;
}

.industry-pack-card p,
.industry-pack-card dd {
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.industry-pack-card dl {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.industry-pack-card div {
  display: grid;
  gap: 3px;
}

.industry-pack-card dt {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.industry-pack-card dd {
  margin: 0;
}

.industry-pack-card strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
}

.industry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.industry-grid button {
  min-height: 52px;
  padding: 0 12px;
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.industry-grid strong {
  font-size: 16px;
}

.page-head {
  padding: 10px 2px 14px;
}

.page-head p {
  color: var(--muted);
  margin-top: 6px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.tabs button {
  flex: 0 0 auto;
  padding: 0 14px;
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.builder-head {
  padding: 12px 0 14px;
}

.builder-head p {
  color: var(--brand);
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}

.builder-head span {
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.form-panel {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.primary-btn,
.secondary-btn {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 10px 20px rgba(8, 113, 95, 0.18);
}

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

.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.result-hint {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#promptResult {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  line-height: 1.55;
  background: #fbfcfb;
}

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

.plans article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.plans strong {
  display: block;
  margin: 9px 0;
  font-size: 22px;
}

.plans p,
.update-list {
  color: var(--muted);
  line-height: 1.5;
}

.tips-list {
  display: grid;
  gap: 16px;
}

.tips-group {
  display: grid;
  gap: 10px;
}

.tips-group h3 {
  font-size: 17px;
}

.tips-grid {
  display: grid;
  gap: 10px;
}

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

.tip-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.tip-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}

.tip-prompt {
  border-left: 3px solid var(--brand);
  background: #f5fffb;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 10px;
  border-radius: 0 8px 8px 0;
}

.plans .featured-plan strong {
  color: #8a5a12;
}

.bottom-nav button.active {
  background: var(--soft);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px rgba(8, 113, 95, 0.08);
}

.featured-plan {
  border-color: rgba(217, 154, 50, 0.5) !important;
  background: var(--warm-soft) !important;
}

.update-list {
  margin: 0;
  padding: 12px 14px 12px 32px;
  border: 1px solid rgba(217, 154, 50, 0.35);
  border-radius: 8px;
  background: var(--warm-soft);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  height: 68px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.bottom-nav button {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.bottom-nav button.active {
  background: var(--soft);
  color: var(--brand-dark);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 33, 29, 0.42);
}

.modal-mask[hidden] {
  display: none;
}

.register-dialog {
  width: min(460px, 100%);
  background: #ffffff;
  border: 1px solid #dde5df;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(24, 33, 29, 0.24);
}

.register-dialog h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.register-dialog p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.register-dialog label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.register-dialog input {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 16px;
  font-size: 18px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.empty-state {
  padding: 22px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 18px;
    overflow: hidden;
  }
}

@media (min-width: 920px) {
  body {
    padding: 0;
    overflow: hidden;
    background: var(--bg);
  }

  .app-shell {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-rows: 82px minmax(0, 1fr);
    padding-bottom: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
  }

  .topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 18px 34px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
  }

  .topbar h1 {
    font-size: 30px;
  }

  .plain-icon {
    width: auto;
    min-width: 96px;
    height: 44px;
    padding: 0 22px;
    border-radius: 10px;
  }

  .bottom-nav {
    position: static;
    grid-column: 1;
    grid-row: 2;
    transform: none;
    width: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 24px 18px;
    border-top: 0;
    border-right: 1px solid var(--line);
    background: #ffffff;
  }

  .bottom-nav::before {
    content: "工作台";
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin: 0 10px 8px;
  }

  .bottom-nav button {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    padding: 0 16px;
    text-align: left;
    color: var(--ink);
  }

  .bottom-nav button.active {
    color: #ffffff;
    background: var(--brand-dark);
  }

  main {
    grid-column: 2;
    grid-row: 2;
    height: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 28px 34px 44px;
  }

  .view.active {
    max-width: 1320px;
    margin: 0 auto;
  }

  .search {
    max-width: 760px;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    padding: 18px 20px;
  }

  .content-section {
    margin-top: 28px;
  }

  .section-title {
    margin-bottom: 16px;
  }

  .section-title h2,
  .page-head h2 {
    font-size: 26px;
  }

  .business-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .business-card {
    min-height: 132px;
    padding: 22px;
  }

  .business-card strong {
    font-size: 22px;
  }

  .business-card span {
    font-size: 15px;
  }

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

  .quick-grid button {
    min-height: 58px;
    font-size: 16px;
  }

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

  .industry-grid button {
    min-height: 66px;
  }

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

  .tabs {
    display: flex;
    gap: 12px;
    margin: 18px 0 22px;
    overflow: visible;
  }

  .tabs button {
    min-width: 132px;
    padding: 0 22px;
  }

  .template-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .template-card {
    min-height: 154px;
    padding: 20px;
  }

  .template-card h3 {
    font-size: 20px;
  }

  .template-card p {
    font-size: 15px;
  }

  #builderView.active {
    max-width: 1440px;
    display: grid;
    grid-template-columns: minmax(520px, 0.95fr) minmax(440px, 1.05fr);
    grid-template-rows: auto auto auto;
    gap: 18px 24px;
    align-items: start;
  }

  #builderView .back-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .builder-head {
    grid-column: 1;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
  }

  .builder-head h2 {
    font-size: 28px;
    margin: 8px 0;
  }

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

  .field:has(textarea) {
    grid-column: 1 / -1;
  }

  .action-row {
    grid-column: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0;
  }

  .primary-btn,
  .secondary-btn {
    min-height: 52px;
  }

  .result-panel {
    grid-column: 2;
    grid-row: 2 / span 3;
    position: sticky;
    top: 0;
    min-height: calc(100vh - 138px);
    display: flex;
    flex-direction: column;
  }

  .result-panel[hidden] {
    display: flex;
    visibility: hidden;
  }

  .result-panel textarea {
    flex: 1;
    min-height: 520px;
    font-size: 15px;
  }

  .plans {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .tips-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .toast {
    left: auto;
    right: 28px;
    bottom: 28px;
    transform: none;
  }
}
