.tr-login-panel,
.tr-portal {
    box-sizing: border-box;
    color: #0a192f;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    margin: 0 auto;
    max-width: 1080px;
    padding: 48px 22px 72px;
    width: min(1080px, calc(100vw - 56px));
}

.tr-login-panel {
    max-width: 460px;
}

.tr-login-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tr-login-notice,
.tr-login-error {
    border-radius: 7px;
    font-weight: 700;
    margin: 16px 0;
    padding: 12px 14px;
}

.tr-login-notice {
    background: rgba(0, 210, 255, 0.12);
    border-left: 4px solid #00d2ff;
    color: #0a192f;
}

.tr-login-error {
    background: #fff1f2;
    border-left: 4px solid #e11d48;
    color: #7f1d1d;
}

.wp-block-post-content > .tr-portal {
    margin-left: auto !important;
    margin-right: auto !important;
    position: static;
    transform: none;
}

body:has(.tr-portal) .wp-block-post-title {
    box-sizing: border-box;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 1080px;
    text-align: left;
    width: min(1080px, calc(100vw - 56px));
}

.tr-login-panel h1,
.tr-portal h1,
.tr-portal h2 {
    letter-spacing: 0;
}

.tr-login-panel form,
.tr-portal-panel {
    background: #ffffff;
    border: 1px solid rgba(10, 25, 47, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(10, 25, 47, 0.08);
}

.tr-login-panel form {
    margin-top: 22px;
    padding: 22px;
}

.tr-login-panel label,
.tr-portal .tr-field {
    display: block;
    font-weight: 700;
    margin-bottom: 14px;
}

.tr-login-panel .tr-login-remember {
    align-items: center;
    display: flex;
    gap: 8px;
}

.tr-login-panel .tr-login-remember input {
    min-height: 0;
    width: auto;
}

.tr-current-owner {
    background: #f8fafc;
    border: 1px solid rgba(10, 25, 47, 0.12);
    border-radius: 7px;
    margin: 0 0 16px;
    padding: 12px 14px;
}

.tr-current-owner strong,
.tr-current-owner span,
.tr-current-owner small {
    display: block;
}

.tr-current-owner strong {
    color: #5a30ec;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tr-current-owner span {
    font-weight: 800;
    margin-top: 4px;
}

.tr-current-owner small {
    color: #8892b0;
    font-weight: 600;
    margin-top: 2px;
}

.tr-login-panel input[type="text"],
.tr-login-panel input[type="password"],
.tr-portal input,
.tr-portal select,
.tr-portal textarea {
    border: 1px solid rgba(10, 25, 47, 0.18);
    border-radius: 7px;
    box-sizing: border-box;
    font: inherit;
    max-width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    resize: vertical;
    width: 100%;
}

.tr-login-panel .button,
.tr-portal-button {
    background: #00d2ff;
    border: 0;
    border-radius: 7px;
    color: #0a192f;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    min-height: 42px;
    padding: 11px 16px;
    text-decoration: none;
}

.tr-audio-upload audio {
    display: block;
    margin: 8px 0 10px;
    max-width: 420px;
    width: 100%;
}

.tr-subscription-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tr-subscription-metric {
    background: #f8fafc;
    border: 1px solid rgba(10, 25, 47, 0.1);
    border-radius: 8px;
    padding: 14px;
}

.tr-subscription-metric span,
.tr-subscription-metric small {
    color: #64708b;
    display: block;
    font-size: 0.86rem;
    font-weight: 650;
}

.tr-subscription-metric strong {
    display: block;
    font-size: 1.08rem;
    margin: 5px 0;
}

.tr-usage-meter {
    align-items: center;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(170px, 260px) 1fr;
    margin: 18px 0;
}

.tr-usage-meter strong {
    display: block;
    font-size: 1.1rem;
}

.tr-usage-meter span {
    color: #64708b;
}

.tr-usage-bar {
    background: #e5e7eb;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.tr-usage-bar span {
    background: #00d2ff;
    display: block;
    height: 100%;
}

.tr-usage-warning .tr-usage-bar span {
    background: #f59e0b;
}

.tr-usage-over .tr-usage-bar span {
    background: #ef4444;
}

.tr-usage-note {
    border-left: 4px solid #00d2ff;
}

.tr-usage-note-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
    color: #78350f;
}

.tr-usage-note-danger {
    background: #fef2f2;
    border-left-color: #ef4444;
    color: #7f1d1d;
}

.tr-portal-hero {
    background: #0a192f;
    border-radius: 8px;
    color: #ffffff;
    margin-bottom: 22px;
    padding: 28px;
}

.tr-portal-hero p,
.tr-portal-panel-head p {
    color: #5a30ec;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 0 0 7px;
    text-transform: uppercase;
}

.tr-portal-hero h1 {
    color: #ffffff;
    margin: 0 0 8px;
}

.tr-portal-hero span {
    color: rgba(255, 255, 255, 0.78);
}

.tr-portal-panel {
    margin: 22px 0;
    padding: 22px;
}

.tr-portal-panel-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.tr-portal-panel-head h2 {
    margin: 0;
}

.tr-portal-panel-head > span {
    background: rgba(0, 210, 255, 0.12);
    border-radius: 999px;
    font-weight: 800;
    padding: 6px 11px;
}

.tr-portal-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tr-portal .tr-field span {
    display: block;
    margin-bottom: 6px;
}

