.bmi-btn {
    position: fixed;
    z-index: 100120 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    margin: 0;
    border: 0;
    border-radius: var(--bmi-button-radius, 999px);
    padding: 10px 14px;
    background: var(--bmi-button-bg, #111827);
    color: var(--bmi-button-text, #fff);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.26);
    transition: filter 0.16s ease, transform 0.16s ease;
}

.bmi-btn:hover,
.bmi-btn:focus-visible {
    filter: brightness(0.94);
}

.bmi-btn:focus-visible {
    outline: 2px solid #111827;
    outline-offset: 2px;
}

.bmi-btn:active {
    transform: translateY(1px);
}

.bmi-btn.pos-top-left {
    top: var(--bmi-button-offset-y, 16px);
    right: auto;
    bottom: auto;
    left: var(--bmi-button-offset-x, 16px);
}

.bmi-btn.pos-top-right {
    top: var(--bmi-button-offset-y, 16px);
    right: var(--bmi-button-offset-x, 16px);
    bottom: auto;
    left: auto;
}

body.admin-bar .bmi-btn.pos-top-left,
body.admin-bar .bmi-btn.pos-top-right {
    top: calc(var(--bmi-button-offset-y, 16px) + 32px);
}

.bmi-btn.pos-bottom-left {
    top: auto;
    bottom: var(--bmi-button-offset-y, 16px);
    right: auto;
    left: var(--bmi-button-offset-x, 16px);
}

.bmi-btn.pos-bottom-right {
    top: auto;
    bottom: var(--bmi-button-offset-y, 16px);
    left: auto;
    right: var(--bmi-button-offset-x, 16px);
}

.bmi-modal {
    position: fixed;
    inset: 0;
    z-index: 100130 !important;
    display: none;
}

.bmi-modal.is-open {
    display: block;
}

.bmi-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.52);
}

.bmi-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(860px, calc(100vw - 24px));
    max-height: calc(100vh - 28px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bmi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
}

.bmi-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: #111827;
}

.bmi-close {
    border: 0;
    background: #111827;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.bmi-content {
    padding: 12px 14px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bmi-content::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.bmi-loading {
    margin: 0;
    font-size: 13px;
    color: #4b5563;
}

.bmi-user {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

.bmi-user-avatar {
    flex: 0 0 auto;
}

.bmi-user-avatar img {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.bmi-user-main {
    flex: 1 1 240px;
    min-width: 0;
}

.bmi-user-title-row {
    display: flex;
    align-items: center;
    min-height: 26px;
}

.bmi-user-title-row strong {
    display: block;
    font-size: 14px;
    color: #111827;
}

.bmi-user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.bmi-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 8px;
    border: 1px solid #dbe2ea;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
}

.bmi-summary-chip strong {
    color: #111827;
    font-weight: 700;
}

.bmi-user-bio {
    margin-top: 8px;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.55;
    color: #374151;
}

.bmi-user > .bmi-actions {
    margin-top: 0;
    margin-left: auto;
    align-self: flex-start;
}

.bmi-sections {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.bmi-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

.bmi-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
}

.bmi-section-head h3 {
    margin: 0;
    font-size: 14px;
    color: #111827;
}

.bmi-count {
    font-size: 12px;
    color: #6b7280;
}

.bmi-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bmi-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.bmi-item:last-child {
    border-bottom: 0;
}

.bmi-row-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}

.bmi-row-link {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    cursor: pointer;
    text-align: left;
}

.bmi-row-link:hover,
.bmi-row-link:focus-visible {
    color: #2563eb;
    text-decoration: underline;
    outline: none;
}

.bmi-row-sub {
    margin-top: 3px;
    font-size: 12px;
    color: #4b5563;
}

.bmi-row-meta {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #6b7280;
}

.bmi-row-comment {
    margin-top: 6px;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.45;
    color: #111827;
}

.bmi-images {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
}

.bmi-images img {
    width: 62px;
    height: 62px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
}

.bmi-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.bmi-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 6px 10px;
    color: #111827;
    text-decoration: none;
    font-size: 12px;
    background: #fff;
}

.bmi-actions .bmi-page-btn {
    border-radius: 999px;
    padding: 6px 10px;
}

.bmi-actions .bmi-primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #111827;
    border-radius: 999px;
    padding: 6px 12px;
    color: #fff;
    font-size: 12px;
    background: #111827;
    cursor: pointer;
}

.bmi-actions .bmi-primary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.bmi-actions .bmi-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    padding: 2px;
    color: #b91c1c;
    font-size: 16px;
    line-height: 1;
    background: transparent;
    cursor: pointer;
}

.bmi-actions .bmi-delete-btn:hover {
    opacity: 0.8;
}

.bmi-actions .bmi-delete-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.bmi-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

.bmi-page-label {
    font-size: 12px;
    color: #4b5563;
}

.bmi-page-btn {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    padding: 5px 9px;
    font-size: 12px;
    cursor: pointer;
}

.bmi-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bmi-empty {
    padding: 14px 12px;
    font-size: 13px;
    color: #6b7280;
}

.bmi-login-box {
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    padding: 14px;
    background: #f9fafb;
    font-size: 13px;
    color: #4b5563;
}

.bmi-profile-page {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bmi-profile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.bmi-profile-top h3 {
    margin: 0;
    color: #111827;
    font-size: 16px;
}

.bmi-profile-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.bmi-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bmi-field span {
    font-size: 12px;
    color: #4b5563;
}

.bmi-field input,
.bmi-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
    font-size: 13px;
    color: #111827;
}

.bmi-profile-status {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
}

.bmi-profile-status.is-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.bmi-profile-status.is-error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.bmi-danger-box {
    border: 1px solid #fecaca;
    border-radius: 12px;
    background: #fef2f2;
    padding: 12px;
}

.bmi-danger-box h4 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #991b1b;
}

.bmi-danger-box p {
    margin: 0 0 8px;
    font-size: 12px;
    color: #7f1d1d;
}

.bmi-danger-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bmi-danger-controls input {
    flex: 1 1 210px;
    min-width: 160px;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    background: #fff;
    padding: 8px 10px;
    font-size: 13px;
}

.bmi-danger-btn {
    border: 1px solid #dc2626;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
}

.bmi-danger-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (max-width: 800px) {
    .bmi-panel {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .bmi-sections {
        grid-template-columns: minmax(0, 1fr);
    }

    .bmi-btn.pos-top-left,
    .bmi-btn.pos-top-right {
        top: var(--bmi-button-offset-y, 16px);
    }

    body.admin-bar .bmi-btn.pos-top-left,
    body.admin-bar .bmi-btn.pos-top-right {
        top: calc(var(--bmi-button-offset-y, 16px) + 46px);
    }

    .bmi-btn.pos-bottom-left,
    .bmi-btn.pos-bottom-right {
        bottom: var(--bmi-button-offset-y, 16px);
    }

    .bmi-user-avatar img {
        width: 44px;
        height: 44px;
    }

    .bmi-user > .bmi-actions {
        width: 100%;
        margin-left: 0;
    }
}
