:root {
    --bg: #f7f8fb;
    --card: #ffffff;
    --text: #0b1324;
    --muted: #6b7486;
    --accent: #4D843D; /* Divitia Green */
    --secondary: #F5B80B; /* Divitia Gold */
    --ring: #e5e7eb;
    --shadow: 0 10px 24px rgba(2,8,23,.06);
    --glass: rgba(255,255,255,.45);
    --glass-stroke: rgba(255,255,255,.35);
    --blur: 8px;
}

body.theme-milk {
    --bg: #f7f7fb;
    --card: #fff;
    --text: #0b1324;
    --muted: #677087;
    --accent: #21bf63;
    --ring: #e7e9ee;
}

body.theme-dark {
    --bg: #0f1320;
    --card: #0b0f1a;
    --text: #e8ecf5;
    --muted: #93a0b8;
    --accent: #23d365;
    --ring: #1e2636;
    --shadow: 0 10px 32px rgba(0,0,0,.45);
}

body.theme-light {
    --bg: #f8fafc;
    --card: #fff;
    --text: #0b1324;
    --muted: #6b7486;
    --accent: #1fbf5a;
    --ring: #e5e7eb;
}

body.theme-lightblue {
    --bg: #eef6ff;
    --card: #fff;
    --text: #0b1324;
    --muted: #5b6a86;
    --accent: #1c84ff;
    --ring: #dbeafe;
}

body.theme-glass {
    --bg: #e8eef6;
    --card: var(--glass);
    --text: #0b1324;
    --muted: #5b6a86;
    --accent: #22c55e;
    --ring: #cbd5e1;
    backdrop-filter: blur(var(--blur));
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Open Sans',system-ui,-apple-system,Segoe UI,Roboto,Arial,Helvetica,sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration: none
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.admincontainer {
    width: 100%;
    margin: 0;
    padding: 0 20px;
}

/* Top nav (your home page may also use this) */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card);
    border-bottom: 1px solid var(--ring);
    box-shadow: var(--shadow);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 16px
}

.brand {
    font-weight: 800;
    letter-spacing: .2px
}

    .brand b {
        color: var(--accent)
    }

.menu {
    display: flex;
    gap: 20px;
    align-items: center
}

    .menu a {
        padding: 8px 10px;
        border-radius: 8px;
        color: var(--muted);
        font-weight: 600
    }

        .menu a:hover {
            background: var(--ring)
        }

.theme-select {
    appearance: none;
    padding: 8px 10px;
    border: 1px solid var(--ring);
    border-radius: 10px;
    background: var(--card);
    color: var(--text)
}

#dg-landing {
    scroll-behavior: smooth;
}

.dg-section {
    padding: 56px 12px;
}

    .dg-section.alt {
        background: #f8fafc;
    }

.dg-section__inner {
    max-width: 1100px;
    margin: 0 auto;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    align-items: center;
}

@media (max-width:900px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.dg-h2 {
    font-size: clamp(1.4rem,2.2vw,2rem);
    margin-bottom: 8px;
}

.dg-lead {
    color: #475569;
    margin-bottom: 16px;
}

.dg-bullets {
    margin: 0 0 16px 0;
    padding-left: 18px;
}

    .dg-bullets li {
        margin: 6px 0;
    }

.dg-ctas .btn {
    margin-right: 8px;
}

/* Hero */
.hero {
    padding: 56px 0 20px
}

.hero-wrap {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    align-items: center
}

.h-title {
    font-size: 44px;
    line-height: 1.1;
    margin: 0 0 12px
}

.h-sub {
    color: var(--muted);
    max-width: 48ch
}

.stats {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap
}

.pill {
    background: var(--card);
    border: 1px solid var(--ring);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: var(--shadow)
}

    .pill .small {
        font-size: 12px;
        color: var(--muted)
    }

.currency:before {
    content: "\20A6";
}

.cards-slab {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px
}

.pie-wrap {
    background: #fff;
    border: 1px solid var(--ring);
    border-radius: 12px;
    padding: 16px;
    height: 180px;
    width: 100%;
}

.thin-pie-wrap {
    background: #fff;
    border-radius: 4px;
    padding: 6px;
    height: 80px;
}

.legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px
}

