.ax-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: var(--ax-radius-md);
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: 160ms ease;
}

.ax-btn-primary {
    background: linear-gradient(135deg, var(--ax-primary), #60a5fa);
    color: #ffffff;
    box-shadow: var(--ax-shadow-sm);
}

.ax-btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    color: #ffffff;
}

.ax-btn-secondary {
    background: rgba(37, 99, 235, 0.10);
    color: var(--ax-primary);
    border-color: rgba(37, 99, 235, 0.22);
}

.ax-btn-secondary:hover {
    background: rgba(37, 99, 235, 0.16);
}

.ax-card {
    background: rgba(17, 24, 39, 0.72);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-lg);
    box-shadow: var(--ax-shadow-sm);
}

.ax-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.22);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ax-input {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border-radius: var(--ax-radius-md);
    border: 1px solid var(--ax-border-strong);
    background: rgba(15, 23, 42, 0.72);
    color: var(--ax-text);
    outline: none;
    transition: 160ms ease;
}

.ax-input:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.ax-section-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ax-section-copy {
    margin: 0;
    color: var(--ax-text-muted);
    font-size: 15px;
    line-height: 1.7;
}

.ax-kpi {
    padding: 18px;
    border-radius: var(--ax-radius-lg);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(17, 24, 39, 0.84));
    border: 1px solid var(--ax-border);
    box-shadow: var(--ax-shadow-sm);
}

.ax-kpi-label {
    margin: 0 0 8px;
    color: var(--ax-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ax-kpi-value {
    margin: 0;
    color: var(--ax-text-strong);
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.ax-alert {
    padding: 14px 16px;
    border-radius: var(--ax-radius-md);
    border: 1px solid var(--ax-border);
    background: rgba(15, 23, 42, 0.68);
}

.ax-alert-info {
    border-color: rgba(37, 99, 235, 0.24);
}

.ax-alert-warning {
    border-color: rgba(245, 158, 11, 0.24);
}

.ax-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    transition: 140ms ease;
}

.ax-nav-item:hover {
    background: rgba(148, 163, 184, 0.08);
}

.ax-nav-item.is-active {
    background: rgba(37, 99, 235, 0.14);
    border: 1px solid rgba(37, 99, 235, 0.22);
}

.ax-shell-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.ax-sidebar-card {
    padding: 16px;
    border-radius: 18px;
}

.ax-sidebar-title {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--ax-text-muted);
}

.ax-nav-stack {
    display: grid;
    gap: 10px;
}

.ax-workspace {
    display: grid;
    gap: 22px;
}

.ax-page-hero {
    padding: 24px;
    border-radius: 20px;
}

.ax-page-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
}

.ax-page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ax-page-split {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
}

.ax-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.ax-panel {
    padding: 22px;
    border-radius: 20px;
}

.ax-panel-title {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ax-text-muted);
}

.ax-panel-headline {
    margin: 0 0 10px;
    color: var(--ax-text-strong);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
}

.ax-panel-copy {
    margin: 0;
    color: var(--ax-text-muted);
    line-height: 1.7;
}

.ax-two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ax-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--ax-text-muted);
    line-height: 1.8;
}

.ax-list li + li {
    margin-top: 4px;
}

.ax-module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.ax-module-item {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--ax-border);
    background: rgba(148, 163, 184, 0.05);
}

.ax-module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.ax-module-item p {
    margin: 0;
    line-height: 1.7;
}

.ax-module-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.ax-module-live {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, 0.20);
}

.ax-module-ready {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.20);
}

.ax-endpoint-stack {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.ax-endpoint {
    display: block;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--ax-border);
    background: rgba(15, 23, 42, 0.66);
    overflow-wrap: anywhere;
}

.ax-endpoint code {
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
}

.ax-tabbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: -4px;
}

.ax-tab {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--ax-border);
    text-decoration: none;
    color: var(--ax-text);
    background: rgba(148, 163, 184, 0.06);
    font-weight: 700;
}

