/* Material Design 3 inspired color system */
:root {
    --md-sys-color-primary: #1e88e5;
    --md-sys-color-primary-container: #e3f2fd;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-secondary: #1565c0;
    --md-sys-color-surface: #ffffff;
    --md-sys-color-surface-variant: #f2f4f7;
    --md-sys-color-on-surface: #0f172a;
    --md-sys-color-outline: #90a4ae;
    --md-sys-color-error: #b3261e;
    --md-sys-shadow-l1: 0 1px 2px rgba(17, 12, 34, 0.12), 0 1px 3px rgba(17, 12, 34, 0.08);
    --md-sys-shadow-l2: 0 6px 10px rgba(17, 12, 34, 0.14), 0 1px 18px rgba(17, 12, 34, 0.12);
    --md-sys-shadow-l3: 0 18px 32px rgba(17, 12, 34, 0.14), 0 8px 24px rgba(17, 12, 34, 0.12);
    --md-border-radius-xl: 24px;
    --md-border-radius-lg: 16px;
    --md-border-radius-md: 12px;
    --md-border-radius-sm: 8px;
    --md-table-border-color: rgba(15, 23, 42, 0.22);
    --md-sys-color-primary-soft: rgba(30, 136, 229, 0.14);
    --md-font-family-base: 'Roboto', 'Noto Sans JP', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --md-btn-height: 40.188px;
    --md-btn-min-width: 76.844px;
}

/* Base typography and surface setup */
html, body {
    font-family: var(--md-font-family-base);
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    letter-spacing: 0.02em;
}

body {
    min-height: 100vh;
    margin: 0;
    background-image: none;
    scrollbar-gutter: stable both-edges; /* サイドバー開閉時もレイアウト幅を安定させる */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--md-sys-color-on-surface);
}

p, label, th, td {
    color: var(--md-sys-color-on-surface);
}

a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
}

a:hover, a:focus {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
}

/* Navigation / sidebar */
.md-sidebar {
    background-color: rgba(30, 136, 229, 0.08);
    background-image: linear-gradient(180deg, rgba(30, 136, 229, 0.14), rgba(30, 136, 229, 0.06));
    background-repeat: no-repeat;
    background-size: cover;
    border-right: none;
    border-radius: 0;
    box-shadow: var(--md-sys-shadow-l1);
    padding: 0.9rem 0 0.9rem 0.65rem;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 200px;
    flex: 0 0 200px;
    max-height: 100vh;
    overflow: hidden; /* スクロール管理は内部コンテナに委譲 */
    overflow-x: hidden; /* 横方向にコンテンツがはみ出さないように固定 */
    scrollbar-gutter: stable; /* 内部スクロールバーの出現で幅が変わらないようにする */
}

.md-sidebar.sidebar-initializing {
    visibility: hidden;
}

.md-sidebar h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--md-sys-color-secondary);
    margin-bottom: 0.5rem;
}

.md-sidebar .nav-link {
    border-radius: var(--md-border-radius-md);
    padding: 0.32rem 0.6rem 0.32rem 0.85rem;
    color: var(--md-sys-color-on-surface);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.md-sidebar .nav-link.sidebar-root-link {
    padding: 0.2rem 0;
    display: block;
    color: inherit;
}

.md-sidebar .sidebar-root-item {
    min-height: 2.6rem;
    display: flex;
    align-items: center;
}

.md-sidebar .sidebar-root-title {
    font-size: 1rem; /* 16px equivalent */
}

.md-sidebar .nav-link.sidebar-root-link:hover,
.md-sidebar .nav-link.sidebar-root-link:focus {
    background-color: transparent;
    text-decoration: none;
}

.md-sidebar .nav-link:hover,
.md-sidebar .nav-link:focus {
    background-color: rgba(30, 136, 229, 0.12);
    text-decoration: none;
}

.md-sidebar .nav-link.fw-semibold {
    background-color: rgba(30, 136, 229, 0.18);
    color: var(--md-sys-color-secondary);
    box-shadow: none;
}

/* ナビゲーションリストを常に縦方向1列に固定 */
.md-sidebar .nav {
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
}

/* 各 nav-item を全幅化して横並びを防止 */
.md-sidebar .nav .nav-item {
    width: 100%;
}

/* メニュー全体をスクロール領域化し、ログイン領域との重なりを防止 */
.md-sidebar > .nav {
    flex: 1 1 auto;
    margin-bottom: 0;
    overflow-y: auto;
    scrollbar-gutter: stable; /* サイドバー内スクロール幅を固定 */
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}

.md-sidebar > .nav::-webkit-scrollbar {
    width: 6px;
}

.md-sidebar > .nav::-webkit-scrollbar-track {
    background: transparent;
}

.md-sidebar > .nav::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
}

.md-sidebar > .nav:hover::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.32);
}

/* Sidebar collapsible controls */
.md-sidebar .sidebar-toggle {
    color: var(--md-sys-color-secondary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    padding: 0.2rem 0.2rem;
}

.md-sidebar .sidebar-toggle .small {
    font-size: 1rem;
    text-transform: none;
}

.md-sidebar .sidebar-toggle:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    border-radius: var(--md-border-radius-sm);
}

.md-sidebar .toggle-icon.rotated {
    transform: rotate(180deg);
}

.md-sidebar .sidebar-group {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    margin-top: 0.2rem; /* 常に一定の余白を保ちレイアウト崩れを防ぐ */
    opacity: 1;
    will-change: max-height;
}

