:root {
  --paper: #f4efe6;
  --surface: #fbf8f2;
  --surface-2: #f7f2e9;
  --paper-2: #ece5d8;
  --line: #e6ddcf;
  --line-strong: #d9cfbf;
  --ink: #1f1b16;
  --muted: #7a7267;
  --faint: #a89f92;
  --primary: #b8771b;
  --primary-strong: #9e6414;
  --primary-soft: #f6e7cf;
  --danger: #c0392b;
  --danger-soft: #fbe6e3;
  --success: #2f855a;
  --success-soft: #e1f2e8;
  --shadow-card: 0 1px 2px rgba(60, 45, 20, .05), 0 8px 24px -12px rgba(60, 45, 20, .15);
  --font-display: "Noto Serif SC", "Songti SC", STSong, serif;
  --font-sans: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.6 var(--font-sans); }
button, input, select, textarea { font: inherit; }
button, select, input[type="range"], input[type="file"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid rgba(184,119,27,.55); outline-offset: 2px; }

.topbar { position: sticky; top: 0; z-index: 10; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(30px, calc((100vw - 1200px) / 2)); background: rgba(244,239,230,.88); border-bottom: 1px solid rgba(230,221,207,.72); backdrop-filter: blur(12px); }
.brand { display: inline-flex; gap: 9px; align-items: center; color: var(--ink); text-decoration: none; font: 700 16px var(--font-display); }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; color: #fff; background: var(--primary); border-radius: 10px; font: 700 15px var(--font-display); }
.topbar-note { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; }
.live-dot { width: 7px; height: 7px; background: var(--success); border-radius: 50%; }

.page { max-width: 1200px; margin: 0 auto; padding: 30px 30px 72px; }
.section-kicker { margin: 0 0 6px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
h2 { margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 1.2; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 23px; align-items: start; }
.form-column, .output-column { display: grid; gap: 15px; }
.output-column { position: sticky; top: 70px; }
.panel { padding: 19px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-card); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-heading.compact-heading { margin-bottom: 11px; }
.required-note, .panel-note, .format-badge, .prompt-spec { color: var(--muted); font-size: 11px; white-space: nowrap; }
.required-note { display: inline-flex; gap: 5px; align-items: center; }
.required-note i { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; }
.format-badge { padding: 2px 8px; color: var(--primary-strong); background: var(--primary-soft); border-radius: 999px; font-weight: 700; }
.prompt-spec { padding: 2px 8px; color: var(--success); background: var(--success-soft); border-radius: 999px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.form-card-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .64fr); align-items: end; gap: 18px; }
.form-fields { min-width: 0; }
.service-facts-grid { grid-template-columns: 1.05fr .8fr .9fr 1fr; }
.project-customer-grid { align-items: start; }
.notes-grid { align-items: start; }
.field { display: grid; gap: 6px; margin-bottom: 13px; color: var(--ink); font-size: 13px; }
.field > span { font-weight: 600; }
.field b { color: var(--primary); }
.field em { color: var(--faint); font-size: 11px; font-style: normal; font-weight: 400; }
.field small { color: var(--muted); font-size: 11px; }
input:not([type="range"]), select, textarea { width: 100%; min-height: 39px; padding: 8px 11px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; outline: none; transition: border .15s, box-shadow .15s; }
textarea { min-height: auto; line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: rgba(184,119,27,.68); box-shadow: 0 0 0 3px rgba(184,119,27,.11); }
.field-label { display: inline-flex; align-items: center; gap: 7px; }
.weekday-value { color: var(--primary-strong); font-family: ui-monospace, Consolas, monospace; font-size: 11px; font-weight: 700; }

.weather-row { display: flex; align-items: center; gap: 10px; min-height: 39px; margin: 2px 0 10px; }
.weather-message { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.weather-message.is-error { color: var(--danger); }
.weather-row .text-button { margin-left: auto; white-space: nowrap; }
.weather-result { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 7px; min-width: 0; min-height: 36px; padding: 6px 9px; background: var(--surface-2); border-radius: 12px; white-space: nowrap; }
.weather-result > span:first-child { font-size: 19px; }
.weather-result strong { font-size: 13px; }
.weather-result #weather-source { max-width: 105px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; }
.manual-weather { display: grid; grid-template-columns: 1fr 110px; gap: 10px; padding: 13px; margin-bottom: 13px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; }
.manual-weather .field { margin: 0; }
.manual-weather p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 11px; }
.project-field { margin-top: 0; }

.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; border: 1px solid transparent; border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 600; transition: background .15s, border .15s, transform .1s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 6px 18px rgba(184,119,27,.22); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-block { width: 100%; }
.text-button { padding: 2px 0; color: var(--primary-strong); background: none; border: 0; font-size: 12px; font-weight: 600; }

.cover-frame { overflow: hidden; width: 100%; margin: 0; background: #2c2924; border-radius: 0; }
.inline-cover { width: 90%; justify-self: end; aspect-ratio: 3 / 4; align-self: end; }
#cover-canvas { display: block; width: 100%; height: 100%; }
.form-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 2px; }
.form-actions .btn { min-width: 0; padding-right: 6px; padding-left: 6px; white-space: nowrap; }
.upload-cover-button { position: relative; cursor: pointer; }
.upload-cover-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.toast { position: fixed; z-index: 20; top: 64px; left: 50%; max-width: calc(100vw - 30px); padding: 8px 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-card); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, -8px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.prompt-dialog { width: min(720px, calc(100vw - 30px)); max-height: min(720px, calc(100vh - 30px)); padding: 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(32, 24, 13, .25); }
.prompt-dialog::backdrop { background: rgba(32, 27, 20, .38); backdrop-filter: blur(2px); }
.prompt-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.prompt-dialog-heading h2 { font-size: 18px; }
.prompt-dialog-actions { display: flex; gap: 13px; align-items: center; }
#prompt-preview-output { height: min(560px, calc(100vh - 150px)); color: #554d43; background: var(--surface-2); border-color: transparent; border-radius: 12px; font: 12px/1.65 ui-monospace, "SFMono-Regular", Consolas, monospace; resize: vertical; }

@media (max-width: 920px) {
  .workspace { gap: 15px; }
  .service-facts-grid { grid-template-columns: 1fr 1fr; }
  .weather-result #weather-source { display: none; }
  .page { padding-right: 20px; padding-left: 20px; }
  .topbar { padding-right: 20px; padding-left: 20px; }
}

@media (max-width: 767px) {
  body { padding-bottom: 24px; }
  .topbar { height: 53px; padding: 0 15px; }
  .topbar-note { font-size: 10px; }
  .page { padding: 22px 15px 24px; }
  .workspace { display: flex; flex-direction: column; gap: 15px; }
  .form-column, .output-column { width: 100%; }
  .output-column { position: static; }
  .panel { padding: 15px; border-radius: 18px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .notes-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .service-facts-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .manual-weather { grid-template-columns: 1fr 92px; }
  .weather-row { flex-wrap: wrap; }
  .weather-message { flex: 1 1 150px; }
  .weather-result { order: 3; flex-basis: auto; }
  .form-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .form-actions .btn { padding-right: 3px; padding-left: 3px; font-size: 12px; }
  .form-card-layout { grid-template-columns: 1fr; }
  .inline-cover { width: 100%; }
  .toast { top: 61px; }
}

@media (max-width: 390px) {
  .brand { gap: 7px; font-size: 15px; }
  .brand-mark { width: 30px; height: 30px; }
  .topbar-note { display: none; }
  .service-facts-grid { grid-template-columns: 1fr; gap: 0; }
  .weather-row .text-button { margin-left: 0; }
}
