/* HB Form Engine — builder + renderer */

:root {
    --hb-ink: #1a2332;
    --hb-muted: #6b7a90;
    --hb-line: #e6ebf2;
    /* Theme tenant có thể set --accent / --paper trong partials/theme-styles */
    --hb-accent: var(--accent, #0f6e56);
    --hb-accent-deep: var(--accent-deep, #0b5744);
    --hb-accent-soft: #e7f4ef;
    --hb-surface: #fff;
    --hb-canvas: var(--paper, #f3f6fa);
    --hb-radius: 12px;
    --hb-radius-sm: 8px;
    --hb-focus: rgba(15, 110, 86, 0.22);
    --hb-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@supports (color: color-mix(in srgb, red 50%, white)) {
    :root {
        --hb-accent-soft: color-mix(in srgb, var(--hb-accent) 14%, white);
        --hb-focus: color-mix(in srgb, var(--hb-accent) 28%, transparent);
    }
}

.hb-builder-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--hb-surface);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius);
}

.hb-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hb-accent);
}

.hb-builder-title {
    margin: 0.1rem 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.hb-meta {
    color: var(--hb-muted);
    font-size: 0.85rem;
}

.hb-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.hb-builder-grid {
    display: grid;
    grid-template-columns: 200px 1fr 280px;
    gap: 0.85rem;
    min-height: 520px;
}

@media (max-width: 1100px) {
    .hb-builder-grid {
        grid-template-columns: 1fr;
    }
}

.hb-panel {
    background: var(--hb-surface);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius);
    padding: 0.85rem;
}

.hb-panel h3 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hb-muted);
    margin: 0 0 0.75rem;
}

.hb-palette-item {
    display: block;
    width: 100%;
    text-align: left;
    margin-bottom: 0.4rem;
    padding: 0.5rem 0.65rem;
    border: 1px dashed var(--hb-line);
    border-radius: 8px;
    background: #fafbfd;
    cursor: grab;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hb-ink);
}

.hb-palette-item:hover {
    border-color: var(--hb-accent);
    background: var(--hb-accent-soft);
}

.hb-palette-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hb-muted);
    margin: 0.75rem 0 0.35rem;
}

.hb-palette-group-label:first-child {
    margin-top: 0;
}

.hb-prop-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.hb-prop-checkbox input {
    width: auto;
}

.hb-prop-hint {
    font-size: 0.72rem;
    margin-top: 0.2rem;
}

.hb-add-section-btn {
    margin-top: 0.25rem;
}

.hb-section {
    border: 1px solid var(--hb-line);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: #fafbfd;
}

.hb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.hb-section-title-input {
    min-width: 0;
}

.hb-section-handle {
    flex: 0 0 auto;
    padding: 0.35rem 0.25rem;
    color: var(--hb-muted);
    cursor: grab;
    user-select: none;
}

.hb-section-handle:active {
    cursor: grabbing;
}

.hb-section.is-dragging {
    opacity: 0.4;
}

.hb-section.drop-before,
.hb-section.drop-after {
    position: relative;
}

.hb-section.drop-before::before,
.hb-section.drop-after::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--hb-accent);
    z-index: 3;
}

.hb-section.drop-before::before {
    top: -6px;
}

.hb-section.drop-after::after {
    bottom: -6px;
}

.hb-section-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.hb-fields {
    min-height: 48px;
    padding: 0.35rem;
    border-radius: 8px;
    border: 1px dashed transparent;
    position: relative;
}

.hb-fields.hb-drag-over {
    border-color: var(--hb-accent);
    background: var(--hb-accent-soft);
}

.hb-fields.drop-at-end::after {
    content: '';
    display: block;
    height: 3px;
    margin: 0.15rem 0.25rem;
    border-radius: 2px;
    background: var(--hb-accent);
    box-shadow: 0 0 0 2px rgba(15, 110, 86, 0.2);
}

.hb-field-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.4rem;
    background: #fff;
    border: 1px solid var(--hb-line);
    border-radius: 8px;
    position: relative;
    cursor: default;
    transition: box-shadow 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}

.hb-field-card.is-selected {
    border-color: var(--hb-accent);
    box-shadow: 0 0 0 2px rgba(15, 110, 86, 0.15);
}

.hb-field-card.is-dragging {
    opacity: 0.35;
}

.hb-field-card.drop-before::before,
.hb-field-card.drop-after::after {
    content: '';
    position: absolute;
    left: 0.25rem;
    right: 0.25rem;
    height: 3px;
    border-radius: 2px;
    background: var(--hb-accent);
    box-shadow: 0 0 0 2px rgba(15, 110, 86, 0.2);
    z-index: 2;
    pointer-events: none;
}

