:root {
    --mg-primary: #6366f1;
    --mg-primary-dark: #4f46e5;
    --mg-primary-soft: #eef2ff;
    --mg-sidebar-bg: #141a2e;
    --mg-sidebar-muted: #8b93a7;
    --mg-bg: #f4f6fb;
    --mg-card-border: #e6e9f2;
    --mg-text: #1e2434;
    --mg-muted: #6b7280;
    --mg-success: #10b981;
    --mg-warning: #f59e0b;
    --mg-danger: #ef4444;
    --mg-info: #06b6d4;
    --mg-radius: 14px;
    --mg-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
    --mg-shadow-lg: 0 10px 40px rgba(16, 24, 40, .10);
}

* { scrollbar-width: thin; scrollbar-color: #c9d2e3 transparent; }

body {
    background-color: var(--mg-bg);
    color: var(--mg-text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: .925rem;
}

::selection { background: rgba(99, 102, 241, .22); }

:focus-visible { outline: 2px solid var(--mg-primary); outline-offset: 2px; }

/* ---------- App shell ---------- */
.mg-shell { display: flex; min-height: 100vh; }

.mg-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #141a2e 0%, #1c2340 100%);
    color: var(--mg-sidebar-muted);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 200;
}

.mg-brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.15rem 1.25rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.02em;
    text-decoration: none;
}

.mg-brand:hover { color: #fff; }

.mg-brand .logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--mg-primary), #a855f7);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, .4);
}

.mg-nav {
    padding: .5rem .8rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.mg-nav-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #56607a;
    padding: 1rem .6rem .35rem;
}

.mg-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--mg-sidebar-muted);
    text-decoration: none;
    padding: .55rem .8rem;
    border-radius: 10px;
    font-size: .9rem;
    transition: background .15s, color .15s, transform .1s;
}

.mg-nav a i { font-size: 1.05rem; width: 20px; text-align: center; }

.mg-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }

.mg-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--mg-primary), #7c3aed);
    box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}

.mg-nav a.mg-nav-playground {
    background: linear-gradient(135deg, rgba(168, 85, 247, .18), rgba(99, 102, 241, .10));
    border: 1px solid rgba(168, 85, 247, .25);
    color: #c4b5fd;
    margin: 2px 0;
}
.mg-nav a.mg-nav-playground:hover { color: #fff; border-color: rgba(168, 85, 247, .5); }
.mg-nav a.mg-nav-playground.active {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(168, 85, 247, .4);
}

.mg-sidebar-footer {
    padding: 1rem 1.25rem;
    font-size: .75rem;
    color: #56607a;
    border-top: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.mg-status { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--mg-sidebar-muted); }
.mg-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); flex-shrink: 0; }
.mg-status-dot.ok { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.mg-status.is-down .mg-status-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.mg-version { color: #4b5568; }

.mg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mg-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.75rem;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--mg-card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mg-topbar .page-title { font-size: 1.05rem; font-weight: 650; margin: 0; }

.mg-topbar .user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #fff;
    border: 1px solid var(--mg-card-border);
    border-radius: 999px;
    padding: .3rem .6rem .3rem .35rem;
    box-shadow: var(--mg-shadow);
}

.mg-topbar .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mg-primary), #a855f7);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .72rem;
    font-weight: 700;
}

.mg-menu-toggle { border-radius: 10px; }
.mg-scrim { display: none; }

.mg-content { padding: 1.6rem 1.75rem 3rem; }

/* ---------- Cards ---------- */
.card {
    border: 1px solid var(--mg-card-border);
    border-radius: var(--mg-radius);
    box-shadow: var(--mg-shadow);
    transition: box-shadow .18s ease, transform .18s ease;
}

.card:hover { box-shadow: var(--mg-shadow-lg); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--mg-card-border);
    font-weight: 650;
    padding: .9rem 1.15rem;
}

.card-body { padding: 1.15rem; }