.leg {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #0f172a
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%
}

.hero .title {
    font-size: 48px;
    line-height: 1.04;
    margin: 0 0 12px
}

.hero .subtitle {
    color: var(--muted);
    font-size: 18px
}

.hero-bullets {
    display: flex;
    gap: 14px;
    margin-top: 18px
}

.hero-media {
    background: var(--accent);
    border-radius: 0 50px 50px 0;
    border: 1px solid #c7efd8;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    padding: 10px 50px 10px 10px;
    margin-left: -25px;
}

    .hero-media .art {
        display: flex;
        gap: 18px;
        align-items: flex-end;
        transform: translateY(6px);
    }

    .hero-media img {
        height: 220px;
        width: auto;
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(2,8,23,.12)
    }

.hero-dots {
    position: absolute;
    bottom: 10px;
    left: 16px;
    display: flex;
    gap: 8px
}

    .hero-dots i {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #9ae6b4
    }

        .hero-dots i.active {
            background: #16a34a
        }

.carousel {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    background: #e5e7eb;
    min-height: 320px;
    box-shadow: var(--shadow)
}

    .carousel img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 0;
        transition: opacity .5s ease
    }

        .carousel img.active {
            opacity: 1
        }

.dots {
    position: absolute;
    display: flex;
    gap: 8px;
    left: 16px;
    bottom: 14px
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #cbd5e1;
    opacity: .7;
    cursor: pointer
}

    .dot.active {
        background: var(--accent);
        opacity: 1
    }

section.section {
    margin: 28px 0
}

.card {
    background: var(--card);
    border: 1px solid var(--ring);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow)
}

.cardlight {
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow)
}

.cardborderless {
    border-radius: 18px;
    padding: 24px;
    display: inline-block;
}

.cardborderless-small {
    border-radius: 4px;
    padding: 6px;
    display: inline-block;
    position: relative;
}

.title {
    margin: 0 0 10px
}

.muted {
    color: var(--muted)
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 16px
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 16px
}

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 700;
    border: 0;
    cursor: pointer
}

.input {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--ring);
    padding: 0 12px;
    background: var(--card);
    color: var(--text)
}

textarea.input {
    height: auto;
    padding-top: 10px
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: all .6s cubic-bezier(.2,.7,.2,1)
}

    .reveal.show {
        opacity: 1;
        transform: none
    }

.chat-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    height: 52px;
    width: 52px;
    border-radius: 50%;
    border: 0;
    background: var(--accent);
    color: #fff;
    font-size: 20px;
    box-shadow: var(--shadow);
    cursor: pointer
}

.chatbox {
    position: fixed;
    right: 18px;
    bottom: 80px;
    width: 320px;
    background: var(--card);
    border: 1px solid var(--ring);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: none;
    overflow: hidden
}

    .chatbox .head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        border-bottom: 1px solid var(--ring)
    }

    .chatbox .body {
        max-height: 260px;
        overflow: auto;
        padding: 12px
    }

.msg {
    background: var(--ring);
    padding: 8px 10px;
    border-radius: 10px;
    margin: 6px 0;
    display: inline-block
}

.chatbox .foot {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--ring)
}

    .chatbox .foot input {
        flex: 1
    }

.chatbox.open {
    display: block
}

footer {
    background: #0b1220;
    color: #e5edf6;
    margin-top: 48px
}

.foot-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 36px 18px;
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 26px
}

footer h4 {
    margin: 0 0 12px
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px
}

footer a {
    color: #cfe6ff;
    text-decoration: none
}

    footer a:hover {
        text-decoration: underline
    }

