:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --background: #07111f;
    --background-soft: #091827;
    --surface: #0d1b2d;
    --surface-strong: #102640;
    --surface-soft: #122b47;
    --line: rgba(162, 190, 220, .17);
    --line-strong: rgba(162, 190, 220, .32);
    --text: #edf5ff;
    --muted: #94a9c3;
    --accent: #42d2b4;
    --accent-soft: rgba(66, 210, 180, .12);
    --warning: #f6bd60;
    --danger: #ff6b79;
    --info: #78a8ff;
    --shadow: 0 24px 80px rgba(0, 0, 0, .34);
}

body[data-theme="contrast"] {
    --background: #02050a;
    --background-soft: #050b12;
    --surface: #09111e;
    --surface-strong: #101c2d;
    --surface-soft: #142943;
    --line: rgba(220, 235, 255, .24);
    --text: #ffffff;
    --muted: #b8c7da;
    --accent: #61f4cb;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #12345b, var(--background) 42%); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 14px; background: var(--accent); color: #04221d; font-weight: 800; }
button:hover { filter: brightness(1.07); }
button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { background: var(--surface-soft); color: var(--text); border: 1px solid var(--line); }
button.quiet { background: transparent; color: var(--muted); border: 1px solid var(--line); }
code { border: 1px solid var(--line); border-radius: 7px; padding: 2px 6px; background: rgba(0, 0, 0, .22); color: #cce7ff; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 24px; }
h2 { margin-bottom: 4px; font-size: 25px; }
h3 { margin-bottom: 12px; font-size: 16px; }

.landing-shell { min-height: 100vh; background: #f4f6f3; color: #102018; }
.landing-hero { position: relative; display: grid; min-height: 86vh; overflow: hidden; padding: 24px 34px 32px; background: #07120f; color: #f4fff9; }
.landing-scene { position: absolute; inset: 0; overflow: hidden; opacity: .82; }
.landing-scene::before { position: absolute; inset: 9% 4% 10%; content: ""; border: 1px solid rgba(133, 236, 199, .18); border-radius: 8px; }
.landing-scene::after { position: absolute; right: 8%; bottom: 10%; width: 320px; height: 320px; content: ""; border: 1px solid rgba(246, 189, 96, .3); border-radius: 100%; }
.rail { position: absolute; height: 1px; background: rgba(133, 236, 199, .42); transform-origin: left center; }
.rail-one { top: 35%; left: 7%; width: 72%; transform: rotate(-8deg); }
.rail-two { top: 60%; left: 14%; width: 64%; background: rgba(246, 189, 96, .48); transform: rotate(7deg); }
.rail-three { top: 48%; left: 34%; width: 46%; background: rgba(120, 168, 255, .42); transform: rotate(34deg); }
.scene-node { position: absolute; display: inline-flex; min-width: 82px; align-items: center; justify-content: center; border: 1px solid rgba(244, 255, 249, .24); border-radius: 999px; padding: 9px 13px; background: rgba(7, 18, 15, .78); color: #dff9ee; font-size: 12px; font-weight: 850; box-shadow: 0 18px 60px rgba(0, 0, 0, .28); }
.node-wallet { top: 27%; left: 10%; }
.node-ussd { top: 58%; left: 22%; }
.node-airtime { top: 34%; right: 25%; }
.node-ledger { right: 10%; bottom: 30%; border-color: rgba(246, 189, 96, .5); color: #ffe0a3; }
.node-alerts { right: 18%; top: 19%; border-color: rgba(120, 168, 255, .5); color: #d8e6ff; }
.landing-nav { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.landing-brand img { width: 154px; height: 52px; object-fit: contain; object-position: left center; }
.landing-nav nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.landing-nav nav a { border: 1px solid rgba(244, 255, 249, .16); border-radius: 999px; padding: 8px 12px; color: #d8e8df; font-size: 13px; font-weight: 750; }
.landing-nav nav a:hover { border-color: rgba(66, 210, 180, .48); color: #ffffff; }
.hero-copy { position: relative; z-index: 2; align-self: center; max-width: 760px; padding: 76px 0 54px; }
.hero-copy h1 { max-width: 740px; margin-bottom: 18px; font-size: 68px; line-height: .98; }
.hero-lede { max-width: 610px; color: #c6d7ce; font-size: 19px; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.button-link { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid #42d2b4; border-radius: 8px; padding: 10px 16px; background: #42d2b4; color: #061713; font-weight: 850; }
.button-link.secondary { border-color: rgba(244, 255, 249, .22); background: rgba(244, 255, 249, .08); color: #f4fff9; }
.hero-status { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; align-self: end; width: min(920px, 100%); border: 1px solid rgba(244, 255, 249, .14); border-radius: 8px; overflow: hidden; background: rgba(244, 255, 249, .1); }
.hero-status div { display: grid; gap: 4px; padding: 14px; background: rgba(7, 18, 15, .72); }
.hero-status strong { font-size: 14px; }
.hero-status span { color: #a9bbb2; font-size: 12px; }
.landing-band, .landing-split, .use-case-band, .trust-band, .contact-band, .landing-footer { padding: 74px 34px; }
.section-heading { max-width: 790px; margin: 0 auto 28px; text-align: center; }
.section-heading h2, .landing-split h2, .contact-band h2 { color: #102018; font-size: 38px; line-height: 1.08; }
.section-heading p, .landing-split p, .contact-band p { color: #52645c; font-size: 16px; line-height: 1.7; }
.landing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 1120px; margin: 0 auto; }
.landing-card { min-height: 230px; border: 1px solid #d8dfd8; border-radius: 8px; padding: 22px; background: #ffffff; box-shadow: 0 18px 48px rgba(22, 38, 30, .08); }
.landing-card span { color: #1e8c77; font-size: 12px; font-weight: 900; }
.landing-card h3 { margin-top: 42px; color: #102018; font-size: 22px; }
.landing-card p { color: #52645c; line-height: 1.65; }
.landing-split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 42px; align-items: start; background: #ffffff; }
.landing-split > div:first-child { max-width: 560px; justify-self: end; }
.service-list { display: grid; gap: 10px; max-width: 650px; }
.service-list div { display: grid; gap: 6px; border: 1px solid #d8dfd8; border-radius: 8px; padding: 16px; background: #f7f8f4; }
.service-list strong { color: #102018; }
.service-list span { color: #52645c; line-height: 1.55; }
.use-case-band { background: #f4f6f3; }
.use-case-grid { display: grid; grid-template-columns: 1.2fr repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 1120px; margin: 0 auto; }
.use-case-card { display: grid; align-content: end; min-height: 255px; border: 1px solid #d8dfd8; border-radius: 8px; padding: 22px; background: #ffffff; box-shadow: 0 18px 48px rgba(22, 38, 30, .08); }
.use-case-card.featured { grid-row: span 2; min-height: 522px; background: #102018; color: #f4fff9; }
.use-case-card span { color: #1e8c77; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.use-case-card.featured span { color: #42d2b4; }
.use-case-card h3 { color: #102018; font-size: 23px; line-height: 1.12; }
.use-case-card.featured h3 { color: #f4fff9; font-size: 34px; }
.use-case-card p { margin-bottom: 0; color: #52645c; line-height: 1.65; }
.use-case-card.featured p { color: #c6d7ce; }
.trust-band { background: #11231d; color: #f4fff9; }
.trust-band .section-heading h2 { color: #f4fff9; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1040px; margin: 0 auto; }
.trust-strip span { border: 1px solid rgba(244, 255, 249, .18); border-radius: 999px; padding: 10px 13px; background: rgba(244, 255, 249, .06); color: #d5e6dd; font-weight: 800; }
.contact-band { display: flex; gap: 24px; align-items: center; justify-content: space-between; background: #eef2ea; }
.contact-band div { max-width: 760px; }
.landing-footer { background: #061429; color: #f5f9ff; }
.footer-main { display: grid; grid-template-columns: minmax(240px, 1.2fr) repeat(3, minmax(170px, 1fr)); gap: 54px; max-width: 1240px; margin: 0 auto; }
.footer-brand { display: grid; align-content: start; gap: 18px; }
.footer-brand img { width: 150px; height: 52px; object-fit: contain; object-position: left center; }
.footer-brand p { max-width: 330px; margin-bottom: 4px; color: #aab8c9; line-height: 1.65; }
.footer-brand strong { font-size: 17px; }
.social-links { display: flex; flex-wrap: wrap; gap: 12px; }
.social-links a { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, .08); border-radius: 8px; background: #1d314d; color: #ffffff; font-size: 13px; font-weight: 900; }
.social-links a:hover, .footer-column a:hover, .footer-bottom a:hover { color: #42d2b4; }
.footer-column { display: grid; align-content: start; gap: 16px; }
.footer-column h3 { margin: 0 0 4px; color: #91a5be; font-size: 13px; }
.footer-column a { color: #ffffff; font-weight: 850; }
.footer-bottom { display: flex; gap: 24px; align-items: center; justify-content: space-between; max-width: 1240px; margin: 60px auto 0; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .12); color: #ffffff; font-weight: 750; }
.footer-bottom div { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; }
.footer-bottom a { color: #ffffff; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: rgba(13, 27, 45, .94); box-shadow: var(--shadow); }
.login-logo { width: 145px; height: 48px; margin-bottom: 26px; object-fit: contain; object-position: left center; }
label { display: grid; gap: 7px; margin: 14px 0; color: var(--muted); font-size: 13px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; background: #091828; color: var(--text); }
textarea { resize: vertical; }
.login-card button { width: 100%; margin-top: 10px; }
.message { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.message.error { color: var(--danger); }
.message.success { color: var(--accent); }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 254px minmax(0, 1fr); }
.app-shell:has(.drawer:not(.hidden)) { grid-template-columns: 254px minmax(0, 1fr) minmax(430px, 33vw); }
.sidebar { display: flex; min-height: 100vh; flex-direction: column; gap: 20px; padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(8, 22, 37, .96); }
.brand img { width: 138px; height: 46px; object-fit: contain; object-position: left center; }
.sidebar-title h1 { font-size: 20px; }
#primary-nav { display: grid; gap: 6px; overflow-y: auto; padding-right: 2px; }
.nav-item { display: grid; gap: 2px; padding: 10px; border-radius: 10px; color: var(--muted); font-size: 13px; }
.nav-item small { color: #6f86a3; font-size: 11px; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active small { color: #9be7d5; }
.sidebar-footer { display: flex; gap: 8px; align-items: center; margin-top: auto; color: var(--muted); font-size: 12px; }
.health-dot { width: 8px; height: 8px; border-radius: 100%; background: var(--warning); box-shadow: 0 0 16px var(--warning); }

.main { min-width: 0; padding: 28px; overflow: auto; }
.topbar, .panel-heading, .drawer-header { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.topbar-actions, .action-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.notice { margin: 24px 0 16px; padding: 12px 14px; border: 1px solid rgba(246, 189, 96, .24); border-radius: 10px; background: rgba(246, 189, 96, .07); color: #e7cf9e; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card, .panel, .detail-section, .action-form, .command-card, .board-card { border: 1px solid var(--line); border-radius: 12px; background: rgba(13, 27, 45, .92); }
.metric-card { display: grid; gap: 7px; padding: 15px; }
.metric-card.good { border-color: rgba(66, 210, 180, .3); }
.metric-card.bad { border-color: rgba(255, 107, 121, .35); }
.metric-card.warn { border-color: rgba(246, 189, 96, .35); }
.metric-card span, small { color: var(--muted); font-size: 12px; }
.metric-card strong { font-size: 23px; }
.panel { overflow: hidden; margin-bottom: 16px; }
.panel-heading { padding: 16px; border-bottom: 1px solid var(--line); }
.panel-copy, .contract-note { padding: 14px 16px; color: var(--muted); }
.board-grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 16px; }
.board-card { display: block; padding: 16px; transition: transform .16s ease, border-color .16s ease; }
.board-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.board-card p:last-child { margin-bottom: 0; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
td small { display: block; margin-top: 5px; }
.compact table { font-size: 11px; }
.compact th, .compact td { padding: 7px; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; background: rgba(120, 168, 255, .12); color: var(--info); font-size: 11px; font-weight: 800; }
.pill.good { background: rgba(66, 210, 180, .12); color: var(--accent); }
.pill.warn { background: rgba(246, 189, 96, .12); color: var(--warning); }
.pill.bad { background: rgba(255, 107, 121, .12); color: var(--danger); }
.pill.neutral { background: rgba(148, 169, 195, .12); color: var(--muted); }
.empty-state { padding: 34px 20px; color: var(--muted); text-align: center; }
.empty-state h3 { color: var(--text); }
.check-list { display: grid; gap: 10px; margin: 0; padding: 16px 20px 18px 34px; color: #cfdeef; }

.drawer { max-height: 100vh; padding: 20px; overflow-y: auto; border-left: 1px solid var(--line); background: rgba(9, 23, 38, .98); }
.detail-section, .action-form { margin-top: 14px; padding: 14px; }
dl { display: grid; gap: 8px; margin: 0; }
dl div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 8px; font-size: 12px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; color: #e1edfb; }
.confirm-row, .toggle-row { display: flex; gap: 9px; align-items: flex-start; color: var(--warning); }
.confirm-row input, .toggle-row input { width: auto; margin-top: 2px; }

.lookup-form, .settings-form { padding: 16px; }
.lookup-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 12px; align-items: end; }
.lookup-form label { margin: 0; }
.settings-form { display: grid; gap: 10px; }
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.toggle-row { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, .12); color: var(--text); }
.toggle-row span { display: grid; gap: 3px; }
.toggle-row small { color: var(--muted); }
.command-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; margin-bottom: 16px; }
.command-card { display: grid; gap: 12px; padding: 16px; }
.command-card code { display: block; overflow-wrap: anywhere; line-height: 1.55; }
.json-box { max-height: 460px; margin: 0; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, .24); color: #d5e6fa; font-size: 12px; }
.loading-panel { display: flex; gap: 12px; align-items: center; padding: 20px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 100%; animation: spin 1s linear infinite; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 30; max-width: 380px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); box-shadow: var(--shadow); color: var(--text); }
.toast.success { border-color: rgba(66, 210, 180, .34); }
.toast.error { border-color: rgba(255, 107, 121, .34); }

body[data-density="compact"] .main { padding: 18px; }
body[data-density="compact"] th,
body[data-density="compact"] td { padding: 8px 10px; }
body[data-density="compact"] .metric-card,
body[data-density="compact"] .board-card,
body[data-density="compact"] .command-card { padding: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1220px) {
    .app-shell, .app-shell:has(.drawer:not(.hidden)) { grid-template-columns: 220px minmax(0, 1fr); }
    .drawer { position: fixed; inset: 0 0 0 auto; z-index: 20; width: min(660px, 94vw); box-shadow: -20px 0 60px rgba(0, 0, 0, .38); }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-copy h1 { font-size: 56px; }
    .landing-grid, .use-case-grid { grid-template-columns: 1fr; }
    .landing-card { min-height: auto; }
    .landing-card h3 { margin-top: 28px; }
    .use-case-card.featured { grid-row: auto; min-height: 330px; }
    .footer-main { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; }
}

@media (max-width: 780px) {
    .landing-hero { min-height: 92vh; padding: 18px 18px 24px; }
    .landing-nav { align-items: flex-start; }
    .landing-brand img { width: 132px; height: 44px; }
    .landing-nav nav { max-width: 180px; }
    .landing-nav nav a { padding: 7px 9px; font-size: 12px; }
    .hero-copy { padding: 44px 0 26px; }
    .hero-copy h1 { font-size: 40px; line-height: 1.04; }
    .hero-lede { font-size: 16px; line-height: 1.55; }
    .hero-status { grid-template-columns: 1fr; }
    .landing-scene::after { right: -110px; bottom: 90px; }
    .scene-node { min-width: 68px; padding: 7px 9px; font-size: 11px; }
    .node-wallet { top: 31%; left: 7%; }
    .node-ussd { display: none; }
    .node-airtime { top: 42%; right: 8%; }
    .node-ledger { right: 9%; bottom: 24%; }
    .node-alerts { display: none; }
    .landing-band, .landing-split, .use-case-band, .trust-band, .contact-band, .landing-footer { padding: 52px 18px; }
    .section-heading { text-align: left; }
    .section-heading h2, .landing-split h2, .contact-band h2 { font-size: 30px; }
    .landing-split, .contact-band, .footer-main { display: grid; grid-template-columns: 1fr; }
    .landing-split > div:first-child { justify-self: start; }
    .use-case-card, .use-case-card.featured { min-height: auto; }
    .use-case-card.featured h3 { font-size: 28px; }
    .footer-bottom { display: grid; margin-top: 42px; }
    .footer-bottom div { justify-content: flex-start; }
    .app-shell, .app-shell:has(.drawer:not(.hidden)) { display: block; }
    .sidebar { min-height: auto; padding: 15px; }
    #primary-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 220px; }
    .sidebar-footer { display: none; }
    .main { padding: 16px; }
    .topbar, .panel-heading { display: grid; }
    .metrics, .board-grid.two, .lookup-form { grid-template-columns: 1fr; }
}
