:root {
    --bg: #0b1020;
    --bg-soft: #111936;
    --panel: rgba(17, 25, 54, 0.82);
    --panel-strong: #121c3d;
    --stroke: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --text-soft: #97a4c0;
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #38bdf8;
    --shadow: 0 24px 80px rgba(2, 6, 23, 0.45);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.24), transparent 28%),
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 20%),
        linear-gradient(145deg, #070b17 0%, #0a1021 35%, #101935 100%);
    color: var(--text);
    min-height: 100vh;
}

body.auth-body {
    overflow-x: hidden;
}

body.app-body {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.12), transparent 20%),
        linear-gradient(150deg, #070b17 0%, #0e1430 55%, #151d3f 100%);
}

.text-secondary {
    color: var(--text-soft) !important;
}

.auth-shell,
.app-layout {
    min-height: 100vh;
}

.hero-panel,
.auth-panel,
.panel-card,
.app-modal,
.sidebar {
    background: var(--panel);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-panel,
.auth-panel {
    border-radius: var(--radius-xl);
    padding: 2rem;
}

.brand-badge,
.pill-live,
.status-badge,
.metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    font-weight: 700;
}

.brand-badge {
    background: rgba(99, 102, 241, 0.16);
    color: #dbe4ff;
}

.pill-live {
    background: rgba(34, 197, 94, 0.12);
    color: #a7f3d0;
}

.hero-stat-card,
.soft-note,
.highlight-row,
.list-tile,
.api-key-item,
.instance-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
}

.hero-stat-card {
    padding: 1rem;
    height: 100%;
}

.hero-stat-card strong,
.hero-stat-card small,
.hero-stat-label {
    display: block;
}

.hero-stat-card strong {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.hero-stat-card small,
.hero-stat-label {
    color: var(--text-soft);
}

.hero-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

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

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.feature-item i {
    color: #93c5fd;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.auth-panel .nav-pills {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    padding: 0.35rem;
}

.auth-panel .nav-pills .nav-link {
    color: var(--text-soft);
    border-radius: 999px;
    font-weight: 600;
}

.auth-panel .nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
}

.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
    border-radius: 14px;
    padding: 0.8rem 1rem;
}

.form-control::placeholder {
    color: rgba(151, 164, 192, 0.85);
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-color: rgba(99, 102, 241, 0.75);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

.form-label,
.form-check-label {
    color: #dce6fa;
    font-weight: 600;
}

.btn {
    border-radius: 14px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
}

.btn-outline-primary {
    color: #cbd5ff;
    border-color: rgba(99, 102, 241, 0.45);
}

.btn-outline-primary:hover,
.btn-outline-light:hover {
    color: #fff;
}

.btn-soft-primary {
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.12);
    color: #d7dcff;
}

.soft-note {
    padding: 1rem 1.1rem;
    color: #cdd8f1;
}

.app-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 1.25rem;
    padding: 1.25rem;
}

.sidebar {
    border-radius: var(--radius-xl);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 1.25rem;
    height: calc(100vh - 2.5rem);
}

.admin-sidebar {
    background: rgba(59, 7, 100, 0.36);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    font-size: 1.25rem;
}

.sidebar-brand small {
    display: block;
    color: var(--text-soft);
}

.sidebar-nav {
    display: grid;
    gap: 0.55rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    color: var(--text-soft);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 16px;
    text-align: left;
    transition: all 0.2s ease;
}

.sidebar-link.active,
.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.sidebar-footer {
    display: grid;
    gap: 1rem;
}

.mini-user-card {
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

.mini-user-card small {
    display: block;
    color: var(--text-soft);
    margin-top: 0.25rem;
}

.main-content {
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem 0.25rem 0.75rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.dashboard-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 270px;
    padding: 0.45rem 0.7rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 20, 45, 0.65);
}

.dashboard-search-wrap i {
    color: var(--text-soft);
}

.dashboard-search-wrap .form-control {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    color: var(--text);
}

.dashboard-search-wrap .form-control:focus {
    box-shadow: none;
}