.copyright {
    border-top: 1px solid #1e293b;
    padding: 12px 18px;
    text-align: center;
    color: #9fb4cf
}

@media (max-width:980px) {
    .hero-wrap {
        grid-template-columns: 1fr
    }

    .grid-3 {
        grid-template-columns: repeat(2,minmax(0,1fr))
    }

    .grid2, .grid2.reverse, .cards-slab, .content-block, .content-block.alt {
        grid-template-columns: 1fr
    }

    .hero .title {
        font-size: 34px
    }

    .kpis {
        grid-template-columns: 1fr
    }
}

@media (max-width:640px) {
    .menu {
        gap: 10px
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr
    }
    .vg-menu-desktop {
    display: none;
    }
}

/* ===== Divitia form layout (drop-in) ===== */
.dv-form {
    width: 100%;
    margin-top: 8px;
}

.dv-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}

    .dv-field label {
        font-size: 13px;
        font-weight: 700;
        color: #111827;
    }

.dv-req {
    color: #dc2626;
    font-weight: 900;
}

.dv-field input,
.dv-field select,
.dv-field textarea {
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    outline: none;
    box-sizing: border-box;
}

.dv-field textarea {
    min-height: 100px;
    height: auto;
    resize: vertical;
}

    .dv-field input:focus,
    .dv-field select:focus,
    .dv-field textarea:focus {
        border-color: rgba(16,185,129,.60);
        box-shadow: 0 0 0 3px rgba(16,185,129,.18);
    }

.dv-grid {
    display: grid;
    gap: 12px;
}

.dv-grid-2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 720px) {
    .dv-grid-2 {
        grid-template-columns: 1fr;
    }
}

.dv-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
    cursor: pointer;
    user-select: none;
}

    .dv-check input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
    }

.dv-link {
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: #065f46;
}

    .dv-link:hover {
        text-decoration: underline;
    }

.dv-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
}

.dv-actions-split {
    margin-top: 6px;
}

.dv-btn {
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #22c55e;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

    .dv-btn:hover {
        filter: brightness(.98);
    }

    .dv-btn:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

/* ===== Form layout to match wrap/card/hdr/bd structure ===== */
.bd .row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

    .bd .row label {
        font-size: 13px;
        font-weight: 700;
        color: #111827;
    }

.bd .grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 720px) {
    .bd .grid2 {
        grid-template-columns: 1fr;
    }
}

.bd input,
.bd select,
.bd textarea {
    width: 100%;
    height: 44px;
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    background: #fff;
    color: #111827;
    outline: none;
    box-sizing: border-box;
}

.bd textarea {
    height: auto;
    min-height: 90px;
    resize: vertical;
}

    .bd input:focus,
    .bd select:focus,
    .bd textarea:focus {
        border-color: rgba(16,185,129,.60);
        box-shadow: 0 0 0 3px rgba(16,185,129,.18);
    }

.bd .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.bd .link {
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: #065F46;
}

    .bd .link:hover {
        text-decoration: underline;
    }

.bd .btn {
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #22C55E;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

    .bd .btn:disabled {
        opacity: .6;
        cursor: not-allowed;
    }

.bd .row-inline {
    margin-top: 6px;
}

.bd .check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

    .bd .check input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
    }

.bd .req {
    color: #DC2626;
    font-weight: 900;
}

.bd .hint {
    font-size: 12px;
    color: #6B7280;
    margin-top: 2px;
}

/* ---------- Theme tokens (fallbacks) ---------- */
:root {
    --card-bg: #fff;
    --fg: #0b1220;
    --border: #e5e7eb;
    --hover: #f8fafc;
    --muted: #64748b;
    --overlay: rgba(2,8,23,.25);
}

.theme-milk {
    --card-bg: #fff;
    --fg: #0b1220;
    --border: #e5e7eb;
    --hover: #f8fafc;
    --muted: #64748b;
    --overlay: rgba(2,8,23,.25);
}

