html {
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    background: #f8fafc;
    color: #0f172a;
    font-size: 13px !important;
}

.app-shell {
    min-height: 100vh;
    background: #f8fafc;
}

.app-sidebar {
    width: 256px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
}

.app-main {
    min-width: 0;
    flex: 1;
}

.app-content {
    padding: 2rem;
}

.layout-admin-header {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 30;
}

.layout-admin-header-left,
.layout-admin-header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.layout-admin-header-left {
    min-width: 0;
}

.layout-brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.layout-brand-logo {
    height: 1.5rem;
    width: auto;
}

.layout-header-divider {
    width: 1px;
    height: 1.5rem;
    background: #e2e8f0;
}

.layout-sidebar-brand {
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    min-height: 64px;
    flex-shrink: 0;
}

.layout-sidebar-brand-divider {
    height: 1px;
    margin: 0 1.25rem;
    background: #e2e8f0;
    flex-shrink: 0;
}

.layout-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.layout-role-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
    animation: layout-pulse 1.8s infinite;
}

@keyframes layout-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.layout-icon-button,
.layout-profile-trigger {
    border: 0;
    background: #fff;
    padding: 0;
}

.layout-icon-button {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.layout-icon-button:hover,
.layout-profile-trigger:hover {
    background: #f8fafc;
    color: #0f172a;
}

.layout-alert-dot {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: #ef4444;
    border: 2px solid #fff;
}

.layout-profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s ease;
}

.layout-profile-menu {
    position: relative;
}

