:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #15803d;
  --success-dark: #166534;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fef2f2;
  --secondary: #64748b;
  --secondary-dark: #475569;
  --border: #d9e0ea;
  --focus: #f59e0b;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.customer-cosmetics-rate-toggle {
  width: 100%;
  margin-top: 8px;
  text-align: left;
}

.customer-cosmetics-rate-panel {
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: color-mix(in srgb, var(--card, #fff) 92%, #f0f7ff 8%);
}

.customer-cosmetics-rate-panel h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.customer-cosmetics-rate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.customer-cosmetics-rate-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.customer-cosmetics-rate-input-wrap input {
  width: 100%;
  margin: 0;
}

@media (max-width: 600px) {
  .customer-cosmetics-rate-row {
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 8px;
  }
}

/* みぃテーマ：アプリ全体で使う柔らかい配色と丸みのある文字 */
html[data-app-theme="mii"] {
  --bg: #fff9f5;
  --card: #fffdfa;
  --text: #4f4138;
  --muted: #7b6c62;
  --primary: #df857b;
  --primary-dark: #c96c63;
  --primary-soft: #fff0ee;
  --success: #719a7b;
  --success-dark: #587d62;
  --danger: #d96365;
  --danger-dark: #bd4d50;
  --danger-soft: #fff0f0;
  --secondary: #8a7468;
  --secondary-dark: #6f5c52;
  --border: #eadfd8;
  --focus: #efa56f;
  --shadow: 0 10px 28px rgba(106, 83, 67, 0.1);
}

html[data-app-theme="mii"] body {
  font-family:
    "Hiragino Maru Gothic ProN",
    "Yu Gothic",
    "Meiryo",
    system-ui,
    sans-serif;
  letter-spacing: 0.01em;
}

html[data-app-theme="mii"] header,
html[data-app-theme="mii"] .app-header {
  background: #5c4a40;
}

html[data-app-theme="mii"] .card {
  border-color: #eadfd8;
  border-radius: 18px;
}

html[data-app-theme="mii"] h2,
html[data-app-theme="mii"] h3,
html[data-app-theme="mii"] label {
  color: #5f5147;
}

html[data-app-theme="mii"] input,
html[data-app-theme="mii"] textarea,
html[data-app-theme="mii"] select {
  border-color: #eadfd8;
  border-radius: 14px;
  background: #fffcfa;
}

html[data-app-theme="mii"] button {
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(106, 83, 67, 0.12);
}

html[data-app-theme="mii"] .home-menu-tile {
  border-color: #eadfd8;
  border-radius: 16px;
  background: #fffdfa;
  box-shadow: 0 3px 9px rgba(106, 83, 67, 0.08);
}

html[data-app-theme="mii"] .home-menu-tile:hover {
  background: #fff0ee;
  box-shadow: 0 4px 12px rgba(223, 133, 123, 0.16);
}

html[data-app-theme="mii"] .home-menu-tile .home-menu-icon {
  color: #df857b;
}

html[data-app-theme="mii"] .menu-section-title {
  border-color: #eadfd8;
  color: #7b6c62;
}

html[data-app-theme="mii"] .menu-section,
html[data-app-theme="mii"] .list-item {
  border-color: #eadfd8;
}

html[data-app-theme="mii"] .status {
  border-color: #f2cfca;
  background: #fff0ee;
}

html[data-app-theme="mii"] table {
  background: #fffdfa;
}

html[data-app-theme="mii"] th {
  background: #fff5f2;
  color: #5f5147;
}

html[data-app-theme="mii"] .total-box {
  border-color: #eadfd8;
  background: #fff5f2;
}

html[data-app-theme="mii"] .product-inquiry-modal,
html[data-app-theme="mii"] .product-inquiry-modal-header {
  background: #fffdfa;
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

#deployInfoBadge {
  display: block;
  margin-top: 6px;
  padding: 8px 10px 6px;
  border-top: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-align: right;
  white-space: pre-line;
  box-shadow: none;
  pointer-events: auto;
}

header,
.app-header {
  display: flex;
  align-items: center;
  background: #111827;
  color: white;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: bold;
  min-height: 44px;
  box-sizing: border-box;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.global-top-back-button {
  flex: 0 0 87px;
  width: 87px;
  min-width: 87px;
  max-width: 87px;
  min-height: 38px;
  margin-top: 0;
  margin-right: 7px;
  margin-bottom: 0;
  padding: 4px 6px;
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  z-index: 10003;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  line-height: 1.15;
}

.global-top-back-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}

.app-header-brand {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  pointer-events: none;
  font-size: 18px;
  font-weight: bold;
}

.app-header-brand .app-header-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  object-fit: contain;
}

.app-header-logo-mii {
  display: none;
  border-radius: 7px;
}

html[data-app-theme="mii"] .app-header-logo-standard {
  display: none;
}

html[data-app-theme="mii"] .app-header-logo-mii {
  display: block;
}

.header-keyboard-qr {
  height: 38px;
  width: 38px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  box-sizing: border-box;
  order: -2;
  margin: 0 8px 0 0;
}

.header-product-scan-actions {
  order: -2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 7px;
}

.header-scan-action {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 38px;
  min-height: 38px;
  margin-top: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  box-shadow: none;
}

.header-scan-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.header-scan-action > .material-symbols-outlined {
  display: block;
  font-size: 31px;
  line-height: 38px;
}

.header-rfid-action-icon {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding-bottom: 6px;
  box-sizing: border-box;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.3px;
}

.header-scan-action--rfid {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.28);
}

.header-scan-action-theme-image {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
  object-position: center;
}

html[data-app-theme="mii"]
  .header-scan-action
  > .material-symbols-outlined {
  display: none;
}

html[data-app-theme="mii"]
  .header-scan-action
  > .header-scan-action-theme-image {
  display: block;
}

.header-scan-action-label {
  position: absolute;
  right: -2px;
  bottom: 1px;
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(17, 24, 39, 0.88);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  text-shadow: 0 1px 1px #111827;
}

.header-scan-action--inquiry .header-scan-action-label {
  color: #60a5fa;
}

.header-scan-action--sale .header-scan-action-label {
  color: #4ade80;
}

.product-inquiry-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.72);
  box-sizing: border-box;
}

.product-inquiry-modal {
  width: min(720px, 100%);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.product-inquiry-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  min-height: 48px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.product-inquiry-modal-header h2 {
  margin: 0;
  font-size: 18px;
  text-align: center;
}

.product-inquiry-icon-button {
  min-height: 38px;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--primary);
  box-shadow: none;
}

.product-inquiry-icon-button--close {
  color: var(--muted);
}

.product-inquiry-body {
  padding: 12px;
}

.product-inquiry-reader {
  width: min(420px, 100%);
  min-height: 260px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: #111827;
}

.product-inquiry-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.product-inquiry-status.is-error {
  color: var(--danger);
  font-weight: 700;
}

.product-inquiry-summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
}

.product-inquiry-photo {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.product-inquiry-photo-empty {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}

.product-inquiry-title {
  margin: 0 0 4px;
  font-size: 19px;
  line-height: 1.35;
}

.product-inquiry-mode {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
}

.product-inquiry-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 14px;
  margin-top: 9px;
  font-size: 13px;
}

.product-inquiry-field {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-inquiry-field-label {
  color: var(--muted);
}

.product-inquiry-management {
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid #eef2f7;
}

.product-inquiry-management summary {
  width: fit-content;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  user-select: none;
}

.product-inquiry-management[open] summary {
  color: var(--text);
}

.product-inquiry-management-fields {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f8fafc;
}

.product-inquiry-margin-badge-row {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.product-inquiry-margin-badge-row .product-gross-margin-badge {
  margin-left: 0;
}

.product-inquiry-relations {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
  font-size: 13px;
}

.product-inquiry-product-link {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 2px 6px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  color: var(--primary);
  background: #fff;
  text-decoration: underline;
  cursor: pointer;
}

.product-inquiry-product-chip {
  display: inline-block;
  width: auto;
  min-height: 0;
  margin: 2px 6px 2px 0;
  padding: 2px 6px;
  border: 1px solid #d9e0ea;
  border-radius: 5px;
  background: #f8fafc;
  color: #475569;
  box-shadow: none;
  font-size: inherit;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

.product-inquiry-product-chip:hover,
.product-inquiry-product-chip:focus-visible {
  border-color: #93c5fd;
  background: #eff6ff;
  color: var(--primary);
}

.product-inquiry-compact-actions {
  margin-top: 6px;
}

.product-inquiry-compact-button {
  width: auto;
  min-height: 0;
  margin: 2px 6px 2px 0;
  padding: 3px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  background: #fff;
  color: var(--primary);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.product-inquiry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.product-inquiry-actions button {
  flex: 1 1 150px;
}

.product-inquiry-stock-flow {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.product-inquiry-stock-flow .stock-flow-panel {
  margin: 0;
}

.product-inquiry-sale-guard {
  flex: 1 1 100%;
  padding: 8px 10px;
  border: 1px solid #fde68a;
  border-radius: 7px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
}

.product-inquiry-stock-link {
  flex: 0 1 auto !important;
  background: #fff;
  color: var(--primary);
  border: 1px solid #93c5fd;
}

.global-top-back-button {
  order: -1;
}

.sale-customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.sale-customer-row.has-new-customer {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.sale-entry-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.sale-entry-heading-row h2 {
  margin: 0;
}

.sale-accounting-type-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sale-accounting-type-control[hidden],
.sale-accounting-type-toggle[hidden] {
  display: none;
}

.sale-accounting-type-disclosure {
  width: 58px;
  min-width: 58px;
  height: 48px;
  margin: 0;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.sale-accounting-type-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.sale-accounting-type-button {
  width: auto;
  min-width: 82px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.sale-accounting-type-button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.customer-sale-type-toggle {
  display: flex;
  width: 100%;
  margin: 0 0 14px;
}

.customer-sale-type-toggle .sale-accounting-type-button {
  flex: 1 1 50%;
}

.sale-accounting-type-notice {
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid #fdba74;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 13px;
}

@media (max-width: 700px) {
  .sale-entry-heading-row {
    align-items: flex-start;
  }

  .sale-accounting-type-control {
    align-items: flex-start;
  }

  .sale-accounting-type-disclosure {
    width: 52px;
    min-width: 52px;
    height: 44px;
    font-size: 25px;
  }

  .sale-accounting-type-button {
    min-width: 68px;
    padding: 7px 8px;
    font-size: 12px;
  }
}

.sale-customer-field {
  min-width: 0;
}

.sale-customer-field[hidden] {
  display: none;
}

.sale-customer-field label {
  display: block;
}

.sale-customer-field select,
.sale-customer-field input {
  width: 100%;
}

#appTopFixedArea {
  position: sticky;
  top: 0;
  z-index: 10000;
  overflow: visible;
}

#appTopFixedArea header {
  position: relative;
  z-index: 10002;
}

#appTopFixedArea .global-status-bar {
  position: relative;
  z-index: 10001;
}

#appTopFixedArea,
#appTopFixedArea header,
.header-user-menu {
  overflow: visible;
}

.global-status-bar {
  margin: 0;
  padding: 8px 16px;
  border-bottom: 1px solid #dbeafe;
  background: #eef6ff;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
}

.global-status-bar:empty {
  display: none;
}

.header-user-menu {
  position: relative;
  z-index: 10003;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  overflow: visible;
}

.user-menu-button {
  width: auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  padding: 7px 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font: inherit;
}

.user-menu-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

#headerUserName {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  z-index: 10003;
}

.user-menu-dropdown.hidden {
  display: none;
}

.user-menu-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 0;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
  text-decoration: none;
  font: inherit;
}

.user-menu-item:hover {
  background: #f3f4f6;
}

.manual-attachment-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: var(--card);
}

.manual-attachment-section h3 {
  margin: 0 0 14px;
}

.manual-document-link {
  color: #0b63ce;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.manual-setup-section {
  margin-top: 28px;
}

.manual-setup-section > h3 {
  margin: 0 0 14px;
}

.manual-guide-card {
  padding: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: var(--card);
}

.manual-guide-details {
  padding: 0;
  overflow: hidden;
}

.manual-recommended-details {
  margin-top: 16px;
}

.manual-guide-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  font-size: 18px;
  font-weight: 700;
}

.manual-guide-summary::-webkit-details-marker {
  display: none;
}

.manual-guide-summary::before {
  content: "▶";
  flex: 0 0 auto;
  font-size: 13px;
  transition: transform 0.18s ease;
}

.manual-guide-details[open] > .manual-guide-summary::before {
  transform: rotate(90deg);
}

.manual-guide-summary:hover {
  background: rgba(148, 163, 184, 0.1);
}

.manual-guide-summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: -3px;
}

.manual-guide-content {
  padding: 0 20px 20px;
}

.manual-recommended-list {
  margin: 0;
  padding-left: 22px;
}

.manual-recommended-list > li {
  margin: 0 0 10px;
  line-height: 1.6;
}

.manual-recommended-list > li:last-child {
  margin-bottom: 0;
}

.manual-guide-card h4 {
  margin: 0 0 16px;
  font-size: 18px;
}

.manual-official-guide {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eff6ff;
}

.manual-official-guide a {
  color: #0b63ce;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.manual-official-guide p {
  margin: 8px 0 0;
  color: #4b5563;
  line-height: 1.55;
}

.manual-setup-steps {
  margin: 0;
  padding-left: 24px;
}

.manual-setup-steps > li {
  margin: 0 0 12px;
  padding-left: 4px;
  line-height: 1.65;
}

.manual-setup-steps a {
  color: #0b63ce;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.manual-step-image {
  margin: 12px 0 4px;
}

.manual-step-image img {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.manual-step-image figcaption {
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.5;
}

.manual-install-details {
  margin-top: -2px;
}

.manual-install-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.manual-install-summary::-webkit-details-marker {
  display: none;
}

.manual-install-summary::before {
  content: "▶";
  flex: 0 0 auto;
  font-size: 11px;
  transition: transform 0.18s ease;
}

.manual-install-details[open] > .manual-install-summary::before {
  transform: rotate(90deg);
}

.manual-install-summary:focus-visible {
  border-radius: 4px;
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 3px;
}

.manual-install-steps {
  margin: 10px 0 0 18px;
  padding-left: 22px;
}

.manual-install-steps > li {
  margin: 6px 0;
}

.manual-install-steps code {
  overflow-wrap: anywhere;
}

.manual-install-image {
  max-width: 500px;
}

.manual-print-settings {
  margin: 8px 0 0;
  padding-left: 22px;
}

.manual-print-settings li {
  margin: 4px 0;
}

.user-menu-version {
  color: #6b7280;
}

#deployInfoBadge.user-menu-version {
  position: static;
  border-radius: 0;
  z-index: auto;
}

.user-menu-button .material-symbols-outlined,
.user-menu-item .material-symbols-outlined {
  margin-right: 0;
  font-size: 20px;
  line-height: 1;
}

main {
  padding: 18px;
  max-width: 1080px;
  margin: auto;
}

.card {
  background: var(--card);
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

h2,
h3 {
  margin-top: 0;
}

label {
  display: block;
  margin-top: 12px;
  font-weight: bold;
  color: #334155;
  line-height: 1.35;
}

input,
textarea,
select,
button {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  padding: 12px 13px;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

input,
textarea,
select {
  min-height: 46px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(245, 158, 11, 0.35);
  outline-offset: 2px;
  border-color: var(--focus);
}

button {
  background: var(--primary);
  color: white;
  border: none;
  font-weight: bold;
  cursor: pointer;
  margin-top: 14px;
  min-height: 46px;
  line-height: 1.3;
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  white-space: normal;
  overflow-wrap: anywhere;
}

button .material-symbols-outlined {
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
  margin-right: 6px;
}

button.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.icon-button .material-symbols-outlined {
  margin-right: 0;
}

button.icon-button .button-label {
  min-width: 0;
}

/* カテゴリ内のボタンはそのまま（管理者メニュー用） */
#topMenuCard .menu-section {
  display: block;
  margin-top: 8px;
}

#topMenuCard .menu-section button {
  margin-top: 6px;
}

.admin-backup-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-backup-menu-grid button {
  min-width: 0;
}

.admin-maintenance-tools {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-maintenance-tools > summary {
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.admin-maintenance-tools-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

/* ===== ホームメニュー タイルグリッド ===== */

.menu-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin: 16px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}

.home-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 0;
}

@media (min-width: 900px) {
  .home-menu-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.home-menu-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 3px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  color: var(--text);
  font-family: inherit;
  min-height: 0;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
  font-weight: normal;
}

.home-menu-tile:hover {
  background: #eff6ff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.14);
}

.home-menu-tile .home-menu-icon {
  font-size: 26px;
  line-height: 1;
  color: #2563eb;
  margin-right: 0;
}

.home-menu-theme-image {
  display: none;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center;
}

html[data-app-theme="mii"]
  .home-menu-tile--mii-image
  .home-menu-icon {
  display: none;
}

html[data-app-theme="mii"] .home-menu-tile--mii-image {
  position: relative;
  overflow: hidden;
  padding: 0;
}

html[data-app-theme="mii"]
  .home-menu-tile--mii-image
  .home-menu-theme-image {
  display: block;
  position: absolute;
  top: 0;
  left: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 20px);
  border-radius: 14px;
  object-fit: cover;
  object-position: center;
}

