.portal-shell,
.portal-login-shell {
    min-height: 100vh;
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(47, 113, 255, 0.18), transparent 28%),
        linear-gradient(180deg, #f5f7fb 0%, #e9eef8 100%);
    color: #172033;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding: 1.25rem 2rem;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1 1 auto;
    min-width: 0;
}

.portal-logo {
    color: #172033;
    line-height: 0;
}

.portal-brand__tagline {
    margin: 0;
    white-space: nowrap;
    font-size: 0.92rem;
    line-height: 1.4;
    color: #4f5f7d;
}

.portal-logo svg {
    display: block;
    width: 220px;
    max-width: 100%;
    height: auto;
}

.portal-logo--login {
    margin-bottom: 1.25rem;
}

.portal-auth-switch {
    margin-top: 1rem;
}

.portal-kicker {
    display: block;
    margin: 0 0 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    color: #4a6bb3;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 0 0 auto;
}

.portal-nav a,
.portal-pill,
code {
    color: #172033;
}

.portal-theme-picker select {
    min-height: 2.2rem;
    border: 1px solid rgba(23, 32, 51, 0.2);
    border-radius: 999px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.9);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23172033' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M1.25 1.25 6 6l4.75-4.75'/%3E%3C/svg%3E");
    background-position: right 0.9rem center;
    background-repeat: no-repeat;
    background-size: 0.75rem auto;
    color: #172033;
    font-size: 0.88rem;
    padding: 0.35rem 1.9rem 0.35rem 0.8rem;
    outline: none;
}

.portal-theme-picker select:focus {
    border-color: #245bca;
    box-shadow: 0 0 0 3px rgba(36, 91, 202, 0.18);
}

.portal-main,
.portal-login {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto 3rem;
}

.portal-page,
.portal-login__panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(23, 32, 51, 0.08);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(23, 32, 51, 0.08);
    padding: 2rem;
}

