:root {
  color-scheme: light;
  --ink: #243c36;
  --muted: #738079;
  --line: #e3e8e1;
  --green: #30614c;
  --green-dark: #234c3b;
  --paper: #fff;
  --wash: #f4f6f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--wash); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, summary, select, input[type="checkbox"] { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #adc9ac; outline-offset: 3px; }
[hidden] { display: none !important; }
.page { max-width: 1240px; padding: 48px 30px 22px; margin: 0 auto; }
.page-header { margin: 0 0 30px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .22em; color: var(--green); margin-bottom: 12px; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 36px); letter-spacing: -.04em; font-weight: 650; line-height: 1.4; }
.subtitle { color: var(--muted); margin: 10px 0 0; font-size: 14px; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
h3 { margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 3px 10px #263a2b03; }
.settings { padding: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.65; font-weight: 400; }
.currency-fieldset { border: 0; margin: 21px 0 22px; padding: 0; min-width: 0; }
.currency-fieldset legend { font-size: 12px; color: var(--muted); margin-bottom: 10px; padding: 0; }
.currency-options { display: flex; flex-wrap: wrap; gap: 9px; min-height: 37px; }
.currency-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; cursor: pointer; }
.currency-chip:has(input:checked) { background: #f0f6ee; border-color: #c7d9c1; }
.currency-chip input, .check-label input { accent-color: var(--green); margin: 0; width: 15px; height: 15px; flex-shrink: 0; }
.currency-code { font-family: "Consolas", "SFMono-Regular", monospace; font-size: 12px; color: var(--green); background: #edf2eb; border-radius: 4px; padding: 2px 5px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 500; min-width: 0; }
input[type="text"], input:not([type]), select { width: 100%; min-width: 0; border: 1px solid #dfe5dc; border-radius: 7px; padding: 10px 11px; background: #fff; color: var(--ink); line-height: 1.4; }
input::placeholder, textarea::placeholder { color: #9ba69d; font-weight: 400; }
.currency-manager { border-top: 1px solid var(--line); margin-top: 23px; padding-top: 17px; }
.currency-manager summary { font-size: 13px; font-weight: 500; color: var(--green); width: fit-content; }
.manager-description { margin: 14px 0 8px; }
.currency-list { padding: 0; margin: 0; list-style: none; }
.currency-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef1eb; }
.currency-identity { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; flex: 1; font-size: 13px; overflow-wrap: anywhere; }
.currency-badge { color: #929b93; font-size: 11px; font-weight: 400; }
.row-actions { display: flex; gap: 4px; align-items: center; }
.button { min-height: 35px; border: 1px solid transparent; border-radius: 7px; padding: 8px 13px; font-size: 13px; font-weight: 500; transition: background .15s; white-space: nowrap; }
.button-primary { background: var(--green); color: #fff; padding: 11px 21px; }
.button-primary:hover:not(:disabled) { background: var(--green-dark); }
.button-primary span { margin-left: 20px; }
.button-secondary { background: #eef3eb; border-color: #d9e3d4; color: var(--green); }
.button-secondary:hover:not(:disabled) { background: #e3eddf; }
.button-text { background: transparent; color: var(--green); padding: 6px 9px; }
.button-text:hover:not(:disabled) { background: #eff4ed; }
.button-danger { color: #a64b3b; background: #fbf0ec; }
.button-danger:hover:not(:disabled) { background: #f7e3dc; }
.edit-currency-form { display: flex; flex-wrap: wrap; width: 100%; gap: 12px; align-items: end; }
.edit-currency-form .field { flex: 1; min-width: 120px; }
.delete-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; font-size: 12px; color: #a64b3b; }
.add-currency-form { padding-top: 20px; }
.add-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.add-fields button { min-height: 43px; }
.add-currency-form > .hint { margin-bottom: 0; }
.status { margin: 8px 0 0; color: var(--muted); font-size: 12px; min-height: 0; line-height: 1.6; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.error { color: #b04432; }
.status.success { color: var(--green); }
.load-status { display: flex; align-items: center; gap: 12px; }
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.editor-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.editor-heading { min-height: 70px; padding: 16px 21px; border-bottom: 1px solid var(--line); }
.toolbar { display: flex; gap: 2px; }
.bill-text { display: block; width: 100%; min-height: 320px; flex: 1; resize: vertical; border: 0; background: #fff; padding: 22px; color: var(--ink); font-size: 14px; line-height: 1.9; font-family: "Consolas", "SFMono-Regular", "PingFang SC", "Microsoft YaHei", monospace; tab-size: 10; border-radius: 0; }
.bill-text:focus-visible { outline-offset: -3px; }
.output-text { background: #fafbf8; white-space: pre; overflow-wrap: normal; }
.editor-footer, .output-footer { min-height: 77px; padding: 16px 21px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
.workspace-status { grid-column: 1 / -1; margin: -9px 0 0; }
.page-footer { text-align: center; color: #9ba59b; font-size: 11px; margin-top: 25px; }
@media (max-width: 760px) {
  .page { padding: 30px 16px 20px; }
  .page-header { margin-bottom: 24px; }
  .settings { padding: 19px 17px; }
  .settings > .section-heading { align-items: start; flex-direction: column; gap: 6px; }
  .settings-grid { grid-template-columns: 1fr; gap: 17px; }
  .workspace { grid-template-columns: 1fr; gap: 17px; margin-top: 17px; }
  .bill-text { min-height: 260px; padding: 17px; }
  .editor-heading { padding: 14px 16px; min-height: 62px; }
  .editor-footer, .output-footer { padding: 14px 16px; min-height: 70px; }
  .add-fields { grid-template-columns: 1fr 1fr; }
  .add-fields button { grid-column: 1 / -1; }
  .workspace-status { margin-top: -5px; }
  .currency-chip { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }
