:root {
  --ink: #17202a;
  --muted: #5d6d7e;
  --line: #d7dee8;
  --panel: #ffffff;
  --wash: #f2f6f8;
  --night: #243447;
  --accent: #0b7fab;
  --accent-dark: #075f81;
  --ok: #138a52;
  --danger: #c0392b;
  --warning: #f4b942;
  --touch: 68px;
}

html {
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  background: var(--wash);
}

button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 6px 24px;
  background: var(--night);
  color: white;
}

.eyebrow {
  margin: 0 0 2px;
  color: #c8d8e4;
  font-size: 14px;
  font-weight: 700;
}

.receiver-status { min-width: 0; max-width: 400px; margin-left: auto; display: grid; gap: 3px; font-size: 13px; }
.receiver-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #a5e5c1; }
.receiver-status span.warning { color: #ffd17c; }
.receiver-status small { color: #c8d8e4; font-size: 12px; }
@media (max-width: 700px) {
  .receiver-status { margin-left: 0; max-width: 100%; }
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
}

.scale-panel {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: baseline;
  min-width: 330px;
  justify-content: end;
}

.scale-label {
  color: #c8d8e4;
  font-weight: 700;
}

#currentWeight {
  font-size: 40px;
  line-height: 1;
}

.unit {
  font-size: 24px;
  font-weight: 800;
}

main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 16px 20px;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin: 0 auto 6px;
  max-width: 1220px;
}

.mode-tabs button {
  min-height: 42px;
  padding: 0 28px;
  color: var(--night);
  background: #dde7ef;
}

.mode-tabs .active {
  color: white;
  background: var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#tabletView {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  height: calc(100vh - 138px);
  max-width: 1220px;
  margin: 0 auto;
}

#tabletView.active {
  display: grid;
}

.progress-panel {
  grid-row: 1;
  min-height: 34px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.progress-panel ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.progress-panel li {
  position: relative;
  min-width: 120px;
  color: #6d7f88;
  background: #d4dde4;
  font-size: 17px;
  font-weight: 800;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%, 18px 50%);
  margin-left: -12px;
  opacity: 0.72;
}

.progress-panel li:first-child {
  margin-left: 0;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%);
}

.progress-panel li button {
  width: 100%;
  min-height: 32px;
  padding: 0 24px 0 28px;
  color: inherit;
  background: transparent;
  text-align: center;
}

.progress-panel li:not(.reachable) button {
  cursor: default;
}

.progress-panel li.done {
  color: #12313b;
  background: #a8d7dc;
  opacity: 1;
}

.progress-panel li.reachable:not(.active):not(.done) {
  color: #24434d;
  background: #c8e2e5;
  opacity: 0.95;
}

.progress-panel li.active {
  color: #102d36;
  background: #8fd2d9;
  opacity: 1;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.14);
}

.tablet-screen {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 16px 28px;
  border-radius: 8px;
  background: #314052;
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.tablet-footer {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 2px;
}

.tablet-footer button {
  min-height: 44px;
  color: #eaf4f8;
  background: #415164;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.16);
  font-size: 20px;
  font-weight: 900;
}

.tablet-footer button:hover,
.tablet-footer button:focus-visible {
  background: #4e6175;
  outline: 2px solid #78d7e8;
  outline-offset: 1px;
}

#cancelButton {
  color: #ffffff;
  background: #6a5360;
}

#backButton {
  background: #2f6679;
}

.step {
  display: none;
  height: 100%;
}

.step.active {
  display: block;
}

#confirmStep.step.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

#confirmStep .large-prompt {
  margin-bottom: 12px;
  font-size: 36px;
}

.center-stage {
  min-height: 610px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  text-align: center;
}

.large-prompt {
  margin: 0 0 12px;
  font-size: 36px;
  line-height: 1.2;
  font-weight: 900;
}

.start-button {
  width: min(360px, 80vw);
  aspect-ratio: 1;
  border-radius: 50%;
  color: white;
  background: radial-gradient(circle at 35% 28%, #78d7e8, #008bb5 72%);
  font-size: 58px;
  box-shadow: 0 16px 0 rgba(0, 0, 0, 0.2);
}

.start-button.small {
  width: 230px;
  font-size: 34px;
}

.done-actions {
  display: grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 24px;
}

.large-action {
  min-width: 230px;
  min-height: 104px;
  font-size: 34px;
}

.status-text {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #dce9ef;
}

.assist-text {
  margin: 16px 0 0;
  color: #dce9ef;
  font-size: 24px;
  font-weight: 800;
}

.input-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(340px, 430px);
  gap: 28px;
  align-items: start;
}

.big-output {
  display: block;
  width: 100%;
  min-height: 88px;
  margin-bottom: 12px;
  padding: 12px 22px;
  border: 3px solid #5fb7db;
  border-radius: 8px;
  color: #10202d;
  background: white;
  font-size: 64px;
  line-height: 1;
  font-weight: 900;
  text-align: right;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad button,
.selection-grid button,
.quick-grid button,
.weight-actions button {
  min-height: var(--touch);
  color: #1d2b36;
  background: linear-gradient(#ffffff, #dce5ec);
  border: 1px solid #aeb9c4;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.1);
  font-size: 30px;
}

.keypad .wide {
  grid-column: span 2;
}

.keypad .action-key {
  margin-top: 12px;
}

.keypad .enter-wide {
  grid-column: span 2;
}

.keypad .danger {
  color: white;
  background: var(--danger);
}

.keypad .enter {
  color: white;
  background: var(--ok);
}

.quick-grid,
.weight-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quick-grid button,
.weight-actions button {
  min-height: 86px;
  font-size: 24px;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.selection-grid button {
  min-height: 94px;
  padding: 12px;
  text-align: left;
  font-size: 26px;
}

.selection-grid small {
  display: block;
  margin-top: 6px;
  color: #53626e;
  font-size: 18px;
}

.chooser-layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(340px, 430px);
  gap: 28px;
  height: calc(100% - 64px);
  min-height: 0;
}

.chooser-main,
.chooser-side {
  min-height: 0;
}

.chooser-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #dce9ef;
  font-size: 22px;
  font-weight: 900;
}

.chooser-reset {
  min-height: 46px;
  padding: 0 18px;
  color: var(--night);
  background: #dce5ec;
  font-size: 18px;
}

.code-panel,
.kana-panel {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.kana-panel {
  margin-top: 12px;
}

.code-panel {
  padding: 0;
  background: transparent;
}

.kana-panel > span {
  display: block;
  margin-bottom: 8px;
  color: #dce9ef;
  font-size: 20px;
  font-weight: 900;
}

.code-output {
  display: block;
  min-height: 88px;
  margin-bottom: 12px;
  padding: 12px 22px;
  border: 3px solid #5fb7db;
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font-size: 64px;
  line-height: 1;
  font-weight: 900;
  text-align: right;
}

.mini-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mini-keypad button {
  min-height: var(--touch);
  color: #1d2b36;
  background: linear-gradient(#ffffff, #dce5ec);
  border: 1px solid #aeb9c4;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.1);
  font-size: 30px;
}

.kana-grid button {
  min-height: 42px;
  color: #1d2b36;
  background: linear-gradient(#ffffff, #dce5ec);
  border: 1px solid #aeb9c4;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.1);
  font-size: 20px;
}

.mini-keypad .danger {
  color: white;
  background: var(--danger);
}

.mini-keypad .enter {
  color: white;
  background: var(--ok);
}

.mini-keypad .wide {
  grid-column: span 2;
}

.mini-keypad .action-key {
  margin-top: 12px;
}

.mini-keypad .enter-wide {
  grid-column: span 2;
}

.kana-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.kana-grid button.active {
  color: white;
  background: var(--accent);
}

.empty-choice {
  display: grid;
  place-items: center;
  min-height: 94px;
  border-radius: 8px;
  color: #dce9ef;
  background: rgba(255, 255, 255, 0.12);
  font-size: 24px;
  font-weight: 900;
}

.confirm-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
}

.summary-card {
  min-height: 76px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.summary-card span {
  color: var(--muted);
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1.15;
}

.delivery-note {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 12px 22px;
  border-radius: 2px;
  color: #263b43;
  background: #d6f4ef;
  border: 2px solid #4f777a;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.delivery-note h2 {
  width: 190px;
  margin: 0 auto 6px;
  padding-bottom: 2px;
  border-bottom: 3px double #4f777a;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
  color: #142d34;
}

.note-date-line {
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 2px solid #6b9292;
  border-bottom: 0;
  font-weight: 800;
}

.note-date-line strong {
  min-width: 32px;
  min-height: 20px;
  padding: 0 4px;
  border-bottom: 1px solid #4f777a;
  text-align: center;
  font-size: 16px;
}

.note-job-line {
  display: grid;
  grid-template-columns: 110px 1fr;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border: 2px solid #6b9292;
}

.note-job-line span,
.note-party-grid span,
.note-vehicle-grid span,
.note-remarks span {
  color: #405f65;
  font-weight: 800;
}

.note-party-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  min-height: 62px;
  border-left: 2px solid #6b9292;
  border-right: 2px solid #6b9292;
  border-bottom: 2px solid #6b9292;
}

.note-customer {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 14px;
  padding: 8px 12px 10px;
  border-right: 2px solid #6b9292;
}

.note-customer strong {
  max-width: 100%;
  border-bottom: 1px solid #4f777a;
  font-size: 21px;
  line-height: 1.25;
}

.note-customer span {
  font-size: 19px;
}

.note-site {
  display: grid;
  grid-template-rows: 24px 1fr;
}

.note-site span {
  display: grid;
  place-items: center;
  border-bottom: 1px solid #6b9292;
}

.note-site strong {
  padding: 6px;
  font-size: 16px;
}

.note-vehicle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 46px;
  border-left: 2px solid #6b9292;
  border-right: 2px solid #6b9292;
  border-bottom: 2px solid #6b9292;
}

.note-vehicle-grid > div {
  display: grid;
  grid-template-rows: 22px 1fr;
  text-align: center;
}

.note-vehicle-grid > div:first-child {
  border-right: 2px solid #6b9292;
}

.note-vehicle-grid span {
  display: grid;
  place-items: center;
  border-bottom: 1px solid #6b9292;
}

.note-vehicle-grid strong {
  display: grid;
  place-items: center;
  font-size: 19px;
}

.note-items {
  width: 100%;
  border-collapse: collapse;
}

.note-items th,
.note-items td {
  height: 32px;
  border: 2px solid #6b9292;
  padding: 5px;
  text-align: center;
}

.note-items th {
  color: #263b43;
  font-size: 15px;
}

.note-items td:first-child {
  width: 46%;
}

.note-items td:nth-child(2),
.note-items td:nth-child(3) {
  width: 27%;
}

.note-remarks {
  display: grid;
  grid-template-rows: 24px 1fr;
  min-height: 48px;
  border-left: 2px solid #6b9292;
  border-right: 2px solid #6b9292;
  border-bottom: 2px solid #6b9292;
}

.note-remarks span {
  display: flex;
  align-items: center;
  padding-left: 10px;
  border-bottom: 1px solid #6b9292;
  font-size: 15px;
}

.note-remarks strong {
  padding: 4px 8px;
  font-size: 15px;
}

.note-footer {
  min-height: 68px;
  border-left: 2px solid #6b9292;
  border-right: 2px solid #6b9292;
  border-bottom: 2px solid #6b9292;
}

.note-company {
  display: grid;
  align-content: end;
  gap: 2px;
  padding: 6px 10px 7px;
}

.note-company p {
  margin: 0;
  padding-bottom: 2px;
  border-bottom: 2px solid #4f777a;
  color: #17202a;
  font-size: 21px;
  font-weight: 900;
}

.note-company span {
  font-size: 9px;
  font-weight: 700;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 12px;
}

.primary,
.secondary {
  min-height: 58px;
  padding: 0 34px;
  font-size: 24px;
}

.primary {
  color: white;
  background: var(--ok);
}

.secondary {
  color: var(--night);
  background: #dce5ec;
}

.office-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  height: calc(100vh - 154px);
  max-width: 1220px;
  margin: 0 auto;
}

.weighing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  height: calc(100vh - 154px);
  max-width: 1220px;
  margin: 0 auto;
}