.layout-profile-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.layout-profile-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.layout-profile-alias {
    font-size: 0.625rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.layout-profile-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.layout-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-nav-icon {
    width: 1.125rem;
    height: 1.125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.layout-nav-icon svg {
    width: 100%;
    height: 100%;
}

.layout-profile-chevron {
    color: #94a3b8;
}

.layout-profile-dropdown {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    min-width: 12rem;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    z-index: 40;
}

.layout-profile-dropdown-item {
    width: 100%;
    display: block;
    padding: 0.625rem 0.75rem;
    border: 0;
    border-radius: 0.625rem;
    background: transparent;
    color: #334155;
    text-align: left;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.layout-profile-dropdown-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.layout-profile-dropdown-item.is-danger {
    color: #dc2626;
}

.layout-profile-dropdown-item.is-danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.layout-profile-dropdown-divider {
    height: 1px;
    margin: 0.375rem 0;
    background: #e2e8f0;
}

.layout-admin-sidebar {
    width: 16rem;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    z-index: 20;
}

.layout-sidebar-nav {
    flex: 1;
    padding: 0.875rem 0.625rem 0.875rem;
    overflow-x: hidden;
    overflow-y: hidden;
}

.layout-sidebar-section {
    padding: 0 0.75rem;
    margin-bottom: 0.25rem;
    color: #94a3b8;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.layout-sidebar-section-secondary {
    margin-top: 1.25rem;
}

.layout-nav-entry,
.layout-logout-entry {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.layout-nav-group {
    margin-top: 0.125rem;
}

.layout-nav-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: #475569;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.layout-nav-toggle:hover {
    background: #f8fafc;
    color: #0f172a;
}

.layout-nav-toggle.is-coming-soon {
    color: #94a3b8;
}

.layout-nav-toggle.is-coming-soon:hover {
    background: #f8fafc;
    color: #94a3b8;
}

.layout-nav-toggle-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.layout-nav-chevron {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: transform 0.2s ease, color 0.2s ease;
    flex: 0 0 auto;
}

.layout-nav-chevron svg {
    width: 100%;
    height: 100%;
}

.layout-nav-group.is-open .layout-nav-chevron {
    transform: rotate(180deg);
    color: #2563eb;
}

.layout-nav-toggle.active {
    background: #eff6ff;
    color: #2563eb;
}

.layout-nav-submenu {
    display: none;
    padding: 0.125rem 0 0 0;
}

.layout-nav-group.is-open .layout-nav-submenu {
    display: block;
}

.layout-nav-subentry {
    width: calc(100% - 1.5rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.layout-nav-subentry:hover {
    background: #eff6ff;
    color: #2563eb;
}

.layout-nav-subentry.active {
    background: #eff6ff;
    color: #2563eb;
}

.layout-nav-entry:hover,
.layout-logout-entry:hover {
    background: #f8fafc;
    color: #0f172a;
}

.layout-nav-entry.active {
    background: #eff6ff;
    color: #2563eb;
    border-left: 4px solid #2563eb;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: calc(0.75rem - 4px);
}

.layout-nav-entry.is-coming-soon,
.layout-nav-toggle.is-coming-soon,
.layout-nav-subentry.is-coming-soon,
.portal-user-dropdown-item.is-coming-soon {
    color: #94a3b8;
}

.layout-nav-entry.is-coming-soon:hover,
.layout-nav-toggle.is-coming-soon:hover,
.layout-nav-subentry.is-coming-soon:hover,
.portal-user-dropdown-item.is-coming-soon:hover {
    color: #94a3b8;
}

.layout-nav-entry.is-coming-soon:hover,
.layout-nav-subentry.is-coming-soon:hover {
    background: #f8fafc;
}

.portal-user-dropdown-item.is-coming-soon:hover {
    background: #f8fafc;
}

.layout-nav-entry.is-coming-soon.active,
.layout-nav-subentry.is-coming-soon.active {
    background: #f8fafc;
    color: #94a3b8;
    border-left-color: #cbd5e1;
}

.layout-sidebar-footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.layout-logout-entry {
    justify-content: center;
}

.layout-logout-entry:hover {
    color: #dc2626;
    background: #fef2f2;
}

.layout-sidebar-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem 0.75rem 0;
    border-top: 1px solid #f1f5f9;
    color: #94a3b8;
    font-size: 0.75rem;
    line-height: 1.5;
}

.layout-sidebar-meta a {
    color: inherit;
    text-decoration: none;
}

.layout-sidebar-meta a:hover {
    color: #475569;
}

.layout-sidebar-home-link {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 1rem;
}

.layout-sidebar-copyright {
    white-space: nowrap;
}

.layout-page-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.panel-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel-card .card-header {
    background: #fff;
    border-bottom: 1px solid #edf2f7;
}

.dashboard-split-shell {
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
    gap: 1.25rem;
    min-height: calc(100vh - 10rem);
}

.dashboard-side-panel {
    min-width: 0;
}

.dashboard-surface-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.dashboard-side-stack {
    padding: 1rem;
    display: grid;
    gap: 1.125rem;
}

.dashboard-panel-section {
    display: grid;
    gap: 0.75rem;
}

.dashboard-panel-caption {
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-nav-item {
    width: 100%;
    border: 0;
    border-radius: 0.625rem;
    background: transparent;
    color: #475569;
    text-align: left;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.dashboard-nav-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.dashboard-nav-item.is-active {
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-nav-item-icon {
    display: inline-flex;
    width: 1.5rem;
    justify-content: center;
    margin-right: 0.5rem;
}

.dashboard-chip-list {
    display: grid;
    gap: 0.625rem;
}

.dashboard-chip {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    color: #334155;
    text-align: left;
    padding: 0.9375rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.dashboard-chip:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
    transform: translateY(-1px);
}

.dashboard-content-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.375rem;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-panel-subtitle {
    margin: 0.375rem 0 0;
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.65;
}

.dashboard-clear-action {
    min-height: 2.25rem;
    padding: 0.5rem 0.875rem;
}

.dashboard-message-thread {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.375rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 28%);
}

.dashboard-message-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.dashboard-message-row.is-user {
    justify-content: flex-end;
}

.dashboard-message-avatar {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 700;
}

.dashboard-message-avatar.is-ai {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.dashboard-message-avatar.is-user {
    background: #e2e8f0;
    color: #475569;
}

.dashboard-message-block {
    max-width: min(68%, 42rem);
}

.dashboard-message-bubble {
    border-radius: 1rem;
    padding: 0.9375rem 1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    font-size: 0.875rem;
    line-height: 1.68;
}

.dashboard-message-bubble.is-ai {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.dashboard-message-bubble.is-user {
    background: #2563eb;
    color: #fff;
}

.dashboard-message-bubble p:last-child,
.dashboard-message-bubble ul:last-child {
    margin-bottom: 0;
}

.dashboard-message-bubble ul {
    margin: 0.625rem 0 0.625rem 1rem;
    padding: 0;
}

.dashboard-message-meta {
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    color: #94a3b8;
}

.dashboard-message-row.is-user .dashboard-message-meta {
    text-align: right;
}

.dashboard-composer {
    padding: 1rem 1.375rem 1.375rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.dashboard-composer-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.dashboard-composer-input {
    flex: 1 1 auto;
    min-height: 3rem;
}

.dashboard-composer-submit {
    flex: 0 0 auto;
    min-width: 6rem;
    min-height: 3rem;
}

@media (max-width: 991.98px) {
    .dashboard-split-shell {
        grid-template-columns: 1fr;
    }

    .dashboard-message-block {
        max-width: 100%;
    }

    .dashboard-composer-row {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-composer-submit {
        width: 100%;
    }
}

.chart-box {
    min-height: 320px;
}

.chart-box-sm {
    min-height: 260px;
}

.token-structure-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 0.9rem 1rem;
    background: #fff;
}

.token-signal-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    padding: 1rem;
    height: 100%;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f8fafc;
}

.dashboard-shell {
    display: grid;
    gap: 1.25rem;
}

.dashboard-shell > * {
    min-width: 0;
}

.dashboard-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.875rem;
    flex-wrap: wrap;
}

.dashboard-title {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    color: #0f172a;
}

.dashboard-subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.65;
}

.dashboard-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.dashboard-segmented {
    display: inline-flex;
    align-items: center;
    padding: 0.1875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
}

.dashboard-segmented-btn {
    border: 0;
    background: transparent;
    color: #64748b;
    padding: 0.4375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.dashboard-segmented-btn.active {
    background: #f1f5f9;
    color: #0f172a;
}

.dashboard-filter {
    width: auto;
    min-width: 9rem;
    font-size: 0.875rem;
    border-color: #e2e8f0;
    min-height: 2.5rem;
    border-radius: 0.625rem;
    box-shadow: none;
}

.dashboard-metric-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1.5rem;
    height: 100%;
    min-height: 10rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-metric-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    border-color: #cbd5e1;
}

.dashboard-metric-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.dashboard-metric-icon {
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dashboard-metric-icon i {
    font-size: 1.25rem;
    line-height: 1;
}

.dashboard-metric-icon.is-primary {
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-metric-icon.is-indigo {
    background: #eef2ff;
    color: #4f46e5;
}

.dashboard-metric-icon.is-success {
    background: #ecfdf5;
    color: #059669;
}

.dashboard-metric-icon.is-warning {
    background: #fffbeb;
    color: #d97706;
}

.dashboard-metric-icon.is-danger {
    background: #fef2f2;
    color: #dc2626;
}

.dashboard-metric-delta {
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-metric-delta.is-up {
    background: #f0fdf4;
    color: #16a34a;
}

.dashboard-metric-delta.is-down {
    background: #fef2f2;
    color: #dc2626;
}

.dashboard-metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: #0f172a;
}

.dashboard-metric-label {
    margin-top: 0.375rem;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

.dashboard-metric-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-metric-detail-list {
    margin-top: 0.875rem;
}

.dashboard-metric-detail-list.is-split {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid #f1f5f9;
}

.dashboard-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.dashboard-metric-row + .dashboard-metric-row {
    margin-top: 0.5rem;
}

.dashboard-metric-row-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-metric-row-label,
.dashboard-metric-stat-label {
    color: #94a3b8;
    font-size: 0.75rem;
}

.dashboard-metric-row-trail {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-metric-row-value,
.dashboard-metric-stat-value {
    color: #0f172a;
    font-size: 0.8125rem;
    font-weight: 700;
}

.dashboard-metric-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
}

.dashboard-metric-dot.is-indigo {
    background: #6366f1;
}

.dashboard-metric-dot.is-indigo-soft {
    background: #a5b4fc;
}

.dashboard-metric-dot.is-amber {
    background: #f59e0b;
}

.dashboard-metric-dot.is-amber-soft {
    background: #fcd34d;
}

.dashboard-metric-inline-delta {
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-metric-inline-delta.is-up {
    color: #16a34a;
}

.dashboard-metric-row-list {
    display: grid;
    gap: 0.75rem;
}

.dashboard-metric-capacity-list {
    margin-top: 0.25rem;
    gap: 0;
}

.dashboard-metric-capacity-group {
    display: grid;
    gap: 0.6rem;
    padding: 0.25rem 0 0.875rem;
}

.dashboard-metric-capacity-group + .dashboard-metric-capacity-group {
    border-top: 1px solid #f1f5f9;
    padding-top: 0.875rem;
    padding-bottom: 0;
}

.dashboard-metric-capacity-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-metric-mini-label {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
}

.dashboard-metric-mini-value {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-metric-stat-grid {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid #f1f5f9;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.dashboard-metric-stat {
    text-align: center;
}

.dashboard-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #0f172a;
}

.dashboard-summary-highlight {
    color: #2563eb;
    font-weight: 600;
}

.dashboard-chart-card .card-body {
    padding: 1.375rem !important;
}

.dashboard-table-card {
    overflow: hidden;
}

.dashboard-table-header,
.dashboard-table-footer {
    padding: 1rem 1.375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-color: #f1f5f9;
}

.dashboard-table-header {
    border-bottom: 1px solid #f1f5f9;
}

.dashboard-table-footer {
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

.dashboard-link-btn {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 500;
}

.dashboard-table thead th {
    padding: 0.875rem 1.375rem;
    font-size: 10px;
}

.dashboard-table tbody td {
    padding: 0.9375rem 1.375rem;
    font-size: 0.875rem;
    color: #475569;
}

.dashboard-table-name {
    color: #0f172a;
    font-weight: 500;
}

.dashboard-table-apr {
    color: #16a34a;
    font-weight: 600;
}

.dashboard-footer-copy {
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.dashboard-pagination-btn {
    min-width: 1.875rem;
    height: 1.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #fff;
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-pagination-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.dashboard-pagination-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.dashboard-pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.875rem;
    color: #94a3b8;
    font-size: 0.75rem;
}

.dashboard-table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: #94a3b8;
    font-size: 0.8125rem;
    flex-wrap: wrap;
}

.dashboard-pagination-info {
    white-space: nowrap;
}

.dashboard-primary-btn,
.dashboard-export-btn {
    border: 0;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.dashboard-primary-btn {
    background: #2563eb;
    color: #fff;
    min-height: 2.5rem;
    padding: 0.625rem 1rem;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}

.dashboard-export-btn {
    background: #2563eb;
    color: #fff;
    min-height: 2.25rem;
    padding: 0.5rem 0.875rem;
}

.dashboard-inline-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dashboard-inline-switch-btn {
    border: 0;
    background: transparent;
    color: #64748b;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.dashboard-inline-switch-btn.active {
    background: #f1f5f9;
    color: #0f172a;
}

.dashboard-table-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dashboard-filter-sm {
    min-width: 7.5rem;
    font-size: 0.75rem;
}

.dashboard-summary-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1.125rem 1.25rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-summary-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.dashboard-summary-label {
    font-size: 0.75rem;
    color: #64748b;
}

.dashboard-summary-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.dashboard-summary-foot {
    font-size: 0.75rem;
    color: #94a3b8;
}

.dashboard-foot-strong {
    color: #475569;
    font-weight: 600;
}

.dashboard-foot-danger {
    color: #ef4444;
    font-weight: 600;
}

.dashboard-foot-positive {
    color: #16a34a;
    font-weight: 600;
}

.dashboard-foot-warning {
    color: #d97706;
    font-weight: 600;
}

.dashboard-type-badge,
.dashboard-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.dashboard-type-badge.is-primary {
    background: #eff6ff;
    color: #1d4ed8;
}

.dashboard-type-badge.is-purple {
    background: #f3e8ff;
    color: #7e22ce;
}

.dashboard-type-badge.is-warning {
    background: #fffbeb;
    color: #b45309;
}

.dashboard-type-badge.is-teal {
    background: #ecfeff;
    color: #0f766e;
}

.dashboard-status-badge.is-done {
    background: #f0fdf4;
    color: #15803d;
}

.dashboard-status-badge.is-pending {
    background: #fefce8;
    color: #a16207;
}

.dashboard-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: #a8b2cc;
    font-size: 0.95rem;
    line-height: 1;
}

.dashboard-status-icon.is-done {
    color: #16a34a;
}

.dashboard-status-icon.is-done i {
    color: #16a34a;
}

.dashboard-status-icon.is-disabled {
    color: #a8b2cc;
}

.dashboard-status-icon.is-disabled i {
    color: #a8b2cc;
}

.dashboard-status-icon.is-warning {
    color: #d97706;
}

.dashboard-status-icon.is-warning i {
    color: #d97706;
}

.dashboard-status-icon.is-danger {
    color: #dc2626;
}

.dashboard-status-icon.is-danger i {
    color: #dc2626;
}

.dashboard-table-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.dashboard-table-soft {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #fbfcff;
    color: #263657;
    font-size: 14px;
}

.dashboard-table-soft thead th {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px dashed #e6ecf7;
    color: #a7b0c8;
    font-size: inherit;
    font-weight: normal;
    white-space: nowrap;
}

.dashboard-table-soft tbody td {
    padding: 1em 1.25rem;
    border-bottom: 1px dashed #e6ecf7;
    color: #263657;
}

.dashboard-table-soft tbody tr:last-child td {
    border-bottom-color: transparent;
}

.dashboard-table-soft tbody tr:hover td {
    background: #fbfcff;
}

.api-shell {
    max-width: 980px;
    margin: 0 auto;
}

.api-table thead th,
.api-table tbody td {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.dashboard-inline-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-icon-badge {
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.dashboard-icon-badge.is-primary {
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-icon-badge.is-purple {
    background: #f3e8ff;
    color: #9333ea;
}

.dashboard-icon-badge.is-warning {
    background: #fffbeb;
    color: #d97706;
}

.dashboard-icon-badge svg {
    display: block;
    width: 1rem;
    height: 1rem;
}

.dashboard-code-badge {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #f8fafc;
    color: #475569;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.dashboard-icon-btn {
    border: 0;
    background: transparent;
    font-size: 0.75rem;
    color: #94a3b8;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.dashboard-icon-btn:hover,
.dashboard-icon-btn.is-copied {
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-icon-btn svg {
    width: 1rem;
    height: 1rem;
}

.dashboard-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
}

.dashboard-dialog-card {
    width: min(34rem, 100%);
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

.dashboard-dialog-head,
.dashboard-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.375rem;
}

.dashboard-dialog-head {
    border-bottom: 1px solid #f1f5f9;
}

.dashboard-dialog-foot {
    border-top: 1px solid #f1f5f9;
    justify-content: flex-end;
}

.dashboard-dialog-body {
    padding: 1.375rem;
}

.dashboard-dialog-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.625rem;
    background: #f8fafc;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
}

.dashboard-dialog-close:hover {
    background: #eef2f7;
    color: #0f172a;
}

.dashboard-alert-card {
    margin-bottom: 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 0.875rem;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.dashboard-alert-copy {
    padding: 0.875rem 1rem;
    color: #1d4ed8;
    font-size: 0.875rem;
    line-height: 1.6;
}

.dashboard-legend-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-legend-inline span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dashboard-legend-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
}

.dashboard-legend-dot.is-blue {
    background: #3b82f6;
}

.dashboard-legend-dot.is-amber {
    background: #f59e0b;
}

.dashboard-change-danger {
    color: #dc2626;
    font-weight: 500;
}

.dashboard-change-success {
    color: #16a34a;
    font-weight: 500;
}

.energy-suggestion-card {
    border-left: 4px solid transparent;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
}

.energy-suggestion-card.is-blue {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.energy-suggestion-card.is-amber {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.energy-suggestion-card.is-green {
    background: #ecfdf5;
    border-left-color: #10b981;
}

.energy-suggestion-title {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
}

.energy-suggestion-desc {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #475569;
}

.dashboard-legend-dot.is-green {
    background: #10b981;
}

.dashboard-legend-dot.is-red {
    background: #ef4444;
}

.network-profile-card {
    display: grid;
    gap: 0.875rem;
}

.network-profile-group {
    display: grid;
    gap: 0.25rem;
}

.network-profile-label {
    font-size: 11px;
    color: #94a3b8;
}

.network-profile-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.network-profile-subvalue {
    font-size: 0.75rem;
    color: #64748b;
}

.network-sla-list {
    display: grid;
    gap: 0.375rem;
    font-size: 0.75rem;
}

.network-sla-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.network-sla-list span {
    color: #64748b;
}

.network-sla-list strong {
    color: #334155;
}

.network-download-btn {
    width: 100%;
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    background: #fff;
    color: #1d4ed8;
    min-height: 2.625rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.network-alert-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: #64748b;
}

.network-alert-summary span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.network-alert-summary strong {
    color: #475569;
}

.network-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.network-level-badge.is-critical {
    background: #fef2f2;
    color: #dc2626;
}

.network-level-badge.is-warning {
    background: #fffbeb;
    color: #d97706;
}

.network-level-badge.is-info {
    background: #eff6ff;
    color: #2563eb;
}

.dashboard-shell-narrow {
    max-width: 1120px;
    margin: 0 auto;
}

.dashboard-toolbar-center {
    justify-content: center;
    align-items: center;
}

.dashboard-inline-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #94a3b8;
    font-size: 0.75rem;
}

.dashboard-inline-hint strong {
    color: #f59e0b;
}

.dashboard-inline-hint-icon {
    width: 1rem;
    height: 1rem;
    color: #fbbf24;
}

.dashboard-inline-hint-icon svg,
.dashboard-feature-check svg {
    display: block;
    width: 100%;
    height: 100%;
}

.dashboard-plan-card {
    position: relative;
    height: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dashboard-plan-card.is-featured {
    border: 2px solid #2563eb;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
}

.dashboard-plan-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    border-bottom-left-radius: 0.75rem;
    background: #2563eb;
    color: #fff;
    padding: 0.25rem 1rem;
    font-size: 10px;
    font-weight: 700;
}

.dashboard-plan-main {
    padding: 1.625rem 1.5rem 1.5rem;
}

.dashboard-plan-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-plan-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

.dashboard-plan-tag {
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
}

.dashboard-plan-card.is-featured .dashboard-plan-tag {
    color: #9333ea;
    background: #faf5ff;
}

.dashboard-plan-desc {
    margin: 0 0 1.125rem;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.7;
}

.dashboard-plan-price-wrap {
    margin-bottom: 1.25rem;
}

.dashboard-plan-price {
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    color: #0f172a;
}

.dashboard-plan-period {
    margin-top: 0.25rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.dashboard-plan-action {
    width: 100%;
    justify-content: center;
}

.dashboard-plan-feature-list {
    border-top: 1px solid #f1f5f9;
    background: rgba(248, 250, 252, 0.65);
    padding: 1rem 1.5rem;
    display: grid;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.75rem;
}

.dashboard-plan-feature-list.is-featured {
    background: rgba(239, 246, 255, 0.6);
}

.dashboard-feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-feature-check {
    width: 0.9rem;
    height: 0.9rem;
    color: #10b981;
    flex: 0 0 auto;
}

.dashboard-feature-emphasis {
    color: #334155;
}

.dashboard-table tbody tr:hover {
    background: rgba(248, 250, 252, 0.5);
}

.dashboard-table-label {
    color: #334155;
    font-weight: 500;
}

.dashboard-compare-highlight,
.dashboard-compare-highlight-cell {
    background: rgba(239, 246, 255, 0.45);
    color: #1d4ed8;
    font-weight: 600;
}

.dashboard-table-muted {
    color: #cbd5e1;
}

@media (max-width: 991.98px) {
    .app-sidebar {
        width: 100%;
        min-height: auto;
        position: static;
    }

    .app-shell {
        flex-direction: column;
    }

    .app-content {
        padding: 1.25rem;
    }

    .layout-admin-header {
        height: auto;
        padding: 1rem 1.25rem;
        align-items: flex-start;
        flex-direction: column;
    }

    .layout-admin-header-left,
    .layout-admin-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .layout-sidebar-nav {
        padding-top: 1rem;
    }

    .layout-profile-copy {
        align-items: flex-start;
    }

    .dashboard-title {
        font-size: 1.75rem;
    }

    .dashboard-toolbar {
        align-items: flex-start;
    }

    .compute-trend-controls {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .compute-trend-controls .settings-input {
        flex: 1 1 180px;
        width: auto;
        min-width: 0;
    }
}

.overview-grid {
    display: grid;
    gap: 1.5rem;
}

.overview-table-card,
.settings-card,
.audit-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.overview-table-card {
    overflow: hidden;
}

.overview-table-head,
.settings-card-head,
.audit-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.375rem;
    border-bottom: 1px solid #f1f5f9;
}

.overview-table-foot {
    padding: 0.9375rem 1.375rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.overview-rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 700;
}

.overview-rank-badge.is-top {
    background: #fef3c7;
    color: #b45309;
}

.settings-tabs,
.audit-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
}

.settings-tab-btn,
.audit-tab-btn {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #64748b;
    padding: 1rem 1rem 0.9375rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.settings-tab-btn.active,
.audit-tab-btn.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.settings-panel,
.audit-panel {
    display: none;
    min-width: 0;
}

.settings-panel.is-active,
.audit-panel.is-active {
    display: block;
}

.settings-card-body,
.audit-card-body {
    padding: 1.375rem;
    min-width: 0;
}

.settings-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.settings-field {
    display: grid;
    gap: 0.5rem;
}

.settings-field.is-span-2 {
    grid-column: span 2;
}

.settings-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
}

.settings-input,
.settings-select,
.settings-textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #fff;
    color: #0f172a;
    min-height: 2.75rem;
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
    outline: none;
    box-shadow: none;
}

.settings-input.is-invalid,
.settings-select.is-invalid,
.settings-textarea.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

label.form-error-message {
    display: block;
    margin-top: 4px;
    color: #dc2626;
    font-size: 12px;
    line-height: 1.4;
}

.settings-textarea {
    min-height: 7rem;
    resize: vertical;
}

.settings-help {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.6;
}

.settings-form-stack {
    display: grid;
    gap: 1.125rem;
    max-width: 42rem;
}

.settings-form-row {
    display: grid;
    grid-template-columns: var(--settings-form-row-label-width, 7.5rem) minmax(0, 1fr);
    align-items: center;
    gap: 0.875rem;
}

.settings-form-row.is-label-xxl {
    --settings-form-row-label-width: 12.5rem;
}

.settings-form-row.is-top {
    align-items: start;
}

.settings-form-row-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.settings-form-row-label.is-wide {
    width: 10rem;
}

.settings-form-row-label.is-xl {
    width: 11.25rem;
}

.settings-form-row-label.is-xxl {
    width: 12.5rem;
}

.settings-form-row-body {
    min-width: 0;
}

.settings-inline-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-input-compact {
    width: 10rem;
}

.settings-select-compact {
    max-width: 14rem;
}

.settings-inline-unit,
.settings-switch-copy {
    font-size: 0.75rem;
    color: #64748b;
}

.settings-upload-box {
    width: 100%;
    border: 2px dashed #e2e8f0;
    border-radius: 0.75rem;
    background: #fff;
    padding: 1.625rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: #64748b;
    text-align: center;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.settings-upload-box:hover {
    border-color: #60a5fa;
    color: #2563eb;
    background: #f8fbff;
}

.settings-upload-icon {
    width: 2rem;
    height: 2rem;
    color: #94a3b8;
}

.settings-upload-icon svg {
    width: 100%;
    height: 100%;
}

.settings-upload-title {
    font-size: 0.875rem;
    color: #475569;
}

.settings-upload-copy {
    font-size: 0.6875rem;
    color: #94a3b8;
}

.settings-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f8fafc;
}

.settings-toggle-row:last-child {
    border-bottom: 0;
}

.settings-toggle-copy strong {
    display: block;
    font-size: 0.875rem;
    color: #0f172a;
}

.settings-toggle-copy span {
    font-size: 0.75rem;
    color: #64748b;
}

.settings-toggle-pill {
    min-width: 3rem;
    height: 1.75rem;
    border-radius: 999px;
    background: #dbeafe;
    position: relative;
}

.settings-toggle-pill::after {
    content: "";
    position: absolute;
    top: 0.1875rem;
    right: 0.1875rem;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 999px;
    background: #2563eb;
}

.settings-toggle-pill.is-button {
    border: 0;
    cursor: pointer;
}

.settings-toggle-pill.is-button::after {
    right: 0.1875rem;
    left: auto;
    transition: transform 0.2s ease;
}

.settings-toggle-pill.is-button.is-off {
    background: #cbd5e1;
}

.settings-toggle-pill.is-button.is-off::after {
    transform: translateX(-1.25rem);
    background: #fff;
}

.settings-switch-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.audit-summary-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.audit-summary-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1rem;
}

.audit-summary-label {
    font-size: 0.75rem;
    color: #64748b;
}

.audit-summary-value {
    margin-top: 0.375rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

.audit-summary-foot {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.audit-role-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.audit-role-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    padding: 1rem;
    background: #fff;
}

.audit-role-title {
    margin: 0 0 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.audit-role-copy {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.6;
}

.audit-role-list {
    display: grid;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #475569;
}

.audit-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.audit-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 400;
}

.audit-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.audit-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.5rem;
    background: #f8f9fb;
    color: #a8b2cc;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.audit-action-btn:hover,
.audit-action-btn:focus {
    background: #f3f5f9;
    color: #1d4ed8;
    box-shadow: none;
}

.audit-action-btn.is-warn {
    color: #a8b2cc;
}

.audit-action-btn.is-warn:hover,
.audit-action-btn.is-warn:focus {
    background: #f3f5f9;
    color: #b45309;
    box-shadow: none;
}

.audit-action-btn.is-danger {
    color: #a8b2cc;
}

.audit-action-btn.is-danger:hover,
.audit-action-btn.is-danger:focus {
    background: #f3f5f9;
    color: #b91c1c;
    box-shadow: none;
}

.audit-email-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.audit-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.audit-filter-item {
    display: grid;
    gap: 0.375rem;
    min-width: 11rem;
}

.audit-date-range-filter {
    min-width: 19rem;
    max-width: 100%;
}

.audit-date-range-inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
}

.audit-date-range-inputs .settings-input {
    min-width: 0;
}

.audit-date-range-separator {
    color: #94a3b8;
    white-space: nowrap;
}

.audit-section-head.audit-log-card-head {
    align-items: center;
}

.audit-log-card-head .audit-filter-bar {
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: 0;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.audit-log-card-head .audit-filter-item {
    min-width: 0;
}

.audit-log-card-head .settings-select {
    min-width: 8.75rem;
}

.audit-token-search-group {
    width: 280px;
}

.audit-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.audit-section-head.is-title-only {
    align-items: center;
}

.audit-editor-dialog {
    width: min(48rem, 100%);
}

.audit-role-dialog,
.audit-log-dialog {
    width: min(64rem, 100%);
}

.audit-editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
}

.audit-editor-field {
    display: grid;
    gap: 0.5rem;
}

.audit-editor-field-span-2 {
    grid-column: span 2;
}

.audit-editor-label {
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
}

.audit-editor-label span {
    color: #ef4444;
}

.audit-role-editor {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
}

.audit-role-editor-head {
    margin-bottom: 1rem;
}

.audit-role-editor-title,
.audit-log-detail-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
}

.audit-role-editor-copy {
    margin: 0.375rem 0 0;
    color: #64748b;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.audit-role-permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.audit-role-permission-section {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1rem;
}

.audit-role-permission-section-title {
    margin: 0 0 0.875rem;
    color: #0f172a;
    font-size: 0.8125rem;
    font-weight: 700;
}

.audit-role-permission-list {
    display: grid;
    gap: 0.75rem;
}

.audit-role-permission-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: #334155;
    font-size: 0.875rem;
}

.audit-role-permission-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: #2563eb;
}

.audit-log-dialog-body {
    display: grid;
    gap: 1rem;
}

.audit-log-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.audit-log-meta-item {
    padding: 0.875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #f8fbff;
}

.audit-log-meta-item span {
    display: block;
    color: #64748b;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.audit-log-meta-item strong {
    color: #0f172a;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.audit-log-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.audit-log-detail-block {
    display: grid;
    gap: 0.75rem;
}

.audit-log-detail-pre {
    margin: 0;
    min-height: 18rem;
    max-height: 28rem;
    overflow: auto;
    padding: 1rem;
    border-radius: 0.875rem;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.8125rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.dashboard-secondary-btn {
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    background: #fff;
    color: #475569;
    min-height: 2.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dashboard-secondary-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.dashboard-inline-code {
    border: 1px solid #dbeafe;
    border-radius: 0.375rem;
    background: #fff;
    color: #1d4ed8;
    padding: 0.125rem 0.375rem;
}

.portal-shell {
    min-height: 100vh;
    background: #fff;
    color: #0f172a;
}

.layout-admin-footer {
    display: none;
}

.portal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 75;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid #eef2f7;
}

.portal-header-inner {
    width: min(1120px, calc(100% - 3rem));
    margin: 0 auto;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.portal-section {
    width: min(1120px, calc(100% - 3rem));
    margin: 0 auto;
}

.portal-footer-inner {
    width: min(1120px, calc(100% - 3rem));
    margin: 0 auto;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

.portal-nav a {
    color: #5c6880;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 700;
    transition: color 0.2s ease;
}

.portal-nav a:hover {
    color: #0f172a;
}

.portal-logo {
    height: 1.6rem;
    width: auto;
}

.portal-btn,
.portal-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.875rem;
    padding: 0.8125rem 1.875rem;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    appearance: none;
    outline: none;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.portal-btn-sm {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 800;
}

.portal-user-menu {
    position: relative;
}

.portal-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    color: #334155;
    padding: 0.375rem 0.625rem;
    border-radius: 0.75rem;
}

.portal-user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
}

.portal-user-chevron {
    color: #94a3b8;
    font-size: 0.75rem;
}

.portal-user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 12rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.1);
    padding: 0.5rem;
    z-index: 60;
}

.portal-user-dropdown-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #475569;
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.portal-user-dropdown-item:hover {
    background: #f8fafc;
    color: #0f172a;
}

.portal-user-dropdown-item.is-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.portal-user-dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.375rem 0;
}

.portal-btn {
    background: #0b7cff;
    color: #fff;
    box-shadow: 0 12px 28px rgba(11, 124, 255, 0.28);
}

.portal-btn-secondary {
    border: 1px solid #dbe2ea;
    color: #334155;
    background: #fff;
}

.portal-btn:hover {
    background: #1d4ed8;
    color: #fff;
}

.portal-btn-secondary:hover {
    background: #f8fafc;
    color: #334155;
}

.portal-nav > .portal-btn.portal-btn-sm {
    box-shadow: 0 8px 18px rgba(11, 124, 255, 0.26);
}

.portal-hero .portal-btn,
.portal-hero .portal-btn-secondary {
    min-height: 3rem;
}

.portal-hero {
    background:
        radial-gradient(circle at 17% 22%, rgba(228, 236, 255, 0.72) 0, rgba(228, 236, 255, 0) 26rem),
        radial-gradient(circle at 82% 20%, rgba(235, 239, 255, 0.78) 0, rgba(235, 239, 255, 0) 26rem),
        #f7faff;
    min-height: 520px;
    padding: 8.5rem 0 5.25rem;
}

.portal-hero > .portal-section {
    padding: 0;
}

.portal-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
    align-items: center;
    gap: 5.25rem;
}

.portal-hero-copy {
    max-width: 41rem;
    min-width: 0;
}

.portal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #0b7cff;
    padding: 0.45rem 0.9rem;
    font-size: 0.8125rem;
    font-weight: 800;
    border: 1px solid #dce9ff;
    box-shadow: 0 7px 18px rgba(38, 80, 140, 0.1);
}

.portal-kicker-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: #2563eb;
}

.portal-title {
    margin: 1.25rem 0 1.35rem;
    font-size: clamp(3rem, 5vw, 4rem);
    line-height: 0.98;
    font-weight: 900;
    letter-spacing: 0;
    color: #0b1224;
}

.portal-title span {
    color: #3b55f2;
}

.portal-copy {
    margin: 0;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: #66748e;
    font-weight: 500;
    max-width: 39rem;
}

.portal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.portal-hero-visual {
    position: relative;
    width: min(100%, 26rem);
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
    padding: 1.8rem;
    border-radius: 2.4rem;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
}

.portal-hero-visual::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 0;
    width: 150%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    background: url("../images/colorbg.png") center center / contain no-repeat;
    opacity: 0.7;
    pointer-events: none;
}

.portal-hero-visual > * {
    position: relative;
    z-index: 1;
}

.portal-metric-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    min-height: 5.9rem;
    padding: 1.2rem 1.35rem;
    border-radius: 1.35rem;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.13);
    backdrop-filter: blur(16px);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.portal-metric-card:hover {
    background: #fff;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.16);
}

.portal-metric-card + .portal-metric-card {
    margin-top: 1.35rem;
}

.portal-metric-icon {
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-metric-icon.is-blue {
    color: #2f6df6;
    background: #e1ebff;
}

.portal-metric-icon.is-green {
    color: #20a873;
    background: #dcfae9;
}

.portal-metric-icon.is-purple {
    color: #6657f6;
    background: #e7e8ff;
}

.portal-metric-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.portal-metric-label {
    color: #8b99b0;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 400;
}

.portal-metric-content strong {
    color: #0b1224;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 900;
}

.portal-metric-card:not(.is-gpu) .portal-metric-content strong {
    font-size: 1.7rem;
}

.portal-metric-progress {
    display: block;
    height: 0.45rem;
    margin-top: 0.9rem;
    overflow: hidden;
    border-radius: 999px;
    background: #eff3fa;
}

.portal-metric-progress span {
    display: block;
    width: 72%;
    height: 100%;
    border-radius: inherit;
    background: #82a0f5;
}

.portal-card,
.portal-feature-card,
.portal-faq-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.portal-card {
    padding: 1.75rem;
    border-color: transparent;
    border-radius: 1.5rem;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.15);
}

.portal-chart-box {
    min-height: 260px;
}

.portal-section {
    padding: 6.5rem 0;
}

.portal-section-white {
    background: #fff;
}

.portal-section-muted {
    background: #f5f9fc;
}

.portal-section-muted > .portal-section {
    width: min(1152px, calc(100% - 3rem));
    margin: 0 auto;
}

.portal-section-heading {
    max-width: 36rem;
    margin-bottom: 3.5rem;
}

.portal-section-heading-center {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.portal-section-heading h2 {
    margin: 0 0 0.75rem;
    font-size: 2.1rem;
    font-weight: 800;
    color: #0f172a;
}

.portal-section-heading p {
    margin: 0;
    color: #64748b;
    line-height: 1.8;
}

.portal-feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4rem;
    align-items: stretch;
}

.portal-feature-card,
.portal-faq-card {
    padding: 1.875rem 1.75rem;
}

.portal-feature-card {
    min-height: 12.25rem;
    text-align: center;
    background: transparent;
    border-color: transparent;
    border-radius: 1rem;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

.portal-feature-card:hover {
    background: #f6f9fc;
}

.portal-feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.portal-feature-icon.is-blue {
    background: #dbeafe;
    color: #2563eb;
}

.portal-feature-icon.is-green {
    background: #dcfce7;
    color: #16a34a;
}

.portal-feature-icon.is-amber {
    background: #fef3c7;
    color: #d97706;
}

.portal-feature-card h3,
.portal-faq-card h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.portal-feature-card p,
.portal-faq-card p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.75;
    color: #64748b;
}

.portal-monitor-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1fr);
    gap: 7rem;
    align-items: center;
}

.portal-eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e8f1ff;
    color: #0b7cff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.portal-bullet-list {
    display: grid;
    gap: 1.2rem;
    margin-top: 2rem;
}