.hb-field-card.drop-before::before {
    top: -3px;
}

.hb-field-card.drop-after::after {
    bottom: -3px;
}

.hb-field-card .hb-handle {
    color: var(--hb-muted);
    font-size: 0.85rem;
    line-height: 1;
    user-select: none;
    cursor: grab;
    padding: 0.35rem 0.4rem;
    margin: -0.2rem 0 -0.2rem -0.25rem;
    border-radius: 6px;
    touch-action: none;
}

.hb-field-card .hb-handle:hover {
    background: #eef1f5;
    color: #334155;
}

.hb-field-card .hb-handle:active {
    cursor: grabbing;
}

.hb-field-card .hb-field-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 0;
}

.hb-field-card .hb-field-type {
    font-size: 0.7rem;
    color: var(--hb-muted);
    text-transform: uppercase;
}

.hb-order-actions {
    display: inline-flex;
    gap: 0.15rem;
    flex-shrink: 0;
}

.hb-order-btn {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--hb-line);
    border-radius: 5px;
    background: #fff;
    color: #475569;
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
}

.hb-order-btn:hover:not(:disabled) {
    border-color: var(--hb-accent);
    color: var(--hb-accent);
    background: var(--hb-accent-soft);
}

.hb-order-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.hb-props-body label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hb-muted);
    margin: 0.55rem 0 0.2rem;
}

.hb-props-body input,
.hb-props-body select,
.hb-props-body textarea {
    width: 100%;
    border: 1px solid var(--hb-line);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    font-size: 0.875rem;
}

.hb-props-body .tox-tinymce {
    margin-top: 0.2rem;
    border-color: var(--hb-line);
    border-radius: 8px;
}

.hb-logic-rule {
    border: 1px solid var(--hb-line);
    border-radius: 8px;
    padding: 0.65rem;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    background: #fafbfd;
}

.hb-logic-heading {
    display: block;
    margin-bottom: 0.25rem;
}

.hb-logic-when {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr);
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.hb-logic-when [data-l="when-field"] {
    grid-column: 1 / -1;
}

.hb-logic-rule select,
.hb-logic-rule input {
    width: 100%;
    border: 1px solid var(--hb-line);
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    min-width: 0;
}

.hb-logic-actions {
    display: grid;
    gap: 0.35rem;
}

.hb-logic-action {
    display: grid;
    grid-template-columns: 5rem minmax(0, 1fr) 1.5rem;
    gap: 0.35rem;
    align-items: center;
}

.hb-remove-logic-action {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #dc3545;
    font-size: 1.1rem;
    line-height: 1;
}

.hb-remove-logic-action:disabled {
    opacity: 0.25;
}

.hb-add-logic-action {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    text-decoration: none;
}

.hb-remove-logic {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.75rem;
    text-decoration: none;
}

/* —— Public renderer —— */
.hb-form {
    max-width: 720px;
    margin: 0 auto;
    color: var(--hb-ink);
    font-family: var(--hb-font);
}

.hb-form-section {
    margin-bottom: 1.75rem;
}

.hb-form-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--hb-accent);
    color: var(--hb-ink);
}

.hb-field {
    margin-bottom: 1.1rem;
}

.hb-field.is-hidden {
    display: none !important;
}

.hb-field label.hb-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--hb-ink);
    font-size: 0.95rem;
}

.hb-field .hb-required {
    color: #c0392b;
}

.hb-field .hb-help {
    display: block;
    font-size: 0.8rem;
    color: var(--hb-muted);
    margin: 0.2rem 0 0.45rem;
    line-height: 1.4;
}

.hb-field .hb-error {
    color: #c0392b;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.hb-file-upload {
    position: relative;
    border: 1.5px dashed #aab8ca;
    border-radius: var(--hb-radius-sm);
    background: #f8fafc;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    overflow: hidden;
}

.hb-file-upload:hover,
.hb-file-upload:focus-within,
.hb-file-upload.is-dragging {
    border-color: var(--hb-accent);
    background: var(--hb-accent-soft);
    box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.1);
}

.hb-file-upload .hb-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.hb-file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.25rem 1rem;
    text-align: center;
    pointer-events: none;
}

.hb-file-upload-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.15rem;
    border-radius: 50%;
    color: var(--hb-accent);
    background: var(--hb-accent-soft);
}

.hb-file-upload-icon svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hb-file-upload-title {
    color: var(--hb-ink);
    font-size: 0.9rem;
    font-weight: 600;
}

.hb-file-upload-meta,
.hb-file-selection-size {
    color: var(--hb-muted);
    font-size: 0.75rem;
}

