* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Yu Gothic", "Meiryo", sans-serif;
    background: #f4f6f8;
    color: #222;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 380px;
    padding: 32px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.login-card h1 {
    margin: 0;
    text-align: center;
    font-size: 28px;
}

.login-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #1f6feb;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1958ba;
}

.error-box {
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 8px;
    background: #ffe5e5;
    color: #b00020;
    border: 1px solid #ffb3b3;
}

.header {
    height: 64px;
    padding: 0 24px;
    background: #1f2937;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.system-title {
    font-size: 20px;
    font-weight: bold;
}

.login-info {
    font-size: 13px;
    color: #d1d5db;
}

.logout-link {
    color: #fff;
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 8px;
}

.container {
    padding: 24px;
}

.menu-section {
    margin-bottom: 28px;
    background: #fff;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.menu-section h2 {
    margin-top: 0;
    font-size: 18px;
    border-left: 5px solid #1f6feb;
    padding-left: 10px;
}

.menu-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.menu-button {
    display: inline-block;
    min-width: 180px;
    padding: 14px 18px;
    background: #eef4ff;
    color: #174ea6;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
}

.menu-button:hover {
    background: #dbeafe;
}

.search-box {
    margin-bottom: 20px;
    background: #fff;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 14px;
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
}

.search-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

.btn-primary.small {
    width: auto;
    min-width: 100px;
    padding: 10px 18px;
}

.btn-secondary {
    display: inline-block;
    padding: 10px 18px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.list-section {
    background: #fff;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.list-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: bold;
}

.note {
    color: #666;
    font-size: 13px;
    font-weight: normal;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

.data-table th {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 8px 10px;
    text-align: left;
}

.data-table td {
    border: 1px solid #e5e7eb;
    padding: 8px 10px;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.empty-cell {
    text-align: center;
    color: #777;
    padding: 24px !important;
}

.code-text {
    color: #777;
    font-size: 12px;
    margin-left: 4px;
}

.mode-badge {
    display: inline-block;
    min-width: 64px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    text-align: center;
    font-weight: bold;
    background: #e5e7eb;
    color: #374151;
}

.mode-1 {
    background: #dcfce7;
    color: #166534;
}

.mode-2 {
    background: #dbeafe;
    color: #1d4ed8;
}

.mode-3 {
    background: #fee2e2;
    color: #991b1b;
}

.print-title {
    display: none;
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 10pt;
    }

    .no-print {
        display: none !important;
    }

    .container {
        padding: 0 !important;
    }

    .print-title {
        display: block;
        margin-bottom: 10px;
    }

    .print-title h2 {
        margin: 0 0 4px 0;
        font-size: 16pt;
    }

    .list-section {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .list-header {
        margin-bottom: 6px;
        font-size: 10pt;
    }

    .table-wrap {
        overflow: visible !important;
    }

    .data-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8.5pt;
        white-space: normal;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #000 !important;
        padding: 3px 4px !important;
        color: #000 !important;
        background: #fff !important;
    }

    .data-table th {
        font-weight: bold;
        text-align: center;
    }

    .mode-badge {
        border: none !important;
        background: transparent !important;
        color: #000 !important;
        padding: 0 !important;
        min-width: auto !important;
        font-size: 8.5pt !important;
    }

    .code-text {
        color: #000 !important;
        font-size: 7.5pt !important;
    }

    a {
        color: #000 !important;
        text-decoration: none !important;
    }
}

.detail-section {
    background: #fff;
    padding: 18px;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 20px;
}

.detail-section h2 {
    margin-top: 0;
    font-size: 18px;
    border-left: 5px solid #1f6feb;
    padding-left: 10px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.detail-main-code {
    font-size: 24px;
    font-weight: bold;
    margin-right: 10px;
}

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

.detail-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}


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

.detail-label {
    background: #f3f4f6;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: bold;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.detail-value {
    padding: 12px 10px;
    min-height: 42px;
    font-size: 15px;
}

.remark-box {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    padding: 12px;
    min-height: 80px;
}

@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-wide {
        grid-column: span 1;
    }

    .detail-header {
        display: block;
    }
}

@media print {
    .detail-section {
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin-bottom: 8mm !important;
    }

    .detail-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4mm;
    }

    .detail-item {
        border: 1px solid #000 !important;
        border-radius: 0 !important;
    }

    .detail-label {
        background: #fff !important;
        color: #000 !important;
        border-bottom: 1px solid #000 !important;
    }

    .detail-value {
        color: #000 !important;
    }

    .remark-box {
        border: 1px solid #000 !important;
        border-radius: 0 !important;
    }
}

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

.num-cell {
    text-align: right !important;
}