.md-sidebar .sidebar-group:not(.is-open) {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.md-sidebar .material-symbols-outlined {
    font-family: 'Material Symbols Outlined', 'Material Icons', sans-serif;
    font-style: normal;
    font-weight: normal;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-sidebar .menu-icon,
.md-sidebar .sidebar-heading-icon {
    font-size: 1.2rem;
    min-width: 1.6rem;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-sidebar .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

.md-sidebar .btn-primary {
    border-radius: var(--md-border-radius-md);
    box-shadow: var(--md-sys-shadow-l1);
    font-weight: 600;
}

/* ログイン領域を常にサイドバー下部へ固定 */
.md-sidebar .account-section {
    border-top: 1px solid rgba(30, 136, 229, 0.18);
    margin-top: auto;
    padding-top: 0.9rem;
    padding-bottom: 0.55rem;
    position: sticky;
    bottom: 0;
}

.md-sidebar .account-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.md-sidebar .account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(30, 136, 229, 0.32), rgba(30, 136, 229, 0.18));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(15, 23, 42, 0.8);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.md-sidebar .account-avatar .material-symbols-outlined {
    font-size: 20px;
}

.md-sidebar .account-name {
    color: var(--md-sys-color-on-surface);
    font-size: 1rem;
}

.md-sidebar .account-section.guest {
    padding-top: 1.15rem;
}

/* Surface components */
.card {
    border: none !important;
    border-radius: var(--md-border-radius-lg);
    box-shadow: var(--md-sys-shadow-l1);
    background-color: var(--md-sys-color-surface);
}

.card-header,
.card-footer {
    border-radius: var(--md-border-radius-lg);
    background-color: transparent;
}

.table {
    --bs-table-bg: transparent;
}

.table.table-md {
    border-collapse: collapse;
    box-shadow: 0 0 0 1px var(--md-table-border-color);
    overflow: hidden;
    background-color: var(--md-sys-color-surface);
}

.table.table-md thead tr {
    background-color: var(--md-sys-color-primary-soft);
}

.table.table-md th {
    border: none;
    color: var(--md-sys-color-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--md-table-border-color);
}

.table.table-md thead th {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
    border-bottom: 1px solid var(--md-table-border-color);
    text-align: center;
}

.table.table-md th,
.table.table-md td {
    border: 1px solid var(--md-table-border-color);
}

.table.table-md tbody td {
    text-align: left;
}

.table.table-md tbody td[data-type="number"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 生産指示一覧テーブル（画面高さに応じて内部スクロール量を調整） */
.production-instruction-table-scroll {
    max-height: clamp(200px, 43vh, 420px); /* 余白を活用し、約2行分スクロール領域を拡張 */
    overflow: auto; /* スクロールを許可して sticky の基準を作る */
    scrollbar-gutter: stable both-edges;
    position: relative; /* sticky の基準 */
    border: var(--md-table-border-width) solid var(--md-table-border-color);
    background-color: var(--md-sys-color-surface);
    border-radius: 0; /* テーブル枠の角丸を抑止して常に直角表示する */
}

/* 生産指示一覧は下部余白を残しつつ、一覧の可視件数を優先して高さを広げる */
.production-instruction-table-scroll--list {
    max-height: clamp(280px, 54vh, 620px);
}

/* 生産指示一覧は1画面の可視件数を増やすため、行高を少しだけ圧縮する */
.production-instruction-table--compact th,
.production-instruction-table--compact td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.production-instruction-table--compact .btn-detail-link {
    --btn-height: 34px;
    --btn-min-width: 64px;
    padding: 0.35rem 0.85rem;
}

/* 出荷指示一覧は削除ボタン列を含むため、少し控えめに密度を上げる */
.production-instruction-table-scroll--shipment {
    max-height: clamp(260px, 50vh, 560px);
}

/* 指示一覧系は検索ボタン群と一覧の間に出荷履歴と同程度の余白を確保する */
.instruction-list-search-actions {
    margin-bottom: 1rem;
}

/* 追加した余白ぶんだけ一覧の可視高さを少し抑える。1行分だけさらに狭める。 */
.instruction-list-table-scroll.production-instruction-table-scroll--list {
    max-height: clamp(192px, 45vh, 532px);
}

.instruction-list-table-scroll--shipment.production-instruction-table-scroll--shipment {
    max-height: clamp(244px, 47vh, 544px);
}

.production-instruction-table--compact .btn-destructive-action {
    --btn-height: 34px;
    --btn-min-width: 64px;
    padding: 0.35rem 0.85rem;
}

/* 一覧系画面で共通に使う軽い圧縮設定 */
.list-table-scroll--compact {
    max-height: clamp(260px, 50vh, 560px);
}

/* 製品別棚卸一覧はスクロールなしで見える行数を1行分だけ減らす。 */
.inventory-stocktaking-products-table-scroll.list-table-scroll--compact {
    max-height: clamp(226px, 46vh, 526px);
}

/* 棚卸進捗一覧は可視行数を約6行分増やし、16行前後を表示できるようにする。 */
.inventory-stocktaking-operations-table-scroll.list-table-scroll--compact {
    max-height: clamp(450px, 72vh, 800px);
}

.shipment-products-table-scroll {
    /* 出荷品確認画面はスクロールなしの可視行を約7行分増やす。 */
    max-height: clamp(540px, calc(50vh + 280px), 840px);
}

.product-master-list-table-scroll {
    /* 製品マスタ一覧（品目表示）は1行分だけ高さを抑え、画面全体のスクロール発生を防ぐ。 */
    max-height: clamp(214px, calc(50vh - 46px), 514px);
    overscroll-behavior: contain;
}

.rfid-reissue-table-scroll {
    max-height: clamp(360px, 62vh, 720px);
}

/* 印刷履歴一覧はスクロールなしで見える範囲を3行分だけ狭める。 */
.print-history-table-scroll.list-table-scroll--compact {
    max-height: calc(clamp(260px, 50vh, 560px) - 67px);
}

.rfid-reissue-confirm-table-scroll {
    /* 再発行確認画面は読み取り結果を1行分だけ少なく見せる。 */
    max-height: clamp(390px, 58vh, 690px);
}

.factory-rfid-register-confirm-table-scroll {
    /* RFID登録確認画面はスクロールなしで見える行数を0.5行分だけ減らす。 */
    max-height: clamp(378px, calc(66vh - 20px), 778px);
}

.factory-rfid-register-table-scroll {
    /* RFID登録用RFID読取画面は表示領域を半行分だけ詰める。 */
    max-height: clamp(320px, calc(60vh - 20px), 700px);
}

.list-table--compact th,
.list-table--compact td {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.list-table--compact .btn-detail-link,
.list-table--compact .btn-destructive-action,
.list-table--compact .btn-action {
    --btn-height: 34px;
    --btn-min-width: 64px;
    padding: 0.35rem 0.85rem;
}

.table.table-md.production-instruction-table {
    width: 100%;
    overflow: visible; /* table.table-md の overflow: hidden を打ち消し、sticky ヘッダーを有効化 */
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: 0;
}

.production-instruction-table thead tr {
    background-color: var(--md-sys-color-primary-soft);
}

.stocktaking-adjustment-table thead tr {
    background-color: var(--md-sys-color-surface);
}

.production-instruction-table thead th {
    text-align: center;
    color: var(--md-sys-color-on-surface);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 5;
    background-color: var(--md-sys-color-surface);
    background-image: linear-gradient(0deg, rgba(30, 136, 229, 0.18), rgba(30, 136, 229, 0.18));
    box-shadow:
        0 1px 0 0 var(--md-table-border-color),
        0 -1px 0 0 var(--md-table-border-color);
}

.stocktaking-adjustment-table thead th {
    background-color: var(--md-sys-color-surface);
    background-image: none;
}

.production-instruction-table thead {
    position: sticky;
    top: 0;
    z-index: 6;
    background-color: var(--md-sys-color-surface);
}

.production-instruction-table tbody tr:first-child td {
    border-top: none; /* ヘッダー直下の境界線が二重にならないように調整 */
}

.result-pagination-row {
    margin-bottom: 1.5rem;
}

.production-instruction-table th,
.production-instruction-table td {
    border: 1px solid var(--md-table-border-color);
    background-color: var(--md-sys-color-surface);
    white-space: nowrap; /* ヘッダーとセルの折り返しを防ぎ、横スクロールで調整 */
}

.table.table-md .action-column {
    width: 84px;
    min-width: 84px;
    white-space: nowrap; /* ボタン幅に合わせて余白を削減 */
}
.table.table-md .action-column--checkbox {
    width: 44px;
    min-width: 44px;
}

.shipping-products-table .action-column {
    width: 64px;
    min-width: 64px;
}

.shipping-products-table .action-column .btn {
    padding: 0.18rem 0.35rem;
    min-width: 58px;
    width: auto;
}

.history-shipment__col-status {
    width: 120px;
    min-width: 120px;
}

.history-shipment__col-shipped-at {
    min-width: 150px;
}

.history-shipment__col-truck {
    width: 88px;
    min-width: 88px;
}

.history-shipment__col-due-date {
    min-width: 150px;
}

.history-shipment__col-delivery1 {
    min-width: 240px;
}

.history-shipment__col-delivery2 {
    min-width: 210px;
}

.instruction-detail-card {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem;
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    background-color: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-shadow-l1);
}

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

.instruction-detail-table-container {
    max-width: 900px;
    margin: 0 auto;
}

.instruction-detail-table--wide .instruction-detail-col-label {
    width: 10%;
    min-width: 110px;
}

.instruction-detail-table--wide .instruction-detail-col-value {
    width: 35%;
    min-width: 260px;
}

.instruction-detail-table-container--left {
    margin-left: 0;
    margin-right: auto;
}

/* 生産指示詳細のテーブルは横幅を最大化する */
.production-instruction-detail-container {
    max-width: none;
    width: 100%;
}

.inventory-stocktaking-header-table {
    max-width: min(640px, 66%);
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.inventory-stocktaking-header-table .instruction-detail-table th,
.inventory-stocktaking-header-table .instruction-detail-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.inventory-stocktaking-header-table .instruction-detail-table th {
    min-width: 110px;
}

.shipment-history-header-table {
    max-width: min(320px, 45%);
    margin-left: 0;
}

.shipment-history-inspection-table {
    max-width: min(640px, 65%);
    margin-left: 0;
}

.shipment-history-inspection-table .instruction-detail-table th,
.shipment-history-inspection-table .instruction-detail-table td {
    padding: 0.85rem 1.6rem;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

.receive-history-three-column-table {
    table-layout: fixed;
}

.receive-history-three-column-table .receive-history-three-column-table__label {
    width: 12%;
    min-width: 130px;
}

.receive-history-three-column-table .receive-history-three-column-table__value {
    width: 21.3333%;
    min-width: 120px;
}

.receive-history-three-column-table th,
.receive-history-three-column-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-history-top-table.receive-history-three-column-table {
    width: 100%;
    max-width: 1120px;
}

.receive-history-top-table--summary .receive-history-top-table--summary__label--primary {
    width: 14%;
    min-width: 140px;
}

.receive-history-top-table--summary .receive-history-top-table--summary__value--primary {
    width: 26%;
    min-width: 280px;
}

.receive-history-top-table--summary .receive-history-top-table--summary__label:not(.receive-history-top-table--summary__label--primary) {
    width: 10%;
    min-width: 120px;
}

.receive-history-top-table--summary .receive-history-top-table--summary__value:not(.receive-history-top-table--summary__value--primary) {
    width: 20%;
    min-width: 180px;
}

.receive-history-top-table--worker .receive-history-top-table--worker__label--primary,
.receive-history-top-table--detail .receive-history-top-table--detail__label--primary {
    width: 14%;
    min-width: 140px;
}

.receive-history-top-table--worker .receive-history-top-table--worker__value--primary,
.receive-history-top-table--detail .receive-history-top-table--detail__value--primary {
    width: 26%;
    min-width: 280px;
}

.receive-history-top-table--worker .receive-history-top-table--worker__label:not(.receive-history-top-table--worker__label--primary),
.receive-history-top-table--detail .receive-history-top-table--detail__label:not(.receive-history-top-table--detail__label--primary) {
    width: 10%;
    min-width: 120px;
}

.receive-history-top-table--worker .receive-history-top-table--worker__value:not(.receive-history-top-table--worker__value--primary),
.receive-history-top-table--detail .receive-history-top-table--detail__value:not(.receive-history-top-table--detail__value--primary) {
    width: 20%;
    min-width: 180px;
}

.receive-history-top-table-container {
    max-width: 1180px;
    width: 100%;
}

.receive-history-delete-comment-table .instruction-detail-table td:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.receive-history-empty-cell {
    border: none !important;
    background-color: transparent !important;
}

.receive-history-delete-comment-table {
    max-width: 1120px;
    width: 100%;
}

@media (max-width: 1200px) {
    .receive-history-delete-comment-table {
        max-width: 100%;
    }
}

.receive-history-item-detail-page .instruction-detail-table th {
    width: 10%;
    text-align: center;
}

.receive-history-top-table:not(.receive-history-three-column-table) .instruction-detail-col-label {
    width: 12%;
    min-width: 130px;
}

.receive-history-top-table:not(.receive-history-three-column-table) .instruction-detail-col-value {
    width: 33%;
    min-width: 240px;
}

.receive-history-top-table tbody tr:nth-child(1) th,
.receive-history-top-table tbody tr:nth-child(3) th {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
}

/* 入庫履歴詳細の一覧テーブル本文行高さを詳細テーブルに合わせる */
.receive-history-item-table tbody td {
    padding: 0.85rem 1.6rem;
}

.shipment-history-table .shipment-col-delivery1,
.shipment-history-table .shipment-col-delivery2 {
    width: 22%;
    min-width: 200px;
}

.shipment-history-table .shipment-col-order-no,
.shipment-history-table .shipment-col-house,
.shipment-history-table .shipment-col-strength,
.shipment-history-table .shipment-col-spec,
.shipment-history-table .shipment-col-office {
    width: 12%;
    min-width: 130px;
}

.shipment-history-table .shipment-col-wood,
.shipment-history-table .shipment-col-adhesion,
.shipment-history-table .shipment-col-usage,
.shipment-history-table .shipment-col-length,
.shipment-history-table .shipment-col-thickness,
.shipment-history-table .shipment-col-width,
.shipment-history-table .shipment-col-instruction-qty,
.shipment-history-table .shipment-col-read-qty {
    width: 8%;
    min-width: 90px;
}

.inventory-stocktaking-table {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

/* 棚卸履歴詳細の差異調整表は、実棚表より3行分だけ可視領域を狭める。 */
.inventory-stocktaking-adjustment-table-scroll {
    max-height: calc(clamp(200px, 43vh, 420px) - 10rem);
}

/* 棚卸履歴詳細の実棚表は、スクロールなしで見える範囲を3行分だけ狭める。 */
.inventory-stocktaking-actual-shelf-table-scroll {
    max-height: calc(clamp(200px, 43vh, 420px) - 10rem);
}

.product-stocktaking-row--highlight td {
    background-color: #fff4ce;
}

@media (max-width: 576px) {
    .inventory-stocktaking-table {
        margin-left: 0;
        margin-right: 0;
    }
}

.instruction-detail-table--wide th,
.instruction-detail-table--wide td {
    width: auto;
}

/* 生産指示詳細は値列を広げる */
.production-instruction-detail-table th:nth-child(1),
.production-instruction-detail-table th:nth-child(3),
.production-instruction-detail-table th:nth-child(5) {
    text-align: left;
}

.production-instruction-detail-table {
    table-layout: fixed;
}

.production-instruction-detail-col-value {
    width: 50%;
}

.production-instruction-detail-table th,
.production-instruction-detail-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* 生産指示詳細は1画面で確認しやすいよう行高を圧縮する */
.production-instruction-detail-table th,
.production-instruction-detail-table td {
    padding: 0.3rem 0.62rem;
    font-size: 0.76rem;
    line-height: 1.0;
}

/* 生産監視（主要8種）は項目列を狭く、値列を広く固定する */
.production-monitor-basic-table {
    table-layout: fixed;
}

.production-monitor-basic-col-item {
    width: 11%;
}

.production-monitor-basic-col-value {
    width: 22.3333%;
}

.production-monitor-basic-table th,
.production-monitor-basic-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.stocktaking-adjustment-basic-table {
    width: fit-content;
    table-layout: auto;
}

.stocktaking-adjustment-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.stocktaking-adjustment-page__title {
    flex: 0 0 auto;
    margin-bottom: 0.5rem !important;
}

.stocktaking-adjustment-summary {
    flex: 0 0 auto;
    max-width: min(840px, 100%);
    margin-bottom: 0.75rem !important;
}

.stocktaking-adjustment-result-section {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem !important;
}

.stocktaking-adjustment-result-section > h2 {
    flex: 0 0 auto;
    margin-bottom: 0.5rem !important;
}

.stocktaking-adjustment-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable both-edges;
}

.stocktaking-adjustment-result-section .result-pagination-row {
    flex: 0 0 auto;
    margin-top: 0.25rem;
    margin-bottom: 0.1rem;
}

.stocktaking-adjustment-back {
    flex: 0 0 auto;
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
}

.stocktaking-adjustment-basic-table-container {
    max-width: 100%;
    width: fit-content;
    overflow-x: auto;
}

.stocktaking-adjustment-basic-col-item {
    width: 6.5rem;
    min-width: 6.5rem;
}

.stocktaking-adjustment-basic-col-value {
    width: auto;
    min-width: 6.5rem;
}

.stocktaking-adjustment-basic-table th,
.stocktaking-adjustment-basic-table td {
    font-size: 0.85rem;
    padding: 0.16rem 0.38rem;
    line-height: 1.15;
}

.stocktaking-adjustment-basic-table th {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.stocktaking-adjustment-basic-table tr > *:nth-child(odd) {
    text-align: left;
}

.stocktaking-adjustment-basic-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.stocktaking-adjustment-table th,
.stocktaking-adjustment-table td {
    padding: 0.14rem 0.3rem;
    font-size: 0.9rem;
    line-height: 1.02;
}

.stocktaking-adjustment-table .action-column {
    width: 84px;
    min-width: 84px;
}

.stocktaking-adjustment-table th:nth-child(6),
.stocktaking-adjustment-table td:nth-child(6) {
    width: 100px;
    min-width: 100px;
}

.stocktaking-adjustment-table th:nth-child(7),
.stocktaking-adjustment-table td:nth-child(7) {
    width: 150px;
    min-width: 150px;
}

.production-monitor-time-table {
    width: 100%;
    table-layout: fixed;
}

.production-monitor-time-col-item {
    width: 15%;
}

.production-monitor-time-col-value {
    width: 35%;
}

.production-monitor-time-table th,
.production-monitor-time-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.production-monitor-result-table .monitor-stocker-col {
    min-width: 96px;
}

.production-monitor-result-table .monitor-count-col,
.production-monitor-result-table .monitor-received-col {
    min-width: 80px;
}

.production-monitor-result-table .monitor-basic-col {
    min-width: 104px;
}

.production-monitor-table-wrap {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.production-monitor-table-wrap.table-responsive {
    overflow-x: visible;
}

.inventory-detail-summary-table {
    table-layout: auto;
    width: 70%;
    max-width: 840px;
}

.inventory-detail-summary-table .inventory-summary-col-label {
    width: 14%;
}

.inventory-detail-summary-table .inventory-summary-col-label--left {
    width: 14%;
}

.inventory-detail-summary-table .inventory-summary-col-label--right {
    width: 10%;
}

.inventory-detail-summary-table .inventory-summary-col-value--wide {
    width: 52%;
    white-space: nowrap;
}

.inventory-detail-summary-table .inventory-summary-col-value--narrow {
    width: 14%;
    white-space: nowrap;
}

.inventory-detail-summary-table .inventory-summary-col-value {
    width: auto;
}

.inventory-detail-summary-table td:nth-child(2),
.inventory-detail-summary-table td:nth-child(4) {
    white-space: nowrap;
}

.instruction-detail-actions {
    max-width: 640px;
    margin: 1.5rem auto 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.instruction-detail-actions .btn {
    min-width: 140px;
}

.instruction-detail-actions--left {
    max-width: none;
    margin: 1.5rem 0 0;
    justify-content: flex-start;
}

.instruction-detail-actions--spread-left {
    margin-left: 0;
    margin-right: auto;
    justify-content: space-between;
}

.instruction-detail-actions--split {
    max-width: none;
    margin: 1.5rem 0 0;
}

.bundle-rfid-table-scroll {
    max-height: 320px;
    overflow-y: auto;
    border: none;
    border-radius: 0;
}

/* バラシ・結束履歴詳細のRFID見出し行は縦スクロール時も常に表示する */
.instruction-detail-table--sticky-header {
    position: relative;
}

.instruction-detail-table--sticky-header thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #eef2f6;
}

.detail-inline-field {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: baseline;
}

.detail-inline-field__label {
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
}

.detail-inline-field__value {
    font-size: 1.05rem;
    font-weight: 500;
}

.detail-mini-table th {
    width: auto;
    min-width: 120px;
}

.detail-mini-table td {
    font-weight: 500;
}

.stocktaking-adjustment-actions {
    width: 100%;
    flex-wrap: nowrap !important; /* Bootstrapのflex-wrap指定を上書きし、行高を一定に保つ */
    gap: 0.1rem !important;
}

.stocktaking-adjustment-table .stocktaking-adjustment-actions .btn {
    font-size: 0.58rem;
    padding: 0;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    line-height: 1;
    border-radius: 0.35rem;
    box-sizing: border-box;
    white-space: nowrap;
}

.stocktaking-adjustment-actions .btn {
    font-size: 0.72rem;
    padding: 0.18rem 0.45rem;
    min-height: 28px;
    white-space: nowrap;
}

.stocktaking-adjustment-actions__delete,
.stocktaking-adjustment-actions .btn-common-action {
    min-width: 50px;
}

.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register,
.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register:visited {
    background-color: var(--md-sys-color-primary) !important;
    border-color: var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-on-primary) !important;
}

.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register:hover,
.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register:focus-visible {
    background-color: rgba(30, 136, 229, 0.9) !important;
    border-color: rgba(30, 136, 229, 0.9) !important;
    color: var(--md-sys-color-on-primary) !important;
}

.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register.disabled,
.stocktaking-adjustment-actions .btn.stocktaking-adjustment-actions__rfid-register:disabled {
    background-color: rgba(30, 136, 229, 0.5) !important;
    border-color: rgba(30, 136, 229, 0.4) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    box-shadow: none;
}

/* 棚卸調整行の表示状態ごとの背景色 */
.stocktaking-adjustment-row--system-only td {
    background-color: #fff4ce;
}

.stocktaking-adjustment-row--physical-only td {
    background-color: #fde2e1;
}

.stocktaking-adjustment-row--matched td {
    background-color: #d7eafe;
}

.instruction-detail-table th,
.instruction-detail-table td {
    border: 1px solid var(--md-table-border-color);
    padding: 0.85rem 1.2rem;
    font-size: 0.95rem;
}

.instruction-detail-table th {
    width: 32%;
    background-color: rgba(15, 23, 42, 0.04);
    font-weight: 600;
    text-align: center;
    color: var(--md-sys-color-on-surface);
}

.instruction-detail-table td {
    background-color: #fff;
}

.instruction-detail-table--grid th {
    width: auto;
    min-width: 110px;
}

.instruction-detail-table--grid td {
    width: auto;
}

.instruction-detail-table--grid .placeholder-cell {
    background-color: transparent;
    border-color: transparent;
}

.instruction-detail-table td[data-type="number"] {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.detail-action-bar .btn {
    min-width: 120px;
}

.shipping-detail-header-table {
    max-width: 420px;
    margin: 0;
}

.shipping-detail-header-card {
    max-width: 420px;
    margin-left: 0;
}

.shipping-detail-header-table th {
    width: 40%;
}

.shipping-product-header-card {
    max-width: 900px;
}

.shipping-product-zone + .shipping-product-zone {
    margin-top: 12px;
}

.shipping-product-header-table th {
    width: 18%;
}

.shipping-product-header-table th:nth-child(1),
.shipping-product-header-table th:nth-child(3) {
    width: 16%;
}

.shipping-product-header-table td:nth-child(2),
.shipping-product-header-table td:nth-child(4) {
    width: 34%;
}

.shipping-product-header-action-row {
    margin-left: 87%;
}

.shipping-product-header-action-row .btn {
    white-space: nowrap;
}

.shipping-product-info-table th:nth-child(1),
.shipping-product-info-table th:nth-child(3),
.shipping-product-order-table th:nth-child(1),
.shipping-product-order-table th:nth-child(3) {
    width: 16%;
}

.shipping-product-info-table td:nth-child(2),
.shipping-product-info-table td:nth-child(4),
.shipping-product-order-table td:nth-child(2),
.shipping-product-order-table td:nth-child(4) {
    width: 34%;
}

.shipping-product-info-table tr:first-child th,
.shipping-product-info-table tr:first-child td {
    border-top: 0;
}

.shipping-product-header-table .shipping-product-empty-cell {
    background-color: #fff;
    color: transparent;
}

.shipping-product-header-table .shipping-product-empty-label-cell {
    background-color: rgba(15, 23, 42, 0.04);
}

.shipping-product-product-code-table .shipping-product-empty-cell {
    background-color: #fff;
    color: transparent;
}

.shipping-product-product-code-table .shipping-product-product-code-button-row td {
    border: 0;
    background: transparent;
    padding: 0 0 0.5rem 0;
}

.shipping-product-product-code-table th:first-child {
    width: 16%;
}

.shipping-product-header-table .shipping-product-button-row th,
.shipping-product-header-table .shipping-product-button-row td {
    border-left-color: transparent;
    border-right-color: transparent;
}

.shipping-product-header-table .shipping-product-separator-row th,
.shipping-product-header-table .shipping-product-separator-row td {
    border: 0;
    height: 10px;
    padding: 0;
    background-color: #fff;
}

.shipping-product-inspection-table {
    table-layout: fixed;
}

.shipping-product-inspection-col-label {
    width: 24%;
    min-width: 110px;
}

.shipping-product-inspection-col-value {
    width: 100px;
}

.shipping-product-inspection-col-action {
    width: 160px;
}

.shipping-product-inspection-table td {
    background-color: rgba(15, 23, 42, 0.04);
}

.shipping-product-inspection-table th {
    min-width: 110px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.shipping-product-inspection-status-cell {
    background-color: #fff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shipping-product-inspection-status-value {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shipping-product-inspection-worker-content {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shipping-product-inspection-worker-cell {
    background-color: #fff !important;
}

.shipping-product-inspection-card {
    display: block;
}

.shipping-product-inspection-action-cell {
    background-color: #fff !important;
    text-align: left;
    vertical-align: middle;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: 1px solid var(--md-table-border-color) !important;
}

.shipping-product-inspection-table .shipping-product-inspection-row--forced td.shipping-product-inspection-status-cell {
    background-color: #e57a66 !important;
    color: #111 !important;
}

.shipping-product-force-shipment-btn {
    background-color: #d98f8f;
    border-color: #d98f8f;
    color: #fff;
}

.shipping-product-force-shipment-btn:hover {
    background-color: #cf7c7c;
    border-color: #cf7c7c;
    color: #fff;
}

.shipping-product-card {
    max-width: 900px;
}

.shipping-product-card .form-control {
    border-radius: var(--md-border-radius-sm);
}

.shipping-product-card textarea.form-control {
    resize: vertical;
}

.shipping-product-action-row {
    width: 100%;
    max-width: 900px; /* 製品選択エリアと戻る／登録エリアの横幅を統一 */
}

.inventory-rfid-issue-input {
    max-width: 420px;
}

.inventory-search-panel,
.inventory-result-panel {
    background-color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    padding: 2rem;
}

.inventory-search-panel {
    display: block;
}

.inventory-search-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: end;
}

.inventory-search-form label {
    font-weight: 500;
    color: rgba(15, 23, 42, 0.74);
}

.inventory-search-form > div {
    min-width: 0;
}

.inventory-search-actions {
    grid-column: 4 / -1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.inventory-search-actions .btn {
    min-width: 120px;
}

@media (max-width: 576px) {
    .inventory-search-form {
        grid-template-columns: 1fr;
    }

    .inventory-search-actions {
        grid-column: auto;
        width: 100%;
        flex-direction: column;
    }

    .inventory-search-actions .btn {
        width: 100%;
    }
}

.inventory-result-panel__body {
    padding: 0;
}

.inventory-result-panel__body .table-responsive {
    margin-top: 1rem;
}

.shipping-detail-header {
    background-color: var(--md-sys-color-surface);
}

.shipping-detail-grid {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--md-table-border-color);
}

.shipping-detail-grid th,
.shipping-detail-grid td {
    border: 1px solid var(--md-table-border-color);
    padding: 0.75rem 1rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.shipping-detail-grid th {
    width: 18%;
    background-color: rgba(15, 23, 42, 0.04);
    text-align: center;
    font-weight: 600;
}

.shipping-detail-grid td {
    width: 32%;
    background-color: var(--md-sys-color-surface);
}

.shipping-detail-grid .shipping-detail-placeholder {
    color: transparent;
    background-color: transparent;
    border-color: transparent;
}

/* 入庫履歴詳細（品目） */
.receive-history-detail-card {
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    background-color: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-shadow-l1);
    padding: 1.5rem;
}

.receive-history-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.receive-history-detail-table th,
.receive-history-detail-table td {
    border: 1px solid var(--md-table-border-color);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-history-detail-table th {
    width: 14%;
    min-width: 110px;
    background-color: rgba(15, 23, 42, 0.04);
    text-align: center;
    font-weight: 600;
}

.inventory-detail-page .receive-history-detail-table {
    width: 92% !important;
    margin-left: 0;
    margin-right: auto;
}

.inventory-detail-page .instruction-detail-actions {
    width: 92%;
    margin-left: 0;
    margin-right: auto;
}

.inventory-detail-basic8-table {
    table-layout: fixed;
}

.inventory-detail-basic8-table th,
.inventory-detail-basic8-table td {
    width: calc(100% / 6);
}

.inventory-detail-summary-row-table {
    table-layout: fixed;
}

.inventory-detail-summary-row-table th {
    width: 14%;
}

.inventory-detail-summary-row-table td {
    width: 19.3333%;
}

.inventory-detail-summary-row-table td.inventory-detail-warehouse-value {
    width: 17%;
}

.inventory-detail-summary-row-table td.inventory-detail-production-lot-value {
    width: 16%;
}

.detail-section-title {
    font-weight: 600;
    color: var(--md-sys-color-secondary);
    letter-spacing: 0.05em;
}

.grade-summary-tile {
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-md);
    padding: 1rem;
    text-align: center;
    background-color: rgba(30, 136, 229, 0.04);
}

.grade-summary-tile .grade-label {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--md-sys-color-secondary);
}

.grade-summary-tile .grade-count {
    font-size: 1rem;
    margin-top: 0.35rem;
}

.history-sub-table th {
    text-align: center;
}

.history-sub-table td {
    text-align: left;
}

.production-record-table th {
    text-align: center;
}

.production-record-table td {
    text-align: left;
}

/* 出荷履歴詳細 */
.shipment-history-detail-card {
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    background-color: var(--md-sys-color-surface);
    box-shadow: var(--md-sys-shadow-l1);
    padding: 1.5rem;
}

.shipment-history-detail-table {
    width: 100%;
    border-collapse: collapse;
}

.shipment-history-detail-table th,
.shipment-history-detail-table td {
    border: 1px solid var(--md-table-border-color);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.shipment-history-detail-table th {
    background-color: rgba(15, 23, 42, 0.04);
    text-align: center;
    font-weight: 600;
    width: 16%;
}

.shipment-history-remark {
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-md);
    padding: 1rem;
    min-height: 140px;
    background-color: rgba(15, 23, 42, 0.02);
}

.shipment-history-product-table th,
.shipment-history-rfid-table th {
    text-align: center;
}

.shipment-history-product-table td,
.shipment-history-rfid-table td {
    text-align: left;
}

.shipment-history-product-table td:last-child {
    text-align: right;
}

.shipment-history-delivery-scroll {
    /* 上段表は直前の設定より0.5行分だけ広く表示する。 */
    max-height: clamp(116px, calc(43vh - 180px), 240px);
}

.shipment-history-other-office-scroll {
    /* 他事業所表は現在の表示から0.5行分だけ狭くする。 */
    max-height: clamp(148px, calc(43vh - 184px), 252px);
}

.shipment-history-delivery-scroll thead th,
.shipment-history-other-office-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--md-sys-color-surface);
}

/* 生産開始画面 */
.start-mode-card .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.1rem;
}

.start-mode-card .form-check-label {
    margin-left: 0.35rem;
    font-weight: 600;
}

.product-selection-card {
    border: 1px solid var(--md-table-border-color);
}

.product-selection-panel {
    background-color: transparent;
    border: none;
    padding: 0;
}

.mode-action-row .btn,
.mode-secondary-action .btn {
    min-width: 140px;
}

.product-summary-table-wrapper .table {
    box-shadow: none;
    border-radius: var(--md-border-radius-lg);
}

.product-summary-table--plain,
.product-summary-table--plain th,
.product-summary-table--plain td {
    border: none;
}

.product-summary-table th {
    width: 180px;
    background-color: var(--md-sys-color-primary-soft);
    color: var(--md-sys-color-on-surface);
}

.product-summary-table td {
    background-color: var(--md-sys-color-surface);
    font-weight: 600;
}

.product-selection-table-section--start .production-instruction-table-scroll {
    border-radius: 0;
    padding-left: 0;
    padding-right: 0;
}

.product-selection-flat-table {
    border-radius: 0;
}

.product-selection-flat-table .table {
    border-radius: 0;
}

.product-selection-search-form .col-xl-fifth,
.product-selection-search-form .col-xl-two-fifth {
    flex: 1 1 100%;
    max-width: 100%;
}

.product-selection-search-form--tight {
    row-gap: 0.5rem;
}

.product-selection-search-form > .col-12.col-sm-6.col-xl-fifth {
    margin-top: 0.5rem;
}

@media (min-width: 1200px) {
    .product-selection-search-form .col-xl-fifth {
        flex: 0 0 20%;
        max-width: 20%;
    }

    .product-selection-search-form .col-xl-two-fifth {
        flex: 0 0 40%;
        max-width: 40%;
    }
}

.inventory-summary-panel {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    padding: 1.5rem;
    max-width: 420px;
    box-shadow: var(--md-sys-shadow-l1);
}

.inventory-summary-table-wrapper {
    margin-left: 0;
    margin-right: auto;
}

.inventory-summary-table th {
    text-align: center;
    width: 160px;
    font-weight: 600;
    background-color: var(--md-sys-color-primary-soft);
    color: var(--md-sys-color-on-surface);
    vertical-align: middle;
    padding: 0.75rem 1.5rem;
    border-color: var(--md-table-border-color);
}

.inventory-summary-table td {
    text-align: left;
    vertical-align: middle;
    padding: 0.75rem 1.5rem;
    border-color: var(--md-table-border-color);
    background-color: var(--md-sys-color-surface);
    font-weight: 600;
}

.summary-two-column {
    width: 90%;
    max-width: 1080px;
    margin-left: 0;
    margin-right: 0;
}
.table.table-md td {
    border-top: 1px solid var(--md-table-border-color);
}

.table.table-md tbody tr:hover {
    background-color: rgba(30, 136, 229, 0.04);
}

.table-responsive {
    border-radius: var(--md-border-radius-lg);
}

.rfid-field-hidden {
    visibility: hidden;
}

.rfid-field-container {
    min-height: 146px;
}

/* ユーザーマスタ画面 */
.user-management-panel {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    padding: 2rem;
    box-shadow: var(--md-sys-shadow-l1);
}

.user-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.user-page-title {
    font-size: 1.75rem;
    font-weight: 600;
}

.user-create-btn {
    min-width: 140px;
}

.user-search-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-search-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.user-search-field {
    flex: 1 1 220px;
}

.user-search-field-wide {
    flex: 1 1 360px;
}

.user-row-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-row-btn {
    min-width: 110px;
}

.user-list-main {
    padding-right: clamp(1.25rem, 2.8vw, 2.4rem);
}

.user-list-table-scroll {
    max-width: 100%;
    max-height: clamp(248px, 50vh, 476px);
}

.table.table-md.production-instruction-table.user-list-table {
    min-width: 1240px;
}

.user-list-table th:nth-child(3),
.user-list-table td:nth-child(3) {
    min-width: 150px;
}

.user-list-table th:nth-child(4),
.user-list-table td:nth-child(4) {
    min-width: 250px;
}

.user-list-table th:nth-child(5),
.user-list-table td:nth-child(5) {
    min-width: 140px;
}

.user-list-table th:nth-child(6),
.user-list-table td:nth-child(6) {
    min-width: 180px;
}

.user-list-table th:nth-child(7),
.user-list-table td:nth-child(7) {
    min-width: 190px;
}

.user-list-table th:nth-child(8),
.user-list-table td:nth-child(8) {
    min-width: 120px;
}

.user-table-card {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--md-sys-shadow-l1);
}

.user-table .form-check-input {
    margin: 0;
}

/* ユーザ一覧のユーザ名は2行で省略し、title属性で全文を確認できるようにする */
.production-instruction-table td.user-name-cell {
    white-space: normal;
}

.user-name-cell .user-name-cell-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
    max-height: calc(1.35em * 2);
}

/* ユーザー新規・編集フォーム */
.user-form-panel {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    box-shadow: var(--md-sys-shadow-l1);
    padding: 2.5rem 3rem;
    max-width: 760px;
}

.user-form-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.user-form-label {
    width: 120px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.82);
}

