.te-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--te-color-border);
    background: var(--te-color-card);
    color: var(--te-color-text);
    font-size: var(--te-font-size-base);
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.te-button:hover,
.te-button:focus {
    background: #f1f2f4;
    border-color: rgba(0, 0, 0, 0.16);
    color: var(--te-color-text);
    outline: none;
}

.te-button--primary {
    border-color: var(--te-color-accent);
    background: var(--te-color-accent);
    color: #ffffff;
}

.te-button--primary:hover,
.te-button--primary:focus {
    border-color: var(--te-color-accent);
    background: var(--te-color-accent);
    filter: brightness(0.92);
    color: #ffffff;
}

.te-button--danger {
    border-color: var(--te-color-danger);
    color: var(--te-color-danger);
    background: var(--te-color-card);
}

.te-button--danger:hover,
.te-button--danger:focus {
    background: var(--te-color-danger);
    border-color: var(--te-color-danger);
    color: #ffffff;
}

.te-button[disabled],
.te-button.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.te-card {
    background: var(--te-color-card);
    border: 1px solid var(--te-color-border);
}

.te-card__header {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--te-color-border);
}

.te-card__title {
    margin: 0;
    color: var(--te-color-primary);
    font-size: 14px;
    font-weight: 700;
}

.te-card__body {
    padding: 14px;
}

.te-kpi-card {
    background: var(--te-color-card);
    border: 1px solid var(--te-color-border);
    padding: 14px;
}

.te-kpi-card__label {
    margin: 0 0 8px;
    color: var(--te-color-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.te-kpi-card__value {
    margin: 0;
    color: var(--te-color-primary);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.te-kpi-card__meta {
    margin: 8px 0 0;
    color: var(--te-color-muted);
    font-size: 12px;
}

.te-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid var(--te-color-border);
    background: var(--te-color-card);
    color: var(--te-color-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.te-badge--success {
    border-color: rgba(46, 139, 87, 0.35);
    background: rgba(46, 139, 87, 0.08);
    color: #2e8b57;
}

.te-badge--warning {
    border-color: rgba(230, 126, 34, 0.35);
    background: rgba(230, 126, 34, 0.08);
    color: #b85f11;
}

.te-badge--danger {
    border-color: rgba(229, 62, 62, 0.35);
    background: rgba(229, 62, 62, 0.08);
    color: var(--te-color-danger);
}

.te-toast-stack {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    width: 320px;
    max-width: calc(100vw - 32px);
}

.te-toast {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 28px;
    column-gap: 8px;
    align-items: start;
    margin: 0 0 8px;
    padding: 12px;
    border: 1px solid var(--te-color-border);
    background: var(--te-color-card);
    color: var(--te-color-text);
}

.te-toast--success {
    border-color: rgba(46, 139, 87, 0.35);
}

.te-toast--warning {
    border-color: rgba(230, 126, 34, 0.35);
}

.te-toast--error {
    border-color: var(--te-color-danger);
}

.te-toast--info {
    border-color: var(--te-color-border);
}

.te-toast__content {
    min-width: 0;
}

.te-toast__title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
}

.te-toast__message {
    margin: 0;
    color: var(--te-color-muted);
    font-size: 12px;
    line-height: 1.4;
}

.te-toast__close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--te-color-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.te-toast__close:hover,
.te-toast__close:focus {
    color: var(--te-color-text);
    outline: none;
}

body.te-mb-modal-open {
    overflow: hidden;
}

.te-mb-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9990;
    background: rgba(0, 0, 0, 0.35);
}

.te-mb-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 9991;
    width: 520px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    transform: translate(-50%, -50%);
    background: var(--te-color-card);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    color: var(--te-color-text);
}

.te-mb-modal:focus {
    outline: none;
}

.te-mb-modal__header {
    min-height: 52px;
    display: grid;
    grid-template-columns: 1fr 36px;
    align-items: center;
    column-gap: 8px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.te-mb-modal__title {
    margin: 0;
    color: var(--te-color-primary);
    font-size: 17px;
    font-weight: 700;
}

.te-mb-modal__close {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--te-color-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.te-mb-modal__close:hover,
.te-mb-modal__close:focus {
    background: rgba(0, 0, 0, 0.06);
    color: var(--te-color-text);
    outline: none;
}

.te-mb-modal__body {
    min-height: 0;
    padding: 20px;
    overflow: auto;
}

.te-mb-modal__body p {
    margin: 0;
}

.te-mb-modal__footer {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 20px;
    background: var(--te-color-surface);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.te-skeleton {
    display: block;
    min-height: 16px;
    background: rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
    .te-toast-stack {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        max-width: none;
    }

    .te-mb-modal {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 48px);
        transform: none;
    }

    .te-mb-modal__footer {
        justify-content: stretch;
    }

    .te-mb-modal__footer .te-button {
        flex: 1;
    }
}