:root {
            --mmg-font: 'Inter', =
            --mmg-bg: #f8fafc;
            --mmg-text-main: #1e293b;
            --mmg-text-muted: #64748b;
            --mmg-text-light: #94a3b8;
            --mmg-border: #e2e8f0;
            --mmg-border-focus: #8b5cf6; =
            
            --mmg-primary: #6d28d9; 
            --mmg-primary-hover: #5b21b6;
            --mmg-primary-light: #f5f3ff;
            
            --mmg-success: #059669;
            --mmg-success-bg: #ecfdf5;
            --mmg-success-border: #a7f3d0;
            
            --mmg-danger: #dc2626;
            --mmg-danger-bg: #fef2f2;
            --mmg-danger-border: #fecaca;
        }

        .mmg-app-wrapper {
            font-family: var(--mmg-font);
            background-color: var(--mmg-bg);
            color: var(--mmg-text-main);
            min-height: 100vh;
            padding-bottom: 3rem;
            line-height: 1.5;
            box-sizing:
        }

        .mmg-app-wrapper * { box-sizing: border-box; }

        /* Layout */
        .mmg-container { max-width: 80rem; margin: 0 auto; padding: 2rem 1rem; }
        .mmg-grid-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
        @media (min-width: 1024px) {
            .mmg-grid-layout { grid-template-columns: repeat(12, minmax(0, 1fr)); }
            .mmg-col-sidebar { grid-column: span 4 / span 4; }
            .mmg-col-main { grid-column: span 8 / span 8; }
        }
        @media (max-width: 700px) {
            .mmg-card-header-flex { flex-direction: column !important; gap:25px; }
        }

        .mmg-card {
            background-color: #ffffff;
            border-radius: 1rem;
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            border: 1px solid var(--mmg-border);
            overflow: hidden;
            margin-bottom: 1.5rem;
        }
        .mmg-card-header {
            padding: 1rem 1.25rem;
            border-bottom: 1px solid #f1f5f9;
            background-color: rgba(248, 250, 252, 0.8);
        }
        .mmg-card-header-flex { display: flex; justify-content: space-between; align-items: center; }
        .mmg-card-title {
            font-weight: 700;
            color: var(--mmg-text-main);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.875rem;
            margin: 0;
        }
        .mmg-card-title-lg { font-size: 1.125rem; }
        .mmg-card-body { padding: 1.25rem; }

        /* Buttons */
        .mmg-btn {
            display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
            border-radius: 0.5rem; font-weight: 600; font-size: 0.75rem; padding: 0.5rem 0.75rem;
            cursor: pointer; transition: all 0.2s; border: 1px solid transparent; background: transparent; font-family: inherit;
        }
        .mmg-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        
        .mmg-btn-outline { background-color: #ffffff; border-color: var(--mmg-border); color: #334155; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
        .mmg-btn-outline:hover:not(:disabled) { background-color: #f8fafc; }
        
        .mmg-btn-success { background-color: var(--mmg-success-bg); border-color: var(--mmg-success-border); color: var(--mmg-success); }
        .mmg-btn-success:hover:not(:disabled) { background-color: #d1fae5; }
        
        .mmg-btn-primary { background-color: var(--mmg-primary); color: #ffffff; box-shadow: 0 4px 6px -1px rgba(109, 40, 217, 0.2); border-color: var(--mmg-primary); }
        .mmg-btn-primary:hover:not(:disabled) { background-color: var(--mmg-primary-hover); border-color: var(--mmg-primary-hover); }
        
        .mmg-btn-danger { background-color: var(--mmg-danger-bg); border-color: var(--mmg-danger-border); color: var(--mmg-danger); }
        .mmg-btn-danger:hover:not(:disabled) { background-color: var(--mmg-danger); color: #ffffff; }

        .mmg-btn-icon-only { padding: 0.375rem; color: var(--mmg-text-light); border-radius: 0.25rem; border: none; cursor: pointer; transition: all 0.2s; background: transparent; }
        .mmg-btn-icon-only:hover { color: var(--mmg-danger); background-color: var(--mmg-danger-bg); }

        .mmg-btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.75rem;}

        /* Forms & Inputs */
        .mmg-input-group { display: flex; flex-direction: column; gap: 0.375rem; }
        .mmg-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mmg-text-light); display: block; }
        .mmg-input {
            width: 100%; background-color: #f8fafc; border: 1px solid var(--mmg-border); border-radius: 0.5rem;
            padding: 0.5rem 0.75rem; font-size: 0.875rem; color: #334155; font-weight: 500; outline: none; transition: all 0.2s; font-family: inherit;
        }
        .mmg-input:focus { background-color: #ffffff; border-color: var(--mmg-border-focus); box-shadow: 0 0 0 2px #ede9fe; }
        .mmg-input-mono { font-family: monospace; }
        
        .mmg-color-wrap { position: relative; width: 2.3rem; height: 2.3rem; border-radius: 0.5rem; overflow: hidden; border: 1px solid var(--mmg-border); cursor: pointer; flex-shrink: 0; }
        .mmg-color-wrap:hover { box-shadow: 0 0 0 2px var(--mmg-border-focus); }
.mmg-input-color { width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; background: transparent; }
.mmg-input-color::-webkit-color-swatch-wrapper { padding: 0; }
.mmg-input-color::-webkit-color-swatch { border: none; border-radius: 0; }
.mmg-input-color::-moz-color-swatch { border: none; border-radius: 0; }
.mmg-input-row { display: flex; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem;}

        /* Mode Switcher */
        .mmg-mode-switcher { display: flex; padding: 0.25rem; background-color: rgba(241, 245, 249, 0.8); border-radius: 0.5rem; margin-bottom: 1rem; }
        .mmg-mode-btn { flex: 1; padding: 0.375rem; font-size: 0.75rem; font-weight: 600; border-radius: 0.375rem; cursor: pointer; border: 1px solid transparent; background: transparent; transition: all 0.2s; color: var(--mmg-text-muted); }
        .mmg-mode-btn-active { background-color: #ffffff; color: var(--mmg-primary); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); border-color: var(--mmg-border); }
        .mmg-mode-btn:not(.mmg-mode-btn-active):hover { color: var(--mmg-text-main); }

        /* Section Titles */
        .mmg-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
        .mmg-link-btn { font-size: 0.75rem; display: flex; align-items: center; gap: 0.25rem; color: var(--mmg-primary); background: none; border: none; cursor: pointer; font-weight: 600; padding: 0; }
        .mmg-link-btn:hover { color: var(--mmg-primary-hover); }

        /* Data Table */
        .mmg-table-wrapper { border: 1px solid #cbd5e1; border-radius: 0.5rem; overflow: hidden; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); margin-bottom: 1rem; }
        .mmg-table-header { display: flex; background-color: #f1f5f9; border-bottom: 1px solid #cbd5e1; }
        .mmg-th { font-size: 0.6875rem; font-weight: 700; color: #475569; padding: 0.625rem 0.75rem; border-right: 1px solid #cbd5e1; flex: 1; }
        .mmg-th span { font-weight: 400; color: var(--mmg-text-light); }
        .mmg-th-index { width: 2.5rem; border-right: 1px solid #cbd5e1; background-color: rgba(226, 232, 240, 0.5); flex: none; }
        .mmg-th-action { width: 3rem; background-color: #f8fafc; flex: none;}
        
        .mmg-table-body { max-height: 15.625rem; overflow-y: auto; background-color: #ffffff; }
        .mmg-tr { display: flex; border-bottom: 1px solid var(--mmg-border); transition: background-color 0.2s; }
        .mmg-tr:hover { background-color: var(--mmg-primary-light); }
        
        .mmg-td-index { width: 2.5rem; background-color: #f8fafc; border-right: 1px solid var(--mmg-border); display: flex; align-items: center; justify-content: center; font-size: 0.625rem; font-weight: 700; color: var(--mmg-text-light); flex: none; }
        .mmg-td { flex: 1; border-right: 1px solid var(--mmg-border); position: relative; }
        .mmg-cell-input { width: 100%; height: 100%; padding: 0.625rem 0.75rem; font-size: 0.875rem; background: transparent; border: none; outline: none; font-family: monospace; margin: 0; }
        .mmg-cell-input:focus { background-color: var(--mmg-primary-light); box-shadow: inset 0 0 0 2px var(--mmg-border-focus); position: relative; z-index: 10; }
        .mmg-td-action { width: 3rem; display: flex; align-items: center; justify-content: center; flex: none; }

        /* Tabs */
        .mmg-tabs-wrapper { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-bottom: 0.75rem; margin-bottom: 1.25rem; border-bottom: 1px solid #f1f5f9; }
        .mmg-tab { padding: 0.375rem 0.75rem; border-radius: 0.5rem; font-size: 0.75rem; font-weight: 600; transition: all 0.2s; display: flex; align-items: center; gap: 0.5rem; border: 1px solid transparent; cursor: pointer; background-color: #f8fafc; color: var(--mmg-text-muted); font-family: inherit; }
        .mmg-tab:hover { background-color: #f1f5f9; color: #334155; }
        .mmg-tab-active { background-color: #ffffff; border-color: #cbd5e1; color: var(--mmg-text-main); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
        .mmg-tab-dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; }

        /* Params Box */
        .mmg-params-box { padding: 1rem; background-color: var(--mmg-primary-light); border: 1px solid #ede9fe; border-radius: 0.75rem; display: flex; flex-direction: column; gap: 1rem; }

        /* Results Grid */
        .mmg-results-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
        @media (min-width: 768px) { .mmg-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; } }
        
        .mmg-result-card { background-color: #ffffff; border-radius: 1rem; border: 1px solid var(--mmg-border); padding: 1.25rem; position: relative; overflow: hidden; transition: box-shadow 0.2s; }
        .mmg-result-card:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
        .mmg-result-strip { position: absolute; top: 0; left: 0; width: 0.375rem; height: 100%; }
        .mmg-result-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; padding-left: 0.75rem; }
        .mmg-result-title { font-weight: 700; color: var(--mmg-text-main); font-size: 1.125rem; margin: 0; }
        .mmg-badge { font-size: 0.625rem; padding: 0.25rem 0.5rem; border-radius: 0.375rem; font-family: monospace; font-weight: 700; border: 1px solid; }
        .mmg-badge-slate { background-color: #f1f5f9; color: var(--mmg-text-muted); border-color: var(--mmg-border); }
        .mmg-badge-purple { background-color: var(--mmg-primary-light); color: var(--mmg-primary); border-color: #ede9fe; }
        
        .mmg-result-body { padding-left: 0.75rem; }
        .mmg-param-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--mmg-border); margin-bottom: 0.5rem; }
        .mmg-param-label { color: var(--mmg-text-muted); font-size: 0.75rem; display: block; margin-bottom: 0.25rem; font-weight: 600;}
        .mmg-param-value { font-family: monospace; font-size: 1.25rem; font-weight: 700; color: var(--mmg-text-main); }
        
        .mmg-marker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-top: 0.25rem; }
        .mmg-marker-label { color: var(--mmg-text-light); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: block; }
        .mmg-marker-value { font-family: monospace; font-size: 0.875rem; color: #475569; font-weight: 500; }
        
        .mmg-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 8rem; color: var(--mmg-text-light); }
        .mmg-empty-icon { font-size: 2.25rem; margin-bottom: 0.5rem; opacity: 0.3; }
        .mmg-empty-text { font-size: 0.875rem; font-weight: 500; }

        /* Chart Container */
        .mmg-chart-wrap { position: relative; width: 100%; height: 350px; padding: 0.5rem; }
        @media (min-width: 768px) { .mmg-chart-wrap { height: 450px; } }

        /* Modal System */
        .mmg-modal-backdrop { position: fixed; inset: 0; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
        .mmg-modal-backdrop.mmg-show { opacity: 1; visibility: visible; }
        .mmg-modal-panel { background-color: #ffffff; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); width: 100%; max-width: 28rem; transform: scale(0.95); transition: transform 0.3s ease; overflow: hidden; }
        .mmg-modal-backdrop.mmg-show .mmg-modal-panel { transform: scale(1); }
        .mmg-modal-header { padding: 1rem 1.5rem; border-bottom: 1px solid #f1f5f9; background-color: #f8fafc; display: flex; justify-content: space-between; align-items: center; }
        .mmg-modal-title { font-weight: 700; color: var(--mmg-text-main); display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 1rem; }
        .mmg-modal-close { background: #ffffff; border: none; color: var(--mmg-text-light); cursor: pointer; border-radius: 9999px; padding: 0.25rem; display: flex; }
        .mmg-modal-close:hover { color: var(--mmg-danger); background-color: var(--mmg-danger-bg); }
        .mmg-modal-body { padding: 1.5rem; }
        .mmg-modal-text { font-size: 0.875rem; color: var(--mmg-text-muted); margin-bottom: 0.75rem; margin-top: 0; line-height: 1.6; }
        .mmg-textarea { width: 100%; height: 10rem; background-color: #f8fafc; border: 1px solid var(--mmg-border); border-radius: 0.75rem; padding: 0.75rem; font-family: monospace; font-size: 0.875rem; outline: none; resize: none; }
        .mmg-textarea:focus { border-color: var(--mmg-border-focus); box-shadow: inset 0 0 0 2px #ede9fe; }
        .mmg-modal-footer { display: flex; gap: 0.75rem; margin-top: 1.25rem; justify-content: flex-end; }

        /* Dialog specific styling */
        .mmg-dialog-icon-wrap { width: 3rem; height: 3rem; border-radius: 9999px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1rem; }
        .mmg-dialog-icon-info { background-color: #fef3c7; color: #d97706; }
        .mmg-dialog-icon-confirm { background-color: var(--mmg-primary-light); color: var(--mmg-primary); }
        .mmg-dialog-icon-danger { background-color: #fee2e2; color: #dc2626; }
        .mmg-dialog-title { font-weight: 700; color: var(--mmg-text-main); font-size: 1.125rem; margin-top: 0; margin-bottom: 0.5rem; }

        /* Utilities */
        .mmg-hidden { display: none !important; }
        .mmg-animate-fade { animation: mmgFadeIn 0.3s ease-in-out; }
        @keyframes mmgFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
        .mmg-text-purple { color: var(--mmg-primary); }
        .mmg-text-emerald { color: var(--mmg-success); }
        .mmg-actions-row { display: flex; gap: 0.5rem; margin-top: 1rem; }
        .mmg-flex-1 { flex: 1; }

        @media print {
            .mmg-print-hidden { display: none !important; }
            .mmg-container { padding: 0; }
            .mmg-grid-layout { display: block; }
            .mmg-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); break-inside: avoid; }
            .mmg-card { box-shadow: none; border-color: #cbd5e1; margin-bottom: 1rem; }
        }