﻿/* User Profile - refined layout (scoped) */

.profile-container {
    width: 100%;
    padding: 0.75rem 0.75rem 1rem;
    background: var(--background);
}

.profile-container .profile-shell {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    padding: 1.1rem;
}

.profile-container .profile-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.9rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.profile-container .profile-title {
    margin: 0;
    font-size: clamp(1.55rem, 1.3rem + 0.8vw, 2.25rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--foreground);
    font-weight: 800;
}

.profile-container .profile-subtitle {
    margin: 0.4rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.82rem;
    max-width: 78ch;
}

.profile-container .profile-quick {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    white-space: nowrap;
}

.profile-container .profile-main {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.95fr);
    gap: 0.95rem;
    margin-top: 0.95rem;
}

.profile-container .main-stack,
.profile-container .side-stack {
    display: grid;
    gap: 0.8rem;
}

.profile-container .hero-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(45, 108, 223, 0.16);
    background:
        radial-gradient(circle at top right, rgba(45, 108, 223, 0.08), transparent 36%),
        linear-gradient(180deg, #ffffff, #f9fbff);
    border-radius: 14px;
    padding: 0.9rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.8rem;
}

.profile-container .hero-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4c86f8, #2d6cdf);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 14px 26px rgba(45, 108, 223, 0.2);
}

.profile-container .hero-info h2 {
    margin: 0;
    font-size: clamp(1.1rem, 1rem + 0.45vw, 1.45rem);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--foreground);
}

.profile-container .hero-email {
    margin-top: 0.24rem;
    color: var(--muted-foreground);
    font-size: 0.8rem;
}

.profile-container .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.profile-container .chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    font-size: 0.69rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.profile-container .chip-warning {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
}

.profile-container .chip-success {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
}

.profile-container .chip-primary {
    background: rgba(45, 108, 223, 0.1);
    color: #245fcb;
}

.profile-container .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 148px;
}

.profile-container .tabs-card,
.profile-container .panel,
.profile-container .stats-grid,
.profile-container .kanban-grid,
.profile-container .card-soft {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 14px;
}

.profile-container .tabs-card {
    padding: 0.5rem;
    background: linear-gradient(180deg, #f8fafc, #f2f5fa);
}

.profile-container .tabs {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.profile-container .tab {
    width: auto !important;
    flex: 0 0 auto;
    min-height: 2rem;
    padding: 0 0.7rem;
    border-radius: 10px;
    color: var(--muted-foreground);
    font-size: 0.74rem;
    font-weight: 600;
    border: 0;
    background: transparent;
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 160ms ease;
}

.profile-container .tab:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--foreground);
}

.profile-container .tab.active {
    background: linear-gradient(180deg, var(--primary), var(--primary-glow));
    color: #fff;
    box-shadow: 0 10px 20px rgba(45, 108, 223, 0.18);
}

.profile-container .panel {
    padding: 0.82rem;
    display: none;
}

.profile-container .panel.active {
    display: block;
}

.profile-container .section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.profile-container .section-heading h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--foreground);
}

.profile-container .section-heading p {
    margin: 0.28rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    max-width: 72ch;
}

.profile-container .overview-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0.6rem;
}

.profile-container .card-soft {
    background: linear-gradient(180deg, #ffffff, #fbfcff);
    padding: 0.72rem;
}

.profile-container .info-list {
    display: grid;
    gap: 0.5rem;
}

.profile-container .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.76rem;
}

.profile-container .info-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.profile-container .info-row .label {
    color: var(--muted-foreground);
}

.profile-container .info-row .value {
    color: var(--foreground);
    font-weight: 700;
    text-align: right;
}

.profile-container .form-grid,
.profile-container .security-grid,
.profile-container .kanban-grid {
    display: grid;
    gap: 0.62rem;
}

.profile-container .form-grid,
.profile-container .kanban-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-container .security-grid {
    grid-template-columns: 1.2fr 0.8fr;
}

.profile-container .security-grid.security-grid-single {
    grid-template-columns: 1fr;
}

.profile-container .field {
    display: grid;
    gap: 0.36rem;
}

.profile-container .field.full {
    grid-column: 1 / -1;
}

.profile-container .field label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--muted-foreground);
}

.profile-container .field input,
.profile-container .field select,
.profile-container .field .form-input {
    width: 100%;
    min-height: 2rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--secondary);
    padding: 0 0.6rem;
    color: var(--foreground);
    font-size: 0.78rem;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.profile-container .field input:focus,
.profile-container .field select:focus,
.profile-container .field .form-input:focus {
    border-color: rgba(45, 108, 223, 0.45);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(45, 108, 223, 0.12);
}

.profile-container .field small,
.profile-container .form-hint {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    line-height: 1.35;
}

