:root { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #20242a; background: #f5f6f8; }
* { box-sizing: border-box; }
body { margin: 0; }
a { color: #1f5687; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.site-header { background: #172b3a; color: white; padding: 14px 0; }
.header-row, .title-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: white; font-weight: 700; text-decoration: none; }
nav { display: flex; gap: 18px; align-items: center; } nav a, .link-button { color: white; text-decoration: none; }
.inline-form { display: inline; } .link-button { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; }
main { padding: 26px 0 60px; }
h1 { margin: 0 0 18px; } h2 { margin-top: 34px; }
.muted { color: #65707a; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card { background: white; border: 1px solid #dfe3e7; border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.card strong { font-size: 2rem; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid #dfe3e7; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #e8ebee; white-space: nowrap; }
th { background: #eef2f5; }
.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #bbc3ca; border-radius: 6px; font: inherit; }
button { padding: 10px 18px; border: 0; border-radius: 6px; background: #245f8f; color: white; cursor: pointer; white-space: nowrap; }
.login-card { max-width: 460px; margin: 70px auto; padding: 28px; background: white; border: 1px solid #dfe3e7; border-radius: 10px; }
.login-card label { display: block; margin-bottom: 15px; }
.error { color: #a22121; }.message { background: #e8f2e8; padding: 12px; border-radius: 6px; margin-bottom: 14px; }
.details { display: grid; grid-template-columns: 160px 1fr; background: white; border: 1px solid #dfe3e7; border-radius: 8px; overflow: hidden; }
.details dt, .details dd { margin: 0; padding: 11px 14px; border-bottom: 1px solid #e8ebee; }
.details dt { font-weight: 700; background: #eef2f5; }
.qr { width: 180px; height: 180px; border: 8px solid white; }
@media (max-width: 760px) { .cards { grid-template-columns: repeat(2, 1fr); } .header-row { align-items: flex-start; } nav { flex-wrap: wrap; } .title-row { align-items: flex-start; } .qr { width: 130px; height: 130px; } .details { grid-template-columns: 120px 1fr; } }
.button-link {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 6px;
  background: #245f8f;
  color: white;
  text-decoration: none;
  white-space: nowrap;
}
.button-link--small { padding: 7px 11px; font-size: 0.9rem; }
.small-action { margin-left: 8px; font-size: 0.9rem; }
.set-detail-actions { display: flex; align-items: center; gap: 18px; }
.item-pair-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.item-summary h3 { margin: 0 0 12px; }
.compact-details { display: grid; grid-template-columns: 100px 1fr; margin: 0; }
.compact-details dt, .compact-details dd { margin: 0; padding: 6px 0; border-bottom: 1px solid #e8ebee; }
.compact-details dt { font-weight: 700; }
@media (max-width: 760px) {
  .set-detail-actions { align-items: flex-start; flex-direction: column-reverse; }
  .item-pair-grid { grid-template-columns: 1fr; }
}
.small-text { font-size: .82rem; }
.message--error, .error-box { background: #fbeaea; color: #8b1f1f; border: 1px solid #edc3c3; }
.error-box { padding: 12px; border-radius: 6px; margin: 12px 0; }
.field-error { display: block; color: #a22121; font-size: .78rem; white-space: normal; margin-top: 4px; }
.form-panel { background: #fff; border: 1px solid #dfe3e7; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.bulk-header-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bulk-header-grid label { font-weight: 700; }
.bulk-header-grid select { margin-top: 6px; font-weight: 400; }
.bulk-toolbar, .batch-actions, .form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 16px 0; }
.batch-actions label { display: flex; align-items: center; gap: 8px; }
.batch-actions select { width: auto; min-width: 170px; }
.select-all-label input { width: auto; }
.check-column { width: 64px; text-align: center; }
.check-column input { width: auto; transform: scale(1.15); }
.secondary-button { background: #687782; padding: 7px 11px; }
.bulk-table-wrap { max-height: 65vh; }
.bulk-entry-table { min-width: 1850px; }
.bulk-entry-table th { position: sticky; top: 0; z-index: 2; }
.bulk-entry-table td { vertical-align: top; padding: 8px; }
.bulk-entry-table input, .bulk-entry-table select { min-width: 118px; padding: 8px; }
.bulk-entry-table td:nth-child(5) select { min-width: 210px; }
.bulk-entry-table td:nth-child(11) input { min-width: 260px; }
.bulk-entry-table .row-number { text-align: center; min-width: 44px; }
.result-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 22px; }
@media (max-width: 760px) {
  .bulk-header-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
}

.registration-section h2 { margin: 0 0 14px; font-size: 1.15rem; }
.registration-section label, .field-label { font-weight: 700; }
.registration-section input, .registration-section select { margin-top: 6px; font-weight: 400; }
.mode-choice { margin-bottom: 14px; }
.mode-choice > div { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 8px; }
.mode-choice > div > div label { display: flex; align-items: center; gap: 7px; font-weight: 400; }
.mode-choice input[type="radio"] { width: auto; margin: 0; }
.conditional-panel { border-top: 1px solid #e4e8eb; padding-top: 14px; }
.conditional-panel[hidden] { display: none; }
.new-master-grid, .new-lot-grid { display: grid; gap: 14px; }
.new-master-grid { grid-template-columns: 2fr 1fr 1fr; }
.new-lot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-help { margin-left: 10px; font-weight: 400; }
.bulk-entry-table { min-width: 2070px; }
.bulk-entry-table td:nth-child(5) input { min-width: 190px; }
.bulk-entry-table td:nth-child(6) input { min-width: 155px; }
.bulk-entry-table td:nth-child(12) input { min-width: 270px; }
.result-context { margin: 0 0 18px; padding: 12px 14px; background: #fff; border: 1px solid #dfe3e7; border-radius: 8px; }

@media (max-width: 900px) {
  .new-master-grid, .new-lot-grid { grid-template-columns: 1fr; }
  .inline-help { display: block; margin: 5px 0 0; }
}

/* 注文票整形・集計 */
.status-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.status-badge--ok { background: #e7f3e8; color: #276331; }
.status-badge--warning { background: #fff0c7; color: #765400; }
.status-text { font-size: 1.1rem !important; line-height: 1.35; }
.upload-panel { max-width: 760px; }
.upload-panel label { display: block; font-weight: 700; margin-bottom: 18px; }
.upload-panel label input { margin-top: 7px; font-weight: 400; }
.import-status-cards { margin-bottom: 18px; }
.import-case-details { margin-bottom: 18px; }
.import-actions { margin: 18px 0; }
.import-actions form { margin: 0; }
.inline-upload { display: flex; gap: 12px; align-items: center; }
.inline-upload input[type="file"] { flex: 1; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.compact-table th, .compact-table td { padding: 8px 10px; }
.order-import-table-wrap { max-height: 68vh; }
.order-import-table { min-width: 2260px; }
.order-import-table th { position: sticky; top: 0; z-index: 3; }
.order-import-table td { padding: 7px; vertical-align: top; }
.order-import-table input, .order-import-table select, .order-import-table textarea { padding: 7px; min-width: 110px; }
.order-import-table td:nth-child(6) input, .order-import-table td:nth-child(7) input { min-width: 180px; }
.order-import-table td:nth-child(13) textarea { min-width: 270px; }
.order-import-table .warning-cell { min-width: 300px; white-space: normal; }
.order-import-table .row-warning td { background: #fff9df; }
.order-import-table .row-warning td:first-child { border-left: 4px solid #d29a00; }
button:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 900px) {
  .summary-grid { grid-template-columns: 1fr; }
  .inline-upload { align-items: stretch; flex-direction: column; }
}
