:root {
    --bhxh-primary: #2563eb;
    --bhxh-primary-hover: #1d4ed8;
    --bhxh-success: #12970a;
    --bhxh-danger: #ef4444;
    --bhxh-bg: #ffffff;
    --bhxh-gray-50: #f8fafc;
    --bhxh-gray-100: #f1f5f9;
    --bhxh-gray-200: #e2e8f0;
    --bhxh-gray-300: #cbd5e1;
    --bhxh-text-main: #0f172a;
    --bhxh-text-muted: #64748b;
    --bhxh-radius: 8px;
}

.bhxh-calc-container, .bhxh-calc-container * {
    box-sizing: border-box;
}

.bhxh-calc-container {
    width: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--bhxh-text-main);
}

/* Remove outer card to avoid double border with theme */
.bhxh-card {
    background: #fff;
    border: 1px solid var(--bhxh-gray-200);
    border-radius: var(--bhxh-radius);
    overflow: hidden;
    margin-bottom: 25px;
}

.bhxh-header {
    padding: 25px;
    background: var(--bhxh-gray-50);
    border-bottom: 1px solid var(--bhxh-gray-200);
    text-align: center;
}

.bhxh-header h2 {
    margin: 0 0 5px 0;
    font-size: 22px;
    font-weight: 800;
}

.bhxh-header p {
    margin: 0;
    color: var(--bhxh-text-muted);
    font-size: 14px;
}

.bhxh-tabs {
    display: flex;
    padding: 10px 20px 0;
    background: var(--bhxh-gray-50);
    border-bottom: 1px solid var(--bhxh-gray-200);
}

.bhxh-tab-btn {
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--bhxh-text-muted);
}

.bhxh-tab-btn.active {
    color: var(--bhxh-primary);
    border-bottom-color: var(--bhxh-primary);
}

.bhxh-body {
    padding: 20px;
}

/* Row Layout */
.bhxh-table-header {
    display: grid;
    grid-template-columns: 35px 1fr 180px 35px;
    gap: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--bhxh-gray-100);
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 11px;
    color: var(--bhxh-text-muted);
    text-transform: uppercase;
}

.bhxh-row {
    display: grid;
    grid-template-columns: 35px 1fr 180px 35px;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--bhxh-gray-100);
    align-items: center;
}

.bhxh-stt {
    font-size: 14px;
    font-weight: 700;
    color: var(--bhxh-gray-300);
}

.bhxh-period-inputs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bhxh-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.bhxh-input-group select {
    padding: 6px 8px;
    border: 1px solid var(--bhxh-gray-200);
    border-radius: 6px;
    font-size: 13px;
}

.bhxh-salary-input input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--bhxh-gray-200);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.bhxh-row-label {
    display: block;
    font-size: 10px;
    color: var(--bhxh-text-muted);
    margin-top: 3px;
}

.bhxh-action button {
    background: #fee2e2;
    color: var(--bhxh-danger);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Actions */
.bhxh-add-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.bhxh-btn-add {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--bhxh-gray-200);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.bhxh-footer-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.bhxh-btn-primary {
    background: var(--bhxh-primary);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    flex: 1;
}

.bhxh-btn-outline {
    background: #fff;
    border: 1px solid var(--bhxh-gray-200);
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

/* Result Card */
.bhxh-result-card {
    border-color: var(--bhxh-success);
}

.bhxh-result-header {
    background: #f0fdf4;
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #dcfce7;
}

.bhxh-result-header h3 {
    margin: 0;
    color: var(--bhxh-success);
    font-size: 18px;
    font-weight: 800;
}

.bhxh-total-amount {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid var(--bhxh-gray-100);
}

.bhxh-total-amount .value {
    font-size: 32px;
    font-weight: 900;
    color: var(--bhxh-success);
}

/* Explanation */
.bhxh-breakdown {
    padding: 20px;
}

.bhxh-breakdown ul {
    list-style: none;
    padding: 0;
}

.bhxh-breakdown li {
    padding: 5px 0;
    font-size: 14px;
    line-height: 1.5;
}

.bhxh-breakdown li.bhxh-step-title {
    background: var(--bhxh-gray-100);
    padding: 10px 15px;
    margin: 15px 0 10px;
    border-radius: 6px;
    font-weight: 800;
    color: var(--bhxh-primary);
}

.bhxh-sub-item { padding-left: 10px; }
.bhxh-sub-item-detail { padding-left: 20px; color: #475569; font-size: 13px; }

/* Coefficient Table - Truly Responsive */
.bhxh-coeff-table-container {
    margin-top: 30px;
    border-top: 1px solid var(--bhxh-gray-200);
    padding-top: 25px;
}

.bhxh-coeff-table-container h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 15px;
}

.bhxh-table-responsive {
    overflow-x: auto;
    width: 100%;
    border: 1px solid var(--bhxh-gray-200);
    border-radius: 8px;
}

.bhxh-coeff-table {
    width: 100%;
    border-collapse: collapse;
    /* No min-width here to prevent layout breakage */
}

.bhxh-coeff-table th, 
.bhxh-coeff-table td {
    border: 1px solid var(--bhxh-gray-200);
    padding: 10px 8px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}

.bhxh-coeff-table th { background: var(--bhxh-gray-50); }
.bhxh-coeff-table td:first-child, .bhxh-coeff-table th:first-child {
    background: var(--bhxh-gray-50);
    font-weight: 700;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 1;
}

.bhxh-row-spacer td { height: 10px; background: #fff; border: none; }

/* Mobile Adjustments */
@media (max-width: 900px) {
    .bhxh-table-header { display: none; }
    .bhxh-row {
        grid-template-columns: 1fr;
        padding: 15px;
        background: var(--bhxh-gray-50);
        border-radius: 8px;
        margin-bottom: 10px;
    }
}
