.g5-profile {
    --g5-profile-border: #d8d8d8;
    --g5-profile-muted: #6b7280;
    --g5-profile-bg: #fff;
    --g5-profile-soft-bg: #f5f5f5;
    --g5-profile-strong: #171717;
    --g5-profile-success: #166534;
    --g5-profile-error: #b42318;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    color: inherit;
}

.g5-profile [hidden] {
    display: none !important;
}

.g5-profile-message {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-soft-bg);
    line-height: 1.55;
}

.g5-profile-message.is-success {
    border-color: #86b895;
    color: var(--g5-profile-success);
    background: #effaf2;
}

.g5-profile-message.is-error {
    border-color: #e6a19a;
    color: var(--g5-profile-error);
    background: #fff2f1;
}

.g5-profile-horizontal-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px;
    margin: 0;
    border-bottom: 1px solid var(--g5-profile-strong);
}

.g5-profile-horizontal-tab,
.g5-profile-vertical-tab,
.g5-profile-button,
.g5-profile-password-toggle {
    appearance: none;
    box-sizing: border-box;
    border-radius: 0;
    font: inherit;
    cursor: pointer;
}

.g5-profile-horizontal-tab {
    position: relative;
    margin: 0 0 -1px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-bottom-color: var(--g5-profile-strong);
    background: transparent;
    color: inherit;
    font-weight: 600;
}

.g5-profile-horizontal-tab:hover,
.g5-profile-horizontal-tab:focus-visible {
    background: var(--g5-profile-soft-bg);
}

.g5-profile-horizontal-tab.is-active {
    border-color: var(--g5-profile-strong);
    border-top-width: 4px;
    border-bottom-color: var(--g5-profile-bg);
    background: var(--g5-profile-bg);
    font-weight: 700;
}

.g5-profile-horizontal-panels {
    border: 1px solid var(--g5-profile-strong);
    border-top: 0;
    background: var(--g5-profile-bg);
}

.g5-profile-horizontal-panel {
    display: none;
    min-width: 0;
}

.g5-profile-horizontal-panel.is-active {
    display: block;
}

.g5-profile-vertical-layout {
    display: grid;
    grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
    align-items: stretch;
    min-height: 420px;
}

.g5-profile-vertical-tabs {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 4px;
    padding: 20px 0 20px 20px;
    background: var(--g5-profile-soft-bg);
}

.g5-profile-vertical-tab {
    position: relative;
    width: 100%;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-left: 4px solid transparent;
    background: transparent;
    color: inherit;
    text-align: left;
}

.g5-profile-vertical-tab:hover,
.g5-profile-vertical-tab:focus-visible {
    background: #fff;
}

.g5-profile-vertical-tab.is-active {
    z-index: 1;
    border-color: var(--g5-profile-strong);
    border-right-color: #fff;
    border-left-color: var(--g5-profile-strong);
    background: #fff;
    font-weight: 700;
}

.g5-profile-vertical-tab.is-active::after {
    content: "";
    position: absolute;
    top: 0;
    right: -2px;
    width: 3px;
    height: 100%;
    background: #fff;
}

.g5-profile-vertical-panels {
    min-width: 0;
    padding: 24px clamp(18px, 4vw, 42px) 42px;
    border-left: 1px solid var(--g5-profile-strong);
}

.g5-profile-vertical-panel {
    display: none;
}

.g5-profile-vertical-panel.is-active {
    display: block;
}

.g5-profile-card {
    padding: 22px 0;
    border-bottom: 1px solid var(--g5-profile-border);
}

.g5-profile-card:first-child {
    padding-top: 0;
}

.g5-profile-card:last-child {
    border-bottom: 0;
}

.g5-profile-card h2,
.g5-profile-card h3,
.g5-profile-activity-header h2 {
    margin: 0 0 18px;
    color: inherit;
    font-weight: 700;
}

.g5-profile-image-card {
    display: flex;
    align-items: center;
    gap: 22px;
}

.g5-profile-image-preview-wrap {
    flex: 0 0 auto;
    width: 120px;
    height: 120px;
    overflow: hidden;
    border: 3px solid var(--g5-profile-border);
    border-radius: 50%;
    background: var(--g5-profile-soft-bg);
}

.g5-profile-image-preview,
.g5-profile-image-preview-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.g5-profile-image-controls {
    min-width: 0;
}

.g5-profile-image-controls h3 {
    margin-bottom: 4px;
}

.g5-profile-muted,
.g5-profile-help {
    color: var(--g5-profile-muted);
    font-size: 13px;
    line-height: 1.55;
}

.g5-profile-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.g5-profile-field {
    grid-column: 1 / -1;
    min-width: 0;
}

.g5-profile-field-half {
    grid-column: auto;
}

.g5-profile-field label {
    display: block;
    margin: 0 0 7px;
    font-weight: 700;
}

.g5-profile input[type="text"],
.g5-profile input[type="url"],
.g5-profile input[type="password"],
.g5-profile input[type="email"],
.g5-profile textarea,
.g5-profile select {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--g5-profile-strong);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
}

.g5-profile textarea {
    resize: vertical;
}

.g5-profile-readonly {
    min-height: 22px;
    padding: 10px 11px;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-soft-bg);
    overflow-wrap: anywhere;
}

.g5-profile-inline-actions,
.g5-profile-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.g5-profile-form-actions {
    margin-top: 20px;
}

.g5-profile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--g5-profile-strong);
    background: #fff;
    color: inherit;
    text-decoration: none;
    line-height: 1.25;
}

