﻿.pi-account-page {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

.pi-account-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}

.pi-account-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
}

.pi-account-identity {
    min-width: 0;
}

.pi-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.pi-email {
    color: #6b7280;
}

.pi-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.pi-subscription-stat-card {
    width: 255px;
    min-height: 112px;
    margin-left: auto;
    flex: 0 0 255px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.pi-usage-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pi-usage-period-header {
    margin: 24px 0 12px;
}

.pi-usage-period-header .pi-label {
    margin-bottom: 3px;
    color: #111827;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.pi-usage-period-header p {
    margin: 0;
    color: #6b7280;
    font-size: .9rem;
}

.pi-stat-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
}

.pi-label {
    display: block;
    color: #6b7280;
    margin-bottom: 6px;
}

.pi-stat-label-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.pi-stat-label-row .pi-label {
    margin-bottom: 6px;
}

.pi-usage-info {
    position: relative;
    display: inline-flex;
}

.pi-info-button {
    width: 17px;
    height: 17px;
    padding: 0;
    border: 1px solid #64748b;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    cursor: help;
}

.pi-info-button:hover,
.pi-info-button:focus-visible {
    border-color: #2563eb;
    color: #2563eb;
}

.pi-info-button:focus-visible {
    outline: 2px solid #bfdbfe;
    outline-offset: 2px;
}

.pi-usage-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    z-index: 10;
    display: grid;
    min-width: 180px;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #111827;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .2);
    color: #fff;
    font-size: .78rem;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity .15s ease, transform .15s ease;
}

.pi-usage-tooltip::after {
    position: absolute;
    top: 100%;
    left: 50%;
    border: 5px solid transparent;
    border-top-color: #111827;
    content: "";
    transform: translateX(-50%);
}

.pi-usage-info:hover .pi-usage-tooltip,
.pi-usage-info:focus-within .pi-usage-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.pi-progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    margin-top: 12px;
    overflow: hidden;
}

.pi-progress-fill {
    height: 100%;
    background: #2563eb;
}

.pi-section {
    margin-top: 20px;
}

.pi-action-link {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: #111827;
    background: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: inherit;
    text-align: left;
    cursor: pointer;
}

.pi-action-form {

    margin: 0;

}

.pi-action-button {
    appearance: none;
    -webkit-appearance: none;
}

    .pi-action-link:hover {
        background: #f9fafb;
    }

.pi-danger-zone {
    margin-top: 32px;
    padding: 20px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 12px;
}

.pi-delete-link {
    color: #dc2626;
    font-weight: 600;
    text-decoration: none;
}

.pi-pending-deletion {
    display: grid;
    gap: 10px;
    margin-bottom: 24px;
}

.pi-pending-deletion form {
    margin-top: 4px;
}

.pi-pending-deletion .pi-btn {
    width: auto;
}

.pi-account-card .pi-profile-logout-btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pi-btn-primary {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 760px) {
    .pi-account-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .pi-subscription-stat-card {
        width: 255px;
        margin-left: 80px;
        flex-basis: 255px;
    }

    .pi-usage-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .pi-subscription-stat-card {
        width: 100%;
        margin-left: 0;
        flex-basis: 100%;
    }
}
