/* Shared chrome for the sample demos under /demo/. App chrome, not the
   marketing layout: it should read as the product. Mirrors the app's Mantine
   look (blue primary, grey hairlines, light badges) with the site's fonts and
   the brand sun for the sample banner and conversion buttons. Each demo adds
   its own demo-<name>.css on top. */

:root {
  color-scheme: light;
  --ink: #0e1a2b;
  --text: #212529;
  --dim: #6b7280;
  --line: #e3e7ee;
  --bg: #f6f8fb;
  --card: #fff;
  --blue: #228be6; --blue-soft: #e7f5ff; --blue-ink: #1971c2;
  --teal: #0ca678; --teal-soft: #e6fcf5;
  --red: #e03131; --red-soft: #fff5f5;
  --yellow: #e8a400; --yellow-soft: #fff9db; --yellow-ink: #a86a00;
  --orange: #f76707; --orange-soft: #fff4e6;
  --grape: #ae3ec9; --grape-soft: #f8f0fc;
  --violet: #7048e8; --violet-soft: #f3f0ff;
  --gray-soft: #f1f3f5;
  --sun: #ffa503; --sun-soft: #fff4dc;
  --font: "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(14,26,43,.05);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.25; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--dim); }
.ink { color: var(--ink); }
.xs { font-size: 12px; }
.sm { font-size: 13px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.noscript { padding: 2rem; text-align: center; }

/* Sample banner and top bar ------------------------------------------------ */
.demo-banner { background: var(--ink); color: #d6deeb; font-size: 13px; }
.demo-banner-in { max-width: 1440px; margin: 0 auto; padding: 9px 20px; display: flex; align-items: center; gap: 12px; }
.demo-banner .pill { flex: none; background: var(--sun); color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; }
.demo-banner b { color: #fff; font-weight: 600; }
.demo-banner-text { flex: 1; min-width: 0; }
.demo-banner-cta { flex: none; color: var(--sun); font-weight: 600; white-space: nowrap; }
.demo-banner-cta:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .demo-banner-in { flex-wrap: wrap; gap: 6px 10px; padding: 8px 16px; }
  .demo-banner-text { flex-basis: 100%; order: 3; font-size: 12.5px; }
}

.app-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; height: 58px; padding: 0 20px; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.app-brand { display: inline-flex; align-items: center; gap: 5px; color: #1f5c1f; }
.app-brand .sunmark { width: 24px; height: 24px; }
.app-brand .wordmark { height: 30px; width: auto; }
.app-org { display: flex; align-items: center; gap: 8px; margin-right: auto; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }
.app-org small { color: var(--dim); font-weight: 400; margin-left: 4px; }
.org-mark { width: 22px; height: 22px; border-radius: 5px; background: #c92a2a; color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .02em; }
.btn-demo { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--sun); color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 8px; white-space: nowrap; transition: background .15s, transform .15s; }
.btn-demo:hover { background: #ffb42e; transform: translateY(-1px); }
.btn-lg { font-size: 16px; padding: 13px 22px; }
@media (max-width: 600px) { .app-org small { display: none; } .app-top { gap: 10px; padding: 0 16px; } .app-brand .wordmark { display: none; } }

/* Page --------------------------------------------------------------------- */
.app { max-width: 1440px; margin: 0 auto; padding: 22px 20px 48px; }
.page-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.page-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.page-head h1 { font-size: 22px; font-weight: 600; font-family: var(--font); }
.page-head p { color: var(--dim); }

.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { position: sticky; top: 76px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 6px; color: var(--text); }
.nav-item svg { flex: none; margin-top: 2px; }
.nav-item span { display: flex; flex-direction: column; }
.nav-item b { font-weight: 500; }
.nav-item small { color: var(--dim); font-size: 12px; }
.nav-item:hover { background: var(--gray-soft); }
.nav-item.on { background: var(--blue); color: #fff; }
.nav-item.on small { color: rgba(255,255,255,.8); }
.main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; flex-direction: row; overflow-x: auto; padding: 0; background: none; border: 0; gap: 6px; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; align-items: center; padding: 6px 12px; border-radius: 99px; background: var(--blue-soft); color: var(--blue-ink); }
  .nav-item small { display: none; }
  .nav-item svg { margin: 0; width: 16px; height: 16px; }
  .app { padding: 16px 16px 40px; }
}

/* Filters */
.filters { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.range { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.range-now { display: flex; align-items: center; gap: 6px; font-weight: 500; margin-inline: auto; }
.seg { display: inline-flex; background: var(--gray-soft); border-radius: 7px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 5px; font-size: 12.5px; color: #495057; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.seg-quiet { background: none; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.select select { appearance: none; border: 1px solid var(--line); border-radius: 6px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%236b7280' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 9px center; padding: 5px 28px 5px 10px; font-size: 12.5px; min-width: 150px; }
.scope-note { font-size: 12px; color: var(--blue-ink); background: var(--blue-soft); padding: 3px 8px; border-radius: 99px; }
@media (max-width: 700px) { .range-now { margin-inline: 0; } .seg-quiet { display: none; } .select { flex: 1 1 140px; } .select select { width: 100%; } }

.icon-btn { border: 0; background: none; width: 28px; height: 28px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--dim); font-size: 16px; }
.icon-btn:hover { background: var(--gray-soft); color: var(--ink); }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.on { background: var(--blue-soft); color: var(--blue); }
.link { border: 0; background: none; padding: 0; color: var(--blue-ink); font-size: inherit; text-align: left; }
.link:hover { text-decoration: underline; }
.link.strong { font-weight: 600; }
.textlink { color: var(--blue-ink); font-weight: 600; }
.btn-default, .btn-primary, .btn-sub { display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; font-size: 12.5px; font-weight: 500; padding: 6px 12px; white-space: nowrap; }
.btn-default { border: 1px solid var(--line); background: #fff; }
.btn-default:hover { background: var(--gray-soft); }
.btn-default:disabled { opacity: .7; cursor: progress; }
.btn-primary { border: 0; background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-ink); }
.btn-sub { border: 0; background: none; color: var(--blue-ink); padding: 4px 8px; }
.btn-sub:hover { background: var(--blue-soft); }
.spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards and sections */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.sec { padding: 16px; min-width: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.sec h2 { font-size: 15px; font-weight: 600; font-family: var(--font); display: flex; align-items: center; gap: 6px; }
.hint { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1px solid #adb5bd; color: #868e96; border-radius: 50%; font-size: 10px; font-weight: 600; font-style: italic; cursor: help; }
.hint:hover::after, .hint:focus::after { content: attr(data-tip); position: absolute; left: 50%; top: 22px; transform: translateX(-50%); width: 280px; max-width: 70vw; background: var(--ink); color: #fff; font-size: 12px; font-weight: 400; font-style: normal; line-height: 1.45; padding: 8px 10px; border-radius: 6px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .two { grid-template-columns: minmax(0, 1fr); } }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 1px 7px; border-radius: 99px; line-height: 1.6; white-space: nowrap; border: 1px solid transparent; }
.badge.light.c-gray { background: var(--gray-soft); color: #495057; }
.badge.light.c-blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge.light.c-teal { background: var(--teal-soft); color: #087f5b; }
.badge.light.c-red { background: var(--red-soft); color: #c92a2a; }
.badge.light.c-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }
.badge.light.c-orange { background: var(--orange-soft); color: #d9480f; }
.badge.light.c-grape { background: var(--grape-soft); color: #9c36b5; }
.badge.light.c-violet { background: var(--violet-soft); color: #6741d9; }
.badge.outline { border-color: #ced4da; color: #495057; background: #fff; }
.badge.dot { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11px; color: #495057; border-color: var(--line); background: #fff; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #adb5bd; }
.badges { display: inline-flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.chip { cursor: pointer; }
.chip:hover { filter: brightness(.95); text-decoration: underline; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); }
.tile-value { font-size: 24px; font-weight: 700; color: var(--ink); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tile-value.t-teal { color: #087f5b; } .tile-value.t-red { color: #c92a2a; } .tile-value.t-yellow { color: var(--yellow-ink); }
.tile-sub { font-size: 12px; color: var(--dim); }
.tile .spark { margin-top: 6px; }
.delta { font-size: 12px; font-weight: 500; }
.delta.up { color: var(--teal); } .delta.down { color: var(--red); } .delta.flat { color: var(--dim); }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .tiles.three .tile-label { font-size: 10px; } .tile-value { font-size: 20px; } }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.grid-table, .heat { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--dim); padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid-table td { padding: 8px 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
.grid-table .n { text-align: right; }
.grid-table tr.click { cursor: pointer; }
.grid-table tr.click:hover td, .grid-table tr.click:focus td { background: #f8fafc; }

.switch { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 34px; height: 20px; border-radius: 99px; background: #ced4da; position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.empty { padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* Closing CTA */
.closing { margin-top: 8px; background: var(--ink); color: #c9d2e3; border-radius: 14px; padding: 28px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.closing::after { content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,165,3,.22), transparent 70%); pointer-events: none; }
.closing h2 { color: #fff; font-family: var(--display); font-size: clamp(20px, 2.6vw, 28px); font-weight: 650; letter-spacing: -.01em; margin-bottom: 8px; }
.closing p { max-width: 62ch; }
.closing-actions { display: flex; flex-direction: column; gap: 12px; align-items: center; position: relative; z-index: 1; }
.closing .textlink { color: var(--sun); }
@media (max-width: 760px) { .closing { grid-template-columns: minmax(0, 1fr); padding: 22px 20px; } .closing-actions { align-items: flex-start; } }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(14,26,43,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #fff; z-index: 41; box-shadow: -12px 0 40px rgba(14,26,43,.18); transform: translateX(102%); transition: transform .22s ease; display: flex; flex-direction: column; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer:focus { outline: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; font-size: 16px; font-family: var(--font); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }

/* Modal and toast */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(14,26,43,.45); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 12px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal-head h2 { font-size: 16px; font-family: var(--font); font-weight: 600; }
.modal-body { padding: 16px 18px 18px; }
.task-form { display: flex; flex-direction: column; gap: 12px; }
.task-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; flex: 1; }
.task-form input, .task-form select, .task-form textarea { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13.5px; font-weight: 400; background: #fff; }
.task-form textarea { resize: vertical; line-height: 1.5; }
.task-form .row { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 70; background: var(--ink); color: #e6ebf3; padding: 11px 16px; border-radius: 10px; font-size: 13px; width: max-content; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 12px 30px rgba(0,0,0,.25); display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.toast[hidden] { display: none; }

.btn-ghost { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 500; padding: 7px 12px; border-radius: 8px; }
.btn-ghost:hover { border-color: #c5cdda; background: var(--gray-soft); }

/* Demo gate: the one call to action every dead end opens */
.gate { position: fixed; inset: 0; z-index: 80; background: rgba(14,26,43,.55); display: grid; place-items: center; padding: 16px; animation: gate-fade .18s ease-out; }
.gate[hidden] { display: none; }
.gate-card { position: relative; width: min(600px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border: 8px solid var(--sun); border-radius: 22px; box-shadow: 0 0 0 1px #ffd27a inset, 0 30px 80px rgba(0,0,0,.35); padding: 52px 52px 40px; text-align: center; animation: gate-rise .22s ease-out; }
.gate-card::before { content: ""; position: absolute; inset: 10px; border: 1.5px solid #ffd27a; border-radius: 12px; pointer-events: none; }
.gate-x { position: absolute; top: 18px; right: 18px; }
.gate-logo { display: inline-flex; align-items: center; gap: 8px; color: #1f5c1f; margin-bottom: 22px; }
.gate-logo .sunmark { width: 40px; height: 40px; }
.gate-logo .wordmark { height: 52px; width: auto; }
.gate h2 { font-family: var(--display); font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.015em; line-height: 1.15; color: var(--ink); margin: 0 auto 14px; max-width: 20ch; }
.gate p { font-size: 16px; line-height: 1.6; color: #34405a; max-width: 46ch; margin: 0 auto; }
.gate .gate-sub { margin-top: 12px; color: var(--ink); font-weight: 500; }
.gate-btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 28px; background: #1f5c1f; color: #fff; font-family: var(--display); font-size: 18px; font-weight: 600; padding: 15px 40px; border-radius: 12px; box-shadow: 0 8px 20px rgba(31,92,31,.28); transition: background .15s, transform .15s; }
.gate-btn:hover { background: #184a18; transform: translateY(-1px); }
.gate-btn:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
.gate-later { display: block; margin: 16px auto 0; border: 0; background: none; color: var(--dim); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.gate-later:hover { color: var(--ink); }
@keyframes gate-fade { from { opacity: 0; } }
@keyframes gate-rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 600px) { .gate-card { padding: 44px 24px 28px; border-width: 6px; } .gate-btn { width: 100%; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
