@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* KXPL MEPF IQ design system. Brand: Kepler X Private Limited (green #50d890, blue #4f98ca, teal #0f2326). */
:root {
  --kx-green: #50d890; --kx-blue: #4f98ca; --kx-green-aa: #1b7d4c; --kx-blue-aa: #2a6690;
  --kx-teal-900: #0b1b1d; --kx-teal-800: #0f2326; --kx-teal-700: #102e32; --kx-teal-600: #173f44;
  --bg: #f4f8f7; --surface: #ffffff; --surface-2: #f0f6f5; --surface-3: #e6efee;
  --text: #13262a; --text-2: #4b6266; --text-3: #6f8589; --border: #d8e4e3; --border-strong: #bfd0cf;
  --primary: var(--kx-green-aa); --primary-hover: #166a40; --primary-soft: #e3f6ec; --accent: var(--kx-blue-aa); --accent-soft: #e4eff8;
  --ok: #1b7d4c; --ok-soft: #e3f6ec; --warn: #9a6400; --warn-soft: #fff4dc; --err: #b42318; --err-soft: #fde9e7; --info: #2a6690; --info-soft: #e4eff8;
  --demo: #7a4dbf; --demo-soft: #f1eafb;
  --radius: 10px; --radius-sm: 6px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 35, 38, .06), 0 2px 8px rgba(15, 35, 38, .05);
  --shadow-lg: 0 12px 32px rgba(15, 35, 38, .14);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar-w: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1b1d; --surface: #102629; --surface-2: #143033; --surface-3: #1a3a3e;
  --text: #e6f3f1; --text-2: #a9c2c0; --text-3: #85a09e; --border: #24474b; --border-strong: #2f5a5f;
  --primary: #50d890; --primary-hover: #6fe3a6; --primary-soft: #133c2c; --accent: #6fb2e0; --accent-soft: #143246;
  --ok: #50d890; --ok-soft: #133c2c; --warn: #f2b84b; --warn-soft: #3a2d12; --err: #ff8a7d; --err-soft: #3d1c19; --info: #6fb2e0; --info-soft: #143246;
  --demo: #c3a4f2; --demo-soft: #2c2140;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1b1d; --surface: #102629; --surface-2: #143033; --surface-3: #1a3a3e;
    --text: #e6f3f1; --text-2: #a9c2c0; --text-3: #85a09e; --border: #24474b; --border-strong: #2f5a5f;
    --primary: #50d890; --primary-hover: #6fe3a6; --primary-soft: #133c2c; --accent: #6fb2e0; --accent-soft: #143246;
    --ok: #50d890; --ok-soft: #133c2c; --warn: #f2b84b; --warn-soft: #3a2d12; --err: #ff8a7d; --err-soft: #3d1c19; --info: #6fb2e0; --info-soft: #143246;
    --demo: #c3a4f2; --demo-soft: #2c2140;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
:focus-visible { outline: 2px solid var(--kx-blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--kx-teal-800), var(--kx-teal-900)); color: #cfe6e3; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand img { height: 34px; width: auto; background: #fff; border-radius: 8px; padding: 3px 5px; }
.brand-name { font-weight: 800; letter-spacing: .02em; font-size: 15px; line-height: 1.1; }
.brand-name small { display: block; font-weight: 500; font-size: 10.5px; color: var(--kx-green); letter-spacing: .04em; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #7fa3a0; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cfe6e3; padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(80, 216, 144, .14); color: #fff; box-shadow: inset 3px 0 0 var(--kx-green); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.sidebar-foot { padding: 12px 18px 18px; font-size: 11px; color: #7fa3a0; border-top: 1px solid rgba(255, 255, 255, .06); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding-left: 34px; }
.topbar .search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-menu { position: relative; }
.user-menu > button { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; padding: 4px; border-radius: 8px; }
.user-menu .dropdown { right: 0; }
.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.footer { padding: 14px 24px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); display: flex; gap: 16px; flex-wrap: wrap; }

.dropdown { position: absolute; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 50; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .meta { padding: 8px 10px; color: var(--text-3); font-size: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin: 2px 0 0; }
.crumbs { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card, .grid > * > .card, .row > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--text-2); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.stat { padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.9rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--text-3); }
.stat.accent { border-top: 3px solid var(--kx-green); }
.stat.blue { border-top: 3px solid var(--kx-blue); }
.stat.warn { border-top: 3px solid #e8a33a; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13px/1.2 var(--font); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #06221a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #06221a; } }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--border)); }
.btn-danger:hover { background: var(--err-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 8px; width: 34px; height: 34px; display: inline-grid; place-items: center; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
form.inline { display: inline; }

/* ---------- forms ---------- */
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 4px; color: var(--text); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 3px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=tel], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: 14px/1.4 var(--font); transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 220px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--kx-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--kx-blue) 25%, transparent); }
input.invalid, select.invalid { border-color: var(--err); background: var(--err-soft); }
input.warn { border-color: #e8a33a; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: -3px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.input-unit { position: relative; }
.input-unit input { padding-right: 56px; }
.input-unit .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--text-3); pointer-events: none; }
.required::after { content: " *"; color: var(--err); }
.suggest { font-size: 11.5px; color: var(--accent); margin-top: 3px; }
.suggest::before { content: "Suggested: "; font-weight: 600; }
.linked { font-size: 11.5px; color: var(--ok); margin-top: 3px; }
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; cursor: help; margin-left: 4px; position: relative; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); width: 260px; padding: 8px 10px; background: var(--kx-teal-800); color: #e6f3f1; font-weight: 500; font-size: 12px; line-height: 1.4; border-radius: 6px; z-index: 60; white-space: normal; box-shadow: var(--shadow-lg); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); font-weight: 700; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact th, .table.compact td { padding: 6px 8px; font-size: 13px; }
.edit-table td { padding: 3px; }
.edit-table input, .edit-table select { padding: 5px 6px; font-size: 13px; min-width: 70px; border-radius: 5px; }
.edit-table th { white-space: nowrap; font-size: 11px; }
.edit-table td.rownum { color: var(--text-3); font-size: 12px; text-align: center; padding: 6px; }

