/* team-members-panel.css (variables-based) */

.tm-frame {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    padding: 19px 20px 20px;
    height: 100%;
}

.tm-frame::before {
    content: none !important;
}

.tm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.tm-title {
    margin: 0;
    font-weight: 600;
    font-size: var(--font-size-lg);
    line-height: 140%;
    color: var(--text-primary);
}

.tm-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: nowrap;
    margin-left: auto;
}

/* Buttons */
.tm-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 15px;

    min-height: 50px;
    padding: 10px 16px;

    border: 2px solid var(--accent-primary-hover);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;

    font-weight: 600;
    font-size: var(--font-size-md);
    line-height: 140%;
    color: var(--text-primary);

    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.tm-btn svg {
    width: 30px;
    height: 30px;
    color: var(--text-primary);
    flex: none;
}

.tm-btn--pending {
    width: 226px;
    max-width: 100%;
}

.tm-btn--invite {
    width: 191px;
    max-width: 100%;
}

.tm-badge {
    margin-left: auto;
    min-width: 26px;
    height: 22px;
    padding: 0 8px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    border: 1px solid var(--accent-primary-hover);
    background: var(--bg-septenary);
    color: var(--text-primary);

    font-size: 12px;
    font-weight: 600;
}

/* Sections */
.tm-section {
    margin-top: 18px;
    font-weight: 600;
    font-size: var(--font-size-md);
    line-height: 140%;
    color: var(--text-primary);
}

/* Grid */
.tm-grid {
    margin-top: 12px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, 279px);
    gap: 13px;
}

/* Card */
.tm-card {
    position: relative;
    width: 100%;
    max-width: 279px;
    height: 60px;
    box-sizing: border-box;

    background: var(--bg-octenennary-1);
    border: 1px solid var(--accent-primary-hover);
}

.tm-card__name {
    position: absolute;
    left: 20px;
    top: 9px;

    font-weight: 500;
    font-size: var(--font-size-md);
    line-height: 140%;
    color: var(--text-primary);
}

.tm-card__email {
    position: absolute;
    left: 20px;
    top: 36px;

    font-weight: 400;
    font-size: var(--font-size-xs);
    line-height: 140%;
    color: var(--text-muted);
}

.tm-card__more {
    position: absolute;
    right: 20px;
    top: calc(50% - 10px);

    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;

    color: var(--text-primary);
}

/* Overlay */
.tm-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay, rgba(0, 0, 0, 0.55));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

/* Modal */
.tm-invite-modal {
    position: relative;
    width: min(682px, calc(100vw - 48px));
    box-sizing: border-box;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;

    padding: 20px 16px;
    gap: 10px;

    background: var(--bg-invite-modal);
    border-radius: 20px;
}

/* Label */
.tm-invite-label {
    font-weight: 400;
    font-size: var(--font-size-md);
    line-height: 100%;
    color: var(--text-primary);
}