.ax-tab.is-active {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(37, 99, 235, 0.26);
}

.ax-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.ax-data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ax-text-muted);
}

.ax-data-table td {
    padding: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.ax-btn-primary,
.ax-btn-primary:visited,
.ax-btn-primary:hover,
.ax-btn-primary:focus,
.btn.btn-primary,
.btn.btn-primary:visited,
.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.primary,
.btn.primary:visited,
.btn.primary:hover,
.btn.primary:focus {
    color: #ffffff !important;
    text-shadow: none !important;
}

html[data-theme="ainex-premium-dark"] .ax-card,
html[data-theme="ainex-premium-dark"] .ax-panel,
html[data-theme="ainex-premium-dark"] .ax-page-hero,
html[data-theme="ainex-premium-dark"] .ax-sidebar-card,
html[data-theme="ainex-premium-dark"] .ax-kpi {
    background: linear-gradient(180deg, rgba(10, 19, 40, 0.88), rgba(8, 15, 32, 0.84)) !important;
    border: 1px solid rgba(148, 163, 184, 0.18) !important;
    color: #e5e7eb !important;
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.28) !important;
}

html[data-theme="ainex-premium-light"] .ax-card,
html[data-theme="ainex-premium-light"] .ax-panel,
html[data-theme="ainex-premium-light"] .ax-page-hero,
html[data-theme="ainex-premium-light"] .ax-sidebar-card,
html[data-theme="ainex-premium-light"] .ax-kpi {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    color: #0f172a !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="ainex-premium-dark"] .ax-panel-title,
html[data-theme="ainex-premium-dark"] .ax-kpi-label,
html[data-theme="ainex-premium-dark"] .ax-section-copy,
html[data-theme="ainex-premium-dark"] .ax-panel-copy,
html[data-theme="ainex-premium-dark"] .ax-list,
html[data-theme="ainex-premium-dark"] .ax-list li,
html[data-theme="ainex-premium-dark"] .ax-data-table th {
    color: #94a3b8 !important;
}

html[data-theme="ainex-premium-light"] .ax-panel-title,
html[data-theme="ainex-premium-light"] .ax-kpi-label,
html[data-theme="ainex-premium-light"] .ax-section-copy,
html[data-theme="ainex-premium-light"] .ax-panel-copy,
html[data-theme="ainex-premium-light"] .ax-list,
html[data-theme="ainex-premium-light"] .ax-list li,
html[data-theme="ainex-premium-light"] .ax-data-table th {
    color: #475569 !important;
}

html[data-theme="ainex-premium-dark"] .ax-panel-headline,
html[data-theme="ainex-premium-dark"] .ax-section-title,
html[data-theme="ainex-premium-dark"] .ax-kpi-value,
html[data-theme="ainex-premium-dark"] .ax-sidebar-title,
html[data-theme="ainex-premium-dark"] .ax-data-table td,
html[data-theme="ainex-premium-dark"] .ax-tab {
    color: #f8fafc !important;
}

html[data-theme="ainex-premium-light"] .ax-panel-headline,
html[data-theme="ainex-premium-light"] .ax-section-title,
html[data-theme="ainex-premium-light"] .ax-kpi-value,
html[data-theme="ainex-premium-light"] .ax-sidebar-title,
html[data-theme="ainex-premium-light"] .ax-data-table td,
html[data-theme="ainex-premium-light"] .ax-tab {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .ax-nav-item {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .ax-nav-item:hover {
    background: rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="ainex-premium-light"] .ax-nav-item.is-active {
    background: rgba(37, 99, 235, 0.10) !important;
    border: 1px solid rgba(37, 99, 235, 0.18) !important;
}

html[data-theme="ainex-premium-dark"] .ax-btn-secondary {
    background: rgba(37, 99, 235, 0.10) !important;
    color: #60a5fa !important;
    border-color: rgba(37, 99, 235, 0.22) !important;
}

html[data-theme="ainex-premium-light"] .ax-btn-secondary {
    background: rgba(37, 99, 235, 0.08) !important;
    color: #1d4ed8 !important;
    border-color: rgba(37, 99, 235, 0.18) !important;
}

html[data-theme="ainex-premium-light"] .ax-endpoint {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="ainex-premium-light"] .ax-endpoint code {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .ax-module-item {
    background: rgba(255, 255, 255, 0.92) !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="ainex-premium-light"] .content,
html[data-theme="ainex-premium-light"] .ax-workspace {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .content a {
    color: #1d4ed8 !important;
}

html[data-theme="ainex-premium-light"] .content a:hover {
    color: #1e40af !important;
}

@media (max-width: 1100px) {
    .ax-kpi-grid,
    .ax-page-split,
    .ax-two-col,
    .ax-module-grid {
        grid-template-columns: 1fr;
    }

    .ax-page-hero-grid {
        grid-template-columns: 1fr;
    }

    .ax-page-actions {
        justify-content: flex-start;
    }
}

/* === Vendor/workspace light-mode strip fix === */
html[data-theme="ainex-premium-light"] .ax-input,
html[data-theme="ainex-premium-light"] select.ax-input,
html[data-theme="ainex-premium-light"] textarea.ax-textarea,
html[data-theme="ainex-premium-light"] .ax-textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow: none !important;
}

html[data-theme="ainex-premium-light"] .ax-input::placeholder,
html[data-theme="ainex-premium-light"] .ax-textarea::placeholder {
    color: #64748b !important;
}

html[data-theme="ainex-premium-light"] .ax-filterbar,
html[data-theme="ainex-premium-light"] .ax-form-grid,
html[data-theme="ainex-premium-light"] .ax-module-sidebar,
html[data-theme="ainex-premium-light"] .ax-workspace-main {
    background: transparent !important;
}

html[data-theme="ainex-premium-light"] .ax-data-table td,
html[data-theme="ainex-premium-light"] .ax-data-table th {
    background: transparent !important;
}

html[data-theme="ainex-premium-light"] .ax-empty-state {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px dashed rgba(15, 23, 42, 0.16) !important;
    border-radius: 16px;
    padding: 18px;
}

html[data-theme="ainex-premium-light"] .ax-json-viewer {
    background: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
    border-radius: 16px;
    padding: 16px;
    white-space: pre-wrap;
    overflow: auto;
}

html[data-theme="ainex-premium-light"] .ax-cap-badge {
    background: rgba(37, 99, 235, 0.08) !important;
    color: #1d4ed8 !important;
    border: 1px solid rgba(37, 99, 235, 0.14) !important;
}

html[data-theme="ainex-premium-light"] .ax-badge-cloud {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

html[data-theme="ainex-premium-light"] .ax-alert {
    background: #ffffff !important;
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .ax-alert-warning {
    border-color: rgba(245, 158, 11, 0.28) !important;
}

html[data-theme="ainex-premium-light"] .ax-alert-info {
    border-color: rgba(37, 99, 235, 0.22) !important;
}

/* === FINAL hard override for light-mode form controls === */
html[data-theme="ainex-premium-light"] .ax-workspace input,
html[data-theme="ainex-premium-light"] .ax-workspace select,
html[data-theme="ainex-premium-light"] .ax-workspace textarea,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-input,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-textarea,
html[data-theme="ainex-premium-light"] .ax-panel input,
html[data-theme="ainex-premium-light"] .ax-panel select,
html[data-theme="ainex-premium-light"] .ax-panel textarea,
html[data-theme="ainex-premium-light"] .ax-panel .ax-input,
html[data-theme="ainex-premium-light"] .ax-panel .ax-textarea {
    background: #ffffff !important;
    background-image: none !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

html[data-theme="ainex-premium-light"] .ax-workspace input::placeholder,
html[data-theme="ainex-premium-light"] .ax-workspace textarea::placeholder,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-input::placeholder,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-textarea::placeholder,
html[data-theme="ainex-premium-light"] .ax-panel input::placeholder,
html[data-theme="ainex-premium-light"] .ax-panel textarea::placeholder,
html[data-theme="ainex-premium-light"] .ax-panel .ax-input::placeholder,
html[data-theme="ainex-premium-light"] .ax-panel .ax-textarea::placeholder {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

html[data-theme="ainex-premium-light"] .ax-workspace input:focus,
html[data-theme="ainex-premium-light"] .ax-workspace select:focus,
html[data-theme="ainex-premium-light"] .ax-workspace textarea:focus,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-input:focus,
html[data-theme="ainex-premium-light"] .ax-workspace .ax-textarea:focus,
html[data-theme="ainex-premium-light"] .ax-panel input:focus,
html[data-theme="ainex-premium-light"] .ax-panel select:focus,
html[data-theme="ainex-premium-light"] .ax-panel textarea:focus,
html[data-theme="ainex-premium-light"] .ax-panel .ax-input:focus,
html[data-theme="ainex-premium-light"] .ax-panel .ax-textarea:focus {
    background: #ffffff !important;
    background-image: none !important;
    color: #0f172a !important;
    border-color: rgba(37, 99, 235, 0.45) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10) !important;
    outline: none !important;
}

html[data-theme="ainex-premium-light"] .ax-filterbar input,
html[data-theme="ainex-premium-light"] .ax-filterbar select,
html[data-theme="ainex-premium-light"] .ax-form-grid input,
html[data-theme="ainex-premium-light"] .ax-form-grid select,
html[data-theme="ainex-premium-light"] .ax-form-grid textarea {
    background: #ffffff !important;
    background-image: none !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
}

html[data-theme="ainex-premium-light"] .ax-field-label {
    color: #334155 !important;
}

html[data-theme="ainex-premium-light"] .ax-filterbar,
html[data-theme="ainex-premium-light"] .ax-form-grid {
    gap: 12px;
}

html[data-theme="ainex-premium-light"] select {
    color-scheme: light !important;
}


/* === AX COMPONENT SYSTEM V2 === */

.ax-btn-ghost {
    background: transparent;
    color: var(--ax-text);
    border-color: var(--ax-border);
}

.ax-btn-ghost:hover {
    background: rgba(148, 163, 184, 0.08);
}

.ax-btn-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--ax-danger);
    border-color: rgba(220, 38, 38, 0.22);
}

.ax-btn-danger:hover {
    background: rgba(220, 38, 38, 0.18);
}

.ax-input-error {
    border-color: rgba(220, 38, 38, 0.45);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.ax-input:focus,
.ax-btn:focus,
.ax-nav-item:focus {
    outline: none;
    box-shadow: var(--ax-focus-ring);
}

.ax-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--ax-border);
    background: rgba(148, 163, 184, 0.08);
    color: var(--ax-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ax-chip-success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--ax-success);
    border-color: rgba(22, 163, 74, 0.22);
}

.ax-chip-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.22);
}

.ax-chip-danger {
    background: rgba(220, 38, 38, 0.12);
    color: var(--ax-danger);
    border-color: rgba(220, 38, 38, 0.22);
}

.ax-chip-ai {
    background: rgba(124, 58, 237, 0.12);
    color: var(--ax-ai);
    border-color: rgba(124, 58, 237, 0.22);
}

.ax-card-panel {
    background: color-mix(in srgb, var(--ax-surface) 92%, transparent);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-xl);
    box-shadow: var(--ax-shadow-sm);
}

.ax-card-kpi {
    background: color-mix(in srgb, var(--ax-surface-2) 94%, transparent);
    border: 1px solid var(--ax-border);
    border-radius: var(--ax-radius-lg);
    box-shadow: var(--ax-shadow-sm);
}

.ax-card-empty {
    border: 1px dashed var(--ax-border-strong);
    border-radius: var(--ax-radius-lg);
    background: rgba(148, 163, 184, 0.04);
    padding: 24px;
}

.ax-card-empty h3 {
    margin: 0 0 8px;
    color: var(--ax-text-strong);
    font-size: 18px;
    font-weight: 800;
}

.ax-card-empty p {
    margin: 0;
    color: var(--ax-text-muted);
    line-height: 1.7;
}

.ax-section-header {
    display: grid;
    gap: 8px;
}

.ax-section-meta {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ax-text-muted);
}