.hb-file-selection {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-top: 1px solid var(--hb-line);
    background: #fff;
    font-size: 0.8rem;
}

.hb-file-upload.has-file .hb-file-selection {
    display: flex;
}

.hb-file-selection-name {
    min-width: 0;
    overflow: hidden;
    color: var(--hb-ink);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hb-field input[type="text"],
.hb-field input[type="email"],
.hb-field input[type="url"],
.hb-field input[type="tel"],
.hb-field input[type="number"],
.hb-field input[type="date"],
.hb-field input[type="password"],
.hb-field select,
.hb-field textarea,
.hb-country-select {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--hb-ink);
    background: var(--hb-surface);
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.hb-date-control {
    position: relative;
    display: flex;
    align-items: stretch;
}

.hb-date-control > input[type="text"] {
    min-width: 0;
    border-radius: var(--hb-radius-sm);
}

.hb-date-native-picker {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100%;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.hb-field input:hover,
.hb-field select:hover,
.hb-field textarea:hover,
.hb-country-select:hover {
    border-color: var(--hb-accent);
}

.hb-field input:focus,
.hb-field select:focus,
.hb-field textarea:focus,
.hb-country-select:focus {
    outline: none;
    border-color: var(--hb-accent);
    box-shadow: 0 0 0 3px var(--hb-focus);
}

.hb-field textarea {
    min-height: 110px;
    resize: vertical;
}

.hb-field select,
.hb-country-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a90' d='M1.4 0L6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

.hb-heading {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.hb-divider {
    border: 0;
    border-top: 1px solid var(--hb-line);
    margin: 1rem 0;
}

.hb-option-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}

.hb-radio-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1.15rem;
    align-items: center;
}

.hb-radio-inline .hb-option-row {
    margin-bottom: 0;
    white-space: nowrap;
}

.hb-other-row {
    flex-wrap: nowrap;
}

.hb-other-specify {
    min-width: 160px;
    max-width: 240px;
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius-sm);
    padding: 0.35rem 0.55rem;
    font-size: 0.9rem;
    background: #f7f8fa;
}

.hb-other-specify:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.hb-other-specify:not(:disabled) {
    background: #fff;
}

.hb-file-input {
    width: 100%;
    padding: 0.55rem 0.7rem;
    font-size: 0.9rem;
    border: 1px dashed var(--hb-line);
    border-radius: var(--hb-radius-sm);
    background: var(--hb-canvas);
    box-sizing: border-box;
}

.hb-file-name {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--hb-muted);
}

.hb-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.35rem;
    padding: 0.75rem 1.55rem;
    border: none;
    border-radius: var(--hb-radius-sm);
    background: var(--hb-accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: background .15s ease, transform .1s ease;
}

.hb-submit-btn:hover:not(:disabled) {
    background: var(--hb-accent-deep);
}

.hb-submit-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.hb-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hb-form-alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.hb-form-alert.error {
    background: #fff1f0;
    color: #8a2b24;
    border: 1px solid #f3c6c2;
}

.hb-form-alert.success {
    background: #eefaf3;
    color: #1f6b45;
    border: 1px solid #c6ebd5;
}

.hb-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 9999;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    background: #1a2332;
    color: #fff;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    opacity: 0;
    transform: translateY(8px);
    transition: .2s ease;
}

.hb-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Embed shell (standalone / iframe) */
.hb-embed-body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    color: var(--hb-ink);
    font-family: var(--hb-font);
    background: var(--paper, #fff);
}

.hb-embed-shell {
    padding: 1.25rem 1.35rem 1.75rem;
    max-width: 760px;
    margin: 0 auto;
    box-sizing: border-box;
}

.hb-embed-title {
    margin: 0 0 0.4rem;
    font-size: 1.4rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--hb-ink);
}

.hb-embed-lede {
    margin: 0 0 1.35rem;
    color: var(--hb-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.hb-embed-card {
    background: var(--hb-surface);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius);
    padding: 1.25rem 1.35rem 1.5rem;
    box-shadow: 0 8px 28px rgba(26, 35, 50, 0.06);
}

.hb-embed-loading {
    margin: 0;
    color: var(--hb-muted);
    font-size: 0.9rem;
}

.hb-embed-thanks {
    text-align: center;
    padding: 2rem 1.25rem;
}

.hb-embed-thanks h1 {
    font-size: 1.45rem;
    margin: 0 0 0.55rem;
}

.hb-embed-thanks p {
    color: var(--hb-muted);
    line-height: 1.55;
    margin: 0.4rem 0;
}

.hb-embed-thanks code {
    display: inline-block;
    background: var(--hb-accent-soft);
    color: var(--hb-accent-deep);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

/* Admin builder preview */
.hb-preview-body {
    background: var(--hb-canvas);
}

.hb-preview-shell {
    background: var(--hb-surface);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius);
    padding: 1.25rem 1.35rem 1.5rem;
    box-shadow: 0 6px 20px rgba(26, 35, 50, 0.05);
}

.hb-preview-shell .hb-form {
    margin: 0;
}

.hb-preview-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hb-accent);
    background: var(--hb-accent-soft);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    margin-bottom: 0.85rem;
}

