:root {
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d9e2e8;
  --paper: #ffffff;
  --canvas: #f4f7f6;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #e2f4f0;
  --amber: #b45309;
  --amber-light: #fff4d7;
  --blue: #2563eb;
  --blue-light: #e8f0ff;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { max-width: 1440px; margin: 0 auto; padding: 28px 32px 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.topbar-actions, .heading-actions, .share-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.heading-actions { justify-content: flex-end; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(24px, 3vw, 36px); line-height: 1.18; }
h2 { margin-bottom: 0; font-size: 21px; line-height: 1.25; }
h3 { margin-bottom: 14px; font-size: 16px; }
.subtitle { margin-bottom: 0; color: var(--muted); }
.mode-badge, .status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 11px; background: var(--teal-light); color: var(--teal-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.segmented { display: inline-flex; min-height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.segment-button { min-width: 84px; border: 0; border-radius: 4px; padding: 6px 10px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.segment-button.active { color: #fff; background: var(--teal); }
.quick-mode .advanced-field { display: none !important; }
.layout { max-width: 1440px; margin: 0 auto; padding: 0 32px 48px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.form-panel, .side-panel, .result-panel { padding: 24px; }
.result-panel { grid-column: 1 / -1; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.notice { margin: -4px 0 22px; padding: 11px 13px; border-left: 3px solid var(--amber); background: var(--amber-light); color: #7c4a0c; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { padding-top: 4px; border-top: 0; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label, legend { color: #334155; font-size: 13px; font-weight: 700; }
label { display: flex; flex-direction: column; gap: 6px; }
.wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 5px; padding: 9px 10px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
textarea { resize: vertical; min-height: 68px; }
fieldset { margin: 0; padding: 0; border: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 7px; }
.check-row label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; font-weight: 500; color: #475569; }
.check-row input { width: auto; accent-color: var(--teal); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; }
.save-hint, .muted { color: var(--muted); font-size: 13px; }
.primary-button, .ghost-button { border-radius: 5px; padding: 9px 14px; font-weight: 700; }
.primary-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); }
.primary-button:hover { background: var(--teal-dark); }
.ghost-button { border: 1px solid var(--line); color: #475569; background: #fff; }
.ghost-button:hover { border-color: var(--teal); color: var(--teal); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.task-list { display: grid; gap: 10px; }
.task-item { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; text-align: left; }
.task-item:hover, .task-item.active { border-color: var(--teal); background: #f2fbf8; }
.task-name { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 700; }
.task-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.task-status { color: var(--teal); }
.result-content { display: grid; gap: 18px; }
.result-block { padding: 18px 0; border-top: 1px solid var(--line); }
.result-block:first-child { padding-top: 0; border-top: 0; }
.result-block h3 { margin-bottom: 9px; color: var(--teal-dark); }
.result-block p { margin-bottom: 7px; }
.result-block ul { margin: 0; padding-left: 20px; }
.structured-list { display: grid; gap: 7px; }
.structured-list > li > span { display: inline; }
.structured-list > li > .structured-data, .structured-list > li > .structured-list { margin-top: 6px; }
.structured-data { display: grid; gap: 10px; }
.structured-row { display: grid; grid-template-columns: minmax(104px, 22%) minmax(0, 1fr); gap: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.structured-row:last-child { padding-bottom: 0; border-bottom: 0; }
.structured-row > strong { color: #334155; }
.structured-row p, .structured-row ul { margin: 0; }
.package-placeholder { margin: 6px 0; padding: 14px 16px; border: 1px solid #f2cf85; border-radius: 6px; background: #fffaf0; color: #68440b; }
.package-placeholder h3 { color: #8a5208; }
.editable-package { min-height: 520px; width: 100%; white-space: pre-wrap; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 15px; line-height: 1.7; }
.shared-package-text { margin: 0; padding: 16px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; font: 15px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; }
.save-state { color: var(--muted); font-size: 13px; }
.prompt-box { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.error-text { color: #b91c1c; }
.form-error { margin: 0; color: #b42318; font-size: 13px; }
.auth-page { min-height: 100vh; min-height: 100dvh; background: #eef3f2; }
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-panel { width: min(100%, 420px); padding: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.auth-panel h1 { margin-bottom: 6px; font-size: 28px; }
.auth-subtitle { margin-bottom: 26px; color: var(--muted); }
.auth-form { display: grid; gap: 16px; }
.auth-submit { width: 100%; margin-top: 4px; }
.share-layout { width: min(960px, calc(100% - 40px)); margin: 0 auto 48px; }
.share-panel { padding: 24px; }
.share-actions { margin-bottom: 22px; }
.compact-topbar { align-items: center; }
.qr-dialog { width: min(92vw, 390px); border: 0; border-radius: 8px; padding: 24px; color: var(--ink); box-shadow: 0 18px 48px rgba(15, 23, 42, .22); }
.qr-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.dialog-close { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.qr-image { display: block; width: min(100%, 300px); aspect-ratio: 1; margin: 16px auto; border: 1px solid var(--line); }
.share-url { margin-bottom: 12px; }
.admin-layout { width: min(1040px, calc(100% - 40px)); margin: 0 auto 48px; display: grid; gap: 16px; }
.admin-panel { padding: 24px; }
.admin-form { display: grid; gap: 16px; }
.admin-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-list { display: grid; gap: 10px; }
.account-item { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.account-item.inactive { background: #f8fafc; opacity: .75; }
.account-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-summary strong { margin-right: 8px; }
.account-role, .account-state { color: var(--muted); font-size: 12px; }
.account-state { color: var(--teal-dark); font-weight: 700; }
.inactive .account-state { color: var(--muted); }
.account-meta { margin: 6px 0 12px; color: var(--muted); font-size: 12px; }
.account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-account-form { display: flex; flex: 1 1 360px; gap: 8px; }
.inline-account-form input { min-width: 0; }
.wechat-tools { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.wechat-hint { max-width: 220px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.auth-wechat-tools { position: fixed; z-index: 2; top: max(16px, env(safe-area-inset-top)); right: 16px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .result-panel { grid-column: auto; } }
@media (max-width: 620px) {
  body { font-size: 15px; }
  button, input, select, textarea { font-size: 16px; }
  .topbar { padding: 18px 16px 12px; flex-direction: column; gap: 14px; }
  .topbar-actions { width: 100%; }
  .mode-badge { margin-left: auto; }
  .layout { padding: 0 12px 112px; gap: 12px; }
  .form-panel, .side-panel, .result-panel { padding: 16px; }
  .panel-heading { flex-direction: column; margin-bottom: 18px; }
  .heading-actions { width: 100%; justify-content: space-between; }
  .segmented { flex: 1; }
  .segment-button { flex: 1; min-width: 0; }
  .form-grid.two { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .form-actions { position: sticky; z-index: 10; bottom: 0; align-items: stretch; flex-direction: column; margin: 0 -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.97); }
  .primary-button { width: 100%; }
  .share-layout { width: calc(100% - 24px); margin-bottom: 28px; }
  .share-actions { align-items: stretch; flex-direction: column; }
  .share-actions .button-link { width: 100%; }
  .admin-layout { width: calc(100% - 24px); margin-bottom: 28px; }
  .admin-panel { padding: 16px; }
  .admin-form-actions { align-items: stretch; flex-direction: column; }
  .admin-form-actions .primary-button, .admin-form-actions .ghost-button { width: 100%; }
  .inline-account-form { flex-basis: 100%; }
  .inline-account-form button, .account-status-button { flex: 1; }
  .structured-row { grid-template-columns: 1fr; gap: 4px; }
  .editable-package { min-height: 65vh; font-size: 16px; }
  .auth-shell { place-items: start center; padding: max(42px, env(safe-area-inset-top)) 16px 24px; }
  .auth-panel { padding: 24px 20px; }
}