.ax-metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.ax-action-zone {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.ax-table-wrap {
    overflow-x: auto;
    max-width: 100%;
}

.ax-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ax-table th {
    text-align: left;
    padding: 14px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ax-text-muted);
    border-bottom: 1px solid var(--ax-border);
}

.ax-table td {
    padding: 16px 14px;
    color: var(--ax-text);
    border-bottom: 1px solid color-mix(in srgb, var(--ax-border) 80%, transparent);
    vertical-align: middle;
}

.ax-table tr:hover td {
    background: rgba(37, 99, 235, 0.03);
}

@media (max-width: 1100px) {
    .ax-metric-strip,
    .ax-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .ax-metric-strip,
    .ax-kpi-grid,
    .ax-two-col,
    .ax-module-grid {
        grid-template-columns: 1fr;
    }

    .ax-page-hero-grid,
    .ax-page-split,
    .ax-shell-grid {
        grid-template-columns: 1fr;
    }

    .ax-page-actions,
    .ax-action-zone {
        justify-content: flex-start;
    }
}



/* === PHASE 5 SHELL SYSTEM === */

/* ainex-layout-theme-overrides */
html[data-theme="ainex-premium-dark"] body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 30%),
        linear-gradient(180deg, #061225 0%, #08101f 100%) !important;
    color: var(--ax-text) !important;
}