html[data-app-theme="mii"]
  .home-menu-tile--mii-image
  .home-menu-label {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: calc(100% - 8px);
  min-height: 20px;
  padding: 1px 3px;
  transform: translateX(-50%);
  border: 2px solid #f19c91;
  border-radius: 999px;
  background: #fffdfa;
  color: #5f5147;
  box-shadow: 0 2px 6px rgba(122, 82, 67, 0.14);
  box-sizing: border-box;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
}

.home-menu-label {
  font-size: 10px;
  text-align: center;
  line-height: 1.2;
  color: var(--text);
  word-break: break-word;
  font-weight: normal;
}

button:hover {
  background: var(--primary-dark);
}

.secondary {
  background: var(--secondary);
}

.secondary:hover {
  background: var(--secondary-dark);
}

.primary-action {
  background: var(--success);
}

.primary-action:hover {
  background: var(--success-dark);
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: var(--danger-dark);
}

.status {
  padding: 10px;
  background: var(--primary-soft);
  border: 1px solid #dbeafe;
  border-radius: 9px;
  margin-bottom: 12px;
  font-size: 14px;
}

.small {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.cosmetics-brand-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.cosmetics-brand-select-row select,
.cosmetics-brand-select-row button {
  margin-top: 0;
}

.cosmetics-brand-select-row button {
  width: auto;
  white-space: nowrap;
}

.cosmetics-brand-settings-modal[hidden] {
  display: none;
}

.cosmetics-brand-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.56);
  box-sizing: border-box;
}

body.cosmetics-brand-modal-open {
  overflow: hidden;
}

.cosmetics-brand-settings-dialog {
  width: min(640px, 100%);
  margin: 36px auto;
  padding: 20px;
  border-radius: 16px;
  background: var(--card, #fff);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.cosmetics-brand-settings-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #dbe3ef);
}

.cosmetics-brand-settings-header h2,
.cosmetics-brand-settings-header p {
  margin: 0;
}

.cosmetics-brand-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.6fr);
  gap: 10px 12px;
  margin-top: 14px;
}

.cosmetics-brand-settings-form label {
  margin: 0;
}

.cosmetics-brand-active-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  grid-column: 1 / -1;
}

.cosmetics-brand-active-check input[type="checkbox"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  margin: 0;
}

.cosmetics-brand-settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  grid-column: 1 / -1;
}

.cosmetics-brand-settings-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #dbe3ef);
}

.cosmetics-brand-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line, #dbe3ef);
  border-radius: 10px;
}

.cosmetics-brand-settings-row > div {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.cosmetics-brand-settings-row button {
  width: auto;
  flex: 0 0 auto;
}

.cosmetics-brand-inactive-badge {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 999px;
  color: #92400e;
  background: #fef3c7;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 700px) {
  .cosmetics-brand-select-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .cosmetics-brand-settings-modal {
    padding: 10px;
  }

  .cosmetics-brand-settings-dialog {
    margin: 12px auto;
    padding: 16px;
  }

  .cosmetics-brand-settings-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .cosmetics-brand-settings-form > *,
  .cosmetics-brand-active-check,
  .cosmetics-brand-settings-actions {
    grid-column: 1;
  }
}

.product-stock-flow-link {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 600;
}

.product-stock-flow-link:hover {
  color: #1d4ed8;
}

.stock-flow-table-action {
  width: 1%;
  text-align: center;
  white-space: nowrap;
}

.stock-flow-table-link {
  display: inline-block;
  color: #2563eb;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.stock-flow-table-link:hover {
  color: #1d4ed8;
}

.stock-return-target > td {
  background: #fff7ed;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  transition:
    background-color 0.25s ease,
    outline-color 0.25s ease;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.sales-filter-payment-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stock-filter-primary-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.actions button {
  flex: 1;
  margin-top: 0;
}

@media (min-width: 769px) {
  .sales-list-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
  }

  .sales-list-actions button {
    width: auto !important;
    flex: 0 0 auto !important;
    min-width: 90px;
    height: 34px;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 8px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }
}

.list-item {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.sale-list-item-inactive,
.purchase-list-item-inactive {
  opacity: 0.55;
  background: #f3f4f6;
}

/* ===== 委託仕入一覧 横並びレイアウト ===== */
.consign-purchase-list-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  background: #ffffff;
}

.consign-purchase-main-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.consign-purchase-thumb-area {
  flex: 0 0 80px;
  width: 80px;
}

.consign-purchase-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  display: block;
}

.consign-purchase-no-photo {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  text-align: center;
}

.consign-purchase-photo-count {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

.consign-purchase-detail-area {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
}

.consign-purchase-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  word-break: break-word;
}

.consign-purchase-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.consign-purchase-actions button {
  width: auto;
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.3;
  min-height: 32px;
  margin-top: 0;
  border-radius: 8px;
}

@media (max-width: 700px) {
  .consign-purchase-actions {
    gap: 5px;
  }

  .consign-purchase-actions button {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 28px;
    border-radius: 7px;
  }
}

@media (max-width: 768px) {
  .sales-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }

  .sales-list-actions button {
    width: auto !important;
    flex: 1 1 calc(33.333% - 6px);
    min-width: 88px;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: 10px;
    white-space: normal;
    writing-mode: horizontal-tb;
  }
}

.purchase-inactive-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  border-radius: 4px;
  color: #7f1d1d;
  line-height: 1.7;
}

.purchase-consign-active-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  border-radius: 4px;
  color: #1e3a5f;
}

.purchase-memo-photo-edit {
  margin-top: 16px;
}

.purchase-detail-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.sale-inactive-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  background: #6b7280;
  color: #fff;
  vertical-align: middle;
}

.list-item:first-child {
  border-top: none;
}

.product-list-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  align-items: start;
}

.product-photo-box {
  width: 130px;
  position: relative;
}

.product-photo {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f3f4f6;
}

.product-photo-empty {
  width: 130px;
  height: 130px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: #f9fafb;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-info-box {
  min-width: 0;
}

.product-parent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.product-compact-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.product-compact-actions--quantity {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.product-compact-actions--nonstock {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-compact-actions button {
  min-width: 0;
  width: 100%;
  padding: 6px 2px;
  font-size: 13px;
  white-space: nowrap;
}

.product-rfid-button {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.product-rfid-button--compact {
  display: block;
  width: auto !important;
  min-width: 72px;
  min-height: 30px;
  margin: 6px 0 0 !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  white-space: nowrap;
}

/* 商品一覧：表示モード（詳細/簡易）切替カード。必ず1行で表示する */
.product-display-mode-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.product-display-mode-card label {
  white-space: nowrap;
  margin: 0;
}

.product-display-mode-card select {
  flex: 1;
  min-width: 120px;
  margin-top: 0;
}

/* 商品一覧：簡易表示行（写真＋商品名のみ） */
.product-simple-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
}

.product-simple-row img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  flex-shrink: 0;
}

.product-simple-photo-empty {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: #f9fafb;
  flex-shrink: 0;
}

.product-simple-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.product-price-rate-excluded-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  background: #fffbeb;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  vertical-align: middle;
}

.product-simple-cosmetics-name {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1px;
  height: 48px;
  overflow: hidden;
  text-overflow: clip;
  white-space: normal;
}

.product-simple-cosmetics-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  line-height: 1.35;
}

.product-simple-cosmetics-code {
  flex: 0 0 auto;
}

.product-simple-cosmetics-brand,
.product-simple-cosmetics-product {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-simple-cosmetics-brand {
  flex: 1;
}

.product-simple-cosmetics-product {
  line-height: 1.35;
}

/* 仕入先一覧：写真＋会社名の折り畳み表示 */
.supplier-list-card {
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.supplier-list-summary {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.supplier-list-summary:hover {
  background: #f8fafc;
}

.supplier-list-thumb {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f3f4f6;
}

.supplier-list-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--muted);
  font-size: 11px;
}

.supplier-list-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-sale-type-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.customer-sale-type-badge.is-export {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #dbeafe;
}

.customer-sale-type-badge.is-domestic {
  border-color: #86efac;
  color: #166534;
  background: #dcfce7;
}

.supplier-list-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.supplier-list-details {
  padding: 2px 12px 12px 70px;
}

.supplier-bank-heading {
  margin-top: 8px;
  font-weight: 700;
}

.purchase-collapsible-details {
  padding-left: 12px;
}

.purchase-collapsible-summary .sale-inactive-badge {
  flex: 0 0 auto;
}

@media (max-width: 700px) {
  .supplier-list-details {
    padding-left: 12px;
  }
}

.inline-child-add-panel {
  width: 100%;
  box-sizing: border-box;
  margin: 10px 0 16px;
  padding: 14px;
  border: 2px solid #93c5fd;
  border-radius: 14px;
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.inline-child-add-panel:focus {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.inline-child-add-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.inline-child-add-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.3;
}

.inline-child-add-parent {
  font-size: 13px;
  color: #475569;
  word-break: break-word;
}

.inline-child-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 700px) {
  .inline-child-add-panel {
    margin: 10px 0 14px;
    padding: 12px;
    border-radius: 12px;
  }

  .inline-child-add-header {
    flex-direction: column;
  }

  .inline-child-add-actions button {
    width: auto;
    min-width: 120px;
  }
}

.product-children-table {
  border-collapse: collapse;
}

@media (min-width: 769px) {
  .product-parent-actions {
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 16px;
  }

  .product-parent-actions button {
    flex: 1 1 0;
    min-width: 0;
    height: 44px;
    padding: 8px 12px;
    font-size: 14px;
    white-space: nowrap;
    writing-mode: horizontal-tb;
  }
}

.product-props {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-top: 6px;
}

.product-props .small {
  margin-top: 0;
}

.product-props .product-simple-status-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 4px 12px;
}

.product-simple-status-grid .small {
  min-width: 0;
  white-space: nowrap;
}

.purchase-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.purchase-photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
}

.purchase-photo-thumb:hover {
  opacity: 0.85;
}

.product-photo-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

.product-photo-edit-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
}

.product-photo-edit-item {
  width: 132px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.product-photo-edit-item--new {
  border-color: #60a5fa;
  background: #eff6ff;
}

.product-photo-edit-item img {
  width: 118px;
  height: 92px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.product-photo-edit-item button {
  width: 100%;
  min-height: auto;
  margin-top: 4px;
  padding: 5px 8px;
  font-size: 12px;
}

.outsourcing-list-card {
  cursor: pointer;
}

.outsourcing-list-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.outsourcing-list-card-heading .item-title {
  flex: 1;
  margin: 0;
}

.outsourcing-list-toggle {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.outsourcing-list-summary {
  margin-top: 6px;
}

.outsourcing-list-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.outsourcing-list-expanded-detail {
  margin-top: 12px;
  padding-top: 4px;
}

.outsourcing-list-card-expanded {
  cursor: default;
}

.dashboard-card-settings {
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.dashboard-card-settings legend {
  padding: 0 6px;
  font-weight: 700;
}

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

.dashboard-card-settings-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  cursor: pointer;
}

.dashboard-card-settings-grid input[type="checkbox"] {
  width: auto;
  margin: 0;
}

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

.user-settings-divider {
  margin: 18px 0 14px;
  border: 0;
  border-top: 1px solid var(--border);
}

.app-theme-settings-grid label {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: 22px 1fr;
  grid-template-rows: 66px auto;
  align-items: center;
  gap: 4px 8px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
}

.app-theme-settings-grid label:has(input:checked) {
  border-color: #397d8d;
  background: #edf7f7;
}

.app-theme-settings-grid input {
  grid-row: 1 / 3;
  width: auto;
  margin: 0;
}

.app-theme-settings-grid img {
  display: block;
  width: 100%;
  max-width: 112px;
  max-height: 66px;
  justify-self: center;
  object-fit: contain;
}

.app-theme-settings-grid span {
  justify-self: center;
  font-size: 14px;
  font-weight: 700;
}

.qr-scan-distance-settings .small {
  margin: 0 0 12px;
  color: var(--muted);
}

.qr-scan-distance-settings input[type="range"] {
  width: 100%;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.qr-scan-distance-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.qr-scan-distance-current {
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
}

.qr-scan-distance-current strong {
  color: var(--primary);
  font-size: 16px;
}

.top-shortcut-section {
  margin-bottom: 14px;
}

.top-shortcut-settings-grid {
  max-height: 330px;
  overflow-y: auto;
  padding-right: 4px;
}

.customer-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.customer-photo-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f3f4f6;
  cursor: pointer;
}

.customer-photo-thumb:hover {
  opacity: 0.85;
}

@media (max-width: 700px) {
  .product-props {
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
  }

  .product-props .small {
    font-size: 12px;
  }
}

@media (max-width: 700px) {
  .product-list-row {
    grid-template-columns: 96px 1fr;
    gap: 10px;
  }

  .product-photo-box,
  .product-photo,
  .product-photo-empty {
    width: 96px;
  }

  .product-photo,
  .product-photo-empty {
    height: 96px;
  }

  .product-parent-actions button {
    flex: 1 1 calc(50% - 6px);
    min-height: 40px;
    padding: 6px 8px;
    font-size: 13px;
    line-height: 1.2;
    writing-mode: horizontal-tb;
    white-space: normal;
  }
}

.product-photo {
  cursor: pointer;
}

.photo-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  padding: 20px;
  box-sizing: border-box;
}

.photo-modal-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.photo-modal img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  background: white;
  border-radius: 10px;
}

.photo-modal-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: auto;
  padding: 10px 14px;
  background: #111827;
  color: white;
  border-radius: 999px;
  z-index: 10000;
}

.item-title {
  font-weight: bold;
  font-size: 17px;
}

.screen,
.sectionMenu {
  display: none;
}

.menu-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 16px;
}

.menu-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.customer-search-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(110px, 1fr);
  gap: 10px;
  align-items: end;
}

.customer-search-filter-row > input,
.customer-search-filter-row > label,
.customer-search-filter-row select {
  min-width: 0;
}

.dashboard-kpi-section {
  margin: 14px 0 20px;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-kpi-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 124px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-kpi-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 28px;
}

.dashboard-kpi-content {
  min-width: 0;
}

