/* QCRM component and layout styles. Mobile-first; desktop through container queries on .qapp. */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button { font: inherit; color: inherit; }

.qapp {
  container-type: inline-size;
  container-name: qapp;
  position: relative;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}
.qapp[lang="hy"] { font-family: var(--font-hy); }
.mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* layout primitives */
.row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.col { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.between { justify-content: space-between; }
.gap-1 { gap: var(--s-1); } .gap-3 { gap: var(--s-3); } .gap-4 { gap: var(--s-4); } .gap-6 { gap: var(--s-6); }
.grid { display: grid; gap: var(--s-3); grid-template-columns: minmax(0, 1fr); }

/* type */
.h1 { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
.h2 { font-size: var(--fs-xl); font-weight: 620; letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
.h3 { font-size: var(--fs-l); font-weight: 600; margin: 0; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.small { font-size: var(--fs-s); }
.xs { font-size: var(--fs-xs); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-2);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 560; font-size: var(--fs-m); cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .input:focus-visible, .chip:focus-visible, .navi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 35%, var(--line)); }
.btn.danger.solid { background: var(--danger); color: var(--surface); border-color: var(--danger); }
.btn.sm { min-height: 34px; padding: 0 var(--s-3); font-size: var(--fs-s); border-radius: var(--r-1); }
.btn.icon { padding: 0; width: var(--tap); }
.btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.loading { color: transparent; position: relative; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-ink); border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-s); font-weight: 560; color: var(--text-2); }
.input, .select, .textarea {
  min-height: var(--tap); width: 100%; padding: 0 var(--s-3); border-radius: var(--r-2);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-m);
}
.textarea { padding: var(--s-3); min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input.err, .select.err { border-color: var(--danger); background: var(--danger-soft); }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.errtext { font-size: var(--fs-xs); color: var(--danger); font-weight: 520; }
.inputwrap { position: relative; display: flex; align-items: center; }
.inputwrap .input { padding-left: 38px; }
.inputwrap .ico { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s-2); }
.otp span { height: 52px; border-radius: var(--r-2); border: 1px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; font: 600 22px var(--font-mono); }
.otp span.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; background: var(--surface); flex: none; }
.box.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.switch { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); position: relative; flex: none; transition: background var(--t-fast); cursor: pointer; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-1); transition: left var(--t-fast); }
.switch.on { background: var(--accent); }
.switch.on::after { left: 19px; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-2); background: var(--surface-2); border: 1px solid var(--line); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 0 var(--s-3); min-height: 32px; border-radius: 7px; font-size: var(--fs-s); font-weight: 560; color: var(--text-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* chips, badges */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--s-3); border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: var(--fs-s); font-weight: 520; cursor: pointer; white-space: nowrap; color: var(--text-2); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.platform { background: var(--platform-soft); color: var(--platform); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.stage { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; color: var(--sc); background: color-mix(in oklch, var(--sc) 14%, transparent); white-space: nowrap; }
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sc); }

/* avatar */
.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; color: var(--avc); background: color-mix(in oklch, var(--avc) 16%, var(--surface)); }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 48px; height: 48px; font-size: 16px; }
.avstack { display: flex; }
.avstack .av { box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; }
.avstack .av:first-child { margin-left: 0; }

/* cards, lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--shadow-1); min-width: 0; }
.card.pad { padding: var(--s-4); }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); min-height: 52px; }
.card-b { padding: var(--s-4); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); min-height: 56px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; padding: var(--s-2) 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { font-size: var(--fs-xs); color: var(--muted); font-weight: 540; }
.kv dd { margin: 0; font-size: var(--fs-m); min-width: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: var(--s-4); }
.grid.c4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat .v { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.divider { height: 1px; background: var(--line); border: 0; margin: var(--s-3) 0; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: var(--s-10) var(--s-6); color: var(--text-2); }
.empty .glyph { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.callout { display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-2); background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); font-size: var(--fs-s); }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 35%, transparent); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 35%, transparent); }
.callout.danger { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 35%, transparent); }
.callout .ico { flex: none; margin-top: 1px; }
.code { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-3); word-break: break-all; color: var(--text); }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-s); }
.t th { text-align: left; font-weight: 600; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--surface-2); }
.t tr.sel td { background: var(--accent-soft); }
.t .r { text-align: right; }

/* sheets, dialogs, toasts */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-height: 92%; overflow: auto; overscroll-behavior: contain; background: var(--surface); border-radius: var(--r-4) var(--r-4) 0 0; box-shadow: var(--shadow-3); padding: var(--s-2) var(--s-4) var(--s-6); animation: up var(--t-med) var(--ease); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-4); }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r-2); box-shadow: var(--shadow-3); font-size: var(--fs-s); display: flex; gap: 10px; align-items: center; z-index: 60; white-space: nowrap; }