.office-main,
.office-side > *,
.weighing-main,
.scale-preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.office-main,
.weighing-main {
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.list-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading .eyebrow {
  color: var(--accent-dark);
}

#exportCsv {
  min-width: 220px;
  font-size: 22px;
}

.csv-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.csv-actions .secondary {
  min-height: 44px;
  padding: 0 14px;
  font-size: 16px;
}

.csv-actions .primary {
  min-height: 58px;
  padding: 0 26px;
}

.table-wrap {
  min-height: 0;
  max-height: calc(100vh - 338px);
  overflow: auto;
}

.office-tabs,
.master-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.csv-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.office-tabs button,
.master-tabs button {
  min-height: 36px;
  padding: 0 14px;
  color: var(--night);
  background: #dde7ef;
  font-size: 16px;
}

.office-tabs button.active,
.master-tabs button.active {
  color: white;
  background: var(--accent);
}

.office-panel {
  display: none;
}

.office-panel.active {
  display: grid;
  min-height: 0;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
}

.delivery-records-table {
  table-layout: fixed;
  font-size: 13px;
}

.weighing-results-table {
  table-layout: fixed;
  font-size: 13px;
}

.records-table th,
.records-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.records-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f7fafc;
}

.delivery-records-table th,
.delivery-records-table td {
  overflow: hidden;
  padding: 9px 5px;
  text-overflow: ellipsis;
}