.g5-profile-button:hover,
.g5-profile-button:focus-visible {
    background: var(--g5-profile-soft-bg);
    color: inherit;
}

.g5-profile-button-primary {
    background: var(--g5-profile-strong);
    color: #fff;
}

.g5-profile-button-primary:hover,
.g5-profile-button-primary:focus-visible {
    background: #333;
    color: #fff;
}

.g5-profile-button:disabled,
.g5-profile-password-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.g5-profile-password-control {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 440px;
}

.g5-profile-password-control input {
    min-width: 0;
    border-right: 0 !important;
}

.g5-profile-password-toggle {
    flex: 0 0 auto;
    min-width: 66px;
    padding: 0 12px;
    border: 1px solid var(--g5-profile-strong);
    background: var(--g5-profile-soft-bg);
    color: inherit;
    font-size: 13px;
    font-weight: 600;
}

.g5-profile-password-toggle:hover,
.g5-profile-password-toggle:focus-visible,
.g5-profile-password-toggle[aria-pressed="true"] {
    background: var(--g5-profile-strong);
    color: #fff;
}

.g5-profile-password-strength {
    width: 100%;
    max-width: 440px;
    margin-top: 9px;
}

.g5-profile-password-strength-bar {
    display: block;
    width: 100%;
    height: 7px;
    overflow: hidden;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-soft-bg);
}

.g5-profile-password-strength-bar i {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    background: #9ca3af;
    transition: transform 0.18s ease, background 0.18s ease;
}

.g5-profile-password-strength strong {
    display: block;
    margin-top: 6px;
    font-size: 13px;
}

.g5-profile-password-strength.is-weak i {
    background: #b42318;
}

.g5-profile-password-strength.is-normal i {
    background: #b7791f;
}

.g5-profile-password-strength.is-good i {
    background: #2f855a;
}

.g5-profile-password-strength.is-strong i {
    background: #171717;
}

.g5-profile-password-match.is-valid {
    color: var(--g5-profile-success);
}

.g5-profile-password-match.is-invalid {
    color: var(--g5-profile-error);
}

.g5-profile-activity-panel {
    padding: clamp(20px, 4vw, 42px);
}

.g5-profile-activity-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--g5-profile-border);
}

.g5-profile-activity-content {
    min-width: 0;
}

.g5-profile-login-required {
    padding: 24px;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-bg);
}

@media (max-width: 760px) {
    .g5-profile-horizontal-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }

    .g5-profile-horizontal-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .g5-profile-vertical-layout {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .g5-profile-vertical-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding: 12px;
        border-bottom: 1px solid var(--g5-profile-strong);
        background: var(--g5-profile-soft-bg);
    }

    .g5-profile-vertical-tab {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap;
        border-left-width: 1px;
    }

    .g5-profile-vertical-tab.is-active {
        border-color: var(--g5-profile-strong);
        background: #fff;
    }

    .g5-profile-vertical-tab.is-active::after {
        display: none;
    }

    .g5-profile-vertical-panels {
        padding: 22px 16px 30px;
        border-left: 0;
    }

    .g5-profile-image-card {
        align-items: flex-start;
    }

    .g5-profile-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .g5-profile-field-half {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .g5-profile-horizontal-tab {
        padding: 10px 12px;
        font-size: 14px;
    }

    .g5-profile-image-card {
        flex-direction: column;
    }

    .g5-profile-image-preview-wrap {
        width: 96px;
        height: 96px;
    }

    .g5-profile-inline-actions,
    .g5-profile-form-actions {
        align-items: stretch;
    }

    .g5-profile-button {
        width: 100%;
    }
}

/* -------------------------------------------------------------------------
 * 프로필 확장을 사용하지 않을 때의 이전 단순 프로필
 * ---------------------------------------------------------------------- */
.g5-profile-legacy {
    max-width: 920px;
}

.g5-profile-legacy .g5-profile-header {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 24px;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-bg);
}

.g5-profile-legacy .g5-profile-avatar {
    flex: 0 0 auto;
}

.g5-profile-legacy .g5-profile-avatar img {
    display: block;
    max-width: none;
    border-radius: 50%;
}

.g5-profile-legacy .g5-profile-identity {
    min-width: 0;
    flex: 1;
}

.g5-profile-legacy .g5-profile-name {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

.g5-profile-legacy .g5-profile-email {
    margin: 5px 0 0;
    color: var(--g5-profile-muted);
    word-break: break-all;
}

.g5-profile-legacy .g5-profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.g5-profile-legacy .g5-profile-sections {
    display: grid;
    gap: 18px;
    margin-top: 22px;
}

.g5-profile-legacy .g5-profile-section {
    padding: 22px;
    border: 1px solid var(--g5-profile-border);
    background: var(--g5-profile-bg);
}

.g5-profile-legacy .g5-profile-section > h3 {
    margin: 0 0 14px;
    font-size: 18px;
}

@media (max-width: 640px) {
    .g5-profile-legacy .g5-profile-header {
        align-items: flex-start;
        padding: 18px;
    }

    .g5-profile-legacy .g5-profile-avatar img {
        width: 68px;
        height: 68px;
    }

    .g5-profile-legacy .g5-profile-name {
        font-size: 20px;
    }
}

.g5-profile-legacy .g5-profile-image-preview-wrap {
    flex: 0 0 auto;
}

.g5-profile-legacy .g5-profile-image-actions {
    margin-top: 12px;
}

@media (max-width: 640px) {
    .g5-profile-legacy .g5-profile-image-preview-wrap {
        width: 68px;
        height: 68px;
    }
}
