:root {
  font-family: "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
  color: #172d30;
  background: #f2f5f4;
  font-size: 14px;
  --accent: #126259;
  --accent-dark: #0e5149;
  --muted: #4d6569;
  --line: #d6e0de;
  --white: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #19796e;
  outline-offset: 2px;
}
.app-header { background: #123c39; color: var(--white); }
.header-inner, main { width: min(1440px, 100%); margin: auto; padding-inline: clamp(16px, 3.4vw, 48px); }
.header-inner { display: flex; align-items: center; gap: clamp(20px, 5vw, 74px); min-height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; font-weight: 700; font-size: 17px; }
.brand-icon { width: 24px; height: 17px; border: 1.5px solid #a6ddd1; border-radius: 3px; position: relative; overflow: hidden; }
.brand-icon::before { content: ""; position: absolute; width: 15px; height: 15px; border: solid #a6ddd1; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); top: -8px; left: 3px; }
nav { display: flex; gap: 22px; }
nav button { color: #cce2de; border: 0; border-bottom: 2px solid transparent; background: none; min-height: 66px; padding: 0 2px; white-space: nowrap; }
nav button[aria-current], nav button:hover { color: white; }
nav button[aria-current] { border-bottom-color: #9ee0d0; font-weight: 700; }
nav button:focus-visible { outline-color: #a6ddd1; outline-offset: -4px; }
nav .local-billing-link { display: flex; align-items: center; color: #cce2de; text-decoration: none; white-space: nowrap; padding: 0 2px; }
nav .local-billing-link:hover { color: white; }
main { padding-block: 28px 48px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; line-height: 1.35; }
.page-heading p { color: var(--muted); margin-top: 7px; }
.workspace, .master-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 24px; }
.panel { background: var(--white); padding: 20px; border: 1px solid var(--line); border-radius: 10px; }
#shipment { display: grid; gap: 14px; }
h2 { font-size: 16px; line-height: 1.4; }
.panel h2 { margin-bottom: 13px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 13px; }
label { display: block; color: #314d50; font-size: 13px; font-weight: 600; }
.field-grid > .wide { grid-column: 1 / -1; }
label.check { display: flex; align-items: flex-start; gap: 7px; }
.required { font-size: 11px; color: #87402b; margin-inline-start: 3px; }
input:not([type="checkbox"]), textarea, select {
  display: block; width: 100%; min-width: 0; min-height: 38px; margin-top: 4px;
  border: 1px solid #b9cbc8; border-radius: 5px; padding: 7px 9px; color: #172d30; background: #fff;
}
input[type="checkbox"] { accent-color: var(--accent); margin: 3px 0 0; }
input[aria-invalid] { border-color: #a13224; }
input::placeholder, textarea::placeholder { color: #697c7e; }
textarea { resize: vertical; }
.button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 39px;
  border: 1px solid transparent; border-radius: 6px; padding: 7px 12px; font-weight: 650; line-height: 1.45; text-align: center;
}
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary, .button.remove { background: var(--white); border-color: #b9cbc8; color: #234e4c; }
.button.secondary:hover, .button.remove:hover { background: #eaf4f0; }
.button.small { min-height: 34px; font-size: 13px; }
.section-head, .save-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-head { justify-content: space-between; }
.panel .save-row { margin-top: 15px; }
.catalog-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.catalog-picker { margin-bottom: 12px; }
.item { border: 1px solid var(--line); border-radius: 7px; min-width: 0; padding: 7px 10px 10px; margin: 0 0 9px; }
.item legend { padding-inline: 5px; color: #456562; font-size: 12px; }
.item-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(57px, .7fr) minmax(52px, .6fr) auto; gap: 7px; align-items: end; }
.item-grid .button { min-height: 38px; padding: 5px 8px; font-size: 12px; }
.item-classification { font-size: 12px; color: #35635c; margin-top: 6px; overflow-wrap: anywhere; }
.after-field { margin-top: 12px; }
.preview-panel {
  background: #dce6e3; border: 1px solid #c5d5d2; overflow: hidden; border-radius: 10px;
  position: sticky; top: 15px;
}
.preview-head { padding: 13px 16px; background: #f8fbfa; border-bottom: 1px solid #c5d5d2; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.preview-head > div:first-child { display: flex; align-items: center; gap: 9px; }
.format-label { color: #3e615e; font-size: 12px; font-weight: 600; border: 1px solid #ccd9d7; padding: 1px 6px; border-radius: 4px; }
[role="tablist"] { display: flex; gap: 2px; padding: 3px; background: #eaf1ef; border-radius: 7px; }
[role="tab"] { padding: 5px 12px; color: #3a5e59; background: transparent; border: 1px solid transparent; border-radius: 5px; white-space: nowrap; }
[role="tab"][aria-selected="true"] { background: #fff; color: #154d47; border-color: #cbdad6; font-weight: 700; }
.preview-body { padding: 18px; overflow: auto; max-height: min(63vh, 715px); min-height: 250px; }
.preview-actions { background: #f8fbfa; padding: 13px 16px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #c5d5d2; }
.feedback:empty { display: none; }
.feedback { color: #8b2e20; width: 100%; font-size: 13px; }
#app-feedback { position: fixed; bottom: 18px; right: 18px; max-width: calc(100vw - 36px); background: #123c39; color: white; border-radius: 7px; padding: 12px 16px; z-index: 2; }
.record-list { list-style: none; padding: 0; margin: 0; }
.record-list li { border-top: 1px solid #e0e8e6; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; overflow-wrap: anywhere; }
.record-list li:first-child { border-top: 0; }
.record-list li:last-child { padding-bottom: 0; }
.record-title { font-weight: 700; }
.record-list .muted { margin-top: 4px; }
.record-actions { display: flex; gap: 6px; flex-shrink: 0; }
.history-filters { display: grid; grid-template-columns: minmax(160px, 2fr) repeat(2, minmax(120px, 1fr)); gap: 9px; margin-bottom: 9px; }
.history-pagination { justify-content: center; }
.dispatch-stages { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }
.dispatch-stage {
  display: grid; gap: 5px; min-height: 72px; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  color: var(--muted); font-weight: 600; text-align: left;
}
.dispatch-stage:hover, .dispatch-stage[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); background: #eaf5f1; }
.dispatch-stage[aria-pressed="true"] { box-shadow: inset 0 -2px var(--accent); }
.dispatch-stage strong { font-size: 1.5rem; color: #172d30; line-height: 1; font-variant-numeric: tabular-nums; }
.dispatch-stage[data-stage="attention"] strong { color: #8a3625; }
.panel.dispatch-panel { padding: 0; overflow: hidden; }
.dispatch-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(125px, 1fr) minmax(125px, 1fr) auto; align-items: end; gap: 10px; padding: 15px; }
.dispatch-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 15px; border-top: 1px solid var(--line); background: #f8fbfa; }
.dispatch-bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dispatch-page-select { align-items: center !important; min-height: 34px; cursor: pointer; }
.dispatch-page-select input { margin: 0; }
.dispatch-table-frame { overflow-x: auto; }
.dispatch-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.dispatch-table th, .dispatch-table td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.dispatch-table th { font-size: 12px; color: #3d5658; background: #f1f6f4; }
.dispatch-table th:first-child { width: 54px; text-align: center; padding: 0 4px; }
.dispatch-table th:nth-child(2), .dispatch-table th:nth-child(4) { width: 20%; }
.dispatch-table th:nth-child(5) { width: 16%; }
.dispatch-table th:last-child { width: 25%; }
.dispatch-table tbody tr:hover, .dispatch-table tbody tr[data-selected="true"] { background: #f0f8f5; }
.dispatch-table td:first-child { padding: 0 4px; }
.dispatch-select-box { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
.dispatch-select-box input { width: 16px; height: 16px; margin: 0; }
.dispatch-table .record-title { font-variant-numeric: tabular-nums; }
.dispatch-table .muted { margin-top: 3px; }
.dispatch-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dispatch-status { display: inline-block; padding: 3px 8px; border: 1px solid #d8e3e0; border-radius: 6px; background: #eef4f2; color: #3c5551; font-size: 12px; font-weight: 700; }
.dispatch-status[data-stage="attention"] { color: #8a3625; border-color: #efc9bd; background: #fff0e9; }
.dispatch-status[data-stage="moving"] { color: #235278; border-color: #cbe0ef; background: #edf5fb; }
.dispatch-status[data-stage="delivered"] { color: #176149; border-color: #bfe1d2; background: #e8f6ee; }
.dispatch-empty { padding: 28px 15px; color: var(--muted); text-align: center; }
.dispatch-panel .history-pagination { margin: 0; padding: 12px; border-top: 1px solid var(--line); }
#dispatch-edit { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(410px, calc(100% - 32px)); color: inherit; overscroll-behavior: contain; }
#dispatch-edit::backdrop { background: #123c3966; }
#dispatch-edit-source { margin-bottom: 10px; text-decoration: none; }
.dispatch-actions a.button { text-decoration: none; }
.dispatch-error { color: #8a3625; margin-top: 8px; }
@media (max-width: 900px) {
  .dispatch-table { min-width: 780px; }
}
@media (max-width: 740px) {
  .dispatch-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dispatch-stage { min-height: 56px; padding: 7px 8px; font-size: 12px; }
  .dispatch-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dispatch-search { grid-column: 1 / -1; }
  .dispatch-page-select { min-height: 44px; }
  .dispatch-table, .dispatch-table tbody { display: block; min-width: 0; }
  .dispatch-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dispatch-table tbody tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; padding: 8px; border-top: 1px solid var(--line); }
  .dispatch-table td, .dispatch-table td:first-child { padding: 4px; border: 0; }
  .dispatch-table td:first-child { padding: 0; }
  .dispatch-table td:nth-child(3), .dispatch-table td:nth-child(4), .dispatch-table td:nth-child(6) { grid-column: 2 / -1; }
  .dispatch-table td:nth-child(5) { grid-column: 3; grid-row: 1; }
  .dispatch-actions .button { min-height: 44px; }
}
.history-tools { margin-top: 14px; }
input[readonly] { background: #f4f7f6; color: #4d6569; }
.tracking-note { display: block; margin-top: 4px; }
.tracking-note[data-status="exception"] { color: #8b2e20; font-weight: 700; }
.tracking-note[data-status="delivered"] { color: #126259; font-weight: 700; }
.history-actions { flex-wrap: wrap; justify-content: end; }
#official-result { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(410px, calc(100% - 32px)); color: inherit; }
#official-result::backdrop { background: #123c3966; }
#shipment-timeline { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(640px, calc(100% - 32px)); color: inherit; max-height: 85vh; overflow-y: auto; }
#shipment-timeline::backdrop { background: #123c3966; }
#shipment-timeline-context { margin-top: 8px; overflow-wrap: anywhere; }
#shipment-timeline-status, #history-timeline-count { margin-top: 4px; }
#shipment-timeline-events { list-style: none; padding: 0; margin: 10px 0 0; }
#shipment-timeline-events li { border-top: 1px solid #dce6e5; padding: 8px 0; display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 12px; overflow-wrap: anywhere; }
#shipment-timeline-events li:first-child { border-top: 0; }
#shipment-timeline-events .event-location { display: block; margin-top: 2px; }
.official-result-context { margin: 7px 0 13px; overflow-wrap: anywhere; }
.official-result-actions { margin-top: 14px; }
.paper {
  width: 210mm; min-height: 297mm; padding: 17mm 18mm; margin: 0 auto;
  background: #fff; color: #16191a; font-size: 10.5pt; line-height: 1.65;
  overflow-wrap: anywhere;
}
.paper h2 { font-size: 23pt; line-height: 1.3; text-align: center; letter-spacing: .17em; margin: 3mm 0 10mm; }
.paper p { white-space: pre-wrap; }
.paper .doc-meta, .paper .signature { text-align: right; }
.paper .doc-meta { margin-bottom: 4mm; }
.paper .identity { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 9mm; margin-bottom: 11mm; }
.paper .recipient-name { font-weight: 700; font-size: 13pt; padding-bottom: 1.7mm; border-bottom: .3mm solid #1b2121; margin-bottom: 2mm; }
.paper .sender { font-size: 9.5pt; }
.paper .sender strong { display: block; margin-bottom: 1mm; font-size: 11pt; }
.paper .subject { font-size: 13pt; margin-bottom: 5mm; text-align: center; }
.paper .letter-body { line-height: 1.8; min-height: 12mm; }
.paper .signature { margin-top: 2mm; }
.paper .enclosures { margin-top: 7mm; }
.paper .enclosures > h3 { font-size: 10.5pt; text-align: center; margin: 0 0 3mm; }
.paper .letter-end { margin-top: 3mm; text-align: right; }
.paper .print-tracking { border-top: .2mm solid #777; margin-top: 5mm; padding-top: 3mm; }
.paper table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.paper th, .paper td { border: .2mm solid #555; padding: 2.2mm 2.7mm; overflow-wrap: anywhere; }
.paper th { font-size: 9.5pt; font-weight: 700; text-align: left; }
.paper th:nth-child(1) { width: 21%; }
.paper th:nth-child(3) { width: 13%; }
.paper th:nth-child(4) { width: 13%; }
.paper td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
.paper .delivery-intro { margin-bottom: 4mm; }
.paper .notes { margin-top: 6mm; }
.paper .notes h3 { font-size: 10.5pt; margin: 0 0 1mm; }
.paper .empty-value { color: #637774; }
@media screen {
  .paper { zoom: var(--preview-scale, .59); box-shadow: 0 3px 14px #193c3426; }
  body[data-preview="cover"] #delivery, body[data-preview="delivery"] #cover, .print-instructions { display: none; }
}
@media (max-width: 950px) {
  .workspace, .master-layout { gap: 14px; }
  .panel { padding: 15px; }
  .item-grid { grid-template-columns: minmax(0, 1fr) minmax(52px, .6fr) minmax(52px, .6fr) auto; }
  .item-name { grid-column: 1 / -1; }
}
@media (max-width: 740px) {
  .header-inner { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding-top: 10px; }
  .header-inner > .button { grid-column: 2; grid-row: 1; }
  nav { grid-column: 1 / -1; grid-row: 2; gap: 0 clamp(7px, 2.4vw, 16px); flex-wrap: wrap; }
  nav button { min-height: 44px; font-size: 13px; }
  main { padding-top: 19px; }
  .page-heading { flex-wrap: wrap; margin-bottom: 16px; }
  .workspace, .master-layout { grid-template-columns: minmax(0, 1fr); }
  .preview-panel { position: static; }
  .preview-body { max-height: 68vh; }
  #shipment-list li { align-items: flex-start; flex-direction: column; }
  .history-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-search { grid-column: 1 / -1; }
  .history-actions { justify-content: start; }
}
body[data-view="billing"] { background: #f7f5f5; }
body[data-view="billing"] .app-header { display: none; }
body[data-view="billing"] main { width: 100%; padding: 0; }

#view-billing {
  --freee-blue: #285ac8;
  --freee-tint: #ebf3ff;
  --freee-muted: #f7f5f5;
  --freee-divider: #e9e7e7;
  --freee-border: #dcdcdc;
  color: #151515;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}
#view-billing button { border: 1px solid var(--freee-border); border-radius: 8px; background: #fff; color: #151515; min-height: 36px; padding: 6px 15px; }
#view-billing button:hover { background: #f7f5f5; }
#view-billing button:focus-visible, #view-billing input:focus-visible, #view-billing select:focus-visible, #view-billing textarea:focus-visible {
  outline: 2px solid var(--freee-blue); outline-offset: 2px;
}
#view-billing input:not([type="checkbox"], [type="radio"]), #view-billing select, #view-billing textarea {
  border-color: var(--freee-border); border-radius: 8px; min-height: 36px; margin-top: 4px; padding: 6px 8px; color: #151515;
}
#view-billing textarea { resize: vertical; }
#view-billing label, .billing-payment > legend { color: #151515; font-size: 12px; font-weight: 400; }
#view-billing input, #view-billing select, #view-billing textarea, .billing-payment label { font-size: 14px; }
.billing-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.billing-header {
  position: sticky; top: 0; z-index: 3; height: 48px; padding: 0 24px;
  display: flex; align-items: center; gap: 16px; background: var(--freee-tint); border-bottom: 1px solid var(--freee-divider);
}
#view-billing .billing-back { background: none; border: none; color: var(--freee-blue); min-height: auto; padding: 0; font-size: 23px; width: 13px; }
.billing-header h1 { font-size: 20px; font-weight: 400; line-height: 1.3; letter-spacing: 0; }
.billing-document-icon {
  width: 22px; height: 27px; flex: 0 0 22px; border: 2px solid var(--freee-blue); border-radius: 4px;
  background: #e5edb5; position: relative;
}
.billing-document-icon::after {
  position: absolute; content: ""; left: 3px; right: 3px; top: 5px; height: 12px;
  background: repeating-linear-gradient(to bottom, var(--freee-blue) 0 2px, transparent 2px 5px);
}
#view-billing[data-billing-kind="quote"] .billing-document-icon { background: #dcd4ff; }
#view-billing[data-billing-kind="quote"] .billing-document-icon::after {
  background: radial-gradient(circle, var(--freee-blue) 1px, transparent 2px) 0 0 / 5px 4px;
}
.billing-switch { display: flex; align-items: center; gap: 4px; margin-left: auto; }
#view-billing .billing-switch button { min-height: 28px; padding: 3px 8px; color: #333; font-size: 12px; background: transparent; border-color: transparent; }
#view-billing .billing-switch button[aria-pressed="true"] { color: var(--freee-blue); border-color: #c7d7fa; background: #fff; }

.billing-live-workspace { display: grid; grid-template-columns: minmax(0, 67fr) minmax(0, 33fr); align-items: start; }
#billing-form { min-width: 0; background: #fff; padding: 24px 24px 90px; min-height: calc(100vh - 48px); }
.billing-editor-mode { display: flex; margin: 0 0 16px; }
#view-billing .billing-editor-mode button { min-height: 24px; border-radius: 0; border-color: var(--freee-blue); padding: 0 16px; font-size: 12px; font-weight: 600; color: var(--freee-blue); }
#view-billing .billing-editor-mode button:first-child { border-radius: 4px 0 0 4px; }
#view-billing .billing-editor-mode button:last-child { border-left: 0; border-radius: 0 4px 4px 0; }
#view-billing .billing-editor-mode button[aria-pressed="true"] { color: white; background: var(--freee-blue); }
#view-billing[data-editor-mode="simple"] .billing-detail-only { display: none; }
.billing-optional { margin-left: 4px; padding: 1px 4px; border-radius: 5px; background: #f2f2f2; color: #535353; font-size: 10px; }
.billing-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .946fr); gap: 24px; align-items: start; }
.billing-group { min-width: 0; padding-bottom: 24px; border-bottom: 1px solid var(--freee-divider); }
.billing-group + .billing-group { padding-top: 16px; margin-right: 16px; }
.billing-issuer { padding-bottom: 16px; }
.billing-group h2, .billing-line-heading h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.billing-partner-fields { display: grid; grid-template-columns: minmax(0, 384px); }
#view-billing .billing-partner-fields select { width: 112px; margin-top: 28px; }
.billing-partner-fields > label:not(.billing-sr-only) { grid-column: 1 / -1; }
.billing-required { margin-left: 4px; padding: 1px 4px; border-radius: 5px; background: #f7d2d7; color: #84263d; font-size: 10px; }
.billing-display { margin-top: 8px; padding: 20px 16px; background: var(--freee-muted); }
.billing-display-heading, .billing-display summary { font-size: 14px; min-height: 28px; font-weight: 600; color: #555; }
.billing-display summary { cursor: pointer; list-style: none; }
.billing-display summary::-webkit-details-marker { display: none; }
.billing-display summary span, #view-billing .billing-link { margin-left: 20px; color: #242424; font-weight: 600; }
#view-billing .billing-link { min-height: 25px; padding: 3px 4px; border: 0; background: none; }
.billing-facts { display: grid; grid-template-columns: minmax(80px, 120px) minmax(0, 1fr); align-items: center; gap: 12px 0; margin: 16px 0 4px; font-size: 14px; }
.billing-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.billing-display .field-grid { margin-top: 14px; }
.billing-number-fields, .billing-date-fields { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.billing-number-fields { margin-bottom: 22px; }
.billing-number-fields > label:first-child { width: 168px; max-width: calc(100% - 80px); }
.billing-number-fields > label:last-child { width: 64px; }

.billing-date-fields { display: grid; grid-template-columns: minmax(0, 176px); gap: 16px; }
.billing-date-fields > label { width: 100%; }
.billing-payment { min-width: 0; border: 0; padding: 0; margin: 0; white-space: nowrap; }
.billing-payment > legend { padding: 0; }
#view-billing .billing-payment > label { display: inline-flex; gap: 5px; align-items: center; font-size: 14px; min-height: 36px; margin: 4px 5px 0 0; }
.billing-payment input, .billing-withholding input { margin: 0; accent-color: var(--freee-blue); }
.billing-subject-field { max-width: 384px; }
.billing-main-info .billing-subject-field { margin-top: 14px; }
.billing-quote-delivery { display: grid; grid-template-columns: minmax(0, 176px) minmax(0, 192px); gap: 16px; margin-top: 10px; }
.billing-delivery-details summary { cursor: pointer; font-size: 12px; }

.billing-lines { margin-top: 20px; }
.billing-line-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.billing-line-heading h2 { margin: 0; }
.billing-line-options { display: grid; gap: 8px; margin-bottom: 12px; }
#view-billing .billing-line-options label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.billing-line-options input[type="checkbox"] { margin: 0; accent-color: var(--freee-blue); }
#view-billing .billing-line-options input[name="carriedBalance"] { width: 150px; }
#view-billing .billing-small { border-radius: 8px; min-height: 24px; padding: 2px 8px; font-size: 12px; }
.billing-table-scroll { overflow: auto; }
.billing-editor-table { width: 100%; min-width: 890px; border-collapse: collapse; table-layout: fixed; }
.billing-editor-table thead { background: var(--freee-muted); }
.billing-editor-table th, .billing-editor-table td { padding: 4px; border-bottom: 1px solid var(--freee-divider); }
.billing-editor-table thead th { text-align: left; font-size: 12px; font-weight: 400; }
.billing-editor-table thead th:nth-child(1) { width: 61px; }
.billing-editor-table thead th:nth-child(2) { width: 32px; }
.billing-editor-table thead th:nth-child(4) { width: 184px; }
.billing-editor-table thead th:nth-child(5) { width: 120px; text-align: right; }
.billing-editor-table thead th:nth-child(6) { width: 72px; }
.billing-editor-table thead th:nth-child(7) { width: 120px; text-align: right; }
.billing-editor-table thead th:nth-child(8) { width: 120px; }
.billing-editor-table thead th:nth-child(9) { width: 120px; }
.billing-editor-table thead th:nth-child(10) { width: 120px; text-align: center; }
#view-billing[data-show-line-dates="true"] .billing-editor-table { min-width: 1050px; }
.billing-editor-table tbody th { font-weight: 400; text-align: left; color: #535353; }
#view-billing:not([data-show-line-dates="true"]) [data-line-date] { display: none; }
#view-billing .billing-editor-table :is(input, select) { margin-top: 0; }
.billing-editor-table :is([data-billing-field="unitPrice"], [data-billing-field="quantity"]) { text-align: right; }
#view-billing .billing-row-button { padding: 0; width: 24px; color: #333; font-size: 14px; }
.billing-withholding { display: flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 28px; }
.billing-line-amount { font-weight: 700; text-align: center; white-space: nowrap; }
.billing-add-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 8px; }
.billing-summary { width: min(300px, 100%); margin: 20px 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
#view-billing .billing-summary select { width: 64px; margin: 4px 0 0; min-height: 24px; padding: 2px 7px; font-size: 12px; }
.billing-editor-totals { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; margin: 0; padding: 14px 16px; gap: 7px 12px; background: var(--freee-muted); font-size: 13px; }
.billing-editor-totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.billing-editor-totals dt:last-of-type, .billing-editor-totals dd:last-of-type { font-weight: 700; }
.billing-bottom-fields { display: grid; gap: 18px; margin-top: 24px; }
#view-billing .billing-cancel { background: transparent; border-color: transparent; }
.billing-footer {
  position: fixed; z-index: 2; bottom: 0; inset-inline: 0; min-height: 64px; padding: 12px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: #fff; border-top: 1px solid var(--freee-divider);
}
#view-billing .billing-primary { background: var(--freee-blue); border-color: var(--freee-blue); font-weight: 700; color: #fff; }
#view-billing .billing-primary:hover { background: #294ba9; }
#billing-status { font-size: 12px; color: #555; }
.billing-footer-tools { display: flex; gap: 8px; margin-left: auto; }
.billing-dialog { color: inherit; padding: 22px; border: 1px solid var(--freee-border); border-radius: 8px; width: min(560px, calc(100vw - 24px)); }
.billing-dialog::backdrop { background: #17171755; }
.billing-dialog h2 { margin: 0 0 16px; }
.billing-dialog .field-grid, .billing-local-note { margin-bottom: 16px; }
.billing-drafts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.billing-local-note { margin-top: 10px; color: #555; font-size: 12px; }
.billing-oauth-link, #billing-freee-document { color: var(--freee-blue); }
.billing-dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
#billing-oauth-fields label { margin: 8px 0; }
.billing-review-dialog { padding: 0; width: min(980px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.billing-review-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .7fr); gap: 20px; padding: 18px; }
#billing-review-paper { min-width: 0; }
#billing-review-status { white-space: pre-wrap; overflow-wrap: anywhere; }
.billing-review-body .billing-facts { margin: 0 0 16px; }
@media (max-width: 740px) {
  .billing-review-body { grid-template-columns: minmax(0, 1fr); }
}

 .billing-live-preview {
  min-width: 0; background: var(--freee-muted); position: sticky; top: 48px;
  height: calc(100dvh - 48px); display: flex; flex-direction: column;
}
.billing-live-toolbar {
  min-height: 52px; padding: 8px 24px 8px 35px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
}
#view-billing .billing-live-toolbar select { margin: 0; width: min(100%, 176px); min-width: 75px; }
#view-billing .billing-preview-zoom {
  display: flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 36px;
  padding: 6px 8px; border: 1px solid var(--freee-border); background: #fff; border-radius: 8px;
}
.billing-preview-zoom input { margin: 0; accent-color: var(--freee-blue); }
#view-billing .billing-preview-icon { width: 36px; flex: 0 0 36px; padding: 0; font-size: 19px; color: #323232; }
.billing-live-paper { min-height: 0; overflow: auto; padding: 0 28px 75px; }
.billing-live-paper.billing-zoomed #billing-preview { min-width: 705px; }
.billing-preview { padding: 0; width: min(820px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--freee-muted); }
.billing-preview-bar { z-index: 1; position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--freee-divider); }
.billing-preview-bar h2 { font-size: 14px; font-weight: 400; margin: 0; }
.billing-fullscreen-paper { padding: 16px 28px; }
#billing-preview { width: 100%; }
.billing-paper {
  width: 100%; aspect-ratio: 210 / 297; position: relative; container-type: inline-size;
  background: #fff; color: #151515; box-shadow: 0 1px 8px #0003; overflow: hidden;
  font-family: "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}
.billing-paper + .billing-paper { margin-top: 16px; }
.billing-paper-title, .billing-paper-recipient, .billing-paper-meta, .billing-paper-issuer, .billing-paper-seal, .billing-paper-matter,
.billing-paper-amount, .billing-paper-payment, .billing-paper-lines, .billing-paper-delivery,
.billing-paper-notes, .billing-paper-tax, .billing-paper-reduced, .billing-paper-pagination { position: absolute; margin: 0; }
.billing-paper .billing-paper-title { top: 5.07%; left: 0; right: 0; text-align: center; margin: 0; font-size: 2.69cqw; line-height: 1; }
.billing-paper-recipient, .billing-paper-matter, .billing-paper-issuer { font-size: 1.51cqw; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.billing-paper-recipient { top: 12.02%; left: 7.14%; width: 46%; max-height: 15.5%; overflow: hidden; }
.billing-paper .billing-paper-company { font-size: 2.02cqw; margin-bottom: .85cqw; }
.billing-paper-meta, .billing-paper-delivery, .billing-paper-tax {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; gap: .45cqw .4cqw;
  font-size: 1.51cqw; line-height: 1.38;
}
.billing-paper :is(.billing-paper-meta,.billing-paper-delivery,.billing-paper-tax) dd { margin: 0; overflow-wrap: anywhere; }
.billing-paper-meta { top: 12.02%; left: 60.48%; right: 7.14%; }
.billing-paper-meta dd, .billing-paper-tax dd { text-align: right; }
.billing-paper-issuer { top: 22.59%; left: 60.48%; right: 7.14%; max-height: 14%; overflow: hidden; }
.billing-paper-issuer p:last-child { letter-spacing: -.035cqw; }
.billing-paper-seal { top: 22.57%; left: 62.63%; width: 12.24%; height: auto; }
#view-billing[data-billing-kind="quote"] .billing-paper-seal { width: 10.2%; }
.billing-paper-matter { top: 28.16%; left: 7.14%; width: 49.6%; height: 4%; overflow: hidden; }
.billing-paper :is(.billing-paper-amount,.billing-paper-payment,.billing-paper-lines) {
  border-collapse: collapse; table-layout: fixed; color: inherit; font-size: 1.51cqw; line-height: 1.05;
}
.billing-paper :is(th,td) { border: .15cqw solid #303030; padding: .18cqw .45cqw; vertical-align: middle; overflow-wrap: anywhere; }
.billing-paper th { font-weight: 400; text-align: center; }
.billing-paper-amount { top: 32.53%; left: 7.14%; width: 49.6%; height: 5.44%; }
.billing-paper-amount th:first-child { width: 29%; }
.billing-paper-amount th:nth-child(2) { width: 25%; }
.billing-paper-amount td, .billing-paper-lines td:not(:first-child) { text-align: right; }
.billing-paper-amount td:last-child { font-size: 2.69cqw; font-weight: 600; }
#view-billing[data-billing-kind="quote"] .billing-paper-amount th:first-child { width: 25%; }
.billing-paper-payment { top: 38.86%; left: 7.14%; width: 49.6%; height: 5.48%; }
.billing-paper-payment th:first-child { width: 29%; }
.billing-paper-payment td { white-space: pre-wrap; }
.billing-paper-lines { top: 45.91%; left: 7.14%; width: 85.72%; height: 38.62%; }
#view-billing[data-billing-kind="quote"] .billing-paper-lines { top: 39.85%; }
.billing-paper-lines tr { height: 5.5556%; }
.billing-paper-lines td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.billing-paper-lines th:nth-last-child(3) { width: 12.15%; }
.billing-paper-lines th:nth-last-child(2) { width: 13.3%; }
.billing-paper-lines th:last-child { width: 16.8%; }
.billing-paper-lines-dated th:first-child { width: 18%; }
.billing-paper-delivery { top: 82.84%; left: 7.14%; width: 46%; }
.billing-paper-tax { top: 84.95%; left: 59%; right: 7.14%; font-size: 1.18cqw; line-height: 1.08; gap: .08cqw .4cqw; }
.billing-paper-reduced { top: 84.95%; left: 7.14%; font-size: 1.1cqw; }
#view-billing[data-billing-kind="quote"] .billing-paper-reduced { top: 78.86%; }
.billing-paper-notes {
  top: 87.57%; left: 7.14%; right: 7.14%; height: 7.5%; border: .15cqw solid #303030; padding: .4cqw 2.5cqw;
  font-size: 1.51cqw; white-space: pre-wrap; overflow: auto;
}
.billing-paper-pagination { top: 96.36%; left: 0; right: 0; text-align: center; font-size: 1.51cqw; }
@media (max-width: 740px) {
  .billing-header { padding-inline: 14px; gap: 8px; }
  .billing-header h1 { font-size: 16px; }
  #view-billing .billing-switch button { padding-inline: 4px; }
  .billing-live-workspace { grid-template-columns: 1fr; }
  #billing-form { padding-inline: 14px; padding-bottom: 24px; }
  .billing-live-preview { position: static; height: auto; margin-bottom: 110px; }
  .billing-live-toolbar { padding-inline: 14px; }
  .billing-live-paper { padding-inline: 14px; }
  .billing-columns { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .billing-group + .billing-group { margin-right: 0; }
  .billing-footer { padding-inline: 14px; gap: 6px; }
  .billing-footer-tools { margin-left: 0; }
  #billing-status { order: 2; flex-basis: 100%; }
}
@page { size: A4; margin: 17mm 18mm; }
@media print {
  html, body { background: #fff; }
  .app-header, .page-heading, #shipment, .preview-head, .preview-actions, #app-feedback,
  #view-billing, #view-catalog, #view-issuers, #view-history, #view-shipments, #dispatch-edit, #official-result, #shipment-timeline { display: none !important; }
  main, .workspace, .preview-panel, .preview-body { display: block; margin: 0; padding: 0; width: auto; background: none; border: 0; border-radius: 0; overflow: visible; max-height: none; min-height: 0; position: static; }
  .paper { display: none; width: auto; min-height: 0; padding: 0; margin: 0; }
  body[data-print] #view-documents { display: block !important; }
  body[data-print="cover"] #cover, body[data-print="delivery"] #delivery, body[data-print="both"] .paper { display: block; }
  body[data-print="both"] #delivery { break-before: page; }
  .paper .identity { display: flex; align-items: flex-start; break-inside: avoid; }
  .paper .identity > :first-child { flex: 1.15 1 0; min-width: 0; }
  .paper .identity > :last-child { flex: 1 1 0; min-width: 0; }
  .paper thead { display: table-header-group; }
  .paper tr { break-inside: avoid; }
  .paper .notes, .paper .print-tracking { break-inside: avoid; }
  .paper .empty-value { display: none; }
  body[data-print] .print-instructions { display: none; }
}


/* Shared visual language for document preparation and dispatch operations. */
.app-header { background:#fff;color:#223438;border-bottom:1px solid #dfe6e7 }
.app-header nav button,.app-header nav .local-billing-link { color:#607276 }
.app-header nav button[aria-current],.app-header nav button:hover,.app-header nav .local-billing-link:hover { color:#115247 }
.app-header nav button[aria-current] { border-bottom-color:#176b60 }
.app-header .finance-link { background:#edf5f1;color:#115247;border-color:#dfe6e7 }
.page-heading h1 { font-size:28px;letter-spacing:-.03em }
.button { min-height:40px;border-radius:8px }
.dispatch-source-context { margin:-10px 0 18px;font-size:13px }
.cover-template-controls { padding:12px;background:#f4f8f6;border-radius:8px;margin-bottom:8px;align-items:end }
.cover-template-hint { margin-bottom:12px }
.template-library-link { color:var(--accent);font-size:12px;padding:10px 0;text-underline-offset:3px }
.dispatch-source-context a { color:#176b60;text-underline-offset:4px;font-weight:600 }
.dispatch-stages { gap:10px }
.dispatch-stages .dispatch-stage { display:flex;align-items:center;justify-content:space-between;min-height:58px;border-radius:10px;padding:12px 16px }
.dispatch-stage strong { font-size:22px }
.dispatch-filters { padding:20px;gap:14px }
.dispatch-toolbar { padding:12px 20px;background:#fafcfb }
.dispatch-table th { padding-block:12px;background:#f5f8f7 }
.dispatch-table td { padding-block:18px }
.dispatch-actions .button:first-child { background:#176b60;color:white;border-color:#176b60 }
.dispatch-actions .button:not(:first-child) { border-color:#e1e8e6;font-size:12px }
.panel.dispatch-panel { border-radius:12px;box-shadow:0 2px 6px #20372d04 }
@media(max-width:740px) {
  .dispatch-table tbody td,.dispatch-table tbody td:first-child { padding:6px 4px }
  .dispatch-stages { grid-template-columns:repeat(5,minmax(100px,1fr));overflow-x:auto;padding-bottom:4px }
  .dispatch-stages .dispatch-stage { padding:10px 12px;gap:8px;min-height:50px;font-size:12px }
  .dispatch-stage strong { font-size:18px }
  .dispatch-filters { padding:14px }
  .dispatch-toolbar { padding:10px 14px }
  .dispatch-bulk .button:disabled { display:none }
  .button { min-height:44px }
}
.paper .cover-items-title { font-size:11pt; margin:6mm 0 3mm; }
.paper .cover-items th:first-child { width:76%; }
.paper .cover-items th:last-child, .paper .cover-items td:last-child { width:24%; text-align:right; }

.freee-workspace-account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 24px; color: #19332e; background: #fff; border-bottom: 1px solid #e1e6e5; }
.freee-workspace-account #freee-operator { margin-inline-start: auto; }
.freee-login { margin: 10vh auto; padding: 32px; width: min(470px, 93%); background: #fff; border: 1px solid #dcdfe5; border-radius: 12px; }
.freee-login h1 { margin: 6px 0 12px; }
.freee-login p { margin: 0 0 16px; }
.freee-login a { display: inline-block; padding: 10px 16px; background: #285ac8; color: #fff; border-radius: 8px; text-decoration: none; }
.freee-login a:focus-visible { outline: 2px solid #285ac8; outline-offset: 3px; }
