:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --text: #1b1f1d;
  --muted: #68726c;
  --line: #dce2dc;
  --accent: #13795b;
  --accent-2: #0f5f49;
  --warning: #9a5b00;
  --shadow: 0 18px 50px rgba(24, 36, 30, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 24px;
}

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

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

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p,
.status,
.metric small,
.metric span,
.panel-head span,
.eyebrow {
  color: var(--muted);
}

.brand p,
.status,
.metric small,
.panel-head span,
.eyebrow {
  font-size: 13px;
}

.connect {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.connect label {
  font-size: 13px;
  font-weight: 700;
}

.key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 121, 91, 0.12);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.primary-button,
.secondary-button,
.icon-button,
.nav-item,
.restore-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  background: white;
  color: var(--text);
  font-weight: 700;
}

.restore-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.restore-button input {
  display: none;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-2);
}

.secondary-button:hover,
.icon-button:hover,
.nav-item:hover {
  border-color: #b7c2bb;
  background: var(--surface-2);
}

.nav {
  display: grid;
  gap: 8px;
}

.disclaimer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.nav-item {
  text-align: left;
}

.nav-item.active {
  border-color: rgba(19, 121, 91, 0.22);
  background: rgba(19, 121, 91, 0.1);
  color: var(--accent-2);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

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

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

.pro-badge {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid rgba(19, 121, 91, 0.28);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(19, 121, 91, 0.1);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.book-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.metric span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.15fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel h3 {
  font-size: 17px;
}

.list,
.note-list,
.review-list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.list-item strong,
.book-card strong,
.note-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.list-item span,
.book-card span,
.note-card span {
  color: var(--muted);
  font-size: 13px;
}

.brief {
  min-height: 180px;
  color: #33433b;
  line-height: 1.6;
}

.onboarding-list {
  display: grid;
  gap: 8px;
}

.onboarding-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.onboarding-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.onboarding-item.done .onboarding-check {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.onboarding-item strong {
  display: block;
  font-size: 13px;
}

.onboarding-item span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar input {
  max-width: 420px;
}

.toolbar select {
  max-width: 170px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.book-card,
.note-card {
  padding: 14px;
}

.book-card {
  display: grid;
  gap: 8px;
  min-height: 148px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.note-card {
  display: grid;
  gap: 8px;
}

.search-results {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

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

.search-hit strong {
  display: block;
  margin-bottom: 6px;
}

.search-hit mark {
  border-radius: 4px;
  padding: 0 2px;
  background: rgba(255, 214, 102, 0.65);
}

.review-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.review-card q {
  color: #293830;
  line-height: 1.55;
}

.review-card footer {
  color: var(--muted);
  font-size: 13px;
}

.email-panel {
  margin-bottom: 14px;
}

#emailDraft {
  min-height: 260px;
}

.note-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.note-actions .secondary-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.highlight-preview {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.highlight-preview blockquote {
  margin: 0;
  border-left: 3px solid var(--accent);
  padding: 9px 10px;
  background: #f7faf7;
  color: #293830;
  line-height: 1.45;
}

.highlight-preview blockquote span {
  display: block;
  margin-top: 7px;
}

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

.summary-box {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  border: 1px solid rgba(19, 121, 91, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: rgba(19, 121, 91, 0.06);
}

.summary-box .panel-head {
  margin-bottom: 0;
}

.summary-box p,
.summary-box ul {
  margin: 0;
}

.summary-box ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.summary-box li,
.summary-box p {
  color: #293830;
  line-height: 1.5;
}

.export-panel {
  height: calc(100vh - 132px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

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

.pro-hero {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  align-content: start;
  background: #f9fbf8;
}

.pro-hero h3 {
  max-width: 780px;
  font-size: 32px;
  line-height: 1.15;
}

.pro-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-row strong {
  font-size: 36px;
}

.price-row span {
  color: var(--muted);
}

.payment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-row span {
  border: 1px solid rgba(19, 121, 91, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(19, 121, 91, 0.08);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
}

.checkout-row {
  display: grid;
  grid-template-columns: 140px 130px minmax(150px, max-content);
  gap: 8px;
  align-items: center;
}

.pro-status {
  margin: 0;
  color: var(--muted);
}

.qr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qr-card {
  display: grid;
  gap: 7px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
  text-align: center;
}

.active-order {
  justify-items: start;
  text-align: left;
}

.qr-card span,
.payment-note {
  color: var(--muted);
  font-size: 13px;
}

.qr-placeholder {
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 50%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.2) 50%, transparent 50%),
    var(--accent);
  background-size: 16px 16px;
}

.active-order .qr-placeholder {
  justify-self: center;
}

.qr-wechat {
  background-color: #1aad19;
}

.qr-alipay {
  background-color: #1677ff;
}

.payment-note {
  margin: 12px 0 0;
  line-height: 1.5;
}

.activation-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.activation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
}

.pro-active .pro-card,
.pro-active .pro-hero {
  border-color: rgba(19, 121, 91, 0.4);
  background: rgba(19, 121, 91, 0.08);
}

.pro-active #showPaymentQr {
  opacity: 0.72;
}

.feature-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  position: relative;
  padding-left: 18px;
  color: #33433b;
  line-height: 1.45;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.pro-card {
  border-color: rgba(19, 121, 91, 0.28);
  background: rgba(19, 121, 91, 0.06);
}

textarea {
  min-height: 420px;
  resize: none;
  padding: 14px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

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

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

  .metric-grid,
  .split,
  .pro-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .actions,
  .toolbar,
  .note-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .split,
  .pro-layout {
    grid-template-columns: 1fr;
  }

  .qr-grid,
  .activation-row,
  .checkout-row {
    grid-template-columns: 1fr;
  }
}
