.app-shell {
    --af-obsidian: #111827;
    --af-charcoal: #182233;
    --af-surface: #202B3B;
    --af-surface-hover: #263346;
    --af-surface-elevated: #28374B;
    --af-gold: #D6AD65;
    --af-gold-hover: #E2BD78;
    --af-gold-muted: rgba(214, 173, 101, .12);
    --af-gold-border: rgba(214, 173, 101, .35);
    --af-orange: #48A99A;
    --af-ivory: #F5F1E8;
    --af-white: #F5F1E8;
    --af-text-primary: #F5F1E8;
    --af-text-secondary: #A5AFBF;
    --af-text-muted: #A5AFBF;
    --af-border: #354154;
    --af-border-light: #44536A;
    --af-border-focus: #D6AD65;
    --af-success: #48A99A;
    --af-info: #48A99A;
    --af-teal: #48A99A;
    --shadow-gold: 0 8px 24px rgba(214, 173, 101, .12);
    background: #111827;
    color: #F5F1E8;
}

.app-shell .app-main {
    min-width: 0;
    background: #111827;
}

.app-shell .app-topbar {
    background: rgba(24, 34, 51, .97);
    border-color: #354154;
}

.app-shell .mobile-menu-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #354154;
    border-radius: 12px;
    background: #202B3B;
    color: #F5F1E8;
}

.app-shell .mobile-menu-button:hover,
.app-shell .mobile-menu-button:focus-visible,
.app-shell .notification-trigger:hover,
.app-shell .notification-trigger:focus-visible {
    border-color: rgba(214, 173, 101, .6);
    background: #263346;
    color: #D6AD65;
}

.app-shell .notification-overlay {
    --notification-bg: #111827;
    --notification-surface: #182233;
    --notification-elevated: #202B3B;
    --notification-gold: #D6AD65;
    --notification-orange: #48A99A;
    --notification-text: #F5F1E8;
    --notification-muted: #A5AFBF;
    --notification-border: #354154;
}

