* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f2f4f8;
    color: #1f2937;
}

.container {
    max-width: 980px;
    margin: 24px auto;
    padding: 0 16px 40px;
}

h1 {
    margin-bottom: 8px;
}

.page-header.result-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.page-header.result-page-header h1 {
    margin: 0;
}

.result-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.hint {
    margin-top: 0;
    color: #4b5563;
}

.hint.limited-ok {
    margin-top: 12px;
    color: #166534;
    font-weight: 600;
}

.algo-overview-heading {
    margin: 20px 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
}

.algo-overview-intro {
    margin-bottom: 8px;
}

.algo-overview-list {
    margin: 0 0 4px;
    padding-left: 1.35rem;
    line-height: 1.65;
    color: #4b5563;
}

.algo-overview-list li {
    margin-bottom: 6px;
}

/* 勿覆寫 .form-switch 的 padding-left：Bootstrap 會用負 margin 對齊開關，padding 過小會整顆跑出格線左側 */
.type-limited-switch-cell {
    margin: 0;
    min-height: 1.5em;
}

.type-limited-switch-cell .form-check-label {
    margin-top: 0;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
    cursor: pointer;
}

.panel {
    background: #ffffff;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.panel.error {
    border-color: #f3b3b3;
    background: #fff5f5;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 600;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
}

