@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;700&display=swap');

/* --- Core Layout & Scrollbar --- */
:root {
    --text-base: 16px;
    --text-sm: 14px;
    --text-xs: 12px;
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.4);
}

/* Sprint 1: Typography Baseline Enforcement */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: var(--text-base);
    line-height: 1.5;
    color: #1e293b;
    padding-bottom: 128px;
    background-color: #f3f4f6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior-y: none;
}

/* Sprint 1: Global Focus States (Accessibility) */
:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    box-shadow: var(--focus-ring);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* --- 1. Interaction Protocols (Drag and drop behavior) --- */
.draggable-row {
    cursor: grab;
    transition: all 0.2s ease-in-out;
}

.draggable-row:active {
    cursor: grabbing;
}

.draggable-row.dragging {
    opacity: 0.5;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(2px) scale(1.02);
    z-index: 1000;
}

.drag-over {
    background-color: #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-bottom: 2px solid #3b82f6;
    transition: all 0.2s ease-in-out;
}

/* --- 2. Atomic UI Components --- */
.alert-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator {
    transition: opacity 0.5s ease-in-out;
}

.status-online {
    border-color: #22c55e;
    color: #15803d;
    background-color: #f0fdf4;
}

.status-offline {
    border-color: #ef4444;
    color: #b91c1c;
    background-color: #fef2f2;
    cursor: not-allowed;
}

/* --- 3. Roadmap Visualization --- */
.roadmap-past {
    color: #9ca3af;
}

.roadmap-current {
    color: #2563eb;
    font-weight: 700;
}

.roadmap-future {
    color: #1f2937;
}

/* --- 4. Intelligence Suite Visuals --- */
.ai-message {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ai-message.user {
    background-color: #eff6ff;
    border: 1px solid #dbeafe;
    color: #1e3a8a;
    text-align: right;
    margin-left: 20%;
}

.ai-message.assistant {
    background-color: #f0fdf4;
    border: 1px solid #dcfce7;
    color: #14532d;
    margin-right: 10%;
}

.ai-message.assistant strong {
    color: #166534;
    font-weight: 700;
}

.ai-message.assistant ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-top: 5px;
}

/* --- 5. Support Interface --- */
.bmc-btn {
    background-color: #FFDD00;
    color: #000000;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.bmc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- 6. Print Media Protocols --- */
@media print {

    #footnote,
    #loginBtn,
    footer,
    #settingsBtn,
    #openAiToolsBtn {
        display: none !important;
    }
}

#bmac-btn-container,
#bmc-wbtn {
    display: none !important;
}

/* --- 7. Production Stage Visuals --- */
#stagesCarousel {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#stagesCarousel::-webkit-scrollbar {
    display: none;
}

.stage-card {
    transition: transform 0.2s;
}

.stage-drop-zone {
    min-height: 100px;
}

.stage-draggable {
    transition: all 0.2s;
    touch-action: none;
}

.stage-draggable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- 8. Mobile Platform Support --- */
@media (max-width: 768px) {
    .mobile-desc-truncate {
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        width: 100%;
        display: block;
    }

    .mobile-desc-truncate:focus {
        white-space: normal;
        overflow: visible;
        position: relative;
        z-index: 50;
        background: white;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        border-radius: 4px;
        padding: 8px;
        height: auto;
    }
}

/* --- 9. Navigation Elements --- */
.sticky-section-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.sticky-th {
    position: sticky;
    top: 43px;
    z-index: 20;
    background-color: #ffffff;
}

/* --- 10. Document Studio Canvas --- */
.grid-stack {
    background-color: #64748b;
    min-height: 80vh;
    padding: 20px !important;
}

@media (max-width: 768px) {
    .grid-stack {
        padding: 10px !important;
    }
}

/* Print Standard Override */
.print-standard .grid-stack-item-content {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
}

.print-standard input,
.print-standard textarea {
    color: #000 !important;
    font-weight: bold !important;
}

/* Visual Hardening - Unified Container Logic */
/* Replaces legacy card style with Industry Standard "Flat" look */
.grid-stack-item-content {
    background-color: white;
    border: 2px solid #000 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    /* Batch 3.1: Liquid CSS Engine - Vertical Flex Protocol */
    container-type: inline-size;
    container-name: widget;
    overflow: hidden !important;
    /* Strict containment to prevent overlap */
    display: flex;
    flex-direction: column;
    cursor: grab;
}

