/* Nossic Accounts. Colours and type from the Nossic Branding Pack (v1). */
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("/fonts/atkinson-next.ttf") format("truetype"); font-weight: 200 800; font-display: swap; }

:root {
  --blue: #266BD9; --yellow: #FFCC33; --navy: #1F2438;
  --bg: #EAF2FD; --surface: #FFFFFF; --surface-2: #F5F8FD; --fg: #1F2438; --muted: #5A6278; --line: #DCE3F0;
  --primary: #266BD9; --primary-fg: #FFFFFF; --primary-hover: #1A4FA8; --link: #1A4FA8;
  --good: #1F8A4C; --good-bg: #E5F5EC; --warn: #9A6B00; --warn-bg: #FFF4D1; --bad: #D9483B; --bad-bg: #FDECEA;
  --paper-shadow: 0 1px 3px rgba(31, 36, 56, .12), 0 8px 24px rgba(31, 36, 56, .08);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12162A; --surface: #1A2036; --surface-2: #20283F; --fg: #EEF2FA; --muted: #A3ADC6; --line: #2C3552;
    --primary: #5A93F0; --primary-fg: #0E1424; --primary-hover: #82AEF5; --link: #8DB4F5;
    --good: #5FD08F; --good-bg: #173326; --warn: #FFCC33; --warn-bg: #3A3216; --bad: #FF8A80; --bad-bg: #3C1F22;
    --paper-shadow: 0 2px 10px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.55; min-height: 100vh; }
a { color: var(--link); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; max-width: 65ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: var(--mono); font-size: .85em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }
.light-only { display: block; } .dark-only { display: none; }
@media (prefers-color-scheme: dark) { .light-only { display: none; } .dark-only { display: block; } }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; }
.logo { height: 32px; width: auto; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
@media (max-width: 640px) { .who-name { display: none; } .logo { height: 28px; } }
@media (max-width: 480px) { .topbar { gap: 8px; padding-inline: 12px; } .who { gap: 2px; } .who .btn.sm { padding-inline: 7px; } }

/* Layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 16px 64px; display: grid; gap: 20px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head > div { display: grid; gap: 6px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 14px; min-width: 0; }
.rows { display: grid; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row > div { display: grid; gap: 2px; min-width: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.empty { color: var(--muted); padding: 6px 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: start; }

/* Controls */
.btn { font: inherit; font-weight: 700; font-size: .92rem; border-radius: 9px; padding: 9px 16px; border: 1.5px solid transparent; cursor: pointer; background: var(--primary); color: var(--primary-fg); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--primary-hover); }
.btn.secondary { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--primary); }
.btn.ghost { background: transparent; color: var(--fg); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.yellow { background: var(--yellow); color: var(--navy); }
.btn.yellow:hover { background: #F5BD1A; }
.btn.sm { padding: 6px 11px; font-size: .85rem; }
.btn.lg { padding: 13px 22px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--primary); }
input, select, textarea { font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
input[type="range"] { padding: 0; border: 0; box-shadow: none; accent-color: var(--primary); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; background: var(--surface-2); flex-wrap: wrap; }
.seg button { font: inherit; font-weight: 600; font-size: .88rem; border: 0; background: transparent; color: var(--fg); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.state { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 16px; }
.state-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 460px; }
.state-card .mark { width: 52px; height: 52px; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 50; max-width: calc(100vw - 32px); }
.toast.error { background: var(--bad); }
.dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--fg); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.dialog.wide { width: min(760px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(18, 22, 42, .55); }
.dlg { padding: 22px; display: grid; gap: 16px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding-top: 8px; }


/* Nav */
.nav { display: flex; gap: 4px; align-items: center; margin-left: 18px; margin-right: auto; }
.nav a { color: var(--fg); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
@media (max-width: 640px) { .nav { margin-left: 6px; } .nav a { padding: 6px 7px; } }
.wrap.wide { max-width: 1480px; }
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--muted); }
.ref { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }

.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--good); display: inline-block; box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: beat 2s infinite; }
.pulse.off { background: var(--muted); animation: none; }
@keyframes beat { 70% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 800; background: var(--primary); color: var(--primary-fg); flex: none; }
.avatar.ai, .avatar.bot { background: var(--yellow); color: var(--navy); }
.avatar.visitor { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.ws-switch { width: auto; padding: 6px 10px; font-size: .88rem; font-weight: 600; max-width: 220px; }
.ws-name { font-weight: 700; color: var(--fg); text-decoration: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .ws-switch, .ws-name { display: none; } }
code.snippet, pre.code { display: block; font-family: var(--mono); font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; font: inherit; line-height: 1; }

/* Home: workspaces */
.wscards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.wscard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 8px; text-decoration: none; color: inherit; }
.wscard:hover { border-color: var(--primary); }