.portal-bullet-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: #334155;
    font-size: 0.9375rem;
    font-weight: 700;
}

.portal-bullet-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-bullet-icon.is-blue {
    background: #dbeafe;
    color: #2563eb;
}

.portal-bullet-icon.is-green {
    background: #dcfce7;
    color: #16a34a;
}

.portal-bullet-icon.is-amber {
    background: #fef3c7;
    color: #d97706;
}

.portal-faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    max-width: 50rem;
    margin: 0 auto;
}

.portal-faq-card {
    box-shadow: none;
    padding: 1.75rem 2rem;
    background: #f6f9fc;
    border-color: transparent;
}

.portal-footer {
    background: #061225;
    padding: 4.5rem 0 3.75rem;
}

.portal-footer-inner {
    display: grid;
    gap: 2rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.portal-footer-top,
.portal-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.portal-footer-top {
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.portal-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.portal-footer-logo {
    height: 1.35rem;
    width: auto;
}

.portal-footer-links {
    display: inline-flex;
    align-items: center;
    gap: 1.8rem;
}

.portal-footer-links a {
    color: inherit;
    text-decoration: none;
}

.portal-footer-links a:hover {
    color: #fff;
}

.portal-subpage {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: #fff;
    overflow-y: auto;
    padding-top: 5.25rem;
}

.portal-subpage-inner {
    width: min(960px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.75rem 0 2.75rem;
}

.portal-subpage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.portal-subpage-head h1,
.portal-subpage-head h2 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
}

.portal-subpage-close {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    min-height: 2.5rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
}

.portal-subpage-card,
.portal-usage-card {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.portal-subpage-card {
    padding: 1.375rem;
}

.portal-subpage-card-table {
    overflow: hidden;
    padding: 0;
}

.portal-subpage-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border-bottom: 1px solid #f1f5f9;
}

.portal-user-center-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.portal-user-center-tabs button {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: #fff;
    color: #64748b;
    min-height: 2.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
}

.portal-user-center-tabs button.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.portal-user-center-tabs .portal-user-center-chat-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.portal-user-center-tabs .portal-user-center-chat-link:hover,
.portal-user-center-tabs .portal-user-center-chat-link:focus-visible {
    border-color: #60a5fa;
    background: #dbeafe;
    color: #1d4ed8;
}

.portal-user-usage-stack {
    display: grid;
    gap: 1.25rem;
}

#page-user-center .portal-subpage {
    position: static;
    inset: auto;
    z-index: auto;
    background: transparent;
    overflow: visible;
    padding-top: 0;
}

#page-user-center .portal-subpage-inner {
    width: 100%;
    padding: 0;
}

