/* HQ Affiliate System — Frontend Styles */
.hq-dashboard { max-width: 960px; margin: 0 auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.hq-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 24px; margin-bottom: 24px; }
.hq-box h3 { margin: 0 0 16px; font-size: 1.1rem; color: #1a202c; }

/* Cards */
.hq-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.hq-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px 16px; text-align: center; }
.hq-card-label { display: block; font-size: .8rem; color: #718096; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.hq-card-value { display: block; font-size: 1.8rem; font-weight: 700; color: #2d3748; }
.hq-card-paid   { border-top: 3px solid #48bb78; }
.hq-card-unpaid { border-top: 3px solid #ed8936; }
.hq-card-bonus  { border-top: 3px solid #9f7aea; background: #faf5ff; }
.hq-card-bonus .hq-card-value { color: #6b46c1; }

/* Bonus period box */
.hq-bonus-period-box { background: #ebf8ff; border-color: #bee3f8; }
.hq-bonus-period-box h3 { color: #2b6cb0; }
.hq-period-dates { display: flex; flex-wrap: wrap; gap: 16px; }
.hq-period-dates span { background: #fff; border: 1px solid #bee3f8; border-radius: 6px; padding: 8px 14px; font-size: .9rem; }

/* Bonus structure */
.hq-bonus-structure-box { background: #fffff0; border-color: #f6e05e; }
.hq-bonus-structure-box h3 { color: #744210; }
.hq-bonus-note { font-size: .85rem; color: #744210; margin-bottom: 12px; }
.hq-bonus-table { width: 100%; }
.hq-bonus-row { background: #fefce8; }
.hq-bonus-row-gold { background: #fffbeb; }
.hq-bonus-highlight { color: #6b46c1; font-weight: 700; }

/* Tables */
.hq-table-wrap { overflow-x: auto; }
.hq-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.hq-table th, .hq-table td { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; }
.hq-table th { background: #f7fafc; font-weight: 600; color: #4a5568; font-size: .8rem; text-transform: uppercase; }
.hq-table tr:last-child td { border-bottom: none; }

/* Referral link */
.hq-reflink-wrap { display: flex; gap: 8px; }
.hq-reflink-input { flex: 1; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .9rem; background: #f7fafc; }

/* Forms */
.hq-form { max-width: 480px; }
.hq-form-row { margin-bottom: 16px; }
.hq-form-row label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; color: #4a5568; }
.hq-form-row input[type=text],
.hq-form-row input[type=email],
.hq-form-row input[type=password],
.hq-form-row input[type=number],
.hq-form-row input[type=url],
.hq-form-row textarea { width: 100%; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 6px; font-size: .9rem; box-sizing: border-box; }
.hq-checkbox-row label { font-weight: 400; display: flex; align-items: center; gap: 6px; }

/* Buttons */
.hq-btn { padding: 8px 16px; border: 1px solid #e2e8f0; border-radius: 6px; background: #edf2f7; cursor: pointer; font-size: .9rem; }
.hq-btn-primary { background: #3182ce; color: #fff; border-color: #3182ce; }
.hq-btn-primary:hover { background: #2b6cb0; }

/* Status badges */
.hq-status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: .8rem; font-weight: 600; }
.hq-status-paid     { background: #c6f6d5; color: #276749; }
.hq-status-unpaid   { background: #feebc8; color: #7b341e; }
.hq-status-pending  { background: #bee3f8; color: #2c5282; }
.hq-status-rejected { background: #fed7d7; color: #822727; }

/* Notices */
.hq-notice, .hq-error, .hq-success { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; }
.hq-error   { background: #fff5f5; border: 1px solid #fc8181; color: #c53030; }
.hq-success { background: #f0fff4; border: 1px solid #68d391; color: #276749; }
.hq-notice  { background: #ebf8ff; border: 1px solid #90cdf4; color: #2a4365; }

@media (max-width: 600px) {
    .hq-cards { grid-template-columns: repeat(2, 1fr); }
    .hq-period-dates { flex-direction: column; }
}

/* ── Portal layout: vertical tab rail (left) + content column (right) ────── */
.hq-dashboard-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.hq-tabs {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    position: sticky;
    top: 24px;
}

.hq-tab-btn {
    appearance: none;
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: #4a5568;
    cursor: pointer;
    transition: color .15s, background .15s, border-color .15s;
}
.hq-tab-btn:hover { color: #2d3748; background: #f7fafc; }
.hq-tab-btn:focus-visible { outline: 2px solid #90cdf4; outline-offset: -2px; }
.hq-tab-btn.is-active {
    color: #5a3fc0;
    background: #f3efff;
    border-left-color: #5a3fc0;
}

/* min-width:0 stops wide tables from blowing out the flex column */
.hq-tab-content {
    flex: 1 1 auto;
    min-width: 0;
}

/* Tabs need JS. Without it, hide the rail and let every section render
   in sequence exactly as it did before tabs existed. */
.hq-dashboard:not([data-hq-tabs-ready]) .hq-tabs { display: none; }
.hq-dashboard:not([data-hq-tabs-ready]) .hq-dashboard-layout { display: block; }

/* Below tablet the rail becomes a horizontal strip above the content */
@media (max-width: 782px) {
    .hq-dashboard-layout { flex-direction: column; gap: 16px; }
    .hq-tabs {
        flex: 1 1 auto;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
        padding: 6px;
    }
    .hq-tab-btn {
        flex: 1 1 auto;
        width: auto;
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 10px 12px;
        font-size: 13px;
    }
    .hq-tab-btn.is-active { border-left-color: transparent; border-bottom-color: #5a3fc0; }
    .hq-tab-content { width: 100%; }
}