.theme-dark {
    --card-bg: #0f172a;
    --fg: #e2e8f0;
    --border: #1f2937;
    --hover: #111827;
    --muted: #94a3b8;
    --overlay: rgba(0,0,0,.45);
}

.theme-light {
    --card-bg: #fff;
    --fg: #0b1220;
    --border: #e5e7eb;
    --hover: #f8fafc;
    --muted: #6b7280;
    --overlay: rgba(2,8,23,.25);
}

.theme-lightblue {
    --card-bg: #eef6ff;
    --fg: #0b1220;
    --border: #cfe3ff;
    --hover: #e3f0ff;
    --muted: #4b5563;
    --overlay: rgba(2,8,23,.25);
}

.theme-glass {
    --card-bg: rgba(255,255,255,.08);
    --fg: #e5e7eb;
    --border: rgba(255,255,255,.22);
    --hover: rgba(255,255,255,.12);
    --muted: #cbd5e1;
    --overlay: rgba(0,0,0,.35);
    backdrop-filter: saturate(160%) blur(8px);
}

/* ---------- Top bar ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    color: var(--fg)
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px
}

.brand {
    font-weight: 800;
    text-decoration: none;
    color: var(--fg)
}

.menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px
}

    .menu a {
        color: var(--fg);
        text-decoration: none;
        padding: 8px 10px;
        border-radius: 8px
    }

        .menu a:hover {
            background: var(--hover)
        }

.nav-spacer {
    flex: 1
}

/* Icons & dropdowns */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--fg);
    cursor: pointer
}

.ms {
    font-family: "Material Symbols Outlined";
    font-weight: 400;
    font-style: normal;
    font-size: 20px;
    line-height: 1
}

.dd {
    position: relative
}

.dd-menu {
    position: absolute;
    right: 0;
    top: 44px;
    min-width: 240px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(2,8,23,.12);
    padding: 8px;
    display: none;
    z-index: 60;
    color: var(--fg)
}

.dd.open .dd-menu {
    display: block
}

.dd-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--fg)
}

    .dd-item:hover {
        background: var(--hover)
    }

.dd-meta {
    font-size: 12px;
    color: var(--muted);
    padding: 8px 10px 4px
}

/* ---------- User shell (sidebar + content) ---------- */
.us-shell {
    width: 100%;
    margin: 22px 0;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    padding: 0 16px
}

.us-side {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    color: var(--fg)
}

.us-content {
    min-width: 0
}

.us-toggle {
    display: none
}

.us-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border)
}

.us-side-title {
    font-weight: 800
}

.us-collapse-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--fg);
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer
}

.us-nav {
    padding: 8px
}

.us-group {
    margin-bottom: 10px
}

    .us-group h5 {
        margin: 10px 8px 6px 8px;
        font-size: 12px;
        color: var(--muted);
        text-transform: uppercase
    }

.us-list {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.us-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--fg);
    border: 1px solid transparent
}

    .us-link:hover {
        background: var(--hover);
        border-color: var(--border)
    }

.us-ico .ms {
    font-size: 18px;
    opacity: .85
}

/* Collapsed (desktop) */
.us-collapsed .us-shell {
    grid-template-columns: 56px 1fr
}

.us-collapsed .us-side {
    width: 56px
}

.us-collapsed .us-side-title, .us-collapsed .us-group h5, .us-collapsed .us-link .us-text {
    display: none
}

.us-collapsed .us-link {
    justify-content: center
}

