/* Fanya Labs demo kit: shared look for every demo system. Light, realistic business-app UI. */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --accent: #0f766e; --accent-ink: #fff; --accent-soft: color-mix(in srgb, var(--accent) 12%, #fff);
  --bg: #f4f5f7; --panel: #fff; --ink: #14171a; --muted: #667085; --line: #e4e7ec; --line-2: #d0d5dd;
  --ok: #12805c; --ok-soft: #e7f6ef; --warn: #b54708; --warn-soft: #fef0c7; --bad: #b42318; --bad-soft: #fee4e2; --info: #175cd3; --info-soft: #e0eaff;
  --r: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Demo ribbon */
.d-ribbon { display: flex; align-items: center; justify-content: center; gap: .75rem; flex-wrap: wrap; background: #111; color: #e5e7eb; font-size: 12.5px; padding: 6px 12px; text-align: center; }
.d-ribbon b { color: #f7941d; font-weight: 600; }
.d-ribbon a { color: #22d3ee; }
.d-ribbon button { background: none; border: 1px solid #444; color: #e5e7eb; border-radius: 6px; padding: 1px 8px; cursor: pointer; font-size: 12px; }
.d-ribbon button:hover { border-color: #888; }

/* Login */
.d-login { min-height: calc(100vh - 32px); display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.d-login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px -20px rgba(16,24,40,.25); }
.d-login-card .d-logo { margin-bottom: 1.2rem; }
.d-login-card h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.d-login-card > p { color: var(--muted); margin-bottom: 1.4rem; }
.d-roles { display: grid; gap: .5rem; margin-bottom: 1.2rem; }
.d-role { display: flex; gap: .75rem; align-items: center; text-align: left; width: 100%; padding: .7rem .85rem; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; cursor: pointer; }
.d-role:hover { border-color: var(--accent); }
.d-role.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.d-role small { display: block; color: var(--muted); }
.d-login-hint { margin-top: 1rem; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Shell */
.d-app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 32px); }
.d-side { background: #fff; border-right: 1px solid var(--line); padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: calc(100vh - 32px); overflow-y: auto; }
.d-logo { display: flex; align-items: center; gap: .6rem; font-weight: 650; font-size: 15px; padding: .25rem .5rem 1rem; }
.d-logo i { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-style: normal; font-weight: 700; flex: none; }
.d-logo small { display: block; font-weight: 450; font-size: 11.5px; color: var(--muted); }
.d-nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: #344054; font-weight: 500; }
.d-nav a:hover { background: var(--bg); text-decoration: none; }
.d-nav a.is-on { background: var(--accent-soft); color: var(--accent); }
.d-nav svg { width: 18px; height: 18px; flex: none; }
.d-nav .d-count { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 7px; }
.d-side-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.d-user { display: flex; align-items: center; gap: .6rem; padding: .5rem; }
.d-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; }
.d-user small { display: block; color: var(--muted); font-size: 12px; }
.d-main { min-width: 0; display: flex; flex-direction: column; }
.d-top { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.d-top h1 { font-size: 1.1rem; font-weight: 650; }
.d-top .d-sp { flex: 1; }
.d-menu-btn { display: none; background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: .35rem .55rem; cursor: pointer; }
.d-content { padding: 1.5rem; display: grid; gap: 1.25rem; align-content: start; }

/* Site layout (public portals) */
.d-site-nav { display: flex; align-items: center; gap: 1.25rem; padding: .9rem clamp(1rem, 4vw, 3rem); background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.d-site-nav .d-logo { padding: 0; }
.d-site-nav nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.d-site-nav nav a { padding: .45rem .7rem; border-radius: 8px; color: #344054; font-weight: 500; }
.d-site-nav nav a.is-on { background: var(--accent-soft); color: var(--accent); }
.d-site-nav nav a:hover { text-decoration: none; background: var(--bg); }
.d-site-main { padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 3rem) 3rem; display: grid; gap: 1.25rem; max-width: 1240px; margin: 0 auto; width: 100%; }
.d-hero { border-radius: 18px; padding: clamp(1.5rem, 4vw, 3rem); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000)); color: #fff; display: grid; gap: .8rem; }
.d-hero h2 { font-size: clamp(1.6rem, 3.5vw, 2.6rem); line-height: 1.1; letter-spacing: -.02em; max-width: 22ch; }
.d-hero p { opacity: .85; max-width: 58ch; font-size: 15px; }
.d-hero .d-btn { background: #fff; color: var(--accent); border-color: #fff; }
.d-hero .d-btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }

/* Building blocks */
.d-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 0; }
.d-card-h { display: flex; align-items: center; gap: .75rem; justify-content: space-between; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.d-card-h h2, .d-card-h h3 { font-size: 15px; font-weight: 620; }
.d-card-b { padding: 1.1rem; }
.d-card-b.p0 { padding: 0; }
.d-grid { display: grid; gap: 1.25rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.d-kpi { padding: 1rem 1.1rem; }
.d-kpi small { color: var(--muted); font-weight: 500; display: block; }
.d-kpi b { display: block; font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; margin: .15rem 0; font-variant-numeric: tabular-nums; }
.d-kpi span { font-size: 12.5px; color: var(--muted); }
.d-kpi .up { color: var(--ok); }
.d-kpi .down { color: var(--bad); }
.d-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.d-row.between { justify-content: space-between; }
.d-stack { display: grid; gap: .75rem; }
.d-muted { color: var(--muted); }
.d-small { font-size: 12.5px; }
.d-big { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; }
.d-hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0; }

.d-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 560; padding: .5rem .9rem; border-radius: 8px; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.d-btn:hover { filter: brightness(1.07); text-decoration: none; }
.d-btn:disabled { opacity: .5; cursor: not-allowed; }
.d-btn-ghost { background: #fff; color: #344054; border-color: var(--line-2); }
.d-btn-ghost:hover { background: var(--bg); filter: none; }
.d-btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.d-btn-bad { background: #fff; border-color: #fda29b; color: var(--bad); }
.d-btn-sm { padding: .3rem .6rem; font-size: 12.5px; }
.d-btn-lg { padding: .75rem 1.2rem; font-size: 15px; }
.d-btn-block { width: 100%; }
.d-mpesa-btn { background: #15a34a; border-color: #15a34a; color: #fff; }

.d-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: 12px; font-weight: 560; padding: 1px 8px; border-radius: 999px; background: #f2f4f7; color: #344054; white-space: nowrap; }
.d-badge.ok { background: var(--ok-soft); color: var(--ok); }
.d-badge.warn { background: var(--warn-soft); color: var(--warn); }
.d-badge.bad { background: var(--bad-soft); color: var(--bad); }
.d-badge.info { background: var(--info-soft); color: var(--info); }
.d-badge.acc { background: var(--accent-soft); color: var(--accent); }

.d-table-wrap { overflow-x: auto; }
.d-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.d-table th { text-align: left; font-weight: 560; color: var(--muted); font-size: 12.5px; background: #f9fafb; padding: .6rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.d-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.d-table tr:last-child td { border-bottom: 0; }
.d-table tbody tr:hover td { background: #fafbfc; }
.d-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-table .act { text-align: right; white-space: nowrap; }
.d-empty { padding: 2rem; text-align: center; color: var(--muted); }

.d-form { display: grid; gap: .9rem; }
.d-field { display: grid; gap: .3rem; }
.d-field label { font-weight: 560; font-size: 13px; }
.d-field small { color: var(--muted); }
.d-input, .d-form input:not([type=checkbox]):not([type=radio]):not([type=range]), .d-form select, .d-form textarea { width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: .55rem .7rem; }
.d-form textarea { min-height: 90px; resize: vertical; }
.d-input:focus, .d-form input:focus, .d-form select:focus, .d-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.d-search { border: 1px solid var(--line-2); border-radius: 8px; padding: .45rem .7rem; min-width: 220px; background: #fff; }
.d-search:focus { outline: none; border-color: var(--accent); }
.d-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.d-tabs a, .d-tabs button { padding: .55rem .8rem; border: 0; background: none; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.d-tabs .is-on { color: var(--accent); border-color: var(--accent); }
.d-tabs a:hover { text-decoration: none; color: var(--ink); }
.d-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.d-chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: .25rem .75rem; cursor: pointer; font-weight: 500; font-size: 13px; }
.d-chip.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.d-progress { height: 8px; background: #eef0f3; border-radius: 999px; overflow: hidden; }
.d-progress i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.d-list { list-style: none; margin: 0; padding: 0; }
.d-list li { display: flex; gap: .75rem; align-items: center; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.d-list li:last-child { border-bottom: 0; }
.d-list .grow { flex: 1; min-width: 0; }
.d-dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; }
.d-dl dt { color: var(--muted); }
.d-dl dd { margin: 0; font-weight: 500; }
.d-alert { border-radius: 10px; padding: .8rem 1rem; background: var(--info-soft); color: #1d2939; border: 1px solid #b2ccff; }
.d-alert.warn { background: var(--warn-soft); border-color: #fedf89; }
.d-alert.ok { background: var(--ok-soft); border-color: #a6f4c5; }

/* Bar chart */
.d-bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-bottom: 22px; }
.d-bars span { flex: 1; position: relative; display: flex; align-items: flex-end; height: 100%; }
.d-bars i { display: block; width: 100%; background: var(--accent); opacity: .85; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .6s; }
.d-bars em { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.d-bars span:hover i { opacity: 1; }
.d-bars b { position: absolute; bottom: calc(var(--h) + 4px); left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-weight: 500; white-space: nowrap; opacity: 0; }
.d-bars span:hover b { opacity: 1; }

/* Modal */
.d-modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; padding: 1rem; z-index: 50; animation: dfade .15s; }
.d-modal { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow: auto; box-shadow: 0 30px 80px -20px rgba(16,24,40,.5); animation: dpop .2s; }
.d-modal.wide { width: min(760px, 100%); }
.d-modal-h { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.d-modal-h h3 { font-size: 16px; }
.d-modal-h button { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.d-modal-b { padding: 1.2rem; }
.d-modal-f { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.2rem; border-top: 1px solid var(--line); background: #f9fafb; border-radius: 0 0 14px 14px; flex-wrap: wrap; }
@keyframes dfade { from { opacity: 0; } }
@keyframes dpop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Toasts */
.d-toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 60; }
.d-toast { background: #101828; color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); max-width: 360px; animation: dpop .2s; display: flex; gap: .5rem; align-items: flex-start; }
.d-toast.ok::before { content: "✓"; color: #4ade80; font-weight: 700; }
.d-toast.demo::before { content: "i"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #f7941d; color: #000; font-weight: 700; font-size: 12px; flex: none; margin-top: 1px; }

/* M-Pesa flow */
.d-pesa-head { display: flex; align-items: center; gap: .6rem; }
.d-pesa-logo { background: #15a34a; color: #fff; font-weight: 700; border-radius: 6px; padding: 2px 8px; font-size: 13px; letter-spacing: .02em; }
.d-pesa-amt { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; text-align: center; margin: .6rem 0 .2rem; }
.d-pesa-to { text-align: center; color: var(--muted); margin-bottom: 1rem; }
.d-spin { width: 44px; height: 44px; border: 4px solid #e5e7eb; border-top-color: #15a34a; border-radius: 50%; margin: 1.2rem auto; animation: dspin .8s linear infinite; }
@keyframes dspin { to { transform: rotate(360deg); } }
.d-demo-note { border: 1px solid #f7941d; background: #fff7ed; border-radius: 12px; padding: 1rem 1.1rem; display: grid; gap: .4rem; }
.d-demo-note strong { color: #9a3412; display: flex; gap: .5rem; align-items: center; }
.d-demo-note strong::before { content: "!"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #f7941d; color: #000; font-size: 12px; flex: none; }
.d-demo-note p { color: #7c2d12; font-size: 13.5px; }
.d-done { text-align: center; padding: .5rem 0; }
.d-done i { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto .6rem; font-style: normal; font-size: 26px; font-weight: 700; }

/* Receipt */
.d-receipt { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; background: #fffef8; border: 1px dashed var(--line-2); border-radius: 8px; padding: 1rem; }
.d-receipt .c { text-align: center; }
.d-receipt .r { display: flex; justify-content: space-between; gap: 1rem; }
.d-receipt hr { border: 0; border-top: 1px dashed var(--line-2); margin: .5rem 0; }

/* Kanban */
.d-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.d-col { background: #eef0f3; border-radius: 12px; padding: .75rem; display: grid; gap: .6rem; align-content: start; min-height: 200px; }
.d-col h3 { font-size: 13px; font-weight: 620; display: flex; justify-content: space-between; color: #344054; padding: 0 .2rem; }
.d-tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; display: grid; gap: .35rem; box-shadow: var(--shadow); }
.d-tile b { font-weight: 600; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g21, .g12 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .d-app { grid-template-columns: minmax(0, 1fr); }
  .d-side { position: fixed; inset: 32px auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .25s; box-shadow: 20px 0 50px -20px rgba(0,0,0,.3); height: auto; }
  .d-app.nav-open .d-side { transform: none; }
  .d-menu-btn { display: inline-block; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .d-content { padding: 1rem; }
  .d-top { padding: .7rem 1rem; }
  .d-search { min-width: 0; width: 100%; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .d-kpi b { font-size: 1.25rem; }
  .d-top .d-hide-sm { display: none; }
}

/* ==========================================================================
   Look v2: branded dark sidebar, richer cards, charts, split login, site footer.
   ========================================================================== */
:root {
  --bg: #f2f4f8; --line: #e6e9f0; --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 14px -6px rgba(16,24,40,.10);
  --shadow-lg: 0 24px 48px -24px rgba(16,24,40,.28);
  --side: color-mix(in srgb, var(--accent) 18%, #0b1016);
  --side-2: color-mix(in srgb, var(--accent) 30%, #0b1016);
  --accent-2: color-mix(in srgb, var(--accent) 70%, #fff);
  --accent-deep: color-mix(in srgb, var(--accent) 75%, #000);
}
body { background: radial-gradient(1100px 420px at 70% -120px, color-mix(in srgb, var(--accent) 9%, transparent), transparent), var(--bg); background-attachment: fixed; }

/* Sidebar */
.d-side { background: linear-gradient(180deg, var(--side-2), var(--side) 40%); border-right: 0; color: #e6ebf2; padding: 1.1rem .8rem; }
.d-side .d-logo { color: #fff; }
.d-side .d-logo small { color: rgba(230,235,242,.6); }
.d-logo i { background: linear-gradient(135deg, var(--accent-2), var(--accent) 55%, var(--accent-deep)); box-shadow: 0 6px 16px -6px var(--accent), inset 0 1px 0 rgba(255,255,255,.3); }
.d-nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: rgba(230,235,242,.42); padding: .2rem .75rem .4rem; font-weight: 600; }
.d-side .d-nav a { color: rgba(230,235,242,.78); font-weight: 500; transition: background .15s, color .15s; }
.d-side .d-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.d-side .d-nav a.is-on { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #fff; box-shadow: 0 8px 20px -10px var(--accent), inset 0 1px 0 rgba(255,255,255,.18); }
.d-side .d-nav .d-count { background: #f97066; }
.d-side-foot { border-top-color: rgba(255,255,255,.1); }
.d-side .d-user small { color: rgba(230,235,242,.55); }
.d-side .d-user b { color: #fff; font-weight: 600; }

/* Top bar */
.d-top { background: rgba(255,255,255,.82); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom-color: var(--line); gap: .75rem; min-height: 62px; }
.d-top-t { display: grid; line-height: 1.2; min-width: 0; }
.d-top-t h1 { font-size: 1.12rem; font-weight: 680; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-top-t small { color: var(--muted); font-size: 12px; }
.d-date { display: inline-flex; align-items: center; gap: .4rem; font-size: 12.5px; color: #475467; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; }
.d-date svg { width: 14px; height: 14px; }
.d-bell { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: #475467; }
.d-bell svg { width: 18px; height: 18px; }
.d-bell i { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: #f04438; box-shadow: 0 0 0 2px #fff; }
.d-av { width: 30px; height: 30px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 650; font-size: 11.5px; flex: none; letter-spacing: .02em; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.d-who { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; }
.d-who b { display: block; font-weight: 600; }
.d-who small { display: block; color: var(--muted); font-size: 12px; }
.d-content { padding: 1.6rem; gap: 1.35rem; }

/* Cards & KPIs */
.d-card { border-radius: 16px; border-color: var(--line); box-shadow: var(--shadow); }
.d-card-h { padding: 1rem 1.2rem; }
.d-card-h h2, .d-card-h h3 { font-size: 15px; font-weight: 660; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.d-card-h h2::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--accent-2), var(--accent)); }
.d-kpi { padding: 1.05rem 1.15rem 1rem; position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.d-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.d-kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); pointer-events: none; }
.d-kpi-top { display: flex; align-items: center; gap: .6rem; }
.d-kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.d-kpi-ic svg { width: 18px; height: 18px; }
.d-kpi small { font-size: 12.5px; color: #475467; }
.d-kpi b { font-size: 1.7rem; margin: .55rem 0 .2rem; }
.d-kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; }
.d-kpi-foot > span { font-size: 12.5px; color: var(--muted); }
.d-spark { color: var(--accent); flex: none; opacity: .9; }
.d-kpi .up { color: var(--ok); font-weight: 560; }
.d-kpi .down { color: var(--bad); font-weight: 560; }

/* Buttons, chips, badges */
.d-btn { border-radius: 9px; font-weight: 580; transition: transform .12s, box-shadow .2s, filter .2s; }
.d-btn:not(.d-btn-ghost):not(.d-btn-bad) { background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0)); box-shadow: 0 1px 2px rgba(16,24,40,.08), 0 6px 14px -8px var(--accent); }
.d-btn:active { transform: translateY(1px); }
.d-mpesa-btn { box-shadow: 0 6px 14px -8px #15a34a !important; }
.d-chip { transition: all .15s; }
.d-chip:hover { border-color: var(--accent); color: var(--accent); }
.d-chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -8px var(--accent); }
.d-badge { padding: 2px 9px 2px 8px; }
.d-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.d-search { border-radius: 10px; padding-left: 2.1rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2398a2b3' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat .7rem center; }
.d-search:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Tables & lists */
.d-table th { background: #f8f9fb; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; font-weight: 650; color: #667085; padding: .7rem 1rem; }
.d-table td { padding: .8rem 1rem; }
.d-table tbody tr { transition: background .12s; }
.d-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 4%, #fff); }
.d-table td:first-child a, .d-table td:first-child b { font-weight: 600; }
.d-list li { transition: background .12s; }
.d-list li:hover { background: #fafbfc; }
.d-progress { height: 8px; background: #eceff4; }
.d-progress i { background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* Charts */
.d-bars { height: 180px; gap: 8px; background: repeating-linear-gradient(to top, transparent 0, transparent 39px, #eef0f4 39px, #eef0f4 40px); background-position: 0 -22px; }
.d-bars i { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 7px 7px 3px 3px; opacity: .92; box-shadow: 0 6px 14px -10px var(--accent); }
.d-donut { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.d-donut svg { width: 150px; height: 150px; flex: none; }
.d-donut path { transition: opacity .2s; }
.d-donut path:hover { opacity: .8; }
.d-donut-v { font-size: 17px; font-weight: 700; fill: var(--ink); }
.d-donut-l { font-size: 9px; fill: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.d-donut ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; flex: 1; min-width: 160px; }
.d-donut li { display: flex; align-items: center; gap: .55rem; font-size: 13px; }
.d-donut li i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.d-donut li span { flex: 1; color: #475467; }
.d-area svg { width: 100%; height: 190px; display: block; }
.d-grid-l line { stroke: #eef0f4; stroke-width: 1; }
.d-area-x { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 2px; }

/* Login: brand panel + form */
.d-login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); place-items: stretch; padding: 0; background: var(--bg); }
.d-login-brand { position: relative; overflow: hidden; background: linear-gradient(150deg, var(--side-2), var(--side) 60%, #05070a); color: #fff; padding: clamp(2rem, 5vw, 3.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.d-login-glow { position: absolute; width: 520px; height: 520px; right: -160px; top: -160px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 65%); opacity: .55; animation: dglow 9s ease-in-out infinite alternate; }
.d-login-brand::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
@keyframes dglow { to { transform: translate(-60px, 80px) scale(1.15); } }
.d-logo-inv { color: #fff; position: relative; z-index: 1; }
.d-logo-inv small { color: rgba(255,255,255,.6); }
.d-login-pitch { position: relative; z-index: 1; max-width: 30rem; }
.d-login-pitch h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.08; letter-spacing: -.03em; margin-bottom: 1.4rem; }
.d-login-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.d-login-pitch li { display: flex; gap: .65rem; align-items: flex-start; color: rgba(255,255,255,.85); }
.d-login-pitch li svg { width: 20px; height: 20px; flex: none; color: #fff; background: rgba(255,255,255,.14); border-radius: 50%; padding: 3px; }
.d-login-stats { position: relative; z-index: 1; display: flex; gap: 1rem; flex-wrap: wrap; }
.d-login-stats div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: .7rem 1rem; backdrop-filter: blur(6px); min-width: 110px; }
.d-login-stats b { display: block; font-size: 1.05rem; }
.d-login-stats small { color: rgba(255,255,255,.6); font-size: 12px; }
.d-login-side { display: grid; place-items: center; padding: 2rem 1rem; }
.d-login-card { box-shadow: var(--shadow-lg); border-radius: 18px; }
.d-login-card h1 { font-size: 1.55rem; letter-spacing: -.02em; }
.d-login-logo { display: none; }
.d-role { border-radius: 12px; transition: all .15s; }
.d-role .d-avatar { background: var(--accent); color: var(--accent-ink); }

/* Website layout */
.d-site-nav { background: rgba(255,255,255,.86); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.d-site-nav nav { margin-left: auto; }
.d-site-nav nav a { font-weight: 550; }
.d-site-nav nav a.is-on { background: none; color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.d-site-menu { display: none; margin-left: auto; }
.d-hero { position: relative; overflow: hidden; border-radius: 22px; background: linear-gradient(130deg, var(--accent-deep), var(--accent) 55%, var(--accent-2)); box-shadow: var(--shadow-lg); }
.d-hero::before { content: ""; position: absolute; right: -120px; top: -140px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%); }
.d-hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 20px 20px; mask-image: linear-gradient(90deg, transparent 30%, #000); pointer-events: none; }
.d-hero > * { position: relative; z-index: 1; }
.d-art { display: block; width: 100%; height: 100%; }
.d-pic { border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 10; background: #e5e7eb; position: relative; }
.d-pic .d-tagpill { position: absolute; left: .7rem; top: .7rem; }
.d-tagpill { background: rgba(255,255,255,.92); color: var(--ink); font-size: 12px; font-weight: 600; border-radius: 999px; padding: .2rem .6rem; box-shadow: 0 4px 10px -4px rgba(0,0,0,.2); }
.d-site-foot { margin-top: 2rem; background: #0b1016; color: #cbd5e1; padding: 2.5rem clamp(1rem, 4vw, 3rem) 1.2rem; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.d-site-foot .d-logo { color: #fff; padding-left: 0; }
.d-site-foot .d-logo small { color: #94a3b8; }
.d-site-foot p { color: #94a3b8; max-width: 40ch; }
.d-site-foot h4 { color: #fff; margin: 0 0 .6rem; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.d-site-foot a, .d-site-foot span { display: block; color: #cbd5e1; padding: .15rem 0; }
.d-site-foot-b { grid-column: 1 / -1; border-top: 1px solid #1e293b; padding-top: 1rem; font-size: 12.5px; color: #64748b; }

/* Motion */
.d-rise { animation: drise .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes drise { from { opacity: 0; transform: translateY(12px); } }
.d-modal-bg { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.d-modal { border-radius: 18px; }
.d-toast { border-radius: 12px; }
@media (prefers-reduced-motion: reduce) { .d-rise, .d-login-glow { animation: none; } }

@media (max-width: 960px) {
  .d-login { grid-template-columns: minmax(0, 1fr); }
  .d-login-brand { display: none; }
  .d-login-logo { display: flex; }
  .d-login-side { background: radial-gradient(900px 400px at 50% -10%, var(--accent-soft), transparent); min-height: calc(100vh - 32px); }
}
@media (max-width: 860px) {
  .d-side { box-shadow: 20px 0 50px -20px rgba(0,0,0,.5); }
  .d-site-menu { display: inline-block; }
  .d-site-nav nav { display: none; width: 100%; flex-direction: column; margin: 0; }
  .d-site-nav.nav-open nav { display: flex; }
  .d-site-foot { grid-template-columns: 1fr; gap: 1.2rem; }
  .d-content { padding: 1rem; }
}
@media (max-width: 520px) {
  .d-top .d-av { display: none; }
  .d-kpi .d-spark { display: none; }
}

/* ---------- Shared pieces for agent, website and system demos ---------- */
.d-chatlog { display: grid; gap: .6rem; padding: 1.1rem; max-height: 520px; overflow-y: auto; background: linear-gradient(180deg, #f7f8fa, #fff); }
.d-msg { max-width: 78%; padding: .6rem .85rem; border-radius: 14px; white-space: pre-wrap; line-height: 1.45; font-size: 13.5px; box-shadow: 0 1px 2px rgba(16,24,40,.06); animation: dpop .2s; }
.d-msg.them { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; justify-self: start; }
.d-msg.me { background: var(--accent); color: var(--accent-ink); border-top-right-radius: 4px; justify-self: end; }
.d-msg small { display: block; opacity: .6; font-size: 11px; margin-top: .2rem; }
.d-tool { justify-self: start; display: inline-flex; align-items: center; gap: .45rem; font-size: 12px; font-family: ui-monospace, Consolas, monospace; background: #0b1016; color: #a5f3fc; border-radius: 8px; padding: .35rem .6rem; max-width: 90%; animation: dpop .2s; }
.d-tool::before { content: "⚙"; color: #fbbf24; }
.d-typing { justify-self: start; display: inline-flex; gap: 4px; padding: .7rem .9rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.d-typing i { width: 6px; height: 6px; border-radius: 50%; background: #98a2b3; animation: dtype 1s infinite; }
.d-typing i:nth-child(2) { animation-delay: .15s; } .d-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dtype { 50% { transform: translateY(-4px); opacity: .5; } }
.d-chatbar { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 16px 16px; }
.d-chatbar input { flex: 1; border: 1px solid var(--line-2); border-radius: 999px; padding: .55rem 1rem; }
.d-chatbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.d-quick { display: flex; gap: .4rem; flex-wrap: wrap; padding: 0 1.1rem .8rem; background: #fff; }
.d-feed { list-style: none; margin: 0; padding: .4rem 0; }
.d-feed li { display: grid; grid-template-columns: 34px 1fr auto; gap: .7rem; align-items: start; padding: .6rem 1.1rem; }
.d-feed li + li { border-top: 1px dashed var(--line); }
.d-feed .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.d-feed .ic svg { width: 16px; height: 16px; }
.d-feed .ic.ok { background: var(--ok-soft); color: var(--ok); } .d-feed .ic.warn { background: var(--warn-soft); color: var(--warn); } .d-feed .ic.bad { background: var(--bad-soft); color: var(--bad); }
.d-feed small { color: var(--muted); }
.d-feed li.is-new { animation: dnew 1.6s; }
@keyframes dnew { 0% { background: var(--accent-soft); } 100% { background: transparent; } }
.d-ring { --p: 50; --c: var(--accent); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #eceff4 0); font-weight: 700; font-size: 13px; flex: none; position: relative; }
.d-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.d-ring span { position: relative; }
.d-steps { display: flex; gap: 0; margin: .5rem 0; }
.d-steps div { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); padding-top: 28px; }
.d-steps div::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: #eceff4; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line-2); z-index: 1; }
.d-steps div::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 3px; background: #eceff4; }
.d-steps div:first-child::after { display: none; }
.d-steps div.on { color: var(--ink); font-weight: 600; }
.d-steps div.on::before { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.d-steps div.on::after { background: var(--accent); }
.d-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.d-tile2 { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; color: inherit; }
.d-tile2:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); text-decoration: none; }
.d-tile2 .d-pic { border-radius: 0; }
.d-tile2-b { padding: .9rem 1rem 1rem; display: grid; gap: .3rem; flex: 1; }
.d-tile2-b h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.d-price { font-weight: 700; color: var(--accent); font-size: 15px; }
.d-meta { display: flex; gap: .8rem; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.d-switch { position: relative; width: 40px; height: 22px; flex: none; }
.d-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.d-switch i { position: absolute; inset: 0; background: #d0d5dd; border-radius: 999px; transition: .2s; cursor: pointer; }
.d-switch i::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.d-switch input:checked + i { background: var(--accent); }
.d-switch input:checked + i::before { transform: translateX(18px); }
.d-switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }
.d-setting { display: flex; align-items: center; gap: 1rem; justify-content: space-between; padding: .85rem 1.1rem; }
.d-setting + .d-setting { border-top: 1px solid var(--line); }
.d-setting small { display: block; color: var(--muted); }
.d-section-h { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.d-section-h h2 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); letter-spacing: -.02em; }
.d-section-h p { color: var(--muted); }
.d-searchbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; background: #fff; padding: .7rem; border-radius: 14px; box-shadow: var(--shadow-lg); color: var(--ink); align-items: end; }
.d-searchbar label { font-size: 11.5px; font-weight: 600; color: var(--muted); display: grid; gap: .2rem; }
.d-searchbar input, .d-searchbar select { border: 1px solid var(--line-2); border-radius: 9px; padding: .5rem .6rem; width: 100%; background: #fff; }
.d-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.d-hero.d-hero-pic { grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); align-items: center; }
.d-hero-art { border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 11; box-shadow: 0 30px 60px -30px rgba(0,0,0,.5); }
.d-scorebar { display: grid; grid-template-columns: 120px 1fr 40px; gap: .6rem; align-items: center; font-size: 13px; }
.d-check { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: 13.5px; }
.d-check li { display: flex; gap: .45rem; }
.d-check li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.d-check li.no::before { content: "✕"; color: var(--bad); }
@media (max-width: 860px) {
  .d-split, .d-hero.d-hero-pic { grid-template-columns: minmax(0, 1fr); }
  .d-msg { max-width: 90%; }
}

.d-row > .grow { flex: 1; min-width: 0; }