.dashboard-kpi-title {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.dashboard-kpi-value {
  margin-top: 8px;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dashboard-kpi-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.dashboard-profit-card-lines {
  display: grid;
  gap: 1px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.1;
}

.dashboard-profit-card-lines #dashboardTodayGrossProfit {
  color: #334155;
  font-weight: 800;
}

.kpi-profit .dashboard-kpi-value {
  margin-top: 6px;
}

.kpi-sales {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.kpi-sales .dashboard-kpi-icon {
  background: #dbeafe;
  color: #2563eb;
}

.kpi-purchases {
  background: #f7fdf9;
  border-color: #bbf7d0;
}

.kpi-purchases .dashboard-kpi-icon {
  background: #dcfce7;
  color: #16a34a;
}

.kpi-stock-count {
  background: #fbf8ff;
  border-color: #ddd6fe;
}

.kpi-stock-count .dashboard-kpi-icon {
  background: #ede9fe;
  color: #7c3aed;
}

.kpi-stock-amount {
  background: #fffaf2;
  border-color: #fed7aa;
}

.kpi-stock-amount .dashboard-kpi-icon {
  background: #ffedd5;
  color: #ea580c;
}

.kpi-profit {
  background: #fff7f8;
  border-color: #fecdd3;
}

.kpi-profit .dashboard-kpi-icon {
  background: #ffe4e6;
  color: #e11d48;
}

.kpi-stocktaking-active {
  background: #c62828;
  border-color: #b71c1c;
  color: #fff;
}

.kpi-stocktaking-active .dashboard-kpi-title {
  color: rgba(255, 255, 255, 0.85);
}

.kpi-stocktaking-active .dashboard-kpi-value {
  color: #fff;
  font-size: 14px;
}

.kpi-stocktaking-active .dashboard-kpi-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.invoice {
  background: white;
  color: #111;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.invoice-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.invoice-top {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.4fr;
  gap: 16px;
  align-items: start;
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.invoice-title-area {
  text-align: center;
}

.invoice-logo {
  width: 90px;
  max-height: 90px;
  object-fit: contain;
  margin: 4px auto 6px;
  display: block;
}

.receipt-stamp-area {
  width: 92px;
  height: 92px;
  border: 1px dashed #777;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #555;
  text-align: center;
  line-height: 1.4;
  margin-left: auto;
}

.receipt-amount-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
}

@media print {
  .receipt-stamp-area {
    width: 88px;
    height: 88px;
    font-size: 11px;
  }
}

.invoice-company {
  text-align: left;
  font-size: 13px;
  line-height: 1.55;
}

.invoice-company-name {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 4px;
}

.invoice-meta {
  font-size: 14px;
  line-height: 1.7;
}

@media print {
  .invoice-logo {
    width: 85px;
    max-height: 85px;
  }

  .invoice-company {
    font-size: 12px;
  }
}

.invoice-title {
  font-size: 28px;
  font-weight: bold;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
  background: #fff;
}

th,
td {
  border: 1px solid var(--border);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}

.right {
  text-align: right;
}

.total-box {
  margin-top: 16px;
  text-align: right;
  font-size: 18px;
  font-weight: bold;
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

#saleEntryTotalBox.is-export-sale .sale-tax-total-row {
  display: none;
}

.sale-total-main-row {
  font-size: 18px;
  font-weight: bold;
}

.sale-total-sub-row {
  font-size: 13px;
  font-weight: normal;
  margin-top: 5px;
  color: #374151;
}

.invoice-total-main {
  font-size: 22px;
  font-weight: bold;
}

.invoice-total-sub {
  margin-top: 4px;
  font-size: 12px;
  font-weight: normal;
  color: #555;
}

.invoice-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-top: 16px;
  align-items: end;
}

.bank-info {
  border: 1px solid #ccc;
  padding: 10px;
  font-size: 13px;
  line-height: 1.6;
}

.bank-info-title {
  font-weight: bold;
  margin-bottom: 4px;
}

@media (max-width: 700px) {
  .invoice-bottom {
    grid-template-columns: 1fr;
  }
}

@media print {
  .bank-info {
    font-size: 12px;
  }
}

@media (max-width: 700px) {
  main {
    padding: 12px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stock-filter-primary-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .stock-filter-certificate-frame-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .stock-filter-certificate-frame-row > div,
  .stock-filter-certificate-frame-row select {
    width: 100%;
    min-width: 0;
  }

  .sales-filter-date-row {
    grid-template-columns: 1fr 1fr;
  }

  .sales-filter-customer-type-row {
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.55fr);
  }

  .sales-filter-payment-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .sales-filter-payment-row > div,
  .sales-filter-payment-row select {
    width: 100%;
    min-width: 0;
  }

  .sales-filter-payment-row label {
    font-size: 13px;
  }

  .sales-filter-payment-row select {
    padding-right: 6px;
    padding-left: 8px;
  }

  .receivable-date-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .consign-out-date-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-head {
    display: block;
  }

  table {
    font-size: 12px;
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sale-entry-table input {
    margin-top: 0;
    padding: 8px;
    font-size: 14px;
  }

  .sale-entry-table .sale-code {
    min-width: 110px;
  }

  .sale-entry-table .sale-name {
    min-width: 180px;
    font-size: 13px;
    color: var(--muted);
  }

  .sale-entry-table .sale-qty,
  .sale-entry-table .sale-unit-price,
  .sale-entry-table .sale-amount {
    text-align: right;
  }

  @media (max-width: 700px) {
    .sale-entry-table {
      font-size: 12px;
    }

    .sale-entry-table input {
      padding: 6px;
      font-size: 12px;
    }

    .sale-entry-table .sale-name {
      min-width: 140px;
    }
  }

  th,
  td {
    padding: 6px;
  }
}

@media print {
  body {
    background: white;
  }

  header,
  #globalStatusBar,
  #loginCard,
  #topMenuCard,
  .sectionMenu,
  .screen:not(#invoiceScreen),
  .no-print {
    display: none !important;
  }

  main {
    padding: 0;
    max-width: none;
  }

  .card {
    box-shadow: none;
    border-radius: 0;
  }
}

.code-name-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.code-name-sub {
  font-size: 12px;
  line-height: 1.3;
  color: #555;
  white-space: normal;
  word-break: break-word;
}

.sale-product-add-area {
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.sale-product-add-row {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

/* 数量 + 手入力XA番号 行：スマホでも横並びを維持 */
.sale-manual-code-row {
  flex-wrap: nowrap;
}

.sale-qty-field {
  flex: 0 0 92px;
  min-width: 80px;
}

.sale-manual-code-field {
  flex: 1 1 auto;
  min-width: 0;
}

.sale-qty-field input {
  width: 100%;
  height: 52px;
  min-height: 52px;
  box-sizing: border-box;
}

.purchase-cosmetics-tax-summary {
  margin-top: 4px;
}

.purchase-cosmetics-tax-row {
  display: grid;
  grid-template-columns: minmax(7em, auto) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

@media (max-width: 600px) {
  .purchase-cosmetics-tax-row {
    grid-template-columns: minmax(6em, auto) minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
    font-size: 13px;
  }
}

/* 手入力XA番号 + 在庫選択ボタン */
.manual-code-with-selector {
  display: flex;
  gap: 6px;
  width: 100%;
  align-items: stretch;
  margin-top: 4px;
}
.manual-code-with-selector input {
  flex: 1 1 auto;
  min-width: 0;
  height: 52px;
  min-height: 52px;
  margin-top: 0;
  box-sizing: border-box;
}
.selector-open-btn {
  flex: 0 0 40px;
  width: 40px;
  height: 52px;
  min-height: 52px;
  margin-top: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

/* 在庫商品セレクターモーダル */
.stock-selector-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100000;
  pointer-events: auto;
  isolation: isolate;
  overscroll-behavior: contain;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}
.stock-selector-modal {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}
.stock-selector-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #dbe3ef;
  flex-shrink: 0;
}
.stock-selector-title {
  font-weight: bold;
  font-size: 15px;
}
.stock-selector-filters {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #dbe3ef;
  flex-shrink: 0;
}
.stock-selector-filter-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 0;
}
.stock-selector-filter-qty {
  flex: 0 0 76px;
  max-width: 76px;
}
.stock-selector-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: 55vh;
}
.stock-selector-table {
  width: 100%;
  min-width: 440px;
  border-collapse: collapse;
}
.stock-selector-table th,
.stock-selector-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #eef2f8;
  font-size: 13px;
  text-align: left;
}
.stock-selector-table th {
  background: #f5f7fa;
  position: sticky;
  top: 0;
  z-index: 1;
}
.stock-selector-qty-th {
  text-align: right;
}
.stock-selector-row {
  cursor: pointer;
}
.stock-selector-row:hover {
  background: #eef4ff;
}
.stock-selector-code {
  white-space: nowrap;
}
.stock-selector-qty {
  white-space: nowrap;
  min-width: 48px;
  text-align: right;
}
@media (max-width: 700px) {
  .stock-selector-modal-overlay {
    display: block;
    padding: 0;
    overflow: hidden;
  }
  .stock-selector-modal {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(env(safe-area-inset-top, 0px) + 130px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 146px);
    width: auto;
    max-width: none;
    height: auto;
    margin: 0;
    transform: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .stock-selector-filters {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 8px;
  }
  .stock-selector-filter-input {
    font-size: 13px;
    padding: 6px 6px;
  }
  .stock-selector-filter-qty {
    flex: 0 0 54px;
    max-width: 54px;
  }

  /* テーブルをモーダル幅内に収める */
  .stock-selector-table-wrap {
    overflow-x: hidden;
  }
  .stock-selector-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
  }
  /* XA番号列 */
  .stock-selector-table th:nth-child(1),
  .stock-selector-table td:nth-child(1) {
    width: 90px;
    word-break: break-all;
    white-space: normal;
  }
  /* 在庫数列 */
  .stock-selector-table th:nth-child(2),
  .stock-selector-table td:nth-child(2) {
    width: 36px;
    text-align: right;
  }
  /* 商品名列：残り幅を全部使い折り返し表示 */
  .stock-selector-table th:nth-child(3),
  .stock-selector-table td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  /* 選択ボタン列 */
  .stock-selector-table th:nth-child(4),
  .stock-selector-table td:nth-child(4) {
    width: 44px;
    padding: 4px 2px;
  }
  .stock-selector-table .row-mini-button {
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    font-size: 12px;
    padding: 4px 2px;
  }
}

.sale-product-scan-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 10px;
}

.xa-scan-mode-button {
  --xa-scan-visual-size: 72px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 88px;
  margin-top: 0;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.xa-scan-button-visual {
  position: relative;
  flex: 0 0 var(--xa-scan-visual-size);
  width: var(--xa-scan-visual-size);
  min-width: var(--xa-scan-visual-size);
  max-width: var(--xa-scan-visual-size);
  height: var(--xa-scan-visual-size);
  min-height: var(--xa-scan-visual-size);
  max-height: var(--xa-scan-visual-size);
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.xa-scan-mode-button .xa-scan-button-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  object-fit: cover;
}

.xa-scan-mode-button .xa-scan-button-image--mii {
  display: none;
}

.xa-scan-button-visual--rfid {
  display: grid;
  place-items: center;
  border: 2px solid #0f766e;
  background: #ecfdf5;
}

.xa-rfid-button-icon {
  color: #0f766e;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 900;
  letter-spacing: 0.04em;
}

html[data-app-theme="mii"] .xa-scan-mode-button .xa-scan-button-image--standard {
  display: none;
}

html[data-app-theme="mii"] .xa-scan-mode-button .xa-scan-button-image--mii {
  display: block;
}

.xa-scan-button-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

#saleScanStatusMessage {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}

.sale-product-add-area label {
  margin-top: 0;
}

.sale-product-add-area input {
  margin-top: 4px;
}

.sale-product-add-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

#saleScanInput {
  ime-mode: disabled;
}

.sale-scan-status {
  display: none;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 0;
  white-space: nowrap;
}

.sale-scan-status:empty {
  display: none !important;
  padding: 0;
  border: 0;
  margin: 0;
}

.sale-scan-status.is-active {
  display: block;
  border-color: #16a34a;
  background: #ecfdf5;
  color: #166534;
  font-weight: 700;
}

.sale-camera-scan-area {
  margin-top: 10px;
  width: 100%;
  max-width: 520px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
}

.sale-camera-scan-area video {
  display: block;
  width: 100%;
  min-height: 220px;
  max-height: 360px;
  object-fit: cover;
}

.sale-camera-scan-reader {
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}

.sale-camera-scan-reader video {
  width: 100% !important;
  min-height: 300px;
  max-height: 420px;
  object-fit: cover;
  border-radius: 12px;
}

.sale-camera-scan-reader canvas {
  max-width: 100%;
}

.sale-camera-scan-reader:empty {
  display: none;
}

.sales-consignment-settlement-sale-type {
  border: 1px solid var(--border);
  border-radius: 12px;
}

.sales-consignment-settlement-sale-type-title {
  margin-bottom: 8px;
  font-weight: 700;
}

.sales-consignment-sale-type-toggle {
  display: flex;
  width: 100%;
  box-sizing: border-box;
}

.sales-consignment-sale-type-toggle .sale-accounting-type-button {
  flex: 1 1 50%;
}

.sales-consignment-settlement-sale-type-help {
  margin-top: 7px;
  color: var(--muted);
}

/* 販売委託清算：納品/返却スキャンボタンは常に1行2個横並び（PC・iPhone共通） */
.scan-button-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.scan-button-row button {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .scan-button-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .scan-button-row button {
    flex: 1;
    font-size: 12px;
    padding: 8px 6px;
  }
}

/* QRリーダー/HID入力欄：内部的にフォーカスして入力を受け取るためだけに存在し、
   画面上には通常の入力欄として見せない */
.consignment-scan-hidden-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stock-taking-camera-scan-area {
  width: 100%;
  max-width: 520px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #111827;
}

.stock-taking-lists {
  display: grid;
  gap: 16px;
}

.stock-taking-list-panel {
  min-width: 0;
}

/* ===== エリア別棚卸 ===== */
.inv-status-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: bold;
}
.inv-badge-in-progress {
  background: #fff3cd;
  color: #856404;
}
.inv-badge-completed {
  background: #d1e7dd;
  color: #0a3622;
}
.inv-badge-editing {
  background: #cfe2ff;
  color: #084298;
}

.area-list-table {
  width: 100%;
  border-collapse: collapse;
}
.area-list-row td {
  vertical-align: middle;
}
.area-list-row:hover td {
  background: #f8f9fa;
}
.area-expand-toggle {
  font-size: 11px;
  color: #555;
  width: 20px;
  text-align: center;
  cursor: default;
}
.area-list-actions {
  white-space: nowrap;
}
.area-expand-row td {
  padding: 0 !important;
  background: #f8f9fa;
}
.area-scan-expand-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin: 4px 8px;
}
.area-scan-expand-table th,
.area-scan-expand-table td {
  padding: 3px 6px;
  border: none;
}

.stock-taking-quantity-input {
  width: 76px;
  min-width: 64px;
  padding: 6px 8px;
  text-align: right;
  box-sizing: border-box;
}

.stock-taking-unscanned-parent-code {
  display: flex;
  align-items: center;
  min-width: 0;
}

.stock-taking-unscanned-toggle {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  margin: 0 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #2563eb;
  font-size: 16px;
  line-height: 1;
}