/* Mobile drawer */
@media (max-width:980px) {
    .us-shell {
        grid-template-columns: 1fr
    }

    .us-side {
        position: fixed;
        left: 12px;
        top: 72px;
        bottom: 12px;
        width: 260px;
        max-height: calc(100vh - 84px);
        overflow: auto;
        box-shadow: 0 10px 22px rgba(2,8,23,.12);
        z-index: 40;
        display: none
    }

        .us-side.us-open {
            display: block
        }

    .us-overlay {
        position: fixed;
        inset: 0;
        background: var(--overlay);
        backdrop-filter: blur(1px);
        z-index: 39;
        display: none
    }

        .us-overlay.us-open {
            display: block
        }

    .us-toggle {
        display: inline-flex
    }
}

/* Public container */
.vg-container {
    width: 100%;
    margin: 22px 0;
    padding: 0 16px
}

/* Footer (theme-aware) */
footer {
    margin-top: 40px;
    background: #0b1220;
    color: #cbd5e1
}

.foot-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 16px;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 20px
}

    .foot-wrap h4 {
        color: #fff;
        margin: 0 0 8px 0
    }

    .foot-wrap a {
        color: #cbd5e1;
        text-decoration: none
    }

        .foot-wrap a:hover {
            text-decoration: underline
        }

.copyright {
    border-top: 1px solid #1f2937;
    padding: 12px 16px;
    text-align: center
}

.hidden {
    display: none !important
}

/* ===== User Dashboard (namespaced .ud-*) ===== */
.ud-cards {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 14px;
    margin: 8px 0 16px
}

@media (max-width:1080px) {
    .ud-cards {
        grid-template-columns: repeat(2,minmax(0,1fr))
    }
}

@media (max-width:640px) {
    .ud-cards {
        grid-template-columns: 1fr
    }
}

.ud-row-3col {
    display: grid;
    grid-template-columns: 60% 15% 25%;
    gap: 14px;
    align-items: start
}

@media (max-width:1200px) {
    .ud-row-3col {
        grid-template-columns: 1fr 1fr
    }
}

@media (max-width:860px) {
    .ud-row-3col {
        grid-template-columns: 1fr
    }
}

.ud-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px
}

@media (max-width:900px) {
    .ud-row-2col {
        grid-template-columns: 1fr
    }
}

.ud-card {
    position: relative;
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px
}

    .ud-card h3 {
        margin: 0 0 10px 0;
        font-weight: 700
    }

.ud-more {
    position: absolute;
    right: 12px;
    bottom: 10px;
    font: 600 12px/1 ui-sans-serif;
    opacity: .8
}

.ud-k {
    font-size: 12px;
    color: var(--muted)
}

.ud-v {
    font-size: 24px;
    font-weight: 800
}

.ud-r {
    font-family: ui-monospace, Menlo, monospace
}

.ud-mini {
    font-size: 12px;
    color: var(--muted)
}

.ud-list {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.ud-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px
}

.ud-chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px
}