/* ---------- Stat cards ---------- */
.mg-stat {
    position: relative;
    overflow: hidden;
    border-radius: var(--mg-radius);
    border: 1px solid var(--mg-card-border);
    background: #fff;
    box-shadow: var(--mg-shadow);
    padding: 1.1rem 1.15rem;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
}
.mg-stat:hover { transform: translateY(-2px); box-shadow: var(--mg-shadow-lg); }

.mg-stat .ico {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    margin-bottom: .8rem;
}

.mg-stat .val { font-size: 1.55rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }

.mg-stat .lbl { color: var(--mg-muted); font-size: .78rem; margin-top: .2rem; }

.mg-stat.primary .ico { background: var(--mg-primary-soft); color: var(--mg-primary); }
.mg-stat.success .ico { background: #d1fae5; color: var(--mg-success); }
.mg-stat.warning .ico { background: #fef3c7; color: var(--mg-warning); }
.mg-stat.danger .ico { background: #fee2e2; color: var(--mg-danger); }
.mg-stat.info .ico { background: #cffafe; color: var(--mg-info); }
.mg-stat.dark .ico { background: #e5e7eb; color: #374151; }

/* ---------- Banner ---------- */
.mg-banner { background: linear-gradient(120deg, #eef2ff 0%, #f5f3ff 100%); border: 1px solid #e0e7ff; }
.mg-banner-icon {
    width: 52px; height: 52px; flex-shrink: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mg-primary), #a855f7);
    color: #fff;
    display: grid; place-items: center;
    font-size: 1.4rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, .35);
}

/* ---------- Buttons ---------- */
.btn-primary {
    background: linear-gradient(135deg, var(--mg-primary), var(--mg-primary-dark));
    border: 0;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .3);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--mg-primary-dark), var(--mg-primary-dark)); box-shadow: 0 8px 20px rgba(99, 102, 241, .4); }
.btn-primary:disabled { box-shadow: none; }

.btn-outline-primary { color: var(--mg-primary-dark); border-color: #c7d2fe; }
.btn-outline-primary:hover { background: var(--mg-primary); border-color: var(--mg-primary); }

.btn { transition: box-shadow .15s ease, transform .1s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }

/* ---------- Tables ---------- */
.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--mg-muted);
    border-bottom-width: 1px;
    white-space: nowrap;
}

.table td { vertical-align: middle; }

.table-hover tbody tr:hover { background: #f8faff; }

.table > :not(caption) > * > * { padding-top: .7rem; padding-bottom: .7rem; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; letter-spacing: .01em; text-transform: capitalize; }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: 10px;
    border-color: #d7dce8;
}

.form-control:focus, .form-select:focus {
    border-color: var(--mg-primary);
    box-shadow: 0 0 0 .2rem rgba(99, 102, 241, .12);
}

.form-label { font-weight: 600; font-size: .85rem; }

/* ---------- Code blocks ---------- */
pre { white-space: pre-wrap; word-break: break-word; }
code { font-size: .85em; }

/* ---------- Auth pages ---------- */
.mg-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(99, 102, 241, .25), transparent 60%),
        radial-gradient(800px 500px at 110% 110%, rgba(168, 85, 247, .2), transparent 60%),
        #f4f6fb;
}

.mg-auth .card { border-radius: 18px; overflow: hidden; }

.mg-auth-brand {
    background: linear-gradient(135deg, #141a2e 0%, #1c2340 100%);
    color: #fff;
    padding: 1.4rem;
    text-align: center;
}

.mg-auth-brand .logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--mg-primary), #a855f7);
    display: inline-grid;
    place-items: center;
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: .6rem;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .4);
}

/* ---------- Charts ---------- */
canvas { max-width: 100%; }

/* ---------- Misc ---------- */
.mg-empty { color: var(--mg-muted); }

.font-monospace { font-variant-ligatures: none; }