.stock-taking-unscanned-toggle:hover,
.stock-taking-unscanned-toggle:focus-visible {
  background: color-mix(in srgb, #2563eb 10%, transparent);
  box-shadow: none;
}

html[data-app-theme="mii"] .stock-taking-unscanned-toggle {
  border-radius: 6px;
  box-shadow: none;
}

.stock-taking-unscanned-child-row td {
  background: color-mix(in srgb, var(--surface, #fff) 92%, #dbeafe);
}

.stock-taking-result-search-section label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.stock-taking-result-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.stock-taking-result-search-row input {
  width: 100%;
  box-sizing: border-box;
}

.stock-taking-result-search-row button {
  width: auto;
  min-width: 88px;
  margin: 0;
  white-space: nowrap;
}

.stock-taking-result-section-heading {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.stock-taking-result-section-heading h3 {
  min-width: 0;
  margin: 8px 0 4px;
}

.stock-taking-result-section-toggle {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #2563eb;
  font-size: 16px;
  line-height: 1;
}

.stock-taking-result-section-toggle:hover,
.stock-taking-result-section-toggle:focus-visible {
  background: color-mix(in srgb, #2563eb 10%, transparent);
  box-shadow: none;
}

html[data-app-theme="mii"] .stock-taking-result-section-toggle {
  border-radius: 6px;
  box-shadow: none;
}

.inv-result-section {
  margin-bottom: 20px;
}
.inv-result-section h3 {
  margin: 8px 0 4px;
  font-size: 15px;
}
.inv-result-total {
  font-weight: bold;
  border-top: 2px solid #ccc;
}

#stockTakingAreaScanInput {
  width: 100%;
  box-sizing: border-box;
}

.inventory-area-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inventory-area-actions button {
  width: auto;
  min-width: 72px;
  max-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .inventory-area-actions {
    gap: 4px;
  }
  .inventory-area-actions button {
    min-width: 64px;
    max-width: 120px;
    padding: 5px 8px;
    font-size: 12px;
  }
}

.inventory-area-scan-mode-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.inventory-area-scan-mode-row button {
  flex: 1;
}

.stock-taking-table {
  margin-top: 8px;
  font-size: 14px;
}

.stock-taking-table input[type="number"] {
  min-width: 80px;
}

#stockTakingSessionListContent .stock-taking-session-number-button {
  display: block;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  margin: 0 auto;
  padding: 5px 8px;
  white-space: nowrap;
}

.stock-taking-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

#saleCameraScanStatus.is-active {
  border-color: #16a34a;
  background: #ecfdf5;
  color: #166534;
  font-weight: 700;
}

.sale-parent-row {
  background: #f8fafc;
}

.sale-parent-header {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sale-parent-toggle {
  min-width: 34px;
  margin-top: 0;
}

.sale-child-row td {
  background: #fff;
}

.sale-child-cell {
  padding-left: 20px;
}

.sale-child-summary {
  font-size: 11px;
  color: var(--muted);
}

.sale-compact-parent-count {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

/* === 売上明細コンパクトレイアウト === */
.sale-entry-list {
  margin: 8px 0;
}

.sale-compact-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 7px 10px;
  margin: 5px 0;
  background: #fff;
  font-size: 13px;
}

.sale-compact-parent {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.sale-compact-parent-info {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sale-compact-parent-code {
  font-weight: 700;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
}

.sale-compact-parent-name {
  font-weight: 600;
  color: #374151;
}

.sale-compact-total {
  white-space: nowrap;
  font-weight: 700;
  color: #374151;
  min-width: 55px;
  text-align: right;
  font-size: 13px;
}

.sale-compact-child {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 32px;
  border-top: 1px solid #f3f4f6;
  margin-top: 4px;
  padding-top: 4px;
  padding-left: 20px;
}

.sale-compact-child-code {
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
}

.sale-compact-child-size {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.sale-compact-qty {
  white-space: nowrap;
  font-size: 12px;
  color: #374151;
}

.sale-compact-qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 32px;
}

.sale-compact-code {
  width: 110px;
  height: 28px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 0;
}

.sale-compact-name {
  flex: 1 1 80px;
  min-width: 0;
  color: #374151;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-compact-price-input {
  width: 76px;
  height: 28px;
  padding: 2px 5px;
  font-size: 12px;
  text-align: right;
  margin-top: 0;
}

.sale-parent-toggle-static {
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  color: #64748b;
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

.sale-compact-price-readonly {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 2px 5px;
  text-align: right;
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
}

.sale-compact-code-readonly {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #f9fafb;
}

.product-inquiry-code-link {
  color: #08769b;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}

.product-inquiry-code-link:hover,
.product-inquiry-code-link:focus-visible {
  color: #075d7a;
}

.sale-compact-code-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-readonly-items {
  margin-top: 4px;
  margin-bottom: 12px;
}

.purchase-readonly-items .sale-compact-name,
.purchase-readonly-items .sale-compact-child-size {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.sale-compact-qty-input {
  width: 44px;
  height: 28px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: right;
  margin-top: 0;
}

.sale-compact-amount {
  white-space: nowrap;
  font-weight: 700;
  min-width: 55px;
  text-align: right;
  font-size: 13px;
  color: #374151;
}

.sale-zero-price-qty {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.sale-zero-price-qty .sale-compact-qty-input {
  border-color: #f59e0b;
  background: #fffbeb;
}

.purchase-quantity-fields {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.purchase-free-qty-field {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  color: #b45309;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.purchase-free-qty-field[hidden] {
  display: none;
}

.purchase-free-qty-field input {
  border-color: #f59e0b;
  background: #fffbeb;
}

.sale-gross-margin-icon {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-sizing: border-box;
}

.sale-gross-margin-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: currentColor;
}

.sale-gross-margin-icon.is-blue {
  color: #2563eb;
  background: #dbeafe;
}

.sale-gross-margin-icon.is-green {
  color: #16a34a;
  background: #dcfce7;
}

.sale-gross-margin-icon.is-yellow {
  color: #ca8a04;
  background: #fef9c3;
}

.sale-gross-margin-icon.is-red {
  color: #dc2626;
  background: #fee2e2;
}

.sale-gross-margin-icon.is-unknown {
  color: #94a3b8;
  background: #f1f5f9;
}

.sale-compact-warning {
  font-size: 11px;
  min-height: 0;
}

/* === 製品カテゴリチップ === */
.product-category-chip-area {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px 6px;
  align-items: center;
  margin-top: 4px;
}

.product-category-chip {
  /* グローバル button { width: 100% } を上書き */
  width: auto;
  min-height: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  line-height: 1.6;
}

.product-category-chip:hover {
  border-color: #6b7280;
  background: #f9fafb;
}

.product-category-chip.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.stock-detail-filter-toggle {
  margin-top: 8px;
  text-align: left;
}

.stock-detail-filter-body {
  display: grid;
  grid-template-columns: minmax(112px, 0.28fr) minmax(0, 1fr);
  max-height: 320px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--card-bg, #fff);
}

.stock-detail-filter-body[hidden] {
  display: none;
}

.stock-detail-filter-tabs {
  display: flex;
  flex-direction: column;
  background: #f7f7f8;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
body.stock-selector-modal-open {
  overflow: hidden;
}
body.stock-selector-modal-open > :not(#stockProductSelectorModal) {
  pointer-events: none !important;
}

.stock-detail-filter-tab {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.stock-detail-filter-tab.active {
  border-left-color: #2563eb;
  background: var(--card-bg, #fff);
  color: #1d4ed8;
}

.stock-detail-filter-count {
  flex: 0 0 auto;
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.stock-detail-filter-content {
  min-width: 0;
  padding: 10px 12px 12px;
  overflow-y: auto;
}

.stock-detail-filter-title {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.stock-detail-filter-chips {
  margin-top: 0;
}

.stock-detail-filter-chips.is-range-filter {
  display: block;
}

.stock-active-detail-filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  margin-top: 8px;
}

.stock-active-detail-filter-badges[hidden] {
  display: none;
}

.stock-active-filter-badge {
  width: auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 3px 8px 3px 10px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.stock-active-filter-badge.is-material {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.stock-active-filter-badge.is-productCategory {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.stock-active-filter-badge.is-certificate {
  border-color: #fcd34d;
  background: #fef3c7;
  color: #92400e;
}

.stock-active-filter-badge.is-frame {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #334155;
}

.stock-active-filter-badge.is-size {
  border-color: #67e8f9;
  background: #cffafe;
  color: #155e75;
}

.stock-active-filter-badge.is-price {
  border-color: #fdba74;
  background: #ffedd5;
  color: #9a3412;
}

.stock-active-filter-badge.is-missingWeight {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}

.stock-active-filter-badge-remove {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.stock-dual-range {
  padding: 4px 4px 2px;
}

.product-missing-weight-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.product-missing-weight-filter input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
}

.stock-dual-range-value {
  min-height: 24px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.stock-dual-range-track {
  --range-start: 0%;
  --range-end: 100%;
  position: relative;
  height: 42px;
  margin: 0 14px;
}

.stock-dual-range-base,
.stock-dual-range-selected {
  position: absolute;
  top: 19px;
  height: 5px;
  border-radius: 3px;
}

.stock-dual-range-base {
  left: 0;
  right: 0;
  background: #e5e7eb;
}

.stock-dual-range-selected {
  left: var(--range-start);
  right: calc(100% - var(--range-end));
  background: #2563eb;
}

.stock-dual-range-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  pointer-events: none;
}

.stock-dual-range-track input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  background: transparent;
}

.stock-dual-range-track input[type="range"]::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -12px;
  appearance: none;
  -webkit-appearance: none;
  border: 3px solid #2563eb;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  cursor: grab;
}

.stock-dual-range-track input[type="range"]::-moz-range-track {
  height: 5px;
  background: transparent;
}

.stock-dual-range-track input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #2563eb;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  cursor: grab;
}

.stock-dual-range-track input[data-stock-range-side="min"] {
  z-index: 2;
}

.stock-dual-range-track input[data-stock-range-side="max"] {
  z-index: 3;
}

.stock-dual-range-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 640px) {
  .stock-detail-filter-body {
    grid-template-columns: 94px minmax(0, 1fr);
    max-height: 270px;
  }

  .stock-detail-filter-tab {
    min-height: 44px;
    padding: 7px 6px;
    font-size: 11px;
  }

  .stock-detail-filter-content {
    padding: 8px;
  }

  .stock-detail-filter-chips {
    gap: 5px;
  }

  .stock-detail-filter-chips .product-category-chip {
    padding: 4px 8px;
    font-size: 11px;
  }

  .stock-dual-range {
    padding-left: 0;
    padding-right: 0;
  }

  .stock-dual-range-value {
    font-size: 13px;
  }

  .stock-dual-range-track {
    margin: 0 12px;
  }

  .stock-dual-range-track input[type="range"]::-webkit-slider-thumb {
    width: 30px;
    height: 30px;
    margin-top: -13px;
  }
}

.sale-compact-item .sale-delete-button {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 28px;
  height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  margin-top: 0;
  width: auto;
}

.sale-compact-item .sale-parent-toggle {
  flex: 0 0 auto;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  height: 28px;
  padding: 0;
  font-size: 12px;
  margin-top: 0;
}

.sale-entry-table th:nth-child(7),
.sale-entry-table td:nth-child(7) {
  width: 96px;
  min-width: 96px;
  text-align: center;
}

.sale-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 34px;
  margin-top: 0;
  padding: 7px 12px;
  white-space: nowrap;
}

.invoice-item-info {
  margin-top: 2px;
  font-size: 12px;
  color: #555;
  line-height: 1.35;
}

.invoice-child-detail-row td {
  font-size: 12px;
  color: #555;
  border-top: 0;
  padding-top: 2px;
}

.sale-entry-table,
.purchase-entry-table {
  width: 100%;
  table-layout: fixed;
}

.sale-entry-table th,
.sale-entry-table td,
.purchase-entry-table th,
.purchase-entry-table td {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}

.sale-entry-table th:nth-child(1),
.sale-entry-table td:nth-child(1) {
  width: 36px;
}

.sale-entry-table th:nth-child(2),
.sale-entry-table td:nth-child(2) {
  width: 45%;
}

.sale-entry-table th:nth-child(3),
.sale-entry-table td:nth-child(3) {
  width: 12%;
}

.sale-entry-table th:nth-child(4),
.sale-entry-table td:nth-child(4) {
  width: 18%;
}

.sale-entry-table th:nth-child(5),
.sale-entry-table td:nth-child(5) {
  width: 18%;
}

.purchase-entry-table th:nth-child(1),
.purchase-entry-table td:nth-child(1) {
  width: 36px;
}

.purchase-entry-table th:nth-child(2),
.purchase-entry-table td:nth-child(2) {
  width: 42%;
}

.purchase-entry-table th:nth-child(3),
.purchase-entry-table td:nth-child(3) {
  width: 11%;
}

.purchase-entry-table th:nth-child(4),
.purchase-entry-table td:nth-child(4) {
  width: 16%;
}

.purchase-entry-table th:nth-child(5),
.purchase-entry-table td:nth-child(5) {
  width: 16%;
}

.purchase-entry-table th:nth-child(6),
.purchase-entry-table td:nth-child(6) {
  width: 120px;
  min-width: 120px;
}

.purchase-unit-editor-table-row > .purchase-unit-editor-table-cell {
  width: auto !important;
  padding: 10px !important;
}

.purchase-unit-editor-table-row #purchaseUnitInfoEditor {
  margin: 0 !important;
}

.purchase-unit-editor-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.purchase-unit-editor-child-table {
  width: 100%;
  border-collapse: collapse;
}

.purchase-entry-table .purchase-unit-editor-child-table th,
.purchase-entry-table .purchase-unit-editor-child-table td {
  width: auto;
  min-width: 0;
}

@media (max-width: 768px) {
  .sale-product-add-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* 数量 + 手入力XA番号 行はスマホでも横並び維持 */
  .sale-manual-code-row {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }

  .sale-qty-field {
    flex: 0 0 72px;
    min-width: 72px;
  }

  .sale-manual-code-field {
    flex: 1 1 auto;
    min-width: 0;
  }

  .sale-scan-status {
    white-space: normal;
  }

  .xa-scan-mode-button {
    --xa-scan-visual-size: 62px;
    min-height: 80px;
    padding: 6px 7px;
    gap: 5px;
  }

  .xa-scan-button-visual {
    border-radius: 10px;
  }

  .xa-scan-button-label {
    font-size: 13px;
  }

  .sale-entry-table input,
  .purchase-entry-table input {
    font-size: 12px;
    padding: 4px;
  }

  .sale-entry-table th,
  .sale-entry-table td,
  .purchase-entry-table th,
  .purchase-entry-table td {
    font-size: 12px;
    padding: 4px;
  }

  .code-name-sub {
    font-size: 11px;
  }
}

@media (max-width: 1100px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-kpi-card {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 136px;
    padding: 13px;
  }

  .dashboard-kpi-icon {
    width: 38px;
    height: 38px;
    font-size: 25px;
  }

  .dashboard-kpi-value {
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.row-mini-button {
  margin-top: 4px;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 6px;
  min-height: 34px;
}

.btn-label-print {
  background: #f97316;
  color: #fff;
  border: 1px solid #ea580c;
}

.btn-label-print:hover {
  background: #ea580c;
}

@media (max-width: 520px) {
  header,
  .app-header {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 8px;
    font-size: 16px;
    min-height: 46px;
  }

  .global-top-back-button {
    order: initial;
    flex: 0 0 76px;
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    min-height: 38px;
    margin: 0;
    padding: 3px 4px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.15;
  }

  .app-header-brand {
    position: absolute;
    left: 55%;
    transform: translateX(-50%);
    justify-content: center;
    max-width: none;
    font-size: 14px;
    gap: 2px;
    overflow: visible;
  }

  .app-header-brand .app-header-logo {
    display: none;
  }

  html[data-app-theme="mii"] .app-header-brand .app-header-logo-mii {
    display: block;
    width: 28px;
    height: 28px;
  }

  #appHeaderTitle {
    min-width: max-content;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .header-keyboard-qr {
    order: initial;
    width: 38px;
    height: 38px;
    margin: 0;
  }

  .header-product-scan-actions {
    order: initial;
    width: 76px;
    height: 38px;
    gap: 0;
    margin: 0;
  }

  .header-scan-action {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .header-scan-action > .material-symbols-outlined {
    line-height: 38px;
  }

  .header-user-menu {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 112px;
    margin-left: auto;
    font-size: 14px;
  }

  #headerUserName {
    display: inline-block;
    max-width: 4.2em;
  }

  .header-user-menu .user-menu-button {
    width: auto;
    max-width: 112px;
    min-width: 38px;
    min-height: 38px;
    gap: 2px;
    padding: 6px 2px;
  }

  .card {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 14px;
  }

  h2 {
    font-size: 20px;
    line-height: 1.3;
  }

  h3 {
    font-size: 17px;
    line-height: 1.35;
  }

  #topMenuCard .menu-section {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  button {
    min-height: 48px;
    padding: 12px;
  }

  .home-menu-tile {
    min-height: 0;
    padding: 6px 3px;
    gap: 4px;
  }

  .actions button,
  .row button {
    min-width: 0;
  }

  .product-list-row {
    grid-template-columns: 82px 1fr;
  }

  .product-photo-box,
  .product-photo,
  .product-photo-empty {
    width: 82px;
  }

  .product-photo,
  .product-photo-empty {
    height: 82px;
  }

  .product-props {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 8px;
  }

  .sale-entry-table,
  .purchase-entry-table {
    display: table;
    border-collapse: separate;
    border-spacing: 0 10px;
    overflow: visible;
  }

  .sale-entry-table thead,
  .purchase-entry-table thead {
    display: none;
  }

  .sale-entry-table tbody,
  .sale-entry-table tr,
  .sale-entry-table td,
  .purchase-entry-table tbody,
  .purchase-entry-table tr,
  .purchase-entry-table td {
    display: block;
    width: 100% !important;
    box-sizing: border-box;
  }

  .sale-entry-table tr,
  .purchase-entry-table tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    overflow: hidden;
  }

  .sale-entry-table td,
  .purchase-entry-table td {
    border: none;
    border-bottom: 1px solid #eef2f7;
    padding: 9px 10px;
  }

  .sale-entry-table td:last-child,
  .purchase-entry-table td:last-child {
    border-bottom: none;
  }

  .sale-entry-table td::before,
  .purchase-entry-table td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .sale-entry-table td:nth-child(1)::before,
  .purchase-entry-table td:nth-child(1)::before {
    content: "No";
  }

  .sale-entry-table td:nth-child(2)::before,
  .purchase-entry-table td:nth-child(2)::before {
    content: "商品コード / 商品名";
  }

  .sale-entry-table td:nth-child(3)::before,
  .purchase-entry-table td:nth-child(3)::before {
    content: "個数";
  }

  .sale-entry-table td:nth-child(4)::before,
  .purchase-entry-table td:nth-child(4)::before {
    content: "税込単価";
  }

  .sale-entry-table.is-export-sale td:nth-child(4)::before {
    content: "単価";
  }

  .sale-entry-table td:nth-child(5)::before,
  .purchase-entry-table td:nth-child(5)::before {
    content: "税込金額";
  }

  .sale-entry-table.is-export-sale td:nth-child(5)::before {
    content: "金額";
  }

  .purchase-entry-table td:nth-child(6)::before {
    content: "枝番";
  }

  .purchase-entry-table .purchase-unit-editor-table-row > .purchase-unit-editor-table-cell::before,
  .purchase-entry-table .purchase-unit-editor-child-table td::before {
    display: none !important;
    content: none !important;
  }

  .purchase-entry-table .purchase-unit-editor-child-table {
    display: table;
    min-width: 560px;
    border-collapse: collapse;
    border-spacing: 0;
  }

  .purchase-entry-table .purchase-unit-editor-child-table thead {
    display: table-header-group;
  }

  .purchase-entry-table .purchase-unit-editor-child-table tbody {
    display: table-row-group;
    width: auto !important;
  }

  .purchase-entry-table .purchase-unit-editor-child-table tr {
    display: table-row;
    width: auto !important;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .purchase-entry-table .purchase-unit-editor-child-table th,
  .purchase-entry-table .purchase-unit-editor-child-table td {
    display: table-cell;
    width: auto !important;
    padding: 6px;
    border: 1px solid var(--border);
  }

  .sale-entry-table td:nth-child(6)::before {
    content: "メモ";
  }

  .sale-entry-table td:nth-child(7)::before {
    content: "操作";
  }

  .sale-entry-table input,
  .purchase-entry-table input,
  .sale-entry-table textarea,
  .purchase-entry-table textarea {
    min-height: 42px;
    font-size: 16px;
    padding: 9px 10px;
  }

  .sale-delete-button,
  .row-mini-button {
    min-height: 40px;
    width: 100%;
  }

  .sale-compact-item .sale-delete-button,
  .sale-compact-item .sale-parent-toggle {
    min-height: 28px !important;
    height: 28px !important;
    width: auto !important;
    padding: 2px 8px !important;
  }

  .sale-compact-item input {
    min-height: auto !important;
    font-size: 12px !important;
    padding: 2px 5px !important;
  }

  .sale-compact-price-input {
    width: 70px !important;
  }

  .sale-compact-qty-input {
    width: 40px !important;
  }

  button.sale-compact-item {
    min-height: auto;
    padding: 0;
  }

  .total-box {
    text-align: left;
  }
}

.print-page-break {
  page-break-before: always;
  break-before: page;
}

@media print {
  .print-page-break {
    page-break-before: always;
    break-before: page;
  }
}

/* ===== ダッシュボードKPIカード クリック可能 ===== */
.dashboard-kpi-card--clickable {
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.dashboard-kpi-card--clickable:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* ===== 要対応カード ===== */

.dashboard-action-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.dashboard-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.dashboard-action-row:hover,
.dashboard-action-row:focus {
  background: rgba(0, 0, 0, 0.07);
  outline: none;
}

.dashboard-action-row:active {
  background: rgba(0, 0, 0, 0.12);
}

.dashboard-action-label {
  color: var(--muted);
  min-width: 2.5em;
}

.dashboard-action-row strong {
  font-size: 15px;
  color: var(--fg);
}

/* ===== 在庫レポート ===== */

.stock-report-chart-body {
  margin-bottom: 24px;
}

.stock-report-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 12px;
}

.stock-report-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  word-break: break-all;
}

.stock-report-bar-track {
  height: 18px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.stock-report-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.stock-report-bar-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 90px;
}

.stock-report-bar-amount {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.stock-report-bar-sub {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.stock-report-stacked-groups {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}

.stock-report-stacked-card {
  padding: 16px 18px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.stock-report-stacked-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.stock-report-stacked-bar {
  display: flex;
  width: 100%;
  height: 38px;
  overflow: hidden;
  border-radius: 6px;
  background: #e5e7eb;
}

.stock-report-stacked-segment {
  width: 0;
  min-width: 0;
  height: 100%;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.stock-report-stacked-segment + .stock-report-stacked-segment {
  border-left: 1px solid rgba(255, 255, 255, 0.7);
}

.stock-report-stacked-legend {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stock-report-stacked-legend-row {
  display: grid;
  grid-template-columns: 18px minmax(100px, auto) auto;
  justify-content: start;
  gap: 8px;
  align-items: center;
  color: #374151;
  font-size: 14px;
}

.stock-report-stacked-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(17, 24, 39, 0.35);
  border-radius: 50%;
}

.stock-report-stacked-legend-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stock-report-stacked-legend-row strong {
  white-space: nowrap;
  color: #111827;
}

@media (max-width: 640px) {
  .stock-report-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .stock-report-bar-info {
    align-items: flex-start;
  }

  .stock-report-stacked-card {
    padding: 14px 12px;
  }

  .stock-report-stacked-title {
    font-size: 16px;
  }

  .stock-report-stacked-bar {
    height: 32px;
  }

  .stock-report-stacked-legend-row {
    grid-template-columns: 16px minmax(0, 1fr) auto;
    width: 100%;
  }
}

/* ===== 売上レポート ===== */

.sales-report-period-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.sales-report-period-btn {
  padding: 6px 18px;
  font-size: 14px;
}

.sales-report-period-btn.is-active-period {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
}

.sales-report-custom-period {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.sales-report-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 10;
}

/* サマリーカード */
.sales-report-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.sales-report-summary-card {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.sales-report-summary-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}

.sales-report-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

/* グラフ */
.sales-scatter-card {
  margin: 0 0 24px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.sales-scatter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
}

.sales-scatter-summary::-webkit-details-marker {
  display: none;
}

.sales-scatter-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sales-scatter-toggle-icon {
  display: inline-block;
  color: #64748b;
  transition: transform 0.15s ease;
}

.sales-scatter-details[open] .sales-scatter-toggle-icon {
  transform: rotate(90deg);
}

.sales-scatter-summary > span:last-child {
  flex: 0 0 auto;
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
}

.sales-scatter-body {
  padding: 0 14px 14px;
  border-top: 1px solid #eef2f7;
}

.sales-scatter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sales-scatter-heading h3 {
  margin: 0;
  font-size: 16px;
  color: #111827;
}

.sales-scatter-heading span,
.sales-scatter-note {
  color: #6b7280;
  font-size: 12px;
}

.sales-scatter-note {
  margin: 5px 0 10px;
}

.sales-scatter-legend-control {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(240px, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin: 12px 0 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.sales-scatter-legend-select {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 7px 34px 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 14px;
}

.sales-scatter-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sales-scatter-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.sales-scatter-grid {
  stroke: #e5e7eb;
  stroke-width: 1;
}

.sales-scatter-axis {
  stroke: #64748b;
  stroke-width: 1.5;
}

.sales-scatter-axis-text {
  fill: #64748b;
  font-size: 12px;
}

.sales-scatter-axis-label {
  fill: #334155;
  font-size: 13px;
  font-weight: 700;
}

.sales-scatter-point {
  stroke: #fff;
  stroke-width: 2;
  opacity: 0.82;
  cursor: help;
}

.sales-scatter-point:hover,
.sales-scatter-point:focus {
  opacity: 1;
  stroke: #111827;
}

.sales-scatter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 10px;
}

.sales-scatter-legend-label {
  margin-top: 10px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.sales-scatter-point-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  min-height: 20px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
}

.sales-scatter-point-detail strong {
  color: #111827;
}

.sales-scatter-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #475569;
  font-size: 12px;
}

.sales-scatter-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .sales-scatter-summary {
    align-items: flex-start;
    padding: 12px;
    font-size: 14px;
  }

  .sales-scatter-body {
    padding: 0 10px 10px;
  }

  .sales-scatter-legend-control {
    grid-template-columns: 1fr;
  }
}

.sales-report-chart-body {
  margin-bottom: 24px;
}

.sales-report-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 10px;
  align-items: start;
  margin-bottom: 14px;
}

.sales-report-bar-group {
  margin-bottom: 14px;
}

.sales-report-bar-group .sales-report-bar-row {
  margin-bottom: 0;
}

.sales-report-expandable {
  cursor: pointer;
}

.sales-report-expandable:hover,
.sales-report-expandable:focus-visible,
.sales-report-expandable.is-expanded {
  background: #f8fafc;
  outline: none;
}

.sales-report-bar-row.sales-report-expandable {
  padding: 6px;
  border-radius: 8px;
}

.sales-report-expand-marker {
  display: inline-block;
  width: 1.2em;
  color: #2563eb;
  font-size: 11px;
}

.sales-report-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  word-break: break-all;
  padding-top: 2px;
}

.sales-report-bar-track {
  height: 18px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.sales-report-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.sales-report-bar-info {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.sales-report-bar-amount {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.sales-report-bar-sub {
  font-size: 12px;
  color: #6b7280;
}

.sales-report-empty {
  color: #9ca3af;
  padding: 16px 0;
}

/* テーブル */
.sales-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}

.sales-report-table th,
.sales-report-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.sales-report-table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
}

.sales-report-table .right {
  text-align: right;
}

.sales-report-summary-row:hover td,
.sales-report-summary-row:focus-visible td,
.sales-report-summary-row.is-expanded td {
  background: #f8fafc;
}

.sales-report-detail-row > td {
  padding: 0 8px 12px;
  white-space: normal;
}

.sales-report-detail-panel {
  margin: 8px 0 14px;
  padding: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #ffffff;
}

.sales-report-detail-title {
  margin-bottom: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.gross-profit-detail-note {
  margin-left: 8px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 400;
}

.sales-report-detail-scroll {
  overflow-x: auto;
}

.sales-report-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.sales-report-detail-table th,
.sales-report-detail-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  white-space: nowrap;
}

.sales-report-detail-table th {
  background: #f3f4f6;
  color: #374151;
}

.sales-report-detail-table .right {
  text-align: right;
}

.sales-report-detail-table .sales-report-detail-name {
  min-width: 220px;
  white-space: normal;
}

.gross-profit-detail-table {
  min-width: 900px;
}

.gross-profit-detail-table th:nth-last-child(-n + 3),
.gross-profit-detail-table td:nth-last-child(-n + 3) {
  min-width: 92px;
}

@media (max-width: 600px) {
  .sales-report-bar-row {
    grid-template-columns: 1fr;
  }

  .sales-report-bar-info {
    grid-column: 1;
  }

  .sales-report-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sales-report-table {
    display: block;
    overflow-x: auto;
  }

  .sales-report-detail-panel {
    padding: 8px;
  }

  .sales-report-detail-table .sales-report-detail-name {
    min-width: 180px;
  }
}

/* ===== バックアップ・復元 ===== */

.backup-section {
  margin-bottom: 8px;
}

.backup-restore-status {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  min-height: 48px;
  margin-top: 16px;
  color: #374151;
  line-height: 1.6;
}

.backup-preview-box {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.8;
}

.backup-restore-notice {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #854d0e;
}

/* ===== 売掛管理 ===== */

.receivable-customer-select-area {
  margin-bottom: 16px;
}

.receivable-list-filter-bar {
  margin-bottom: 16px;
}

.receivable-date-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
}

.receivable-date-filter-row input {
  width: 100%;
  box-sizing: border-box;
}

.consign-out-date-filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.consign-out-date-filter-row input {
  width: 100%;
  box-sizing: border-box;
}

.consign-out-action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 販売委託入力：「◯◯後に確定できます」の確定ボタンと「ドラフト保存」を同じ行に表示する */
.consignment-draft-notice-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.receivable-summary-card {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: #f9fafb;
}

.receivable-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
}

.receivable-summary-row.receivable-summary-balance {
  border-top: 1px solid #d1d5db;
  margin-top: 8px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 16px;
}

.receivable-balance-positive {
  color: #dc2626;
}

.receivable-balance-negative {
  color: #2563eb;
}

.receivable-payment-form-details {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: #fff;
}

.receivable-payment-form-details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  margin-bottom: 4px;
}

.receivable-payment-form-details summary::-webkit-details-marker {
  display: none;
}

.receivable-payment-form-details[open] summary {
  margin-bottom: 16px;
}

.receivable-payment-form .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.receivable-ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}

.receivable-ledger-table th,
.receivable-ledger-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  vertical-align: middle;
}

.receivable-ledger-table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #374151;
}

.receivable-ledger-table td.right {
  text-align: right;
}

@media (max-width: 600px) {
  .receivable-payment-form .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .receivable-ledger-table {
    display: block;
    overflow-x: auto;
  }
}

/* 非アクティブ入金伝票行 */
.receivable-inactive-row td {
  background: #f3f4f6;
  color: #9ca3af;
}

.receivable-inactive-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ドラフト保存中の販売委託伝票行（一覧） */
.consign-out-draft-row td {
  background: #fffbeb;
}

.consign-out-draft-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.receivable-payment-slip-link {
  font-size: 12px;
  padding: 4px 10px;
}

.receivable-payment-detail-card {
  max-height: 90vh;
  overflow-y: auto;
}

.receivable-payment-detail-photo-row {
  align-items: flex-start;
  margin-top: 10px;
}

.receivable-payment-detail-photo-button {
  width: 148px;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  box-shadow: none;
}

.receivable-payment-detail-photo-button img {
  display: block;
  width: 100%;
  height: 148px;
  object-fit: contain;
}

@media (max-width: 600px) {
  /* iPhone幅ではカード/表が圧迫されないよう伝票番号ボタンを省略表示にする
     （表示文字自体もJS側でisIOSDevice()時に"..."へ固定している） */
  .receivable-payment-slip-link.mobile-ellipsis {
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
  }
}

.receivable-deactivate-btn {
  color: #dc2626 !important;
  margin-left: 4px;
}

/* 入金伝票 表示中バナー */
#receivableViewingInfo {
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #f9fafb;
  font-size: 13px;
  line-height: 1.7;
}

.receivable-viewing-info-content {
  color: #374151;
}

/* ===== 請求書印刷＆ドラフト保存ブロック ===== */

.invoice-print-save-block {
  margin-top: 8px;
}

.sale-accounting-type-readonly,
.sale-payment-method-readonly {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.sale-accounting-type-readonly[hidden],
.sale-payment-method-readonly[hidden] {
  display: none;
}

.sale-core-fields-readonly {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 8px 0 14px;
}

.sale-core-fields-readonly[hidden] {
  display: none;
}

.sale-core-readonly-field {
  min-width: 0;
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.sale-core-readonly-label {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.screen-saleEntry.sale-entry-limited-edit #saleDateLabel,
.screen-saleEntry.sale-entry-limited-edit #saleDate,
.screen-saleEntry.sale-entry-limited-edit #saleCustomerSearchLabel,
.screen-saleEntry.sale-entry-limited-edit #saleCustomerSearch,
.screen-saleEntry.sale-entry-limited-edit #saleCustomerRow,
.screen-saleEntry.sale-entry-limited-edit #saleNoLabel,
.screen-saleEntry.sale-entry-limited-edit #saleNoDisplay {
  display: none !important;
}

@media (max-width: 700px) {
  .sale-core-fields-readonly {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  }

  .sale-core-readonly-number {
    grid-column: 1 / -1;
  }
}

.invoice-print-save-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.invoice-print-save-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.invoice-print-save-buttons button {
  flex: 0 0 auto;
  min-width: 72px;
}

/* ===== MP-B20 58mm 印刷 ===== */

.mp-b20-print-area {
  display: none;
  width: 48mm;
  font-family: system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #000;
  background: #fff;
}

.mp-b20-inner {
  padding: 2mm;
}

.mp-b20-company {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 1mm;
}

.mp-b20-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3mm;
}

.mp-b20-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  align-items: baseline;
}

.mp-b20-divider {
  border: none;
  border-top: 1px dashed #000;
  margin: 2mm 0;
}

.mp-b20-total {
  font-size: 14px;
  font-weight: 700;
}

.mp-b20-small {
  font-size: 9px;
}

.mp-b20-items-section {
  margin: 1mm 0;
}

.mp-b20-item {
  margin-bottom: 1.5mm;
}

.mp-b20-receipt-amount {
  text-align: center;
  margin: 3mm 0;
}

.mp-b20-receipt-big {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin: 1mm 0;
}

/* 印刷エリアは通常非表示（新ウィンドウ方式のため本体側では使用しない） */

/* ===== 注文受付 ===== */

.order-request-paste-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  margin: 8px 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.order-request-paste-area:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.order-request-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 4px;
}

.order-request-row:hover,
.order-request-row.active {
  background: var(--primary-soft);
}

.order-request-thumb-cell {
  flex-shrink: 0;
}

.order-request-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.order-request-no-photo-box {
  width: 56px;
  height: 56px;
  background: var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
}

.order-request-info {
  flex: 1;
  min-width: 0;
}

.order-request-no {
  font-weight: 600;
  font-size: 13px;
}

.order-request-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.order-request-memo-preview {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-request-status-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: #e8f4fd;
  color: #0077cc;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.order-request-row--completed {
  opacity: 0.65;
}

.order-request-filter {
  margin-bottom: 10px;
}

.order-request-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.order-request-detail-inner {
  padding: 0;
}

.order-request-detail-inner h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 600;
}

.order-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}

.order-detail-table th {
  width: 80px;
  text-align: left;
  color: var(--muted);
  padding: 3px 8px 3px 0;
  font-weight: normal;
  vertical-align: top;
}

.order-detail-table td {
  padding: 3px 0;
  word-break: break-all;
}

.order-detail-photo img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 6px;
  display: block;
  margin: 8px 0;
}

.order-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.order-detail-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.order-detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.order-detail-photos-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-detail-photos-block .order-detail-photo img {
  max-width: 140px;
  max-height: 140px;
}

.handler-pending-photo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.readonly-box {
  background: var(--bg-soft, #f8f8f8);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 36px;
}

.order-request-detail-readonly h3 {
  color: var(--muted);
}

/* 注文受付画面レイアウト */

.screen-orderRequests-layout {
  display: flex;
  gap: 16px;
}

.order-request-list-panel {
  flex: 1;
  min-width: 0;
}

.order-request-detail-panel {
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

@media (max-width: 700px) {
  .screen-orderRequests-layout {
    flex-direction: column;
  }

  .order-request-detail-panel {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 12px;
  }
}

.order-request-detail-panel--inline {
  width: 100%;
  flex: none;
  box-sizing: border-box;
  margin: 8px 0 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface, #fff);
}

.order-request-customer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.order-request-status-badge--completed {
  background: #e8f0e8;
  color: #3a7a3a;
}

.order-detail-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.readonly-box {
  background: var(--bg-secondary, #f5f5f7);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 36px;
  word-break: break-all;
  white-space: pre-wrap;
  margin-bottom: 4px;
}

.order-detail-photos-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.order-request-detail-readonly h3 {
  color: var(--muted);
}

.payment-photo-preview-item {
  position: relative;
  display: inline-block;
}
.payment-photo-preview-item .btn-photo-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sale-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.sale-attachment-preview-item {
  position: relative;
  width: min(220px, 100%);
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fff);
  overflow: hidden;
}

.sale-attachment-open {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  align-items: center;
  min-height: 72px;
  padding: 8px 28px 8px 8px;
  color: inherit;
  text-decoration: none;
}

.sale-attachment-icon {
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 9px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
  font-weight: 800;
}

.sale-attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.sale-attachment-size {
  color: var(--muted);
  font-size: 11px;
}

.sale-attachment-preview-item .btn-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  line-height: 1;
}

/* 売上入力画面：元注文表示パネル */

.sale-entry-source-order {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #f9f9fb;
}

.sale-entry-source-order-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sale-entry-source-order-no {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.sale-entry-source-order-photo {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
  display: block;
}

/* ===== コンパクトCSVエリア ===== */
.btn-small {
  width: auto;
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
  min-height: 0;
  margin-top: 0;
  line-height: 1.2;
  white-space: nowrap;
}

.csv-toggle-button {
  margin-top: 8px;
}

label.btn-small-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--secondary);
  color: white;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
  flex: 0 0 auto;
}

label.btn-small-secondary:hover {
  background: var(--secondary-dark);
}

.product-csv-import-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  margin-top: 8px;
}

