:root {
    --portal-dark: #111827;
    --portal-muted: #64748b;
    --portal-card: #ffffff;
    --portal-border: #e5e7eb;
}

body {
    min-height: 100vh;
    color: #172033;
    background:
        radial-gradient(circle at top left, rgba(25, 135, 84, .13), transparent 30rem),
        linear-gradient(180deg, #f8fafc, #eef2f7);
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] {
    color: #e5e7eb;
    background:
        radial-gradient(circle at top left, rgba(25, 135, 84, .18), transparent 30rem),
        linear-gradient(180deg, #0f172a, #111827);
}

[data-bs-theme="dark"] .portal-card,
[data-bs-theme="dark"] .hero-card,
[data-bs-theme="dark"] .landing-hero,
[data-bs-theme="dark"] .portal-admin-sidebar,
[data-bs-theme="dark"] .portal-page-hero,
[data-bs-theme="dark"] .portal-stat-card {
    border-color: #263244;
    background: rgba(17, 24, 39, .9);
    color: #e5e7eb;
}

[data-bs-theme="dark"] .text-muted {
    color: #9ca3af !important;
}

.portal-nav {
    background: linear-gradient(115deg, #111827, #1f2937 70%, #198754);
    box-shadow: 0 10px 32px rgba(15, 23, 42, .18);
}

.portal-nav .navbar-brand {
    color: #fff;
}

.hero-card,
.portal-card {
    border: 1px solid var(--portal-border);
    border-radius: 24px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .10);
}

.hero-card {
    overflow: hidden;
}

.landing-hero {
    overflow: hidden;
    border: 1px solid var(--portal-border);
    border-radius: 28px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 22px 60px rgba(15, 23, 42, .12);
}

.hero-visual {
    color: #fff;
    background: linear-gradient(145deg, #111827, #243047 65%, #198754);
}

.landing-trust {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.landing-trust span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    border-radius: 999px;
    color: #166534;
    background: rgba(25, 135, 84, .1);
    font-size: .88rem;
    font-weight: 600;
}

.landing-preview {
    position: relative;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 24px;
    padding: 1.25rem;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.preview-topbar {
    display: flex;
    gap: .4rem;
    margin-bottom: 1rem;
}

.preview-topbar span {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .5);
}

.preview-title {
    margin-bottom: 1rem;
    font-size: 1.15rem;
    font-weight: 800;
}

.preview-tile {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, .12);
}

.preview-tile i {
    font-size: 1.55rem;
}

.preview-tile small {
    color: rgba(255, 255, 255, .7);
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #198754;
    background: rgba(25, 135, 84, .1);
    font-size: 1.25rem;
}

.landing-feature-mini {
    height: 100%;
    display: flex;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 18px;
    background: rgba(248, 250, 252, .78);
}

.landing-feature-mini i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #198754;
    background: rgba(25, 135, 84, .1);
    font-size: 1.2rem;
}

.landing-feature-mini p {
    margin: .2rem 0 0;
    color: var(--portal-muted);
    font-size: .92rem;
}

.landing-cta-card {
    background:
        radial-gradient(circle at top right, rgba(25, 135, 84, .16), transparent 16rem),
        rgba(255, 255, 255, .9);
}

.order-step {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
}

.order-step i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #198754;
    background: rgba(25, 135, 84, .1);
    font-size: 1.2rem;
}

.order-step span {
    display: block;
    color: var(--portal-muted);
    font-size: .92rem;
}

.subdomain-preview {
    border: 1px dashed rgba(25, 135, 84, .35);
    background: rgba(25, 135, 84, .06);
}

.instance-card {
    transition: transform .16s ease, box-shadow .16s ease;
}

.instance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 58px rgba(15, 23, 42, .13);
}

.instance-status-panel {
    display: flex;
    gap: .85rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(248, 250, 252, .86);
    border: 1px solid var(--portal-border);
}

.instance-status-panel i {
    font-size: 1.35rem;
}

.instance-status-panel p {
    margin: .15rem 0 0;
    color: var(--portal-muted);
    font-size: .92rem;
}

.instance-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}

.instance-status.pending { color: #92400e; background: #fef3c7; }
.instance-status.active { color: #166534; background: #dcfce7; }
.instance-status.suspended { color: #991b1b; background: #fee2e2; }
.instance-status.demo { color: #1d4ed8; background: #dbeafe; }
.instance-status.provisioning { color: #4338ca; background: #e0e7ff; }

.portal-admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.4rem;
    align-items: start;
}

.portal-admin-sidebar {
    position: sticky;
    top: 1.25rem;
    padding: .85rem;
    border: 1px solid var(--portal-border);
    border-radius: 24px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .08);
}

.portal-admin-brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .75rem .75rem 1rem;
    margin-bottom: .55rem;
    border-bottom: 1px solid var(--portal-border);
}

.portal-admin-brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, #198754, #0f766e);
    font-weight: 900;
    letter-spacing: -.04em;
}

.portal-admin-nav {
    display: grid;
    gap: .2rem;
}

.portal-admin-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .72rem .78rem;
    border-radius: 15px;
    color: #64748b;
    text-decoration: none;
    font-weight: 700;
    font-size: .92rem;
}

.portal-admin-nav-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    color: #0f5132;
    background: rgba(25, 135, 84, .1);
    font-weight: 900;
    line-height: 1;
}

.portal-admin-nav a:hover,
.portal-admin-nav a.active {
    color: #0f5132;
    background: rgba(25, 135, 84, .1);
}

.portal-admin-nav a.active .portal-admin-nav-icon {
    color: #fff;
    background: #198754;
}

.portal-admin-main {
    min-width: 0;
}

.portal-page-hero {
    padding: 1.25rem;
    border: 1px solid var(--portal-border);
    border-radius: 26px;
    background: rgba(255,255,255,.9);
    box-shadow: 0 18px 44px rgba(15,23,42,.08);
}

.portal-stat-card {
    height: 100%;
    padding: 1.15rem;
    border: 1px solid var(--portal-border);
    border-radius: 20px;
    background: rgba(255,255,255,.82);
}

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

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

.portal-table-card .table > :not(caption) > * > * {
    padding: .95rem 1rem;
}

@media (max-width: 991.98px) {
    .portal-admin-shell { display: block; }
    .portal-admin-sidebar { position: static; margin-bottom: 1rem; overflow-x: auto; padding: .5rem; }
    .portal-admin-brand { display: none; }
    .portal-admin-nav { display: flex; min-width: max-content; }
    .portal-admin-nav a { white-space: nowrap; }
}