.tr-portal .tr-static-field {
    background: #f8fafc;
    border: 1px solid rgba(10, 25, 47, 0.12);
    border-radius: 7px;
    box-sizing: border-box;
    color: #0a192f;
    font-weight: 700;
    min-height: 42px;
    padding: 10px 11px;
    width: 100%;
}

.tr-portal .tr-field em {
    color: #8892b0;
    display: block;
    font-size: 0.92rem;
    font-style: normal;
    font-weight: 500;
    line-height: 1.45;
    margin: -2px 0 8px;
}

.tr-portal-note {
    background: rgba(0, 210, 255, 0.1);
    border-left: 4px solid #00d2ff;
    border-radius: 7px;
    color: #0a192f;
    margin: 0 0 16px;
    padding: 12px 14px;
}

.tr-welcome-editor {
    display: grid;
    gap: 12px;
}

.tr-template-select {
    background: #ffffff;
    border: 1px solid rgba(10, 25, 47, 0.16);
    border-radius: 7px;
    color: #0a192f;
    font: inherit;
    font-weight: 700;
    margin: 0 0 10px;
    min-height: 42px;
    padding: 8px 10px;
    width: min(100%, 420px);
}

.tr-compliance-box {
    background: #f8fafc;
    border: 1px solid rgba(10, 25, 47, 0.1);
    border-left: 4px solid #5a30ec;
    border-radius: 7px;
    color: #0a192f;
    padding: 13px 14px;
}

.tr-compliance-box strong {
    display: block;
    margin-bottom: 5px;
}

.tr-compliance-box p,
.tr-compliance-warning {
    line-height: 1.5;
    margin: 0;
}

.tr-compliance-warning {
    background: #fffbeb;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-left: 4px solid #f59e0b;
    border-radius: 7px;
    color: #78350f;
    padding: 11px 13px;
}

.tr-portal-masked,
.tr-portal-muted {
    color: #8892b0;
    font-weight: 700;
}

.tr-portal .tr-phone {
    display: grid;
    gap: 8px;
    grid-template-columns: 158px minmax(140px, 260px);
}

.tr-portal .tr-phone select {
    min-width: 158px;
}

.tr-portal-check {
    display: block;
    font-weight: 700;
    margin: 10px 0 18px;
}

.tr-portal-check input {
    min-height: 0;
    width: auto;
}

.tr-portal-table-wrap {
    overflow-x: auto;
}

.tr-portal-table {
    border-collapse: collapse;
    min-width: 860px;
    width: 100%;
}

.tr-portal-table th,
.tr-portal-table td {
    border-bottom: 1px solid rgba(10, 25, 47, 0.09);
    padding: 11px 9px;
    text-align: left;
    vertical-align: middle;
}

.tr-portal-table th {
    color: #8892b0;
    font-size: 0.82rem;
    text-transform: uppercase;
}

.tr-portal-table td span {
    color: #8892b0;
    font-size: 0.9rem;
}

.tr-portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tr-portal-actions form {
    margin: 0;
}

.tr-portal-actions button,
.tr-portal-link {
    background: transparent;
    border: 1px solid rgba(10, 25, 47, 0.18);
    border-radius: 7px;
    color: #0a192f;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 7px 10px;
    text-decoration: none;
}

.tr-portal-actions .tr-portal-danger {
    border-color: rgba(220, 38, 38, 0.34);
    color: #991b1b;
}

.tr-partner-portal .tr-selected-row {
    background: rgba(0, 210, 255, 0.08);
}

.tr-partner-nav {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.tr-partner-nav a {
    background: #ffffff;
    border: 1px solid rgba(10, 25, 47, 0.14);
    border-radius: 8px;
    color: #0a192f;
    font-weight: 800;
    padding: 11px 16px;
    text-decoration: none;
}

.tr-partner-nav a.is-active {
    background: #0a192f;
    border-color: #0a192f;
    color: #ffffff;
}

.tr-partner-picker {
    align-items: flex-end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 1fr) auto;
}

.tr-partner-picker label span {
    color: #8892b0;
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.tr-partner-picker select {
    background: #ffffff;
    border: 1px solid rgba(10, 25, 47, 0.18);
    border-radius: 7px;
    color: #0a192f;
    font: inherit;
    min-height: 44px;
    padding: 9px 11px;
    width: 100%;
}

.tr-partner-company-table th:nth-child(1),
.tr-partner-company-table td:nth-child(1) {
    min-width: 190px;
}

.tr-partner-company-table th:nth-child(2),
.tr-partner-company-table td:nth-child(2) {
    min-width: 220px;
}

.tr-partner-metrics .tr-subscription-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (max-width: 720px) {
    .tr-login-panel,
    .tr-portal {
        padding: 32px 22px 54px;
        width: 100%;
    }

    .wp-block-post-content > .tr-portal {
        margin-left: auto;
        margin-right: auto;
        transform: none;
    }

    body:has(.tr-portal) .wp-block-post-title {
        width: calc(100vw - 44px);
    }

    .tr-portal-panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .tr-portal-grid,
    .tr-portal .tr-phone,
    .tr-partner-picker,
    .tr-subscription-grid,
    .tr-usage-meter {
        grid-template-columns: 1fr;
    }

    .tr-partner-nav {
        flex-direction: column;
    }
}
