/* ============================================================================
 * MetaFile Cloud Bridge & Unified Studio Theme Architecture
 * Dark Studio Modules (.dxf, .3d, .vector, .effect, .sound):
 *   Matches File Explorer / Admin Console (Adobe Illustrator Medium-Dark)
 * Light Studio Modules (.docx, .xlsx, .pptx, .pdf):
 *   Unified Clean Modern Light Office Palette
 * ============================================================================ */

:root {
    /* Unified Dark Studio Palette (Explorer / Admin Console Tone) */
    --mf-dark-topbar: #1e1e1e;
    --mf-dark-panel: #252526;
    --mf-dark-subbar: #2b2b2b;
    --mf-dark-canvas: #323232;
    --mf-dark-viewport: #1b1b1c;
    --mf-dark-input: #1f1f1f;
    --mf-dark-hover: #383838;
    --mf-dark-border: #3f3f3f;
    --mf-dark-border-subtle: #333333;
    --mf-dark-text: #e4e4e4;
    --mf-dark-muted: #9e9e9e;
    --mf-dark-accent: #1473e6;
    --mf-dark-accent-hover: #0d66d0;

    /* Unified Light Studio Palette (Document / Spreadsheet / Slide / PDF) */
    --mf-light-topbar: #f8fafc;
    --mf-light-ribbon: #ffffff;
    --mf-light-subbar: #f1f5f9;
    --mf-light-panel: #f8fafc;
    --mf-light-canvas: #eef2f6;
    --mf-light-input: #ffffff;
    --mf-light-hover: #e2e8f0;
    --mf-light-border: #e2e8f0;
    --mf-light-border-strong: #cbd5e1;
    --mf-light-text: #0f172a;
    --mf-light-muted: #64748b;
    --mf-light-accent: #1473e6;
    --mf-light-accent-hover: #0d66d0;
}

/* ============================================================================
 * 0. UNIFIED MINIMALIST EDITOR LOGO (M.Effect, M.Excel, M.PDF, M.Slide, M.Sound, M.Vector, M.Word, M.3D, M.CAD)
 * ============================================================================ */
.mf-editor-logo {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif !important;
    font-size: 13.5px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    line-height: 1 !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    user-select: none !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}

.mf-editor-logo svg,
.mf-editor-logo img {
    display: none !important;
}

body[data-studio-theme="dark"] .mf-editor-logo {
    background: rgba(20, 115, 230, 0.14) !important;
    border: 1px solid rgba(56, 189, 248, 0.28) !important;
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .mf-editor-logo .mf-logo-prefix {
    color: #38bdf8 !important;
    font-weight: 900 !important;
}

body[data-studio-theme="dark"] .mf-editor-logo .mf-logo-suffix {
    color: #ffffff !important;
    font-weight: 800 !important;
}

body[data-studio-theme="light"] .mf-editor-logo {
    background: rgba(20, 115, 230, 0.09) !important;
    border: 1px solid rgba(20, 115, 230, 0.24) !important;
    color: #0f172a !important;
    margin-right: 6px;
}

body[data-studio-theme="light"] .mf-editor-logo .mf-logo-prefix {
    color: #1473e6 !important;
    font-weight: 900 !important;
}

body[data-studio-theme="light"] .mf-editor-logo .mf-logo-suffix {
    color: #0f172a !important;
    font-weight: 800 !important;
}

/* ============================================================================
 * 0.1 STUDIO LOADING SCREEN & SPLASH OVERLAY
 * ============================================================================ */
#mf-studio-splash {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: radial-gradient(circle at 50% 35%, #172033 0%, #0b0f19 75%) !important;
    color: #f8fafc !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif !important;
    overflow: hidden !important;
    user-select: none !important;
    -webkit-font-smoothing: antialiased !important;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#mf-studio-splash.mf-splash-fade-out {
    opacity: 0 !important;
    transform: scale(1.02) !important;
    pointer-events: none !important;
}

.mf-splash-bg-glow {
    position: absolute !important;
    width: 520px !important;
    height: 520px !important;
    border-radius: 50% !important;
    opacity: 0.28 !important;
    filter: blur(55px) !important;
    pointer-events: none !important;
    animation: mfSplashPulse 4s ease-in-out infinite alternate !important;
}

@keyframes mfSplashPulse {
    0% { transform: scale(0.92); opacity: 0.22; }
    100% { transform: scale(1.12); opacity: 0.38; }
}

.mf-splash-card {
    position: relative !important;
    z-index: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 32px !important;
    max-width: 420px !important;
    width: 90% !important;
}

.mf-splash-logo-pill {
    display: inline-flex !important;
    align-items: center !important;
    padding: 8px 18px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(16px) !important;
    margin-bottom: 14px !important;
}

.mf-splash-prefix {
    font-size: 26px !important;
    font-weight: 900 !important;
    letter-spacing: -0.03em !important;
}

.mf-splash-suffix {
    color: #ffffff !important;
    font-size: 26px !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    margin-left: 1px !important;
}

.mf-splash-desc {
    font-size: 13px !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
    margin: 0 0 16px 0 !important;
    letter-spacing: 0.01em !important;
}

.mf-splash-stages {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
    padding: 4px 12px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, 0.65) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

.mf-splash-stage-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    letter-spacing: 0.02em !important;
    transition: all 0.3s ease !important;
}

.mf-splash-stage-badge.active {
    color: #38bdf8 !important;
}

.mf-splash-stage-badge.done {
    color: #10b981 !important;
}

.mf-splash-stage-badge .mf-stage-dot {
    width: 6px !important;
    height: 6px !important;
    border-radius: 50% !important;
    background: #475569 !important;
    transition: all 0.3s ease !important;
}

.mf-splash-stage-badge.active .mf-stage-dot {
    background: #38bdf8 !important;
    box-shadow: 0 0 8px #38bdf8 !important;
    animation: mfStagePulse 1.4s ease-in-out infinite alternate !important;
}

.mf-splash-stage-badge.done .mf-stage-dot {
    background: #10b981 !important;
    box-shadow: 0 0 6px #10b981 !important;
}