.portal-login {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.portal-login__panel {
    width: min(480px, 100%);
}

.portal-page__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.portal-pill {
    background: #e8eefc;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
}

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

.portal-grid--stacked {
    grid-template-columns: 1fr;
}

.portal-grid--report-summary {
    margin-top: 1.25rem;
}

.portal-card {
    background: #fff;
    border: 1px solid rgba(23, 32, 51, 0.08);
    border-radius: 20px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.portal-card--highlight {
    border-color: rgba(47, 113, 255, 0.25);
    background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
}

.portal-card--usage {
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.portal-card--status-active {
    border-color: rgba(27, 122, 74, 0.2);
    background: linear-gradient(180deg, #ffffff 0%, #f2fbf6 100%);
}

.portal-card--status-trialing {
    border-color: rgba(37, 92, 183, 0.2);
    background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
}

.portal-card--status-warning {
    border-color: rgba(166, 118, 24, 0.24);
    background: linear-gradient(180deg, #ffffff 0%, #fff9eb 100%);
}

.portal-card--status-canceled {
    border-color: rgba(157, 31, 31, 0.18);
    background: linear-gradient(180deg, #ffffff 0%, #fff4f4 100%);
}

.portal-card--status-neutral {
    background: linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
}

.portal-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.portal-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
}

.portal-status-pill__icon {
    display: inline-flex;
    width: 1rem;
    height: 1rem;
}

.portal-status-pill__icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.portal-status-pill--active {
    background: #e8f6ee;
    color: #1b7a4a;
}

.portal-status-pill--trialing {
    background: #e8eefc;
    color: #255cb7;
}

.portal-status-pill--warning {
    background: #fff1cc;
    color: #9a6700;
}

.portal-status-pill--canceled {
    background: #fdecec;
    color: #9d1f1f;
}

.portal-status-pill--neutral {
    background: #eef2f8;
    color: #5d6982;
}

.portal-status-pill--plan {
    background: #e8eefc;
    color: #255cb7;
}

.portal-status-pill__divider {
    width: 0.25rem;
    height: 0.25rem;
    border-radius: 999rem;
    background: currentColor;
    opacity: 0.45;
}

.portal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.portal-inline-spacing-md {
    margin-bottom: 1rem;
}

.portal-input--quantity {
    max-width: 4.75rem;
    margin-bottom: 0.5rem;
}

.portal-qr-image {
    max-width: 220px;
    height: auto;
}

.portal-danger {
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid rgba(157, 31, 31, 0.18);
    border-radius: 16px;
    background: #fff4f4;
}

.portal-danger__label {
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    color: #9d1f1f;
}

.portal-list {
    margin: 1rem 0 0;
    padding-left: 1.2rem;
}

.portal-list--tokens,
.portal-list--activations {
    list-style: none;
    padding-left: 0;
}

.portal-list--tokens li,
.portal-list--activations li {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    padding: 0.9rem 0;
    border-top: 1px solid rgba(23, 32, 51, 0.08);
}

.portal-list--tokens li:first-child,
.portal-list--activations li:first-child {
    border-top: 0;
    padding-top: 0;
}

.portal-list--tokens li:last-child,
.portal-list--activations li:last-child {
    padding-bottom: 0;
}

.portal-list--tokens strong,
.portal-list--activations strong {
    display: block;
    margin-bottom: 0.25rem;
}

.portal-list--activations span {
    color: #4f5f7d;
}

.portal-profile-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.portal-profile-summary--align-right {
    text-align: right;
}

.portal-profile-summary__title,
.portal-profile-summary__line {
    margin: 0;
}

.portal-profile-summary__title {
    color: #245bca;
    font-weight: 600;
}

.portal-profile-summary__line {
    color: #4f5f7d;
    white-space: nowrap;
}

.portal-profile-summary__line strong {
    display: inline;
    margin-bottom: 0;
}

.portal-license-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
    margin: 1rem 0 0;
}

.portal-license-meta p {
    margin: 0;
}

@media (max-width: 720px) {
    .portal-list--tokens li,
    .portal-list--activations li {
        flex-direction: column;
    }

    .portal-profile-summary--align-right {
        text-align: left;
    }
}

.portal-list li {
    margin-bottom: 0.75rem;
}

.portal-form .input,
.portal-form .select,
.portal-form .button {
    min-height: 3rem;
}

.portal-plan-card {
    margin-bottom: 0;
}

.portal-plan-card__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.portal-plan-card__copy {
    flex: 1 1 auto;
    min-width: 0;
}

.portal-plan-card__copy .portal-kicker {
    margin-bottom: 0.5rem;
}

.portal-plan-card__copy p:last-child {
    margin-bottom: 0;
}

.portal-plan-card__action {
    flex: 0 0 auto;
}

.portal-subtitle {
    margin-bottom: 1.5rem;
    color: #4f5f7d;
}

.portal-meter {
    margin: 1rem 0 0.85rem;
}

.portal-meter__track {
    display: block;
    width: 100%;
    height: 0.8rem;
    border-radius: 999px;
    background: #e3ebfb;
    overflow: hidden;
}

.portal-meter__fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #245bca 0%, #5d93ff 100%);
}

.portal-inline-notice {
    margin-top: 0.85rem;
    color: #5b6f97;
}

.portal-inline-meta {
    color: #6b7893;
}

.portal-inline-meta--alert {
    color: #9d1f1f;
}

.portal-card strong {
    color: #172033;
}

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

.portal-table-wrap--compact {
    margin-bottom: 0.9rem;
}

.portal-table {
    width: 100%;
    border-collapse: collapse;
}

.portal-table--compact th,
.portal-table--compact td {
    padding: 0.45rem 0.5rem;
}

.portal-table--compact th:first-child,
.portal-table--compact td:first-child {
    padding-left: 0;
}

.portal-table--compact th:last-child,
.portal-table--compact td:last-child {
    padding-right: 0;
}

.portal-billing-summary-line {
    margin: 0.35rem 0 0;
}

.portal-table th,
.portal-table td {
    padding: 0.45rem 0.375rem;
    border-top: 1px solid rgba(23, 32, 51, 0.08);
    text-align: left;
    vertical-align: middle;
}

.portal-table thead th {
    border-top: 0;
    color: #4f5f7d;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.portal-sort-link {
    color: inherit;
    text-decoration: none;
}

.portal-sort-link:hover {
    color: #245bca;
}

.portal-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 1rem;
}

.portal-subnav__link {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid rgba(23, 32, 51, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: #172033;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
}

.portal-subnav__link:hover {
    border-color: rgba(36, 91, 202, 0.3);
    color: #245bca;
}

.portal-subnav__link.is-active {
    border-color: rgba(36, 91, 202, 0.24);
    background: #e8eefc;
    color: #245bca;
}

.portal-table tbody tr.is-highlighted {
    background: #f6f9ff;
}

.portal-note-panel {
    width: 100%;
    overflow-wrap: anywhere;
    color: #172033;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    user-select: text;
}

.portal-note-panel p {
    margin: 0;
}

.portal-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #e8eefc;
    color: #245bca;
    font-size: 0.78rem;
}

.portal-muted {
    color: #6b7893;
}

.alert {
    border-radius: 14px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #e7f8ee;
    color: #0d6b3d;
}

.alert-danger {
    background: #fdecec;
    color: #9d1f1f;
}

.alert-warning {
    background: #fff5d7;
    color: #8a6312;
}

.alert-info {
    background: #eaf3ff;
    color: #1e4d8f;
}

html[data-theme="dark"] .portal-shell,
html[data-theme="dark"] .portal-login-shell {
    background:
        radial-gradient(circle at top left, rgba(103, 154, 255, 0.16), transparent 32%),
        linear-gradient(180deg, #121821 0%, #0a0f17 100%);
    color: #dbe5f8;
}

html[data-theme="dark"] .portal-logo,
html[data-theme="dark"] .portal-nav a,
html[data-theme="dark"] .portal-pill,
html[data-theme="dark"] code,
html[data-theme="dark"] .portal-card strong {
    color: #e6eeff;
}

html[data-theme="dark"] .portal-brand__tagline,
html[data-theme="dark"] .portal-subtitle,
html[data-theme="dark"] .portal-inline-notice,
html[data-theme="dark"] .portal-inline-meta,
html[data-theme="dark"] .portal-muted,
html[data-theme="dark"] .portal-list--activations span,
html[data-theme="dark"] .portal-table thead th {
    color: #aebcda;
}

html[data-theme="dark"] .portal-profile-summary__title {
    color: #8fb4ff;
}

html[data-theme="dark"] .portal-page,
html[data-theme="dark"] .portal-login__panel {
    background: rgba(14, 20, 31, 0.9);
    border-color: rgba(175, 197, 235, 0.2);
    box-shadow: 0 22px 46px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .portal-card {
    background: #121a28;
    border-color: rgba(175, 197, 235, 0.2);
}

html[data-theme="dark"] .portal-card--highlight {
    border-color: rgba(93, 147, 255, 0.4);
    background: linear-gradient(180deg, #152038 0%, #10182a 100%);
}

html[data-theme="dark"] .portal-card--usage {
    background: linear-gradient(180deg, #132033 0%, #10182a 100%);
}

html[data-theme="dark"] .portal-card--status-active {
    border-color: rgba(79, 203, 134, 0.4);
    background: linear-gradient(180deg, #10231b 0%, #0f1a18 100%);
}

html[data-theme="dark"] .portal-card--status-trialing {
    border-color: rgba(109, 156, 255, 0.4);
    background: linear-gradient(180deg, #10213c 0%, #0f1a2e 100%);
}

html[data-theme="dark"] .portal-card--status-warning {
    border-color: rgba(223, 180, 73, 0.45);
    background: linear-gradient(180deg, #2b2010 0%, #241a0e 100%);
}

html[data-theme="dark"] .portal-card--status-canceled {
    border-color: rgba(230, 113, 113, 0.4);
    background: linear-gradient(180deg, #2c1417 0%, #241014 100%);
}

html[data-theme="dark"] .portal-card--status-neutral {
    background: linear-gradient(180deg, #182030 0%, #131c2c 100%);
}

html[data-theme="dark"] .portal-pill {
    background: #1d2c47;
}

html[data-theme="dark"] .portal-kicker {
    color: #88adff;
}

html[data-theme="dark"] .portal-status-pill--active {
    background: #173726;
    color: #85dfb1;
}

html[data-theme="dark"] .portal-status-pill--trialing,
html[data-theme="dark"] .portal-status-pill--plan {
    background: #1d2c47;
    color: #a8c4ff;
}

html[data-theme="dark"] .portal-status-pill--warning {
    background: #3a2e14;
    color: #f2cc77;
}

html[data-theme="dark"] .portal-status-pill--canceled {
    background: #3c1b22;
    color: #f2a8b4;
}

html[data-theme="dark"] .portal-status-pill--neutral {
    background: #273245;
    color: #becced;
}

html[data-theme="dark"] .portal-danger {
    border-color: rgba(230, 113, 113, 0.4);
    background: #2b131a;
}

html[data-theme="dark"] .portal-danger__label,
html[data-theme="dark"] .portal-inline-meta--alert {
    color: #f2a8b4;
}

html[data-theme="dark"] .portal-meter__track {
    background: #27344f;
}

html[data-theme="dark"] .portal-meter__fill {
    background: linear-gradient(90deg, #4a81ef 0%, #7ca8ff 100%);
}

html[data-theme="dark"] .portal-list--tokens li,
html[data-theme="dark"] .portal-list--activations li,
html[data-theme="dark"] .portal-table th,
html[data-theme="dark"] .portal-table td {
    border-top-color: rgba(175, 197, 235, 0.2);
}

html[data-theme="dark"] .portal-table tbody tr.is-highlighted {
    background: rgba(93, 147, 255, 0.14);
}

html[data-theme="dark"] .portal-note-panel {
    color: #e6eeff;
}

html[data-theme="dark"] .portal-badge {
    background: #1d2c47;
    color: #a8c4ff;
}

html[data-theme="dark"] .alert-success {
    background: #153522;
    color: #8de0b6;
}

html[data-theme="dark"] .alert-danger {
    background: #3a161b;
    color: #f2a8b4;
}

html[data-theme="dark"] .alert-warning {
    background: #3a2d15;
    color: #f5d489;
}

html[data-theme="dark"] .alert-info {
    background: #1a2e49;
    color: #a8c4ff;
}

html[data-theme="dark"] .portal-theme-picker select {
    border-color: rgba(175, 197, 235, 0.35);
    background-color: #1a263c;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23e6eeff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M1.25 1.25 6 6l4.75-4.75'/%3E%3C/svg%3E");
    color: #e6eeff;
}

html[data-theme="dark"] .portal-theme-picker select:focus {
    border-color: #7ca8ff;
    box-shadow: 0 0 0 3px rgba(124, 168, 255, 0.2);
}

@media (max-width: 768px) {
    .portal-header,
    .portal-page__head,
    .portal-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-brand {
        align-items: flex-start;
    }

    .portal-brand__tagline {
        display: none;
    }

    .portal-nav {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .portal-plan-card__body {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-main,
    .portal-login {
        width: min(100% - 1rem, 1100px);
    }
}