.delivery-records-table th:nth-child(1),
.delivery-records-table td:nth-child(1) {
  width: 11%;
}

.delivery-records-table th:nth-child(2),
.delivery-records-table td:nth-child(2) {
  width: 6%;
}

.delivery-records-table th:nth-child(3),
.delivery-records-table td:nth-child(3) {
  width: 10%;
}

.delivery-records-table th:nth-child(4),
.delivery-records-table td:nth-child(4) {
  width: 10%;
}

.delivery-records-table th:nth-child(5),
.delivery-records-table td:nth-child(5) {
  width: 11%;
}

.delivery-records-table th:nth-child(6),
.delivery-records-table td:nth-child(6) {
  width: 9%;
}

.delivery-records-table th:nth-child(7),
.delivery-records-table td:nth-child(7) {
  width: 8%;
}

.delivery-records-table th:nth-child(8),
.delivery-records-table td:nth-child(8) {
  width: 8%;
}

.delivery-records-table th:nth-child(9),
.delivery-records-table td:nth-child(9) {
  width: 10%;
}

.delivery-records-table th:nth-child(10),
.delivery-records-table td:nth-child(10) {
  width: 10%;
  text-align: center;
}

.sort-header {
  min-height: 24px;
  padding: 0;
  color: inherit;
  background: transparent;
  border-radius: 0;
  font-size: inherit;
  font-weight: 900;
}

.trade-select {
  width: 100%;
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-weight: 800;
}

.weighing-table-wrap {
  max-height: calc(100vh - 258px);
}

.weighing-results-table th,
.weighing-results-table td {
  overflow: hidden;
  padding: 10px 8px;
  text-overflow: ellipsis;
}

.weighing-results-table tr.selected td {
  background: #e7f4fb;
}

.delivery-records-table tr.selected td {
  background: #e7f4fb;
}

.weighing-results-table th:nth-child(1),
.weighing-results-table td:nth-child(1) {
  width: 13%;
}

.weighing-results-table th:nth-child(2),
.weighing-results-table td:nth-child(2) {
  width: 7%;
}

.weighing-results-table th:nth-child(3),
.weighing-results-table td:nth-child(3) {
  width: 11%;
}

.weighing-results-table th:nth-child(4),
.weighing-results-table td:nth-child(4) {
  width: 10%;
}

.weighing-results-table th:nth-child(5),
.weighing-results-table td:nth-child(5) {
  width: 10%;
}

.weighing-results-table th:nth-child(6),
.weighing-results-table td:nth-child(6) {
  width: 9%;
}

.weighing-results-table th:nth-child(7),
.weighing-results-table td:nth-child(7) {
  width: 8%;
}

.weighing-results-table th:nth-child(8),
.weighing-results-table td:nth-child(8) {
  width: 8%;
}

.weighing-results-table th:nth-child(9),
.weighing-results-table td:nth-child(9) {
  width: 9%;
}

.weighing-results-table th:nth-child(10),
.weighing-results-table td:nth-child(10) {
  width: 10%;
  text-align: center;
}

.print-action {
  min-width: 58px;
}

.scale-preview-panel {
  min-height: 0;
  overflow: hidden;
  padding: 16px;
}

.office-preview-panel {
  display: grid;
  min-height: 0;
}