/* Inbox: list | conversation | details */
body.app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app #main { flex: 1; min-height: 0; }
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 300px; height: 100%; min-height: 0; }
.inbox > section { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.inbox > section:last-child { border-right: 0; }
@media (max-width: 1180px) { .inbox { grid-template-columns: 300px minmax(0, 1fr); } .inbox .details { display: none; } .inbox.show-details .details { display: flex; position: fixed; right: 0; top: 57px; bottom: 0; width: min(320px, 100vw); z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.18); } }
@media (max-width: 760px) { .inbox { grid-template-columns: minmax(0, 1fr); } .inbox.has-conv .list { display: none; } .inbox:not(.has-conv) .conv { display: none; } }
.list-head { padding: 12px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.views { display: flex; gap: 4px; flex-wrap: wrap; }
.views button { font: inherit; font-size: .82rem; font-weight: 700; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); border-radius: 99px; padding: 4px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.views button[aria-pressed="true"] { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.views .n { font-size: .72rem; opacity: .8; }
.clist { overflow-y: auto; flex: 1; }
.citem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; width: 100%; background: none; border-left: 3px solid transparent; font: inherit; color: inherit; }
.citem:hover { background: var(--surface-2); }
.citem[aria-current="true"] { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); border-left-color: var(--primary); }
.citem .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .last { grid-column: 2 / 4; color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem .time { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.citem .avatar { grid-row: span 2; }
.citem.unread .name::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: 6px; vertical-align: middle; }
.status-bot { background: var(--warn-bg); color: var(--warn); }
.status-waiting { background: var(--bad-bg); color: var(--bad); }
.status-open { background: var(--good-bg); color: var(--good); }
.status-closed { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.conv { background: var(--bg) !important; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-head .t { display: flex; align-items: center; gap: 10px; min-width: 0; }
.conv-head h2 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.msg .bubble { padding: 9px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .meta { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.msg.out { margin-left: auto; flex-direction: row-reverse; }
.msg.out .bubble { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.msg.out.ai .bubble, .msg.out.bot .bubble { background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); color: var(--fg); border-color: color-mix(in srgb, var(--yellow) 60%, var(--line)); }
.msg.out .meta { text-align: right; }
.msg.note { margin: 0 auto; max-width: 90%; }
.msg.note .bubble { background: var(--warn-bg); border: 1px dashed var(--warn); color: var(--fg); font-size: .9rem; }
.sys { align-self: center; font-size: .78rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.btnrow span { font-size: .8rem; border: 1px solid currentColor; border-radius: 99px; padding: 2px 9px; opacity: .85; }
.typing { font-size: .8rem; color: var(--muted); padding: 0 16px 6px; min-height: 1.3em; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.composer textarea { min-height: 64px; max-height: 40vh; resize: none; }
.composer.note textarea { background: var(--warn-bg); border-color: var(--warn); }
.composer .bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.canned { position: absolute; bottom: 100%; left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--paper-shadow); max-height: 240px; overflow-y: auto; }
.canned button { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.canned button:hover, .canned button.on { background: var(--surface-2); }
.details { overflow-y: auto; padding: 16px; gap: 16px; }
.details dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: .88rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.blank { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
.summary { background: color-mix(in srgb, var(--yellow) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--yellow) 50%, var(--line)); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }

/* Flow editor */
.editor { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; height: 100%; min-height: 0; }
@media (max-width: 1100px) { .editor { grid-template-columns: 230px minmax(0, 1fr); } .editor .props { position: fixed; right: 0; top: 57px; bottom: 0; width: min(360px, 100vw); z-index: 20; box-shadow: -8px 0 24px rgba(0,0,0,.2); } .editor .props.empty { display: none; } }
.palette, .props { background: var(--surface); overflow-y: auto; padding: 14px; display: grid; gap: 8px; align-content: start; }
.palette { border-right: 1px solid var(--line); }
.props { border-left: 1px solid var(--line); gap: 14px; }
.palette h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--body); margin-top: 6px; }
.pal-item { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: grab; font-weight: 600; font-size: .88rem; user-select: none; }
.pal-item:hover { border-color: var(--primary); }
.pal-item.off { opacity: .45; cursor: not-allowed; }
.pal-item.off:hover { border-color: var(--line); }
.pal-item .ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .8rem; flex: none; }
.canvas-wrap { position: relative; min-height: 0; display: flex; flex-direction: column; }
.canvas-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.canvas-bar .name { font-family: var(--display); font-weight: 800; font-size: 1.05rem; border-color: transparent; background: transparent; width: auto; min-width: 120px; max-width: 320px; padding: 4px 6px; }
.canvas-bar .name:hover { border-color: var(--line); }
#drawflow { flex: 1; min-height: 0; position: relative; background: var(--bg); background-image: radial-gradient(color-mix(in srgb, var(--muted) 35%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px; z-index: 5; }
.problems { font-size: .86rem; display: grid; gap: 4px; }
.problems .err { color: var(--bad); }
.problems .warn { color: var(--warn); }
.opt-list { display: grid; gap: 6px; }
.opt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.opt-row.route { grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }

/* Drawflow nodes in Nossic style (overrides drawflow.min.css) */
.drawflow .drawflow-node { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; color: var(--fg); width: 230px; padding: 0; box-shadow: var(--paper-shadow); min-height: 0; }
.drawflow .drawflow-node:hover { border-color: var(--primary); }
.drawflow .drawflow-node.selected { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent), var(--paper-shadow); color: var(--fg); }
.drawflow .drawflow-node .input, .drawflow .drawflow-node .output { width: 16px; height: 16px; border: 2px solid var(--primary); background: var(--surface); }
.drawflow .drawflow-node .output:hover, .drawflow .drawflow-node .input:hover { background: var(--primary); }
.drawflow .drawflow-node .inputs { margin-left: -8px; } .drawflow .drawflow-node .outputs { margin-right: -8px; }
.drawflow .connection .main-path { stroke: var(--primary); stroke-width: 3px; }
.drawflow .connection .main-path:hover, .drawflow .connection .main-path.selected { stroke: var(--yellow); }
.drawflow-delete { background: var(--bad); color: #fff; border: 2px solid var(--surface); line-height: 26px; font-family: var(--body); font-weight: 700; }
.drawflow-node .drawflow-delete { right: -12px; top: -12px; }
.parent-drawflow { overflow: hidden; }
.fn { display: grid; gap: 4px; }
.fn-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: .86rem; }
.fn-head .ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: .72rem; flex: none; }
.fn-body { padding: 6px 10px 10px; font-size: .82rem; color: var(--muted); display: grid; gap: 3px; overflow-wrap: anywhere; }
.fn-body .q { color: var(--fg); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fn-outs { padding: 0 0 8px; display: grid; }
.fn-out { height: 26px; display: flex; align-items: center; justify-content: flex-end; font-size: .72rem; color: var(--muted); font-weight: 700; padding-right: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawflow .drawflow-node { align-items: stretch; }
.drawflow .drawflow-node .drawflow_content_node { width: 100%; }
/* Outputs sit at the bottom, one per 26px row, beside their labels in .fn-outs. */
.drawflow .drawflow-node .inputs, .drawflow .drawflow-node .outputs { display: flex; flex-direction: column; }
.drawflow .drawflow-node .outputs { justify-content: flex-end; padding-bottom: 8px; }
.drawflow .drawflow-node .output { margin: 5px 0 !important; }
.drawflow .drawflow-node .inputs { justify-content: flex-start; padding-top: 9px; }
.drawflow .drawflow-node .input { margin: 0 !important; }
.fieldset { display: grid; gap: 8px; }
.ic-blue { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.ic-yellow { background: color-mix(in srgb, var(--yellow) 40%, transparent); color: var(--navy); }
.ic-green { background: var(--good-bg); color: var(--good); }
.ic-red { background: var(--bad-bg); color: var(--bad); }
.ic-grey { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.ic-orange { background: #FFE2B8; color: #8A4B00; }
.ic-purple { background: color-mix(in srgb, #7C5CD6 18%, transparent); color: #5B3FB8; }
.ic-teal { background: color-mix(in srgb, #1A9E8F 18%, transparent); color: #127569; }
@media (prefers-color-scheme: dark) { .ic-yellow { color: var(--yellow); } .ic-orange { background: #4A3417; color: #FFC46B; } .ic-purple { color: #B9A5F5; } .ic-teal { color: #6FD8CB; } }
.pal-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); margin: -4px 0 4px; }
.pal-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; font-size: .85rem; padding: 8px 4px; border-bottom: 3px solid transparent; cursor: pointer; }
.pal-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.multi { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.opt-row.multi-col { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.opt-row.multi-col > input, .opt-row.multi-col > select { flex: 1 1 120px; min-width: 0; width: auto; }
.opt-row.multi-col > .check { flex: 1 1 auto; }
.opt-row.multi-col > .btn { flex: none; margin-left: auto; }
.fieldset.boxed { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.trig-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.trig-list span { font-size: .75rem; background: var(--good-bg); color: var(--good); border-radius: 6px; padding: 1px 6px; font-weight: 600; }

/* Knowledge */
.kb-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.kb-item:first-child { border-top: 0; }
.kb-item .t { font-weight: 700; overflow-wrap: anywhere; }
.answer-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); display: grid; gap: 8px; }

/* Settings */
.settings { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .settings { grid-template-columns: minmax(0, 1fr); } }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hours { display: grid; gap: 6px; }
.hours .day { display: grid; grid-template-columns: 60px auto 1fr 1fr; gap: 8px; align-items: center; }
.preview-pane { position: sticky; top: 76px; }
.swatch { width: 44px; height: 40px; padding: 2px; }

.row > div.actions, .page-head > div.actions { display: flex; }

/* Phones: the workspace links get their own row so the top bar never runs off the screen. */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .nav { order: 3; flex: 1 0 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .who { margin-left: auto; }
}

/* Accounts */
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.row > div:first-child { display: grid; gap: 2px; min-width: 0; }

/* CRM */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }
.filters input[type="search"] { flex: 1 1 240px; }
.card.flush { padding: 0; overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr:last-child td { border-bottom: 0; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: .78rem; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.side { display: grid; gap: 20px; }
dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: .92rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tl { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl:first-child { border-top: 0; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: .9rem; }
.tl-note .tl-ic { background: color-mix(in srgb, var(--yellow) 30%, var(--surface)); }
.tl-ticket .tl-ic { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); }
.tl-body { display: grid; gap: 4px; min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tl-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.note-form { display: grid; gap: 8px; }
.row.task.done label span { text-decoration: line-through; color: var(--muted); }
.late { color: var(--bad); font-weight: 600; }
.views { display: flex; gap: 6px; flex-wrap: wrap; }
.views [aria-pressed="true"] { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.grid-gap { display: grid; gap: 12px; }