a { text-decoration: none; }

.alert { border-radius: 12px; }

/* ---------- Store cards ---------- */
.store-card { overflow: hidden; }
.store-card:hover { transform: translateY(-3px); }

.store-avatar {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--mg-primary-soft);
    color: var(--mg-primary-dark);
    display: grid; place-items: center;
    font-weight: 800; font-size: 1.05rem;
}

/* ---------- Playground ---------- */
.pg-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
    border-radius: var(--mg-radius);
    border: 1px solid #e0e7ff;
    background: linear-gradient(120deg, #eef2ff, #f5f3ff 60%, #ede9fe);
    box-shadow: var(--mg-shadow);
}

.pg-hero-icon {
    width: 58px; height: 58px; flex-shrink: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--mg-primary), #a855f7);
    color: #fff;
    display: grid; place-items: center;
    font-size: 1.6rem;
    box-shadow: 0 10px 24px rgba(99, 102, 241, .4);
}

.pg-step { border-top: 3px solid var(--mg-primary); }
.pg-step-num {
    width: 26px; height: 26px; flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mg-primary), #7c3aed);
    color: #fff;
    display: inline-grid; place-items: center;
    font-size: .78rem; font-weight: 800;
}

.pg-divider { display: flex; align-items: center; gap: .75rem; color: var(--mg-muted); font-size: .8rem; margin: 1.1rem 0; }
.pg-divider::before, .pg-divider::after { content: ''; flex: 1; height: 1px; background: var(--mg-card-border); }

.pg-keys .alert { animation: mg-fade-in .25s ease; }

.pg-key-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: .5rem .7rem;
    flex-wrap: wrap;
}

.pg-key-row .btn { margin-left: auto; }

.pg-key-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    flex-shrink: 0;
    width: 74px;
}