.portal-profile-head {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.portal-profile-avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
}

.portal-profile-head h3 {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.portal-profile-head p {
    margin: 0;
    color: #64748b;
}

.portal-profile-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-left: auto;
    border: 0;
    border-radius: 0.375rem;
    background: #f3f5f9;
    color: #94a3b8;
    line-height: 1;
}

.portal-profile-edit:hover,
.portal-profile-edit:focus-visible {
    background: #eff6ff;
    color: #2563eb;
}

.portal-user-tag {
    display: inline-flex;
    margin-top: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 600;
}

#user-apikey-table .user-apikey-remark {
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.portal-profile-grid label,
.portal-form-field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.portal-profile-grid p {
    margin: 0;
    font-size: 0.9375rem;
    color: #0f172a;
    font-weight: 500;
}

.portal-usage-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.875rem;
    margin-bottom: 1rem;
}

.portal-usage-card {
    padding: 1.125rem;
}

.portal-usage-card p {
    margin: 0 0 0.375rem;
    font-size: 0.75rem;
    color: #94a3b8;
}

.portal-usage-card strong {
    display: block;
    font-size: 1.75rem;
    color: #0f172a;
}

.portal-usage-card span {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: #64748b;
}

.portal-usage-card .is-up {
    color: #16a34a;
}