.dashboard-search-wrap .form-control::placeholder {
    color: #7f8cad;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.panel-card {
    border-radius: var(--radius-lg);
    padding: 1.35rem;
    height: 100%;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(120deg, rgba(7, 126, 95, 0.95), rgba(5, 93, 72, 0.96));
    border: 1px solid rgba(55, 194, 157, 0.35);
}

.hero-kicker {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #bcf0df;
    font-weight: 700;
}

.dashboard-hero h2,
.dashboard-hero p {
    color: #e7fff7 !important;
}

.hero-cta-group {
    display: grid;
    gap: 0.65rem;
    min-width: 240px;
}

.hero-cta-group .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.35);
}

.company-profile-progress .progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 0.45rem;
}

.quick-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.quick-feature-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transition: all 0.2s ease;
}

.quick-feature-btn i {
    color: #93c5fd;
}

.quick-feature-btn:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.1);
}

.panel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.metric-card {
    padding: 1.15rem;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(17, 25, 54, 0.95), rgba(17, 25, 54, 0.7));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    height: 100%;
}

.metric-label {
    color: var(--text-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.35rem 0;
}

.metric-helper {
    color: #d8e0f8;
}

.status-badge {
    font-weight: 700;
}

.status-connected,
.status-active,
.status-paid,
.status-sent,
.status-received {
    background: rgba(34, 197, 94, 0.14);
    color: #a7f3d0;
}

.status-disconnected,
.status-blocked,
.status-failed,
.status-canceled {
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

.status-pending,
.status-trial,
.status-past_due {
    background: rgba(245, 158, 11, 0.14);
    color: #fde68a;
}

.status-inactive,
.status-refunded {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.instance-card {
    padding: 1.15rem;
    display: grid;
    gap: 0.9rem;
    height: 100%;
}

.instance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.instance-actions,
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.instance-meta,
.stack-list {
    display: grid;
    gap: 0.75rem;
}

.list-tile,
.api-key-item,
.highlight-row {
    padding: 0.95rem 1rem;
}

.list-tile small,
.api-key-item small,
.highlight-row small {
    display: block;
    color: var(--text-soft);
    margin-top: 0.2rem;
}

.stack-list.slim-list {
    max-height: 520px;
    overflow: auto;
}

.app-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: rgba(255, 255, 255, 0.07);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
}

.app-table thead th {
    color: #d8e0f8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom-width: 1px;
}

.app-modal {
    border-radius: 24px;
    color: var(--text);
}

.qr-canvas {
    background: #fff;
    padding: 0.85rem;
    border-radius: 18px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.plan-card {
    padding: 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    height: 100%;
}

.plan-price {
    font-size: 1.9rem;
    font-weight: 800;
}

.context-preview {
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #c9d4f3;
}

.toast {
    background: rgba(17, 25, 54, 0.96);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-soft);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 18px;
}

code.inline-token,
.token-inline {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    color: #c8d2ff;
    border-radius: 10px;
    padding: 0.25rem 0.55rem;
}

body.auth-page-zapi {
    background: #f3f5f8;
    color: #111827;
}

.auth-page-zapi .zapi-auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.06fr 0.94fr;
}

.auth-page-zapi .zapi-login-side {
    background: #f3f5f8;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.25rem 1.2rem;
}

.auth-page-zapi .zapi-login-card {
    width: 100%;
    max-width: 430px;
}

.auth-page-zapi .zapi-tools-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.8rem;
}

.auth-page-zapi .zapi-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #d9dfeb;
    background: #fff;
    color: #4b5563;
    border-radius: 8px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.auth-page-zapi .zapi-brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.4rem;
}

.auth-page-zapi .zapi-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    font-weight: 800;
    color: #7ecf65;
    background: rgba(126, 207, 101, 0.16);
}

.auth-page-zapi .zapi-brand-name {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: #79cb62;
}

