/* Kho đơn hàng — layout + nút thống nhất (tvvn / thaytuvi / boidich) */

*, *::before, *::after { box-sizing: border-box; }

body.kho-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f3ff;
    margin: 0;
    color: #1f2937;
}

.kho-wrap { max-width: 860px; margin: 0 auto; padding: 16px; }

.kho-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 24px rgba(49, 46, 129, .08);
    padding: 20px;
    margin-bottom: 16px;
}

.kho-card h1 {
    font-size: 20px;
    color: #312e81;
    text-align: center;
    margin: 8px 0 16px;
}

.kho-muted { color: #6b7280; font-size: 13px; }

.kho-err {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
}

/* ── Form tra cứu ── */
.kho-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}

.kho-form input {
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    width: 100%;
    font-size: 14px;
    font-family: inherit;
}

.kho-form input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .12);
}

.kho-form--wide .kho-form-field--wide { grid-column: 1 / span 2; }

@media (max-width: 640px) {
    .kho-form { grid-template-columns: 1fr; }
    .kho-form--wide .kho-form-field--wide { grid-column: auto; }
}

/* ── Nút thống nhất (vuông, phẳng — giống index cũ) ── */
.kho-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 12px 10px;
    border: none;
    border-radius: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.5;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    white-space: normal;
    text-align: center;
    box-shadow: none;
    transition: opacity .15s ease;
}

.kho-btn:hover {
    opacity: .92;
    color: #fff;
}

.kho-btn--stack {
    flex-direction: row;
    gap: 4px;
}

.kho-btn__plus {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.kho-btn--violet { background-color: #1d4ed8; }
.kho-btn--green { background-color: #10b981; }
.kho-btn--tuvi { background-color: #ff0000; }
.kho-btn--duyen { background-color: #ec4899; }
.kho-btn--dich { background-color: #7c3aed; }
.kho-btn--dark { background-color: rgb(6, 6, 6); }
.kho-btn--orange { background-color: rgb(250, 89, 61); }

.kho-btn--fill {
    width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
}

.kho-form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin: 8px auto;
}

.kho-form-actions .kho-btn-grid {
    width: 100%;
}

.kho-btn-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

/* 2 hàng × 2 nút (index, index2) */
.kho-btn-grid.kho-btn-grid--quad {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-top: 0;
}

.kho-btn-grid.kho-btn-grid--quad .kho-btn--wide {
    grid-column: 1 / -1;
}

.kho-shortcuts {
    width: 100%;
    max-width: 400px;
    margin: 16px auto 0;
}

.kho-shortcuts .kho-btn-grid {
    width: 100%;
    margin-top: 0;
}

.kho-create-actions {
    margin-top: 16px;
}

.kho-btn-grid--create {
    gap: 5px;
}

.kho-btn-grid--create .kho-btn {
    min-height: 40px;
    padding: 10px 8px;
    font-size: 13px;
    line-height: 1.35;
}

.hub-footer-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #ede9fe;
    display: flex;
    justify-content: center;
}

.hub-footer-actions .kho-create-actions {
    margin-top: 0;
    width: 100%;
    max-width: 400px;
}

.hub-footer-actions .kho-btn-grid { margin-top: 0; }

/* Lập quẻ + Kho — một hàng gọn (dichindex) */
.action-row--dual {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    width: 100%;
}

.dich-tab-actions {
    margin-top: 14px;
}

.dich-tab-actions .kho-btn--submit-wide {
    width: 100%;
    min-height: 44px;
    padding: 12px 10px;
    font-size: 14px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
}

/* Lập quẻ + Kho — một hàng gọn (legacy) */
.action-row--dual .kho-btn {
    flex: 1 1 50%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 8px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
}

@media (max-width: 360px) {
    .action-row--dual {
        flex-direction: column;
    }

    .action-row--dual .kho-btn {
        width: 100%;
    }
}

.kho-cta-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 15px auto 0;
    max-width: 400px;
    width: 100%;
}

.inpt_submit.kho-cta-wrap,
.inpt_submit.kho-form-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Chỉ 2 nút CTA Luận giải 150k — cao gấp đôi, vuông, đỏ */
.kho-btn--cta {
    width: 100%;
    min-height: 88px;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    white-space: normal;
    line-height: 1.35;
    background-color: #ff0000;
    border-radius: 0;
}

@media (max-width: 420px) {
    .kho-btn { font-size: 13px; padding: 11px 8px; }
    .kho-btn--cta {
        min-height: 76px;
        font-size: 16px;
        padding: 12px 14px;
    }
}

/* Ghi đè style legacy .inpt_submit — nút thường vuông */
.inpt_submit.kho-form-actions .kho-btn.kho-btn--fill,
.inpt_submit.kho-form-actions a.kho-btn.kho-btn--fill {
    width: 100%;
    min-height: 44px;
    padding: 12px 10px;
    margin: 0;
    font-size: 14px;
    font-weight: normal;
    line-height: 1.5;
    color: #fff;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.inpt_submit.kho-cta-wrap .kho-btn.kho-btn--cta,
.kho-cta-wrap .kho-btn.kho-btn--cta {
    width: 100%;
    min-height: 88px;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    border: none;
    border-radius: 0;
    color: #fff;
    background-color: #ff0000;
    box-shadow: none;
}

.kho-btn-grid--plain { padding-top: 0; border-top: none; }

@media (max-width: 540px) {
    .kho-btn-grid:not(.kho-btn-grid--quad) { grid-template-columns: 1fr; }
    .kho-btn-grid.kho-btn-grid--quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kho-btn { width: 100%; }
}

/* ── Hub card ── */
.hub-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(109, 40, 217, .1);
    padding: 20px 16px 18px;
    margin-bottom: 16px;
    border: 1px solid rgba(139, 92, 246, .12);
}

.hub-hero { text-align: center; margin-bottom: 18px; }

.hub-hero-icon { font-size: 36px; line-height: 1; margin-bottom: 6px; }

.hub-title {
    font-size: 20px;
    font-weight: 800;
    color: #4c1d95;
    margin: 0 0 6px;
}

.hub-sub {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 10px;
    line-height: 1.5;
}

.hub-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    font-size: 12px;
    color: #5b21b6;
    font-weight: 600;
}

.hub-contact span {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    padding: 4px 10px;
    border-radius: 999px;
}

.hub-lookup {
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.hub-lookup label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #5b21b6;
    margin-bottom: 8px;
}

.hub-lookup-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.hub-lookup-row input {
    flex: 1;
    min-width: 0;
    padding: 12px;
    border: 1.5px solid #c4b5fd;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    font-family: inherit;
}

.hub-lookup-row input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15);
}

