:root {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #28231b;
  background: #faf6ed;
}

body { background: #faf6ed; }
.topbar { background: #fffdf8; border-color: #eadfc9; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar-actions .text-button { font-size: 14px; }
.brandmark { color: #28231b; }
.brandmark span { background: #fff0c5; color: #72500b; }
.eyebrow { color: #926400; }
.muted { color: #716b61; }
.panel { background: #fffdf9; border-color: #e8ddc6; border-radius: 20px; box-shadow: 0 10px 28px #6e4c0b0d; }
.button { border-radius: 14px; background: #f8bf31; color: #28231b; }
.button:hover { background: #e9ad1b; }
.button.secondary { background: #f2ead9; color: #40392d; }
.button.active { background: #fff0c5; color: #4b3510; box-shadow: inset 0 0 0 1px #d59b16; }
.button.outline { background: #fffdf9; color: #6d581e; border-color: #ddc78d; }
.field input, .search, input.answer, textarea { border-radius: 13px; }
.field input:focus, .search:focus, textarea:focus { outline-color: #f2cb68; border-color: #d59b16; }
.archive-item, .question { background: #fffdf9; border-color: #eadfc9; border-radius: 16px; }
.priority-box { color: #61491a; background: #fff7e5; border-color: #ecd5a3; }
.q-star { color: #d9940c; }
.pending { color: #9b5a0d !important; }
input[type="radio"], input[type="checkbox"] { accent-color: #f8bf31; }
.archive-item.imported-unopened { background: #f7f0e2; border-color: #ddc78d; }
.imported-badge { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: #f8bf31; color: #28231b; font-size: 11px; font-weight: 700; vertical-align: 2px; }
.empty a, .empty a:visited { color: #926400; }

.home-start { margin-top: 34px; align-items: center; }
.home-start .primary-action { min-width: 196px; padding: 15px 24px; font-size: 18px; letter-spacing: .01em; }
.home-start .home-import { padding: 14px 18px; font-size: 15px; }
.home-head .eyebrow { margin: 0 0 7px; font-size: 12px; }
.archive-head { margin-bottom: 22px; }
.archive-toolbar, .archive-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.archive-toolbar { align-items: center; margin-bottom: 14px; }
.archive-title-row h1 { margin: 5px 0 8px; font-size: clamp(28px, 5vw, 40px); }
.archive-title-row .eyebrow { margin-bottom: 0; }
.archive-primary-action { justify-content: flex-end; padding-top: 26px; }
.archive-export-actions { justify-content: flex-end; }
.section-head, .list-tools, .record-actions { display: flex; align-items: center; gap: 10px; }
.section-head { justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { margin-bottom: 0; }
.visibility-toggle, .list-tools .text-button { color: #716b61; font-size: 13px; cursor: pointer; white-space: nowrap; }
.visibility-toggle input { accent-color: #d99e15; vertical-align: -2px; }
.text-button { border: 0; padding: 5px 3px; background: transparent; color: #77642d; font: inherit; cursor: pointer; }
.text-button:hover { color: #3e3215; text-decoration: underline; }
.text-button.small { font-size: 13px; }
.text-button.danger { color: #a75b4f; }
.trash-link { display: inline-flex; align-items: center; gap: 3px; }
.trash-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.continue-button { padding: 10px 15px; white-space: nowrap; }
.communication-limit { max-width: 300px; margin: 0; padding: 11px 14px; border-radius: 12px; background: #fff7e5; color: #72500b; font-size: 13px; line-height: 1.55; }
.history-list { display: grid; gap: 10px; }
.history-item, .contact-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid #eadfc9; border-radius: 14px; background: #fffdf9; }
.history-item p { margin: 5px 0 0; }
.contact-row { justify-content: stretch; }
.contact-row input { min-width: 0; flex: 1 1 0; border: 1px solid #d2dfdd; border-radius: 10px; padding: 9px 10px; font: inherit; }
.answer-tools { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.answer-tools select { max-width: 140px; border: 1px solid #d2dfdd; border-radius: 10px; padding: 8px; background: #fffdf9; font: inherit; }
.previous-answer { margin: 5px 0; padding: 9px 10px; border-left: 3px solid #e6bf62; background: #fff8e8; color: #6d581e; font-size: 13px; line-height: 1.55; }
.previous-history { margin: 7px 0; padding: 4px 11px; border-left: 3px solid #e6bf62; background: #fff8e8; color: #6d581e; font-size: 13px; line-height: 1.55; }
.previous-history p { margin: 7px 0; }
.previous-history span { color: #8b7a58; font-size: 12px; }
.tabs { position: sticky; top: 58px; z-index: 4; padding-top: 8px; background: #faf6ed; box-shadow: 0 7px 10px #faf6ed; }
.floating-home-back { position: fixed; top: 70px; right: max(14px, calc((100vw - 1000px) / 2)); z-index: 4; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgb(234 223 201 / 72%); border-radius: 50%; background: rgb(255 253 249 / 55%); color: #5c4b22; box-shadow: 0 6px 18px #6e4c0b14; backdrop-filter: blur(12px); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.floating-home-back.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.floating-home-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.quick-record-panel { padding-top: 18px; }
#archive-search-form { display: flex; flex-wrap: nowrap; align-items: center; width: 100%; }
#archive-search-form .search { flex: 1 1 auto; min-width: 0; max-width: none; }
#archive-search-form .button { flex: 0 0 auto; margin-left: auto; }
.library-question { margin: 10px 0; padding: 0; overflow: hidden; }
.library-question summary { display: flex; align-items: center; gap: 7px; padding: 15px; cursor: pointer; font-weight: 650; }
.library-question summary::-webkit-details-marker { display: none; }
.library-question summary time { margin-left: auto; font-size: 13px; font-weight: 500; white-space: nowrap; }
.library-marker { color: var(--item-tone); font-size: 12px; transition: transform .16s ease; }
.library-question[open] .library-marker { transform: rotate(90deg); }
.library-form { display: grid; gap: 12px; padding: 15px; border-top: 1px solid #eadfc9; }
.library-form label, .library-form fieldset { display: grid; gap: 6px; font-size: 14px; }
.library-form input, .library-form textarea, .library-form select { width: 100%; box-sizing: border-box; border: 1px solid #d2dfdd; border-radius: 10px; padding: 9px 10px; background: #fffdf9; font: inherit; }
.library-form fieldset { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); border: 1px solid #eadfc9; border-radius: 10px; }
.library-form legend { padding: 0 5px; }
.library-form .library-check { display: inline-flex; align-items: center; gap: 5px; }
.library-form .library-check input { width: auto; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.library-grid > label { align-content: start; }
.field-help { color: #716b61; font-size: 12px; line-height: 1.55; }
.reference .script { margin: 20px 0; }
.reference .script > summary { color: #302819; font-size: 17px; font-weight: 750; line-height: 1.65; }
.reference .script p { margin: 10px 0 24px; color: #40392d; font-size: 15px; line-height: 2.05; }
.reference .script:last-of-type p { margin-bottom: 8px; }
.reference h3 { margin: 30px 0 14px; line-height: 1.65; }

@media (max-width: 640px) {
  :root { font-size: 15px; }
  html, body { max-width: 100%; }
  body { background: #f8f6f1; -webkit-font-smoothing: antialiased; }
  .topbar { height: 54px; padding: 0 14px; background: rgb(255 253 248 / 92%); box-shadow: 0 1px 8px rgb(70 50 15 / 7%); backdrop-filter: blur(16px); }
  .brandmark { font-size: 15px; }
  .brandmark span { margin-left: 5px; padding: 3px 6px; }
  .topbar-actions { gap: 12px; }
  .topbar-actions .text-button, #save-state { font-size: 12px; }
  .app-shell { width: calc(100% - 24px); margin: 18px auto 56px; }
  .page-head { margin-bottom: 17px; }
  .page-head h1 { margin-top: 4px; font-size: 29px; line-height: 1.22; letter-spacing: -.025em; }
  .home-head .eyebrow { font-size: 11px; letter-spacing: .07em; }
  .page-head .home-start { margin-top: 22px; justify-content: flex-start; gap: 8px; }
  .home-start .primary-action { min-width: 0; padding: 11px 16px; font-size: 15px; }
  .home-start .home-import { padding: 11px 14px; font-size: 14px; }
  .button { min-height: 40px; padding: 10px 14px; border-radius: 12px; }
  .button.small { min-height: 36px; padding: 7px 10px; font-size: 12px; border-radius: 10px; }
  input, textarea, select { font-size: 16px !important; }
  .panel { margin: 12px 0; padding: 16px; border-radius: 17px; border-color: #e9e1d2; box-shadow: 0 5px 20px rgb(80 55 15 / 5%); }
  .panel h2 { font-size: 23px; letter-spacing: -.02em; }
  .section-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 13px; }
  .section-head > :last-child { margin-left: auto; }
  .list-tools, .record-actions { gap: 8px; }
  .visibility-toggle, .list-tools .text-button { font-size: 12px; }
  #archive-search-form { gap: 8px; }
  #archive-search-form .search { width: 0; min-height: 44px; padding: 10px 13px; font-size: 16px; border-radius: 12px; }
  #archive-search-form .button { padding-inline: 15px; }
  .archive-list { gap: 8px; margin-top: 12px; }
  .archive-item { flex-direction: column; padding: 14px; border-radius: 15px; }
  .archive-item h3 { font-size: 17px; }
  .archive-item .muted { font-size: 13px; line-height: 1.55; }
  .record-actions { width: 100%; justify-content: flex-end; }
  .continue-button { padding: 9px 13px; }
  .footnote { max-width: 330px; margin: 26px auto 0; font-size: 11px; line-height: 1.55; }
  .archive-head { margin-bottom: 16px; }
  .archive-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; margin-bottom: 16px; }
  .archive-export-actions { flex-wrap: nowrap; gap: 6px; }
  .archive-export-actions .button { min-height: 34px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
  .archive-title-row { display: block; }
  .archive-title-row h1 { margin: 5px 0 7px; font-size: 29px; line-height: 1.22; letter-spacing: -.025em; }
  .archive-title-row .muted { margin: 0; font-size: 14px; }
  .archive-primary-action { justify-content: flex-start; margin-top: 15px; padding-top: 0; }
  .archive-primary-action .button { min-height: 42px; padding: 10px 15px; font-size: 15px; }
  .communication-limit { max-width: none; font-size: 12px; }
  .history-item { align-items: flex-start; flex-direction: column; }
  .history-item { padding: 12px; border-radius: 13px; }
  .history-item .actions { width: 100%; justify-content: flex-end; }
  .contact-row { align-items: stretch; flex-direction: column; }
  .contact-row { padding: 12px; border-radius: 13px; }
  .answer-tools { align-items: stretch; flex-wrap: wrap; }
  .answer-tools select { flex: 1 1 145px; max-width: none; }
  .chips { gap: 7px; }
  .module-choice { min-height: 38px; padding: 8px 12px !important; font-size: 13px; }
  .tabs { top: 54px; flex-wrap: nowrap; gap: 5px; margin: 18px 0 14px; padding-top: 6px; }
  .tabs .button { flex: 1 1 0; min-width: 0; padding: 9px 8px; font-size: 13px; line-height: 1.35; }
  .question { margin: 8px 0; border-radius: 14px; }
  .question summary { padding: 12px; font-size: 14px; line-height: 1.5; }
  .q-content { padding: 0 12px 12px; }
  .answer { min-height: 88px; }
  .library-grid { grid-template-columns: 1fr; }
  .library-question summary { align-items: flex-start; }
  .library-question summary time { font-size: 12px; }
  .library-form { gap: 11px; padding: 13px; }
  .library-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reference .script > summary { font-size: 16px; }
  .reference .script p { font-size: 14px; line-height: 1.8; }
  .consultation-inline-back, .consultation-eyebrow, .consultation-summary, .consultation-save-note { display: none; }
  .floating-home-back { top: 64px; right: 12px; left: auto; width: 40px; height: 40px; }
  .floating-home-back.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .floating-home-back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
}
:root{--backup-bg:#fffdf6}.backup-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0 0 18px;background:var(--backup-bg)}.backup-panel h2{font-size:17px;margin:0 0 5px}.backup-panel p{margin:0;max-width:600px}@media(max-width:640px){.backup-panel{align-items:flex-start;flex-direction:column}}