/* app shell (mobile). Scrolling: the document never scrolls; the frame is one screen high (100dvh), the page content
   (.pane: top bar, page, bottom navigation) and the desktop sidebar are separate scroll containers, and neither hands
   the wheel or finger over to the other at its end (overscroll-behavior: contain). Sticky parts of a page stick inside .pane. */
html:has(.frame), html:has(.frame) body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.frame { display: flex; flex-direction: column; height: var(--frame-h, 100dvh); overflow: hidden; }
.frame > .shell { flex: 1 1 auto; min-height: 0; }
.shell { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; min-height: 0; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.pane > .main { flex: 1 0 auto; }
.pane > .topbar, .pane > .bottomnav { flex: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s-2); padding: 10px var(--s-3); background: color-mix(in oklch, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); min-height: 56px; }
.topbar .title { font-weight: 640; font-size: var(--fs-l); }
.main { padding: var(--s-4) var(--s-4) 104px; min-width: 0; }
.bottomnav { position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: color-mix(in oklch, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bottomnav .navi { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; min-height: 52px; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 560; cursor: pointer; border-radius: 10px; min-width: 0; }
.bottomnav .navi span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.bottomnav .navi.on { color: var(--accent); }
.fab { position: fixed; right: var(--s-4); bottom: 84px; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-2); display: grid; place-items: center; cursor: pointer; z-index: 25; }
.sidebar { display: none; }
.deskbar { display: none; }
.mobbar { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.desk-only { display: none !important; }
.pagehead { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
.pagehead .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.toolbar { display: flex; gap: var(--s-2); align-items: center; overflow-x: auto; padding-bottom: 2px; margin-bottom: var(--s-3); }
.pqc { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 620; white-space: nowrap; }
.navgroup { display: flex; flex-direction: column; gap: 2px; }
.navgroup .eyebrow { padding: var(--s-3) var(--s-3) var(--s-1); }
.sidei { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 var(--s-3); border-radius: 8px; color: var(--text-2); font-size: var(--fs-m); font-weight: 520; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; }
.sidei:hover { background: var(--surface-2); color: var(--text); }
.sidei.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidei .cnt { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.searchbtn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: var(--fs-s); cursor: pointer; min-width: 0; flex: 1 1 auto; max-width: 520px; }
.kbd { font: 500 11px var(--font-mono); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface-2); }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 86%; gap: var(--s-3); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s-2); }
.kcol { scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-2); display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.kcol-h { display: flex; align-items: center; gap: var(--s-2); padding: 6px 6px 4px; }
.kcol-sum { font-size: var(--fs-xs); color: var(--muted); padding: 0 6px 6px; font-variant-numeric: tabular-nums; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: var(--s-3); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-1); cursor: grab; }
.kcard.drag { transform: rotate(-1.5deg); box-shadow: var(--shadow-3); border-color: var(--accent-line); }
.kcard .amt { font-weight: 650; font-variant-numeric: tabular-nums; }
.kdrop { border: 1.5px dashed var(--accent-line); border-radius: var(--r-2); height: 64px; background: var(--accent-soft); }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tli { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-4); position: relative; }
.tli::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.tli:last-child::before { display: none; }
.tlicon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.diff { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: var(--fs-s); }
.diff del { color: var(--danger); background: var(--danger-soft); padding: 0 4px; border-radius: 4px; text-decoration: line-through; }
.diff ins { color: var(--ok); background: var(--ok-soft); padding: 0 4px; border-radius: 4px; text-decoration: none; }

/* pipeline progress */
.pipe { display: flex; gap: 3px; }
.pipe i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.pipe i.on { background: var(--accent); }
.pipe i.cur { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.steps { display: flex; gap: var(--s-1); overflow-x: auto; }
.stepper { display: flex; align-items: center; gap: 8px; font-size: var(--fs-s); color: var(--muted); }
.stepper b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-size: 12px; }
.stepper.on b { background: var(--accent); color: var(--accent-ink); }
.stepper.done b { background: var(--ok); color: var(--surface); }

/* logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.logo .mark { width: 28px; height: 28px; border-radius: 50%; border: 3.5px solid var(--accent); position: relative; flex: none; }
.logo .mark::after { content: ""; position: absolute; width: 11px; height: 3.5px; background: var(--accent); right: -5px; bottom: 1px; transform: rotate(40deg); border-radius: 2px; }
.logo .mark::before { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.logo .word { font-size: 18px; }
.logo .full { display: block; font-size: 11px; font-weight: 560; color: var(--muted); letter-spacing: 0.02em; }
.logo.platform .mark { border-color: var(--platform); }
.logo.platform .mark::after, .logo.platform .mark::before { background: var(--platform); }

/* auth */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--bg); }
.auth-side { display: none; }
.auth-main { display: flex; flex-direction: column; gap: var(--s-6); padding: var(--s-6) var(--s-5) var(--s-10); max-width: 460px; width: 100%; margin: 0 auto; }
.auth-foot { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; font-size: var(--fs-s); color: var(--muted); flex-wrap: wrap; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; background: var(--surface); }
.cal .dh { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; padding: 8px 0; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal .dc { min-height: 64px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; min-width: 0; }
.cal .dc:nth-child(7n) { border-right: 0; }
.cal .dc .n { font-weight: 600; color: var(--text-2); }
.cal .dc.out .n { color: var(--muted); opacity: 0.5; }
.cal .dc.today .n { background: var(--accent); color: var(--accent-ink); border-radius: 6px; width: 22px; text-align: center; }
.cal .ev { border-radius: 4px; padding: 1px 4px; background: color-mix(in oklch, var(--sc, var(--accent)) 15%, transparent); color: var(--sc, var(--accent)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.lvl { display: inline-flex; border-radius: 7px; border: 1px solid var(--line-strong); overflow: hidden; }
.lvl b { font-size: 11px; font-weight: 600; padding: 4px 7px; color: var(--muted); border-right: 1px solid var(--line); background: var(--surface); }
.lvl b:last-child { border-right: 0; }
.lvl b.on { background: var(--accent); color: var(--accent-ink); }

/* process graph */
.flow { display: flex; flex-direction: column; align-items: center; gap: 0; }
.node { width: min(100%, 340px); border-radius: var(--r-3); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); padding: var(--s-3); display: flex; gap: var(--s-3); align-items: flex-start; }
.node .nk { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.node.trigger .nk { background: var(--warn-soft); color: var(--warn); }
.node.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.node.err { border-color: var(--danger); }
.edge { width: 2px; height: 22px; background: var(--line-strong); position: relative; }
.edge.add::after { content: "+"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 13px; line-height: 18px; text-align: center; color: var(--muted); }
.branches { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); width: min(100%, 560px); }

/* email mock */
.mail { max-width: 560px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; }
.mail-h { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); font-size: var(--fs-s); color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.mail-b { padding: var(--s-8) var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }

/* placeholder imagery */
.ph { border-radius: var(--r-2); border: 1px solid var(--line); background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface-3) 10px 20px); display: grid; place-items: center; font: 500 11px var(--font-mono); color: var(--muted); text-align: center; padding: 8px; }

/* ===== tablet & desktop ===== */
@container qapp (min-width: 720px) {
  .stat .v { font-size: var(--fs-2xl); }
  .qapp, .qapp .main { font-size: 14px; }
  .grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-auto-columns: minmax(260px, 1fr); }
  .kv { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 12px; align-items: baseline; }
  .pagehead { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .pagehead .actions { flex: 0 0 auto; max-width: 60%; justify-content: flex-end; }
  .scrim { align-items: center; }
  .sheet { width: min(560px, 92%); border-radius: var(--r-4); padding: var(--s-5) var(--s-6) var(--s-6); max-height: 86%; }
  .sheet.wide { width: min(880px, 94%); }
  .sheet .grab { display: none; }
  .main { padding: var(--s-6) var(--s-6) var(--s-10); }
  .auth-main { padding-top: var(--s-10); }
}
@container qapp (min-width: 1024px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; gap: var(--s-2); border-right: 1px solid var(--line); background: var(--surface); padding: var(--s-3); height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .topbar { padding: 10px var(--s-6); }
  .main { padding: var(--s-6) var(--s-8) var(--s-10); }
  .bottomnav, .fab, .mob-only, .mobbar { display: none !important; }
  .deskbar { display: flex; align-items: center; gap: var(--s-2); flex: 1 1 auto; min-width: 0; }
  .desk-only { display: revert !important; }
  .btn.desk-only { display: inline-flex !important; }
  .grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.c4, .grid.c4.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .grid.side-l { grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth-side { display: flex; flex-direction: column; justify-content: space-between; padding: var(--s-10); background: var(--text); color: var(--bg); position: relative; overflow: hidden; }
  .auth-main { justify-content: center; }
}
/* Nested scroll areas (lists, code, dropdowns, wide tables, tab rows) keep the wheel/finger to themselves at their ends
   only while they really overflow: a scroll-driven animation is active only on a scrollable box, so a short box still
   lets the page scroll. !important keeps it under prefers-reduced-motion (it moves nothing). Browsers without scroll
   timelines fall back to normal chaining. Feature stylesheets add their own boxes with the same two declarations. */
@keyframes q-contain-y { from, to { overscroll-behavior-y: contain; } }
@keyframes q-contain-x { from, to { overscroll-behavior-x: contain; } }
.qs-y, .bld-json, .adm-pk { animation: q-contain-y linear both !important; animation-timeline: scroll(self block) !important; }
.qs-x, .tablewrap, .kanban, .toolbar, .steps, .seg, .set-stabs, .set-plans, .set-wiz, .pn-scroll, .bld-canvas, .au-mailtabs { animation: q-contain-x linear both !important; animation-timeline: scroll(self inline) !important; }
.qs-xy { animation: q-contain-y linear both, q-contain-x linear both !important; animation-timeline: scroll(self block), scroll(self inline) !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