html[data-theme="ainex-premium-light"] body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, #f6f9ff 0%, #edf3ff 100%) !important;
    color: var(--ax-text) !important;
}

html[data-theme="ainex-premium-dark"] .banner {
    background: linear-gradient(90deg, #0f172a, #172554) !important;
    color: #ffffff !important;
}

html[data-theme="ainex-premium-light"] .banner {
    background: linear-gradient(90deg, #dbeafe, #eff6ff) !important;
    color: #0f172a !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.10);
}

html[data-theme="ainex-premium-dark"] .topbar {
    background: rgba(8, 15, 32, 0.82) !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12) !important;
}

html[data-theme="ainex-premium-light"] .topbar {
    background: rgba(255, 255, 255, 0.84) !important;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    backdrop-filter: blur(12px);
}

html[data-theme="ainex-premium-dark"] .sidebar,
html[data-theme="ainex-premium-dark"] .panel,
html[data-theme="ainex-premium-dark"] .hero,
html[data-theme="ainex-premium-dark"] .metric,
html[data-theme="ainex-premium-dark"] .card {
    background: rgba(10, 19, 40, 0.76) !important;
    color: #e5e7eb !important;
    border: 1px solid rgba(148, 163, 184, 0.18) !important;
    box-shadow: 0 16px 40px rgba(2, 6, 23, 0.30) !important;
}

html[data-theme="ainex-premium-light"] .sidebar,
html[data-theme="ainex-premium-light"] .panel,
html[data-theme="ainex-premium-light"] .hero,
html[data-theme="ainex-premium-light"] .metric,
html[data-theme="ainex-premium-light"] .card {
    background: rgba(255, 255, 255, 0.94) !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08) !important;
}