.user-form-field {
    flex: 1;
    max-width: 460px;
}

.user-form-actions {
    margin-top: 2.5rem;
    align-items: center;
}

.user-form-actions .btn {
    min-width: 140px;
}

@media (max-width: 768px) {
    .user-form-panel {
        padding: 1.5rem;
    }

    .user-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .user-form-label {
        width: 100%;
    }

    .user-form-field {
        max-width: none;
        width: 100%;
    }

    .user-form-actions {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 992px) {
    .user-row-actions {
        justify-content: flex-start;
    }
}

/* 製品マスタ画面 */
.product-master-panel {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-lg);
    padding: 2rem;
    box-shadow: var(--md-sys-shadow-l1);
    min-height: calc(100vh - 5rem);
}

.product-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.product-page-title {
    font-size: 1.7rem;
    font-weight: 600;
}

.product-search-form .form-label {
    font-weight: 600;
}

.product-search-actions {
    gap: 0.6rem;
}

.product-search-actions .btn {
    width: 100%;
}

.product-master-search-table {
    width: 100%;
    border: 1px solid var(--md-table-border-color);
    border-radius: var(--md-border-radius-md);
    border-collapse: separate;
    border-spacing: 0;
    background-color: #fff;
}

.product-master-search-table th,
.product-master-search-table td {
    border: 1px solid var(--md-table-border-color);
    padding: 0.85rem;
    vertical-align: middle;
}