.portal-usage-card .is-warn {
    color: #d97706;
}

.portal-chart-box-sm {
    min-height: 240px;
}

.portal-recharge-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(260px, 0.8fr);
    align-items: stretch;
    gap: 1rem;
}

.portal-recharge-grid .portal-subpage-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portal-recharge-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.75rem;
    flex: 1;
}

.portal-recharge-option {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1.35rem 1rem;
    text-align: left;
    min-height: 10.75rem;
}

.portal-recharge-option.is-active {
    border-color: #2563eb;
    background: rgba(239, 246, 255, 0.55);
}

.portal-recharge-option strong,
.portal-purchase-option strong {
    display: block;
    font-size: 1.35rem;
    color: #0f172a;
}

.portal-recharge-option span,
.portal-purchase-option span {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
}

.portal-recharge-option em {
    display: block;
    margin-top: auto;
    padding-top: 1rem;
    color: #2563eb;
    font-style: normal;
    font-size: 1rem;
    font-weight: 600;
}

.portal-payment-list {
    display: grid;
    gap: 0.5rem;
}

.portal-payment-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.7rem 0.875rem;
    font-size: 0.875rem;
    color: #334155;
}

.portal-payment-item.is-active {
    border-color: #2563eb;
    background: rgba(239, 246, 255, 0.55);
}

