/* Matrix Xtream Editor - Redesign Variant 1 */
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #f5f7fb;
    color: #16304b;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #eef2f8; }
::-webkit-scrollbar-thumb { background: #c9d6e8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #9fb6d6; }

.matrix-sidebar {
    width: 252px;
    min-height: 100vh;
    background: linear-gradient(180deg, #fcfdff 0%, #f6f9fe 100%);
    border-right: 1px solid #e4ebf5;
    padding: 18px 16px;
}
.matrix-sidebar-inner { display:flex; flex-direction:column; justify-content:space-between; min-height:calc(100vh - 36px); gap:24px; }
.matrix-brand-wrap { display:flex; align-items:center; gap:12px; padding:2px 6px 16px; }
.matrix-brand-logo {
    width:40px; height:40px; border-radius:13px; display:flex; align-items:center; justify-content:center;
    background: linear-gradient(135deg, #3a7bff 0%, #74a7ff 100%); color:#fff; font-weight:800; font-size:22px;
    box-shadow: 0 12px 24px -14px rgba(58,123,255,.85);
}
.matrix-brand-title { color:#183153; font-size:15px; font-weight:800; line-height:1.1; }
.matrix-brand-subtitle { color:#8092ac; font-size:11px; margin-top:3px; }
.matrix-nav { display:flex; flex-direction:column; gap:6px; }
.matrix-nav-link {
    display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:14px; color:#526784; font-size:14px; font-weight:700;
    transition:all .2s ease; text-decoration:none;
}
.matrix-nav-link:hover { background:#eef4ff; color:#2868e8; }
.matrix-nav-link.is-active { background:#eaf2ff; color:#1f6bff; box-shadow: inset 0 0 0 1px #d9e7ff; }
.matrix-nav-icon { width:18px; text-align:center; font-size:15px; line-height:1; opacity:.95; }
.matrix-sidebar-footer { display:flex; flex-direction:column; gap:16px; }
.matrix-theme-switch {
    display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; padding:7px; border-radius:16px;
    border:1px solid #e4ebf5; background:#f8fbff; box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.matrix-theme-option {
    display:flex; align-items:center; gap:8px; justify-content:center; flex:1; padding:9px 10px; border-radius:12px; font-size:13px; font-weight:700; color:#60748f; transition:all .2s ease;
}
.matrix-theme-option-icon { font-size:14px; line-height:1; }
#matrixThemeToggle[data-theme-state="light"] .matrix-theme-light-option,
#matrixThemeToggle[data-theme-state="dark"] .matrix-theme-dark-option {
    background:#ffffff; color:#1d6eff; box-shadow:0 8px 18px -14px rgba(38,86,181,.55); border:1px solid #dce8fb;
}
.matrix-version-card {
    border:1px solid #e5ebf4; border-radius:18px; background:#fbfdff; padding:16px; color:#7a8ea8;
}
.matrix-version-title { font-size:14px; font-weight:800; color:#1a3558; margin-bottom:4px; }
.matrix-version-meta { font-size:11px; font-weight:700; color:#6f85a3; margin-bottom:8px; }
.matrix-version-copy { font-size:12px; line-height:1.55; }

.glass-panel {
    background:#ffffff !important; border:1px solid #e5ebf4 !important; box-shadow:0 16px 34px -24px rgba(40,68,122,.22);
    transition: all .25s ease;
}
.glass-panel:hover { box-shadow:0 20px 36px -24px rgba(40,68,122,.28); }
.custom-input {
    background:#ffffff !important; border:1px solid #d9e4f2 !important; border-radius:14px !important; padding:.8rem .95rem !important;
    color:#183153 !important; transition:all .2s ease; box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.custom-input::placeholder { color:#91a3bb !important; }
.custom-input:focus { outline:none !important; border-color:#87b5ff !important; box-shadow:0 0 0 4px rgba(73,135,255,.12) !important; }

.matrix-page-topbar {
    display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px;
}
.matrix-page-kicker { color:#6f86a3; font-size:12px; font-weight:700; }
.matrix-page-title { color:#102848; font-size:22px; line-height:1.15; font-weight:800; margin:0; }
.matrix-page-subtitle { color:#6f86a3; font-size:13px; margin-top:6px; }
.matrix-user-chip { display:flex; align-items:center; gap:12px; background:#fff; border:1px solid #e5ebf4; border-radius:16px; padding:10px 14px; box-shadow:0 14px 30px -26px rgba(30,58,117,.42); }
.matrix-online-chip { display:inline-flex; align-items:center; gap:8px; padding:10px 14px; border-radius:999px; background:#edfdf4; color:#138a47; font-weight:800; font-size:13px; border:1px solid #cdeedb; }
.matrix-online-dot { width:8px; height:8px; border-radius:50%; background:#16a34a; box-shadow:0 0 0 4px rgba(34,197,94,.12); }
.matrix-avatar { width:40px; height:40px; border-radius:999px; background:#eff4fb; display:flex; align-items:center; justify-content:center; color:#31567f; font-weight:800; }
.matrix-user-chip-name { color:#153154; font-size:14px; font-weight:800; line-height:1.1; }
.matrix-user-chip-role { color:#8ba0bb; font-size:12px; margin-top:3px; }

.custom-table { width:100%; border-collapse:separate; border-spacing:0; }
.custom-table thead th {
    color:#68819e; font-size:11px; text-transform:uppercase; letter-spacing:.06em; padding:14px 16px; font-weight:800; background:#f7fafe;
    border-bottom:1px solid #e7eef7;
}
.custom-table tbody tr { background:#fff; transition:background .2s ease; }
.custom-table tbody tr:hover { background:#fafcff; }
.custom-table td { padding:14px 16px; font-size:13px; color:#153154; border-bottom:1px solid #eef3f8; }
.truncate-fix { display:inline-block; max-width:85%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sortable-ghost { opacity:.35; background:#dceaff !important; }
.sortable-chosen { background:#eef5ff !important; }
.animate-fade-in { animation: fadeIn .25s ease-out forwards; }
@keyframes fadeIn { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }
.template-group-active { background:#eff8ff !important; border-color:#bcd7ff !important; }

/* shared light conversions for tailwind-heavy pages */
body[data-theme="light"] .text-white { color:#132e51 !important; }
body[data-theme="light"] .text-zinc-100,
body[data-theme="light"] .text-zinc-200,
body[data-theme="light"] .text-zinc-300,
body[data-theme="light"] .text-zinc-400,
body[data-theme="light"] .text-zinc-500,
body[data-theme="light"] .text-zinc-600 { color:#6f86a3 !important; }
body[data-theme="light"] .text-zinc-300.font-bold,
body[data-theme="light"] .font-black.text-white,
body[data-theme="light"] .font-bold.text-white { color:#132e51 !important; }
body[data-theme="light"] .bg-zinc-950,
body[data-theme="light"] .bg-zinc-950\/40,
body[data-theme="light"] .bg-zinc-950\/50,
body[data-theme="light"] .bg-zinc-950\/60,
body[data-theme="light"] .bg-zinc-950\/70,
body[data-theme="light"] .bg-zinc-950\/80,
body[data-theme="light"] .bg-zinc-950\/90,
body[data-theme="light"] .bg-zinc-900,
body[data-theme="light"] .bg-zinc-900\/40,
body[data-theme="light"] .bg-zinc-900\/50,
body[data-theme="light"] .bg-zinc-900\/60,
body[data-theme="light"] .bg-zinc-900\/70,
body[data-theme="light"] .bg-zinc-900\/80,
body[data-theme="light"] .bg-zinc-800,
body[data-theme="light"] .bg-zinc-800\/60 { background:#f7fafe !important; }
body[data-theme="light"] .border-zinc-900,
body[data-theme="light"] .border-zinc-900\/30,
body[data-theme="light"] .border-zinc-900\/40,
body[data-theme="light"] .border-zinc-900\/60,
body[data-theme="light"] .border-zinc-800,
body[data-theme="light"] .border-zinc-800\/40,
body[data-theme="light"] .border-zinc-800\/60 { border-color:#e2eaf4 !important; }
body[data-theme="light"] .shadow-inner { box-shadow: inset 0 1px 2px rgba(29,78,216,.04) !important; }
body[data-theme="light"] .bg-amber-500,
body[data-theme="light"] .bg-green-600,
body[data-theme="light"] .bg-blue-600,
body[data-theme="light"] .bg-purple-600,
body[data-theme="light"] .bg-red-600 { color:#fff !important; }
body[data-theme="light"] .from-blue-950\/10 { --tw-gradient-from: rgba(232,241,255,.75) var(--tw-gradient-from-position) !important; }
body[data-theme="light"] .to-transparent { --tw-gradient-to: rgba(255,255,255,0) var(--tw-gradient-to-position) !important; }
body[data-theme="light"] .divide-zinc-900\/80 > :not([hidden]) ~ :not([hidden]) { border-color:#edf2f7 !important; }
body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea { color:#183153; }
body[data-theme="light"] input::placeholder,
body[data-theme="light"] textarea::placeholder { color:#90a2b8; }

/* dark mode */
html[data-theme="dark"], body[data-theme="dark"] { background:#0b1120 !important; color:#dbe7ff !important; }
body[data-theme="dark"] ::-webkit-scrollbar-track { background:#0b1120; }
body[data-theme="dark"] ::-webkit-scrollbar-thumb { background:#263449; }
body[data-theme="dark"] .matrix-sidebar { background:linear-gradient(180deg, #0e1729 0%, #0b1220 100%); border-right-color:#1c2940; }
body[data-theme="dark"] .matrix-brand-logo { background:linear-gradient(135deg, #2e67ea 0%, #5689ff 100%); }
body[data-theme="dark"] .matrix-brand-title,
body[data-theme="dark"] .matrix-page-title,
body[data-theme="dark"] .matrix-user-chip-name,
body[data-theme="dark"] .matrix-version-title,
body[data-theme="dark"] .text-white { color:#eff5ff !important; }
body[data-theme="dark"] .matrix-brand-subtitle,
body[data-theme="dark"] .matrix-page-subtitle,
body[data-theme="dark"] .matrix-page-kicker,
body[data-theme="dark"] .matrix-version-meta,
body[data-theme="dark"] .matrix-version-copy,
body[data-theme="dark"] .text-zinc-400,
body[data-theme="dark"] .text-zinc-500,
body[data-theme="dark"] .text-zinc-600 { color:#89a0bf !important; }
body[data-theme="dark"] .matrix-nav-link { color:#a5b7cf; }
body[data-theme="dark"] .matrix-nav-link:hover { background:#122039; color:#fff; }
body[data-theme="dark"] .matrix-nav-link.is-active { background:#162845; color:#77a6ff; box-shadow: inset 0 0 0 1px #213a61; }
body[data-theme="dark"] .matrix-theme-switch,
body[data-theme="dark"] .matrix-version-card,
body[data-theme="dark"] .matrix-user-chip,
body[data-theme="dark"] .glass-panel { background:#101a2d !important; border-color:#1c2a43 !important; box-shadow:0 18px 36px -28px rgba(0,0,0,.75) !important; }
body[data-theme="dark"] #matrixThemeToggle[data-theme-state="dark"] .matrix-theme-dark-option,
body[data-theme="dark"] #matrixThemeToggle[data-theme-state="light"] .matrix-theme-light-option { background:#17233c; border:1px solid #22314e; color:#fff; }
body[data-theme="dark"] .custom-input,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea { background:#0d1526 !important; border-color:#22314a !important; color:#e3eeff !important; }
body[data-theme="dark"] .custom-table thead th { background:#0f1728; color:#87a1c3; border-bottom-color:#1d2a42; }
body[data-theme="dark"] .custom-table td { color:#dbe7ff; border-bottom-color:#1a2740; }
body[data-theme="dark"] .custom-table tbody tr:hover { background:#131f35; }
body[data-theme="dark"] .bg-zinc-950,
body[data-theme="dark"] .bg-zinc-950\/40,
body[data-theme="dark"] .bg-zinc-950\/50,
body[data-theme="dark"] .bg-zinc-950\/60,
body[data-theme="dark"] .bg-zinc-950\/70,
body[data-theme="dark"] .bg-zinc-950\/80,
body[data-theme="dark"] .bg-zinc-950\/90,
body[data-theme="dark"] .bg-zinc-900,
body[data-theme="dark"] .bg-zinc-900\/40,
body[data-theme="dark"] .bg-zinc-900\/50,
body[data-theme="dark"] .bg-zinc-900\/60,
body[data-theme="dark"] .bg-zinc-900\/70,
body[data-theme="dark"] .bg-zinc-900\/80,
body[data-theme="dark"] .bg-zinc-800,
body[data-theme="dark"] .bg-zinc-800\/60 { background:#0f1728 !important; }
body[data-theme="dark"] .border-zinc-900,
body[data-theme="dark"] .border-zinc-900\/30,
body[data-theme="dark"] .border-zinc-900\/40,
body[data-theme="dark"] .border-zinc-900\/60,
body[data-theme="dark"] .border-zinc-800,
body[data-theme="dark"] .border-zinc-800\/40,
body[data-theme="dark"] .border-zinc-800\/60 { border-color:#21304a !important; }
body[data-theme="dark"] .template-group-active { background:#12223d !important; border-color:#274770 !important; }

/* Editor UX v1.6.2 */
.matrix-editor-workbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    padding:12px 14px;
    background:rgba(255,255,255,.94);
    backdrop-filter: blur(14px);
    border:1px solid #e2eaf5;
    border-radius:18px;
    box-shadow:0 14px 32px -26px rgba(27,67,130,.45);
}
.matrix-workflow-steps { display:flex; align-items:center; gap:9px; min-width:0; }
.matrix-workflow-step { display:flex; align-items:center; gap:9px; min-width:0; }
.matrix-workflow-step > span:last-child { display:flex; flex-direction:column; line-height:1.15; min-width:0; }
.matrix-workflow-step strong { font-size:11px; color:#173557; font-weight:800; }
.matrix-workflow-step small { font-size:10px; color:#7890ad; margin-top:3px; max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.matrix-step-number { width:25px; height:25px; border-radius:9px; display:flex; align-items:center; justify-content:center; background:#eaf2ff; color:#246ce8; font-size:11px; font-weight:900; border:1px solid #d8e7ff; }
.matrix-workflow-arrow { color:#b3c1d3; font-size:18px; line-height:1; }
.matrix-workbar-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.matrix-save-state { display:inline-flex; align-items:center; gap:7px; font-size:11px; font-weight:800; padding:7px 10px; border-radius:999px; border:1px solid transparent; }
.matrix-save-state.is-saved { color:#1b8a4b; background:#effaf4; border-color:#d4efdf; }
.matrix-save-state.is-dirty { color:#b87409; background:#fff7e8; border-color:#f8dfb0; }
.matrix-save-dot { width:7px; height:7px; border-radius:50%; background:currentColor; }
.matrix-primary-action { background:#246ff2; color:#fff; border:none; border-radius:12px; padding:9px 14px; font-size:11px; font-weight:800; box-shadow:0 10px 20px -14px rgba(36,111,242,.8); transition:all .2s ease; }
.matrix-primary-action:hover { background:#155ed9; transform:translateY(-1px); }
.matrix-secondary-action { background:#fff; color:#4f6684; border:1px solid #dce6f2; border-radius:12px; padding:9px 12px; font-size:11px; font-weight:800; transition:all .2s ease; }
.matrix-secondary-action:hover { background:#f5f9ff; color:#246ff2; border-color:#c7d9f2; }
.matrix-mini-count { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; background:#eff5ff; color:#3d6fae; border:1px solid #dae8fb; font-size:10px; font-weight:800; }
.matrix-quick-add { width:24px; height:24px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; background:#edf5ff; border:1px solid #d5e6ff; color:#1768ed; font-size:15px; line-height:1; font-weight:900; transition:all .18s ease; }
.matrix-quick-add:hover { background:#1768ed; color:#fff; border-color:#1768ed; transform:scale(1.05); }
.matrix-quick-add.is-added { background:#17a65a; color:#fff; border-color:#17a65a; }
.matrix-quick-add:disabled { opacity:.35; cursor:not-allowed; transform:none; }
.category-row.is-source-active { background:#eaf3ff !important; border-color:#bcd7ff !important; box-shadow: inset 3px 0 0 #2f76ed; }
#availableChannels .channel-row { transition:background .18s ease,border-color .18s ease,transform .18s ease; }
#availableChannels .channel-row:hover { transform:translateY(-1px); border-color:#c9d9ed !important; }

@media (max-width: 1100px) {
    .matrix-editor-workbar { align-items:flex-start; flex-direction:column; }
    .matrix-workbar-actions { width:100%; justify-content:space-between; }
}
@media (max-width: 760px) {
    .matrix-workflow-arrow { display:none; }
    .matrix-workflow-steps { align-items:flex-start; flex-direction:column; }
    .matrix-editor-workbar { position:static !important; }
}

body[data-theme="dark"] .matrix-editor-workbar { background:rgba(16,26,45,.94); border-color:#1f304b; }
body[data-theme="dark"] .matrix-workflow-step strong { color:#eef5ff; }
body[data-theme="dark"] .matrix-workflow-step small { color:#8da3c1; }
body[data-theme="dark"] .matrix-step-number { background:#162a4a; color:#8cb5ff; border-color:#27466e; }
body[data-theme="dark"] .matrix-save-state.is-saved { color:#65d894; background:#10291d; border-color:#1b4930; }
body[data-theme="dark"] .matrix-save-state.is-dirty { color:#f2b957; background:#30230d; border-color:#5a4219; }
body[data-theme="dark"] .matrix-secondary-action { background:#111c30; color:#a9bbd2; border-color:#24344f; }
body[data-theme="dark"] .matrix-secondary-action:hover { background:#172640; color:#8fb9ff; }
body[data-theme="dark"] .matrix-mini-count { background:#152741; color:#8eb5ef; border-color:#29476d; }
body[data-theme="dark"] .matrix-quick-add { background:#152946; border-color:#274b77; color:#8cbbff; }
body[data-theme="dark"] .category-row.is-source-active { background:#142944 !important; border-color:#28517f !important; box-shadow: inset 3px 0 0 #5b95f5; }

/* v1.6.3 page-wide polish */
.glass-panel { border-radius: 22px !important; }
.matrix-page-actions { display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap; }
.matrix-stat-card { background:#fff; border:1px solid #e5ebf4; border-radius:22px; box-shadow:0 16px 34px -26px rgba(40,68,122,.22); }
.matrix-maintenance-card { border:1px solid #e3ebf5; background:#fbfdff; border-radius:18px; padding:14px; }
.matrix-maintenance-card > div { display:flex; align-items:center; justify-content:space-between; gap:10px; color:#173250; font-size:12px; }
.matrix-maintenance-card > div span { color:#4b77b9; background:#edf4ff; border:1px solid #dceaff; border-radius:999px; padding:3px 8px; font-size:10px; font-weight:800; }
.matrix-maintenance-card p { color:#7890ad; font-size:11px; line-height:1.55; margin:7px 0 10px; }
.matrix-maintenance-card button { width:100%; border:1px solid #dbe6f4; background:#fff; color:#315b8f; border-radius:12px; padding:9px 10px; font-size:11px; font-weight:800; transition:.2s ease; }
.matrix-maintenance-card button:hover { background:#eef5ff; border-color:#bdd4f3; }
body[data-theme="dark"] .matrix-maintenance-card { background:#0f1b30; border-color:#20314c; }
body[data-theme="dark"] .matrix-maintenance-card > div { color:#e4efff; }
body[data-theme="dark"] .matrix-maintenance-card > div span { background:#172b49; border-color:#254365; color:#8fbaff; }
body[data-theme="dark"] .matrix-maintenance-card p { color:#8299ba; }
body[data-theme="dark"] .matrix-maintenance-card button { background:#121f35; border-color:#243753; color:#9fc1f4; }
body[data-theme="dark"] .bg-slate-50, body[data-theme="dark"] .bg-white { background:#0f1a2d !important; }
body[data-theme="dark"] .border-slate-200, body[data-theme="dark"] .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color:#21314b !important; }
body[data-theme="dark"] .text-slate-800, body[data-theme="dark"] .text-slate-700, body[data-theme="dark"] .text-slate-600, body[data-theme="dark"] .text-slate-500 { color:#9eb3cf !important; }
body[data-theme="dark"] .bg-blue-50 { background:#10294d !important; }
body[data-theme="dark"] .bg-green-50 { background:#0f2b23 !important; }
body[data-theme="dark"] .bg-red-50 { background:#331b25 !important; }
body[data-theme="dark"] .bg-green-100 { background:#143829 !important; }
body[data-theme="dark"] .text-green-700 { color:#62d89a !important; }
body[data-theme="dark"] .text-red-600 { color:#ff8796 !important; }
@media (max-width: 900px) {
    .matrix-sidebar { width: 220px; }
    .matrix-page-topbar { flex-direction:column; }
    .matrix-page-actions { width:100%; justify-content:space-between; }
}

/* Matrix Dialog System v1.6.4 */
#matrixDialogRoot { position:relative; z-index:99999; }
.matrix-dialog-overlay {
    position:fixed; inset:0; z-index:99999; display:flex; align-items:center; justify-content:center; padding:24px;
    background:rgba(25,46,78,.26); backdrop-filter:blur(6px); opacity:0; transition:opacity .14s ease;
}
.matrix-dialog-overlay.matrix-dialog-visible { opacity:1; }
.matrix-dialog-card {
    width:min(520px, calc(100vw - 32px)); max-height:calc(100vh - 48px); overflow:auto; background:#fff;
    border:1px solid #e3ebf5; border-radius:24px; box-shadow:0 32px 80px -28px rgba(31,59,105,.48);
    padding:24px; transform:translateY(8px) scale(.985); transition:transform .16s ease;
}
.matrix-dialog-visible .matrix-dialog-card { transform:translateY(0) scale(1); }
.matrix-dialog-top { display:grid; grid-template-columns:auto 1fr auto; gap:14px; align-items:start; }
.matrix-dialog-icon {
    width:44px; height:44px; display:flex; align-items:center; justify-content:center; border-radius:15px; font-size:22px; font-weight:900;
    background:#edf4ff; color:#2b71f5; border:1px solid #d8e7ff;
}
.matrix-dialog-tone-success .matrix-dialog-icon { background:#ebfbf2; color:#149954; border-color:#ccefdc; }
.matrix-dialog-tone-warning .matrix-dialog-icon { background:#fff7e7; color:#d78508; border-color:#f8dfaf; }
.matrix-dialog-tone-danger .matrix-dialog-icon { background:#fff0f1; color:#e24956; border-color:#f6d0d5; }
.matrix-dialog-eyebrow { color:#8da0b8; text-transform:uppercase; letter-spacing:.12em; font-size:9px; font-weight:900; margin:2px 0 4px; }
.matrix-dialog-title { color:#153154; font-size:19px; line-height:1.25; font-weight:850; margin:0; }
.matrix-dialog-close {
    width:34px; height:34px; border-radius:11px; display:flex; align-items:center; justify-content:center; border:0; background:#f4f7fb;
    color:#71869f; font-size:22px; cursor:pointer; transition:.18s ease;
}
.matrix-dialog-close:hover { background:#e9eff7; color:#294c75; }
.matrix-dialog-body { color:#657c98; font-size:13px; line-height:1.65; white-space:pre-line; margin-top:18px; }
.matrix-dialog-field { display:flex; flex-direction:column; gap:7px; margin-top:18px; }
.matrix-dialog-field-label { color:#4d6787; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
.matrix-dialog-input {
    width:100%; background:#f9fbfe; color:#183153; border:1px solid #dce6f2; border-radius:14px; padding:12px 14px;
    outline:none; font:inherit; font-size:13px; line-height:1.5; resize:vertical; transition:.18s ease;
}
.matrix-dialog-input:focus { border-color:#8db8ff; box-shadow:0 0 0 4px rgba(64,132,255,.12); background:#fff; }
.matrix-dialog-helper { color:#91a2b8; font-size:11px; line-height:1.45; }
.matrix-dialog-note { margin-top:16px; padding:11px 13px; border-radius:13px; background:#f7fafe; border:1px solid #e8eef6; color:#71869f; font-size:11px; line-height:1.5; }
.matrix-dialog-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; margin-top:24px; }
.matrix-dialog-btn { min-height:42px; border-radius:13px; padding:0 17px; font-size:12px; font-weight:850; cursor:pointer; border:1px solid transparent; transition:.18s ease; }
.matrix-dialog-btn:focus { outline:none; box-shadow:0 0 0 4px rgba(66,126,234,.13); }
.matrix-dialog-btn-secondary { background:#f5f8fc; border-color:#e1e9f3; color:#58718f; }
.matrix-dialog-btn-secondary:hover { background:#edf3fa; color:#294a70; }
.matrix-dialog-btn-primary { background:#2f73f6; color:#fff; box-shadow:0 12px 22px -14px rgba(47,115,246,.8); }
.matrix-dialog-btn-primary:hover { filter:brightness(1.04); transform:translateY(-1px); }
.matrix-dialog-btn-success { background:#18a55e; }
.matrix-dialog-btn-warning { background:#e39a22; }
.matrix-dialog-btn-danger { background:#e44754; box-shadow:0 12px 22px -14px rgba(228,71,84,.72); }

.matrix-toast-root { position:fixed; z-index:100000; right:24px; top:24px; display:flex; flex-direction:column; gap:10px; pointer-events:none; }
.matrix-toast {
    min-width:300px; max-width:420px; display:flex; align-items:flex-start; gap:12px; padding:14px 16px; border-radius:17px; background:#fff;
    border:1px solid #e2eaf4; box-shadow:0 24px 50px -28px rgba(31,59,105,.58); opacity:0; transform:translateY(-8px); transition:.16s ease;
}
.matrix-toast.is-visible { opacity:1; transform:translateY(0); }
.matrix-toast-icon { width:30px; height:30px; flex:0 0 30px; display:flex; align-items:center; justify-content:center; border-radius:10px; background:#edf4ff; color:#2e74f6; font-weight:900; }
.matrix-toast-success .matrix-toast-icon { background:#ebfbf2; color:#159a55; }
.matrix-toast-warning .matrix-toast-icon { background:#fff7e7; color:#d8870a; }
.matrix-toast-danger .matrix-toast-icon { background:#fff0f1; color:#e24956; }
.matrix-toast-title { color:#183153; font-size:12px; font-weight:850; }
.matrix-toast-message { color:#7589a1; font-size:11px; margin-top:2px; line-height:1.45; }

body[data-theme="dark"] .matrix-dialog-overlay { background:rgba(1,6,15,.64); }
body[data-theme="dark"] .matrix-dialog-card,
body[data-theme="dark"] .matrix-toast { background:#111c30; border-color:#22324d; box-shadow:0 32px 80px -28px rgba(0,0,0,.85); }
body[data-theme="dark"] .matrix-dialog-title,
body[data-theme="dark"] .matrix-toast-title { color:#eef5ff; }
body[data-theme="dark"] .matrix-dialog-body,
body[data-theme="dark"] .matrix-dialog-helper,
body[data-theme="dark"] .matrix-dialog-note,
body[data-theme="dark"] .matrix-toast-message { color:#91a7c4; }
body[data-theme="dark"] .matrix-dialog-close,
body[data-theme="dark"] .matrix-dialog-btn-secondary,
body[data-theme="dark"] .matrix-dialog-note { background:#17243a; border-color:#243653; color:#a9bcd4; }
body[data-theme="dark"] .matrix-dialog-input { background:#0c1526; border-color:#263957; color:#eef5ff; }
body[data-theme="dark"] .matrix-dialog-input:focus { background:#0f1b30; }
body[data-theme="dark"] .matrix-dialog-eyebrow,
body[data-theme="dark"] .matrix-dialog-field-label { color:#7e95b3; }

@media (max-width: 640px) {
    .matrix-dialog-overlay { padding:14px; align-items:flex-end; }
    .matrix-dialog-card { width:100%; border-radius:22px 22px 14px 14px; padding:20px; }
    .matrix-dialog-actions { flex-direction:column-reverse; }
    .matrix-dialog-btn { width:100%; }
    .matrix-toast-root { left:14px; right:14px; top:14px; }
    .matrix-toast { min-width:0; width:100%; }
}