/* Input wrapper */
.tm-invite-input-wrap {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;

    display: flex;
    flex-direction: row;
    align-items: center;

    padding: 12px 16px;
    gap: 15px;

    background: var(--bg-input-surface, var(--bg-quattuordenenary)); /* dark: #22418C, light: #2FBED280 */
    border: 1px solid var(--accent-primary-hover);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

.tm-invite-input {
    width: 100%;
    min-height: 20px;
    border: none;
    outline: none;
    background: transparent;

    font-weight: 400;
    font-size: var(--font-size-md);
    line-height: 22px;
    color: var(--text-primary);

    box-sizing: border-box;
}

.tm-invite-input::placeholder {
    color: var(--text-secondary);
}

/* Error */
.tm-invite-error {
    font-size: var(--font-size-xs);
    line-height: 140%;
    color: var(--accent-alert);
}

/* Actions */
.tm-invite-actions {
    width: 100%;
    min-height: 40px;

    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;

    gap: 16px;
}

/* Buttons (adaptive width) */
.tm-invite-btn {
    height: 40px;
    padding: 12px 16px;
    border-radius: var(--radius-md);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-weight: 400;
    font-size: var(--font-size-md);
    line-height: 100%;
    white-space: nowrap;

    cursor: pointer;
    transition: opacity var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.tm-invite-btn--cancel {
    background: transparent;
    border: 1px solid var(--accent-primary-hover);
    color: var(--accent-primary-hover);
}

.tm-invite-btn--ok {
    background: var(--accent-primary-hover-invite);
    border: none;
    color: var(--text-seventhly-invite); /* dark: #FFFFFF, light: #10A37F (если не хочешь зелёный в light — см. ниже) */
}

.tm-invite-btn--ok:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Context menu (portal to body) — ONLY base vars + adaptive sizing */
.tm-menu {
    position: fixed;
    z-index: 20000;

    /* Adaptive width: close to 141px on desktop, but responsive on small screens */
    width: clamp(8.5rem, 22vw, 8.8125rem); /* 136px .. ~141px */
    max-width: calc(100vw - (var(--space-md) * 2));

    height: auto;

    background: var(--bg-octonary1); /* #111827 per your base */
    border: 1px solid var(--accent-primary-hover);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md); /* closest available (8px) from base */
    overflow: hidden;
    box-sizing: border-box;

    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.tm-menu[data-ready="1"] {
    opacity: 1;
    pointer-events: auto;
}

.tm-menu__item {
    width: 100%;

    /* Keep Figma row height but allow better tap targets on mobile */
    min-height: clamp(2.25rem, 5.5vw, 1.875rem); /* 36px -> 30px (desktop tends to 30) */
    padding: 0 var(--space-sm);

    display: block;
    align-items: center;

    border: none;
    background: transparent;
    cursor: pointer;

    font-weight: 400;
    font-size: var(--font-size-sm);
    line-height: 140%;
    color: var(--text-primary);
    text-align: left;

    transition: background-color var(--transition-fast), opacity var(--transition-fast);
    white-space: nowrap;
}

.tm-menu__item--sep {
    border-top: 1px solid var(--accent-primary-hover);
}

/* Hover/active using ONLY base vars */
.tm-menu__item:hover {
    background: var(--bg-quinquennary); /* #2698A8 in base */
}

.tm-menu__item:active {
    opacity: 0.9;
}

/* Extra safety for very narrow screens: allow wrapping */
@media (max-width: 360px) {
    .tm-menu__item {
        white-space: normal;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .tm-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tm-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 12px;
    }

    .tm-btn {
        width: 100%;
        justify-content: center;
    }

    .tm-grid {
        grid-template-columns: 1fr;
        padding-bottom: 10px;
    }

    .tm-card {
        max-width: 100%;
    }
}

.tm-frame.tm-frame--select {
    background: var(--bg-team-select);
}

.tm-bulk-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: var(--space-md);
}

.tm-bulk-btn {
    height: 30px;
    padding: 0 var(--space-sm);
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    line-height: 140%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tm-bulk-btn--primary {
    background: var(--accent-primary-hover-invite);
    color: var(--text-seventhly-invite);
    border: 1px solid var(--accent-primary-hover-invite);
}

.tm-bulk-btn--outline {
    background: transparent;
    color: var(--accent-primary-hover);
    border: 1px solid var(--accent-primary-hover);
}

.tm-bulk-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tm-btn:disabled,
.tm-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tm-card--select {
    background: var(--bg-octenennary-1);
    border: 1px solid var(--accent-primary-hover);
}

.tm-card--selected {
    background: var(--card-selected);
}

.tm-card__check {
    position: absolute;
    right: 20px;
    top: calc(50% - 20px / 2);
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1px solid var(--accent-primary-hover);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-seventhly);
    cursor: pointer;
}

.tm-card__check.is-checked {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

.tm-card__check svg {
    display: block;
}

.main-content--team-select {
    background: var(--bg-team-select);
}

/* Confirm Modal */
.cm-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    padding: 16px;
}

.cm-box {
    position: relative;
    width: 316px;
    min-height: 159px;
    background: var(--bg-member-card-body);
    border: 1px solid var(--accent-primary);
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    outline: none;
}

.cm-head {
    height: 40px;
    background: var(--bg-member-card-header);
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
}

.cm-title {
    font-size: 18px;
    line-height: 140%;
    color: var(--text-primary);
}

.cm-body {
    padding: 16px;
    padding-top: 12px;
}

.cm-text {
    font-weight: 400;
    font-size: 16px;
    line-height: 100%;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    min-height: 32px;
}

.cm-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.cm-btn {
    height: 40px;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 100%;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.cm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* No */
.cm-btn--outline {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--text-ninthly, #fff); /* в light у тебя text-ninthly = белый */
}

/* Yes */
.cm-btn--primary {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--text-ninthly, #fff); /* в light у тебя text-ninthly = белый */
}

.cm-btn--danger {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}


.tm-help {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tm-help__icon {
    cursor: pointer;
}

.tm-help__tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 8px);
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;

    width: 155px;
    height: 100px;

    background: #B3B3B3;

    font-family: Inter, sans-serif;
    font-weight: 300;
    font-size: 16px;
    line-height: 140%;
    color: #000;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.15s ease;
}

.tm-help:hover .tm-help__tooltip {
    opacity: 1;
    visibility: visible;
    transition-delay: 0.35s;
}

.tm-title {
    display: flex;
    align-items: center;
    gap: 16px; /* расстояние между "Team Member" и Total Seats */
}

.tm-title__seats {
    font-size: 16px;
    padding-top: 5px;
    font-weight: 400;
    color: var(--text-secondary);
    white-space: nowrap;
}