.portal-recharge-total,
.portal-purchase-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.portal-recharge-total span,
.portal-purchase-summary span {
    color: #64748b;
    font-size: 0.875rem;
}

.portal-recharge-total strong {
    color: #0f172a;
    font-size: 1.5rem;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    padding: 1rem;
}

.portal-modal-card {
    width: min(420px, 100%);
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    background: #fff;
    padding: 2rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.portal-modal-card-wide {
    width: min(560px, 100%);
}

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

.portal-modal-head h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
}

.portal-modal-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0.625rem;
    background: #f8fafc;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
}

.portal-auth-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 1.375rem;
}

.portal-auth-tab {
    flex: 1;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #64748b;
    padding: 0 0.25rem 0.8125rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.portal-auth-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.portal-auth-panel {
    padding-top: 0.25rem;
}

.portal-auth-copy {
    margin: 0.875rem 0 0;
    text-align: center;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.7;
}

.portal-auth-foot {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.portal-auth-admin-link {
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0;
}

.portal-auth-admin-link:hover {
    color: #1d4ed8;
}

.portal-qr-box {
    width: 12rem;
    height: 12rem;
    margin: 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
    font-weight: 700;
}

.portal-form-field {
    margin-bottom: 1rem;
}

.portal-purchase-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.portal-purchase-option {
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    background: #fff;
    padding: 1rem;
    text-align: center;
}

.portal-purchase-option.is-active {
    border-color: #2563eb;
    background: rgba(239, 246, 255, 0.55);
}

.gateway-toolbar-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.gateway-summary-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.gateway-summary-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gateway-summary-label {
    color: #64748b;
    font-size: 13px;
    line-height: 1.4;
}

.gateway-summary-value {
    color: #0f172a;
    font-size: 30px;
    line-height: 1;
    font-weight: 700;
}

.gateway-search-input {
    min-width: 280px;
}

.dashboard-search-group {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-width: 280px;
}

.dashboard-search-group .settings-input {
    width: 100%;
    padding-right: 42px;
}

.dashboard-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.dashboard-search-clear:hover,
.dashboard-search-clear:focus {
    color: #334155;
    background: #f1f5f9;
}

.gateway-model-controls {
    flex-wrap: nowrap;
    min-width: 0;
}

.gateway-model-controls .gateway-search-input {
    flex: 0 0 480px;
    width: 480px;
}

.gateway-model-controls .dashboard-primary-btn {
    flex: 0 0 auto;
}

.compute-trend-controls {
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.compute-trend-controls .settings-input {
    flex: 0 0 176px;
    width: 176px;
    min-width: 176px;
}

.compute-trend-controls .dashboard-primary-btn,
.compute-trend-controls .dashboard-secondary-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

#gateway-model-tabs ~ .audit-panel .audit-section-head {
    align-items: center;
}

.gateway-log-filters {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 1rem;
}

.gateway-log-card-head {
    align-items: center;
}

.gateway-log-card-head .gateway-log-filters {
    width: auto;
    min-width: 0;
    justify-content: flex-end;
    margin-bottom: 0;
}

.gateway-log-card-head .gateway-log-filters .gateway-search-input {
    flex: 0 1 320px;
    min-width: 260px;
    width: 320px;
}

.gateway-log-filters .gateway-search-input {
    flex: 1 1 280px;
    min-width: 0;
    width: auto;
}

.gateway-log-filters .gateway-select,
.gateway-log-filters .dashboard-primary-btn {
    flex: 0 0 auto;
}

.gateway-log-filters .gateway-select {
    width: auto;
}

.gateway-select {
    min-width: 140px;
}

.gateway-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.gateway-modal.is-active {
    display: flex;
}

.gateway-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.gateway-modal-card {
    position: relative;
    z-index: 1;
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.gateway-modal-card-wide {
    width: min(1120px, 100%);
}

.gateway-route-rules-grid {
    width: 100%;
    table-layout: fixed;
}

.gateway-route-rules-grid th,
.gateway-route-rules-grid td {
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
}

.gateway-route-rules-grid th:last-child,
.gateway-route-rules-grid td:last-child {
    width: 112px;
}

.gateway-route-list-grid {
    table-layout: auto;
}

.gateway-route-list-grid th,
.gateway-route-list-grid td {
    width: auto;
    white-space: nowrap;
}

.gateway-route-list-grid th:first-child,
.gateway-route-list-grid td:first-child,
.gateway-route-list-grid th:nth-child(4),
.gateway-route-list-grid td:nth-child(4) {
    white-space: normal;
}

.gateway-route-list-grid th:last-child,
.gateway-route-list-grid td:last-child {
    width: 1%;
    min-width: 176px;
    white-space: nowrap;
}

.gateway-modal-body {
    padding: 0 28px 28px;
}

.gateway-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px 16px;
}

.gateway-modal-head h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    color: #0f172a;
}

.gateway-modal-head p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 14px;
}

.gateway-modal-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 24px;
    line-height: 1;
}

body.is-modal-open {
    overflow: hidden;
}

.portal-chat-page {
    background: #ffffff;
}

.portal-chat-shell {
    padding-top: calc(4.5rem + 28px);
    align-items: start;
    padding-bottom: 340px;
}

.portal-chat-workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    min-height: 0;
    align-items: start;
}

.portal-chat-sidebar,
.portal-chat-main,
.portal-chat-composer-panel {
    min-width: 0;
}

.portal-chat-main {
    min-height: 0;
    padding-top: 60px;
}

.portal-chat-composer-panel {
    position: fixed;
    z-index: 70;
    left: max(calc(50% - 216px), 368px);
    bottom: 16px;
    width: min(776px, calc(100% - 392px));
    background: #ffffff;
}

.portal-chat-composer-panel .portal-chat-attach-add {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 22px;
}

.portal-chat-composer-panel .portal-chat-send-btn {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 14px;
}

.portal-chat-card {
    border-radius: 28px;
}

.portal-chat-sidebar-card {
    padding: 0 18px;
    position: fixed;
    top: calc(4.5rem + 28px);
    left: max(calc(50% - 560px), 1.5rem);
    width: 320px;
    max-height: calc(100vh - 126px);
    display: flex;
    flex-direction: column;
}

.portal-chat-sidebar-new-session {
    width: 100%;
    margin-bottom: 18px;
    justify-content: flex-start;
    gap: 8px;
}

.portal-chat-side-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.portal-chat-sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.portal-chat-session-list {
    display: grid;
    gap: 10px;
    margin-top: 8px;
    overflow: auto;
    padding-right: 4px;
}

.portal-chat-session-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 5px 14px;
    border-radius: 18px;
    background: transparent;
    transition: background 0.2s ease;
}

.portal-chat-session-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 30px;
    padding: 0;
    text-align: left;
    border: 0;
    background: transparent;
}

.portal-chat-session-trigger strong,
.portal-chat-session-item strong {
    color: #0f172a;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    word-break: break-word;
}

.portal-chat-session-item.is-active .portal-chat-session-trigger strong {
    font-weight: 700;
}