.product-master-search-table th {
    background-color: rgba(15, 23, 42, 0.04);
    width: 12rem;
    font-weight: 600;
}

.product-master-search-table input.form-control {
    border: none;
    box-shadow: none;
}


.product-item-table th:first-child,
.product-item-table td:first-child,
.product-item-table th:nth-child(2),
.product-item-table td:nth-child(2) {
    width: 120px;
}

.product-item-table td.text-muted {
    color: rgba(15, 23, 42, 0.6);
}

.product-master-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.parent-product-header-line {
    align-items: flex-start;
}

.parent-product-header-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    max-width: 100%;
}

.parent-import-field {
    flex: 1 1 220px;
    min-width: 180px;
    max-width: 260px;
}

.parent-file-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.parent-import-action {
    flex: 0 0 auto;
    min-width: 108px;
}

.parent-search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.parent-search-basic-grid {
    display: grid;
    grid-template-columns:
        minmax(100px, 0.55fr)
        minmax(100px, 0.55fr)
        minmax(100px, 0.55fr)
        minmax(120px, 0.7fr)
        minmax(150px, 1fr)
        minmax(108px, auto)
        minmax(108px, auto);
    gap: 0.85rem;
    align-items: end;
}

.parent-search-basic-actions {
    justify-self: end;
    min-width: 0;
    margin-top: 0;
    align-self: end;
    flex-wrap: nowrap;
}