@keyframes mfStagePulse {
    0% { transform: scale(0.85); opacity: 0.6; }
    100% { transform: scale(1.25); opacity: 1; }
}

.mf-splash-stage-arrow {
    color: #475569 !important;
    font-size: 11px !important;
    user-select: none !important;
}

.mf-splash-doc-chip {
    display: none;
    align-items: center !important;
    gap: 7px !important;
    padding: 5px 12px !important;
    border-radius: 8px !important;
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #e2e8f0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    max-width: 320px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 22px !important;
}

.mf-splash-doc-chip span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.mf-splash-track {
    width: 320px !important;
    max-width: 100% !important;
    height: 5px !important;
    background: rgba(255, 255, 255, 0.09) !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
    margin-bottom: 12px !important;
}

.mf-splash-bar {
    height: 100% !important;
    width: 15% !important;
    border-radius: 999px !important;
    transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.mf-splash-meta {
    width: 320px !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 12px !important;
    color: #94a3b8 !important;
}

.mf-splash-status-box {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.mf-splash-spinner {
    width: 12px !important;
    height: 12px !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    animation: mfSplashSpin 0.75s linear infinite !important;
}

@keyframes mfSplashSpin {
    to { transform: rotate(360deg); }
}

.mf-splash-pct {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-weight: 700 !important;
    color: #cbd5e1 !important;
    font-size: 11.5px !important;
}

/* ============================================================================
 * 1. UNIFIED DARK STUDIO THEME (.dxf, .3d, .vector, .effect, .sound)
 * ============================================================================ */
body[data-studio-theme="dark"] {
    --bg-app: #323232;
    --bg-menubar: #1e1e1e;
    --bg-toolbar: #2b2b2b;
    --bg-panel: #252526;
    --bg-panel-header: #2b2b2b;
    --bg-input: #1f1f1f;
    --bg-canvas: #1b1b1c;
    --bg-status: #1e1e1e;
    --border-dark: #181818;
    --border-mid: #3f3f3f;
    --border-light: #4a4a4a;
    --text-main: #e4e4e4;
    --text-muted: #9e9e9e;
    --text-bright: #ffffff;
    --accent-primary: #1473e6;
    --accent-hover: #0d66d0;
    background-color: #252526;
    color: #e4e4e4;
}

/* Sync headers, toolbars, docks & statusbars across Dark Studio modules */
body[data-studio-theme="dark"] #cc-menubar,
body[data-studio-theme="dark"] #top-header,
body[data-studio-theme="dark"] #app-header #menubar,
body[data-studio-theme="dark"] #ec-menubar,
body[data-studio-theme="dark"] #top-menubar,
body[data-studio-theme="dark"] #cc-statusbar,
body[data-studio-theme="dark"] #status-bar,
body[data-studio-theme="dark"] #app-statusbar,
body[data-studio-theme="dark"] #ec-statusbar,
body[data-studio-theme="dark"] #bottom-statusbar {
    background: #1e1e1e !important;
    border-color: #3f3f3f !important;
    color: #e4e4e4 !important;
}

body[data-studio-theme="dark"] #cc-top-toolbar,
body[data-studio-theme="dark"] #cc-PropBar,
body[data-studio-theme="dark"] #ribbon-container,
body[data-studio-theme="dark"] #control-bar,
body[data-studio-theme="dark"] #ec-toolbar,
body[data-studio-theme="dark"] #edit-toolbar {
    background: #2b2b2b !important;
    border-color: #3f3f3f !important;
}

body[data-studio-theme="dark"] #cc-left-toolbar,
body[data-studio-theme="dark"] #cc-right-dock,
body[data-studio-theme="dark"] #left-browser,
body[data-studio-theme="dark"] #right-inspector,
body[data-studio-theme="dark"] #left-toolbar,
body[data-studio-theme="dark"] #right-dock,
body[data-studio-theme="dark"] #ec-left-dock,
body[data-studio-theme="dark"] #ec-right-dock,
body[data-studio-theme="dark"] #ec-bottom-dock,
body[data-studio-theme="dark"] #left-dock,
body[data-studio-theme="dark"] #right-dock-clips {
    background: #252526 !important;
    border-color: #3f3f3f !important;
}

/* ============================================================================
 * 2. UNIFIED LIGHT STUDIO THEME (.docx, .xlsx, .pptx, .pdf)
 * ============================================================================ */
body[data-studio-theme="light"] {
    --bg-app: #eef2f6;
    --bg-header: #f8fafc;
    --bg-toolbar: #ffffff;
    --bg-subbar: #f1f5f9;
    --bg-panel: #f8fafc;
    --bg-surface: #ffffff;
    --bg-canvas: #eef2f6;
    --border-color: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent: #1473e6;
    --accent-hover: #0d66d0;
    background-color: #eef2f6;
    color: #0f172a;
}

/* Unified Light Header Bar & QAT for M.Word, M.Excel, M.Slide, M.PDF */
body[data-studio-theme="light"] .word-title-bar,
body[data-studio-theme="light"] .title-bar,
body[data-studio-theme="light"] .deckcraft-topbar,
body[data-studio-theme="light"] .app-topbar,
body[data-studio-theme="light"] #top-header-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 38px !important;
    background: #f8fafc !important;
    color: #0f172a !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 0 10px !important;
    flex-shrink: 0 !important;
}

.word-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.word-quick-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 12px;
    border-left: none !important;
    padding-left: 0 !important;
}

.word-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #334155;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.word-tool-btn:hover:not(:disabled) {
    background-color: #e2e8f0;
    color: #0f172a;
}

.word-tool-btn:active:not(:disabled) {
    background-color: #cbd5e1;
}

.word-tool-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.word-title-center {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
    text-align: left !important;
}

.word-doc-title-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    padding: 2px 8px;
    border-radius: 5px;
    outline: none;
    width: 220px;
    text-align: left !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.word-doc-title-input:hover {
    border-color: #94a3b8;
}

.word-doc-title-input:focus {
    background: #ffffff;
    color: #0f172a;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.word-save-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #000000 !important;
    background-color: rgba(34, 197, 94, 0.25) !important;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
    user-select: none;
}