.type-row {
    display: grid;
    grid-template-columns: minmax(9.5rem, auto) 2fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.actions.submit {
    justify-content: flex-end;
}

.btn {
    display: inline-block;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1f2937;
    border-radius: 8px;
    padding: 8px 14px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.btn:hover {
    background: #f8fafc;
}

.btn.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.btn.primary:hover {
    background: #1d4ed8;
}

.btn.danger {
    border-color: #ef4444;
    color: #ef4444;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.pack-pattern-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    margin-top: 12px;
}

.pack-pattern-table {
    width: 100%;
    min-width: max-content;
    margin-top: 0;
}

.pack-pattern-table th,
.pack-pattern-table td {
    white-space: nowrap;
    vertical-align: middle;
}

.pack-pattern-table th:first-child,
.pack-pattern-table td:first-child {
    text-align: center;
    font-weight: 700;
    color: #374151;
}

.pack-pattern-table th:last-child,
.pack-pattern-table td:last-child {
    font-weight: 600;
    color: #1e40af;
}

.pack-pattern-table tfoot td {
    border-top: 2px solid #cbd5e1;
    background: #f1f5f9;
    font-weight: 700;
    color: #0f172a;
}

.pack-pattern-table tfoot td:first-child {
    color: #0f172a;
}

.pack-pattern-viz-heading {
    margin: 28px 0 0;
    font-size: 1.05rem;
    color: #1f2937;
}

.pack-pattern-charts {
    display: grid;
    gap: 20px;
    margin-top: 8px;
}

@media (min-width: 960px) {
    .pack-pattern-charts {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.pack-pattern-charts .chart-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 14px 10px;
    background: #f8fafc;
}

.pack-pattern-charts .chart-card h4 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
}

.pack-pattern-charts .chart-canvas-wrap {
    position: relative;
    width: 100%;
    min-height: 200px;
    max-height: 520px;
}

.rule-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
}

.rule-status.ok {
    background: #ecfdf3;
    border: 1px solid #86efac;
    color: #166534;
}

.rule-status.warn {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.rule-status.pending {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
}

table {
    width: 100%;
    border-collapse: collapse;
    overflow-x: auto;
}

th,
td {
    border: 1px solid #dbe2ea;
    padding: 8px;
    text-align: center;
    font-size: 14px;
}

th {
    background: #f8fafc;
}

/* 每包分配結果：依每盒包數分組 */
.pack-by-box-table-panel {
    margin-top: 4px;
}

.pack-by-box-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 12px 0 10px;
}

body.page-result .pack-by-box-toolbar .btn {
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
}

table.pack-by-box {
    border-collapse: separate;
    border-spacing: 0;
}

table.pack-by-box tbody.pack-box-group.pack-box-odd .pack-row td {
    background: #f8fafc;
}

table.pack-by-box tbody.pack-box-group.pack-box-even .pack-row td {
    background: #f1f5f9;
}

table.pack-by-box tbody.pack-box-group .pack-box-header td {
    background: #e2e8f0;
    font-weight: 700;
    text-align: left;
    padding: 10px 12px;
    border-top: 2px solid #64748b;
}

table.pack-by-box tbody.pack-box-group:first-of-type .pack-box-header td {
    border-top: none;
}

table.pack-by-box tbody.pack-box-group .pack-box-columns th {
    background: #eef2f7;
    font-weight: 700;
}

table.pack-by-box .pack-box-note {
    font-weight: 600;
    color: #b45309;
}

table.pack-by-box tbody.pack-box-group .pack-box-header .pack-box-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

table.pack-by-box tbody.pack-box-group .pack-box-header .pack-box-toggle:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

table.pack-by-box tbody.pack-box-group.is-collapsed .pack-box-columns,
table.pack-by-box tbody.pack-box-group.is-collapsed .pack-row {
    display: none;
}

table.pack-by-box .pack-box-toggle-chevron {
    display: inline-block;
    flex-shrink: 0;
    width: 1em;
    line-height: 1;
    transition: transform 0.2s ease;
    color: #475569;
    font-size: 0.7em;
}

table.pack-by-box tbody.pack-box-group.is-collapsed .pack-box-toggle-chevron {
    transform: rotate(-90deg);
}

table.pack-by-box .pack-box-toggle-label {
    flex: 1;
    min-width: 0;
    text-align: left;
}

@media (max-width: 768px) {
    .type-row {
        grid-template-columns: 1fr;
    }


    .actions.submit {
        justify-content: flex-start;
    }
}

/* ——— 首頁（index）專用：不影響 result ——— */
body.page-index {
    font-family: "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
    background: linear-gradient(165deg, #eef2ff 0%, #f8fafc 38%, #ecfeff 100%);
    color: #1e293b;
    min-height: 100vh;
}

body.page-index .index-main.container {
    max-width: 720px;
    margin-top: 32px;
    margin-bottom: 48px;
}

body.page-index .index-home-nav {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

body.page-index .index-home-nav-link {
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

body.page-index .index-home-nav-link:hover {
    text-decoration: none;
}

body.page-index .index-hero {
    text-align: center;
    margin-bottom: 28px;
    padding: 28px 20px 32px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(241, 245, 249, 0.95) 100%);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(79, 70, 229, 0.08);
}

body.page-index .index-hero-eyebrow {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6366f1;
}

body.page-index .index-hero-title {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
}

body.page-index .index-hero-trial {
    margin: 0 auto 14px;
    max-width: 36rem;
    padding: 8px 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #92400e;
    background: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 10px;
}

body.page-index .index-hero-trial strong {
    font-weight: 700;
    color: #78350f;
}

body.page-index .index-hero-lead {
    margin: 0 auto;
    max-width: 36rem;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #475569;
}

body.page-index .index-hero-lead strong {
    color: #334155;
    font-weight: 600;
}

body.page-index .index-panel {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 16px;
    padding: 20px 20px 22px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

body.page-index .index-panel.panel.error,
body.page-index .panel-error-flash {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fff1f2 0%, #fff 100%);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.08);
}

body.page-index .index-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

body.page-index .index-step {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

body.page-index .index-panel-head-text {
    min-width: 0;
}

body.page-index .index-panel-title {
    margin: 0 0 4px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-index .index-panel-title-error {
    margin-bottom: 10px;
    padding-bottom: 0;
    border: 0;
    color: #b91c1c;
}

body.page-index .index-panel-desc {
    margin: 0;
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

body.page-index .index-hint {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 14px;
}

body.page-index .index-import-toolbar {
    margin-bottom: 4px;
}

body.page-index .index-import-toolbar .index-import-file-field {
    min-width: 200px;
}

body.page-index .index-import-done-modal {
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

body.page-index .index-import-done-modal .modal-header {
    border-bottom-color: #e2e8f0;
}

body.page-index .index-import-done-modal .modal-footer {
    border-top-color: #e2e8f0;
}

body.page-index .index-import-done-dl dt {
    font-weight: 600;
    color: #475569;
}

body.page-index .index-import-done-dl dd {
    color: #0f172a;
}

body.page-index .index-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 560px) {
    body.page-index .index-field-grid {
        grid-template-columns: 1fr;
    }
}

body.page-index .index-field label {
    margin-top: 0;
    font-size: 0.8125rem;
    color: #475569;
}

body.page-index .index-field input[type="number"],
body.page-index .index-field input[type="text"] {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.page-index .index-field input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

body.page-index .index-type-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.page-index .index-type-row.type-row {
    margin-bottom: 0;
    padding: 14px 14px 14px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    align-items: center;
    /* 第一欄依開關+「限量」實際寬度，勿用 minmax(9.5rem,auto) 拉寬，否則與類型名稱輸入框距離過遠 */
    grid-template-columns: max-content minmax(0, 2fr) minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 10px;
}

/* 配盒模組（無限量開關）：包法名稱、總包數、刪除 */
body.page-index.page-box-pack .index-type-row.type-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
}

body.page-index .index-step-muted {
    opacity: 0.45;
    font-weight: 600;
}

body.page-index .index-pack-method-summary-panel .index-pack-method-summary-table-wrap {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

body.page-index .index-pack-method-summary-panel .index-pack-method-summary-table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

body.page-index .index-pack-method-summary-panel .index-pack-method-composition {
    white-space: nowrap;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #334155;
}

body.page-index .index-pack-method-summary-panel .index-pack-method-composition-col {
    white-space: normal;
    font-size: 0.8125rem;
    max-width: 10rem;
    color: #334155;
}

/* Grid 內避免 float + 負 margin 視覺溢出：改為橫向 flex，與 Bootstrap 5 form-switch 相容 */
body.page-index .index-type-row .type-limited-switch-cell.form-check.form-switch {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    padding-left: 0;
    margin-bottom: 0;
}

body.page-index .index-type-row .type-limited-switch-cell .form-check-input {
    float: none;
    margin-left: 0;
    margin-top: 0;
    position: relative;
    flex-shrink: 0;
    accent-color: #dc2626;
}

/* 限量開啟：紅色軌道（Bootstrap switch 用 --bs-form-switch-bg 畫圓鈕，勿用 --bs-form-check-bg-image） */
body.page-index .index-type-row .type-limited-switch-cell .form-check-input:checked {
    background-color: #dc2626;
    border-color: #b91c1c;
    background-position: right center;
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

body.page-index .index-type-row .type-limited-switch-cell .form-check-input:focus {
    border-color: #f87171;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.35);
    /* 覆寫 BS 預設藍色圓鈕，改淡灰／淡紅，避免未開時看起來像已選 */
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28220, 38, 38, 0.35%29'/%3e%3c/svg%3e");
}

body.page-index .index-type-row .type-limited-switch-cell .form-check-input:checked:focus {
    border-color: #991b1b;
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.45);
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

body.page-index .index-type-row .type-limited-switch-cell .form-check-label {
    display: inline-block;
    margin-top: 0;
    padding-top: 0;
    line-height: 1.3;
}

body.page-index .index-type-row .type-limited-switch-cell .form-check-input:checked ~ .form-check-label {
    color: #b91c1c;
    font-weight: 700;
}

body.page-index .index-type-row input[type="text"],
body.page-index .index-type-row input[type="number"] {
    background: #f8fafc;
}

/* 勿用 input:focus：會套到限量 switch 的 checkbox，background 簡寫會清掉 BS 的 background-image（白球） */
body.page-index .index-type-row input[type="text"]:focus,
body.page-index .index-type-row input[type="number"]:focus {
    outline: none;
    border-color: #a5b4fc;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* 手機：覆寫桌面四欄 grid（否則仍為 max-content+2fr+1fr，輸入框會過窄） */
@media (max-width: 768px) {
    body.page-index .index-type-row.type-row {
        grid-template-columns: 1fr;
        column-gap: 0;
        row-gap: 12px;
        align-items: stretch;
        padding: 14px 12px;
    }

    body.page-index.page-box-pack .index-type-row.type-row {
        grid-template-columns: 1fr;
    }

    body.page-index .index-type-row input[type="text"],
    body.page-index .index-type-row input[type="number"] {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        padding: 12px 14px;
    }

    body.page-index .index-type-row .btn.danger.remove-row {
        width: 100%;
        min-height: 46px;
        justify-self: stretch;
    }

    body.page-index .index-field input[type="number"],
    body.page-index .index-field input[type="text"] {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 14px;
    }
}

body.page-index .index-actions-add {
    margin-top: 8px;
}

body.page-index .btn-index-outline {
    border: 1px dashed #94a3b8;
    background: rgba(248, 250, 252, 0.9);
    color: #475569;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 18px;
}

body.page-index .btn-index-outline:hover {
    border-color: #6366f1;
    color: #4f46e5;
    background: #eef2ff;
}

body.page-index .index-summary-grid.summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 640px) {
    body.page-index .index-summary-grid.summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

body.page-index .index-stat {
    padding: 12px 12px 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid #e2e8f0;
    text-align: center;
}

body.page-index .index-stat-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
}

body.page-index .index-stat-value {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #312e81;
    line-height: 1.2;
}

body.page-index .index-rule-status.rule-status {
    margin-top: 16px;
    border-radius: 12px;
    padding: 12px 14px;
}

body.page-index .index-submit-bar.actions.submit {
    margin-top: 8px;
    padding-top: 8px;
}

body.page-index .btn-index-submit.btn.primary {
    min-width: 200px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    background: linear-gradient(145deg, #4f46e5, #4338ca);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
}

body.page-index .btn-index-submit.btn.primary:hover {
    background: linear-gradient(145deg, #4338ca, #3730a3);
    filter: brightness(1.02);
}

body.page-index .btn-index-submit.btn.primary:disabled {
    opacity: 0.88;
    cursor: wait;
    filter: none;
}

body.page-index .index-submit-loading {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.page-index .index-submit-loading.is-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

body.page-index .index-submit-loading-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

body.page-index .index-submit-loading-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 20rem;
    padding: 28px 32px;
    text-align: center;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.06),
        0 20px 50px rgba(79, 70, 229, 0.15);
}

body.page-index .index-submit-loading-spinner {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 3px solid #e2e8f0;
    border-top-color: #4f46e5;
    animation: index-submit-spin 0.75s linear infinite;
}

@keyframes index-submit-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    body.page-index .index-submit-loading-spinner {
        animation: none;
        border-color: #e2e8f0;
        border-top-color: #4f46e5;
        border-right-color: #6366f1;
    }
}

body.page-index .index-submit-loading-text {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-index .index-submit-loading-sub {
    margin: 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
}

body.page-index .index-type-row .btn.danger {
    border-radius: 10px;
    font-weight: 600;
    padding: 8px 12px;
}

body.page-index .index-error-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #7f1d1d;
    line-height: 1.6;
}

body.page-index .form-check-input:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

body.page-index .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* ——— 分配結果頁（result）專用 ——— */
body.page-result {
    font-family: "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
    background: linear-gradient(165deg, #ecfdf5 0%, #f8fafc 42%, #eef2ff 100%);
    color: #1e293b;
    min-height: 100vh;
}

body.page-result .result-main.container {
    max-width: 960px;
    margin-top: 28px;
    margin-bottom: 48px;
    padding-left: 18px;
    padding-right: 18px;
}

body.page-result .result-hero {
    margin-bottom: 24px;
    padding: 24px 22px 26px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(236, 253, 245, 0.9) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.05),
        0 14px 40px rgba(16, 185, 129, 0.1);
}

body.page-result .result-hero-top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

body.page-result .result-hero-text {
    flex: 1 1 280px;
    min-width: 0;
}

body.page-result .result-hero-eyebrow {
    margin: 0 0 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #059669;
}

body.page-result .result-hero-title {
    margin: 0 0 10px;
    font-size: clamp(1.65rem, 3.5vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
}

body.page-result .result-hero-lead {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #64748b;
    max-width: 36rem;
}

body.page-result .result-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* .btn 設了 display 會蓋掉 [hidden] 的預設隱藏，需明確關閉版面 */
body.page-result .result-header-actions button[hidden] {
    display: none !important;
}

body.page-result .btn-result-primary.btn.primary {
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 600;
    border: none;
    background: linear-gradient(145deg, #059669, #047857);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.35);
}

body.page-result .btn-result-primary.btn.primary:hover {
    filter: brightness(1.05);
}

body.page-result .btn-result-secondary.btn {
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
}

body.page-result .btn-result-secondary.btn:hover {
    border-color: #059669;
    color: #047857;
    background: #ecfdf5;
}

body.page-result .result-panel.panel {
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    padding: 20px 20px 22px;
    margin-bottom: 20px;
}

body.page-result .result-panel-last {
    margin-bottom: 0;
}

body.page-result .result-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin: 12px 0 14px;
    font-size: 0.875rem;
    color: #475569;
}

body.page-result .result-pagination-meta {
    margin-right: 4px;
}

body.page-result .result-pagination-after-table {
    margin-top: 14px;
    margin-bottom: 0;
}

body.page-result .result-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

body.page-result .result-panel-head.result-panel-head--pack-pattern {
    align-items: center;
}

body.page-result .result-panel-head-export-near-title {
    margin: 0;
    flex-shrink: 0;
}

body.page-result .result-panel-head-tail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

body.page-result .result-step {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

body.page-result .result-panel-title {
    margin: 0 0 4px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-panel-desc {
    margin: 0;
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

body.page-result .result-summary-grid.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

body.page-result .result-stat {
    padding: 12px 12px 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid #e2e8f0;
    text-align: center;
}

body.page-result .result-stat-wide {
    grid-column: 1 / -1;
    text-align: left;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
}

body.page-result .result-stat-label {
    display: block;
    width: 100%;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
}

body.page-result .result-stat-wide .result-stat-label {
    width: auto;
    margin-bottom: 0;
}

body.page-result .result-stat-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f766e;
    line-height: 1.2;
}

body.page-result .result-stat-value-sm {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    word-break: break-all;
}

body.page-result .result-limited-banner.hint.limited-ok {
    margin-top: 4px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #86efac;
}

body.page-result .result-algo-box {
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

body.page-result .result-algo-title.algo-overview-heading {
    margin-top: 0;
}

body.page-result .result-avg-per-type-box {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

body.page-result .result-avg-per-type-title {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-avg-per-type-box .result-table-scroll {
    margin-top: 10px;
}

body.page-result .result-avg-per-type-table th {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
}

body.page-result .result-avg-per-type-table td:first-child {
    font-weight: 600;
    text-align: left;
    padding-left: 12px;
}

body.page-result .result-avg-per-type-table th:first-child {
    text-align: left;
    padding-left: 12px;
}

body.page-result .result-hint.hint {
    font-size: 0.875rem;
    line-height: 1.6;
}

body.page-result .result-pattern-count {
    margin: 12px 0 16px;
    font-size: 1.05rem;
    color: #0f172a;
}

body.page-result .result-pattern-sub {
    font-weight: 500;
    font-size: 0.9rem;
    color: #64748b;
    margin-left: 6px;
}

body.page-result .pack-pattern-table-wrap {
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

body.page-result .pack-pattern-table th {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    font-weight: 700;
    color: #334155;
}

body.page-result .pack-pattern-table tfoot td {
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
}

body.page-result .result-pack-pattern-breakdown-heading {
    margin: 18px 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-pack-pattern-breakdown-wrap {
    margin-bottom: 16px;
}

body.page-result .pack-pattern-viz-heading {
    margin-top: 24px;
}

body.page-result .result-chart-grid.pack-pattern-charts {
    margin-top: 12px;
}

body.page-result .result-chart-card.chart-card {
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
}

body.page-result .result-chart-card.chart-card h4 {
    font-size: 0.95rem;
    color: #0f172a;
}

body.page-result .result-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

body.page-result .result-table-scroll table {
    margin: 0;
}

body.page-result .result-table-pack.pack-by-box tbody.pack-box-group:first-of-type .pack-box-header td {
    border-top: none;
}

body.page-result .result-per-box-export-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 8px 0 12px;
    flex: 1;
    justify-content: space-between;
    min-width: 0;
}

body.page-result .result-per-box-export-form {
    margin: 0;
}

body.page-result .result-box-pattern-heading {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-box-detail-heading {
    margin: 24px 0 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-table-box thead th {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #334155;
    font-weight: 700;
}

body.page-result .rule-status {
    border-radius: 12px;
}

@media (max-width: 640px) {
    body.page-result .result-hero-top {
        flex-direction: column;
    }

    body.page-result .result-header-actions {
        width: 100%;
    }

    body.page-result .result-header-actions .btn {
        flex: 1 1 auto;
        text-align: center;
        justify-content: center;
    }
}

/* 結果頁：Excel 匯出 loading 覆蓋層 */
body.page-result.result-export-overlay-open {
    overflow: hidden;
}

body.page-result .result-export-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

body.page-result .result-export-overlay[hidden] {
    display: none;
}

body.page-result .result-export-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

body.page-result .result-export-overlay-panel {
    position: relative;
    z-index: 1;
    max-width: 360px;
    width: 100%;
    padding: 28px 24px 24px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
    text-align: center;
}

body.page-result .result-export-overlay-title {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-export-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 18px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: result-export-spin 0.75s linear infinite;
}

@keyframes result-export-spin {
    to {
        transform: rotate(360deg);
    }
}

body.page-result .result-export-progress {
    margin-bottom: 14px;
}

body.page-result .result-export-progress-track {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

body.page-result .result-export-progress-indeterminate {
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6);
    background-size: 200% 100%;
    animation: result-export-indeterminate 1.1s ease-in-out infinite;
}

@keyframes result-export-indeterminate {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

body.page-result .result-export-overlay-hint {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #64748b;
}

body.page-result.result-sheet-modal-open {
    overflow: hidden;
}

body.page-result .result-box-packing-submit {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

body.page-result .result-sheet-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

body.page-result .result-sheet-modal[hidden] {
    display: none;
}

body.page-result .result-sheet-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
}

body.page-result .result-sheet-modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 24px 22px 22px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

body.page-result .result-sheet-modal-title {
    margin: 0 0 10px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-result .result-sheet-modal-desc {
    margin: 0 0 18px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #64748b;
}

body.page-result .result-sheet-modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

body.page-result .result-sheet-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
}

body.page-result .result-sheet-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

/* ——— 系統首頁（模組選擇）——— */
body.page-home {
    font-family: "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
    background: linear-gradient(165deg, #eef2ff 0%, #f8fafc 38%, #ecfeff 100%);
    color: #1e293b;
    min-height: 100vh;
}

body.page-home .home-main.container {
    max-width: 920px;
    margin-top: 32px;
    margin-bottom: 48px;
}

body.page-home .home-hero {
    text-align: center;
    margin-bottom: 32px;
    padding: 28px 20px 32px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(241, 245, 249, 0.95) 100%);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(79, 70, 229, 0.08);
}

body.page-home .home-hero-eyebrow {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6366f1;
}

body.page-home .home-hero-title {
    margin: 0 0 12px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
}

body.page-home .home-hero-trial {
    margin: 0 auto 14px;
    max-width: 36rem;
    padding: 8px 14px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #92400e;
    background: rgba(251, 191, 36, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 10px;
}

body.page-home .home-hero-trial strong {
    font-weight: 700;
    color: #78350f;
}

body.page-home .home-hero-lead {
    margin: 0 auto;
    max-width: 40rem;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #475569;
}

body.page-home .home-hero-lead strong {
    color: #334155;
    font-weight: 600;
}

body.page-home .home-modules-head {
    margin: 0 0 14px;
}

body.page-home .home-modules-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-home .home-modules-subtitle {
    margin: 6px 0 0;
    font-size: 0.9rem;
    color: #64748b;
}

body.page-home .home-module-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 220px;
    padding: 24px 22px 22px;
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

body.page-home .home-module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.1);
    border-color: rgba(99, 102, 241, 0.45);
    color: inherit;
}

body.page-home .home-module-card:focus-visible {
    outline: 3px solid rgba(99, 102, 241, 0.45);
    outline-offset: 3px;
}

body.page-home .home-module-card--mix {
    border-left: 4px solid #0d9488;
}

body.page-home .home-module-card--mix:hover {
    border-left-color: #0f766e;
}

body.page-home .home-module-card--pack {
    border-left: 4px solid #4f46e5;
}

body.page-home .home-module-card--pack:hover {
    border-left-color: #4338ca;
}

body.page-home .home-module-card--box {
    border-left: 4px solid #d97706;
}

body.page-home .home-module-card--box:hover {
    border-left-color: #b45309;
}

/* 配箱模組（白底；與配盒區分：左框與徽章為冷色） */
body.page-home .home-module-card--case {
    background: #fff;
    border-left: 4px solid #0284c7;
}

body.page-home .home-module-card--case:hover {
    border-left-color: #0369a1;
}

/* 配包箱模組（首頁 E 卡片） */
body.page-home .home-module-card--case-pack {
    background: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
    border-left: 4px solid #7c3aed;
}

body.page-home .home-module-card--case-pack:hover {
    border-left-color: #6d28d9;
}

/* 配包箱模組 */
body.page-home .home-module-card--pp {
    background: linear-gradient(180deg, #ffffff 0%, #ffffff 100%);
    border-left: 4px solid #a21caf;
}

body.page-home .home-module-card--pp:hover {
    border-left-color: #86198f;
}

/* 配包模組（A1） */
body.page-home .home-module-card--a1 {
    background: linear-gradient(180deg, #ffffff 0%, #f5fbff 100%);
    border-left: 4px solid #0369a1;
}

body.page-home .home-module-card--a1:hover {
    border-left-color: #075985;
}

body.page-home .home-module-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

body.page-home .home-module-card--mix .home-module-badge {
    background: linear-gradient(135deg, #0d9488, #14b8a6);
}

body.page-home .home-module-card--box .home-module-badge {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

body.page-home .home-module-card--case .home-module-badge {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
}

body.page-home .home-module-card--case-pack .home-module-badge {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

body.page-home .home-module-card--pp .home-module-badge {
    background: linear-gradient(135deg, #a21caf, #c026d3);
}

body.page-home .home-module-card--a1 .home-module-badge {
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

body.page-home .home-module-title {
    margin: 0 0 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

body.page-home .home-module-desc {
    flex: 1;
    margin: 0 0 18px;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: #475569;
}

body.page-home .home-module-desc strong {
    color: #334155;
    font-weight: 600;
}

body.page-home .home-module-cta {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #4f46e5;
    transition: gap 0.2s ease;
}

body.page-home .home-module-card:hover .home-module-cta {
    gap: 10px;
}

body.page-home .home-module-card--mix .home-module-cta {
    color: #0f766e;
}

body.page-home .home-module-card--box .home-module-cta {
    color: #b45309;
}

body.page-home .home-module-card--case .home-module-cta {
    color: #0369a1;
}

body.page-home .home-module-card--case-pack .home-module-cta {
    color: #6d28d9;
}

body.page-home .home-module-card--pp .home-module-cta {
    color: #86198f;
}

body.page-home .home-module-card--a1 .home-module-cta {
    color: #075985;
}

body.page-home .home-footnote {
    margin: 28px 0 0;
    text-align: center;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #64748b;
}

/* ——— 混卡模組（card_mix/main.php）——— */
body.page-index.page-mix .index-main.container {
    max-width: 880px;
}

body.page-index.page-mix .mix-hero-eyebrow {
    color: #0d9488;
}

body.page-index.page-mix .mix-intro-panel .index-panel-title {
    font-size: 1.05rem;
}

body.page-index.page-mix .mix-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

body.page-index.page-mix .mix-collapse-toggler {
    flex-shrink: 0;
    padding: 6px 10px;
    line-height: 1;
    min-width: 2.5rem;
}

body.page-index.page-mix .mix-collapse-icon {
    display: inline-block;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

body.page-index.page-mix .mix-group-title-wrap {
    flex: 1 1 200px;
    min-width: 0;
}

body.page-index.page-mix .mix-group-title-input {
    font-weight: 600;
    color: #0f172a;
}

body.page-index.page-mix .mix-group-summary {
    flex: 1 1 auto;
    white-space: nowrap;
}

body.page-index.page-mix .mix-group-summary strong {
    color: #0f766e;
    font-weight: 700;
}

body.page-index.page-mix .mix-group-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    flex: 1 1 100%;
}

@media (min-width: 768px) {
    body.page-index.page-mix .mix-group-toolbar {
        flex: 0 0 auto;
        justify-content: flex-end;
    }
}

body.page-index.page-mix .mix-group-body--collapsed {
    display: none;
}

body.page-index.page-mix .mix-type-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.page-index.page-mix .mix-type-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(100px, 7rem) minmax(5.5rem, 7rem) minmax(4.5rem, 6rem) auto;
    gap: 10px 12px;
    align-items: center;
    margin-bottom: 0;
    padding: 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

body.page-index.page-mix .mix-type-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

body.page-index.page-mix .mix-type-label-static {
    display: block;
    margin-bottom: 4px;
}

body.page-index.page-mix .mix-type-cell-baseline {
    text-align: center;
    justify-self: center;
}

body.page-index.page-mix .mix-baseline-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding-left: 0;
}

body.page-index.page-mix .mix-baseline-switch .form-check-input {
    margin-left: 0;
    float: none;
    cursor: pointer;
}

body.page-index.page-mix .mix-type-cell-pct {
    text-align: right;
}

body.page-index.page-mix .mix-pct-value {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #0f766e;
    display: inline-block;
    min-width: 3.25rem;
}

body.page-index.page-mix .mix-type-row input[type="text"],
body.page-index.page-mix .mix-type-row input[type="number"] {
    width: 100%;
    background: #f8fafc;
}

body.page-index.page-mix .mix-type-row input[type="text"]:focus,
body.page-index.page-mix .mix-type-row input[type="number"]:focus {
    outline: none;
    border-color: #2dd4bf;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

body.page-index.page-mix .mix-type-row .mix-input-baseline:focus {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

body.page-index.page-mix .mix-type-cell-actions {
    display: flex;
    justify-content: flex-end;
}

body.page-index.page-mix .mix-type-cell-actions .btn.danger {
    white-space: nowrap;
}

@media (max-width: 768px) {
    body.page-index.page-mix .mix-type-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    body.page-index.page-mix .mix-type-cell-pct {
        text-align: left;
    }

    body.page-index.page-mix .mix-type-cell-actions .btn.danger {
        width: 100%;
    }
}

body.page-index.page-mix .mix-empty-state {
    text-align: center;
    padding: 28px 20px;
}

body.page-index.page-mix .mix-submit-panel .btn.primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* 結果頁：每包分配結果 AJAX 分頁 */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.page-result #resultPackTableAjaxMount.result-pack-table-ajax-loading {
    opacity: 0.65;
    pointer-events: none;
}