.parent-search-basic-actions .btn {
    min-width: 108px;
}

.parent-search-details {
    margin-top: 0;
    padding-top: 0.25rem;
}

.parent-search-details .search-collapsible__summary {
    margin-bottom: 0.85rem;
    padding: 0;
    display: inline-flex;
}

.parent-search-detail-grid {
    grid-template-columns: minmax(220px, 360px);
    max-width: 360px;
}

.parent-product-table th:first-child,
.parent-product-table td:first-child {
    width: 120px;
}

@media (max-width: 1400px) {
    .parent-search-basic-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .parent-search-basic-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .parent-search-basic-grid {
        grid-template-columns: 1fr;
    }

    .parent-search-basic-actions {
        justify-self: stretch;
        width: 100%;
    }

    .parent-search-basic-actions .btn {
        min-width: 0;
    }

    .parent-search-detail-grid {
        grid-template-columns: 1fr;
        max-width: none;
    }
}

@media (max-width: 992px) {
    .product-header-line {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-search-actions {
        flex-direction: row !important;
    }

}

.list-group-item {
    border: none;
    border-bottom: 1px solid rgba(121, 116, 126, 0.12);
    padding: 1rem 1.25rem;
    background-color: transparent;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group {
    border-radius: var(--md-border-radius-lg);
    box-shadow: var(--md-sys-shadow-l1);
    background-color: var(--md-sys-color-surface);
}

/* Buttons */
.btn {
    border-radius: var(--md-border-radius-md);
    border: none;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.03em;
    white-space: nowrap;
    padding: 0.6rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--btn-min-width, var(--md-btn-min-width));
    height: var(--btn-height, var(--md-btn-height));
}

.btn-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: var(--md-sys-shadow-l1);
}

.btn-confirm-action {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
    box-shadow: var(--md-sys-shadow-l1);
}

.btn-confirm-action:hover,
.btn-confirm-action:focus-visible {
    background-color: #0f9f73;
    border-color: #0f9f73;
    color: #ffffff;
}

.btn-confirm-action:disabled,
.btn-confirm-action.disabled,
.btn-common-action.btn-confirm-action.disabled,
.btn-common-action.btn-confirm-action:disabled {
    background-color: rgba(16, 185, 129, 0.5);
    border-color: rgba(16, 185, 129, 0.4);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-common-action.btn-confirm-action {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.btn-common-action.btn-confirm-action:hover,
.btn-common-action.btn-confirm-action:focus-visible {
    background-color: #0f9f73;
    border-color: #0f9f73;
    color: #ffffff;
}

.btn-search {
    --btn-height: var(--md-btn-height);
    --btn-min-width: var(--md-btn-min-width);
}

.btn-command {
    --btn-height: var(--md-btn-height);
    --btn-min-width: var(--md-btn-min-width);
}

.btn-danger,
.btn-destructive {
    background-color: var(--md-sys-color-error);
    color: #fff;
    box-shadow: var(--md-sys-shadow-l1);
}

.btn-danger:hover,
.btn-destructive:hover {
    background-color: #a02018;
    color: #fff;
}

.btn-destructive:disabled,
.btn-destructive.disabled {
    background-color: rgba(179, 38, 30, 0.5);
    border-color: rgba(179, 38, 30, 0.4);
    color: rgba(255, 255, 255, 0.7);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-action {
    --btn-min-width: auto;
    min-width: auto;
    padding: 0.55rem 1.2rem;
}

.btn-flexible {
    --btn-height: auto;
    --btn-min-width: auto;
    height: auto;
    min-width: auto;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--md-sys-shadow-l2);
}

.btn-outline-dark,
.btn-outline-primary {
    color: var(--md-sys-color-primary);
    border: 1px solid rgba(30, 136, 229, 0.32);
    background-color: transparent;
    box-shadow: none;
}

.btn-common-action {
    color: var(--md-sys-color-primary);
    border: 1px solid rgba(30, 136, 229, 0.45);
    background-color: transparent;
    box-shadow: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.btn-common-action.btn-detail-link {
    background-color: #ffffff;
    color: var(--md-sys-color-primary);
    border-color: rgba(30, 136, 229, 0.45);
    box-shadow: none;
}

.btn-common-action.btn-detail-link:hover,
.btn-common-action.btn-detail-link:focus-visible {
    background-color: #ffffff;
    color: var(--md-sys-color-primary);
    border-color: rgba(30, 136, 229, 0.65);
    box-shadow: var(--md-sys-shadow-l1);
}

.btn-monitor-action {
    padding-left: 8px;
    padding-right: 8px;
}

.btn-common-action:hover,
.btn-common-action:focus-visible {
    background-color: rgba(30, 136, 229, 0.12);
    border-color: rgba(30, 136, 229, 0.85);
    color: var(--md-sys-color-primary);
    box-shadow: var(--md-sys-shadow-l2);
}

.btn-common-action.btn-confirm-action,
.btn-common-action.btn-detail-link.btn-confirm-action {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.btn-common-action.btn-confirm-action:hover,
.btn-common-action.btn-confirm-action:focus-visible,
.btn-common-action.btn-detail-link.btn-confirm-action:hover,
.btn-common-action.btn-detail-link.btn-confirm-action:focus-visible {
    background-color: #0f9f73;
    border-color: #0f9f73;
    color: #ffffff;
}

.btn-outline-dark:hover,
.btn-outline-primary:hover {
    background-color: rgba(30, 136, 229, 0.12);
    color: var(--md-sys-color-primary);
}

.btn:focus-visible {
    outline: 2px solid rgba(30, 136, 229, 0.32);
    outline-offset: 2px;
}

/* Ripple inspired hover */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    background: rgba(255, 255, 255, 0.2);
    transition: opacity 0.2s ease;
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
    box-shadow: var(--md-sys-shadow-l1);
}

/* Badges and alerts */
.badge {
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-weight: 600;
}

.badge.text-bg-warning {
    background-color: rgba(255, 176, 0, 0.18) !important;
    color: #8c5000 !important;
}

.badge.text-bg-success {
    background-color: rgba(0, 129, 81, 0.18) !important;
    color: #00513a !important;
}

.badge.text-bg-secondary {
    background-color: rgba(98, 91, 113, 0.18) !important;
    color: var(--md-sys-color-secondary) !important;
}

.alert {
    border-radius: var(--md-border-radius-md);
    border: none;
    box-shadow: var(--md-sys-shadow-l1);
}

.alert-danger {
    background-color: rgba(179, 38, 30, 0.12);
    color: var(--md-sys-color-error);
    white-space: pre-line;
}

/* Forms */
.form-control,
.form-select,
.input-group-text {
    border-radius: var(--md-border-radius-md);
    border: 1px solid rgba(121, 116, 126, 0.24);
    background-color: #fff;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(30, 136, 229, 0.48);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.12);
}

.input-group-text {
    background-color: rgba(30, 136, 229, 0.08);
    border-color: rgba(121, 116, 126, 0.24);
}

/* Utility overrides */
.bg-light {
    background-color: var(--md-sys-color-surface) !important;
}

.shadow-sm {
    box-shadow: var(--md-sys-shadow-l1) !important;
}

.display-6 {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.text-muted {
    color: rgba(15, 23, 42, 0.6) !important;
}

/* Table filter grids */
.search-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 1.25rem;
}

.search-grid--start {
    grid-template-columns:
        minmax(130px, 0.9fr)
        minmax(260px, 1.4fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.75fr)
        minmax(130px, 0.75fr);
}

.production-start-search-details {
    margin-top: 0;
    padding-top: 0.15rem;
}

.production-start-search-details .search-collapsible__summary {
    margin-bottom: 0.3rem;
    padding: 0;
    display: inline-flex;
}

.production-start-search-actions {
    grid-column: 5 / -1;
    justify-self: stretch;
    min-width: 0;
    align-self: end;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.5rem;
    align-items: end;
}

.production-start-search-action {
    min-width: 108px;
    width: auto;
    flex: 0 0 auto;
}

.production-start-search-action.btn {
    min-width: 108px;
}

.production-start-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 0 !important;
}

.production-start-instruction-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.production-start-search-form {
    flex: 0 0 auto;
}

.production-start-result-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.production-start-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

.production-start-result-section .result-pagination-row {
    margin-top: 0.3rem;
    margin-bottom: 0.25rem;
}

.production-start-detail-grid {
    display: grid;
    gap: 0.85rem;
    width: 100%;
}

.production-start-detail-row {
    grid-template-columns:
        minmax(130px, 0.9fr)
        minmax(260px, 1.4fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.75fr)
        minmax(130px, 0.75fr);
    gap: 1.25rem;
    width: 100%;
}

.search-grid--receive {
    grid-template-columns:
        minmax(150px, 0.9fr)
        minmax(150px, 0.9fr)
        minmax(150px, 0.9fr)
        minmax(150px, 0.9fr);
}

.search-grid--shipment {
    grid-template-columns:
        minmax(260px, 1.4fr)
        minmax(140px, 0.8fr)
        minmax(160px, 0.9fr)
        minmax(160px, 0.9fr)
        minmax(140px, 0.8fr);
    gap: 0.9rem;
}

/* 出荷履歴は検索条件を1行に並べる */
.search-grid--history-shipment {
    grid-template-columns:
        minmax(180px, 1.2fr)
        minmax(180px, 1.2fr)
        minmax(120px, 0.7fr)
        minmax(160px, 0.95fr)
        minmax(160px, 0.95fr)
        minmax(140px, 0.8fr);
    gap: 0.65rem;
}

.search-grid--history-shipment #inspectionStatus {
    min-width: 120px;
}

.search-grid--receive-history {
    grid-template-columns:
        minmax(260px, 1.4fr)
        minmax(140px, 0.8fr)
        minmax(160px, 0.9fr)
        minmax(160px, 0.9fr);
    column-gap: 0.5rem;
    row-gap: 0.7rem;
}

.search-collapsible {
    border-radius: var(--md-border-radius-lg);
}

.search-collapsible__summary {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: var(--md-sys-color-secondary);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.35rem 0;
    margin-bottom: 0.85rem;
}

.search-collapsible__summary::-webkit-details-marker {
    display: none;
}

.search-collapsible__summary-icon {
    transition: transform 0.2s ease;
}

.search-collapsible[open] .search-collapsible__summary-icon {
    transform: rotate(180deg);
}

.search-collapsible:not([open]) .search-form-flat {
    display: none;
}

.search-collapsible[open] .search-form-flat {
    display: block;
}

.search-collapsible .search-form-flat {
    margin-top: 0;
}

.search-collapsible .search-grid {
    margin-top: 0;
}

.receive-history-search-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.receive-history-search-panel {
    padding: 1rem 1rem 0.25rem;
}

.receive-history-basic-search-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(320px, 1.3fr) minmax(180px, 0.8fr) auto;
    gap: 1rem;
    align-items: end;
}