.product-csv-import-row .btn-small {
  flex: 0 0 auto;
}

.csv-file-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== ログイン後ローディング画面 ===== */
#loadingOnlyScreen {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  min-height: 60vh;
}

.loading-card {
  min-width: 320px;
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.loading-progress-bar-wrap {
  background: var(--border);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin: 16px 0 8px;
}

.loading-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  width: 0%;
  transition: width 0.3s ease;
}

.loading-progress-text {
  color: var(--muted);
  font-size: 12px;
  min-height: 1.5em;
  text-align: left;
}

.loading-error-text {
  color: var(--danger);
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.8;
  text-align: left;
}

/* 商品一覧：絞り込み2列グリッド */

.product-list-type-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: nowrap;
  width: 100%;
}

.product-list-type-filter-header h3 {
  margin: 0;
  flex: 0 0 auto;
}

.product-list-type-filter-chips {
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-top: 0;
}

.product-price-rate-margin-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  margin-top: 12px;
}

.product-price-rate-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.product-price-rate-label input[type="checkbox"] {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}

.product-child-common-readonly-value {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
}

.product-child-common-readonly-text {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.product-child-common-readonly-note {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .product-child-common-readonly-value {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
}

.product-gross-margin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.product-gross-margin-badge.is-blue {
  border-color: #60a5fa;
  background: #dbeafe;
  color: #1d4ed8;
}

.product-gross-margin-badge.is-green {
  border-color: #4ade80;
  background: #dcfce7;
  color: #15803d;
}

.product-gross-margin-badge.is-yellow {
  border-color: #facc15;
  background: #fef9c3;
  color: #854d0e;
}

.product-gross-margin-badge.is-red {
  border-color: #f87171;
  background: #fee2e2;
  color: #b91c1c;
}

/* 全画面共通：日付入力がスマホで横にはみ出す問題を防止 */

input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: block;
  -webkit-appearance: none;
  appearance: none;
}

/* 全画面共通：チェックボックスを通常サイズに統一 */

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  max-width: 22px;
  min-height: 22px;
  max-height: 22px;
  padding: 0;
  margin: 0 6px 0 0;
  flex: 0 0 auto;
  transform: none !important;
  vertical-align: middle;
  border-radius: 4px;
}