.profile-container .action-row,
.profile-container .kanban-pref-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.68rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.profile-container .action-help {
    color: var(--muted-foreground);
    font-size: 0.72rem;
    max-width: 52ch;
}

.profile-container .switch-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--border);
}

.profile-container .switch-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.profile-container .switch-copy h4 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
}

.profile-container .switch-copy p {
    margin: 0.18rem 0 0;
    font-size: 0.7rem;
    color: var(--muted-foreground);
}

.profile-container .switch {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #d8e0ee;
    position: relative;
    flex-shrink: 0;
}

.profile-container .switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    transition: transform 160ms ease;
}

.profile-container .switch.active {
    background: rgba(45, 108, 223, 0.78);
}

.profile-container .switch.active::after {
    transform: translateX(20px);
}

.profile-container .stats-grid {
    padding: 0.65rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.profile-container .stat-card {
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #f9fbff);
    border-radius: 12px;
    padding: 0.6rem;
    display: grid;
    gap: 0.28rem;
}

.profile-container .stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.profile-container .stat-label {
    color: var(--muted-foreground);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.profile-container .compact-list {
    display: grid;
    gap: 0.5rem;
}

.profile-container .compact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-container .compact-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.profile-container .compact-meta {
    display: grid;
    gap: 0.16rem;
}

.profile-container .compact-title {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--foreground);
}

.profile-container .compact-sub {
    font-size: 0.69rem;
    color: var(--muted-foreground);
}

.profile-container .status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
    flex-shrink: 0;
}

.profile-container .btn {
    min-height: 2rem;
    padding: 0 0.7rem;
    border-radius: 10px;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 160ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.profile-container .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-container .btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-glow));
    color: #fff;
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.25);
}

.profile-container .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
}

.profile-container .btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.profile-container .btn-secondary:hover:not(:disabled) {
    background: var(--muted);
}

.profile-container .alert {
    padding: 0.56rem 0.68rem;
    border-radius: 10px;
    margin-bottom: 0.62rem;
    font-size: 0.76rem;
    font-weight: 600;
}

.profile-container .alert-success {
    background: linear-gradient(135deg, hsl(142, 76%, 95%), hsl(142, 76%, 92%));
    color: hsl(142, 76%, 25%);
    border: 1px solid hsl(142, 76%, 80%);
}

.profile-container .alert-error {
    background: linear-gradient(135deg, hsl(0, 84%, 97%), hsl(0, 84%, 94%));
    color: hsl(0, 84%, 35%);
    border: 1px solid hsl(0, 84%, 80%);
}

.profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    gap: 0.8rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.profile-error {
    background: var(--card);
    border: 1px solid var(--destructive);
    border-radius: 12px;
    padding: 1rem;
}

.profile-error h2 {
    margin: 0 0 0.5rem;
    color: var(--destructive);
}