.portal-chat-session-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.portal-chat-session-item:hover .portal-chat-session-actions,
.portal-chat-session-item:focus-within .portal-chat-session-actions,
.portal-chat-session-item.is-active .portal-chat-session-actions {
    opacity: 1;
    pointer-events: auto;
}

.portal-chat-session-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
}

.portal-chat-session-action:hover,
.portal-chat-session-action:focus-visible {
    background: transparent;
    color: #2563eb;
}

.portal-chat-session-action.is-danger {
    color: #94a3b8;
}

.portal-chat-session-action.is-danger:hover,
.portal-chat-session-action.is-danger:focus-visible {
    color: #dc2626;
}

.portal-chat-session-item:hover,
.portal-chat-session-item.is-active {
    background: #f8fafc;
}

.portal-chat-thread-card {
    padding: 0;
    min-height: 0;
    width: 100%;
    border-radius: 16px;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
}

.portal-chat-thread-stats {
    position: fixed;
    z-index: 70;
    top: calc(4.5rem + 28px);
    left: max(calc(50% - 216px), 368px);
    width: min(776px, calc(100% - 392px));
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.portal-chat-stat-chip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 132px;
    padding: 12px 14px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(191, 219, 254, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.portal-chat-stat-chip span {
    color: #64748b;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
}

.portal-chat-stat-chip strong {
    color: #0f172a;
    font-size: 11px;
    line-height: 1.25;
    font-weight: 700;
    white-space: nowrap;
}

.portal-chat-thread {
    min-height: 0;
    display: block;
    width: 100%;
    margin-top: 0;
    padding: 24px 22px;
}

.portal-chat-empty {
    display: grid;
    place-items: center;
    min-height: 420px;
    border-radius: 12px;
    text-align: center;
    color: #64748b;
    padding: 24px;
}

.portal-chat-empty h3 {
    margin: 0 0 10px;
    color: #202123;
    font-size: 20px;
    font-weight: 700;
}

.portal-chat-empty p {
    margin: 0;
    max-width: 420px;
    line-height: 1.8;
}

.portal-chat-message {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 22px;
}

.portal-chat-message:last-child {
    margin-bottom: 0;
}

.portal-chat-message.is-user {
    justify-content: flex-end;
}

.portal-chat-message-body {
    flex: 0 1 auto;
    width: fit-content;
    min-width: 0;
    max-width: min(820px, 100%);
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: none;
    align-self: flex-start;
}

.portal-chat-message.is-user .portal-chat-message-body {
    margin-left: auto;
    background: #f4f4f4;
    color: #202123;
    border-top-right-radius: 18px;
}

.portal-chat-message.is-assistant .portal-chat-message-body {
    padding: 10px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #202123;
}

.portal-chat-message-text {
    font-size: 15px;
    line-height: 1.7;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.portal-chat-markdown p,
.portal-chat-markdown ul,
.portal-chat-markdown ol,
.portal-chat-markdown blockquote,
.portal-chat-markdown pre,
.portal-chat-markdown h1,
.portal-chat-markdown h2,
.portal-chat-markdown h3 {
    margin: 0 0 12px;
}

.portal-chat-markdown p:last-child,
.portal-chat-markdown ul:last-child,
.portal-chat-markdown ol:last-child,
.portal-chat-markdown blockquote:last-child,
.portal-chat-markdown pre:last-child {
    margin-bottom: 0;
}

.portal-chat-markdown ul,
.portal-chat-markdown ol {
    padding-left: 1.25rem;
}

.portal-chat-markdown code {
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.92em;
}

.portal-chat-message.is-user .portal-chat-markdown code {
    background: #e7e7e7;
}

.portal-chat-code {
    overflow-x: auto;
    padding: 14px 16px;
    border-radius: 16px;
    background: #0f172a;
    color: #e2e8f0;
}

.portal-chat-code code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.portal-chat-markdown blockquote {
    padding-left: 14px;
    border-left: 3px solid #d1d5db;
    color: #6b7280;
}

.portal-chat-markdown a {
    color: #10a37f;
    text-decoration: none;
}

.portal-chat-markdown a:hover {
    text-decoration: underline;
}

.portal-chat-streaming-placeholder,
.portal-chat-muted {
    color: #64748b;
}

.portal-chat-reasoning {
    border-radius: 16px;
    /* background: rgba(148, 163, 184, 0.08); */
    /* border: 1px solid rgba(148, 163, 184, 0.18); */
}

.portal-chat-reasoning summary {
    padding: 10px 14px;
    cursor: pointer;
    color: #334155;
    font-size: 13px;
    font-weight: 400;
}

.portal-chat-reasoning-body {
    padding: 0 14px 14px;
    color: #475569;
    font-size: 14px;
    line-height: 1.75;
}

.portal-chat-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

.portal-chat-attachment-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 180px;
    max-width: 260px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(241, 245, 249, 0.9);
    color: #0f172a;
}

.portal-chat-message.is-user .portal-chat-attachment-card {
    background: #ffffff;
    color: #202123;
    border: 1px solid #e5e5e5;
}

.portal-chat-attachment-card strong,
.portal-chat-attachment-card span,
.portal-chat-attachment-card p {
    display: block;
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
}

.portal-chat-attachment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    font-size: 11px;
    font-weight: 800;
}

.portal-chat-message.is-user .portal-chat-attachment-icon {
    background: #e9f5f0;
    color: #10a37f;
}

.portal-chat-attachment-preview {
    width: 86px;
    height: 86px;
    object-fit: cover;
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid #e5e5e5;
}

.portal-chat-usage {
    margin-top: 14px;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
}

.portal-chat-message.is-user .portal-chat-usage {
    color: #94a3b8;
}

.portal-chat-pending {
    margin-top: 18px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
    border: 1px solid rgba(191, 219, 254, 0.55);
}

.portal-chat-pending-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
}

.portal-chat-pending-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    margin-left: 8px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.portal-chat-pending-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.portal-chat-pending-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    max-width: 260px;
    padding: 12px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(219, 227, 239, 0.92);
}

.portal-chat-pending-item strong,
.portal-chat-pending-item span {
    display: block;
}

.portal-chat-pending-item strong {
    color: #0f172a;
    font-size: 13px;
}

.portal-chat-pending-item span {
    color: #64748b;
    font-size: 12px;
}

.portal-chat-pending-thumb {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(219, 227, 239, 0.92);
    cursor: pointer;
}

.portal-chat-pending-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.portal-chat-pending-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #64748b;
    font-size: 14px;
    line-height: 1;
}

.portal-chat-text-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
}

.portal-chat-clear-session-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0.375rem 0.75rem;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.portal-chat-clear-session-btn:hover,
.portal-chat-clear-session-btn:focus-visible {
    border-color: #fecaca;
    background: #fef2f2;
    color: #dc2626;
}

.portal-chat-composer-card {
    padding: 22px 24px;
}

.portal-chat-composer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-chat-composer-head-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.portal-chat-composer-model {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.portal-chat-model-select {
    min-width: 220px;
    min-height: 34px;
    margin-left: 0;
    padding: 0 12px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
}

#chat-api-key-select {
    width: calc(15ch + 36px);
    min-width: calc(15ch + 36px);
}

.portal-chat-api-key-guide {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.6;
}

.portal-chat-api-key-guide a {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.portal-chat-composer {
    margin-top: 18px;
    padding: 18px;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.82);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.portal-chat-composer.is-dragover {
    border-color: rgba(37, 99, 235, 0.48);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.10);
    background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
}

.portal-chat-input {
    width: 100%;
    min-height: 1.8em;
    max-height: 162px;
    resize: none;
    overflow-y: hidden;
    border: 0;
    outline: none;
    background: transparent;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.8;
}

.portal-chat-composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 14px;
}

.portal-chat-composer-tools {
    min-width: 0;
    flex: 1 1 auto;
}

.portal-chat-composer-tool-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.portal-chat-attach-add {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border: 1px solid rgba(191, 219, 254, 0.92);
    border-radius: 18px;
    background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
    color: #0f766e;
    font-size: 34px;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.10);
}

.portal-chat-send-cluster {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
}

.portal-chat-send-btn {
    min-width: 126px;
    min-height: 46px;
}

.portal-chat-send-secondary {
    min-width: 118px;
    min-height: 46px;
}

.portal-chat-preview {
    position: fixed;
    inset: 0;
    z-index: 1080;
}

.portal-chat-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
}

.portal-chat-preview-card {
    position: relative;
    z-index: 1;
    width: min(920px, calc(100% - 32px));
    margin: 48px auto;
    padding: 18px;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.28);
}

.portal-chat-preview-card img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: 18px;
}

.portal-chat-preview-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 28px;
    line-height: 1;
}

.gateway-editor-card {
    margin-bottom: 24px;
}