html[data-theme="ainex-premium-dark"] .brand-copy h1,
html[data-theme="ainex-premium-dark"] h1,
html[data-theme="ainex-premium-dark"] h2,
html[data-theme="ainex-premium-dark"] h3,
html[data-theme="ainex-premium-dark"] h4 {
    color: #f8fafc !important;
}

html[data-theme="ainex-premium-light"] .brand-copy h1,
html[data-theme="ainex-premium-light"] h1,
html[data-theme="ainex-premium-light"] h2,
html[data-theme="ainex-premium-light"] h3,
html[data-theme="ainex-premium-light"] h4 {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-dark"] p,
html[data-theme="ainex-premium-dark"] li,
html[data-theme="ainex-premium-dark"] span,
html[data-theme="ainex-premium-dark"] small {
    color: #94a3b8;
}

html[data-theme="ainex-premium-light"] p,
html[data-theme="ainex-premium-light"] li,
html[data-theme="ainex-premium-light"] span,
html[data-theme="ainex-premium-light"] small {
    color: #475569;
}

html[data-theme="ainex-premium-light"] .chip {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.10) !important;
}

html[data-theme="ainex-premium-light"] a {
    color: #1d4ed8 !important;
}

html[data-theme="ainex-premium-light"] a:hover {
    color: #1e40af !important;
}