/* チェックボックス付きlabelを横並びに */
label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
  writing-mode: horizontal-tb;
  white-space: nowrap;
}

/* 在庫補正：履歴一覧テーブル */

.stock-inventory-common-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stock-inventory-history-cards {
  display: grid;
  gap: 10px;
}

.stock-inventory-history-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.stock-inventory-history-card.is-deleted {
  opacity: 0.62;
}

.stock-inventory-history-summary {
  width: 100%;
  min-height: 0;
  padding: 13px 15px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: none;
}

.stock-inventory-history-photos {
  width: 68px;
  min-height: 62px;
  display: grid;
  grid-template-columns: repeat(2, 30px);
  align-content: start;
  gap: 4px;
}

.stock-inventory-history-photo-thumb {
  width: 30px;
  height: 30px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #f3f4f6;
}

.stock-inventory-history-photo-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.stock-inventory-history-photo-empty {
  width: 64px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  background: color-mix(in srgb, var(--card) 92%, var(--muted));
}

.stock-inventory-history-summary:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  transform: none;
}

.stock-inventory-history-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.stock-inventory-history-title {
  font-weight: 700;
}

.stock-inventory-history-meta,
.stock-inventory-history-memo {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-inventory-history-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.stock-inventory-history-status.is-active {
  color: #166534;
  background: #dcfce7;
}

.stock-inventory-history-status.is-deleted {
  color: #6b7280;
  background: #e5e7eb;
}

.stock-inventory-history-status.is-draft {
  color: #92400e;
  background: #fef3c7;
}

.stock-inventory-history-chevron {
  color: var(--muted);
}

.stock-inventory-history-detail {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

.stock-inventory-detail-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.stock-inventory-detail-photos img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.stock-inventory-history-row-selected {
  background: #eaf4ff;
  box-shadow: inset 4px 0 0 #397d8d;
}

.stock-inventory-detail-row > .stock-inventory-detail-cell {
  width: auto !important;
  max-width: none !important;
  padding: 0 !important;
  overflow: visible !important;
  background: #f8fafc;
}

/* 伝票番号ボタン（リンク風） */
.stock-inv-slip-link {
  background: none;
  border: none;
  color: var(--accent, #1a56db);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  min-height: 0;
  width: auto;
  min-width: 0;
  display: inline;
  white-space: nowrap;
}
.stock-inv-slip-link:hover {
  opacity: 0.75;
}

/* メモ列 */
.stock-inv-hist-memo-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #555;
}

/* 列：修正日 / 在庫補正伝票 / 倉庫 / 商品数 / 状態 / メモ（6列） */
@media (max-width: 700px) {
  .stock-inventory-common-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stock-inventory-history-summary {
    padding: 11px 12px;
    gap: 8px;
    grid-template-columns: 58px minmax(0, 1fr) auto auto;
  }

  .stock-inventory-history-photos {
    width: 58px;
    min-height: 54px;
    grid-template-columns: repeat(2, 25px);
  }

  .stock-inventory-history-photo-thumb {
    width: 25px;
    height: 25px;
  }

  .stock-inventory-history-photo-empty {
    width: 54px;
    height: 54px;
  }

  .stock-inventory-history-status {
    padding: 3px 7px;
    font-size: 11px;
  }

  .stock-inventory-history-title {
    font-size: 13px;
  }

  #stockInventoryList {
    overflow-x: hidden;
  }

  .stock-inventory-history-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 11px;
  }

  .stock-inventory-history-table > thead > tr > th,
  .stock-inventory-history-table
    > tbody
    > tr:not(.stock-inventory-detail-row)
    > td {
    padding: 5px 3px;
    vertical-align: middle;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* 修正日 */
  .stock-inventory-history-table > thead > tr > th:nth-child(1),
  .stock-inventory-history-table
    > tbody
    > tr:not(.stock-inventory-detail-row)
    > td:nth-child(1) { width: 52px; }

  /* 伝票番号ボタン列 */
  .stock-inv-hist-slip-cell { width: 52px; text-align: center; }

  /* 倉庫 */
  .stock-inventory-history-table > thead > tr > th:nth-child(3),
  .stock-inventory-history-table
    > tbody
    > tr:not(.stock-inventory-detail-row)
    > td:nth-child(3) { width: 34px; }

  /* 商品数 */
  .stock-inventory-history-table > thead > tr > th:nth-child(4),
  .stock-inventory-history-table
    > tbody
    > tr:not(.stock-inventory-detail-row)
    > td:nth-child(4) { width: 26px; text-align: right; }

  /* 状態 */
  .stock-inventory-history-table > thead > tr > th:nth-child(5),
  .stock-inventory-history-table
    > tbody
    > tr:not(.stock-inventory-detail-row)
    > td:nth-child(5) { width: 36px; }

  /* メモ（6列目、残り幅） */
  .stock-inv-hist-memo-cell { font-size: 10px; }
}

/* 在庫補正：スマホでカード形式に変換 */

@media (max-width: 700px) {
  .stock-inventory-table {
    display: block;
    width: 100%;
    overflow-x: hidden;
  }

  .stock-inventory-table thead {
    display: none;
  }

  .stock-inventory-table tbody {
    display: block;
    width: 100%;
  }

  /* 行をコンパクトなカードに変換 */
  .stock-inventory-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(90px, 0.4fr);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--card);
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }

  /* 商品番号・商品名は全幅 */
  .stock-inventory-table td:nth-child(1),
  .stock-inventory-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  .stock-inventory-table td {
    padding: 4px 4px 4px 0;
    text-align: left;
    border: none;
    min-width: 0;
    box-sizing: border-box;
  }

  .stock-inventory-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: bold;
    color: var(--muted);
    margin-bottom: 3px;
    white-space: nowrap;
  }

  .stock-inventory-table td:nth-child(4) {
    margin-top: 6px;
    padding-right: 0;
  }

  .stock-inventory-table td input,
  .stock-inventory-table td select,
  .stock-inventory-table td button {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .stock-inventory-table .manual-code-with-selector {
    display: flex;
    gap: 6px;
  }

  .stock-inventory-table .manual-code-with-selector input {
    flex: 1;
    min-width: 0;
  }

  .stock-inventory-table .manual-code-with-selector button {
    flex: 0 0 auto;
    width: auto;
    min-width: 44px;
  }
}

/* 仕入一覧カード：写真＋2列レイアウト */

.purchase-type-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 10px;
  border: 1px solid #d7deea;
  border-radius: 10px;
  background: #f5f7fb;
}

.domestic-carry-out-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.domestic-carry-out-scan-section {
  margin-top: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.domestic-carry-out-scan-controls {
  display: grid;
  grid-template-columns: 120px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.domestic-carry-out-scan-controls button {
  width: auto;
  min-width: 88px;
}

.screen-overseasCarryOut details {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft, #fafafa);
}

.screen-overseasCarryOut details > summary {
  cursor: pointer;
  font-weight: 700;
}

#overseasCarryOutItemList,
#overseasCarryOutReturnItemList,
#overseasCarryOutSessionList {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#overseasCarryOutItemList table {
  min-width: 1120px;
}

#overseasCarryOutItemList input {
  min-width: 96px;
  margin: 0;
  padding: 6px 8px;
}

#overseasCarryOutItemList td:nth-child(3) input {
  min-width: 250px;
}

@media (max-width: 720px) {
  .domestic-carry-out-editor-grid,
  .domestic-carry-out-scan-controls {
    grid-template-columns: 1fr;
  }

  .domestic-carry-out-scan-controls button {
    width: 100%;
  }
}

.purchase-type-switch .purchase-type-switch-button {
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 6px 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #526174;
  box-shadow: none;
}

.purchase-type-switch .purchase-type-switch-button.is-active {
  background: #2563eb;
  color: #fff;
}

.purchase-entry-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.purchase-entry-heading-row h2 {
  margin-right: auto;
}

.purchase-entry-product-type-switch {
  flex: 0 0 auto;
  margin-bottom: 0;
}

@media (max-width: 720px) {
  .purchase-entry-heading-row {
    align-items: flex-start;
  }

  .purchase-entry-product-type-switch .purchase-type-switch-button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
  }
}

.purchase-list-card-body {
  display: flex;
  gap: 10px;
  margin: 6px 0 4px;
  align-items: flex-start;
}

.purchase-list-card-photos {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 56px;
}

.purchase-list-no-photo {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 2px;
}

.purchase-list-photo-thumb {
  width: 78px;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid var(--border);
}

.purchase-list-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.purchase-list-card-info {
  flex: 1;
  min-width: 0;
}

.purchase-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 8px;
}