/* Fee table (domain config fees.php) */
.hb-fee-table-wrap {
    overflow-x: auto;
}

.hb-fee-table {
    min-width: 680px;
    border: 1px solid var(--hb-line);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    background: #fff;
    --hb-fee-tier-cols: 2;
}

.hb-fee-row {
    display: grid;
    grid-template-columns: 2.75rem minmax(200px, 1.5fr) repeat(var(--hb-fee-tier-cols), minmax(150px, 1fr));
    border-bottom: 1px solid var(--hb-line);
}

.hb-fee-row:last-child {
    border-bottom: none;
}

.hb-fee-table.is-detailed,
.hb-fee-table-wrap.is-detailed-layout .hb-fee-total {
    min-width: 0;
    width: 100%;
}

.hb-fee-table-wrap.is-detailed-layout .hb-fee-total {
    grid-template-columns: 1fr auto;
}

.hb-fee-table-wrap.is-detailed-layout .hb-fee-total-label {
    grid-column: 1;
    justify-content: flex-end;
}

.hb-fee-table-wrap.is-detailed-layout .hb-fee-total-value {
    grid-column: 2;
    min-width: 8rem;
}

.hb-fee-detailed-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.hb-fee-detailed-table col:nth-child(1) { width: 17%; }
.hb-fee-detailed-table col:nth-child(2) { width: 17%; }
.hb-fee-detailed-table col:nth-child(3) { width: 10%; }
.hb-fee-detailed-table col:nth-child(4) { width: 7%; }
.hb-fee-detailed-table col:nth-child(5) { width: 13%; }
.hb-fee-detailed-table col:nth-child(6) { width: 8%; }
.hb-fee-detailed-table col:nth-child(7) { width: 12%; }
.hb-fee-detailed-table col:nth-child(8) { width: 16%; }

.hb-fee-detailed-table th,
.hb-fee-detailed-table td {
    padding: clamp(0.3rem, 1vw, 0.65rem) clamp(0.15rem, 0.7vw, 0.5rem);
    border-right: 1px solid var(--hb-line);
    border-bottom: 1px solid var(--hb-line);
    text-align: center;
    vertical-align: middle;
    overflow-wrap: anywhere;
    font-size: clamp(0.64rem, 1.5vw, 0.82rem);
    line-height: 1.3;
}

.hb-fee-detailed-table th:last-child,
.hb-fee-detailed-table td:last-child {
    border-right: 0;
}

.hb-fee-detailed-table thead th {
    background: var(--hb-accent-deep, #1a2744);
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
}

.hb-fee-detailed-code {
    font-weight: 700;
    color: var(--hb-accent-deep);
}

.hb-fee-detailed-table .hb-fee-col-price {
    background: var(--hb-accent-soft);
    font-weight: 600;
}

.hb-fee-detailed-table .hb-fee-col-price small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
}

.hb-fee-detailed-qty .hb-fee-qty {
    width: 3.5rem;
}

.hb-fee-col-subtotal {
    font-weight: 600;
}

@media (max-width: 600px) {
    .hb-fee-detailed-table th,
    .hb-fee-detailed-table td {
        padding: 0.3rem 0.12rem;
    }

    .hb-fee-detailed-table .hb-fee-qty {
        width: 2.6rem;
        padding-inline: 0.15rem;
    }

    .hb-fee-table-wrap.is-detailed-layout .hb-fee-total-value {
        min-width: 6rem;
    }
}

.hb-fee-head {
    background: var(--hb-accent-deep, #1a2744);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.hb-fee-head .hb-fee-tier-label {
    line-height: 1.25;
}

.hb-fee-head .hb-fee-tier-sub {
    font-weight: 400;
    text-transform: none;
    opacity: 0.85;
    font-size: 0.68rem;
    margin-top: 0.2rem;
    line-height: 1.3;
}

.hb-fee-col {
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    min-height: 2.75rem;
}

.hb-fee-data-row .hb-fee-col {
    align-items: flex-start;
}

.hb-fee-col-price {
    justify-content: center;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.35;
}

.hb-fee-col-price.is-active-tier {
    background: var(--hb-accent-soft);
    font-weight: 600;
}

.hb-fee-col-price.is-inactive-tier {
    color: #64748b;
    background: #fafbfd;
}

.hb-fee-group-label {
    padding: 0.45rem 0.75rem;
    background: #eef1f5;
    font-weight: 700;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--hb-line);
}