/* ---------- badges / alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.ok, .badge.APPROVED, .badge.COMPLETED { background: var(--ok-soft); color: var(--ok); }
.badge.ISSUED { background: var(--primary); color: #fff; }
.badge.warn, .badge.SUBMITTED, .badge.PENDING_REVIEW, .badge.PENDING_APPROVAL, .badge.PENDING_VERIFICATION { background: var(--warn-soft); color: var(--warn); }
.badge.info, .badge.REVIEWED, .badge.UNDER_DESIGN, .badge.ACTIVE { background: var(--info-soft); color: var(--info); }
.badge.err, .badge.ON_HOLD, .badge.WITHDRAWN { background: var(--err-soft); color: var(--err); }
.badge.DRAFT { background: var(--surface-3); color: var(--text-2); }
.badge.VERIFIED { background: var(--ok-soft); color: var(--ok); }
.badge.demo { background: var(--demo-soft); color: var(--demo); }
.badge.HVAC { background: #e4eff8; color: #2a6690; } .badge.ELECTRICAL { background: #fff4dc; color: #8a5a00; } .badge.PLUMBING { background: #e3f3fb; color: #1f6c8f; }
.badge.DRAINAGE { background: #efeadf; color: #6b5532; } .badge.FIRE { background: #fde9e7; color: #b42318; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 14px; display: block; }
.alert > svg { float: left; margin: 2px 10px 0 0; }
.alert > svg + div { overflow: hidden; }
.alert.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--text); }
.alert.err { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); color: var(--text); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text); }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); color: var(--text); }
.alert.demo { background: var(--demo-soft); border-color: color-mix(in srgb, var(--demo) 35%, transparent); color: var(--text); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 32px 16px; color: var(--text-2); }
.empty svg { width: 42px; height: 42px; color: var(--text-3); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- project cards ---------- */
.project-card { display: flex; flex-direction: column; gap: 10px; position: relative; transition: box-shadow .15s, transform .15s; }
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.project-card .num { font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: .03em; }
.project-card h3 { margin: 0; font-size: 1rem; }
.project-card h3 a { color: var(--text); }
.project-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--kx-green), var(--kx-blue)); border-radius: 99px; }
.fav { position: absolute; top: 12px; right: 12px; }
.fav.on svg { fill: #e8a33a; color: #e8a33a; }

/* ---------- calc view ---------- */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.calc-layout .sticky { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow: auto; }
.outputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.output { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; border: 1px solid var(--border); }
.output.design { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.output .l { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.output .v { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.output .u { font-size: 12px; color: var(--text-2); font-weight: 500; margin-left: 3px; }
.output .tag { font-size: 10px; text-transform: uppercase; color: var(--primary); font-weight: 800; letter-spacing: .06em; }
.steps { counter-reset: step; }
.step { border-left: 3px solid var(--border-strong); padding: 6px 0 6px 12px; margin-bottom: 8px; }
.step .t { font-weight: 700; font-size: 13px; }
.step .f { font-family: var(--mono); font-size: 12.5px; color: var(--accent); }
.step .s { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.step .r { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.step .n { font-size: 12px; color: var(--warn); }
.step-group { margin: 14px 0 6px; font-weight: 800; font-size: 13px; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
details.collapsible { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
details.collapsible > summary { cursor: pointer; padding: 10px 12px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after { content: "+"; color: var(--text-3); }
details.collapsible[open] > summary::after { content: "−"; }
details.collapsible > .body { padding: 0 12px 12px; }
.diff-del { background: var(--err-soft); color: var(--err); text-decoration: line-through; }
.diff-add { background: var(--ok-soft); color: var(--ok); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--kx-blue); }
.timeline .when { font-size: 11.5px; color: var(--text-3); }
.workflow { display: flex; gap: 0; align-items: center; flex-wrap: wrap; margin: 6px 0 2px; }
.workflow span { padding: 4px 10px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-3); position: relative; }
.workflow span:first-child { border-radius: 99px 0 0 99px; } .workflow span:last-child { border-radius: 0 99px 99px 0; }
.workflow span.done { background: var(--primary-soft); color: var(--primary); }
.workflow span.current { background: var(--primary); color: #fff; }

/* ---------- report preview ---------- */
.preview-frame { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.dbr-section { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); }
.dbr-section > .head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; }
.dbr-section > .head .title { flex: 1; font-weight: 700; }
.dbr-section.excluded { opacity: .55; }
.dbr-section .body { padding: 0 12px 12px; display: none; }
.dbr-section.open .body { display: block; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 15, 16, .55); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; }
.modal.open { display: flex; }
.modal .dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; padding: 22px; }
.modal .dialog.wide { max-width: 920px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast div { background: var(--kx-teal-800); color: #e6f3f1; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 13px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.calc-display { font-family: var(--mono); font-size: 1.6rem; text-align: right; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; margin-bottom: 10px; min-height: 52px; word-break: break-all; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.calc-keys button { padding: 10px 0; font: 600 15px var(--font); }

/* ---------- wizard ---------- */
.wizard-steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; counter-reset: ws; }
.wizard-steps button { flex: 1; min-width: 120px; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 12px; font: 600 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.wizard-steps button::before { counter-increment: ws; content: counter(ws); display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); margin-right: 8px; font-size: 11px; }
.wizard-steps button.active { border-color: var(--primary); color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.wizard-steps button.active::before { background: var(--primary); color: #fff; }
.wizard-steps button.has-error { border-color: var(--err); }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.autosave { font-size: 12px; color: var(--text-3); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% 0%, #173f44 0%, transparent 60%), linear-gradient(160deg, #0f2326 0%, #0b1b1d 70%); color: #e6f3f1; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .logo { display: flex; align-items: center; gap: 12px; }
.auth-hero .logo img { height: 48px; background: #fff; border-radius: 10px; padding: 5px 8px; }
.auth-hero .logo b { font-size: 18px; letter-spacing: .02em; }
.auth-hero h1 { font-size: 2.5rem; line-height: 1.1; margin: 0 0 12px; max-width: 520px; }
.auth-hero h1 span { background: linear-gradient(90deg, var(--kx-green), var(--kx-blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p.lead { color: #a9c2c0; font-size: 1.05rem; max-width: 480px; }
.auth-hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.auth-hero .chips span { border: 1px solid rgba(80, 216, 144, .35); color: #bfeed4; border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; }
.auth-art { position: absolute; right: -30px; bottom: -10px; width: 46%; max-width: 420px; opacity: .85; pointer-events: none; }
.auth-hero > div { max-width: 56%; }
@media (max-width: 1200px) { .auth-hero > div { max-width: 100%; } .auth-art { opacity: .35; } }
.auth-art .flow { stroke-dasharray: 6 10; animation: flow 3s linear infinite; }
.auth-art .flow.slow { animation-duration: 5s; }
.auth-art .pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes flow { to { stroke-dashoffset: -64; } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .auth-art .flow, .auth-art .pulse { animation: none; } }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 1.6rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-2); margin-bottom: 22px; }
.auth-card .btn-primary { width: 100%; padding: 12px; font-size: 15px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent); font: 600 12px var(--font); cursor: pointer; padding: 6px; }
.auth-foot { margin-top: 28px; font-size: 12px; color: var(--text-3); }
.terms-box { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); white-space: pre-wrap; font-size: 13px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side, .calc-layout { grid-template-columns: 1fr; }
  .calc-layout .sticky { position: static; max-height: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; z-index: 80; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 8px 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 20px; min-height: auto; }
  .auth-hero h1 { font-size: 1.8rem; }
  .auth-art { display: none; }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar .hide-sm { display: none; }
}
@media print {
  .sidebar, .topbar, .footer, .actions, .no-print { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; }
}

/* ---- browser app (Node.js edition) additions ---- */
.boot { min-height: 60vh; display: grid; place-content: center; text-align: center; color: var(--text-2); gap: 8px; padding: 24px; }
.dlg-body { max-height: 70vh; overflow: auto; padding-right: 2px; }
.dialog .alert.err[hidden], .form-error[hidden] { display: none; }
.glossary dt { margin-top: 10px; }
.glossary dd { margin: 2px 0 0; color: var(--text-2); }
.perm-table td.center, .perm-table th.center, .center { text-align: center; }
.pre { white-space: pre-wrap; }
.ai-box { margin-top: 14px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); }
.dropdown .danger { color: var(--err); }
.project-actions .user-menu .dropdown { right: 0; left: auto; }
.page-head .actions .user-menu { position: relative; }
.page-head .actions .dropdown { right: 0; left: auto; }