.purchase-info-grid > div {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-info-grid .purchase-info-count {
  grid-column: 1;
}

.purchase-info-grid .purchase-info-total {
  grid-column: 2;
}

.purchase-info-full {
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.purchase-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.purchase-list-actions button {
  width: auto;
  min-width: 64px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  border-radius: 6px;
}

@media (max-width: 600px) {
  .purchase-list-actions button {
    width: auto !important;
    min-width: 58px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .purchase-list-photo-thumb {
    width: 68px;
    height: 68px;
  }
}

/* 売上一覧カード：写真＋2列レイアウト */

.sale-list-card-body {
  display: flex;
  gap: 10px;
  margin: 6px 0 4px;
  align-items: flex-start;
}

.sale-list-card-photos {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 56px;
}

.sale-list-photo-thumb {
  position: relative;
  width: 52px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f3f4f6;
}

.sale-list-photo-thumb img {
  width: 100%;
  height: 52px;
  object-fit: cover;
  display: block;
}

.sale-list-photo-thumb span {
  display: block;
  font-size: 9px;
  text-align: center;
  padding: 1px 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
}

.sale-list-photo-product span {
  color: #1d4ed8;
}

.sale-list-photo-payment span {
  color: #15803d;
}

.sale-list-attachment {
  color: inherit;
  text-decoration: none;
}

.sale-list-attachment-icon {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 !important;
  background: #eef2ff !important;
  color: #3730a3 !important;
  font-size: 12px !important;
  font-weight: 800;
}

.sale-list-attachment > span:last-child {
  color: #7c3aed;
}

.sale-list-photo-empty {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 2px;
}

.photo-modal-nav {
  display: none;
  position: fixed;
  top: 50%;
  z-index: 10000;
  width: 48px;
  min-width: 48px;
  height: 64px;
  padding: 0;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.photo-modal-nav--prev {
  left: 12px;
}

.photo-modal-nav--next {
  right: 12px;
}

.photo-modal-counter {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 10000;
  transform: translateX(-50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: #fff;
  font-size: 13px;
}

.sales-list-detail-toggle-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.sales-list-detail-toggle {
  width: 42px !important;
  min-width: 42px;
  min-height: 32px;
  margin: 0;
  padding: 5px 8px;
  line-height: 1;
}

.sales-list-items-panel {
  margin-top: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sales-list-items-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.sales-list-items-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sales-list-items-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sales-list-items-table {
  min-width: 560px;
  margin: 0;
}

.sales-list-items-table th,
.sales-list-items-table td {
  padding: 7px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.sales-list-items-table th:nth-child(2),
.sales-list-items-table td:nth-child(2) {
  min-width: 200px;
  white-space: normal;
}

/* 商品一覧・売上一覧共通：表示方法（詳細/簡易）切替カード。必ず1行で表示する */
.list-display-mode-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 12px;
}

.list-display-mode-card label {
  white-space: nowrap;
  margin: 0;
}

.list-display-mode-card select {
  flex: 1;
  min-width: 120px;
  margin-top: 0;
}

/* 売上一覧：簡易表示行（写真・日付・登録者・合計金額のみ） */
.sales-simple-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  cursor: pointer;
}

.sales-simple-photo {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f3f4f6;
}

.sales-simple-photo-empty {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: #f9fafb;
}

.sales-simple-main {
  min-width: 0;
}

.sales-simple-date,
.sales-simple-customer,
.sales-simple-user {
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-simple-date {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  overflow: visible;
  white-space: normal;
}

.sales-simple-date .sales-simple-status-badge,
.sales-simple-date .sales-simple-payment-badge {
  margin-left: 0;
}

.sales-simple-status-stack,
.sale-info-status-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.sales-simple-cosmetics-badge {
  display: inline-block;
  margin: 0;
  padding: 1px 6px;
  border: 1px solid #111827;
  border-radius: 4px;
  background: #ffffff;
  color: #111827;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.cosmetics-shipping-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.48);
}

.cosmetics-shipping-warning-dialog {
  width: min(100%, 460px);
  padding: 24px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.cosmetics-shipping-warning-title {
  margin-bottom: 10px;
  color: #b91c1c;
  font-size: 19px;
  font-weight: 700;
}

.cosmetics-shipping-warning-message {
  margin-bottom: 20px;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.7;
}

.cosmetics-shipping-warning-actions {
  display: grid;
  gap: 10px;
}

.cosmetics-shipping-warning-actions button {
  width: 100%;
  min-height: 46px;
}

.sales-simple-total {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

/* 売上一覧：簡易表示中の削除済み売上行（グレー表示＋バッジのみで区別、フルサイズにはしない） */
.sales-simple-row-inactive {
  background: #f3f4f6;
  color: #9ca3af;
}

.sales-simple-row-inactive .sales-simple-total {
  color: #9ca3af;
}

.sales-simple-inactive-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sales-simple-status-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  vertical-align: middle;
}

.sales-simple-status-badge-confirmed {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}

.sales-simple-status-badge-draft {
  border-color: #fdba74;
  background: #ffedd5;
  color: #9a3412;
}

.sales-simple-status-badge-excluded {
  border-color: #c4b5fd;
  background: #ede9fe;
  color: #6d28d9;
}

.sales-simple-payment-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  vertical-align: middle;
}

.sales-simple-payment-badge-cash {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.sales-simple-payment-badge-qr {
  border-color: #c4b5fd;
  background: #ede9fe;
  color: #6d28d9;
}

.sales-simple-payment-badge-bank-transfer {
  border-color: #67e8f9;
  background: #cffafe;
  color: #0e7490;
}

.sales-simple-payment-badge-accounts-receivable {
  border-color: #fcd34d;
  background: #fef3c7;
  color: #92400e;
}

.sale-list-card-info {
  flex: 1;
  min-width: 0;
}

.sale-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 8px;
}

.sale-info-grid > div {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sale-info-full {
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 在庫組換 ===== */

.recomb-section {
  margin: 16px 0;
}

.recomb-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.recombination-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.recombination-card.source-card {
  border-top: 3px solid var(--primary);
}

.recombination-card.destination-card {
  border-top: 3px solid var(--success, #15803d);
}

.recombination-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.recomb-entry-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 14px;
}

.recomb-entry-table th,
.recomb-entry-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.recomb-entry-table th {
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  background: var(--card-header-bg, var(--bg));
}

.recomb-entry-table input[type="text"],
.recomb-entry-table input:not([type]) {
  width: 100%;
  min-width: 100px;
}

.recomb-qty-input {
  width: 72px !important;
}

.recomb-remove-btn {
  font-size: 12px;
  padding: 4px 8px !important;
}

.recomb-child-editor-table-row > td {
  padding: 0 8px 10px;
  background: var(--bg);
}

.recomb-child-editor {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.recomb-child-editor-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.recomb-child-editor-row {
  display: grid;
  grid-template-columns: minmax(125px, 0.8fr) repeat(3, minmax(150px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.recomb-child-editor-row:first-of-type {
  border-top: 0;
}

.recomb-child-editor-row label {
  margin: 0;
}

.recomb-child-editor-row label span,
.recomb-child-code {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--muted);
}

.recomb-child-code {
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--text);
}

.recomb-child-editor-row input {
  width: 100%;
  min-width: 0 !important;
}

.recomb-add-row-btn {
  font-size: 13px;
  margin-top: 4px;
}

.recomb-product-name {
  color: var(--text);
  min-width: 80px;
}

.recomb-name-error {
  color: var(--danger, #e53e3e) !important;
}

/* 一覧 */
.recomb-list-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card-bg, var(--bg));
}

.recomb-list-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.recomb-list-photos {
  width: 132px;
  flex: 0 0 132px;
  display: grid;
  grid-template-columns: repeat(2, 60px);
  gap: 6px;
  align-content: start;
}

.recomb-list-photo-thumb {
  width: 60px;
  height: 60px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f3f4f6;
}

.recomb-list-photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.recomb-list-no-photo {
  width: 126px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.recomb-list-content {
  flex: 1;
  min-width: 0;
}

.recomb-list-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.recomb-list-date {
  font-weight: 600;
  font-size: 14px;
}

.recomb-list-no {
  font-size: 12px;
}

.recomb-list-summary {
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.6;
}

.recomb-list-arrow {
  margin: 0 4px;
  color: var(--muted);
}

.recomb-list-total {
  color: var(--muted);
  margin-left: 6px;
}

.recomb-list-memo {
  margin-top: 2px;
  margin-bottom: 6px;
}

.recomb-list-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* 詳細 */
.recomb-detail-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
  background: var(--card-bg, var(--bg));
}

.recomb-detail-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.recomb-detail-tables {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.recomb-detail-arrow {
  font-size: 20px;
  color: var(--muted);
  align-self: center;
  padding-top: 28px;
}

.recomb-detail-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.recomb-detail-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 200px;
}

.recomb-detail-table th,
.recomb-detail-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.recomb-detail-table th {
  font-size: 11px;
  color: var(--muted);
}

.recomb-detail-close-btn {
  font-size: 13px;
}

.recomb-qty-summary {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.8;
}

.recomb-qty-note {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== 複数行組換UI ===== */
.recomb-multi-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--card-bg, var(--bg));
}

.recomb-multi-row-cost {
  margin-top: 8px;
  padding: 5px 8px;
  background: var(--bg);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
}

.recomb-cost-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.recomb-cost-diff-area {
  margin: 6px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.recomb-diff-nonzero {
  font-weight: 600;
  color: var(--danger, #e53e3e);
}

#recombCostDiffWarning {
  margin-top: 4px;
  color: var(--danger, #e53e3e);
}

.recomb-detail-cost-summary {
  margin: 8px 0 10px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
  line-height: 2;
}

@media (max-width: 768px) {
  .recomb-list-body {
    gap: 8px;
  }

  .recomb-list-photos {
    width: 68px;
    flex-basis: 68px;
    grid-template-columns: 60px;
  }

  .recomb-list-no-photo {
    width: 60px;
  }

  .recomb-entry-table th,
  .recomb-entry-table td {
    padding: 4px 6px;
  }

  .recomb-detail-tables {
    flex-direction: column;
    gap: 12px;
  }

  .recomb-detail-arrow {
    padding-top: 0;
    align-self: auto;
  }

  .header-keyboard-qr {
    width: 38px;
    height: 38px;
    margin-right: 3px;
  }

  .header-product-scan-actions {
    gap: 0;
    margin-right: 3px;
  }

  .header-scan-action {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .header-scan-action > .material-symbols-outlined {
    font-size: 27px;
    line-height: 38px;
  }

  .header-scan-action-label {
    right: -3px;
    font-size: 8px;
  }

  .product-inquiry-overlay {
    align-items: flex-start;
    padding: 6px;
  }

  .product-inquiry-modal {
    max-height: calc(100dvh - 12px);
    border-radius: 10px;
  }

  .product-inquiry-body {
    padding: 9px;
  }

  .product-inquiry-summary {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 9px;
  }

  .product-inquiry-photo,
  .product-inquiry-photo-empty {
    width: 82px;
    height: 82px;
  }

  .product-inquiry-title {
    font-size: 16px;
  }

  .product-inquiry-fields {
    gap: 4px 9px;
    font-size: 12px;
  }

  .product-inquiry-actions button {
    min-height: 42px;
    padding: 8px;
  }

  .recomb-child-editor-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .recomb-child-code {
    margin-bottom: 0;
  }
}

/* ===== 商品カテゴリ再検証（管理者機能） ===== */
.admin-catval-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.admin-catval-stat {
  flex: 1 1 80px;
  text-align: center;
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid #ddd;
}
.admin-catval-stat.ok    { background: #e8f5e9; border-color: #81c784; }
.admin-catval-stat.auto  { background: #e3f2fd; border-color: #64b5f6; }
.admin-catval-stat.manual{ background: #fff3e0; border-color: #ffb74d; }
.admin-catval-stat.skip  { background: #f5f5f5; border-color: #bdbdbd; }
.admin-catval-stat strong { display: block; font-size: 18px; margin-top: 2px; }
.admin-catval-ts { font-size: 11px; color: #888; margin: 0 0 8px; }
.admin-catval-none { color: #888; font-size: 13px; margin: 4px 0 12px; }
.admin-catval-after { color: #1a56db; font-weight: 600; }
.admin-catval-warn  { color: #c0392b; }
.admin-category-check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 4px;
}
.admin-category-check-table th,
.admin-category-check-table td {
  border: 1px solid #e0e0e0;
  padding: 4px 6px;
  vertical-align: top;
}
.admin-category-check-table th { background: #f5f5f5; white-space: nowrap; }
.admin-catval-name   { max-width: 200px; word-break: break-all; }
.admin-catval-reason { max-width: 220px; font-size: 11px; color: #666; }
@media (max-width: 700px) {
  .admin-catval-name   { max-width: 120px; }
  .admin-catval-reason { max-width: 140px; }
}

/* ===== バックアップ警告 ===== */
.backup-warning-box {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 8px 0;
  font-size: 13px;
}
.backup-warning-box ul { margin: 4px 0 0 16px; padding: 0; }
.backup-warning-box li { margin-bottom: 2px; }

/* アプリ内確認ダイアログ（iOS PWA でも動作する DOM ベース） */
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.app-confirm-dialog {
  width: min(360px, 100%);
  background: var(--card-bg, #fff);
  border-radius: 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.app-confirm-message {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 18px;
  white-space: pre-wrap;
}

.app-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.app-confirm-actions button {
  min-width: 80px;
  width: auto;
  padding: 10px 16px;
  font-size: 15px;
}

/* 加工・鑑別委託：終了伝票スタイル */
.pochi-trial-modal[hidden] {
  display: none;
}

.pochi-trial-modal {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.62);
  box-sizing: border-box;
}

.pochi-trial-modal.is-open {
  display: flex;
}

body.pochi-trial-modal-open {
  overflow: hidden;
}

.pochi-trial-dialog {
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  height: min(760px, calc(100vh - 36px));
  height: min(760px, calc(100dvh - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.pochi-trial-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

#miiConsultMenuButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mii-consult-menu-icon,
.mii-consult-modal-icon {
  display: none;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 6px;
}

.mii-consult-menu-icon {
  width: 20px;
  height: 20px;
}

.mii-consult-modal-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mii-consult-modal-icon {
  width: 44px;
  height: 44px;
}

html[data-app-theme="mii"] .mii-consult-menu-icon,
html[data-app-theme="mii"] .mii-consult-modal-icon {
  display: block;
}

.pochi-trial-header h2 {
  margin: 0;
  font-size: 20px;
}

.pochi-trial-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pochi-trial-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pochi-trial-header-icon-button,
.pochi-trial-close {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 4px;
}

.pochi-trial-header-icon-button .material-symbols-outlined {
  margin: 0;
  font-size: 24px;
}

.pochi-trial-close {
  font-size: 24px;
  line-height: 1;
}

.pochi-trial-search-panel[hidden] {
  display: none;
}

.pochi-trial-search-panel {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.pochi-trial-search-panel input {
  width: 100%;
  margin: 0;
}

.pochi-trial-search-status {
  min-height: 1.3em;
  margin-top: 4px;
  color: var(--muted);
}

.pochi-trial-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  background: #f8fafc;
  background: color-mix(in srgb, var(--bg) 78%, #ffffff 22%);
}

.pochi-trial-message {
  width: fit-content;
  max-width: 86%;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.09);
}

.pochi-trial-message--user {
  margin-left: auto;
  background: #e8f1ff;
}

.pochi-trial-message-role {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pochi-trial-message-date {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.pochi-trial-message-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pochi-trial-message-text--rich {
  white-space: normal;
}

.pochi-trial-message-text--rich p {
  margin: 0 0 0.75em;
}

.pochi-trial-message-text--rich p:last-child,
.pochi-trial-message-text--rich ul:last-child,
.pochi-trial-message-text--rich ol:last-child {
  margin-bottom: 0;
}

.pochi-trial-message-text--rich ul,
.pochi-trial-message-text--rich ol {
  margin: 0 0 0.75em;
  padding-left: 1.4em;
}

.pochi-trial-message-text--rich li + li {
  margin-top: 0.35em;
}

.pochi-trial-message-text--rich strong {
  font-weight: 800;
}

.pochi-trial-message-text--rich code {
  padding: 0.08em 0.3em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--border) 45%, transparent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.pochi-trial-message-image {
  display: block;
  width: min(220px, 100%);
  max-height: 180px;
  margin: 6px 0 8px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.pochi-trial-image-candidates {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.pochi-trial-image-candidate {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  text-align: left;
}

.pochi-trial-image-candidate img,
.pochi-trial-image-candidate-photo-empty {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: color-mix(in srgb, var(--bg) 75%, #ffffff 25%);
}

.pochi-trial-image-candidate-photo-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.pochi-trial-image-candidate-main {
  min-width: 0;
}

.pochi-trial-image-candidate-code {
  display: block;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.pochi-trial-image-candidate-name {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pochi-trial-image-candidate-stock {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.pochi-trial-input-area {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.pochi-trial-input-area label {
  margin: 0 0 5px;
}

.pochi-trial-input-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.pochi-trial-input-heading label {
  margin: 0;
}

.pochi-trial-image-button {
  flex: 0 0 auto;
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.pochi-trial-image-button .material-symbols-outlined {
  font-size: 18px;
}

.pochi-trial-image-preview[hidden] {
  display: none;
}

.pochi-trial-image-preview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 7px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 72%, #ffffff 28%);
}

.pochi-trial-image-preview img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
}

.pochi-trial-image-preview span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pochi-trial-image-remove {
  width: auto;
  min-height: 32px;
  margin: 0;
  padding: 5px 9px;
  font-size: 12px;
}

.pochi-trial-image-qr-reader {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 320px;
  height: 320px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

.pochi-trial-input-area textarea {
  width: 100%;
  min-height: 82px;
  margin: 0;
  resize: vertical;
  box-sizing: border-box;
}

.pochi-trial-status {
  min-height: 1.4em;
  margin: 5px 0;
}

.pochi-trial-actions {
  display: flex;
  gap: 8px;
}

.pochi-trial-actions button {
  flex: 1 1 0;
  margin: 0;
}

.mii-knowledge-admin-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.mii-knowledge-admin-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.mii-knowledge-admin-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.mii-knowledge-admin-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.mii-knowledge-admin-select {
  margin-top: 7px;
}

.mii-knowledge-admin-empty {
  margin: 4px 0 0;
  color: var(--muted);
}

@media (max-width: 700px) {
  .pochi-trial-modal {
    align-items: stretch;
    padding: 8px;
  }

  .pochi-trial-dialog {
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 14px;
  }

  .pochi-trial-input-area textarea {
    min-height: 72px;
    max-height: 120px;
    resize: none;
  }

  .pochi-trial-message {
    max-width: 92%;
  }

  .pochi-trial-image-button {
    max-width: 48%;
    white-space: normal;
  }
}

.outsourcing-completed-row {
  opacity: 0.55;
  background: var(--surface-2, #f5f5f5);
}
@media (prefers-color-scheme: dark) {
  .outsourcing-completed-row {
    background: rgba(255, 255, 255, 0.04);
  }
}
:root[data-theme="light"] .outsourcing-completed-row {
  background: #f5f5f5;
}
:root[data-theme="dark"] .outsourcing-completed-row {
  background: rgba(255, 255, 255, 0.04);
}

.outsourcing-completed-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #888;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
  vertical-align: middle;
}

.outsourcing-sold-product-badge {
  display: inline-block;
  flex: 0 0 auto;
  margin: 0 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  vertical-align: middle;
}

.outsourcing-qty-input {
  width: 76px;
  min-width: 64px;
  margin: 0;
  padding: 6px 8px;
  text-align: right;
}

.outsourcing-entry-table th:nth-child(1),
.outsourcing-entry-table td:nth-child(1) {
  width: 42px;
}

.outsourcing-entry-table th:nth-child(2),
.outsourcing-entry-table td:nth-child(2) {
  width: 42%;
}

.outsourcing-entry-table th:nth-child(3),
.outsourcing-entry-table td:nth-child(3) {
  width: 90px;
}

.outsourcing-entry-table th:nth-child(4),
.outsourcing-entry-table td:nth-child(4) {
  width: auto;
}

.outsourcing-entry-table th:nth-child(5),
.outsourcing-entry-table td:nth-child(5) {
  width: 86px;
}

.outsourcing-note-input {
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 7px 8px;
  resize: vertical;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .outsourcing-entry-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .outsourcing-entry-table td:nth-child(1) {
    grid-column: 1 / -1;
  }

  .outsourcing-entry-table td:nth-child(2) {
    grid-column: 1;
    border-right: 1px solid #eef2f7;
  }

  .outsourcing-entry-table td:nth-child(3) {
    grid-column: 2;
  }

  .outsourcing-entry-table td:nth-child(4),
  .outsourcing-entry-table td:nth-child(5) {
    grid-column: 1 / -1;
  }

  .outsourcing-entry-table td:nth-child(4)::before {
    content: "依頼内容";
  }

  .outsourcing-entry-table td:nth-child(5)::before {
    display: none;
    content: none;
  }

  .outsourcing-entry-table .outsourcing-qty-input {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    font-size: 16px;
  }

  .outsourcing-entry-table .outsourcing-note-input {
    min-height: 72px;
    font-size: 16px;
  }

  .outsourcing-entry-table td:nth-child(5) button {
    width: 100%;
    margin: 0;
  }
}

/* 在庫の流れ：現在地と移動だけを見せる簡易カード */
.stock-flow-panel {
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.94)),
    repeating-linear-gradient(
      90deg,
      #fff8e9 0,
      #fff8e9 18px,
      #fffdf7 18px,
      #fffdf7 36px
    );
}

.stock-flow-product-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.stock-flow-product-code {
  color: #1f2937;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.stock-flow-product-name {
  color: #4b5563;
  font-size: 15px;
  font-weight: 650;
}

.stock-flow-section + .stock-flow-section {
  margin-top: 24px;
}

.stock-flow-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: #5f5147;
  font-size: 16px;
}

.stock-flow-section h3::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f3a7a0;
  box-shadow: 0 0 0 4px #fff0ee;
}

.stock-flow-location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 10px;
}

.stock-flow-location-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon name"
    "icon qty";
  align-items: center;
  column-gap: 10px;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid #eadfd8;
  border-radius: 16px;
  background: #fffdfa;
  box-shadow: 0 5px 14px rgba(106, 83, 67, 0.08);
}

.stock-flow-location-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #e8f3f5;
  color: #4d8792;
  font-size: 23px;
}

.stock-flow-location-name {
  grid-area: name;
  color: #6b5a4f;
  font-size: 12px;
  font-weight: 700;
}

.stock-flow-location-qty {
  grid-area: qty;
  color: #2d3748;
  font-size: 22px;
  line-height: 1.15;
}

.stock-flow-location-qty small {
  margin-left: 2px;
  color: #7b6c62;
  font-size: 12px;
}

.stock-flow-total {
  margin-top: 8px;
  color: #7b6c62;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.stock-flow-empty-location,
.stock-flow-empty-history {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 64px;
  border: 1px dashed #e2d6ce;
  border-radius: 15px;
  background: rgba(255, 253, 250, 0.82);
  color: #8a786d;
}

.stock-flow-history-list {
  display: grid;
  gap: 10px;
}

.stock-flow-history-item {
  padding: 10px 14px 14px;
  border: 1px solid #eadfd8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 15px rgba(106, 83, 67, 0.07);
}

.stock-flow-history-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  color: #8a786d;
  font-size: 11px;
  font-weight: 650;
}

.stock-flow-history-meta > span + span::before {
  content: "・";
  margin-right: 7px;
  color: #d3b9aa;
}

.stock-flow-slip-link {
  margin-left: auto;
  color: #397d8d;
  font-size: 11px;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stock-flow-route {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(112px, 150px) minmax(90px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 86px;
}

.stock-flow-route-location {
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 15px;
  background: #fff5f2;
  color: #5c4a40;
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.stock-flow-route-location:last-child {
  background: #edf7f7;
  color: #3f6770;
}

.stock-flow-route-location-label {
  display: block;
}

.stock-flow-route-location-with-detail {
  align-content: center;
  gap: 3px;
}

.stock-flow-route-location-with-detail .stock-flow-route-location-label {
  transform: translateY(-2px);
  font-size: 0.82em;
  line-height: 1;
}

.stock-flow-route-location-detail {
  display: block;
  width: 100%;
  overflow: hidden;
  color: #315f69;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-flow-route-arrow {
  position: relative;
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: 82px;
}

.stock-flow-route-mascot {
  display: block;
  width: 112px;
  max-width: 100%;
  height: auto;
  border-radius: 13px;
  mix-blend-mode: multiply;
}

.stock-flow-route-mascot-normal {
  border-radius: 0;
  mix-blend-mode: normal;
}

.stock-flow-route-arrow-normal strong {
  background: #397d8d;
  box-shadow: 0 2px 6px rgba(49, 95, 105, 0.22);
}

.stock-flow-route-arrow strong {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  min-width: 48px;
  padding: 2px 8px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #f19c91;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(122, 82, 67, 0.2);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

/* 標準テーマ：業務画面向けの直線的で落ち着いた在庫流れ */
html[data-app-theme="standard"] .stock-flow-panel {
  background: #ffffff;
}

html[data-app-theme="standard"] .stock-flow-section h3 {
  color: #1f2937;
}

html[data-app-theme="standard"] .stock-flow-section h3::before {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: #2563eb;
  box-shadow: none;
}

html[data-app-theme="standard"] .stock-flow-location-card {
  border-color: #d9e0ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

html[data-app-theme="standard"] .stock-flow-location-icon {
  border-radius: 6px;
  background: #eff6ff;
  color: #2563eb;
}

html[data-app-theme="standard"] .stock-flow-location-name,
html[data-app-theme="standard"] .stock-flow-location-qty,
html[data-app-theme="standard"] .stock-flow-location-qty small {
  color: #1f2937;
}

html[data-app-theme="standard"] .stock-flow-total {
  color: #6b7280;
}

html[data-app-theme="standard"] .stock-flow-empty-location,
html[data-app-theme="standard"] .stock-flow-empty-history {
  border-color: #d9e0ea;
  border-radius: 8px;
  background: #f8fafc;
  color: #6b7280;
}

html[data-app-theme="standard"] .stock-flow-history-item {
  border-color: #d9e0ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

html[data-app-theme="standard"] .stock-flow-history-meta {
  color: #6b7280;
}

html[data-app-theme="standard"]
  .stock-flow-history-meta
  > span
  + span::before {
  color: #94a3b8;
}

html[data-app-theme="standard"] .stock-flow-route-location {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
}

html[data-app-theme="standard"] .stock-flow-route-location:last-child {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

html[data-app-theme="standard"] .stock-flow-route-location-detail {
  color: #475569;
}

@media (max-width: 700px) {
  .stock-flow-panel {
    padding: 14px 10px;
  }

  .stock-flow-product-heading {
    gap: 4px 8px;
    margin-bottom: 16px;
  }

  .stock-flow-product-code {
    font-size: 16px;
  }

  .stock-flow-product-name {
    width: 100%;
    font-size: 13px;
  }

  .stock-flow-location-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stock-flow-location-card {
    min-height: 64px;
    padding: 9px 10px;
    border-radius: 14px;
  }

  .stock-flow-location-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 20px;
  }

  .stock-flow-location-name {
    font-size: 10px;
  }

  .stock-flow-location-qty {
    font-size: 19px;
  }

  .stock-flow-history-item {
    padding: 9px 8px 11px;
    border-radius: 15px;
  }

  .stock-flow-route {
    grid-template-columns: minmax(72px, 1fr) 92px minmax(72px, 1fr);
    gap: 5px;
    min-height: 78px;
  }

  .stock-flow-route-location {
    min-height: 48px;
    padding: 7px 4px;
    border-radius: 12px;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .stock-flow-route-mascot {
    width: 88px;
    border-radius: 10px;
  }

  .stock-flow-route-arrow strong {
    bottom: 0;
    min-width: 42px;
    padding: 1px 6px;
    font-size: 11px;
  }
}

/* ===== 後工程管理 ===== */
.post-process-controls {
  margin: 14px 0 16px;
}

.post-process-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.post-process-filter-button {
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 7px 14px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.post-process-filter-button:hover {
  background: #e2e8f0;
}

.post-process-filter-button.is-active {
  color: #fff;
  background: #334155;
  border-color: #334155;
}

.post-process-completed-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 9px 12px;
  background: #f8fafc;
  border-radius: 9px;
}

.post-process-completed-options label {
  display: inline-flex;
  align-items: center;
  width: auto;
  margin: 0;
  font-size: 13px;
}

.post-process-completed-options input {
  width: auto;
  margin: 0 7px 0 0;
}

.post-process-card.list-item {
  margin: 0 0 10px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.post-process-card-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  cursor: pointer;
}

.post-process-card-summary:hover {
  background: #f8fafc;
}

.post-process-card-summary:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: -3px;
}

.post-process-card-main {
  min-width: 0;
}

.post-process-card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.post-process-slip-link {
  margin: 0;
}

.post-process-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
}

.post-process-card-statuses {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.post-process-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.post-process-status-badge.is-processing-waiting {
  color: #9a3412;
  background: #ffedd5;
}

.post-process-status-badge.is-shipping-waiting {
  color: #1d4ed8;
  background: #dbeafe;
}

.post-process-status-badge.is-done {
  color: #475569;
  background: #e2e8f0;
}

.post-process-expand-mark {
  width: 18px;
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

.post-process-card-details {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
}

.post-process-sale-photos {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

.post-process-task-block {
  margin: 0;
  padding: 14px;
  border-radius: 10px;
}

.post-process-task-block h3 {
  margin: 0;
  font-size: 16px;
}

.post-process-task-processing {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.post-process-task-shipping {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.post-process-task-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.post-process-task-block label {
  margin-top: 10px;
}

.post-process-task-block button {
  margin-top: 10px;
}

.post-process-empty {
  padding: 22px 12px;
  color: #64748b;
  text-align: center;
}

@media (max-width: 700px) {
  .post-process-filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .post-process-filter-button {
    width: 100%;
    padding: 7px 5px;
    font-size: 12px;
  }

  .post-process-card-summary {
    align-items: flex-start;
    gap: 8px;
    padding: 11px;
  }

  .post-process-card-statuses {
    max-width: 112px;
  }

  .post-process-status-badge {
    min-height: 22px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .post-process-card-details {
    padding: 9px;
  }

  .post-process-task-block {
    padding: 12px;
  }
}
.customer-csv-menu-toggle {
  width: 100%;
  min-height: 48px;
  font-size: 24px;
}

.customer-merge-type-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.customer-merge-type-toggle label,
.customer-merge-duplicate-toggle,
.customer-merge-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-merge-type-toggle label {
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.customer-merge-type-toggle input,
.customer-merge-duplicate-toggle input,
.customer-merge-radio input,
.customer-merge-candidate input {
  width: auto;
  flex: 0 0 auto;
}

.customer-merge-duplicate-toggle {
  margin: 12px 0;
}

#customerMergeCandidateList {
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  margin: 12px 0;
}

.customer-merge-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.customer-merge-candidate > span,
.customer-merge-history-item > div {
  min-width: 0;
}

.customer-merge-candidate .small,
.customer-merge-history-item .small {
  display: block;
}

#customerMergeSelectionPanel {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card) 88%, var(--primary) 12%);
}

.customer-merge-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 12px 0;
}

.customer-merge-radio {
  margin: 8px 0;
}

.customer-merge-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
  .customer-merge-choice-grid,
  .customer-merge-history-item {
    grid-template-columns: 1fr;
  }
}
.payment-reconciliation-screen {
  max-width: 1180px;
}

.accounting-export-screen {
  max-width: 1180px;
  min-width: 0;
}

.accounting-export-guide,
.accounting-export-panel-card {
  background: #f8fafc;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  padding: 14px 16px;
}

.accounting-export-guide {
  margin-bottom: 14px;
  color: #334155;
}

.accounting-export-table-wrap,
.accounting-export-preview-wrap {
  overflow-x: auto;
}

.accounting-export-table,
.accounting-export-preview {
  width: 100%;
  border-collapse: collapse;
}

.accounting-export-table th,
.accounting-export-table td,
.accounting-export-preview th,
.accounting-export-preview td {
  border: 1px solid #dbe3ec;
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.accounting-export-table thead th,
.accounting-export-preview thead th {
  background: #eef3f8;
}

.accounting-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

button.accounting-status {
  cursor: pointer;
}

.accounting-status-ready {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.accounting-status-blocked {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.accounting-status-none {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.accounting-exported-note {
  margin-top: 5px;
  color: #7c3aed;
}

#accountingExportPanel {
  margin-top: 18px;
}

.accounting-export-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.accounting-export-panel-heading h3 {
  margin: 0;
}

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

.accounting-cash-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 700;
}

.accounting-cash-calculation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.accounting-cash-calculation > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.accounting-cash-calculation .is-match {
  color: #166534;
  border-color: #86efac;
  background: #f0fdf4;
}

.accounting-cash-calculation .is-difference,
.accounting-export-warning {
  color: #991b1b;
  border-color: #fca5a5;
  background: #fef2f2;
}

.accounting-export-warning {
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.accounting-export-panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.accounting-issue-list {
  display: grid;
  gap: 12px;
}

.accounting-issue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid #fecaca;
  border-left: 5px solid #dc2626;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.accounting-reconciliation-issue-card {
  border-color: #fed7aa;
  border-left-color: #ea580c;
  background: #fffaf5;
}

.accounting-issue-card-title {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 800;
}

.accounting-issue-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  color: #475569;
  font-size: 13px;
}

.accounting-issue-card ul {
  margin: 8px 0 0;
  padding-left: 1.4em;
  color: #991b1b;
}

.accounting-issue-card > button {
  width: auto;
  min-width: 150px;
}

.accounting-export-preview-summary {
  margin-bottom: 10px;
  font-weight: 700;
}

.accounting-export-preview td.number {
  text-align: right;
}

@media (max-width: 760px) {
  .accounting-cash-grid,
  .accounting-cash-calculation {
    grid-template-columns: 1fr;
  }

  .accounting-issue-card {
    grid-template-columns: 1fr;
  }

  .accounting-issue-card > button {
    width: 100%;
  }
}

.payment-reconciliation-period,
.payment-reconciliation-import-panel,
.payment-reconciliation-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.payment-reconciliation-period {
  grid-template-columns: minmax(0, 1fr);
}

.payment-reconciliation-period-display {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef6ff;
  color: #334155;
  font-size: 13px;
}

.payment-reconciliation-import-panel {
  grid-template-columns: 1fr 1.4fr auto;
  align-items: end;
  padding: 12px;
  border: 1px solid #d9e0ea;
  border-radius: 12px;
  background: #f8fafc;
}

.payment-reconciliation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.payment-reconciliation-actions select {
  flex: 1 1 360px;
}

.payment-reconciliation-completed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
}

.payment-reconciliation-completed-toggle input[type="checkbox"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  margin: 0;
}

.payment-reconciliation-filters {
  grid-template-columns:
    minmax(130px, 0.55fr)
    minmax(150px, 0.65fr)
    minmax(170px, 0.75fr)
    minmax(240px, 1.7fr);
  margin-top: 14px;
}

.payment-reconciliation-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.payment-reconciliation-summary-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #f8fbff;
}

.payment-reconciliation-summary-grid span {
  color: var(--muted);
  font-size: 12px;
}

.payment-reconciliation-overview-card {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  margin: 12px 0;
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #f8fbff;
}

.payment-reconciliation-overview-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid #e4ebf3;
}

.payment-reconciliation-overview-item.metric-external,
.payment-reconciliation-overview-item.metric-allocated,
.payment-reconciliation-overview-item.metric-difference {
  grid-column: span 4;
}

.payment-reconciliation-overview-item.metric-difference,
.payment-reconciliation-overview-item.state-import {
  border-right: 0;
}

.payment-reconciliation-overview-item.state-judgement,
.payment-reconciliation-overview-item.state-status,
.payment-reconciliation-overview-item.state-import {
  border-top: 1px solid #e4ebf3;
}

.payment-reconciliation-overview-item.state-judgement {
  grid-column: span 3;
}

.payment-reconciliation-overview-item.state-status {
  grid-column: span 6;
}

.payment-reconciliation-overview-item.state-import {
  grid-column: span 3;
}

.payment-reconciliation-overview-item .payment-reconciliation-summary-label {
  color: var(--muted);
  font-size: 12px;
}

.payment-reconciliation-overview-item strong {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.payment-reconciliation-summary-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.payment-reconciliation-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px !important;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 50%;
  background: #fff;
  color: #475569;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.payment-reconciliation-info-button:hover {
  background: #eaf2fb;
}

.payment-reconciliation-refund-guide {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.6;
}

.payment-reconciliation-table-wrap {
  overflow-x: auto;
}

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

.payment-reconciliation-table th,
.payment-reconciliation-table td {
  padding: 9px;
  border: 1px solid #d9e0ea;
  text-align: left;
  white-space: nowrap;
}

.payment-reconciliation-table .number {
  text-align: right;
}

.payment-reconciliation-detail-card {
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #d9e0ea;
  border-left: 5px solid #94a3b8;
  border-radius: 12px;
  background: #fff;
}

.payment-reconciliation-detail-card.payment-status-matched {
  border-left-color: #16a34a;
}

.payment-reconciliation-detail-card.payment-status-partial,
.payment-reconciliation-detail-card.payment-status-review {
  border-left-color: #f59e0b;
}

.payment-reconciliation-detail-card.payment-status-error,
.payment-reconciliation-detail-card.payment-status-rematch {
  border-left-color: #dc2626;
}

.payment-detail-head,
.payment-detail-amounts,
.payment-allocation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-judgement {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  border-radius: 50%;
  background: #eef2ff;
  font-weight: 700;
}

.payment-status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 12px;
}

.payment-detail-meta {
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
}

.payment-detail-amounts {
  justify-content: flex-start;
  margin: 8px 0;
  font-weight: 700;
}

.payment-allocation-list {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.payment-allocation-row {
  padding: 7px 9px;
  border-radius: 8px;
  background: #f8fafc;
  flex-wrap: nowrap;
}

.payment-allocation-source-info {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-allocation-row > strong,
.payment-allocation-row > .link-button,
.payment-allocation-row > button.compact {
  flex: 0 0 auto;
}

.payment-allocation-editor {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px auto auto;
  gap: 8px;
  align-items: end;
}

.payment-allocation-field {
  display: grid;
  gap: 4px;
  margin: 0;
}

.payment-allocation-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.payment-exclusion-note,
.payment-rematch-note {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7ed;
}

.payment-rematch-note {
  background: #fef2f2;
  color: #991b1b;
}

.link-button {
  display: inline;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0b63ce;
  box-shadow: none;
  text-decoration: underline;
}

button.compact {
  width: auto;
  min-height: 32px;
  padding: 5px 10px;
}

@media (max-width: 720px) {
  .payment-reconciliation-period,
  .payment-reconciliation-import-panel,
  .payment-reconciliation-filters,
  .payment-reconciliation-summary-grid,
  .payment-allocation-editor {
    grid-template-columns: 1fr;
  }

  .payment-reconciliation-detail-card {
    padding: 11px;
  }

  .payment-reconciliation-overview-item {
    padding: 7px 8px;
  }

  .payment-reconciliation-overview-item.metric-external,
  .payment-reconciliation-overview-item.metric-allocated,
  .payment-reconciliation-overview-item.metric-difference {
    grid-column: span 4;
  }

  .payment-reconciliation-overview-item.state-judgement,
  .payment-reconciliation-overview-item.state-import {
    grid-column: span 6;
  }

  .payment-reconciliation-overview-item.state-status {
    grid-column: span 12;
    border-right: 0;
    order: 6;
  }

  .payment-reconciliation-overview-item.state-judgement {
    border-right: 1px solid #e4ebf3;
  }

  .payment-reconciliation-overview-item.state-import {
    border-right: 0;
  }

  .payment-reconciliation-overview-item strong {
    font-size: 12px;
  }

  .payment-allocation-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "slip amount action"
      "info info info";
    align-items: center;
    column-gap: 6px;
    row-gap: 1px;
    padding: 2px 7px;
  }

  .payment-allocation-row > .link-button {
    grid-area: slip;
    justify-self: start;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .payment-allocation-row > .payment-allocation-source-info {
    grid-area: info;
    width: 100%;
    font-size: 11px;
    line-height: 1.15;
  }

  .payment-allocation-row > strong {
    grid-area: amount;
    white-space: nowrap;
  }

  .payment-allocation-row > button.compact {
    grid-area: action;
    min-height: 28px;
    padding: 3px 8px;
    font-size: 14px;
  }
}