.hub-lookup-row .kho-btn { flex-shrink: 0; min-width: 72px; border-radius: 0; }

.hub-lookup-hint { font-size: 11px; color: #8b5cf6; margin: 8px 0 0; }

.hub-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
}

.hub-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 6px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    color: #6d28d9;
    background: #f5f3ff;
    border: 1.5px solid transparent;
    text-align: center;
    line-height: 1.25;
}

.hub-tab.active {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    border-color: #5b21b6;
    box-shadow: 0 4px 14px rgba(109, 40, 217, .25);
}

.hub-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(255, 255, 255, .25);
}

.hub-tab:not(.active) .hub-count { background: #ede9fe; color: #5b21b6; }

.hub-panel-hint { font-size: 12px; color: #6b7280; margin: 0 0 10px; }

.hub-list { display: flex; flex-direction: column; gap: 8px; }

.hub-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e5e7eb;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}

.hub-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
}

.hub-item-tuvi {
    background: linear-gradient(135deg, rgba(16, 185, 129, .07), rgba(5, 150, 105, .03));
    border-color: #bbf7d0;
}

.hub-item-duyen {
    background: linear-gradient(135deg, rgba(236, 72, 153, .07), rgba(219, 39, 119, .03));
    border-color: #fbcfe8;
}

.hub-item-dich {
    background: linear-gradient(135deg, rgba(109, 40, 217, .07), rgba(124, 58, 237, .03));
    border-color: #ddd6fe;
}

.hub-item-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hub-item-code {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .4px;
    color: #5b21b6;
}

.hub-item-tuvi .hub-item-code { color: #047857; }
.hub-item-duyen .hub-item-code { color: #db2777; }

.hub-item-label {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.35;
}

.hub-item-meta { font-size: 12px; color: #6b7280; }

.hub-item-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.hub-item-date { font-size: 11px; color: #9ca3af; white-space: nowrap; }

.hub-badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.hub-badge.ok { background: #d1fae5; color: #065f46; }
.hub-badge.wait { background: #fef9c3; color: #854d0e; }

.hub-empty {
    text-align: center;
    padding: 28px 16px;
    color: #6b7280;
    font-size: 14px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px dashed #d1d5db;
}

@media (max-width: 540px) {
    .hub-tabs { grid-template-columns: 1fr; }
    .hub-tab { padding: 12px; font-size: 13px; }
    .hub-lookup-row { flex-direction: column; }
    .hub-lookup-row .kho-btn { width: 100%; min-width: 0; }
}