/* ainex-fullwidth-enterprise */
:root {
    --ainex-shell-pad-x: 28px;
    --ainex-shell-pad-y: 24px;
    --ainex-sidebar-width: 270px;
    --ainex-shell-gap: 22px;
}

.topbar-inner {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding-left: var(--ainex-shell-pad-x) !important;
    padding-right: var(--ainex-shell-pad-x) !important;
}

.page {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: var(--ainex-shell-pad-y) var(--ainex-shell-pad-x) 40px !important;
}

.grid {
    grid-template-columns: var(--ainex-sidebar-width) minmax(0, 1fr) !important;
    gap: var(--ainex-shell-gap) !important;
    align-items: start !important;
}

.sidebar {
    width: 100% !important;
    position: sticky;
    top: 108px;
}

.content {
    min-width: 0 !important;
    width: 100% !important;
}

.hero,
.panel,
.card,
.metric,
.ax-card,
.ax-panel,
.ax-page-hero {
    width: 100% !important;
}

.ax-shell-grid {
    grid-template-columns: var(--ainex-sidebar-width) minmax(0, 1fr) !important;
    gap: var(--ainex-shell-gap) !important;
    align-items: start !important;
}

.ax-workspace,
.content > * {
    min-width: 0 !important;
}

.ax-kpi-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr)) !important;
}

.ax-two-col {
    grid-template-columns: repeat(2, minmax(320px, 1fr)) !important;
}

@media (min-width: 1600px) {
    :root {
        --ainex-shell-pad-x: 36px;
        --ainex-sidebar-width: 290px;
        --ainex-shell-gap: 26px;
    }
}