.word-save-status-pill.saving {
    background-color: rgba(234, 179, 8, 0.3) !important;
    color: #000000 !important;
}

.word-save-status-pill.saved {
    background-color: rgba(34, 197, 94, 0.25) !important;
    color: #000000 !important;
}

.word-title-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.word-tool-btn.word-ribbon-opts-btn {
    width: auto;
    height: 28px;
    padding: 0 8px;
    gap: 4px;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px;
    color: #334155;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: all 0.15s ease;
}

.word-tool-btn.word-ribbon-opts-btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

.word-tool-btn.word-ribbon-opts-btn:active {
    background: #e2e8f0 !important;
}

.word-tool-btn.word-ribbon-opts-btn .word-opts-caret {
    opacity: 0.75;
}

.word-window-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid #cbd5e1;
}

.word-win-btn {
    width: 30px;
    height: 28px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #334155;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.word-win-btn svg {
    display: block;
    flex-shrink: 0;
}

.word-win-btn:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}

.word-win-btn:active {
    background-color: #cbd5e1;
}

.word-win-btn.close-btn {
    color: #475569;
}

.word-win-btn.close-btn:hover {
    background-color: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

/* Dark Theme Overrides for Unified Chrome Header Controls */
body[data-studio-theme="dark"] .word-doc-title-input,
body[data-studio-theme="dark"] .vector-doc-title-input {
    background: rgba(0, 0, 0, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #ffffff !important;
    caret-color: #38bdf8 !important;
    font-weight: 600;
}

body[data-studio-theme="dark"] .word-doc-title-input:hover,
body[data-studio-theme="dark"] .vector-doc-title-input:hover {
    border-color: rgba(255, 255, 255, 0.3) !important;
    background: rgba(0, 0, 0, 0.48) !important;
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .word-doc-title-input:focus,
body[data-studio-theme="dark"] .word-doc-title-input:active,
body[data-studio-theme="dark"] .vector-doc-title-input:focus,
body[data-studio-theme="dark"] .vector-doc-title-input:active {
    background: rgba(0, 0, 0, 0.65) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    caret-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35) !important;
}

body[data-studio-theme="dark"] .word-save-status-pill {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.35) !important;
}

body[data-studio-theme="dark"] .word-save-status-pill.saving {
    background-color: rgba(234, 179, 8, 0.22) !important;
    color: #facc15 !important;
    border: 1px solid rgba(250, 204, 21, 0.4) !important;
}

body[data-studio-theme="dark"] .word-save-status-pill.saved {
    background-color: rgba(34, 197, 94, 0.2) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(74, 222, 128, 0.35) !important;
}

body[data-studio-theme="dark"] .word-tool-btn.word-ribbon-opts-btn {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #e4e4e7 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body[data-studio-theme="dark"] .word-tool-btn.word-ribbon-opts-btn:hover {
    background: rgba(255, 255, 255, 0.13) !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .word-tool-btn.word-ribbon-opts-btn:active {
    background: rgba(255, 255, 255, 0.18) !important;
}

body[data-studio-theme="dark"] .word-window-controls {
    border-left: 1px solid rgba(255, 255, 255, 0.14) !important;
}

body[data-studio-theme="dark"] .word-win-btn {
    color: #a1a1aa !important;
}

body[data-studio-theme="dark"] .word-win-btn:hover {
    background-color: rgba(255, 255, 255, 0.09) !important;
    border-color: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .word-win-btn:active {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

body[data-studio-theme="dark"] .word-win-btn.close-btn {
    color: #94a3b8 !important;
}

body[data-studio-theme="dark"] .word-win-btn.close-btn:hover {
    background-color: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4) !important;
}

body[data-studio-theme="dark"] .mf-chrome-popup {
    background: #232326 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    color: #e4e4e7 !important;
}

body[data-studio-theme="dark"] .mf-chrome-popup-header {
    background-color: #1a1a1d !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #a1a1aa !important;
}

body[data-studio-theme="dark"] .mf-chrome-popup-divider {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-studio-theme="dark"] .mf-chrome-popup-item {
    color: #e4e4e7 !important;
}

body[data-studio-theme="dark"] .mf-chrome-popup-item:hover {
    background-color: rgba(255, 255, 255, 0.09) !important;
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .mf-ribbon-opt-item:hover {
    background-color: rgba(255, 255, 255, 0.07) !important;
}

body[data-studio-theme="dark"] .mf-ribbon-opt-item.active {
    background-color: rgba(20, 115, 230, 0.22) !important;
    border-left: 3px solid #38bdf8 !important;
}

body[data-studio-theme="dark"] .mf-ribbon-opt-title {
    color: #ffffff !important;
}

body[data-studio-theme="dark"] .mf-ribbon-opt-desc {
    color: #a1a1aa !important;
}

/* Shared Ribbon Display Options & QAT Popups for Excel & Slide */
.mf-chrome-popup {
    position: fixed;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    padding: 4px 0;
    z-index: 99999;
    min-width: 220px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
    font-size: 12.5px;
    color: #0f172a;
}

.mf-chrome-popup-header {
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    background-color: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.mf-chrome-popup-divider {
    height: 1px;
    background-color: #e2e8f0;
    margin: 4px 0;
}

.mf-chrome-popup-item {
    display: flex;
    align-items: center;
    padding: 6px 14px;
    cursor: pointer;
    gap: 10px;
    transition: background-color 0.1s;
}

.mf-chrome-popup-item:hover {
    background-color: #eff6ff;
    color: #1d4ed8;
}

.mf-chrome-popup-check {
    width: 16px;
    font-weight: 700;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mf-ribbon-opt-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    max-width: 280px;
}

.mf-ribbon-opt-item:hover {
    background-color: #f1f5f9;
}

.mf-ribbon-opt-item.active {
    background-color: #eff6ff;
    border-left: 3px solid #2563eb;
}

.mf-ribbon-opt-icon {
    font-size: 18px;
    color: #2563eb;
    margin-top: -2px;
}

.mf-ribbon-opt-title {
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
    margin-bottom: 2px;
}

.mf-ribbon-opt-desc {
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

body[data-studio-theme="light"] .word-title-bar .word-app-logo,
body[data-studio-theme="light"] .title-bar .qat-app-badge,
body[data-studio-theme="light"] .app-topbar .brand-logo {
    color: #1473e6 !important;
}

body[data-studio-theme="light"] .word-title-bar .word-tool-btn,
body[data-studio-theme="light"] .word-title-bar .word-win-btn,
body[data-studio-theme="light"] .title-bar .qat-btn,
body[data-studio-theme="light"] .app-topbar .qat-btn {
    color: #334155 !important;
}

body[data-studio-theme="light"] .word-title-bar .word-tool-btn:hover,
body[data-studio-theme="light"] .word-title-bar .word-win-btn:hover,
body[data-studio-theme="light"] .title-bar .qat-btn:hover,
body[data-studio-theme="light"] .app-topbar .qat-btn:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

body[data-studio-theme="light"] .word-title-bar .word-win-btn.close-btn:hover {
    background: #ef4444 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
}

body[data-studio-theme="light"] .word-doc-title-input,
body[data-studio-theme="light"] .workbook-title-input,
body[data-studio-theme="light"] .doc-title-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 5px !important;
}

body[data-studio-theme="light"] .word-doc-title-input:focus,
body[data-studio-theme="light"] .workbook-title-input:focus,
body[data-studio-theme="light"] .doc-title-input:focus {
    border-color: #1473e6 !important;
    box-shadow: 0 0 0 2px rgba(20, 115, 230, 0.15) !important;
}

body[data-studio-theme="light"] .word-status-bar,
body[data-studio-theme="light"] .status-bar,
body[data-studio-theme="light"] .app-statusbar,
body[data-studio-theme="light"] #bottom-status-bar {
    background: #f8fafc !important;
    color: #475569 !important;
    border-top: 1px solid #e2e8f0 !important;
}

/* ============================================================================
 * 3. CLOUD BRIDGE FLOATING PILL & TOAST NOTIFICATIONS
 * ============================================================================ */
.mf-bridge-pill {
    position: fixed;
    right: 16px;
    bottom: 36px;
    z-index: 999990;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 30, 30, 0.96);
    border: 1px solid #3f3f3f;
    border-radius: 10px;
    padding: 6px 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
    color: #e4e4e4;
    font-size: 12px;
    user-select: none;
}

body[data-studio-theme="light"] .mf-bridge-pill {
    background: rgba(255, 255, 255, 0.96);
    border-color: #cbd5e1;
    color: #0f172a;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

.mf-bridge-home {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #9e9e9e;
    text-decoration: none;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.15s;
}

.mf-bridge-home:hover {
    color: #ffffff;
    background: rgba(20, 115, 230, 0.22);
    border-color: rgba(20, 115, 230, 0.45);
}

.mf-bridge-name {
    background: #1f1f1f;
    border: 1px solid #3f3f3f;
    border-radius: 7px;
    color: #f3f4f6;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    width: 185px;
    outline: none;
    transition: border-color 0.15s;
}

.mf-bridge-name:focus {
    border-color: #1473e6;
}

.mf-bridge-status {
    font-size: 11px;
    color: #9e9e9e;
    min-width: 72px;
    text-align: center;
}

.mf-bridge-status.saved {
    color: #2dce89;
}

.mf-bridge-status.saving {
    color: #ffb020;
}

.mf-bridge-status.error {
    color: #f5365c;
}

.mf-bridge-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #1473e6, #0d66d0);
    color: #ffffff;
    border: none;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(20, 115, 230, 0.35);
    transition: transform 0.12s, opacity 0.12s;
}

.mf-bridge-btn:hover {
    transform: translateY(-1px);
}

.mf-bridge-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* MetaFile Toast Notifications (Fixed Top-Right for All Editors) */
.mf-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.mf-toast,
.mf-bridge-toast {
    position: relative;
    pointer-events: auto;
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-left: 4px solid #10b981;
    color: #f8fafc;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 460px;
    animation: mfToastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

body[data-studio-theme="light"] .mf-toast,
body[data-studio-theme="light"] .mf-bridge-toast {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #10b981;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.14);
}

.mf-toast.mf-toast-fade {
    opacity: 0;
    transform: translateY(-8px);
}

.mf-toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #10b981;
    box-shadow: 0 0 8px currentColor;
}

.mf-toast-msg {
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

@keyframes mfToastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mf-bridge-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================================
 * 4. STUDIO AI CHAT ASSISTANT PANEL & MODEL QUALITY SETTINGS MODAL
 *    Integrated for M.Excel, M.Slide, M.Vector, M.Word, M.CAD
 * ============================================================================ */
.mf-ai-header-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 28px !important;
    padding: 0 12px !important;
    border-radius: 6px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
    background: linear-gradient(135deg, #1473e6 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(20, 115, 230, 0.28) !important;
    transition: all 0.16s ease !important;
    white-space: nowrap !important;
    margin-left: 6px !important;
    margin-right: 6px !important;
    z-index: 60;
}

.mf-ai-header-btn:hover {
    background: linear-gradient(135deg, #0d66d0 0%, #1d4ed8 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 115, 230, 0.4) !important;
}

.mf-ai-header-btn.active {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45) !important;
}

.mf-ai-sparkle {
    font-size: 13px;
    line-height: 1;
}

/* Right-Side AI Studio Panel */
.mf-ai-panel,
.mf-ai-panel * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.mf-ai-panel {
    position: fixed !important;
    top: 38px !important;
    right: 0 !important;
    bottom: 24px !important;
    width: 390px !important;
    max-width: 95vw !important;
    z-index: 999850 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border-left: 1px solid #cbd5e1 !important;
    box-shadow: -12px 0 36px rgba(15, 23, 42, 0.16) !important;
    transform: translateX(104%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.mf-ai-panel.open {
    transform: translateX(0) !important;
}

body[data-studio-theme="dark"] .mf-ai-panel {
    background: #1e222a !important;
    color: #f1f5f9 !important;
    border-left: 1px solid #334155 !important;
    box-shadow: -14px 0 40px rgba(0, 0, 0, 0.6) !important;
}

/* Panel Top Header */
.mf-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    flex-shrink: 0;
}

body[data-studio-theme="dark"] .mf-ai-header {
    background: linear-gradient(180deg, #181b22 0%, #14171d 100%);
    border-bottom-color: #2e3646;
}

.mf-ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mf-ai-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1473e6 0%, #6366f1 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(20, 115, 230, 0.3);
    flex-shrink: 0;
}

.mf-ai-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mf-ai-title {
    font-size: 13.5px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-studio-theme="dark"] .mf-ai-title {
    color: #f8fafc;
}

.mf-ai-subtitle {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

body[data-studio-theme="dark"] .mf-ai-subtitle {
    color: #94a3b8;
}

.mf-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mf-ai-tier-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.mf-ai-tier-btn:hover {
    border-color: #1473e6;
    color: #1473e6;
    background: #f0f7ff;
}

body[data-studio-theme="dark"] .mf-ai-tier-btn {
    background: #262b36;
    border-color: #3b4454;
    color: #e2e8f0;
}

body[data-studio-theme="dark"] .mf-ai-tier-btn:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    background: #1e293b;
}

.mf-ai-tier-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.mf-ai-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

body[data-studio-theme="dark"] .mf-ai-close-btn {
    color: #94a3b8;
}

body[data-studio-theme="dark"] .mf-ai-close-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

/* 2-Mode Switcher & Live Selection Context Bar */
.mf-ai-mode-bar {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    flex-shrink: 0;
}

body[data-studio-theme="dark"] .mf-ai-mode-bar {
    background: #1e222a;
    border-bottom-color: #2e3646;
}

.mf-ai-mode-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    background: #f1f5f9;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
}

body[data-studio-theme="dark"] .mf-ai-mode-tabs {
    background: #13161c;
    border-color: #2e3646;
}

.mf-ai-mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

body[data-studio-theme="dark"] .mf-ai-mode-tab {
    color: #94a3b8;
}

.mf-ai-mode-tab.active {
    background: #ffffff;
    color: #1473e6;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

body[data-studio-theme="dark"] .mf-ai-mode-tab.active {
    background: #262b36;
    color: #38bdf8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

/* Selection Inspector Box */
.mf-ai-selection-box {
    margin-top: 9px;
    padding: 8px 11px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    transition: all 0.15s ease;
}

body[data-studio-theme="dark"] .mf-ai-selection-box {
    background: #151820;
    border-color: #2e3646;
}

.mf-ai-selection-box.has-selection {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

body[data-studio-theme="dark"] .mf-ai-selection-box.has-selection {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.14);
}

.mf-ai-selection-box.warn-empty {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.09);
}

body[data-studio-theme="dark"] .mf-ai-selection-box.warn-empty {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.14);
}

.mf-ai-sel-icon {
    font-size: 13px;
    line-height: 1.3;
    flex-shrink: 0;
}

.mf-ai-sel-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.mf-ai-sel-title {
    font-size: 11.5px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

body[data-studio-theme="dark"] .mf-ai-sel-title {
    color: #f1f5f9;
}

.mf-ai-sel-preview {
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body[data-studio-theme="dark"] .mf-ai-sel-preview {
    color: #94a3b8;
}

/* Quick Starter Chips */
.mf-ai-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #fcfdff;
    flex-shrink: 0;
}

body[data-studio-theme="dark"] .mf-ai-quick-chips {
    background: #191d24;
    border-bottom-color: #282f3d;
}

.mf-ai-chip {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    line-height: 1.25;
}

.mf-ai-chip:hover {
    border-color: #1473e6;
    background: #eff6ff;
    color: #1473e6;
}

body[data-studio-theme="dark"] .mf-ai-chip {
    background: #242936;
    border-color: #363f52;
    color: #cbd5e1;
}

body[data-studio-theme="dark"] .mf-ai-chip:hover {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
}

/* Chat Messages Area */
.mf-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #ffffff;
}

body[data-studio-theme="dark"] .mf-ai-messages {
    background: #1e222a;
}

.mf-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 94%;
    font-size: 12.5px;
    line-height: 1.5;
}

.mf-ai-msg.user {
    align-self: flex-end;
}

.mf-ai-msg.assistant {
    align-self: flex-start;
    width: 100%;
}

.mf-ai-msg-bubble {
    padding: 10px 13px;
    border-radius: 12px;
    word-break: break-word;
}

.mf-ai-msg.user .mf-ai-msg-bubble {
    background: linear-gradient(135deg, #1473e6 0%, #2563eb 100%);
    color: #ffffff;
    border-bottom-right-radius: 3px;
    box-shadow: 0 2px 8px rgba(20, 115, 230, 0.22);
}

.mf-ai-msg.assistant .mf-ai-msg-bubble {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 3px;
}

body[data-studio-theme="dark"] .mf-ai-msg.assistant .mf-ai-msg-bubble {
    background: #151820;
    color: #e2e8f0;
    border-color: #2e3646;
}

.mf-ai-msg-attachment {
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.mf-ai-msg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 11px;
}

.mf-ai-applied-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #059669;
    font-weight: 700;
}

body[data-studio-theme="dark"] .mf-ai-applied-badge {
    color: #34d399;
}

.mf-ai-apply-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(20, 115, 230, 0.35);
    background: rgba(20, 115, 230, 0.1);
    color: #1473e6;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-apply-btn:hover {
    background: #1473e6;
    color: #ffffff;
}

body[data-studio-theme="dark"] .mf-ai-apply-btn {
    background: rgba(56, 189, 248, 0.14);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

body[data-studio-theme="dark"] .mf-ai-apply-btn:hover {
    background: #1473e6;
    color: #ffffff;
}

/* Composer Area (Bottom) */
.mf-ai-composer {
    padding: 10px 14px 14px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

body[data-studio-theme="dark"] .mf-ai-composer {
    background: #161920;
    border-top-color: #2e3646;
}

.mf-ai-attachment-pill {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 7px;
    background: rgba(20, 115, 230, 0.1);
    border: 1px solid rgba(20, 115, 230, 0.3);
    color: #1473e6;
    font-size: 11.5px;
    font-weight: 600;
}

.mf-ai-attachment-pill.visible {
    display: flex;
}

body[data-studio-theme="dark"] .mf-ai-attachment-pill {
    background: rgba(56, 189, 248, 0.14);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

.mf-ai-att-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mf-ai-att-size {
    opacity: 0.75;
    font-size: 10.5px;
}

.mf-ai-att-remove {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    padding: 0 3px;
}

.mf-ai-input-wrap {
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    padding: 8px 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mf-ai-input-wrap:focus-within {
    border-color: #1473e6;
    box-shadow: 0 0 0 3px rgba(20, 115, 230, 0.14);
}

body[data-studio-theme="dark"] .mf-ai-input-wrap {
    background: #222733;
    border-color: #384152;
}

body[data-studio-theme="dark"] .mf-ai-input-wrap:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}

.mf-ai-textarea {
    width: 100%;
    min-height: 54px;
    max-height: 140px;
    resize: none;
    padding: 2px 0 6px;
    border: none !important;
    background: transparent !important;
    color: #0f172a !important;
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.45;
    outline: none !important;
    box-shadow: none !important;
}

body[data-studio-theme="dark"] .mf-ai-textarea {
    color: #f1f5f9 !important;
}

.mf-ai-textarea::placeholder {
    color: #94a3b8;
}

.mf-ai-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

body[data-studio-theme="dark"] .mf-ai-composer-bar {
    border-top-color: #2e3646;
}

.mf-ai-composer-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mf-ai-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 9px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-icon-btn:hover {
    border-color: #1473e6;
    color: #1473e6;
    background: #eff6ff;
}

body[data-studio-theme="dark"] .mf-ai-icon-btn {
    background: #1a1e27;
    border-color: #363f52;
    color: #cbd5e1;
}

body[data-studio-theme="dark"] .mf-ai-icon-btn:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.mf-ai-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 14px;
    border-radius: 7px;
    border: none;
    background: linear-gradient(135deg, #1473e6 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(20, 115, 230, 0.28);
    transition: all 0.15s ease;
}

.mf-ai-send-btn:hover {
    background: linear-gradient(135deg, #0d66d0 0%, #1d4ed8 100%);
    transform: translateY(-1px);
}

.mf-ai-send-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* ============================================================================
 * 5. AI MODEL QUALITY SETTINGS MODAL (Matches Screenshot Specification)
 * ============================================================================ */
.mf-ai-modal-backdrop,
.mf-ai-modal-backdrop * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.mf-ai-modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999980 !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(5px);
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
}

.mf-ai-modal-backdrop.open {
    display: flex !important;
}

.mf-ai-quality-dialog {
    width: 540px !important;
    max-width: 100% !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 25px 65px rgba(15, 23, 42, 0.35) !important;
    overflow: hidden !important;
    animation: mfModalPop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes mfModalPop {
    from { opacity: 0; transform: scale(0.96) translateY(6px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mf-ai-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 15px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.mf-ai-modal-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.mf-ai-modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: #f8fafc;
    color: #64748b;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.mf-ai-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.mf-ai-modal-body {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #ffffff;
}

.mf-ai-plan-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 12.5px;
}

.mf-ai-plan-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #065f46;
}

.mf-ai-plan-info strong {
    font-weight: 800;
    color: #047857;
}

.mf-ai-plan-btn {
    padding: 5px 12px;
    border-radius: 7px;
    border: 1px solid #10b981;
    background: #ffffff;
    color: #047857;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-plan-btn:hover {
    background: #10b981;
    color: #ffffff;
}

/* 3 Quality Cards List */
.mf-ai-quality-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mf-ai-quality-card {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1.5px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-quality-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.mf-ai-quality-card.selected[data-quality-id="fast"] {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.mf-ai-quality-card.selected[data-quality-id="good"],
.mf-ai-quality-card.selected[data-quality-id="high"] {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
}

.mf-ai-quality-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #94a3b8;
    background: #ffffff;
    margin-top: 2px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s ease;
}

.mf-ai-quality-card.selected .mf-ai-quality-radio {
    border-color: #2563eb;
}

.mf-ai-quality-card.selected[data-quality-id="fast"] .mf-ai-quality-radio {
    border-color: #10b981;
}

.mf-ai-quality-card.selected .mf-ai-quality-radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #2563eb;
}

.mf-ai-quality-card.selected[data-quality-id="fast"] .mf-ai-quality-radio::after {
    background: #10b981;
}

.mf-ai-quality-content {
    flex: 1;
    min-width: 0;
}

.mf-ai-quality-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mf-ai-quality-name {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.mf-ai-badge-model {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 5px;
    background: #e0e7ff;
    color: #1d4ed8;
}

.mf-ai-quality-card[data-quality-id="fast"] .mf-ai-badge-model {
    background: #dcfce7;
    color: #047857;
}

.mf-ai-quality-card[data-quality-id="high"] .mf-ai-badge-model {
    background: #f3e8ff;
    color: #6d28d9;
}

.mf-ai-badge-plan {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
}

.mf-ai-badge-plan.starter {
    background: #dcfce7;
    color: #047857;
}

.mf-ai-badge-plan.standard {
    background: #ede9fe;
    color: #6d28d9;
}

.mf-ai-quality-desc {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.45;
}

.mf-ai-modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px 18px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.mf-ai-btn-cancel {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mf-ai-btn-cancel:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.mf-ai-btn-save {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #1473e6 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(20, 115, 230, 0.3);
    transition: all 0.15s ease;
}

.mf-ai-btn-save:hover {
    background: linear-gradient(135deg, #0d66d0 0%, #1d4ed8 100%);
}

/* ============================================================================
 * 6. PER-FILE AI PROMPT & RESULT HISTORY (REUSE PROMPT & RE-APPLY OUTPUT)
 * ============================================================================ */
.mf-ai-hist-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 16px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(20, 115, 230, 0.14);
    color: #1473e6;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}

.mf-ai-mode-tab.active .mf-ai-hist-badge {
    background: #1473e6;
    color: #ffffff;
}

body[data-studio-theme="dark"] .mf-ai-hist-badge {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
}

/* User Prompt Bubble Actions (Reuse Prompt / Copy) */
.mf-ai-user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.mf-ai-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.14s ease;
}

.mf-ai-user-btn:hover {
    background: #ffffff;
    color: #1473e6;
    border-color: #ffffff;
}

/* Structured Output Preview inside Assistant Bubble & History Cards */
.mf-ai-output-preview {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    font-size: 11px;
    color: #334155;
    max-height: 170px;
    overflow: auto;
}

body[data-studio-theme="dark"] .mf-ai-output-preview {
    background: #1e222a;
    border-color: #334155;
    color: #cbd5e1;
}

.mf-ai-output-preview-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mf-ai-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
}

.mf-ai-mini-table th,
.mf-ai-mini-table td {
    border: 1px solid #e2e8f0;
    padding: 3px 6px;
    text-align: left;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mf-ai-mini-table th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
}

body[data-studio-theme="dark"] .mf-ai-mini-table th {
    background: #283040;
    color: #f1f5f9;
    border-color: #364152;
}

body[data-studio-theme="dark"] .mf-ai-mini-table td {
    border-color: #2e3646;
}

/* ============================================================================
 * 2-STEP CAD BLUEPRINT INTERFACE STYLES (M.CAD AI Assistant)
 * ============================================================================ */
.mf-ai-cad-step-card {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    font-size: 11.5px;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body[data-studio-theme="dark"] .mf-ai-cad-step-card {
    background: #1e222a;
    border-color: #334155;
    color: #e2e8f0;
}

.mf-ai-cad-step-card.step-1 {
    border-left: 4px solid #0284c7;
}

.mf-ai-cad-step-card.step-2 {
    border-left: 4px solid #10b981;
}

.mf-ai-cad-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mf-ai-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.mf-ai-step-badge.step-1 {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border: 1px solid rgba(2, 132, 199, 0.3);
}

body[data-studio-theme="dark"] .mf-ai-step-badge.step-1 {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
}

.mf-ai-step-badge.step-2 {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

body[data-studio-theme="dark"] .mf-ai-step-badge.step-2 {
    background: rgba(52, 211, 153, 0.18);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.4);
}

.mf-ai-cad-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
}

body[data-studio-theme="dark"] .mf-ai-cad-title {
    color: #f8fafc;
}

.mf-ai-cad-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mf-ai-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 10.5px;
    font-weight: 600;
}

body[data-studio-theme="dark"] .mf-ai-tag {
    background: #272d38;
    border-color: #3b4454;
    color: #cbd5e1;
}

.mf-ai-cad-sec {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mf-ai-cad-sec-title {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

body[data-studio-theme="dark"] .mf-ai-cad-sec-title {
    color: #94a3b8;
}

.mf-ai-cad-sec-body {
    font-size: 11.5px;
    line-height: 1.45;
    color: #334155;
}

body[data-studio-theme="dark"] .mf-ai-cad-sec-body {
    color: #cbd5e1;
}

.mf-ai-cad-views-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 11px;
    line-height: 1.4;
}

.mf-ai-cad-view-item {
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
}

body[data-studio-theme="dark"] .mf-ai-cad-view-item {
    background: rgba(255, 255, 255, 0.03);
}

.mf-ai-cad-dims-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mf-ai-dim-chip,
.mf-ai-gdt-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
}

body[data-studio-theme="dark"] .mf-ai-dim-chip,
body[data-studio-theme="dark"] .mf-ai-gdt-chip {
    background: #252b36;
    border-color: #3b4454;
    color: #cbd5e1;
}

.mf-ai-gdt-chip {
    border-color: rgba(2, 132, 199, 0.4);
    color: #0284c7;
}

body[data-studio-theme="dark"] .mf-ai-gdt-chip {
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}

.mf-ai-cad-notes-list {
    font-size: 10.5px;
    line-height: 1.45;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0.9;
}

.mf-ai-cad-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px dashed rgba(203, 213, 225, 0.7);
}

body[data-studio-theme="dark"] .mf-ai-cad-action-bar {
    border-top-color: rgba(51, 65, 85, 0.7);
}

.mf-ai-cad-step2-btn {
    width: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    height: 34px !important;
    padding: 0 16px !important;
    border-radius: 7px !important;
    border: none !important;
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3) !important;
    transition: all 0.16s ease !important;
}

.mf-ai-cad-step2-btn:hover {
    background: linear-gradient(135deg, #0369a1 0%, #1d4ed8 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45) !important;
}

.mf-ai-cad-summary {
    font-size: 11.5px;
    line-height: 1.45;
}

.mf-ai-cad-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #10b981;
}

body[data-studio-theme="dark"] .mf-ai-cad-stats {
    color: #34d399;
}

/* History View Container */
.mf-ai-history-view {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: none;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.mf-ai-history-view.active {
    display: flex;
}

body[data-studio-theme="dark"] .mf-ai-history-view {
    background: #1a1e26;
}

.mf-ai-history-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mf-ai-history-search {
    flex: 1;
    height: 30px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
    font-size: 11.5px;
    outline: none;
}

.mf-ai-history-search:focus {
    border-color: #1473e6;
}

body[data-studio-theme="dark"] .mf-ai-history-search {
    background: #222733;
    border-color: #384152;
    color: #f1f5f9;
}

.mf-ai-history-clear-btn {
    height: 30px;
    padding: 0 9px;
    border-radius: 7px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.mf-ai-history-clear-btn:hover {
    background: #dc2626;
    color: #ffffff;
}

.mf-ai-history-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease;
}

.mf-ai-history-card:hover {
    border-color: #94a3b8;
}

body[data-studio-theme="dark"] .mf-ai-history-card {
    background: #151820;
    border-color: #2e3646;
}

.mf-ai-hist-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10.5px;
    color: #64748b;
}

.mf-ai-hist-prompt-box {
    background: #f1f5f9;
    border-left: 3px solid #1473e6;
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    word-break: break-word;
}

body[data-studio-theme="dark"] .mf-ai-hist-prompt-box {
    background: #222733;
    color: #f1f5f9;
}

.mf-ai-hist-summary {
    font-size: 11.5px;
    color: #475569;
    line-height: 1.4;
}

body[data-studio-theme="dark"] .mf-ai-hist-summary {
    color: #94a3b8;
}

.mf-ai-hist-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

body[data-studio-theme="dark"] .mf-ai-hist-actions {
    border-top-color: #282f3d;
}

.mf-ai-hist-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.14s ease;
}

.mf-ai-hist-btn:hover {
    border-color: #1473e6;
    color: #1473e6;
    background: #eff6ff;
}

.mf-ai-hist-btn.primary {
    background: rgba(20, 115, 230, 0.1);
    border-color: rgba(20, 115, 230, 0.35);
    color: #1473e6;
}

.mf-ai-hist-btn.primary:hover {
    background: #1473e6;
    color: #ffffff;
}

.mf-ai-hist-btn.danger {
    margin-left: auto;
    border-color: transparent;
    background: transparent;
    color: #94a3b8;
    padding: 4px 6px;
}

.mf-ai-hist-btn.danger:hover {
    color: #dc2626;
    background: #fef2f2;
}

body[data-studio-theme="dark"] .mf-ai-hist-btn {
    background: #222733;
    border-color: #363f52;
    color: #cbd5e1;
}

body[data-studio-theme="dark"] .mf-ai-hist-btn.primary {
    background: rgba(56, 189, 248, 0.14);
    border-color: rgba(56, 189, 248, 0.35);
    color: #38bdf8;
}

body[data-studio-theme="dark"] .mf-ai-hist-btn.primary:hover {
    background: #1473e6;
    color: #ffffff;
}

/* ============================================================================
 * VIEW-ONLY TEMPLATE MODE & BANNER STYLES
 * ============================================================================ */
.mf-view-only-banner {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999990;
    width: calc(100% - 24px);
    max-width: 1160px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    color: #f8fafc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
    font-size: 12.5px;
    user-select: none;
    box-sizing: border-box;
    animation: mfBannerSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mfBannerSlideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -14px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.mf-vob-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.mf-vob-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.mf-vob-app-tag {
    display: inline-flex;
    align-items: center;
    padding: 2.5px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.22);
    border: 1px solid rgba(59, 130, 246, 0.45);
    color: #93c5fd;
    font-size: 11px;
    font-weight: 800;
}

.mf-vob-code {
    font-size: 11px;
    color: #c7d2fe;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mf-vob-title {
    font-weight: 700;
    color: #ffffff;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mf-vob-hint {
    color: #94a3b8;
    font-size: 11.5px;
}

.mf-vob-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mf-vob-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
    box-sizing: border-box;
}

.mf-vob-btn-back {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e2e8f0;
}
.mf-vob-btn-back:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.mf-vob-btn-use {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.mf-vob-btn-use:hover {
    background: linear-gradient(135deg, #1d4ed8, #4338ca);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}

/* Dim editing ribbons and toolbars in view-only mode */
.mf-view-only-mode .word-quick-tools,
.mf-view-only-mode #qat-save,
.mf-view-only-mode #btn-save,
.mf-view-only-mode #word_qat_save,
.mf-view-only-mode #word_save_status_pill,
.mf-view-only-mode [data-cmd="save"],
.mf-view-only-mode [data-action="save"] {
    display: none !important;
}

.mf-view-only-mode .word-ribbon-content,
.mf-view-only-mode .ribbon-tab-content:not([data-tab="view"]):not([data-tab="review"]) button:not([data-cmd^="view"]):not([data-cmd^="zoom"]),
.mf-view-only-mode #cad-tools-panel button,
.mf-view-only-mode .tool-button:not(#tool-pan):not(#tool-zoom),
.mf-view-only-mode .cad-toolbar-create {
    pointer-events: none !important;
    opacity: 0.55 !important;
}

.mf-view-only-mode [contenteditable] {
    cursor: default !important;
    user-select: text !important;
    caret-color: transparent !important;
}

/* ============================================================================
 * 11. ACTION LOADING OVERLAY (Save / Save & Close / Close Editor)
 * ============================================================================ */
.mf-action-loading-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.48) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 10000005 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0 !important;
    pointer-events: auto !important;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    box-sizing: border-box !important;
}

.mf-action-loading-overlay.mf-action-loading-active {
    opacity: 1 !important;
}

.mf-action-loading-card {
    display: flex !important;
    align-items: center !important;
    gap: 18px !important;
    min-width: 320px !important;
    max-width: 480px !important;
    padding: 20px 26px !important;
    border-radius: 12px !important;
    background: #18181b !important;
    color: #f4f4f5 !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    transform: scale(0.95) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-sizing: border-box !important;
}

body[data-studio-theme="light"] .mf-action-loading-card,
body.light-theme .mf-action-loading-card {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16), 0 3px 8px rgba(15, 23, 42, 0.08) !important;
}

.mf-action-loading-overlay.mf-action-loading-active .mf-action-loading-card {
    transform: scale(1) !important;
}

.mf-action-loading-spinner-wrap {
    flex-shrink: 0 !important;
    width: 38px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mf-action-loading-spinner {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 3px solid rgba(140, 140, 140, 0.25) !important;
    border-top-color: #1473e6 !important;
    animation: mfActionSpin 0.7s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
    box-sizing: border-box !important;
}

@keyframes mfActionSpin {
    to { transform: rotate(360deg); }
}

.mf-action-loading-checkmark {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(16, 185, 129, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: mfCheckPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes mfCheckPop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.mf-action-loading-info {
    flex: 1 !important;
    min-width: 0 !important;
}

.mf-action-loading-title {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.3 !important;
    color: inherit !important;
    letter-spacing: -0.2px !important;
}

.mf-action-loading-sub {
    font-size: 12.5px !important;
    line-height: 1.4 !important;
    color: #a1a1aa !important;
    margin: 0 !important;
    word-break: break-word !important;
}

body[data-studio-theme="light"] .mf-action-loading-sub,
body.light-theme .mf-action-loading-sub {
    color: #64748b !important;
}