.receive-history-basic-search-datetime {
    min-width: 0;
}

.receive-history-basic-search-actions {
    justify-self: end;
    min-width: 0;
    margin-top: 0;
    align-self: end;
}

.receive-search-panel {
    padding: 1rem 1rem 0.25rem;
}

.receive-search-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.receive-search-basic-row {
    display: grid;
    gap: 1rem;
    align-items: end;
}

.receive-search-basic-row--top {
    grid-template-columns:
        minmax(130px, 0.9fr)
        minmax(260px, 1.4fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.85fr)
        minmax(130px, 0.75fr)
        minmax(130px, 0.75fr);
}

.receive-search-basic-row--top > .search-grid__span-2 {
    grid-column: span 2;
}

.receive-search-details {
    margin-top: 0;
    padding-top: 0.15rem;
}

.receive-search-details .search-collapsible__summary {
    margin-bottom: 0.3rem;
    padding: 0;
    display: inline-flex;
}

.receive-search-basic-actions {
    grid-column: 6 / -1;
    justify-self: end;
    min-width: 0;
    margin-top: 0;
    align-self: end;
    flex-wrap: nowrap;
}

.receive-search-basic-actions .btn {
    min-width: 108px;
}

.receive-search-detail-grid {
    grid-template-columns:
        minmax(130px, 0.7fr)
        minmax(130px, 0.7fr)
        minmax(130px, 0.7fr)
        minmax(130px, 0.7fr)
        minmax(130px, 0.7fr)
        minmax(130px, 0.7fr);
    gap: 0.45rem;
}

@media (max-width: 1400px) {
    .receive-search-basic-row--top {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .receive-search-basic-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
        flex-wrap: wrap;
    }

    .receive-search-detail-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 767.98px) {
    .receive-history-search-panel {
        padding: 0.9rem 0.85rem 0.25rem;
    }

    .receive-search-panel {
        padding: 0.9rem 0.85rem 0.25rem;
    }

    .receive-search-basic-row {
        grid-template-columns: 1fr;
    }

    .receive-search-basic-row--top > .search-grid__span-2 {
        grid-column: span 1;
    }

    .receive-search-detail-grid {
        grid-template-columns: 1fr;
    }

    .receive-search-basic-actions {
        justify-self: stretch;
        width: 100%;
    }

    .receive-search-basic-actions .btn {
        min-width: 0;
    }
}

.history-receive-page {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 0 !important;
}

.history-receive-search-section {
    flex: 0 0 auto;
    margin-bottom: 0.35rem !important;
}

.history-receive-result-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
    padding-bottom: 0.25rem;
}

.history-receive-table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
}

.history-receive-stock-table-scroll {
    /* 入庫品一覧は可視件数を3.5行分増やして確認しやすくする。 */
    max-height: clamp(400px, 64vh, 700px);
}

.history-receive-input-table-scroll {
    /* 投入品一覧は可視件数をさらに半行分増やして確認しやすくする。 */
    max-height: clamp(420px, 67vh, 720px);
}

.history-receive-result-section .result-pagination-row {
    margin-top: 0.3rem;
    margin-bottom: 0.25rem;
}

.history-receive-result-section .production-instruction-table th,
.history-receive-result-section .production-instruction-table td {
    padding: 0.4rem 0.55rem;
}

.history-receive-result-section .production-instruction-table .action-column {
    width: 72px;
    min-width: 72px;
}

.history-receive-result-section .production-instruction-table th:nth-child(6),
.history-receive-result-section .production-instruction-table td:nth-child(6) {
    width: 120px;
    min-width: 120px;
}

@media (min-width: 768px) {
    .receive-history-search-form {
        --receive-history-clear-button-width: 108px;
    }

    .receive-history-search-form .search-grid--receive-history {
        max-width: calc(100% - var(--receive-history-clear-button-width));
    }

.receive-history-search-form .receive-history-clear-btn {
        width: var(--receive-history-clear-button-width);
        flex: 0 0 var(--receive-history-clear-button-width);
    }
}

.bundle-operations-search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bundle-operations-basic-grid {
    display: grid;
    grid-template-columns:
        minmax(180px, 0.85fr)
        minmax(160px, 0.8fr)
        minmax(320px, 1.4fr)
        auto;
    gap: 0.85rem;
    align-items: end;
}

.bundle-operations-basic-actions {
    justify-self: end;
    min-width: 0;
    margin-top: 0;
    align-self: end;
}

.bundle-operations-search-details {
    margin-top: 0;
    padding-top: 0.25rem;
}

.bundle-operations-search-details .search-collapsible__summary {
    margin-bottom: 0.85rem;
    padding: 0;
    display: inline-flex;
}

.bundle-operations-page .production-instruction-table-scroll.list-table-scroll--compact {
    max-height: clamp(240px, 42vh, 440px);
}

.bundle-operations-detail-grid {
    grid-template-columns:
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(125px, 1.15fr)
        minmax(130px, 1.2fr)
        minmax(95px, 0.85fr)
        minmax(95px, 0.85fr)
        minmax(95px, 0.85fr);
    gap: 0.45rem;
}

@media (max-width: 767.98px) {
    .bundle-operations-basic-grid {
        grid-template-columns: 1fr;
    }

    .bundle-operations-basic-actions {
        justify-self: stretch;
    }

    .bundle-operations-detail-grid {
        grid-template-columns: 1fr;
    }
}

.receive-history-search-form .receive-history-major-eight-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns:
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(110px, 1fr)
        minmax(125px, 1.15fr)
        minmax(130px, 1.2fr)
        minmax(95px, 0.85fr)
        minmax(95px, 0.85fr)
        minmax(95px, 0.85fr);
    gap: 0.45rem;
}

.search-grid--production {
    grid-template-columns:
        minmax(150px, 0.9fr)
        minmax(260px, 1.4fr)
        minmax(150px, 0.9fr)
        minmax(150px, 0.9fr);
    gap: 0.9rem;
}

.search-grid--bundle-operations {
    grid-template-columns:
        minmax(110px, 0.6fr)
        minmax(110px, 0.6fr)
        minmax(110px, 0.6fr)
        minmax(120px, 0.8fr)
        minmax(120px, 0.8fr)
        minmax(120px, 0.8fr)
        minmax(120px, 0.8fr)
        minmax(120px, 0.8fr);
    width: 91.666667%;
    gap: 0.9rem;
}

.search-grid--print {
    grid-template-columns:
        minmax(220px, 1.15fr)
        minmax(220px, 1.15fr)
        minmax(240px, 1.3fr)
        minmax(120px, 0.65fr);
    gap: 0.85rem;
}

.search-grid--print .search-grid__print-result {
    min-width: 0;
}

