:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #fff;
  --ink: #212734;
  --secondary: #69717f;
  --muted: #9299a5;
  --line: #eceef2;
  --blue: #2851d7;
  --blue-soft: #edf1ff;
  --red: #bd443b;
  --radius: 14px;
  font-family: "Trebuchet MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
button, select { -webkit-appearance: none; appearance: none; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #aab9f3; outline-offset: 3px; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: #c3c7d0; }
[hidden] { display: none !important; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.shell { width: calc(100% - 32px); max-width: 960px; margin-inline: auto; }
.app-header { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; gap: 9px; align-items: center; font-size: 17px; font-weight: 700; white-space: nowrap; letter-spacing: -.4px; }
.brand > svg { width: 28px; height: 28px; color: var(--blue); stroke-width: 1.8; }
.app-label { font-size: 11px; font-weight: 400; color: var(--secondary); border-left: 1px solid #d9dde5; padding-left: 9px; margin-left: 2px; letter-spacing: 0; }
.quiet-button { border: 0; background: transparent; display: flex; align-items: center; gap: 5px; padding: 10px 0 10px 8px; min-height: 44px; font-size: 12px; color: var(--secondary); white-space: nowrap; }
.quiet-button svg { width: 17px; height: 17px; }
.layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; }
.estimate { min-width: 0; padding: 23px 22px 0; background: var(--surface); border-radius: var(--radius); }
.estimate-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.estimate h1 { margin: 0; font-size: 13px; font-weight: 500; color: var(--secondary); }
.currency-note { font-size: 11px; color: var(--muted); }
.estimate-value { display: flex; align-items: baseline; gap: 7px; margin-top: 11px; min-width: 0; }
.estimate-value > span { font-size: 25px; font-weight: 500; }
.estimate-value strong { font-size: 43px; letter-spacing: -1.8px; line-height: 1.18; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.estimate-value.large strong { font-size: 29px; letter-spacing: -.8px; }
.estimate-hint { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 9px 0 19px; }
.estimate-breakdown { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 0; padding-bottom: 19px; }
.estimate-breakdown > div { min-width: 0; }
.estimate-breakdown dt { font-size: 11px; color: var(--secondary); margin-bottom: 7px; }
.estimate-breakdown dd { font-size: 15px; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.category-taxes { display: flex; flex-wrap: wrap; gap: 5px 20px; border-top: 1px solid var(--line); padding: 12px 0 14px; }
.category-taxes > div { display: flex; align-items: center; gap: 9px; font-size: 11px; min-width: 0; }
.category-taxes > div > span { display: flex; align-items: center; gap: 5px; color: var(--secondary); }
.category-taxes small { font-size: 10px; color: var(--muted); }
.category-taxes strong { font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.category-indicator { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #5079dc; }
.category-indicator.tobacco { background: #c39b68; }
.estimate-note, .desktop-details { display: none; }
.editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { border-radius: var(--radius); background: var(--surface); min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 20px 15px; }
.section-heading h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section-heading h2 > span { color: var(--muted); font-size: 11px; font-weight: 400; margin-left: 6px; }
.section-caption { color: var(--muted); font-size: 11px; }
.currency-row { display: flex; align-items: center; justify-content: space-between; margin: 0 20px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.currency-row > label { font-size: 12px; color: var(--secondary); }
.select-control { display: flex; align-items: center; position: relative; min-width: 0; }
.select-control select { min-height: 44px; border: 0; background: transparent; padding: 0 23px 0 10px; border-radius: 6px; font-size: 16px; cursor: pointer; min-width: 0; max-width: 100%; }
.select-control svg { width: 16px; height: 16px; pointer-events: none; position: absolute; right: 1px; color: var(--secondary); }
.item-row { padding: 12px 0 15px; margin: 0 20px; border-bottom: 1px solid var(--line); }
.item-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.item-number { font-size: 11px; color: var(--muted); min-width: 16px; font-variant-numeric: tabular-nums; }
.category-switch { display: flex; align-items: center; border: 0; margin: 0; padding: 0; gap: 6px; min-width: 0; }
.category-switch label, .mode-switch label { position: relative; cursor: pointer; min-width: 0; }
.category-switch input, .mode-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.category-switch label > span { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 0 12px; color: var(--secondary); border-radius: 6px; font-size: 12px; border: 1px solid transparent; }
.category-switch small { font-size: 10px; color: #9299a5; }
.category-switch input:checked + span { color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.category-switch input:checked + span small { color: #6c80c6; font-weight: 400; }
.category-switch label:has(input:focus-visible), .mode-switch label:has(input:focus-visible) { outline: 3px solid #aab9f3; outline-offset: 3px; border-radius: 6px; }
.icon-button { width: 44px; height: 44px; border: 0; padding: 12px; background: transparent; color: #9ba2ae; border-radius: 8px; display: grid; place-items: center; flex: 0 0 44px; }
.icon-button svg { width: 20px; height: 20px; }
.remove-item { margin-left: auto; margin-right: -9px; }
.icon-button:hover { background: #f5f6f8; color: var(--ink); }
.item-amount-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; margin-top: 6px; }
.amount-control { display: flex; align-items: center; min-width: 0; min-height: 47px; background: #f8f9fb; border: 1px solid #f0f1f5; border-radius: 8px; padding: 0 12px; gap: 8px; }
.amount-control:focus-within { border-color: #a7b8f0; background: #fff; box-shadow: 0 0 0 2px #edf1ff; }
.amount-control input { border: 0; outline: none; padding: 9px 0; min-width: 0; width: 100%; background: transparent; font-size: 20px; line-height: 1.2; font-weight: 500; font-variant-numeric: tabular-nums; }
.amount-control input:focus-visible { outline: none; }
.item-symbol { color: #969daa; font-size: 16px; flex-shrink: 0; }
.item-unit, .shipping-symbol { color: #969daa; font-size: 10px; flex-shrink: 0; }
.item-tax { text-align: right; min-width: 67px; max-width: 120px; }
.item-tax > span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.item-tax strong { font-size: 12px; font-weight: 500; color: var(--secondary); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.input-error { font-size: 11px; line-height: 1.6; color: var(--red); margin: 7px 0 0; }
.input-error:empty { display: none; }
.add-item { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--blue); background: transparent; border: 0; }
.add-item > span { font-size: 20px; font-weight: 400; }
.add-item:hover { background: #f8faff; }
.panel-footnote { margin: 0 20px; padding: 0 0 17px; text-align: center; color: var(--muted); font-size: 10px; line-height: 1.6; }
.list-notice { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 6px; margin: 0 20px 12px; background: #f5f7fc; font-size: 11px; color: var(--secondary); }
.list-notice button { border: 0; background: transparent; min-height: 44px; padding: 8px; color: var(--blue); font-size: 12px; }
.shipping-panel { padding-bottom: 4px; }
.shipping-inputs { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; margin: 0 20px; }
.shipping-inputs .amount-control input { font-size: 18px; }
.shipping-select select { min-width: 83px; font-size: 16px; }
.shipping-panel > .input-error { margin-inline: 20px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; margin: 7px 20px 0; min-height: 51px; gap: 12px; cursor: pointer; position: relative; }
.switch-row > span:first-child { font-size: 12px; color: var(--secondary); }
.switch-row input { position: absolute; right: 0; opacity: 0; width: 36px; height: 28px; margin: 0; }
.switch { position: relative; width: 34px; height: 20px; border-radius: 12px; background: #dfe3ea; flex: 0 0 34px; transition: background .15s; pointer-events: none; }
.switch:before { content: ""; width: 16px; height: 16px; border-radius: 50%; position: absolute; left: 2px; top: 2px; background: #fff; box-shadow: 0 1px 2px #00000014; transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--blue); }
.switch-row input:checked + .switch:before { transform: translateX(14px); }
.switch-row input:focus-visible + .switch { outline: 3px solid #aab9f3; outline-offset: 3px; }
.allocation-note { font-size: 11px; color: var(--secondary); line-height: 1.7; padding: 0 20px 13px; margin: 0; }
.exchange-panel { overflow: hidden; }
.exchange-panel summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; cursor: pointer; list-style: none; min-height: 75px; }
.exchange-panel summary::-webkit-details-marker { display: none; }
.exchange-panel summary > span { min-width: 0; }
.exchange-panel summary strong { font-size: 13px; font-weight: 600; }
.exchange-panel summary small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.exchange-panel summary > svg { flex: 0 0 17px; width: 17px; height: 17px; color: var(--muted); }
.exchange-panel details[open] summary > svg { transform: rotate(180deg); }
.exchange-content { border-top: 1px solid var(--line); padding: 18px 20px; }
.mode-switch { display: flex; gap: 4px; border: 0; background: #f2f4f8; padding: 3px; margin: 0; border-radius: 7px; }
.mode-switch label { flex: 1; }
.mode-switch label > span { display: flex; align-items: center; justify-content: center; border-radius: 5px; min-height: 44px; font-size: 12px; color: var(--secondary); }
.mode-switch input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #18284a0a; }
.rate-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; min-height: 32px; }
.rate-status-row > span { font-size: 10px; color: var(--secondary); line-height: 1.6; }
.link-button { color: var(--blue); border: 0; background: transparent; font-size: 12px; min-height: 44px; padding: 9px 0 9px 10px; flex-shrink: 0; }
.rate-pairs, .manual-rates { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; margin-top: 11px; }
.rate-pairs > div { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.rate-pairs span, .manual-rates label { font-size: 11px; color: var(--secondary); }
.rate-pairs strong { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.rate-pairs small { font-size: 10px; color: var(--muted); line-height: 1.5; }
.manual-rates label { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.manual-rates input { width: 100%; min-width: 0; border: 1px solid #e5e8f0; border-radius: 7px; min-height: 44px; padding: 10px; background: #fafbfe; font-size: 16px; }
.manual-rates input:disabled { color: var(--muted); background: #f4f5f7; }
.manual-rates input::placeholder { font-size: 11px; }
.rate-unit-note { font-size: 10px; color: var(--muted); margin: 11px 0 17px; line-height: 1.6; }
.tax-date-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 13px; }
.tax-date-row > span { font-size: 10px; color: var(--secondary); }
.tax-date-row strong { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-top: 7px; }
.tax-date-row small { color: var(--muted); font-size: 10px; text-align: right; }
.source-link { display: inline-block; font-size: 10px; color: var(--muted); margin-top: 17px; }
.rate-error-banner { padding: 0 20px 16px; }
.rate-error-banner p { margin: 0; color: var(--red); font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.rate-error-banner button { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; background: #fff5f2; color: #a44b35; min-height: 44px; padding: 0 11px; margin-top: 10px; width: 100%; border-radius: 6px; font-size: 12px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 20px; padding-bottom: calc(106px + env(safe-area-inset-bottom)); font-size: 9px; color: #a2a8b2; }
.bottom-bar { background: #ffffffed; backdrop-filter: blur(12px); border-top: 1px solid #e7eaf0; position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; padding-bottom: env(safe-area-inset-bottom); }
.bottom-bar-inner { width: calc(100% - 40px); max-width: 580px; margin: auto; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bottom-bar-inner > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bottom-bar-inner > div > span { font-size: 10px; color: var(--secondary); }
.bottom-bar-inner strong { font-size: 22px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bottom-bar-inner strong.large { font-size: 16px; }
.primary-button { display: flex; justify-content: center; align-items: center; gap: 12px; background: var(--blue); color: white; border: 0; border-radius: 8px; min-height: 45px; padding: 0 19px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.primary-button:hover:not(:disabled) { background: #2046c3; }
.primary-button svg { width: 15px; height: 15px; }
.desktop-details { display: none; }
.sheet { border: 0; border-radius: 20px 20px 0 0; padding: 0; width: 100%; max-width: 580px; max-height: 88vh; max-height: 88dvh; margin: auto auto 0; color: var(--ink); background: white; overflow-y: auto; overscroll-behavior: contain; }
.sheet::backdrop { background: #18233866; }
body:has(dialog[open]) { overflow: hidden; }
.sheet-handle { width: 30px; height: 4px; background: #dce0e8; border-radius: 4px; margin: 10px auto 0; }
.sheet-heading { display: flex; justify-content: space-between; align-items: center; padding: 4px 16px 8px 24px; border-bottom: 1px solid var(--line); }
.sheet-heading h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-content { padding: 22px 24px calc(18px + env(safe-area-inset-bottom)); }
.sheet-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.sheet-total > span { color: var(--secondary); font-size: 12px; }
.sheet-total strong { font-size: 27px; font-weight: 700; letter-spacing: -1px; overflow-wrap: anywhere; }
.detail-item { padding: 13px 0; border-top: 1px solid var(--line); }
.detail-item > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; line-height: 1.8; }
.detail-item > div > span:last-child { text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.detail-item p { color: var(--secondary); font-size: 10px; margin: 5px 0 0; line-height: 1.7; }
.detail-summary { border-top: 1px solid var(--line); padding-top: 15px; margin: 0; }
.detail-summary > div { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: 12px; }
.detail-summary dt { color: var(--secondary); }
.detail-summary dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.detail-note { color: var(--muted); font-size: 10px; line-height: 1.9; white-space: pre-line; margin: 18px 0; }
.copy-button { width: 100%; }
.copy-status { min-height: 16px; font-size: 11px; color: var(--secondary); line-height: 1.6; text-align: center; margin: 10px 0 0; }
.rules-content h3 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }
.rules-content p { font-size: 12px; color: var(--secondary); line-height: 1.9; margin: 0 0 24px; }
.rules-content p:last-child { margin-bottom: 4px; }

@media (min-width: 640px) {
  .shell { width: calc(100% - 48px); }
  .layout { max-width: 540px; }
  .estimate { padding: 26px 24px 0; }
  .category-taxes { justify-content: space-between; }
  .sheet { margin: auto; border-radius: 16px; max-height: 85vh; }
  .sheet-handle { display: none; }
  .sheet-heading { padding-top: 8px; }
}
@media (min-width: 900px) {
  .app-header { height: 100px; border-bottom: 1px solid #e2e5eb; margin-bottom: 28px; }
  .brand { font-size: 19px; }
  .layout { max-width: 960px; grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); align-items: start; gap: 26px; }
  .editor { grid-column: 1; grid-row: 1; }
  .estimate { grid-column: 2; grid-row: 1; position: sticky; top: 24px; padding: 28px 26px 20px; }
  .estimate-value { margin-top: 20px; }
  .estimate-value strong { font-size: 46px; }
  .estimate-breakdown { gap: 9px; padding-bottom: 24px; }
  .estimate-breakdown dd { font-size: 15px; }
  .category-taxes { display: flex; flex-direction: column; gap: 16px; padding: 22px 0; }
  .category-taxes > div { justify-content: space-between; font-size: 12px; }
  .category-taxes strong { font-size: 13px; }
  .desktop-details { display: flex; width: 100%; margin-top: 7px; justify-content: space-between; }
  .estimate-note { display: block; font-size: 10px; color: var(--muted); line-height: 1.8; margin: 16px 0 0; }
  .bottom-bar { display: none; }
  .page-footer { padding-top: 26px; padding-bottom: 30px; }
  .section-heading { padding: 22px 24px 16px; }
  .currency-row, .item-row { margin-inline: 24px; }
  .item-row { padding-top: 14px; padding-bottom: 20px; }
  .item-amount-row { margin-top: 10px; gap: 24px; }
  .item-tax { min-width: 93px; }
  .category-switch label > span { min-height: 44px; padding-inline: 16px; }
}
@media (max-width: 359px) {
  .shell { width: calc(100% - 24px); }
  .app-header { height: 65px; }
  .app-label { display: none; }
  .estimate { padding: 20px 17px 0; }
  .estimate-value strong { font-size: 38px; }
  .estimate-breakdown dd { font-size: 13px; }
  .category-taxes { gap: 7px 12px; }
  .category-taxes > div { gap: 6px; font-size: 10px; }
  .category-taxes small { display: none; }
  .section-heading { padding-inline: 16px; }
  .currency-row, .item-row { margin-inline: 16px; }
  .category-switch { gap: 2px; }
  .category-switch label > span { padding: 0 9px; font-size: 11px; }
  .item-top { gap: 7px; }
  .item-amount-row { gap: 10px; }
  .item-tax { min-width: 60px; max-width: 95px; }
  .item-tax strong { font-size: 11px; }
  .shipping-inputs, .switch-row { margin-inline: 16px; }
  .exchange-panel summary, .exchange-content { padding-inline: 16px; }
  .bottom-bar-inner { width: calc(100% - 32px); gap: 10px; }
  .bottom-bar-inner strong { font-size: 20px; }
  .bottom-bar .primary-button { padding: 0 14px; }
  .sheet-content { padding-inline: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { transition: none !important; animation: none !important; }
}