.hb-fee-addon-head {
    padding: 0.4rem 0.75rem 0.4rem 2.75rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--hb-line);
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    font-style: italic;
}

.hb-fee-data-row.is-addon-row {
    background: #fcfdfe;
}

.hb-fee-data-row.is-addon-row .hb-fee-col-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.hb-fee-data-row.is-disabled {
    opacity: 0.55;
}

.hb-fee-data-row[hidden] {
    display: none !important;
}

.hb-fee-row-desc {
    flex: 1 1 100%;
    font-size: 0.75rem;
    color: #667085;
    font-weight: 400;
    line-height: 1.35;
}

.hb-fee-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    font-size: 0.8rem;
    color: #344054;
}

.hb-fee-qty-label {
    font-weight: 600;
}

.hb-fee-qty {
    width: 4rem;
    padding: 0.25rem 0.35rem;
    border: 1px solid var(--hb-line, #d0d5dd);
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.2;
}

.hb-fee-qty:disabled {
    background: #f2f4f7;
    color: #98a2b3;
}

.hb-fee-addon-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--hb-accent);
    background: var(--hb-accent-soft);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    flex-shrink: 0;
}

.hb-fee-hint {
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    color: #856404;
    background: #fff8e6;
    border-bottom: 1px solid #f0e0b2;
}

.hb-fee-col-check {
    justify-content: center;
    padding: 0.65rem 0.35rem 0.65rem 0.65rem;
}

.hb-fee-col-check input {
    margin: 0;
    flex-shrink: 0;
}

.hb-fee-col-label {
    align-items: flex-start;
    padding-left: 0.25rem;
}

.hb-fee-row-label {
    font-size: 0.85rem;
    line-height: 1.4;
}

.hb-fee-row-label.is-disabled {
    opacity: 0.45;
}

.hb-fee-total {
    display: grid;
    grid-template-columns: 2.75rem minmax(200px, 1.5fr) repeat(var(--hb-fee-tier-cols), minmax(150px, 1fr));
    margin-top: 0;
    border: 1px solid var(--hb-line);
    border-top: none;
    border-radius: 0 0 10px 10px;
    background: #fafbfd;
    min-width: 680px;
}

.hb-fee-table-wrap .hb-fee-total {
    margin-top: -1px;
}

.hb-fee-total-label {
    grid-column: 1 / 3;
    padding: 0.65rem 0.75rem;
    font-weight: 700;
    color: #c0392b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.hb-fee-total-value {
    grid-column: -2 / -1;
    padding: 0.65rem 0.75rem;
    font-weight: 700;
    color: #c0392b;
    white-space: nowrap;
    font-size: 0.85rem;
    font-size: 0.95rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hb-fee-empty,
.hb-fee-empty-row {
    padding: 0.75rem;
    color: var(--hb-muted);
    font-size: 0.85rem;
}

.hb-fee-empty code {
    font-size: 0.8rem;
}

/* Payment method field */
.hb-payment-method {
    margin-top: 0.35rem;
}

.hb-payment-method-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--hb-line);
    color: var(--hb-ink);
}

.hb-payment-options {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.hb-payment-option {
    display: block;
    border: 1px solid #c5c9d1;
    border-radius: 4px;
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    background: #fff;
}

.hb-payment-option.is-selected {
    border-color: var(--hb-accent);
    box-shadow: 0 0 0 1px var(--hb-accent);
    background: var(--hb-accent-soft);
}

.hb-payment-option-row {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.hb-payment-option-row input {
    margin-top: 0.2rem;
    width: auto;
    flex-shrink: 0;
}

.hb-payment-option-label {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.35;
}

.hb-payment-info {
    margin: 0.65rem 0 0 1.55rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #7eb6d9;
    background: #e8f4fb;
    border-radius: 2px;
    font-size: 0.85rem;
    color: #1e3a4c;
}

.hb-payment-info-title {
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.hb-payment-info-body {
    white-space: pre-line;
    line-height: 1.45;
}

.hb-payment-info > :first-child {
    margin-top: 0;
}

.hb-payment-info > :last-child {
    margin-bottom: 0;
}

.hb-payment-info p,
.hb-payment-info ul,
.hb-payment-info ol {
    margin-top: 0;
    margin-bottom: 0.45rem;
}