.data-table tfoot th {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 8px 10px;
}

@media (max-width: 1200px) {
    .daily-summary-search-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .daily-summary-search-grid {
        grid-template-columns: 1fr;
    }
}

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

.diff-plus {
    color: #1d4ed8;
    font-weight: bold;
}

.diff-minus {
    color: #b91c1c;
    font-weight: bold;
}

@media (max-width: 1200px) {
    .tokui-summary-search-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .tokui-summary-search-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .diff-plus,
    .diff-minus {
        color: #000 !important;
        font-weight: bold !important;
    }
}

.graph-section {
    margin-bottom: 20px;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.bar-label {
    font-weight: bold;
    font-size: 14px;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-line {
    display: grid;
    grid-template-columns: 42px 1fr 70px;
    gap: 8px;
    align-items: center;
}

.bar-name {
    font-size: 12px;
    font-weight: bold;
    color: #374151;
}

.bar-track {
    height: 16px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
}

.bar-shukka {
    background: #3b82f6;
}

.bar-nyuka {
    background: #22c55e;
}

.bar-value {
    text-align: right;
    font-size: 12px;
    font-weight: bold;
}

@media (max-width: 900px) {
    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-label {
        white-space: normal;
    }
}

@media print {
    .graph-section {
        display: none !important;
    }
}

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

.diff-plus {
    color: #1d4ed8;
    font-weight: bold;
}

.diff-minus {
    color: #b91c1c;
    font-weight: bold;
}

.graph-section {
    margin-bottom: 20px;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.bar-label {
    font-weight: bold;
    font-size: 14px;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-line {
    display: grid;
    grid-template-columns: 42px 1fr 70px;
    gap: 8px;
    align-items: center;
}

.bar-name {
    font-size: 12px;
    font-weight: bold;
    color: #374151;
}

.bar-track {
    height: 16px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
}

.bar-shukka {
    background: #3b82f6;
}

.bar-nyuka {
    background: #22c55e;
}

.bar-value {
    text-align: right;
    font-size: 12px;
    font-weight: bold;
}

@media (max-width: 1200px) {
    .tokui-summary-search-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .bar-row {
        grid-template-columns: 1fr;
    }

    .bar-label {
        white-space: normal;
    }
}

@media (max-width: 760px) {
    .tokui-summary-search-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .graph-section {
        display: none !important;
    }

    .diff-plus,
    .diff-minus {
        color: #000 !important;
        font-weight: bold !important;
    }
}

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

.error-row {
    background: #fff1f2 !important;
}

.err-badge,
.ok-badge {
    display: inline-block;
    min-width: 52px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    text-align: center;
    font-weight: bold;
}

.err-badge {
    background: #fee2e2;
    color: #991b1b;
}

.ok-badge {
    background: #dcfce7;
    color: #166534;
}

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

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

@media print {
    .error-row {
        background: #fff !important;
    }

    .err-badge,
    .ok-badge {
        background: transparent !important;
        color: #000 !important;
        border: none !important;
        padding: 0 !important;
    }
}

.tokui-stock-detail-search-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
}

.num-cell a {
    font-weight: bold;
    color: #1d4ed8;
    text-decoration: none;
}

.num-cell a:hover {
    text-decoration: underline;
}

@media (max-width: 1200px) {
    .tokui-stock-detail-search-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .tokui-stock-detail-search-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    .num-cell a {
        color: #000 !important;
        text-decoration: none !important;
    }
}

.detail-value select,
.detail-value input,
.data-table select,
.data-table input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

/* CURRENT_MODE = 0 未出荷 */
.current-mode-0 {
    background: #fef3c7;
    color: #92400e;
}

/* CURRENT_MODE = 1 得意先 */
.current-mode-1 {
    background: #dbeafe;
    color: #1d4ed8;
}

/* CURRENT_MODE = 2 預かり中 */
.current-mode-2 {
    background: #dcfce7;
    color: #166534;
}

/* CURRENT_MODE = 3 停止中 */
.current-mode-3 {
    background: #fee2e2;
    color: #991b1b;
}

.tokui-stock-detail-search-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
}

@media (max-width: 1200px) {
    .tokui-stock-detail-search-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .tokui-stock-detail-search-grid {
        grid-template-columns: 1fr;
    }
}

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

.master-menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.master-menu-card {
    background: #f8fbff;
    border: 1px solid #d6e4f0;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.master-menu-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 16px;
}

.master-menu-card p {
    margin-top: 0;
    margin-bottom: 16px;
    color: #4d5d6c;
    font-size: 13px;
}

.required-mark {
    color: #dc2626;
    font-size: 12px;
    font-weight: bold;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
}

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

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