.app-shell .notification-panel { border-color: #354154; }

.app-shell .app-content-body {
    color: #F5F1E8;
}

.app-shell .mobile-navigation-drawer {
    --bs-offcanvas-height: min(90dvh, 780px);
    height: min(90dvh, 780px);
    max-height: calc(100dvh - env(safe-area-inset-top) - 8px);
    border: 1px solid #354154;
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: #111827;
    color: #F5F1E8;
    box-shadow: 0 -18px 56px rgba(0, 0, 0, .4);
}

.app-shell .mobile-navigation-drawer.show:not(.hiding),
.app-shell .mobile-navigation-drawer.showing {
    transform: translateY(0) !important;
}

.mobile-more-handle {
    width: 38px;
    height: 4px;
    flex: 0 0 4px;
    margin: 10px auto 0;
    border-radius: 999px;
    background: #44536A;
}

.app-shell .mobile-navigation-drawer .offcanvas-header {
    min-height: 66px;
    padding: 12px 18px;
    border-bottom: 1px solid #354154;
}

.app-shell .mobile-navigation-drawer .offcanvas-title {
    color: #F5F1E8;
    font-size: 1.05rem;
    font-weight: 700;
}

.mobile-more-subtitle {
    margin-top: 2px;
    color: #A5AFBF;
    font-size: .72rem;
}

.mobile-more-close {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid #354154;
    border-radius: 12px;
    background: #202B3B;
    color: #F5F1E8;
    font-size: 1.1rem;
}

.mobile-more-close:hover,
.mobile-more-close:focus-visible {
    border-color: rgba(214, 173, 101, .6);
    color: #D6AD65;
}

.mobile-more-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px max(16px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.mobile-drawer-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 11px 12px;
    border: 1px solid #354154;
    border-radius: 14px;
    background: #182233;
    color: #A5AFBF;
    font-size: 12px;
}

.mobile-account-identity,
.mobile-account-entitlements {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.mobile-account-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid rgba(214, 173, 101, .32);
    border-radius: 50%;
    background: rgba(214, 173, 101, .12);
    color: #D6AD65;
    font-weight: 700;
}

.mobile-account-name {
    max-width: 30vw;
    overflow: hidden;
    color: #F5F1E8;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-account-entitlements { gap: 8px; white-space: nowrap; }
.mobile-account-entitlements .badge-plan-pill { font-size: .62rem; }

.mobile-nav-search {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    margin-bottom: 17px;
    padding: 0 12px;
    border: 1px solid #354154;
    border-radius: 12px;
    background: #182233;
    color: #A5AFBF;
}

.mobile-nav-search:focus-within { border-color: #D6AD65; }
.mobile-nav-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #F5F1E8;
    font: inherit;
    font-size: .85rem;
}
.mobile-nav-search input::placeholder { color: #A5AFBF; }
.mobile-nav-search kbd {
    padding: 1px 5px;
    border: 1px solid #44536A;
    border-radius: 5px;
    color: #A5AFBF;
    font-size: .65rem;
}

.mobile-more-groups { display: flex; flex-direction: column; gap: 17px; }
.mobile-more-group h3 {
    margin: 0 0 6px;
    color: #A5AFBF;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mobile-more-group a,
.mobile-drawer-signout {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #F5F1E8;
    font-size: .86rem;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.mobile-more-group a > i:first-child,
.mobile-drawer-signout > i {
    width: 19px;
    flex: 0 0 19px;
    color: #A5AFBF;
    text-align: center;
}

.mobile-more-group a:hover,
.mobile-more-group a:focus-visible,
.mobile-more-group a[aria-current="page"] {
    border-color: rgba(214, 173, 101, .22);
    background: #202B3B;
    color: #D6AD65;
}

.mobile-more-group a:hover > i:first-child,
.mobile-more-group a:focus-visible > i:first-child,
.mobile-more-group a[aria-current="page"] > i:first-child { color: #D6AD65; }
.mobile-more-group a > span:first-of-type { min-width: 0; flex: 1; }
.mobile-nav-selected { color: #D6AD65 !important; font-size: .78rem; }
.mobile-nav-tier {
    padding: 3px 7px;
    border: 1px solid rgba(214, 173, 101, .28);
    border-radius: 999px;
    color: #D6AD65;
    font-size: .6rem;
    text-transform: uppercase;
}
.mobile-more-admin { padding-top: 14px; border-top: 1px solid #354154; }
.mobile-drawer-signout {
    margin-top: 8px;
    border-color: rgba(240, 165, 165, .16);
    background: rgba(240, 165, 165, .06);
    color: #F0A5A5;
}
.mobile-drawer-signout > i { color: #F0A5A5; }
.mobile-nav-no-results { padding: 18px 0; color: #A5AFBF; text-align: center; }
.mobile-more-groups [hidden],
.mobile-nav-no-results[hidden] { display: none !important; }

.dash-container { min-width: 0; }
.dash-header-section { min-width: 0; }
.dash-title-group h1 { overflow-wrap: anywhere; }
.dash-title-group .badge-plan-pill { color: #D6AD65; }
.dash-actions-group { flex-wrap: wrap; }
.metrics-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-metric-card { min-width: 0; background: #182233; }
.stat-icon-blue {
    border-color: rgba(72, 169, 154, .3);
    background: rgba(72, 169, 154, .12);
    color: #48A99A;
}
.stat-icon-amber {
    border-color: rgba(214, 173, 101, .25);
    background: rgba(214, 173, 101, .12);
    color: #D6AD65;
}

.workspace-tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-studio-card {
    min-width: 0;
    min-height: 0;
    justify-content: flex-start;
    gap: 12px;
    padding: 1.15rem;
    background: #182233;
}

.tool-studio-card.flagship-card {
    background: #182233;
    box-shadow: none;
}

.tool-studio-card:hover,
.tool-studio-card.flagship-card:hover {
    border-color: rgba(214, 173, 101, .55);
    background: #202B3B;
    box-shadow: none;
}

.tool-studio-card:nth-child(odd) .tool-icon-frame {
    border: 1px solid rgba(214, 173, 101, .25);
    background: rgba(214, 173, 101, .12) !important;
    color: #D6AD65 !important;
}

.tool-studio-card:nth-child(even) .tool-icon-frame {
    border: 1px solid rgba(72, 169, 154, .25);
    background: rgba(72, 169, 154, .12) !important;
    color: #48A99A !important;
}

.tool-card-body h3 { font-size: 1rem; }
.tool-card-body p { color: #A5AFBF; line-height: 1.5; }
.tool-provider-badge {
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tool-card-action { margin-top: auto; }

.mobile-bottom-nav {
    height: calc(68px + env(safe-area-inset-bottom));
    padding: 5px 12px calc(5px + env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    background: rgba(24, 34, 51, .97);
    border-color: #354154;
}

.mobile-nav-item {
    position: relative;
    flex: 1 1 0;
    width: 20%;
    min-width: 44px;
    min-height: 48px;
    gap: 2px;
    padding: 5px 3px;
    border-radius: 10px;
    color: #A5AFBF;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
}

.mobile-nav-item i { font-size: 17px; }
.mobile-nav-item.active { color: #D6AD65; }
.mobile-nav-item.active::before {
    position: absolute;
    top: 0;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #D6AD65;
    content: "";
}

.mobile-nav-item.center-action {
    width: 20%;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: #A5AFBF !important;
}

.mobile-nav-item.center-action.active { color: #D6AD65 !important; }
.mobile-nav-item.center-action i { color: currentColor; font-size: 17px; }
.mobile-nav-more {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
}
.mobile-nav-more:focus-visible { outline: 2px solid #D6AD65; outline-offset: -2px; }

@media (min-width: 1200px) {
    .metrics-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1199.98px) {
    .metrics-row,
    .workspace-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
    .app-shell .app-main {
        margin-left: 0 !important;
        padding-bottom: calc(68px + env(safe-area-inset-bottom));
    }

    .app-shell .app-topbar {
        position: sticky;
        top: 0;
        z-index: 1020;
        height: auto;
        min-height: 56px;
        padding-top: max(7px, env(safe-area-inset-top));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: 7px;
        padding-left: max(12px, env(safe-area-inset-left));
    }

    .app-shell .topbar-left { gap: 0; }
    .app-shell .topbar-right { gap: 8px; }
    .app-shell .topbar-right .credits-pill,
    .app-shell .topbar-right .btn-topbar-upgrade,
    .app-shell .topbar-right .user-avatar-pill,
    .app-shell .topbar-left > .badge-plan-pill { display: none !important; }

    .app-shell .notification-trigger {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        border-radius: 12px;
        background: #202B3B;
    }

    .app-shell .app-content-body {
        padding: 1rem 1rem 1.5rem;
    }

    .metrics-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 1.35rem;
    }

    .stat-metric-card {
        min-height: 78px;
        gap: 10px;
        padding: 11px;
        border-radius: 14px;
    }

    .stat-icon-wrapper {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        font-size: .9rem;
    }

    .stat-value { font-size: 1.12rem; }
    .stat-label { font-size: .68rem; line-height: 1.3; }
    .workspace-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tool-studio-card { padding: 12px; border-radius: 14px; }
    .tool-card-top { margin-bottom: 8px; }
    .tool-icon-frame { width: 34px; height: 34px; font-size: 1rem; }
    .tool-card-body h3 { margin-bottom: 5px; font-size: .9rem; }
    .tool-card-body p { margin-bottom: 0; font-size: .7rem; line-height: 1.4; }
    .tool-card-action { padding-top: 9px; font-size: .7rem; }
    .tool-provider-badge { max-width: 74px; font-size: .62rem; }
}

@media (max-width: 575.98px) {
    .app-shell .app-topbar { padding-right: 10px; padding-left: 10px; }
    .app-shell .mobile-topbar-logo { font-size: 1rem; }
    .app-shell .topbar-right { gap: 7px; }
    .app-shell .app-content-body { padding-right: 12px; padding-left: 12px; }

    .dash-header-section {
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 1rem;
    }

    .dash-title-group h1 { font-size: 1.3rem; line-height: 1.3; }
    .dash-title-group p { font-size: .75rem; }
    .dash-actions-group { gap: 8px; }
    .btn-primary-action,
    .btn-secondary-action { min-height: 42px; padding: 8px 10px; font-size: .72rem; }
    .btn-primary-action { background: #D6AD65; box-shadow: none; }
    .btn-primary-action:hover { box-shadow: none; }
    .dash-section-header { margin-bottom: .75rem; }
    .dash-section-title { font-size: 1rem; }
    .dash-section-sub { font-size: .68rem; }
    .tool-studio-card { padding: 10px; }
    .tool-card-body h3 { font-size: .84rem; }
    .tool-card-action { font-size: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav-item,
    .tool-studio-card,
    .mobile-more-group a { transition: none; }
}
