/* ═══════════════════════════════════════════════════════════════════════════
   Dashboard — unified board layout
   ═══════════════════════════════════════════════════════════════════════════ */

.ks-dashboard {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 0 clamp(2.5rem, 6vw, 4rem);
    position: relative;
}

.ks-dashboard::before {
    content: "";
    position: absolute;
    top: -4rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, 90vw);
    height: 280px;
    background: radial-gradient(ellipse at center, rgba(225, 29, 72, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.ks-dashboard > * {
    position: relative;
    z-index: 1;
}

/* Override legacy dashboard rules from style.css */
.ks-dashboard .ks-dash-board .ks-dash-stat-card {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 1.15rem 1.35rem !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.ks-dashboard .ks-dash-board .ks-dash-stat-card::before {
    display: none !important;
}

.ks-dashboard .ks-dash-board .ks-dash-stat-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

.ks-dashboard .ks-dash-board .ks-dash-stat-value {
    background: none !important;
    -webkit-text-fill-color: #fff !important;
    color: #fff !important;
}

.ks-dashboard .ks-credits-bar {
    border-radius: 999px;
    overflow: hidden;
}

.ks-dashboard .ks-credits-bar-fill {
    animation: none !important;
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.ks-dash-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

@media (min-width: 768px) {
    .ks-dash-header {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }
}

.ks-dash-header__aside {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .ks-dash-header__aside {
        justify-content: flex-end;
    }
}

.ks-dash-plan-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: capitalize;
    color: #fda4af;
    background: rgba(180, 18, 42, 0.14);
    border: 1px solid rgba(225, 29, 72, 0.35);
}

.ks-dash-header__title {
    margin: 0.35rem 0 0.5rem;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: clamp(1.65rem, 3.5vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: #fff;
}

.ks-dash-header__username {
    color: #fda4af;
}

.ks-dash-header__lead {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.48);
    max-width: 36rem;
}

.ks-dash-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Unified board (stats + tabs) ──────────────────────────────────────────── */
.ks-dash-board {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 28px 56px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* ── Stats row (inside board, no individual boxes) ─────────────────────────── */
.ks-dash-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 767px) {
    .ks-dash-stats {
        grid-template-columns: 1fr;
    }
}

.ks-dash-stat-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 1.15rem 1.35rem;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: background 0.2s ease;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.ks-dash-stat-card:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 767px) {
    .ks-dash-stat-card:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
}

.ks-dash-stat-card:focus-visible {
    outline: 2px solid rgba(225, 29, 72, 0.55);
    outline-offset: -2px;
    z-index: 1;
}

.ks-dash-stat-card:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: none;
    box-shadow: none;
}

.ks-dash-stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(180, 18, 42, 0.12);
    border: 1px solid rgba(225, 29, 72, 0.2);
    flex-shrink: 0;
}

.ks-dash-stat-card__icon i {
    font-size: 1.1rem;
    color: #fb7185;
}

.ks-dash-stat-value {
    display: block;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: clamp(1.55rem, 3vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #fff;
    background: none;
    -webkit-text-fill-color: unset;
    margin-bottom: 0.2rem;
}

.ks-dash-stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

/* ── Tab shell (no extra outer border) ─────────────────────────────────────── */
.ks-dash-shell {
    min-width: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.ks-dash-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    overflow-x: auto;
    scrollbar-width: none;
}

.ks-dash-nav::-webkit-scrollbar {
    display: none;
}

.ks-dash-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1 1 0;
    justify-content: center;
    min-width: max-content;
    padding: 0.55rem 0.9rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Manrope', system-ui, sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.ks-dash-tab i {
    font-size: 1rem;
    opacity: 0.65;
}

.ks-dash-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.04);
}

.ks-dash-nav .ks-dash-tab.is-active {
    background: rgba(180, 18, 42, 0.2);
    color: #fff;
    box-shadow: none;
    border: none;
}

.ks-dash-nav .ks-dash-tab.is-active i {
    opacity: 1;
    color: #fb7185;
}

.ks-dash-content {
    padding: clamp(1.5rem, 3.5vw, 2rem);
    min-height: 280px;
}

.ks-dash-tab-panel {
    display: none;
}

.ks-dash-tab-panel.is-active {
    display: block;
    animation: ksDashFadeIn 0.28s ease;
}

@keyframes ksDashFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Section headers (tabs) ────────────────────────────────────────────────── */
.ks-dash-section-head {
    margin-bottom: 1.35rem;
}

.ks-dash-section-head__title {
    margin: 0 0 0.35rem;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.ks-dash-section-head__desc {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.42);
}