.preview-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  color: var(--muted);
  text-align: center;
}

.preview-empty strong,
.preview-header strong {
  color: var(--ink);
  font-size: 20px;
}

.preview-empty span,
.preview-header span {
  font-size: 13px;
  font-weight: 800;
}

.preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-note {
  height: calc(100vh - 286px);
  padding: 10px 16px;
}

.preview-note h2 {
  font-size: 21px;
}

.preview-note .note-date-line,
.preview-note .note-job-line {
  min-height: 26px;
}

.preview-note .note-party-grid {
  min-height: 56px;
}

.preview-note .note-vehicle-grid {
  min-height: 42px;
}

.preview-note .note-items th,
.preview-note .note-items td {
  height: 28px;
}

.preview-note .note-footer {
  min-height: 62px;
}

.preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.preview-actions .primary {
  min-width: 150px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
}

.status-pill.done {
  color: #11613a;
  background: #dff4e9;
}

.status-pill.pending {
  color: #8a4c00;
  background: #fff0cf;
}

.compact-table th,
.compact-table td {
  padding: 10px;
}

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  min-height: 30px;
  padding: 0 6px;
  color: white;
  background: var(--accent);
  border-radius: 6px;
  font-size: 14px;
}

.danger-link {
  background: var(--danger);
}

.master-editor {
  display: grid;
  gap: 14px;
}

.master-csv-actions {
  display: grid;
  grid-template-columns: 84px 84px;
  gap: 8px;
  align-items: center;
}

.master-csv-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 14px;
}

.master-form {
  display: grid;
  grid-template-columns: 82px minmax(150px, 1fr) 56px 62px 82px 90px 104px;
  gap: 8px;
  align-items: center;
}

.master-form input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.master-form .ghost-field {
  visibility: hidden;
  pointer-events: none;
}

#masterVehicleWeight { grid-column: 3 / 6; grid-row: 1; }
#masterVehicleWeight[hidden] { display: none; }
.vehicle-master-form .ghost-field { display: none; }
.vehicle-weight-summary { line-height: 1.6; font-size: 18px; color: #fff; }
.vehicle-weight-summary strong { display: block; font-size: 24px; }

.master-form .primary {
  width: 104px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 16px;
}

.office-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.master-box {
  padding: 18px;
}

.master-box h3 {
  margin-bottom: 12px;
}

.master-box dl,
.master-box ul {
  margin: 0;
}

.master-box dt {
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.master-box dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.master-box li {
  margin-bottom: 8px;
}

#printArea {
  display: none;
}

.print-note {
  color: #000;
  font-family: "Yu Gothic", "Meiryo", sans-serif;
}

.print-note h1 {
  text-align: center;
  letter-spacing: 0;
}

.print-note table {
  width: 100%;
  border-collapse: collapse;
}

.print-note th,
.print-note td {
  border: 1px solid #000;
  padding: 10px;
  text-align: center;
}

@media print {
  body > .app-shell {
    display: none;
  }

  #printArea {
    display: block;
  }
}

@media (max-width: 880px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .scale-panel {
    min-width: 0;
    justify-content: start;
  }

  #tabletView.active,
  .input-layout,
  .confirm-layout,
  .office-grid,
  .weighing-grid {
    grid-template-columns: 1fr;
  }

  .progress-panel li {
    min-width: 92px;
    font-size: 14px;
    text-align: center;
  }

  .tablet-screen {
    min-height: 620px;
    padding: 18px;
  }

  .selection-grid,
  .quick-grid,
  .weight-actions {
    grid-template-columns: 1fr;
  }

  .action-row {
    flex-direction: column;
  }
}