.pg-key {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .78rem;
    color: #e2e8f0;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}

.pg-inline { background: #f1f5f9; border: 1px solid var(--mg-card-border); border-radius: 6px; padding: .15rem .45rem; }

.pg-payload {
    background: #0f172a;
    color: #a5f3fc;
    border-radius: 10px;
    padding: .9rem 1rem;
    font-size: .76rem;
    max-height: 320px;
    overflow: auto;
}

.pg-console-card { position: sticky; top: 90px; }

.pg-console {
    background: #0f172a;
    height: 620px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding: .8rem;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .76rem;
}

.pg-empty { color: #475569; padding: 1rem; text-align: center; }

.pg-log { border-left: 3px solid #334155; background: rgba(255, 255, 255, .03); border-radius: 6px; padding: .5rem .6rem; margin-bottom: .55rem; animation: mg-fade-in .2s ease; }
.pg-log--ok { border-left-color: var(--mg-success); }
.pg-log--err { border-left-color: var(--mg-danger); }
.pg-log--info { border-left-color: var(--mg-primary); }
.pg-log--http { border-left-color: var(--mg-info); }

.pg-log-head { display: flex; align-items: center; gap: .4rem; color: #e2e8f0; font-weight: 600; }
.pg-log-head i { font-size: .85rem; }

.pg-log-body {
    margin: .4rem 0 0 1.2rem;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
    font-size: .72rem;
}

.pg-step .nav-tabs .nav-link { font-size: .85rem; color: var(--mg-muted); }
.pg-step .nav-tabs .nav-link.active { color: var(--mg-primary-dark); font-weight: 600; }

.pg-delivery .alert { margin-bottom: .75rem; }

/* status badge helper classes (playground select badge) */
.pending-badge { background: rgba(245, 158, 11, .15); color: #b45309; }
.active-badge { background: rgba(16, 185, 129, .15); color: #047857; }
.rejected-badge { background: rgba(239, 68, 68, .15); color: #b91c1c; }
.suspended-badge { background: rgba(107, 114, 128, .15); color: #4b5563; }

@keyframes mg-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .mg-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--mg-shadow-lg);
    }
    .mg-sidebar.is-open { transform: translateX(0); }
    .mg-scrim.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, .5);
        z-index: 150;
    }
    .mg-content { padding: 1.2rem 1rem 2.5rem; }
    .mg-topbar { padding: .7rem 1rem; }
    .pg-console-card { position: static; }
}

/* ---------- Theme toggle ---------- */
.theme-toggle { border-radius: 999px; line-height: 1; }
.theme-toggle .bi-sun-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: inline-block; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
.theme-toggle-float { position: absolute; top: .75rem; right: .75rem; z-index: 5; }

/* ---------- Brand slots ---------- */
.mg-brand .logo svg,
.mg-auth-brand .logo svg,
.mg-brand-logo svg { display: block; width: 100%; height: 100%; }

/* ---------- Dark theme ---------- */
[data-bs-theme="dark"] {
    --mg-bg: #0e1424;
    --mg-card-border: #232b40;
    --mg-text: #e6eaf4;
    --mg-muted: #94a0b8;
    --mg-primary-soft: #1c2240;
    --mg-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .35);
    --mg-shadow-lg: 0 10px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

[data-bs-theme="dark"] .mg-topbar { background: rgba(14, 20, 36, .85); }
[data-bs-theme="dark"] .mg-topbar .user-chip { background: #141b2e; border-color: var(--mg-card-border); }
[data-bs-theme="dark"] .mg-stat { background: #141b2e; }
[data-bs-theme="dark"] .mg-banner { background: linear-gradient(120deg, #1b2340 0%, #221f3d 100%); border-color: #2b3150; }
[data-bs-theme="dark"] .pg-hero { background: linear-gradient(120deg, #1b2340, #1e1b38 60%, #232042); border-color: #2b3150; }
[data-bs-theme="dark"] .pg-inline { background: #1a2236; }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #141b2e; border-color: #2a3348; color: var(--mg-text); }
[data-bs-theme="dark"] .form-control::placeholder { color: #6b7a90; }
[data-bs-theme="dark"] .dropdown-menu { background-color: #141b2e; border-color: var(--mg-card-border); }
[data-bs-theme="dark"] .dropdown-item { color: var(--mg-text); }
[data-bs-theme="dark"] .dropdown-item:hover, [data-bs-theme="dark"] .dropdown-item:focus { background-color: #1c2340; color: #fff; }
[data-bs-theme="dark"] .table-hover tbody tr:hover { background: #171f35; }
[data-bs-theme="dark"] .mg-auth-brand { background: linear-gradient(135deg, #0a0f1e 0%, #141b2e 100%); }
[data-bs-theme="dark"] .mg-auth {
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(800px 500px at 110% 110%, rgba(168, 85, 247, .15), transparent 60%),
        #0e1424;
}
[data-bs-theme="dark"] .mg-public-nav.navbar { background-color: var(--mg-bg) !important; }
[data-bs-theme="dark"] .text-bg-primary-soft { background: var(--mg-primary-soft); color: #a5b4fc; }
[data-bs-theme="dark"] .card-header, [data-bs-theme="dark"] .alert { border-color: var(--mg-card-border); }

/* Hard-coded light surfaces that Bootstrap would otherwise keep light in dark mode. */
[data-bs-theme="dark"] .bg-white { background-color: var(--mg-bg) !important; }
[data-bs-theme="dark"] .bg-light { background-color: #161d31 !important; }
[data-bs-theme="dark"] .bg-light-subtle { background-color: #151b2d !important; }
[data-bs-theme="dark"] .text-dark { color: var(--mg-text) !important; }
[data-bs-theme="dark"] .text-bg-light { background-color: #242c44 !important; color: #e6eaf4 !important; }

/* alert-light uses --bs-light in every theme, so text ends up light-on-light in dark mode. */
[data-bs-theme="dark"] .alert-light {
    background-color: #141b2e;
    border-color: var(--mg-card-border);
    color: var(--mg-text);
}
[data-bs-theme="dark"] .alert-light .alert-link { color: #a5b4fc; }

/* Bootstrap's default .alert uses CSS vars and adapts; ensure emphasis text stays readable. */
[data-bs-theme="dark"] .alert strong { color: var(--mg-text); }

/* Tables: bootstrap dark switches header/body colours; keep striped rows subtle. */
[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255, 255, 255, .025); }

/* Accordion (FAQ / settings groups) sits on cards; make it match the dark surface. */
[data-bs-theme="dark"] .accordion-button {
    background-color: transparent;
    color: var(--mg-text);
}
[data-bs-theme="dark"] .accordion-button:not(.collapsed) { background-color: var(--mg-primary-soft); color: #c7d2fe; }
[data-bs-theme="dark"] .accordion-button::after { filter: invert(80%) hue-rotate(180deg); }

/* Pre / code blocks (webhook JSON, docs samples). */
[data-bs-theme="dark"] pre { color: var(--mg-text); }

/* Navbar collapse menu in dark mode. */
[data-bs-theme="dark"] .navbar-nav .nav-link { color: var(--mg-text); }
[data-bs-theme="dark"] .navbar-nav .nav-link:hover { color: #a5b4fc; }
[data-bs-theme="dark"] .navbar-toggler { border-color: var(--mg-card-border); color: var(--mg-text); }
[data-bs-theme="dark"] .navbar-toggler-icon { filter: invert(70%); }

/* ---------- Public marketing (landing + info pages) ---------- */
.mg-public-nav.navbar { transition: box-shadow .2s ease, background-color .2s ease; backdrop-filter: blur(8px); }
.mg-public-nav.navbar.mg-nav-scrolled { box-shadow: 0 1px 0 rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06); }
.mg-public-nav .navbar-toggler:focus { box-shadow: none; }

.mg-brand-logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--mg-primary), #a855f7); color: #fff; font-size: .9rem; }

.mg-gradient-text {
    background: linear-gradient(120deg, var(--mg-primary), #a855f7 60%, #ec4899);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.mg-land-hero { position: relative; overflow: hidden; background: linear-gradient(180deg, var(--mg-primary-soft) 0%, #fff 100%); }
[data-bs-theme="dark"] .mg-land-hero { background: linear-gradient(180deg, #101731 0%, var(--mg-bg) 100%); }

/* Aurora blobs */
.mg-land-aurora { position: absolute; inset: 0; pointer-events: none; }
.mg-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.mg-blob-a { width: 420px; height: 420px; top: -140px; left: -120px; background: radial-gradient(circle, rgba(99,102,241,.45), transparent 70%); animation: mg-drift-a 18s ease-in-out infinite alternate; }
.mg-blob-b { width: 380px; height: 380px; top: 40px; right: -140px; background: radial-gradient(circle, rgba(168,85,247,.4), transparent 70%); animation: mg-drift-b 22s ease-in-out infinite alternate; }
.mg-blob-c { width: 300px; height: 300px; bottom: -120px; left: 35%; background: radial-gradient(circle, rgba(236,72,153,.28), transparent 70%); animation: mg-drift-c 26s ease-in-out infinite alternate; }

@keyframes mg-drift-a { to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes mg-drift-b { to { transform: translate(-70px, 30px) scale(1.1); } }
@keyframes mg-drift-c { to { transform: translate(30px, -50px) scale(1.2); } }

/* Floating crypto chips */
.mg-land-chips { position: absolute; inset: 0; pointer-events: none; }
.mg-land-chips .chip {
    position: absolute; display: grid; place-items: center;
    width: 52px; height: 52px; border-radius: 16px;
    background: rgba(255,255,255,.75); border: 1px solid rgba(16,24,40,.08);
    box-shadow: 0 12px 32px rgba(16,24,40,.12);
    font-size: 1.25rem; font-weight: 800; color: var(--mg-primary-dark);
    backdrop-filter: blur(6px);
    animation: mg-float 6s ease-in-out infinite;
}
[data-bs-theme="dark"] .mg-land-chips .chip { background: rgba(28,34,64,.85); border-color: rgba(255,255,255,.08); color: #a5b4fc; }
.chip-1 { top: 12%; left: 6%; animation-delay: 0s; }
.chip-2 { top: 22%; right: 8%; animation-delay: 1.2s; }
.chip-3 { top: 62%; left: 3%; animation-delay: 2.1s; }
.chip-4 { top: 72%; right: 4%; animation-delay: .6s; }
.chip-5 { bottom: 8%; left: 16%; animation-delay: 1.7s; }
.chip-6 { top: 46%; right: 22%; animation-delay: 2.6s; }
@keyframes mg-float { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-16px) rotate(4deg); } }

.mg-pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #10b981; vertical-align: middle; animation: mg-pulse 1.6s ease-in-out infinite; }
@keyframes mg-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); } 55% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } }

.mg-hero-title { letter-spacing: -.03em; }
.mg-hero-sub { max-width: 540px; }
@media (min-width: 992px) { .mg-hero-title { font-size: 3.1rem; } }

.mg-land-pricecard { border-radius: 18px; overflow: hidden; }
[data-bs-theme="dark"] .mg-land-pricecard { background: #141b2e; }
[data-bs-theme="dark"] .mg-land-pricecard .card-header, [data-bs-theme="dark"] .mg-land-pricecard .card-footer { background: #141b2e !important; }
[data-bs-theme="dark"] .mg-land-pricecard .table-hover tbody tr:hover { background: #1a2236; }

/* Marquee ticker */
.mg-ticker { margin-top: 8px; overflow: hidden; border-top: 1px solid rgba(16,24,40,.06); border-bottom: 1px solid rgba(16,24,40,.06); padding: .55rem 0; background: rgba(255,255,255,.5); }
[data-bs-theme="dark"] .mg-ticker { border-color: rgba(255,255,255,.06); background: rgba(14,20,36,.5); }
.mg-ticker-track { display: flex; width: max-content; animation: mg-marquee 28s linear infinite; }
.mg-ticker:hover .mg-ticker-track { animation-play-state: paused; }
.mg-ticker-group { display: flex; align-items: center; }
.mg-ticker-item { display: inline-flex; align-items: center; gap: .4rem; padding: 0 1.6rem; color: var(--mg-muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.mg-ticker-item i { color: var(--mg-primary); }
@keyframes mg-marquee { to { transform: translateX(-50%); } }

/* Stats */
.mg-stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; background: linear-gradient(120deg, var(--mg-primary), #a855f7); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Feature / hover cards */
.mg-feature-ico { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; }
.mg-feature-ico.primary { background: var(--mg-primary); }
.mg-feature-ico.success { background: #10b981; }
.mg-feature-ico.warning { background: #f59e0b; }
.mg-feature-ico.danger { background: #ef4444; }
.mg-feature-ico.info { background: #06b6d4; }
.mg-feature-ico.purple { background: #a855f7; }
.mg-hover-card { transition: transform .18s ease, box-shadow .18s ease; }
.mg-hover-card:hover { transform: translateY(-4px); box-shadow: var(--mg-shadow-lg) !important; }

/* Steps */
.mg-step { position: relative; padding: 1.25rem; border-radius: 14px; background: #fff; border: 1px solid var(--mg-card-border); height: 100%; }
[data-bs-theme="dark"] .mg-step { background: #141b2e; border-color: #232b40; }
.mg-step-num { font-size: .8rem; font-weight: 800; letter-spacing: .08em; color: var(--mg-primary); }
.mg-step::before { content: ''; position: absolute; left: 1.25rem; right: 1.25rem; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--mg-primary), #a855f7); opacity: 0; transition: opacity .2s ease; }
.mg-step:hover::before { opacity: 1; }

/* Currency cards */
.mg-coin-card { transition: transform .18s ease, box-shadow .18s ease; background: #fff; }
[data-bs-theme="dark"] .mg-coin-card { background: #141b2e; }
.mg-coin-card:hover { transform: translateY(-3px); box-shadow: var(--mg-shadow); }

/* CTA band */
.mg-land-cta { background: linear-gradient(135deg, var(--mg-primary-dark) 0%, #7c3aed 55%, #be185d 120%); position: relative; overflow: hidden; }
.mg-land-cta::before { content: ''; position: absolute; inset: 0; background: radial-gradient(600px 260px at 20% 0%, rgba(255,255,255,.16), transparent 60%); pointer-events: none; }

/* Scroll reveal */
.mg-reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s cubic-bezier(.16,1,.3,1); will-change: opacity, transform; }
.mg-reveal-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .mg-reveal { opacity: 1; transform: none; }
    .mg-land-aurora, .mg-land-chips, .mg-ticker-track, .mg-pulse-dot { animation: none !important; }
    .mg-blob, .mg-land-chips .chip { display: none; }
}

/* Info pages (faq/help/about/contact/legal) */
.mg-page-hero { background: linear-gradient(135deg, var(--mg-primary-dark), #7c3aed); color: #fff; }
.mg-page-hero h1 { letter-spacing: -.02em; }
.mg-breadcrumb { font-size: .8rem; }
.mg-faq-item { border: 1px solid var(--mg-card-border); border-radius: 12px; background: #fff; overflow: hidden; }
[data-bs-theme="dark"] .mg-faq-item { background: #141b2e; }
.mg-legal-body { max-width: 780px; }
.mg-contact-card { height: 100%; border: 1px solid var(--mg-card-border); border-radius: 14px; }

/* Event timeline (invoice detail) */
.mg-timeline { list-style: none; padding: 0; margin: 0; }
.mg-timeline li { position: relative; padding: 0 0 1.1rem 2rem; border-left: 2px solid var(--mg-card-border); margin-left: .5rem; }
.mg-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.mg-timeline li > i { position: absolute; left: -.62rem; top: 0; background: var(--mg-card-bg, #fff); padding: 0 .25rem; font-size: 1rem; line-height: 1.2; }
[data-bs-theme="dark"] .mg-timeline li > i { background: #141b2e; }


/* In-product feedback widget (M25 T6) */
.mg-feedback-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--mg-primary-dark) 0%, #7c3aed 55%, #be185d 120%);
    box-shadow: 0 8px 24px rgba(79, 70, 229, .35);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mg-feedback-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(79, 70, 229, .45); }
.mg-feedback-card {
    position: fixed;
    right: 1.25rem;
    bottom: 5rem;
    z-index: 1040;
    width: min(340px, calc(100vw - 2.5rem));
    background: var(--mg-card-bg, #fff);
    border: 1px solid var(--mg-card-border);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 12px 40px rgba(15, 23, 42, .18);
}
[data-bs-theme="dark"] .mg-feedback-card { background: #141b2e; }
.mg-feedback-title { font-weight: 700; }
.mg-feedback-sub { font-size: .8rem; color: var(--mg-muted); margin: 0 0 .6rem; }
.mg-feedback-scores { display: grid; grid-template-columns: repeat(11, 1fr); gap: .25rem; margin-bottom: .6rem; }
.mg-feedback-score {
    border: 1px solid var(--mg-card-border);
    background: transparent;
    border-radius: 8px;
    font-size: .8rem;
    padding: .3rem 0;
    color: inherit;
}
.mg-feedback-score:hover { border-color: var(--mg-primary); }
.mg-feedback-score.is-selected { background: var(--mg-primary); border-color: var(--mg-primary); color: #fff; }