/* ── Overview (subscription hero) ────────────────────────────────────────────── */
.ks-dash-overview {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ks-dash-overview__hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ks-dash-overview__eyebrow {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 0.4rem;
}

.ks-dash-overview__plan-name {
    margin: 0 0 0.5rem;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: clamp(1.5rem, 3vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    text-transform: capitalize;
}

.ks-dash-overview__meta {
    margin: 0;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

.ks-dash-overview__days {
    color: #fda4af;
    font-weight: 600;
}

.ks-dash-overview__hero-actions .ks-framer-btn {
    min-height: 42px;
}

.ks-dash-credits-block {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
}

.ks-dash-credits-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.75rem;
}

.ks-dash-credits-head span {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.ks-dash-credits-head em {
    font-style: normal;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.55);
}

.ks-dash-credits-head em strong {
    font-weight: 700;
    color: #fff;
    font-size: 1rem;
}

.ks-credits-bar {
    height: 8px;
    margin: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 999px;
    overflow: hidden;
}

.ks-credits-bar-fill {
    background: linear-gradient(90deg, #9f1239 0%, #e11d48 55%, #fb7185 100%);
    box-shadow: 0 0 16px rgba(225, 29, 72, 0.35);
}

.ks-dash-overview__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ks-dash-sub-footnote {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.35);
    max-width: 22rem;
}

.ks-dash-link-btn {
    border: none;
    background: none;
    padding: 0;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Manrope', system-ui, sans-serif;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.ks-dash-link-btn:hover {
    color: #fca5a5;
}

/* ── Legacy panels (still used in empty states etc.) ─────────────────────────── */
.ks-dash-panel {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    padding: clamp(1.25rem, 3vw, 1.5rem);
}

.ks-dash-panel__title {
    margin: 0;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}

.ks-dash-panel__desc {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.48);
}

.ks-dash-subtitle {
    margin: 0 0 0.85rem;
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
}

.ks-dash-divider {
    height: 1px;
    margin: 1.15rem 0;
    background: rgba(255, 255, 255, 0.06);
}

.ks-dash-muted {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.38);
}

/* ── Meta list ─────────────────────────────────────────────────────────────── */
.ks-dash-meta-list--grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 640px) {
    .ks-dash-meta-list--grid {
        grid-template-columns: 1fr 1fr;
    }

    .ks-dash-meta-list--grid .ks-dash-meta-row {
        border-bottom: none;
        padding: 0.5rem 0.75rem 0.5rem 0;
    }
}

.ks-dash-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ks-dash-meta-row:last-child {
    border-bottom: none;
}

.ks-dash-meta-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.ks-dash-meta-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    text-align: right;
}

.ks-dash-meta-hint {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
}

.ks-dash-api-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ks-dash-api-row .form-control {
    font-size: 0.82rem;
    font-family: ui-monospace, 'Cascadia Code', monospace;
}

/* ── Seller / earnings ─────────────────────────────────────────────────────── */
.ks-dash-seller-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: end;
}

@media (min-width: 640px) {
    .ks-dash-seller-grid {
        grid-template-columns: auto 1fr;
    }
}

.ks-dash-seller-balance {
    font-family: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    line-height: 1;
}

.ks-dash-seller-label {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
}

.ks-dash-withdraw-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.ks-dash-withdraw-form__field {
    flex: 1 1 140px;
    min-width: 0;
}

.ks-dash-profile-form .form-control {
    font-size: 0.9rem;
}

/* ── Empty states ──────────────────────────────────────────────────────────── */
.ks-dash-empty {
    text-align: center;
    padding: 2.5rem 1rem;
}

.ks-dash-empty__icon {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.1);
    margin-bottom: 0.75rem;
}

.ks-dash-empty p {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.45);
}

.ks-dash-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
}

.ks-dash-empty-state .ks-empty-icon {
    opacity: 0.2;
}

.ks-dash-empty-state h5 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    color: #fff;
}

.ks-dash-empty-state p {
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.45);
}

.ks-dash-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ks-dash-badge--warn {
    color: #fda4af;
    background: rgba(180, 18, 42, 0.18);
    border: 1px solid rgba(225, 29, 72, 0.35);
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.ks-dashboard .table {
    margin-bottom: 0;
    --bs-table-border-color: rgba(255, 255, 255, 0.06);
}

.ks-dashboard .table thead th {
    padding: 0.65rem 0.75rem;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ks-dashboard .table tbody td {
    padding: 0.9rem 0.75rem;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.ks-dashboard .table tbody tr:last-child td {
    border-bottom: none;
}

.ks-table-row:hover {
    background: rgba(255, 255, 255, 0.025) !important;
}

.ks-dash-project-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ks-dash-project-thumb {
    width: 52px;
    height: 34px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ks-dash-project-title {
    font-weight: 600;
    color: #fff;
}

.ks-dash-amount {
    font-weight: 700;
    color: #fda4af;
}

.ks-dash-status {
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: capitalize;
}

.ks-dash-status--completed {
    color: #86efac;
    background: rgba(34, 197, 94, 0.12);
}

.ks-dash-status--pending {
    color: #fcd34d;
    background: rgba(234, 179, 8, 0.12);
}

.ks-dash-status--failed {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
}

.ks-credit-badge {
    display: inline-flex;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fda4af;
    background: rgba(180, 18, 42, 0.12);
    border: 1px solid rgba(225, 29, 72, 0.2);
}

/* ── Alerts & forms ────────────────────────────────────────────────────────── */
.ks-dashboard .alert {
    border-radius: 14px;
    margin-bottom: 1.25rem;
}

.ks-dashboard .form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
}

.ks-dash-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.ks-dash-btn-ghost:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.ks-dash-btn-ghost--accent {
    border-color: rgba(225, 29, 72, 0.4);
    background: rgba(180, 18, 42, 0.12);
    color: #fda4af;
}

@media (max-width: 480px) {
    .ks-dash-nav .ks-dash-tab {
        padding: 0.5rem 0.6rem;
        font-size: 0.74rem;
    }

    .ks-dash-nav .ks-dash-tab i {
        display: none;
    }

    .ks-dash-overview__hero {
        flex-direction: column;
    }

    .ks-dash-overview__hero-actions {
        width: 100%;
    }

    .ks-dash-overview__hero-actions .ks-framer-btn {
        width: 100%;
        justify-content: center;
    }
}
