:root {
            --lbg-font: 'Inter', sans-serif;
            --lbg-bg: #f8fafc;
            --lbg-text-main: #1e293b;
            --lbg-text-muted: #64748b;
            --lbg-text-light: #94a3b8;
            --lbg-border: #e2e8f0;
            --lbg-border-focus: #3b82f6;
            
            --lbg-primary: #2563eb;
            --lbg-primary-hover: #1d4ed8;
            --lbg-primary-light: #eff6ff;
            
            --lbg-success: #059669;
            --lbg-success-hover: #047857;
            --lbg-success-bg: #ecfdf5;
            --lbg-success-border: #a7f3d0;
            
            --lbg-danger: #dc2626;
            --lbg-danger-hover: #b91c1c;
            --lbg-danger-bg: #fef2f2;
            --lbg-danger-border: #fecaca;
        }

        .lbg-app-wrapper {
            font-family: var(--lbg-font);
            background-color: var(--lbg-bg);
            color: var(--lbg-text-main);
            min-height: 100vh;
            padding-bottom: 3rem;
            line-height: 1.5;
            box-sizing: border-box;
        }

        .lbg-app-wrapper * {
            box-sizing: border-box;
        }

        /* --- Layout --- */
        .lbg-container {
            max-width: 80rem;
            margin: 0 auto;
            padding: 2rem 1rem !important;
        }

        .lbg-grid-layout {
            display: grid;
            grid-template-columns: 1fr;
            gap: 2rem;
        }

        @media (min-width: 1024px) {
            .lbg-grid-layout { grid-template-columns: repeat(12, minmax(0, 1fr)); }
            .lbg-col-sidebar { grid-column: span 4 / span 4; }
            .lbg-col-main { grid-column: span 8 / span 8; }
        }

        /* --- Cards --- */
        .lbg-card {
            background-color: #ffffff;
            border-radius: 1rem;
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            border: 1px solid var(--lbg-border);
            overflow: hidden;
            margin-bottom: 1.5rem;
        }

        .lbg-card-header {
            padding: 1rem 1.25rem;
            border-bottom: 1px solid #f1f5f9;
            background-color: rgba(248, 250, 252, 0.8);
        }

        .lbg-card-header-flex {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .lbg-card-title {
            font-weight: 700;
            color: var(--lbg-text-main);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.875rem;
            margin: 0;
        }
        
        .lbg-card-title-lg { font-size: 1.125rem; }

        .lbg-card-body { padding: 1.25rem; }

        /* --- Buttons --- */
        .lbg-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;
        }
        .lbg-btn:disabled { opacity: 0.5; cursor: not-allowed; }
        
        .lbg-btn-outline {
            background-color: #ffffff;
            border-color: var(--lbg-border);
            color: #334155;
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        }
        .lbg-btn-outline:hover:not(:disabled) { background-color: #f8fafc; }
        
        .lbg-btn-success {
            background-color: var(--lbg-success-bg);
            border-color: var(--lbg-success-border);
            color: var(--lbg-success);
        }
        .lbg-btn-success:hover:not(:disabled) { background-color: #d1fae5; }
        
        .lbg-btn-primary {
            background-color: var(--lbg-primary);
            color: #ffffff;
            box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
            border-color: var(--lbg-primary);
        }
        .lbg-btn-primary:hover:not(:disabled) { background-color: var(--lbg-primary-hover); border-color: var(--lbg-primary-hover); }
        
        .lbg-btn-danger {
            background-color: var(--lbg-danger-bg);
            border-color: var(--lbg-danger-border);
            color: var(--lbg-danger);
        }
        .lbg-btn-danger:hover:not(:disabled) { background-color: var(--lbg-danger); color: #ffffff; }

        .lbg-btn-ghost { color: var(--lbg-primary); padding: 0; }
        .lbg-btn-ghost:hover:not(:disabled) { color: var(--lbg-primary-hover); }

        .lbg-btn-icon-only {
            padding: 0.375rem;
            color: var(--lbg-text-light);
            border-radius: 0.25rem;
            background: transparent;
            border: none;
            cursor: pointer;
            transition: all 0.2s;
        }
        .lbg-btn-icon-only:hover { color: var(--lbg-danger); background-color: var(--lbg-danger-bg); }

        .lbg-btn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.75rem;}

        /* --- Forms & Inputs --- */
        .lbg-input-group { display: flex; flex-direction: column; gap: 0.375rem; }
        
        .lbg-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--lbg-text-light);
            display: block;
        }
        
        .lbg-input {
            width: 100%;
            background-color: #f8fafc;
            border: 1px solid var(--lbg-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;
        }
        .lbg-input:focus {
            background-color: #ffffff;
            border-color: var(--lbg-border-focus);
            box-shadow: 0 0 0 2px #dbeafe;
        }
        
        .lbg-input-mono { font-family: monospace; }
        
        .lbg-color-wrap {
            position: relative;
            width: 2.3rem;
            height: 2.3rem;
            border-radius: 0.5rem;
            overflow: hidden;
            border: 1px solid var(--lbg-border);
            box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
            cursor: pointer;
            flex-shrink: 0;
        }
        .lbg-color-wrap:hover { box-shadow: 0 0 0 2px var(--lbg-border-focus); }
.lbg-input-color { width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; background: transparent; }
.lbg-input-color::-webkit-color-swatch-wrapper { padding: 0; }
.lbg-input-color::-webkit-color-swatch { border: none; border-radius: 0; }
.lbg-input-color::-moz-color-swatch { border: none; border-radius: 0; }
.lbg-input-row { display: flex; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem;}
        @media (max-width: 700px) {
            .lbg-card-header-flex { flex-direction: column !important; gap:25px; }
        }
        .lbg-input-row { display: flex; gap: 0.75rem; align-items: flex-end; margin-bottom: 1rem;}

        /* --- Mode Switcher --- */
        .lbg-mode-switcher {
            display: flex;
            padding: 0.25rem;
            background-color: rgba(241, 245, 249, 0.8);
            border-radius: 0.5rem;
            margin-bottom: 1rem;
        }
        .lbg-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(--lbg-text-muted);
        }
        .lbg-mode-btn-active {
            background-color: #ffffff;
            color: var(--lbg-primary);
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            border-color: var(--lbg-border);
        }
        .lbg-mode-btn:not(.lbg-mode-btn-active):hover { color: var(--lbg-text-main); }

        /* --- Section Titles --- */
        .lbg-section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.5rem;
        }
        .lbg-link-btn {
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            gap: 0.25rem;
            color: var(--lbg-primary);
            background: none;
            border: none;
            cursor: pointer;
            font-weight: 600;
            padding: 0;
        }
        .lbg-link-btn:hover { color: var(--lbg-primary-hover); }

        /* --- Data Table --- */
        .lbg-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;
        }
        .lbg-table-header {
            display: flex;
            background-color: #f1f5f9;
            border-bottom: 1px solid #cbd5e1;
        }
        .lbg-th {
            font-size: 0.6875rem;
            font-weight: 700;
            color: #475569;
            padding: 0.625rem 0.75rem;
            border-right: 1px solid #cbd5e1;
            flex: 1;
        }
        .lbg-th span { font-weight: 400; color: var(--lbg-text-light); }
        .lbg-th-index { width: 2.5rem; border-right: 1px solid #cbd5e1; background-color: rgba(226, 232, 240, 0.5); flex: none; }
        .lbg-th-action { width: 3rem; background-color: #f8fafc; flex: none;}
        
        .lbg-table-body {
            max-height: 15.625rem;
            overflow-y: auto;
            background-color: #ffffff;
        }
        .lbg-tr {
            display: flex;
            border-bottom: 1px solid var(--lbg-border);
            transition: background-color 0.2s;
        }
        .lbg-tr:hover { background-color: rgba(239, 246, 255, 0.3); }
        
        .lbg-td-index {
            width: 2.5rem;
            background-color: #f8fafc;
            border-right: 1px solid var(--lbg-border);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.625rem;
            font-weight: 700;
            color: var(--lbg-text-light);
            user-select: none;
            flex: none;
        }
        .lbg-tr:hover .lbg-td-index { background-color: rgba(219, 234, 254, 0.5); }
        
        .lbg-td { flex: 1; border-right: 1px solid var(--lbg-border); position: relative; }
        
        .lbg-cell-input {
            width: 100%;
            height: 100%;
            padding: 0.625rem 0.75rem;
            font-size: 0.875rem;
            background: transparent;
            border: none;
            outline: none;
            font-family: monospace;
            transition: all 0.2s;
            margin: 0;
        }
        .lbg-cell-input:focus {
            background-color: var(--lbg-primary-light);
            box-shadow: inset 0 0 0 2px var(--lbg-border-focus);
            position: relative;
            z-index: 10;
        }
        
        .lbg-td-action {
            width: 3rem;
            background-color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: none;
        }
        .lbg-tr:hover .lbg-td-action { background-color: rgba(239, 246, 255, 0.3); }

        /* --- Tabs --- */
        .lbg-tabs-wrapper {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding-bottom: 0.75rem;
            margin-bottom: 1.25rem;
            border-bottom: 1px solid #f1f5f9;
        }
        .lbg-tab {
            padding: 0.375rem 0.75rem;
            border-radius: 0.5rem;
            font-size: 0.75rem;
            font-weight: 600;
            white-space: nowrap;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            border: 1px solid transparent;
            cursor: pointer;
            background-color: #f8fafc;
            color: var(--lbg-text-muted);
            font-family: inherit;
        }
        .lbg-tab:hover { background-color: #f1f5f9; color: #334155; }
        .lbg-tab-active {
            background-color: #ffffff;
            border-color: #cbd5e1;
            color: var(--lbg-text-main);
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        }
        .lbg-tab-dot {
            width: 0.625rem;
            height: 0.625rem;
            border-radius: 50%;
            box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
        }

        /* --- Params Box --- */
        .lbg-params-box {
            padding: 1rem;
            background-color: rgba(239, 246, 255, 0.5);
            border: 1px solid #dbeafe;
            border-radius: 0.75rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        /* --- Results Grid --- */
        .lbg-results-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 1rem;
        }
        @media (min-width: 768px) {
            .lbg-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
        }

        .lbg-result-card {
            background-color: #ffffff;
            border-radius: 1rem;
            box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            border: 1px solid var(--lbg-border);
            padding: 1.25rem;
            position: relative;
            overflow: hidden;
            transition: box-shadow 0.2s;
        }
        .lbg-result-card:hover {
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .lbg-result-strip {
            position: absolute;
            top: 0; left: 0;
            width: 0.375rem;
            height: 100%;
        }
        .lbg-result-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 1.25rem;
            padding-left: 0.75rem;
        }
        .lbg-result-title {
            font-weight: 700;
            color: var(--lbg-text-main);
            font-size: 1.125rem;
            margin: 0;
        }
        
        .lbg-badge {
            font-size: 0.625rem;
            padding: 0.25rem 0.5rem;
            border-radius: 0.375rem;
            font-family: monospace;
            font-weight: 700;
            border: 1px solid;
        }
        .lbg-badge-slate { background-color: #f1f5f9; color: var(--lbg-text-muted); border-color: var(--lbg-border); }
        .lbg-badge-blue { background-color: var(--lbg-primary-light); color: var(--lbg-primary); border-color: #dbeafe; }
        
        .lbg-result-body { padding-left: 0.75rem; }
        
        .lbg-param-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 1rem;
            padding-bottom: 1rem;
            border-bottom: 1px dashed var(--lbg-border);
            margin-bottom: 0.25rem;
        }
        .lbg-param-label { color: var(--lbg-text-muted); font-size: 0.75rem; display: block; margin-bottom: 0.25rem; }
        .lbg-param-value { font-family: monospace; font-size: 1.25rem; font-weight: 700; color: var(--lbg-text-main); letter-spacing: -0.025em; }
        
        .lbg-intercept-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 1rem;
            padding-top: 0.25rem;
        }
        .lbg-intercept-label { color: var(--lbg-text-light); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; display: block; }
        .lbg-intercept-sub { font-size: 0.5625rem; text-transform: lowercase; font-weight: normal;}
        .lbg-intercept-value { font-family: monospace; font-size: 0.875rem; color: #475569; font-weight: 500; }
        
        .lbg-equation-box {
            margin-top: 0.75rem;
            background-color: #f8fafc;
            border-radius: 0.5rem;
            padding: 0.5rem;
            text-align: center;
            border: 1px solid #f1f5f9;
        }
        .lbg-equation-label { color: var(--lbg-text-light); font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.5rem; }
        .lbg-equation-value { font-family: monospace; font-size: 0.75rem; color: #334155; font-weight: 700; }
        
        .lbg-empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 8rem;
            color: var(--lbg-text-light);
        }
        .lbg-empty-icon { font-size: 2.25rem; margin-bottom: 0.5rem; opacity: 0.3; }
        .lbg-empty-text { font-size: 0.875rem; font-weight: 500; }

        /* --- Chart Container --- */
        .lbg-chart-wrap {
            position: relative;
            width: 100%;
            height: 350px;
            padding: 0.5rem;
        }
        @media (min-width: 768px) { .lbg-chart-wrap { height: 450px; } }

        /* --- Modal System --- */
        .lbg-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;
        }
        .lbg-modal-backdrop.lbg-show { opacity: 1; visibility: visible; }
        
        .lbg-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;
        }
        .lbg-modal-backdrop.lbg-show .lbg-modal-panel { transform: scale(1); }
        
        .lbg-modal-header {
            padding: 1rem 1.5rem;
            border-bottom: 1px solid #f1f5f9;
            background-color: #f8fafc;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .lbg-modal-title {
            font-weight: 700;
            color: var(--lbg-text-main);
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin: 0;
            font-size: 1rem;
        }
        
        .lbg-modal-close {
            background: #ffffff;
            border: none;
            color: var(--lbg-text-light);
            cursor: pointer;
            border-radius: 9999px;
            padding: 0.25rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .lbg-modal-close:hover { color: var(--lbg-danger); background-color: var(--lbg-danger-bg); }
        
        .lbg-modal-body { padding: 1.5rem; }
        .lbg-modal-text {
            font-size: 0.875rem;
            color: var(--lbg-text-muted);
            margin-bottom: 0.75rem;
            margin-top: 0;
            line-height: 1.6;
        }
        
        .lbg-textarea {
            width: 100%;
            height: 10rem;
            background-color: #f8fafc;
            border: 1px solid var(--lbg-border);
            border-radius: 0.75rem;
            padding: 0.75rem;
            font-family: monospace;
            font-size: 0.875rem;
            outline: none;
            resize: none;
            box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
            transition: all 0.2s;
            color: #334155;
        }
        .lbg-textarea:focus { border-color: var(--lbg-border-focus); box-shadow: inset 0 0 0 2px #dbeafe; }
        
        .lbg-modal-footer {
            display: flex;
            gap: 0.75rem;
            margin-top: 1.25rem;
            justify-content: flex-end;
        }
        
        /* Dialog specific styling */
        .lbg-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;
        }
        .lbg-dialog-icon-info { background-color: #fef3c7; color: #d97706; }
        .lbg-dialog-icon-confirm { background-color: #dbeafe; color: #2563eb; }
        .lbg-dialog-icon-danger { background-color: #fee2e2; color: #dc2626; }
        .lbg-dialog-title {
            font-weight: 700;
            color: var(--lbg-text-main);
            font-size: 1.125rem;
            margin-top: 0;
            margin-bottom: 0.5rem;
        }

        /* --- Utilities --- */
        .lbg-hidden { display: none !important; }
        .lbg-animate-fade { animation: lbgFadeIn 0.3s ease-in-out; }
        @keyframes lbgFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
        .lbg-text-blue { color: var(--lbg-primary); }
        .lbg-text-emerald { color: var(--lbg-success); }
        .lbg-actions-row { display: flex; gap: 0.5rem; margin-top: 1rem; }
        .lbg-flex-1 { flex: 1; }

        /* --- Print Styles --- */
        @media print {
            .lbg-print-hidden { display: none !important; }
            .lbg-container { padding: 0; }
            .lbg-grid-layout { display: block; }
            .lbg-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); break-inside: avoid; }
            .lbg-card { box-shadow: none; border-color: #cbd5e1; margin-bottom: 1rem; }
        }