.ud-badge {
    font: 600 12px/1 ui-sans-serif;
    background: var(--badge,#f1f5f9);
    border-radius: 999px;
    padding: 4px 8px;
    margin-left: 6px
}

.ud-card.ud-compact {
    padding: 10px
}

    .ud-card.ud-compact h3 {
        margin: 0 0 6px 0;
        font-size: 14px;
        font-weight: 700
    }

    .ud-card.ud-compact .ud-v {
        font-size: 18px;
        font-weight: 800
    }

    .ud-card.ud-compact .ud-mini {
        font-size: 10px
    }

    .ud-card.ud-compact .ud-more {
        right: 10px;
        bottom: 8px
    }

/* ===== Genealogy preview (kept gx-* namespace) ===== */
.gx-stage {
    position: relative;
    height: 340px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    overflow: auto;
    background: #fafbfe
}

.gx-node {
    position: absolute;
    width: 125px;
    height: 42px;
    border-radius: 21px;
    background: #fff;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(2,8,23,.08);
    user-select: none
}

    .gx-node .gx-left, .gx-node .gx-right {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 4px 8px
    }

    .gx-node .gx-left {
        width: 58%;
        border-radius: 21px 0 0 21px;
        background: #eef2f7
    }

    .gx-node .gx-right {
        width: 42%;
        border-radius: 0 21px 21px 0;
        color: #fff
    }

.gx-name {
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.gx-node.gx-long .gx-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.1;
    max-height: 26px
}

.gx-sub {
    font-size: 10px;
    color: #64748b
}

.gx-subw {
    color: #dbeafe
}

.gx-kind-blue .gx-right {
    background: linear-gradient(180deg,#114a8b,#0b2f66)
}

.gx-kind-wine .gx-right {
    background: linear-gradient(180deg,#a3123b,#6c0724)
}

.gx-kind-orange .gx-right {
    background: linear-gradient(180deg,#f59e0b,#d97706)
}

.gx-pinL {
    position: absolute;
    left: -8px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0b1220;
    display: grid;
    place-items: center;
    font: 700 9px/1 monospace;
    cursor: pointer;
    z-index: 3
}

.gx-pinB {
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0b1220;
    z-index: 2
}

.gx-node:hover {
    outline: 2px solid rgba(17,74,139,.12)
}

svg.gx-wires {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none
}

.gx-wire {
    fill: none;
    stroke: #0b1220;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-opacity: .9;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,.05))
}

.gx-bubble {
    position: absolute;
    min-width: 220px;
    max-width: 280px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(2,8,23,.08);
    padding: 10px 12px;
    z-index: 50
}

.gx-hidden {
    display: none
}

.gx-bubble:after {
    content: "";
    position: absolute;
    left: -8px;
    top: 18px;
    border-width: 8px;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
    filter: drop-shadow(-1px 0 0 var(--border))
}

.gx-bubble h3, .gx-bubble h4 {
    margin: 0 0 6px 0
}

.gx-bubble .gx-row {
    font-size: 11px;
    color: #64748b
}

.gx-bubble code {
    font: 700 11px/1 ui-monospace,Menlo,monospace;
    color: #0f172a;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px
}
/* thin pin color + legend */
.gx-kind-blue .gx-pinB {
    background: #3b82f6;
}

.gx-kind-orange .gx-pinB {
    background: #f59e0b;
}

.gx-kind-wine .gx-pinB {
    background: #ef4444;
}

.gx-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px
}

    .gx-legend .gx-dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin-right: 6px;
        vertical-align: middle
    }

    .gx-legend .blue {
        background: #3b82f6
    }

    .gx-legend .orange {
        background: #f59e0b
    }

    .gx-legend .wine {
        background: #ef4444
    }

/* ===================================================================== */
/* =====================  LADDER (namespaced lad-*)  ==================== */
/* ===================================================================== */
.lad-wrap {
    position: relative;
    height: 100%;
    min-height: 520px;
    overflow: auto
}

.lad-stage {
    position: relative;
    height: 100%
}

.lad-wires {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none
}

.lad-node {
    position: absolute;
    width: 125px;
    height: 42px;
    border-radius: 21px;
    background: #fff;
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(2,8,23,.08);
    user-select: none
}

.lad-left, .lad-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 8px
}

.lad-left {
    width: 58%;
    border-radius: 21px 0 0 21px;
    background: #eef2f7
}

.lad-right {
    width: 42%;
    border-radius: 0 21px 21px 0;
    color: #fff
}

.lad-node.kind-blue .lad-right {
    background: linear-gradient(180deg,#114a8b,#0b2f66)
}

.lad-node.kind-wine .lad-right {
    background: linear-gradient(180deg,#a3123b,#6c0724)
}

.lad-node.kind-orange .lad-right {
    background: linear-gradient(180deg,#f59e0b,#d97706)
}

.lad-name {
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.lad-node.longname .lad-name {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 9px;
    line-height: 1.1;
    max-height: 26px;
}

.lad-pinL {
    position: absolute;
    left: -8px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0b1220;
    display: grid;
    place-items: center;
    font: 700 9px/1 monospace;
    cursor: pointer;
    z-index: 3
}

.lad-pinB {
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0b1220;
    z-index: 2
}

.lad-node.fixed {
    cursor: default
}

.lad-node:not(.fixed) {
    cursor: grab
}

.lad-node.dragging {
    cursor: grabbing;
    box-shadow: 0 10px 22px rgba(2,8,23,.16)
}

.lad-node:hover {
    outline: 2px solid rgba(17,74,139,.12)
}

.lad-wire {
    fill: none;
    stroke: #0b1220;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-opacity: .9;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,.05))
}

.lad-bubble {
    position: absolute;
    min-width: 220px;
    max-width: 280px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(2,8,23,.08);
    padding: 10px 12px;
    z-index: 50
}

    .lad-bubble.lad-hidden {
        display: none
    }

    .lad-bubble:after {
        content: "";
        position: absolute;
        left: -8px;
        top: 18px;
        border-width: 8px;
        border-style: solid;
        border-color: transparent #fff transparent transparent;
        filter: drop-shadow(-1px 0 0 var(--border))
    }

    .lad-bubble h4 {
        margin: 0 0 6px 0;
        font-size: 12px
    }

.lad-row {
    font-size: 11px;
    color: #64748b
}

.lad-bubble code {
    font: 700 11px/1 ui-monospace,Menlo,monospace;
    color: #0f172a;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 6px
}

/* ===================================================================== */
/* ====================  PYRAMID (namespaced pyr-*)  ==================== */
/* ===================================================================== */
.pyr-wrap {
    position: relative;
    height: 100%;
    min-height: 520px;
    overflow: auto
}

#pyrWires {
    position: absolute;
    inset: 0;
    pointer-events: none
}

.pyr-node {
    position: absolute;
    width: 140px;
    height: 110px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: linear-gradient(#eef2f7,#e5e9f0);
    box-shadow: 0 14px 32px rgba(2,8,23,.12);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    user-select: none
}

    .pyr-node.dragging {
        box-shadow: 0 16px 34px rgba(2,8,23,.18)
    }

.pyr-title {
    text-align: center;
    padding: 6px 6px 8px;
    font-weight: 800;
    color: #111827
}

.pyr-metric {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 10px;
    color: #fff;
    padding: 8px 10px;
    display: grid;
    row-gap: 6px;
    box-shadow: 0 10px 20px rgba(2,8,23,.18);
    font-weight: 600
}

.pyr-row {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.pyr-k {
    opacity: .95
}

.pyr-v {
    font-weight: 900
}

.pyr-metric.pyr-blue {
    background: linear-gradient(135deg,#1e82e6,#0b2f66)
}

.pyr-metric.pyr-orange {
    background: linear-gradient(135deg,#f59e0b,#c23600)
}

.pyr-metric.pyr-wine {
    background: linear-gradient(135deg,#d3124a,#7a0e2a)
}

.pyr-wire {
    fill: none;
    stroke: #111827;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-opacity: .9;
    filter: drop-shadow(0 1px 0 rgba(0,0,0,.06))
}

.pyr-joint {
    fill: #9ca3af;
    stroke: #111827;
    stroke-width: 2
}
/* small overlayed switcher in each preview card */
.gx-switch {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    gap: 6px;
    z-index: 5
}

    .gx-switch button {
        border: 1px solid var(--border);
        background: var(--card-bg);
        color: var(--fg);
        font: 600 11px/1 ui-sans-serif;
        padding: 6px 8px;
        border-radius: 8px;
        cursor: pointer
    }

        .gx-switch button[aria-pressed="true"] {
            outline: 2px solid rgba(17,74,139,.25)
        }

/* >>> GX ADD: pyramid downlink wires (same behavior as #pyrWires, without changing existing rules) */
#pyrWiresdown {
    position: absolute;
    inset: 0;
    pointer-events: none
}