@media (max-width: 1400px) {
    .receive-history-basic-search-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .receive-history-basic-search-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .bundle-operations-basic-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .bundle-operations-basic-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .search-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .search-grid--start {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .production-start-detail-grid {
        gap: 0.7rem;
    }

    .production-start-detail-row {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .production-start-search-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }

    .production-start-page {
        min-height: auto;
        height: auto;
        overflow: visible;
    }

    .search-grid--shipment {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .search-grid--history-shipment {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .search-grid--production {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .search-grid--bundle-operations {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
        width: 100%;
    }

    .search-grid--print {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .receive-history-basic-search-grid {
        grid-template-columns: 1fr;
    }

    .receive-history-basic-search-actions {
        justify-self: stretch;
        width: 100%;
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .search-grid--start {
        grid-template-columns: 1fr;
    }

    .production-start-search-action {
        min-width: 0;
    }

    .production-start-detail-grid {
        gap: 0.6rem;
    }

    .production-start-detail-row {
        grid-template-columns: 1fr;
    }

    .production-start-search-actions {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .production-start-page {
        min-height: auto;
        height: auto;
        overflow: visible;
    }

    .search-grid--shipment {
        grid-template-columns: 1fr;
    }

    .search-grid--history-shipment {
        grid-template-columns: 1fr;
    }

    .search-grid--production {
        grid-template-columns: 1fr;
    }

    .search-grid--bundle-operations {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .search-grid--print {
        grid-template-columns: 1fr;
    }
}

.search-grid label {
    font-weight: 500;
    color: rgba(15, 23, 42, 0.74);
}

.search-grid__span-2 {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .search-grid__span-2 {
        grid-column: span 1;
    }
}

.receive-type-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0.75rem;
    column-gap: 0.75rem;
    align-items: center;
}

.receive-type-label {
    text-align: center;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.74);
}

.receive-type-selector .form-check-input {
    border-width: 2px;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0 auto;
}

.search-action-card {
    min-width: 220px;
}

@media (max-width: 992px) {
    .search-action-card {
        width: 100%;
    }
}

/* Login page layout: カード化を避けるための最小限の装飾に調整 */
.login-panel {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
}

.login-panel-wrapper {
    min-width: 300px;
    max-width: 340px;
    width: 100%;
    margin: 0;
    flex: 0 0 auto;
}

/* Layout spacing */
.app-shell {
    padding-top: 0;
    padding-bottom: 0;
}

.app-shell > .row {
    flex-wrap: nowrap;
    align-items: stretch;
    overflow: visible;
}

.app-shell .md-sidebar {
    margin-top: 0;
    padding-top: 20px;
    padding-bottom: 10px;
    flex: 0 0 200px;
}

.app-shell > .row > main {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    padding-top: 20px;
}

/* 余白ユーティリティ */
.mb-18 {
    margin-bottom: 18px;
}

/* Dashboard layout */
.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: rgba(15, 23, 42, 0.85);
}

.dashboard-section-subtitle {
    font-size: 0.95rem;
    font-weight: 500;
}

.dashboard-page-date {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
}

.dashboard-summary-pair {
    margin-bottom: 1.5rem;
}

.dashboard-summary-block {
    flex: 0 1 460px;
    max-width: 460px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

.dashboard-production-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    flex: 1;
    align-content: stretch;
}

.dashboard-summary-grid--compact {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.7rem;
}

.dashboard-summary-card {
    background-color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.dashboard-summary-card--compact {
    padding: 0.7rem 1rem;
    border-radius: 12px;
}

.dashboard-summary-label {
    font-size: 0.88rem;
    color: rgba(15, 23, 42, 0.6);
    margin-bottom: 0.2rem;
}

.dashboard-summary-hint {
    font-size: 0.78rem;
    color: rgba(15, 23, 42, 0.5);
    margin-bottom: 0;
}

.dashboard-summary-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: rgba(15, 23, 42, 0.88);
    margin: 0;
}

.dashboard-summary-card.ratio-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    justify-content: space-between;
    min-height: 92px;
}

.dashboard-summary-ratio {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
}

.dashboard-summary-divider {
    font-size: 1.35rem;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.6);
}

.dashboard-summary-value.ratio-secondary {
    color: rgba(15, 23, 42, 0.88);
}

.dashboard-summary-ratio--offset {
    margin-top: 1.28rem;
}

@media (max-width: 1200px) {
    .dashboard-summary-block {
        flex: 1 1 100%;
        max-width: none;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.2rem 0.85rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    color: #0f172a;
    background-color: rgba(15, 23, 42, 0.08);
}

.status-badge.status-pending {
    background-color: rgba(99, 102, 241, 0.18);
    color: #4338ca;
}

.status-badge.status-in-progress {
    background-color: rgba(16, 185, 129, 0.18);
    color: #059669;
}

.status-badge.status-completed {
    background-color: rgba(14, 165, 233, 0.18);
    color: #0284c7;
}

.status-badge.status-paused {
    background-color: rgba(248, 113, 113, 0.18);
    color: #dc2626;
}

.dashboard-card {
    background-color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 32px;
    padding: 1.5rem 2rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.dashboard-item + .dashboard-item {
    margin-top: 1.5rem;
}

.dashboard-item-label {
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: rgba(15, 23, 42, 0.78);
}

.dashboard-placeholder {
    border: 1px solid rgba(15, 23, 42, 0.45);
    border-radius: 10px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    letter-spacing: 0.3rem;
    color: rgba(15, 23, 42, 0.6);
}

.dashboard-placeholder::after {
    content: '';
}

@supports not (scrollbar-gutter: stable) {
    body {
        overflow-y: scroll; /* scrollbar-gutter 非対応ブラウザ向けの幅安定策 */
    }

    .md-sidebar > .nav {
        overflow-y: auto; /* 必要時のみスクロールバーを表示し、視覚ノイズを抑える */
    }
}

.login-main {
    min-width: 0;
    flex: 1 1 auto !important;
    width: 100% !important;
}

/* 生産指示取込画面 */
.import-form .file-select-group {
    display: flex;
    gap: 16px;
    align-items: center;
    width: 100%;
}

.import-form .file-select-group input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    font-weight: 500;
}

.file-select-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: nowrap;
}

.import-form .file-select-group .btn {
    min-height: 42px;
    padding: 0 24px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--md-border-radius-md);
}

.import-form .file-select-group .import-file-btn {
    min-width: 120px;
}

.preview-submit-btn {
    min-width: 140px;
}

.import-submit-btn,
.back-btn {
    min-width: 120px;
    white-space: nowrap;
    min-height: 42px;
}

/* Import実行ボタンの無効時スタイル */
.import-submit-btn:disabled,
.import-submit-btn.disabled {
    background-color: var(--md-sys-color-surface-variant);
    border-color: var(--md-sys-color-outline);
    color: rgba(0, 0, 0, 0.45);
    box-shadow: none;
    cursor: not-allowed;
}

.action-row form {
    margin: 0;
}

.disabled-link {
    pointer-events: none;
    opacity: 0.55;
}

.receive-entry-mode-wrapper {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 1.5rem auto;
    max-width: 640px;
}

.receive-mode-option {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.receive-mode-label {
    font-weight: 600;
    min-width: 96px;
}

.receive-mode-option input[type="radio"] {
    accent-color: var(--md-sys-color-primary);
}

.receive-entry-table-container,
.receive-entry-actions {
    max-width: 640px;
    margin-left: 0;
    margin-right: auto;
}

.receive-entry-summary-container {
    max-width: 960px;
}

.receive-entry-summary-container .instruction-detail-table {
    table-layout: fixed;
}

.receive-entry-table-container .instruction-detail-table th {
    min-width: 110px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-table-container .instruction-detail-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-summary-container .instruction-detail-table th {
    width: 18%;
    padding: 0.85rem 0.75rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-summary-container .instruction-detail-table td {
    width: 32%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-summary-container .instruction-detail-table td.receive-entry-empty-cell {
    border: none;
    background-color: transparent;
    padding: 0;
}

.receive-entry-input-container .instruction-detail-table th {
    width: 18%;
    padding: 0.85rem 0.75rem;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-input-container .instruction-detail-table td {
    width: 82%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.receive-entry-actions {
    margin-top: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.receive-entry-actions.receive-entry-actions--wide {
    max-width: 960px;
}

.receive-entry-actions.receive-entry-actions--single {
    justify-content: flex-start;
}

.printer-driver-label {
    width: auto;
    white-space: nowrap;
    flex: 0 0 auto;
}

.printer-driver-select {
    width: auto;
    min-width: 120px;
    flex: 0 0 auto;
}

.instruction-detail-table input[type="number"] {
    width: 100%;
}

.instruction-detail-table input[disabled] {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-outline);
}

.receive-entry-disabled-row input {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-outline);
}

.receive-rfid-table-wrapper {
    /* 入庫用RFID読み取り画面は可視行を3行分増やす。 */
    max-height: 400px;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

.receive-confirm-table-scroll {
    /* 入庫対象確認画面は可視行を3行分増やす。 */
    max-height: 535px;
}

.input-rfid-table-scroll {
    /* 投入用RFID読み取り画面は可視行を1行分減らす。 */
    max-height: clamp(266px, 58vh, 646px);
}

.input-confirm-table-scroll {
    /* 投入確認画面は可視行を1行分減らす。 */
    max-height: clamp(306px, 64vh, 686px);
}

@media (max-width: 768px) {
    .import-form .file-select-group {
        flex-wrap: wrap;
        gap: 8px;
    }
    .import-form .file-select-group input[type="text"] {
        width: 100%;
    }
    .file-select-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}
.instruction-detail-actions.instruction-detail-actions--full-width {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.production-monitor-block {
    max-width: 960px;
    width: 100%;
    margin-left: 0;
    margin-right: auto;
}

.product-selection-table-section.product-selection-table-section--selection .production-instruction-table-scroll {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    /* 製品選択画面は表の可視範囲を狭め、表内で縦スクロールさせる。 */
    max-height: clamp(220px, 34vh, 340px);
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
}

/* 製品選択画面はスクロール領域を小さめにして、一覧の見切れを防ぐ。 */
.product-selection-table-section--selection .product-selection-table-scroll--compact {
    max-height: clamp(220px, 34vh, 340px);
}

.product-selection-table--compact th,
.product-selection-table--compact td {
    padding-top: 0.28rem;
    padding-bottom: 0.28rem;
}

.production-start-wrapper {
    max-width: 1280px;
    margin-left: 0;
    margin-right: auto;
}

.production-start-input-page {
    overflow: hidden;
}

.production-start-input-page .app-shell,
.production-start-input-page .app-shell > .row {
    height: 100vh;
    overflow: hidden;
}

.production-start-input-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
    overflow-y: hidden;
}

.production-start-input-main .production-start-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.production-start-panel {
    width: 100%;
    margin-bottom: 1.25rem;
}

.production-start-table th {
    width: 160px;
}

.production-start-main-table th {
    width: auto;
    white-space: nowrap;
}

.production-start-main-table {
    table-layout: auto;
    width: fit-content;
    min-width: 100%;
}

.production-start-main-table--meta {
    table-layout: fixed;
}

.production-start-meta-col-item {
    width: 140px;
}

.production-start-meta-col-value {
    width: calc((100% - 280px) / 2);
}

.production-start-main-table--meta {
    width: 66.6667% !important;
    min-width: 66.6667%;
    max-width: 66.6667%;
}

.production-start-basic-table {
    table-layout: fixed;
}

.production-start-basic-col-item {
    width: 140px;
}

.production-start-basic-col-value {
    width: calc((100% - 420px) / 3);
}

.production-start-worker-col-item {
    width: 140px;
}

.production-start-worker-col-value {
    width: calc((100% - 420px) / 3);
}

.production-start-worker-input-table {
    table-layout: fixed;
}

.production-start-basic-table th,
.production-start-basic-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.production-start-main-table th,
.production-start-main-table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.production-start-main-table-block {
    margin-bottom: 0;
}

.production-start-main-table-block + .production-start-main-table-block {
    margin-top: -1px;
}

.production-start-panel--connected {
    margin-bottom: 0;
}

.production-start-table--with-action th {
    width: 140px;
}

.production-start-table--with-action td:nth-child(2) {
    width: calc(100% - 200px);
}

.production-start-table--select th {
    width: 140px;
}

.production-start-table--select td {
    width: calc(100% - 140px);
}

.production-start-table th,
.production-start-table td {
    padding: 6px 12px;
}

.production-start-table__action {
    width: 80px;
    text-align: center;
}

.production-start-dropdown-btn {
    border-radius: 0;
    font-weight: 600;
}

.production-start-select {
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.production-start-worker-combobox {
    position: relative;
    width: 100%;
}

.production-start-worker-combobox__menu {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-table-border-color);
    box-shadow: var(--md-sys-shadow-l2);
    max-height: 220px;
    overflow-y: auto;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 20;
}

.production-start-worker-combobox__option {
    background: transparent;
    border: 0;
    color: var(--md-sys-color-on-surface);
    display: block;
    padding: 0.45rem 0.65rem;
    text-align: left;
    width: 100%;
}

.production-start-worker-combobox__option:hover,
.production-start-worker-combobox__option:focus,
.production-start-worker-combobox__option.is-selected {
    background-color: var(--md-sys-color-primary-container);
    outline: none;
}

.production-start-worker-filter {
    border-radius: 0;
    box-shadow: none;
    min-height: 32px;
    padding: 4px 28px 4px 8px;
    font-size: 0.9rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--md-sys-color-on-surface) 50%),
            linear-gradient(135deg, var(--md-sys-color-on-surface) 50%, transparent 50%);
    background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    cursor: text;
}

.production-start-input {
    border-radius: 0;
    box-shadow: none;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 0.9rem;
}

.production-start-operator-column {
    width: 120px;
    max-width: 120px;
    white-space: nowrap;
}

.production-start-operator-column .btn {
    width: 100px;
    min-width: 100px;
}

.production-start-panel--stocker {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.75rem;
    margin-top: 1.5rem;
    min-height: 0;
    width: 100%;
    max-width: none;
    overflow: visible;
}

.production-start-stocker-table-wrap {
    --production-start-stocker-header-height: 42px;
    --production-start-stocker-row-height: 45px;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(
        var(--production-start-stocker-header-height)
        + (var(--production-start-stocker-row-height) * 4.5)
    );
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
}

.production-start-stocker-table {
    table-layout: auto;
    width: fit-content;
    min-width: 100%;
}

.production-start-stocker-table th,
.production-start-stocker-table td {
    white-space: nowrap;
}

.production-start-stocker-table thead th {
    height: var(--production-start-stocker-header-height);
}

.production-start-stocker-table tbody th,
.production-start-stocker-table tbody td {
    height: var(--production-start-stocker-row-height);
}

.production-start-stocker-table th {
    width: auto;
}

.production-start-stocker-table th:nth-child(1),
.production-start-stocker-table td:nth-child(1) {
    min-width: 110px;
}

.production-start-stocker-table th:nth-child(2),
.production-start-stocker-table td:nth-child(2),
.production-start-stocker-table th:nth-child(3),
.production-start-stocker-table td:nth-child(3),
.production-start-stocker-table th:nth-child(4),
.production-start-stocker-table td:nth-child(4),
.production-start-stocker-table th:nth-child(5),
.production-start-stocker-table td:nth-child(5),
.production-start-stocker-table th:nth-child(6),
.production-start-stocker-table td:nth-child(6),
.production-start-stocker-table th:nth-child(9),
.production-start-stocker-table td:nth-child(9),
.production-start-stocker-table th:nth-child(10),
.production-start-stocker-table td:nth-child(10),
.production-start-stocker-table th:nth-child(11),
.production-start-stocker-table td:nth-child(11) {
    min-width: 90px;
}

.production-start-stocker-table th:nth-child(7),
.production-start-stocker-table td:nth-child(7),
.production-start-stocker-table th:nth-child(8),
.production-start-stocker-table td:nth-child(8) {
    min-width: 108px;
}

.production-start-stocker-table th:nth-child(2),
.production-start-stocker-table td:nth-child(2) {
    min-width: 64px;
}

.production-start-stocker-table th:nth-child(3),
.production-start-stocker-table td:nth-child(3) {
    min-width: 120px;
}

.production-start-stocker-table th:nth-child(12),
.production-start-stocker-table td:nth-child(12) {
    min-width: 90px;
}

.production-start-table-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.production-start-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 1200px) {
    .production-start-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }

    .production-start-panel--full {
        grid-column: 1 / -1;
    }

    .production-start-panel {
        margin-bottom: 0;
    }
}

@media (max-width: 1199.98px) {
    .production-start-panel--stocker {
        width: 100%;
    }
}
.history-shipment-table-scroll {
    /* 出荷履歴一覧は 2 行分だけ表示領域を広げ、スクロール開始を少し遅らせる。 */
    max-height: clamp(260px, calc(42vh + 60px), 480px);
}

/* RFID登録画面の読取状態パネルの余白を調整 */
.rfid-register-reader-panel {
    padding: 1.5rem 0.75rem;
}

.rfid-register-new-count {
    max-width: 420px;
}

/* 製品別棚卸一覧の検索条件グリッド */
.stocktaking-search-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.stocktaking-search-grid__item {
    min-width: 0;
}

.stocktaking-search-grid__item--half {
    min-width: 0;
}

.stocktaking-search-grid__actions {
    grid-column: 3 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    align-items: end;
}

.inventory-stocktaking-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.inventory-stocktaking-modal[hidden] {
    display: none !important;
}

.inventory-stocktaking-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
}

.inventory-stocktaking-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(470px, 100%);
    background: #fffafc;
    border: 1px solid rgba(91, 109, 163, 0.35);
    border-radius: 0;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18);
}

.inventory-stocktaking-modal__body {
    padding: 1.35rem 1.45rem 1.15rem;
}

.inventory-stocktaking-modal__message {
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 1rem;
}

.inventory-stocktaking-modal__section {
    margin-bottom: 1.15rem;
}

.inventory-stocktaking-modal__section-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.65rem;
}