[hidden] { display: none !important; }
button:disabled, select:disabled { opacity: 0.6; cursor: default; }
.delivery-login { height: 100dvh; display: grid; place-items: center; }
.delivery-login form { display: grid; width: min(360px, 90%); gap: 20px; }
.delivery-login label { display: grid; gap: 8px; }
.delivery-login input { min-height: 44px; font: inherit; padding: 8px; }
.delivery-message { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); max-width: min(640px, 90%); padding: 10px 16px; margin: 0; border: 1px solid #bac9ce; border-radius: 4px; background: #fff; color: #17202a; z-index: 20; box-shadow: 0 2px 8px #0002; }
.delivery-message:empty { display: none; }
.management-link { align-self: center; margin-left: auto; color: #075f81; font-size: 14px; }
#deliverySync { align-self: center; font-size: 12px; color: var(--muted); }
.center-stage { min-height: 0; height: 100%; gap: 20px; }
.start-button { width: min(300px, 70%); }
.summary-card strong { overflow-wrap: anywhere; font-size: 21px; }
.summary-card label { display: grid; gap: 6px; font-size: 14px; color: #5a6b78; }
.summary-card .trade-select { width: 100%; min-height: 32px; font-size: 18px; }
.note-customer strong { overflow-wrap: anywhere; min-width: 0; }
.office-grid, .weighing-grid { max-width: 1480px; grid-template-columns: minmax(0, 1fr) 360px; }
.office-main { display: flex; flex-direction: column; }
.office-panel.active { flex: 1; min-height: 0; }
.master-editor { min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
#mastersPanel.active { grid-template-rows: auto minmax(0, 1fr); }
.master-tabs { align-self: start; align-items: start; flex-wrap: wrap; }
.master-tabs button { height: 36px; flex: 0 0 72px; padding: 0 12px; font-size: 14px; }
.table-wrap { max-height: none; }
.weighing-main { display: flex; flex-direction: column; }
.weighing-table-wrap { flex: 1; }
.export-history { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; flex-wrap: wrap; }
.export-history button { min-height: 30px; padding: 0 10px; background: #dde7ef; }
.export-history select { max-width: 230px; height: 30px; font: inherit; }
.master-form { grid-template-columns: 82px minmax(100px, 1fr) 48px 52px 64px 70px 104px; }
.master-form button { grid-column: 7; grid-row: 1; }
#masterYayoiCode { grid-column: 1 / span 2; grid-row: 2; }
#masterDeviceCode { grid-column: 3 / span 3; grid-row: 2; }
.scale-preview-panel { display: flex; flex-direction: column; gap: 10px; }
.preview-header { flex: none; margin: 0; flex-wrap: wrap; }
.preview-note { flex: 1; height: auto; overflow: auto; }
.preview-note .note-date-line { gap: 3px; padding: 0 4px; font-size: 12px; white-space: nowrap; }
.preview-note .note-date-line strong { min-width: 18px; padding: 0 2px; font-size: 13px; }
.preview-note .note-customer { padding: 6px; gap: 5px; }
.preview-note .note-customer strong, .preview-note .note-customer span { font-size: 15px; }
.preview-note .note-company p { font-size: 17px; }
.status-pill { white-space: nowrap; padding: 0 6px; font-size: 12px; border-radius: 4px; }
.code-review-label { color: #8b4600; font-weight: 700; }
.demo-receiver { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; font-size: 12px; }
.demo-receiver label { display: flex; align-items: center; gap: 4px; }
.demo-receiver select, .demo-receiver button { min-height: 32px; font: inherit; padding: 0 8px; border: 1px solid #bccbd5; border-radius: 4px; background: #eef4f7; color: #17202a; }
.demo-badge { display: inline-block; margin-left: 4px; padding: 2px 4px; color: #82520c; background: #fff0cc; font-size: 11px; border-radius: 4px; }
.weighing-results-table tr.new-arrival td { animation: arrival-fade 10s linear both; animation-delay: var(--arrival-delay, 0ms); }
@keyframes arrival-fade {
  from { box-shadow: inset 0 0 0 9999px rgb(255 187 55 / 65%); }
  to { box-shadow: inset 0 0 0 9999px rgb(255 187 55 / 0%); }
}
.new-arrival .new-arrival-badge { animation: arrival-label-fade 10s linear both; animation-delay: var(--arrival-delay, 0ms); }
@keyframes arrival-label-fade { from { opacity: 1; } to { opacity: 0; } }
.new-arrival-badge { display: inline-block; margin-left: 4px; color: #805600; font-size: 11px; font-weight: 700; }
.estimate-label { display: block; color: #5a6b78; font-size: 11px; }
.records-table th.attention-column, .records-table td.attention-column { width: 56px; text-align: center; }
.delivery-records-table th:nth-child(10), .delivery-records-table td:nth-child(10),
.weighing-results-table th:nth-child(10), .weighing-results-table td:nth-child(10) { width: 56px; }
.delivery-records-table th:first-child, .delivery-records-table td:first-child,
.weighing-results-table th:first-child, .weighing-results-table td:first-child { width: 9%; }
.attention-toggle { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; }
.attention-toggle:has(input:checked) { background: #fff0c5; }
.attention-toggle:has(input:focus-visible) { outline: 2px solid #087fa5; outline-offset: -2px; }
.attention-toggle input { width: 24px; height: 24px; margin: 0; accent-color: #a66b00; cursor: inherit; }
.attention-toggle:has(input:disabled) { cursor: not-allowed; opacity: 0.55; }
.weighing-results-table .table-action { min-height: 48px; }
.table-load-more { display: block; margin-left: auto; min-height: 48px; padding: 8px 20px; font-size: 14px; }
.chooser-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; }
.chooser-main .selection-grid { min-height: 0; overflow: auto; align-content: start; grid-auto-rows: minmax(94px, max-content); }
.selection-grid button { overflow-wrap: anywhere; }
@media (max-width: 980px) { .chooser-main .selection-grid { min-height: 140px; max-height: 300px; } }
.weight-source-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.weight-source-tabs button, #liveDemoControls button { min-height: 40px; padding: 8px 16px; font-size: 16px; }
.weight-source-tabs button.active { background: #087fa5; color: white; }
#liveWeightPanel { display: grid; gap: 12px; }
#liveWeightPanel label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 16px; }
#liveWeightPanel select, #liveTare { max-width: 100%; min-height: 40px; font: inherit; padding: 4px 8px; }
#liveWeightStatus { margin: 0; font-size: 14px; }
#liveWeightPanel .enter, #continueReceivedWeight { min-height: 52px; font-size: 20px; padding: 8px 16px; }
#continueReceivedWeight { background: #10894f; color: white; border-radius: 6px; }
#grossStep .keypad .live-confirm-button { font-size: 20px; }
#grossStep .keypad button:disabled { opacity: 0.45; cursor: not-allowed; }
#captureLiveWeight:disabled { background: #617069; color: #cdd6d0; cursor: not-allowed; }
#liveDemoControls { display: flex; gap: 8px; }
#receivedWeightLock { font-size: 18px; }
.code-register-link { color: #8b4600; background: transparent; border: 0; padding: 0; min-height: 28px; font: inherit; font-weight: 700; text-decoration: underline; }
.received-master-dialog { width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow: auto; padding: 24px; border: 1px solid #bccbd5; border-radius: 8px; color: #17202a; background: white; }
.received-master-dialog::backdrop { background: #17202a88; }
.received-master-dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 90px); }
.received-master-dialog h2 { margin: 0 0 18px; font-size: 22px; }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; border: 0; padding: 2px; margin: 0; min-width: 0; min-height: 0; overflow: auto; }
.received-master-dialog h2, .dialog-notice, .dialog-error, .dialog-actions { flex-shrink: 0; }
.dialog-fields label { display: grid; gap: 6px; font-size: 14px; }
.dialog-fields input, .dialog-fields select { width: 100%; min-width: 0; height: 40px; padding: 0 10px; font: inherit; border: 1px solid #bccbd5; border-radius: 4px; background: white; color: #17202a; }
.dialog-notice { margin: 0 0 16px; color: #765200; font-size: 14px; }
.dialog-error { color: #b02720; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dialog-actions button { min-height: 40px; padding: 0 20px; font-size: 16px; }
@media (max-width: 480px) { .dialog-fields { grid-template-columns: 1fr; } }
.received-code { display: block; color: #5b6772; overflow-wrap: anywhere; }
.received-review { flex: 1; min-height: 0; overflow: auto; }
.received-review dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.received-review dd { margin: 0; overflow-wrap: anywhere; }
.received-review h3 { font-size: 16px; margin: 18px 0 8px; }
.code-review-item { border-top: 1px solid #cbd9df; padding: 12px 0; font-size: 14px; }
.code-review-item .secondary { min-height: 32px; font-size: 14px; padding: 0 12px; margin-top: 8px; }
.preview-actions { flex: none; margin: 0; gap: 8px; }
.preview-actions button { min-height: 42px; padding: 0 14px; font-size: 16px; }
.office-side { min-height: 0; overflow: auto; }
.office-preview-panel:has(.preview-empty) { min-height: 90px; }
.office-preview-panel:has(.preview-note) { height: min(650px, calc(100dvh - 172px)); flex: none; }
.records-table th, .records-table td { white-space: normal; overflow-wrap: anywhere; }
.delivery-records-table th, .delivery-records-table td, .weighing-results-table th, .weighing-results-table td { padding: 8px 4px; }
.delivery-records-table th:last-child, .delivery-records-table td:last-child, .weighing-results-table th:last-child, .weighing-results-table td:last-child { width: 66px; }
.table-action { width: 54px; min-width: 0; font-size: 12px; }
#exportCsv { min-width: 0; font-size: 16px; }
.csv-actions .primary, .csv-actions .secondary { min-height: 36px; padding: 0 12px; font-size: 14px; }
.section-heading { flex-wrap: wrap; }
@media (max-height: 800px) and (min-width: 881px) {
  .large-prompt, #confirmStep .large-prompt { font-size: 30px; }
  .start-button { width: 240px; }
  .tablet-screen { padding: 12px 20px; }
  .big-output, .code-output { min-height: 72px; padding: 10px 18px; font-size: 48px; }
  .keypad button, .mini-keypad button { min-height: 54px; font-size: 26px; }
  .quick-grid button { min-height: 70px; }
  .selection-grid button { min-height: 74px; font-size: 22px; }
  #confirmStep .delivery-note { padding: 4px 12px; }
  #confirmStep .delivery-note h2 { font-size: 21px; margin-bottom: 4px; }
  #confirmStep .note-date-line { min-height: 24px; }
  #confirmStep .note-job-line { min-height: 26px; }
  #confirmStep .note-party-grid { min-height: 46px; }
  #confirmStep .note-customer { padding: 6px 8px; gap: 6px; }
  #confirmStep .note-customer strong { font-size: 17px; }
  #confirmStep .note-vehicle-grid { min-height: 38px; }
  #confirmStep .note-vehicle-grid > div { grid-template-rows: 18px 1fr; }
  #confirmStep .note-vehicle-grid strong { font-size: 17px; }
  #confirmStep .note-items th, #confirmStep .note-items td { height: 24px; padding: 3px; font-size: 13px; }
  #confirmStep .note-remarks { min-height: 32px; grid-template-rows: 18px 1fr; }
  #confirmStep .note-footer { min-height: 56px; }
  #confirmStep .note-company { padding: 4px 8px; }
  #confirmStep .note-company p { font-size: 17px; }
  #confirmStep .note-company span { font-size: 11px; }
}
@media (max-width: 1100px) and (min-width: 881px) {
  .office-grid, .weighing-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 10px; }
  .office-main, .weighing-main { padding: 12px; }
  .master-form { grid-template-columns: 70px minmax(90px, 1fr) 40px 46px 55px 55px 88px; gap: 5px; }
  .master-form .primary { width: 88px; font-size: 14px; }
}
@media (max-width: 880px) {
  main { overflow: auto; }
  .mode-tabs { flex-wrap: wrap; }
  .mode-tabs button { padding: 0 14px; }
  #deliverySync { width: 100%; }
  #tabletView { height: auto; }
  .tablet-screen { min-height: 660px; height: auto; overflow: visible; }
  .chooser-layout { grid-template-columns: 1fr; height: auto; }
  .office-grid, .weighing-grid { grid-template-columns: 1fr; height: auto; }
  .table-wrap { max-height: 60dvh; }
  .delivery-records-table, .weighing-results-table { min-width: 780px; }
  .office-main { min-height: 620px; }
  .master-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #masterVehicleWeight { grid-column: 3; grid-row: 1; }
  .master-form button { grid-column: 3; grid-row: 3; }
  #masterYayoiCode { grid-column: 1; grid-row: 3; }
  #masterDeviceCode { grid-column: 2; grid-row: 3; }
  .scale-preview-panel { min-height: 600px; }
  .office-preview-panel:has(.preview-note) { height: 640px; }
  .progress-panel { overflow: auto; }
}
@media print {
  html, body { height: auto; overflow: visible; background: white; }
  .delivery-login, .delivery-message { display: none !important; }
  #printArea .delivery-note { height: auto; overflow: visible; background: white; border: 0; box-shadow: none; }
  @page { size: A5 portrait; margin: 8mm; }
}