@media (max-width: 1100px) {
    .grid,
    .ax-shell-grid,
    .ax-two-col {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: static !important;
        top: auto !important;
    }

    .page {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    .topbar-inner {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
}

/* ainex-light-content-safety */
html[data-theme="ainex-premium-light"] .content > *,
html[data-theme="ainex-premium-light"] .content .ax-card,
html[data-theme="ainex-premium-light"] .content .ax-panel,
html[data-theme="ainex-premium-light"] .content .ax-page-hero,
html[data-theme="ainex-premium-light"] .content .ax-kpi {
    color: #0f172a !important;
}

html[data-theme="ainex-premium-light"] .content .ax-badge {
    background: rgba(124, 58, 237, 0.10) !important;
    color: #6d28d9 !important;
    border-color: rgba(124, 58, 237, 0.18) !important;
}


/* === PHASE 6D THEME MAPPING === */

html[data-theme="ainex-premium-dark"] body {
    background: var(--ax-bg) !important;
    color: var(--ax-text) !important;
}

/* Override old variables */
html[data-theme="ainex-premium-dark"] {
    --bg: var(--ax-bg);
    --surface: var(--ax-surface);
    --surface-muted: var(--ax-surface-2);
    --text: var(--ax-text);
    --text-soft: var(--ax-text-muted);
    --border: var(--ax-border);
    --primary: var(--ax-primary);
}


/* === PHASE 9 UX DENSITY PASS === */

.ax-page-hero {
    padding: 20px !important;
}

.ax-panel {
    padding: 18px !important;
}

.ax-kpi {
    padding: 14px !important;
}

.ax-kpi-value {
    font-size: 22px !important;
}

.ax-panel-headline {
    font-size: 18px !important;
    margin-bottom: 8px !important;
}

.ax-panel-copy,
.ax-module-item p,
.ax-list {
    font-size: 14px !important;
    line-height: 1.6 !important;
}

.ax-module-grid {
    gap: 12px !important;
}

.ax-module-item {
    padding: 14px !important;
    border-radius: 16px !important;
}

.ax-module-head {
    margin-bottom: 8px !important;
}

.ax-module-status {
    min-height: 24px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
}

.ax-action-zone {
    gap: 8px !important;
}

.ax-btn {
    min-height: 38px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
}

.ax-chip {
    min-height: 26px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
}

.ax-sidebar-card {
    padding: 14px !important;
}

.ax-sidebar-title {
    margin-bottom: 10px !important;
}

.ax-nav-stack {
    gap: 8px !important;
}

.ax-nav-item {
    padding: 10px 12px !important;
    border-radius: 10px !important;
}

@media (max-width: 768px) {
    .ax-page-hero,
    .ax-panel,
    .ax-module-item,
    .ax-kpi {
        padding: 14px !important;
    }
}


/* === FORCE FIX: Primary button text contrast === */
.ax-btn.ax-btn-primary,
.ax-btn-primary {
    color: #ffffff !important;
    fill: #ffffff !important;
}

.ax-btn.ax-btn-primary *,
.ax-btn-primary * {
    color: #ffffff !important;
}


/* ===== FIX: Ensure primary buttons always have white text ===== */
.ax-btn.ax-btn-primary,
.ax-btn-primary {
    color: #ffffff !important;
}

.ax-btn.ax-btn-primary *,
.ax-btn-primary * {
    color: #ffffff !important;
}

/* ===== AI MARKETING PHASE 1 FIX: primary buttons must keep white text ===== */
.ax-btn.ax-btn-primary,
.ax-btn-primary {
    color: #ffffff !important;
}

.ax-btn.ax-btn-primary:visited,
.ax-btn-primary:visited,
.ax-btn.ax-btn-primary:hover,
.ax-btn-primary:hover,
.ax-btn.ax-btn-primary:focus,
.ax-btn-primary:focus,
.ax-btn.ax-btn-primary:active,
.ax-btn-primary:active {
    color: #ffffff !important;
}

.ax-btn.ax-btn-primary *,
.ax-btn-primary * {
    color: #ffffff !important;
}

/* ===== AI MARKETING FINAL FIX: force white text on all primary button render paths ===== */
a.ax-btn.ax-btn-primary,
a.ax-btn-primary,
button.ax-btn.ax-btn-primary,
button.ax-btn-primary,
input.ax-btn.ax-btn-primary,
input.ax-btn-primary,
.ax-page-actions .ax-btn.ax-btn-primary,
.ax-card .ax-btn.ax-btn-primary,
.ax-panel .ax-btn.ax-btn-primary,
.ax-workspace .ax-btn.ax-btn-primary {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-decoration: none !important;
}

a.ax-btn.ax-btn-primary:visited,
a.ax-btn.ax-btn-primary:hover,
a.ax-btn.ax-btn-primary:focus,
a.ax-btn.ax-btn-primary:active,
a.ax-btn-primary:visited,
a.ax-btn-primary:hover,
a.ax-btn-primary:focus,
a.ax-btn-primary:active,
button.ax-btn.ax-btn-primary:hover,
button.ax-btn.ax-btn-primary:focus,
button.ax-btn.ax-btn-primary:active,
.ax-page-actions .ax-btn.ax-btn-primary:hover,
.ax-card .ax-btn.ax-btn-primary:hover,
.ax-panel .ax-btn.ax-btn-primary:hover,
.ax-workspace .ax-btn.ax-btn-primary:hover {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

a.ax-btn.ax-btn-primary span,
a.ax-btn-primary span,
button.ax-btn.ax-btn-primary span,
button.ax-btn-primary span,
.ax-btn.ax-btn-primary *,
.ax-btn-primary * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