/* Fluid Typography (Smart Scaling) - UXForge Accessibility Update */
/* Sprint 1: Enforced 12px Minimum on scaled widgets */
@container widget (max-width: 200px) {
    .widget-header {
        padding: 6px 8px !important;
        min-height: 32px !important;
    }

    .widget-header input {
        font-size: 12px !important;
    }

    .widget-tools {
        transform: scale(1.0);
    }

    .widget-body,
    .cs-table {
        font-size: 12px !important;
    }

    .cs-table th,
    .cs-table td {
        padding: 4px !important;
    }
}

@container widget (min-width: 201px) and (max-width: 400px) {
    .widget-header input {
        font-size: 13px !important;
    }

    .widget-body,
    .cs-table {
        font-size: 13px !important;
    }
}

@container widget (min-width: 401px) {
    .widget-header input {
        font-size: 13px !important;
    }

    .widget-body,
    .cs-table {
        font-size: 13px !important;
    }
}

/* Widget Contrast Fixes: Force darker labels on white widgets */
.grid-stack-item-content .text-slate-400 {
    color: #64748b;
}

/* Batch 2.2: Resize Handle Clean-up */
/* Ensures handles are completely invisible and unclickable in view mode */
#mBTDB_Workspace:not(.editing-mode) .ui-resizable-handle,
#mBTDB_Workspace:not(.editing-mode) .grid-stack-handle,
#mBTDB_Workspace:not(.editing-mode) .widget-tools {
    display: none !important;
    pointer-events: none !important;
}

/* --- [Feat15]. Visual Hardening (Flatten nested widget borders) --- */
/* Context: Strips borders from nested components to enforce flat industry-standard look */
.grid-stack-item-content .cs-box {
    border: none !important;
    margin: 0 !important;
    box-shadow: none !important;
}

.grid-stack-item-content .cs-table {
    border-top: none !important;
}

/* --- 11. Form Utilities (Spinner Removal) --- */
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spinner {
    -moz-appearance: textfield;
    appearance: none;
}

