/* ══════════════════════════════════════════
   accounts-ux.css — CT Accounts UX Enhancement
   Qualifier questions, tiered P&L, guided Balance Sheet
   ══════════════════════════════════════════ */

/* ── Qualifier Questions ── */

.qualifier-questions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.qualifier-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    transition: border-color 0.2s;
}

.qualifier-card:hover {
    border-color: var(--border-mid, #ccc);
}

.qualifier-question {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.qualifier-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.qualifier-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.qualifier-text strong {
    font-size: 0.9375rem;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.3;
}

.qualifier-hint {
    font-size: 0.8125rem;
    color: var(--text-muted, #666);
    line-height: 1.4;
}

.qualifier-toggle {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-sm, 6px);
    background: var(--bg-white, #fff);
    color: var(--text-secondary, #555);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 52px;
    text-align: center;
}

.btn-toggle:hover {
    border-color: var(--fox, #f97316);
    color: var(--fox, #f97316);
}

.btn-toggle.active {
    background: var(--fox, #f97316);
    border-color: var(--fox, #f97316);
    color: #fff;
}

.btn-toggle.active[data-answer="no"] {
    background: var(--text-muted, #888);
    border-color: var(--text-muted, #888);
}

/* Qualifier Summary */
.qualifier-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-light, #f8f8f8);
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--border-light, #e0e0e0);
}

.qualifier-summary-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.qualifier-summary-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.qualifier-summary-text strong {
    font-size: 0.9375rem;
    color: var(--text-primary, #1a1a1a);
}

.qualifier-summary-text span {
    font-size: 0.8125rem;
    color: var(--text-muted, #666);
}

/* Qualifier-dependent fields (hidden/shown by JS) */
.qualifier-field {
    /* display controlled by JS */
}


/* ── P&L Tier Selector ── */

.tier-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: var(--bg-light, #f5f5f5);
    border-radius: var(--radius-md, 8px);
}

.tier-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0.75rem 0.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm, 6px);
    background: transparent;
    color: var(--text-secondary, #555);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tier-btn:hover {
    background: rgba(255, 255, 255, 0.6);
}

.tier-btn.active {
    background: var(--bg-white, #fff);
    color: var(--fox, #f97316);
    border-color: var(--fox, #f97316);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tier-desc {
    font-size: 0.6875rem;
    font-weight: 400;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tier-btn.active .tier-desc {
    color: var(--fox, #f97316);
    opacity: 0.8;
}

/* P&L Tier panels */
.pl-tier {
    /* display controlled by JS */
}


/* ── Profit Result Box ── */

.profit-result {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-light, #f8f8f8);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    text-align: center;
}

.profit-label {
    font-size: 0.8125rem;
    color: var(--text-muted, #666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.profit-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    font-variant-numeric: tabular-nums;
}

.profit-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    margin-top: 0.25rem;
}


/* ── Balance Sheet Sections ── */

.bs-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-white, #fff);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 8px);
}

.bs-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light, #e8e8e8);
}

.bs-section-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.bs-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
}

.bs-section-hint {
    margin: 0.125rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted, #666);
}

.bs-group-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #555);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Accounting term hints */
.form-hint-accounting {
    font-size: 0.6875rem;
    color: var(--text-muted, #999);
    font-style: italic;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}


/* ── Balance Check Indicator ── */

.balance-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-light, #f5f5f5);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.balance-check-ok {
    background: #f0fdf4;
    border-color: #86efac;
}

.balance-check-warn {
    background: #fffbeb;
    border-color: #fcd34d;
}

.balance-check-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.balance-check-text {
    font-size: 0.8125rem;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.4;
}


/* ── Retained Earnings Calculator ── */

.re-calculator {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #fffbeb;
    border: 1px dashed #fbbf24;
    border-radius: var(--radius-md, 8px);
}

.re-calculator h5 {
    font-size: 0.9375rem;
    color: var(--text-primary, #1a1a1a);
}


/* ── Detail Expandables ── */

.detail-expand {
    margin: 0.75rem 0;
    border: 1px solid var(--border-light, #e8e8e8);
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
}

.detail-expand-summary {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--fox, #f97316);
    cursor: pointer;
    background: var(--bg-light, #fafafa);
    transition: background 0.15s;
    list-style: none;
}

.detail-expand-summary::-webkit-details-marker {
    display: none;
}

.detail-expand-summary::before {
    content: '+ ';
    font-weight: 700;
}

.detail-expand[open] .detail-expand-summary::before {
    content: '− ';
}

.detail-expand-summary:hover {
    background: var(--bg-hover, #f0f0f0);
}

.detail-expand-body {
    padding: 0.75rem 1rem;
}


/* ── Help Icon (tooltip trigger) ── */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-muted, #999);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    vertical-align: middle;
    margin-left: 0.25rem;
    position: relative;
}

.help-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary, #1a1a1a);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    min-width: 200px;
    max-width: 280px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}


/* ── Companies House Badge ── */

.ch-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: #1d70b8;
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-right: 0.375rem;
}


/* ── FoxChat Tip Banner ── */

.foxchat-tip-banner {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-md, 8px);
    margin-bottom: 1rem;
    align-items: flex-start;
}

.tip-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    line-height: 1;
}

.tip-content {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-primary, #333);
    line-height: 1.5;
}

.tip-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}


/* ── Mobile Responsive ── */

@media (max-width: 600px) {
    .qualifier-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .qualifier-toggle {
        justify-content: flex-end;
    }

    .qualifier-icon {
        display: none;
    }

    .tier-selector {
        gap: 0.25rem;
    }

    .tier-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.8125rem;
    }

    .bs-section {
        padding: 0.75rem;
    }

    .bs-section-icon {
        display: none;
    }

    .profit-amount {
        font-size: 1.25rem;
    }

    .help-icon:hover::after {
        left: 0;
        transform: none;
        min-width: 180px;
    }
}