.gateway-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.gateway-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.gateway-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gateway-form-field-span-2 {
    grid-column: span 2;
}

.gateway-form-label {
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.gateway-form-help {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.gateway-form-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    margin-top: 20px;
}

.gateway-form-section:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.gateway-form-section-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.gateway-form-section-title {
    margin-top: 18px;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
}

.gateway-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.gateway-check-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 500;
}

.gateway-check-item input {
    margin: 0;
}

.gateway-multiselect {
    min-height: 120px;
}

.gateway-switch-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 12px;
}

.gateway-switch-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 14px;
}

.gateway-switch-item input {
    margin: 0;
}

.gateway-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.gateway-action-btn {
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #2563eb;
    border-radius: 10px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 600;
}

.gateway-action-btn.is-danger {
    color: #dc2626;
}

.dashboard-table-soft .gateway-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: #f8f9fb;
    color: #a8b2cc;
    border-radius: 0.5rem;
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.dashboard-table-soft .gateway-action-btn:hover,
.dashboard-table-soft .gateway-action-btn:focus {
    background: #f3f5f9;
    color: #1d4ed8;
}

.dashboard-table-soft .gateway-action-btn.is-danger {
    color: #a8b2cc;
}

.dashboard-table-soft .gateway-action-btn.is-danger:hover,
.dashboard-table-soft .gateway-action-btn.is-danger:focus {
    background: #f3f5f9;
    color: #b91c1c;
}

.gateway-action-btn.is-disabled,
.gateway-action-btn:disabled {
    color: #94a3b8;
    border-color: #e2e8f0;
    background: #f8fafc;
    cursor: not-allowed;
}

.gateway-modal .settings-actions {
    margin-top: 20px;
}

.gateway-log-detail-body {
    display: grid;
    gap: 18px;
}

.gateway-detail-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.gateway-detail-stage-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.gateway-detail-item {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(219, 227, 239, 0.92);
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.gateway-detail-label {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

.gateway-detail-value {
    display: block;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.gateway-detail-item .dashboard-subtitle {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.45;
}

.gateway-detail-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gateway-detail-tab {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(191, 219, 254, 0.9);
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
}

.gateway-detail-tab.is-active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.gateway-detail-panel {
    display: none;
}

.gateway-detail-panel.is-active {
    display: block;
}

.gateway-detail-pre {
    max-height: 520px;
    overflow: auto;
    margin: 0;
    padding: 18px 20px;
    border-radius: 18px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 991.98px) {
    .settings-form-grid,
    .audit-summary-row,
    .audit-role-grid,
    .gateway-summary-row,
    .portal-feature-grid,
    .portal-hero-grid,
    .portal-monitor-grid {
        grid-template-columns: 1fr;
    }

    .settings-field.is-span-2 {
        grid-column: span 1;
    }

    .settings-form-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .settings-form-row-label,
    .settings-form-row-label.is-wide,
    .settings-form-row-label.is-xl,
    .settings-form-row-label.is-xxl {
        width: auto;
    }

    .settings-input-compact,
    .settings-select-compact {
        width: 100%;
        max-width: none;
    }

    .audit-filter-bar {
        align-items: stretch;
    }

    .audit-filter-item {
        width: 100%;
    }

    .audit-date-range-filter {
        min-width: 0;
    }

    .audit-log-card-head .audit-filter-bar {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .audit-log-card-head .audit-date-range-filter {
        min-width: 0;
    }

    .audit-section-head,
    .audit-log-meta,
    .audit-log-detail-grid,
    .audit-role-permission-grid,
    .audit-editor-grid {
        grid-template-columns: 1fr;
    }

    .audit-section-head {
        flex-direction: column;
        align-items: stretch;
    }

    #gateway-model-tabs ~ .audit-panel .audit-section-head {
        align-items: stretch;
    }

    .gateway-model-controls {
        flex-wrap: wrap;
    }

    .gateway-model-controls .gateway-search-input {
        flex: 1 1 100%;
        width: 100%;
    }

    .audit-editor-field-span-2 {
        grid-column: span 1;
    }

    .audit-filter-bar .dashboard-primary-btn,
    .audit-filter-bar .dashboard-secondary-btn {
        width: 100%;
        justify-content: center;
    }

    .gateway-search-input,
    .gateway-select {
        min-width: 100%;
    }

    .gateway-log-filters {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .gateway-log-card-head .gateway-log-filters {
        width: 100%;
    }

    .gateway-log-filters .dashboard-primary-btn {
        width: 100%;
        justify-content: center;
    }

    .gateway-log-filters .gateway-search-input,
    .gateway-log-filters .gateway-select {
        width: 100%;
    }

    .gateway-form-grid {
        grid-template-columns: 1fr;
    }

    .gateway-form-field-span-2 {
        grid-column: span 1;
    }

    .gateway-editor-head {
        flex-direction: column;
        align-items: stretch;
    }

    .gateway-detail-summary {
        grid-template-columns: 1fr;
    }

    .portal-header-inner,
    .portal-footer-inner {
        flex-direction: row;
        align-items: center;
    }

    .portal-nav {
        width: auto;
        justify-content: flex-end;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .portal-hero {
        min-height: auto;
        padding: 7.5rem 0 4.5rem;
    }

    .portal-hero-grid,
    .portal-monitor-grid {
        gap: 3rem;
    }

    .portal-hero-visual {
        width: 100%;
        margin: 0;
    }

    .portal-feature-grid {
        gap: 1.25rem;
    }

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

    .portal-footer-top,
    .portal-footer-bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-header-inner,
    .portal-section,
    .portal-footer-inner {
        width: min(1200px, calc(100% - 1.5rem));
    }

    .portal-profile-grid,
    .portal-usage-summary,
    .portal-recharge-grid,
    .portal-recharge-options,
    .portal-purchase-options {
        grid-template-columns: 1fr;
    }

    .portal-footer-links {
        flex-wrap: wrap;
    }

    .portal-chat-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        min-height: auto;
    }

    .portal-chat-composer-panel {
        grid-column: auto;
        left: 0.75rem;
        right: 0.75rem;
        bottom: 0.75rem;
        width: auto;
    }

    .portal-chat-thread-stats {
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
    }

    .portal-chat-sidebar-card {
        position: static;
        width: auto;
        max-height: none;
    }

    .portal-chat-composer-foot,
    .portal-chat-composer-head,
    .portal-chat-composer-head-actions,
    .portal-chat-composer-tool-row,
    .portal-chat-pending-item {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-chat-send-secondary {
        width: 100%;
    }

    .portal-chat-send-cluster {
        align-items: flex-end;
    }

    .portal-chat-message-body {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .portal-header-inner {
        min-height: 4rem;
        width: min(100%, calc(100% - 1.25rem));
    }

    .portal-logo {
        height: 1.35rem;
    }

    .portal-nav {
        gap: 0.75rem;
    }

    .portal-nav a[href="#features"],
    .portal-nav a[href="#monitor"],
    .portal-nav a[href="#faq"] {
        display: none;
    }

    .portal-btn-sm {
        padding: 0.45rem 0.75rem;
        font-size: 0.75rem;
    }

    .portal-hero {
        padding-top: 6.75rem;
        overflow-x: hidden;
    }

    .portal-hero-grid {
        width: min(100%, calc(100vw - 1.5rem));
        gap: 2.5rem;
        justify-items: stretch;
    }

    .portal-hero-copy {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
    }

    .portal-title {
        font-size: clamp(2.1rem, 9.8vw, 2.55rem);
        line-height: 1.04;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .portal-title span {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .portal-copy {
        display: block;
        width: 100%;
        max-width: 100%;
        font-size: 0.875rem;
        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: normal;
    }

    .portal-actions {
        gap: 0.875rem;
    }

    .portal-hero .portal-btn,
    .portal-hero .portal-btn-secondary {
        min-height: 2.9rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .portal-hero-visual {
        width: calc(100% - 2.25rem);
        max-width: calc(100% - 2.25rem);
        margin-left: 0;
        margin-right: 0;
        padding: 1.1rem;
        border-radius: 1.75rem;
    }

    .portal-hero-visual::before {
        width: 170%;
    }

    .portal-metric-card {
        width: 100%;
        min-width: 0;
        min-height: 5.5rem;
        padding: 1rem;
    }

    .portal-metric-icon {
        width: 2.75rem;
        height: 2.75rem;
    }

    .portal-metric-card:not(.is-gpu) .portal-metric-content strong,
    .portal-metric-content strong {
        font-size: 1.05rem;
    }

    .portal-section {
        padding: 4.75rem 0;
    }

    .portal-section-heading h2 {
        font-size: 1.65rem;
    }

    .portal-feature-card,
    .portal-faq-card {
        padding: 1.35rem;
    }

    .portal-monitor-grid {
        gap: 2.5rem;
    }

    .portal-card {
        padding: 1.25rem;
    }

}