/* --- 11.5 Settings Modal Theme-Aware Cards (Phase 110.1) --- */
.settings-card {
    background: var(--bg-settings-card, #ffffff);
    border: 1px solid;
    border-color: var(--border-settings-card, #f1f5f9);
    padding: 0.75rem;
    border-radius: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.settings-card-alt {
    background: var(--bg-settings-card-alt, #f8fafc);
    border-color: var(--border-settings-card-alt, #e2e8f0);
}

.settings-text-primary {
    color: var(--text-settings-primary, #1e293b);
}

.settings-text-secondary {
    color: var(--text-settings-secondary, #475569);
}

.settings-text-muted {
    color: var(--text-settings-muted, #94a3b8);
}

.settings-text-link {
    color: var(--text-settings-link, #3b82f6);
}

.settings-border {
    border-color: var(--border-settings, #e2e8f0);
}

.settings-border-light {
    border-color: var(--border-settings-light, #f1f5f9);
}

/* Dark Theme Overrides */
.mbt-theme-dark {
    --bg-settings-card: #1e293b;
    --border-settings-card: #334155;
    --bg-settings-card-alt: #0f172a;
    --border-settings-card-alt: #1e293b;
    --text-settings-primary: #f1f5f9;
    --text-settings-secondary: #94a3b8;
    --text-settings-muted: #64748b;
    --text-settings-link: #60a5fa;
    --border-settings: #334155;
    --border-settings-light: #1e293b;
}

/* --- 11.6 Settings Tab System (Phase 128 T2 Refactor: semantic class restoration) --- */
.settings-modal-shell {
    background-color: rgba(248, 250, 252, 0.5);
}

.settings-tab-nav {
    background-color: #ffffff;
}

.settings-tab-bar {
    border-color: #e2e8f0;
}

.settings-tab-active {
    background-color: #ffffff;
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.settings-tab-inactive {
    color: #94a3b8;
}

.settings-tab-inactive:hover {
    color: #475569;
    background-color: rgba(241, 245, 249, 0.5);
}

.mbt-theme-dark .settings-modal-shell {
    background-color: rgba(15, 23, 42, 0.5);
}

.mbt-theme-dark .settings-tab-nav {
    background-color: #1e293b;
}

.mbt-theme-dark .settings-tab-active {
    background-color: #1e293b;
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.mbt-theme-dark .settings-tab-inactive {
    color: #64748b;
}

.mbt-theme-dark .settings-tab-inactive:hover {
    color: #94a3b8;
    background-color: rgba(30, 41, 59, 0.5);
}

/* --- 12. Crew Contact Popups (Adapted Legacy Logic) --- */
.crew-wrapper {
    position: relative;
    z-index: 20;
    display: inline-block;
}

/* Main Avatar Button - Sprint 3: Touch Target Enforcement */
.crew-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease;
    user-select: none;
    z-index: 20;
}

.crew-avatar:hover {
    transform: scale(1.15);
}

.crew-avatar:active {
    transform: scale(0.95);
}

/* The Floating Pill (Hidden State) */
.crew-popup {
    position: absolute;
    left: 50%;
    /* Start centered behind avatar */
    top: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    /* Start small and centered */
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 9999px;
    padding: 4px 6px 4px 28px;
    /* Left padding creates the visual gap for the avatar */
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10;
    /* Behind avatar */
    white-space: nowrap;
}

/* The "Hit Buffer" (Invisible bridge so mouse doesn't lose focus) */
.crew-popup::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    /* Covers the gap between avatar and buttons */
    background: transparent;
    z-index: -1;
}

/* Active State (Hover OR Mobile Class) */
@media (hover: hover) {
    .crew-wrapper:hover .crew-popup {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate(20px, -50%) scale(1);
        /* Slide out to the right */
        z-index: 50;
    }
}

/* Mobile Toggle State */
.crew-wrapper.mobile-active .crew-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(20px, -50%) scale(1);
    z-index: 50;
}

/* Action Buttons inside the Pill */
.contact-action-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.contact-action-btn:hover {
    transform: scale(1.2);
}

.contact-action-btn svg {
    width: 14px;
    height: 14px;
}

/* Legacy Colors adapted for Tailwind Palette */
.action-call {
    background-color: #10b981;
}

/* Emerald-500 */
.action-wa {
    background-color: #25D366;
}

/* WhatsApp Brand Color */
.action-email {
    background-color: #3b82f6;
}

/* Blue-500 */
.action-profile {
    background-color: #64748b;
}

/* Slate-500 */

/* --- 13. Classic Theme System (High Specificity) --- */
.classic-theme {
    --bg-main: #e5e5e5;
    --brand-primary: #0044cc;
    --brand-success: #007733;
    --radius-std: 0px;
    --shadow-std: none;
    font-family: 'Arial', 'Helvetica', sans-serif !important;
}

.classic-theme [class*="rounded-"],
.classic-theme .rounded-full {
    border-radius: var(--radius-std) !important;
}

.classic-theme [class*="shadow-"] {
    box-shadow: var(--shadow-std) !important;
    border: 1px solid #9ca3af !important;
}

.classic-theme header input#projectName {
    font-family: 'Courier New', monospace;
    background: #fff;
    border: 2px solid #000 !important;
}

.classic-theme .bg-slate-900 {
    background-color: #333 !important;
    border: 1px solid #000;
}

.classic-theme .bg-blue-600 {
    background-color: var(--brand-primary) !important;
}

.classic-theme .text-blue-600 {
    color: var(--brand-primary) !important;
}

.classic-theme .bg-emerald-600 {
    background-color: var(--brand-success) !important;
}

.classic-theme input,
.classic-theme select,
.classic-theme textarea {
    background-color: #fff !important;
    border: 1px solid #000 !important;
    border-radius: 0 !important;
    padding: 4px !important;
}

/* --- 14. Studio Interface (New) --- */
.studio-input {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    transition: all 0.2s;
    width: 100%;
}

.studio-input:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

.studio-input:hover:not(:focus) {
    border-color: #cbd5e1;
    background-color: #f1f5f9;
}

/* Interior Refinement - Header & Body Polish */
.widget-header {
    background-color: #000 !important;
    color: #fff !important;
    padding: 4px 10px !important;
    /* Improved Touch Padding */
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px !important;
    /* Restored Height for Touch */
    border-bottom: 1px solid #000 !important;
    flex-shrink: 0;
}

/* High-Contrast Inputs in Header */
.widget-header input {
    color: #fff !important;
    font-family: 'Roboto Condensed', sans-serif !important;
    font-weight: 700 !important;
    font-size: clamp(11px, 1.2cqw, 14px) !important;
    /* Scales with widget width via container query */
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    background: transparent !important;
    height: 100%;
}

.widget-header input:focus {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Tool Icons in Header */
.widget-tools button {
    color: #9ca3af !important;
    transform: scale(1);
    padding: 4px;
}

.widget-tools button:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
}

/* Body Logic: Scroll internally, strict square corners */
.widget-body {
    /* Batch 3.1: Liquid Scroll Protocol */
    flex-grow: 1;
    min-height: 0;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    background: #fff;
    border-radius: 0 !important;
    /* Strict Square */
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

/* Batch 3.1: Dynamic Content Scaling */
.widget-body textarea,
.widget-body .studio-input {
    flex-grow: 1;
    height: 100% !important;
    resize: none !important;
}

.ui-resizable-handle {
    z-index: 100 !important;
}

.editing-mode .ui-resizable-se {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    right: 2px !important;
    bottom: 2px !important;
}

.editing-mode .ui-resizable-se::after {
    content: '';
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 6px;
    height: 6px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
}

/* --- 15. The Paper Protocol (WYSIWYG Layout) --- */
/* Logic Resolution: Darkened workspace for "Super-App" contrast. Paper is transparent in edit mode to let widgets pop. */
.sheet-workspace {
    background-color: #0f172a;
    padding: 40px;
    display: flex;
    justify-content: center;
    min-height: 100%;
    overflow-y: auto;
}

.document-sheet {
    background: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    padding: 10mm;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border: none;
    margin: 0 auto;
    transition: all 0.3s ease-in-out;
    /* Smooth paper resizing */
    transform-origin: top center;
}

/* Champion/Studio Layout Kit */
.cs-theme {
    font-family: 'Arial Narrow', 'Roboto Condensed', sans-serif;
    color: #000;
}

.cs-theme input,
.cs-theme textarea,
.cs-theme select {
    background: transparent;
    border: 1px solid transparent;
    width: 100%;
    font-family: inherit;
}

.cs-theme input:hover,
.cs-theme textarea:hover {
    border-color: #e2e8f0;
    background-color: #f8fafc;
}

.cs-theme input:focus,
.cs-theme textarea:focus {
    border-color: #3b82f6;
    outline: none;
    background-color: white;
}

.cs-box {
    border: 2px solid #000;
    margin-bottom: -2px;
    position: relative;
}

.cs-header-bar {
    background: #000;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 6px;
    font-size: 10px;
    letter-spacing: 0.5px;
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9px;
}

.cs-table th {
    border: 1px solid #000;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    padding: 2px 4px;
    /* Sprint 6: Tightened horizontal padding */
    font-weight: 700;
    text-align: left;
    font-size: 10px !important;
    line-height: 1.2;
}

.cs-table td {
    border: 1px solid #000;
    padding: 2px 4px;
    vertical-align: top;
}

/* Print Protocol */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .sheet-workspace {
        background: white;
        padding: 0;
        display: block;
        overflow: visible;
    }

    .document-sheet {
        box-shadow: none !important;
        border: none !important;
        margin: 0;
        width: 100%;
        height: auto;
        min-height: 0;
        page-break-after: always;
        padding: 0 !important;
    }

    .no-print,
    .widget-tools,
    .ui-resizable-handle {
        display: none !important;
    }
}

/* --- 16. Offline Survival Kit (Tailwind Polyfill) --- */
/* Critical layout primitives to ensure UI structure persists without CDN */

/* Layout & Flexbox */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

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

.justify-between {
    justify-content: space-between;
}

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

.justify-end {
    justify-content: flex-end;
}

.flex-grow {
    flex-grow: 1;
}

.shrink-0 {
    flex-shrink: 0;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.z-10 {
    z-index: 10;
}

.z-20 {
    z-index: 20;
}

.z-30 {
    z-index: 30;
}

.z-50 {
    z-index: 50;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* Grid System */
.grid {
    display: grid;
}

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

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

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Spacing */
.p-1 {
    padding: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.h-screen {
    height: 100vh;
}

/* Typography */
.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.font-bold {
    font-weight: 700;
}

.font-black {
    font-weight: 900;
}

.uppercase {
    text-transform: uppercase;
}

.tracking-widest {
    letter-spacing: 0.1em;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Decoration */
.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

.rounded-2xl {
    border-radius: 1rem;
}

.rounded-full {
    border-radius: 9999px;
}

.border {
    border-width: 1px;
    border-style: solid;
}

.border-b {
    border-bottom-width: 1px;
}

.shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Colors (Fallback Palette) */
.bg-white {
    background-color: #ffffff;
}

.bg-slate-50 {
    background-color: #f8fafc;
}

.bg-slate-100 {
    background-color: #f1f5f9;
}

.bg-slate-200 {
    background-color: #e2e8f0;
}

.bg-slate-900 {
    background-color: #0f172a;
}

.bg-blue-600 {
    background-color: #2563eb;
}

.bg-emerald-600 {
    background-color: #059669;
}

.bg-rose-500 {
    background-color: #f43f5e;
}

.text-white {
    color: #ffffff;
}

.text-slate-300 {
    color: #cbd5e1;
}

.text-slate-400 {
    color: #94a3b8;
}

.text-slate-500 {
    color: #64748b;
}

.text-slate-800 {
    color: #1e293b;
}

.text-slate-900 {
    color: #0f172a;
}

.text-blue-600 {
    color: #2563eb;
}

.border-slate-100 {
    border-color: #f1f5f9;
}

.border-slate-200 {
    border-color: #e2e8f0;
}

/* State & Interactive */
.hidden {
    display: none !important;
}

.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.cursor-pointer {
    cursor: pointer;
}

.outline-none {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* GridStack Offline Fallback (Vertical Stack) */
.no-gridstack .grid-stack {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    padding: 10px !important;
}

.no-gridstack .grid-stack-item {
    position: relative !important;
    width: 100% !important;
    top: auto !important;
    left: auto !important;
    height: auto !important;
    margin-bottom: 20px;
}

.no-gridstack .grid-stack-item-content {
    height: auto !important;
    min-height: 200px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.no-gridstack .widget-body {
    height: 300px;
    overflow-y: auto;
}

.no-gridstack .ui-resizable-handle {
    display: none !important;
}

/* --- 18. Phase 128: Premium Dark Contrast (Curb-Hardened) --- */

/* Task 1: Token Spectrum Overrides — captures modal surface tokens used in index.html */
.mbt-theme-dark .bg-slate-50 {
    background-color: #1e293b !important;
}

.mbt-theme-dark .bg-slate-100 {
    background-color: #334155 !important;
}

.mbt-theme-dark .bg-slate-200 {
    background-color: #475569 !important;
}

.mbt-theme-dark .border-slate-100 {
    border-color: #334155 !important;
}

.mbt-theme-dark .border-slate-200 {
    border-color: #475569 !important;
}

.mbt-theme-dark .text-slate-400 {
    color: #94a3b8 !important;
}

.mbt-theme-dark .text-slate-500 {
    color: #cbd5e1 !important;
}

.mbt-theme-dark .text-slate-600 {
    color: #f1f5f9 !important;
}

.mbt-theme-dark .text-slate-700 {
    color: #f8fafc !important;
}

.mbt-theme-dark .text-slate-800 {
    color: #ffffff !important;
}

/* Task 3: Negative Constraints — No Light Mode edits. No New Classes. */

/* --- 19. Phase 129.C: Premium Dock Centering (Pill Authority) --- */

/* Task 1 (Design Refinement): offline-safe centering for the footer pill wrapper.
   #footer-hud is fixed left-0 right-0 — flex + justify-center replaces
   mx-auto dependence on CDN, centering the pill reliably at all viewport widths. */
#footer-hud {
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

/* Pill glass aesthetic: CDN-independent fallback for bg-slate-900/95,
   backdrop-blur-2xl, shadow-2xl, and ring-1 ring-black/20 Tailwind utilities. */
#footer-nav {
    background-color: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-radius: 28px;
}

/* Task 2 (Synchronization): Phase 128.Log rebalance loop sets equal minWidth on both flanks;
   CSS orients buttons toward the center keystone to complete bilateral symmetry.
   No maxWidth or minWidth overrides here — JS owns those values. */
#nav-left {
    justify-content: flex-end;
}

#nav-right {
    justify-content: flex-start;
}

#nav-left,
#nav-right {
    margin: 0;
    padding: 0;
}

/* --- 20. Phase 138: Universal Search Styling --- */

/* Task 1: Category group header for search results */
.cmd-group-hdr {
    color: #64748b;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 16px;
}

/* Task 2: Interactive pill toggle (CSS-only — footer pill aesthetic) */
.cmd-pill-toggle {
    display: inline-block;
    width: fit-content;
    border-radius: 9999px;
    border: 1px solid #6366f1;
    padding: 4px 14px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6366f1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cmd-pill-toggle:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

.cmd-pill-toggle:active {
    transform: scale(0.95);
}

.mbt-theme-dark .cmd-pill-toggle {
    color: #818cf8;
    border-color: #818cf8;
}

.mbt-theme-dark .cmd-pill-toggle:hover {
    background-color: rgba(129, 140, 248, 0.1);
}

/* Task 4: Empty state polish — "No results" with search icon */
.cmd-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: #64748b;
    text-align: center;
}

.cmd-empty-state svg {
    opacity: 0.3;
    margin-bottom: 8px;
}

/* --- 21. Phase 139: Smart Hub UI — Stage Identification Styling --- */

/* Task 1: Floating toast notification for stage identification */
#mbt-smart-hub {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 10000;
    background-color: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    padding: 16px 20px;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.1);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

#mbt-smart-hub.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#mbt-smart-hub.dismissed {
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
}

.mbt-theme-dark #mbt-smart-hub {
    background-color: rgba(15, 23, 42, 0.98);
    border-color: rgba(129, 140, 248, 0.3);
}

/* Smart Hub Header */
#mbt-smart-hub .smart-hub-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#mbt-smart-hub .smart-hub-title {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
    margin: 0;
}

#mbt-smart-hub .smart-hub-close {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

#mbt-smart-hub .smart-hub-close:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

/* Smart Hub Body */
#mbt-smart-hub .smart-hub-body {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.5;
}

/* Task 2: Action Pills within the notification */
.smart-hub-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.action-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(99, 102, 241, 0.4);
    background: transparent;
    color: #a5b4fc;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.action-pill:hover {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
    color: #c7d2fe;
}

.action-pill:active {
    transform: scale(0.95);
}

.action-pill.primary {
    background-color: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

.action-pill.primary:hover {
    background-color: #4f46e5;
}

.action-pill.dismiss {
    border-color: rgba(100, 116, 139, 0.3);
    color: #64748b;
}

.action-pill.dismiss:hover {
    background-color: rgba(100, 116, 139, 0.1);
    border-color: #64748b;
    color: #94a3b8;
}

.mbt-theme-dark .action-pill {
    border-color: rgba(129, 140, 248, 0.4);
    color: #a5b4fc;
}

.mbt-theme-dark .action-pill.primary {
    background-color: #6366f1;
    border-color: #6366f1;
    color: #ffffff;
}

/* Task 3: Identification badge on budget rows */
.stage-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6366f1;
    margin-left: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
    animation: stage-id-pulse 2s ease-in-out infinite;
}

.stage-id-badge.dev {
    background-color: #8b5cf6;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

.stage-id-badge.pre {
    background-color: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.stage-id-badge.prod {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.stage-id-badge.post {
    background-color: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

.stage-id-badge.dist {
    background-color: #ec4899;
    box-shadow: 0 0 6px rgba(236, 72, 153, 0.5);
}

@keyframes stage-id-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Task 4: Target stage hover highlight for budget rows */
.budget-row.stage-target {
    transition: all 0.15s ease;
}

.budget-row.stage-target:hover {
    background-color: rgba(99, 102, 241, 0.06);
    border-left: 3px solid #6366f1;
    padding-left: 13px;
}

.budget-row.stage-target.dev:hover {
    background-color: rgba(139, 92, 246, 0.06);
    border-left-color: #8b5cf6;
}

.budget-row.stage-target.pre:hover {
    background-color: rgba(245, 158, 11, 0.06);
    border-left-color: #f59e0b;
}

.budget-row.stage-target.prod:hover {
    background-color: rgba(16, 185, 129, 0.06);
    border-left-color: #10b981;
}

.budget-row.stage-target.post:hover {
    background-color: rgba(59, 130, 246, 0.06);
    border-left-color: #3b82f6;
}

.budget-row.stage-target.dist:hover {
    background-color: rgba(236, 72, 153, 0.06);
    border-left-color: #ec4899;
}

/* Dark theme overrides for Stage 139 Smart Hub */
.mbt-theme-dark #mbt-smart-hub .smart-hub-body {
    color: #cbd5e1;
}

.mbt-theme-dark .action-pill {
    border-color: rgba(129, 140, 248, 0.4);
    color: #a5b4fc;
}

.mbt-theme-dark .action-pill:hover {
    background-color: rgba(129, 140, 248, 0.15);
    border-color: #818cf8;
    color: #c7d2fe;
}