@media (max-width: 1100px) {
    .profile-container .profile-main {
        grid-template-columns: 1fr;
    }

    .profile-container .overview-grid,
    .profile-container .security-grid,
    .profile-container .form-grid,
    .profile-container .kanban-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .profile-container {
        padding: 0.55rem;
    }

    .profile-container .profile-shell {
        padding: 0.75rem;
        border-radius: 14px;
    }

    .profile-container .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-container .profile-quick {
        white-space: normal;
    }

    .profile-container .hero-card {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .profile-container .hero-actions {
        min-width: 0;
        width: 100%;
    }

    .profile-container .action-row,
    .profile-container .kanban-pref-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .profile-container .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}


.auth-2fa-card {
    display: grid;
    gap: 1rem;
    margin-top: .85rem;
    padding: 1rem;
    border-color: color-mix(in srgb, var(--tblr-border-color, #d9dfe8) 82%, #206bc4 18%);
    background: linear-gradient(180deg, #fff 0%, #fbfcfe 100%);
}
.auth-2fa-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.auth-2fa-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    min-width: 0;
}
.auth-2fa-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(32, 107, 196, .10);
    color: #206bc4;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .02em;
}
.auth-2fa-heading h4 {
    margin: 0 0 .2rem;
}
.auth-2fa-heading p,
.auth-2fa-recovery-head p,
.auth-2fa-enabled-summary p,
.auth-2fa-manage-panel p,
.auth-2fa-summary p,
.auth-2fa-muted {
    margin: 0;
    color: var(--tblr-secondary, #667085);
    line-height: 1.45;
}
.auth-2fa-alert {
    margin: 0 !important;
}
.auth-2fa-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem;
    border: 1px solid var(--tblr-border-color, #d9dfe8);
    border-radius: 12px;
    background: #fff;
}
.auth-2fa-summary > div {
    min-width: 0;
}
.auth-2fa-summary .btn {
    flex: 0 0 auto;
}
.auth-2fa-setup {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}
.auth-2fa-step {
    display: grid;
    align-content: start;
    gap: .85rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--tblr-border-color, #d9dfe8);
    border-radius: 12px;
    background: #fff;
}
.auth-2fa-step-title {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
}
.auth-2fa-step-title > div {
    display: grid;
    gap: .12rem;
}
.auth-2fa-step-title small {
    color: var(--tblr-secondary, #667085);
}
.auth-2fa-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #206bc4;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
}
.auth-2fa-qr {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 220px !important;
    height: 220px !important;
    max-width: 100% !important;
    max-height: 220px !important;
    aspect-ratio: 1;
    margin: .15rem auto 0;
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--tblr-border-color, #d9dfe8);
    border-radius: 12px;
    background: #fff;
}
.auth-2fa-qr svg {
    display: block !important;
    width: 196px !important;
    height: 196px !important;
    max-width: 100% !important;
    max-height: 100% !important;
}
.auth-2fa-manual {
    display: grid;
    gap: .45rem;
    color: var(--tblr-secondary, #667085);
    font-size: .74rem;
}
.auth-2fa-secret-row {
    display: flex;
    align-items: stretch;
    gap: .5rem;
}
.auth-2fa-secret {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1 1 auto;
    padding: .6rem .7rem;
    border: 1px solid var(--tblr-border-color, #d9dfe8);
    border-radius: 8px;
    overflow-wrap: anywhere;
    background: var(--tblr-bg-surface-secondary, #f6f8fb);
    font-size: .72rem;
}
.auth-2fa-code-field input {
    max-width: 230px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .12em;
    font-size: 1rem;
    font-weight: 700;
}
.auth-2fa-code-field small {
    color: var(--tblr-secondary, #667085);
}
.auth-2fa-help-box,
.auth-2fa-clock-warning {
    display: grid;
    gap: .15rem;
    padding: .7rem .75rem;
    border-radius: 10px;
    font-size: .73rem;
}
.auth-2fa-help-box {
    border: 1px solid #dce6f4;
    background: #f7faff;
    color: #40566f;
}
.auth-2fa-clock-warning {
    border: 1px solid rgba(245,159,0,.45);
    background: rgba(245,159,0,.08);
    color: #725100;
}
.auth-2fa-setup-actions {
    margin-top: auto;
    padding-top: .35rem;
}
.auth-2fa-enabled {
    display: grid;
    gap: .9rem;
}
.auth-2fa-enabled-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem;
    border: 1px solid rgba(47,179,68,.26);
    border-radius: 12px;
    background: rgba(47,179,68,.05);
}
.auth-2fa-recovery-count {
    display: grid;
    flex: 0 0 auto;
    min-width: 118px;
    text-align: right;
}
.auth-2fa-recovery-count strong {
    font-size: 1.2rem;
}
.auth-2fa-recovery-count span {
    color: var(--tblr-secondary, #667085);
    font-size: .68rem;
}
.auth-2fa-manage-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
}
.auth-2fa-manage-panel {
    display: grid;
    align-content: start;
    gap: .55rem;
    padding: .85rem;
    border: 1px solid var(--tblr-border-color, #e3e7ee);
    border-radius: 12px;
    background: #fff;
}
.auth-2fa-danger {
    border-color: rgba(214,57,57,.20);
    background: rgba(214,57,57,.025);
}
.auth-2fa-recovery {
    padding: .95rem;
    border: 1px solid rgba(245,159,0,.65);
    border-radius: 12px;
    background: rgba(245,159,0,.06);
}
.auth-2fa-recovery-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
    margin-bottom: .75rem;
}
.auth-2fa-code-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
    margin-bottom: .8rem;
}
.auth-2fa-code-grid code {
    padding: .5rem .6rem;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--tblr-border-color, #e3e7ee);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) {
    .auth-2fa-setup,
    .auth-2fa-manage-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 720px) {
    .auth-2fa-card {
        margin-top: .65rem;
        padding: .8rem;
    }
    .auth-2fa-heading,
    .auth-2fa-recovery-head,
    .auth-2fa-enabled-summary,
    .auth-2fa-summary {
        align-items: stretch;
        flex-direction: column;
    }
    .auth-2fa-title-wrap {
        align-items: flex-start;
    }
    .auth-2fa-summary .btn {
        width: 100%;
    }
    .auth-2fa-qr {
        width: min(196px, 100%) !important;
        height: auto !important;
        max-height: 196px !important;
    }
    .auth-2fa-qr svg {
        width: 172px !important;
        height: 172px !important;
    }
    .auth-2fa-secret-row {
        flex-direction: column;
    }
    .auth-2fa-code-field input {
        max-width: none;
        width: 100%;
    }
    .auth-2fa-setup-actions {
        flex-direction: column-reverse !important;
    }
    .auth-2fa-recovery-count {
        text-align: left;
    }
    .auth-2fa-code-grid {
        grid-template-columns: 1fr;
    }
}