.inventory-stocktaking-modal__warehouse-list {
    display: grid;
    gap: 0.7rem;
}

.inventory-stocktaking-modal__warehouse-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.96rem;
    font-weight: 500;
    color: #1f2937;
}

.inventory-stocktaking-modal__warehouse-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    accent-color: var(--md-sys-color-primary);
}

.inventory-stocktaking-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    padding-top: 0.1rem;
}

.inventory-stocktaking-modal__actions .btn {
    min-width: 86px;
    min-height: 34px;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: none;
}

.inventory-stocktaking-modal__actions .btn-primary {
    background-color: #3f68a8;
    border-color: #3f68a8;
    color: #ffffff;
}

.inventory-stocktaking-modal__actions .btn-primary:hover,
.inventory-stocktaking-modal__actions .btn-primary:focus {
    background-color: #345b96;
    border-color: #345b96;
    color: #ffffff;
}

.inventory-stocktaking-modal__actions .btn-outline-secondary {
    background-color: #d8e4f7;
    border-color: #d8e4f7;
    color: #1f2d4d;
}

.inventory-stocktaking-modal__actions .btn-outline-secondary:hover,
.inventory-stocktaking-modal__actions .btn-outline-secondary:focus {
    background-color: #c7d8f1;
    border-color: #c7d8f1;
    color: #1f2d4d;
}

.rfid-reissue-production-lot-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.rfid-reissue-production-lot-modal[hidden] {
    display: none !important;
}

.rfid-reissue-production-lot-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
}

.rfid-reissue-production-lot-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(360px, 100%);
    background: #ffffff;
    border: 1px solid #1f2937;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.22);
}

.rfid-reissue-production-lot-modal__body {
    padding: 1.1rem 1.35rem 1rem;
}

.rfid-reissue-production-lot-modal__message {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.rfid-reissue-production-lot-modal__notice {
    font-size: 0.92rem;
    font-weight: 700;
    color: #dc2626;
    margin-bottom: 0.9rem;
}

.rfid-reissue-production-lot-modal__field {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.45rem;
}

.rfid-reissue-production-lot-modal__field label {
    margin: 0;
    color: #1f2937;
    font-size: 0.9rem;
    font-weight: 600;
}

.rfid-reissue-production-lot-modal__field .form-control {
    border-radius: 0;
    min-height: 2.1rem;
    padding: 0.25rem 0.5rem;
}

.rfid-reissue-production-lot-modal__error {
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.rfid-reissue-production-lot-modal__actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
}

.rfid-reissue-production-lot-modal__actions .btn {
    min-width: 120px;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 700;
}

@media (max-width: 1400px) {
    .stocktaking-search-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .stocktaking-search-grid__actions {
        grid-column: 1 / -1;
        justify-self: stretch;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .stocktaking-search-grid {
        grid-template-columns: 1fr;
    }

    .inventory-stocktaking-modal__dialog {
        width: min(100%, 420px);
    }

    .stocktaking-search-grid__actions {
        grid-column: auto;
        flex-direction: column;
        justify-content: stretch;
    }

    .stocktaking-search-grid__actions .btn {
        width: 100%;
    }

    .inventory-stocktaking-modal__actions {
        flex-direction: column;
    }

    .inventory-stocktaking-modal__actions .btn {
        width: 100%;
    }
}

/* 投入確認画面: 投入済み行の視認性を統一する */
.production-instruction-table tbody tr.input-confirm-historical-row > td,
.production-instruction-table tbody tr.input-confirm-historical-row > th,
.production-instruction-table tbody tr.input-confirm-registered-row > td,
.production-instruction-table tbody tr.input-confirm-registered-row > th {
    background-color: #dfe3e8 !important;
}

.input-confirm-historical-label {
    color: #334155;
    font-weight: 700;
}