.auth-page-zapi .zapi-brand-sub {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.auth-page-zapi .zapi-login-title {
    font-size: 1.55rem;
    line-height: 1.2;
    margin: 0;
    color: #111827;
    font-weight: 800;
}

.auth-page-zapi .zapi-login-subtitle {
    margin-top: 0.35rem;
    margin-bottom: 1rem;
    color: #6b7280;
    font-size: 0.88rem;
}

.auth-page-zapi .zapi-form-stack {
    display: grid;
    gap: 0.85rem;
}

.auth-page-zapi .form-label {
    color: #4b5563;
    font-size: 0.78rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.auth-page-zapi .form-control {
    background: #fff;
    color: #111827;
    border: 1px solid #d7dde8;
    border-radius: 8px;
    padding: 0.62rem 0.74rem;
    font-size: 0.9rem;
}

.auth-page-zapi .form-control::placeholder {
    color: #9ca3af;
}

.auth-page-zapi .form-control:focus {
    background: #fff;
    color: #111827;
    border-color: #83ce69;
    box-shadow: 0 0 0 0.17rem rgba(126, 207, 101, 0.2);
}

.auth-page-zapi .zapi-help-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -0.15rem;
}

.auth-page-zapi .zapi-link-muted {
    color: #9ca3af;
    font-size: 0.75rem;
    text-decoration: none;
}

.auth-page-zapi .zapi-link-muted:hover {
    color: #6b7280;
}

.auth-page-zapi .zapi-btn-enter {
    margin-top: 0.3rem;
    border-radius: 8px;
    border: 0;
    background: #0cb254;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.63rem 0.85rem;
}

.auth-page-zapi .zapi-btn-enter:hover {
    background: #0aa049;
    color: #fff;
}

.auth-page-zapi .zapi-divider {
    margin: 0.95rem 0;
    text-align: center;
    position: relative;
    color: #c0c8d8;
    font-size: 0.78rem;
}

.auth-page-zapi .zapi-divider::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 1px solid #e4e9f2;
}

.auth-page-zapi .zapi-divider span {
    position: relative;
    background: #f3f5f8;
    padding: 0 0.55rem;
}

.auth-page-zapi .zapi-btn-register {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #20be64;
    color: #20be64;
    background: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0.62rem 0.8rem;
}

.auth-page-zapi .zapi-btn-register:hover {
    background: #f1fff6;
    color: #14984c;
}

.auth-page-zapi .zapi-feature-side {
    background: #1d2334;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-page-zapi .zapi-feature-panel {
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    background: linear-gradient(180deg, #23293c 0%, #1d2334 100%);
    padding: 2.35rem 2.1rem;
    color: #f8fafc;
    min-height: 82vh;
    display: flex;
    flex-direction: column;
}

.auth-page-zapi .zapi-feature-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.auth-page-zapi .zapi-feature-illustration {
    flex: 1;
    display: grid;
    place-items: center;
    position: relative;
    margin-bottom: 1rem;
}

.auth-page-zapi .zapi-bot-icon {
    width: 160px;
    height: 160px;
    border-radius: 30px;
    background: linear-gradient(160deg, #00c16c, #0ea35d);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 4.1rem;
    box-shadow: 0 22px 45px rgba(0, 193, 108, 0.35);
}

.auth-page-zapi .zapi-bubble {
    position: absolute;
    top: 18%;
    left: 12%;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.25rem;
}

.auth-page-zapi .zapi-bubble-alt {
    left: auto;
    right: 10%;
    top: 30%;
}

.auth-page-zapi .zapi-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.8rem;
}

.auth-page-zapi .zapi-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #e5e7eb;
    font-size: 1rem;
}

.auth-page-zapi .zapi-feature-list i {
    color: #21c56d;
}

.auth-page-zapi .zapi-feature-list .zapi-more {
    color: #f8fafc;
    font-weight: 600;
}

@media (max-width: 1199px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .auth-page-zapi .zapi-auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-page-zapi .zapi-feature-side {
        display: none;
    }
}

@media (max-width: 991px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-search-wrap {
        width: 100%;
    }

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

    .hero-cta-group {
        min-width: auto;
    }

    .quick-feature-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .auth-panel,
    .panel-card,
    .sidebar {
        padding: 1.35rem;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 767px) {
    .app-layout {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-link {
        justify-content: center;
    }

    .sidebar-link span {
        display: none;
    }

    .panel-card-header,
    .instance-card-header,
    .topbar-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
