/* trip1view — business web app (workflow editor follows n8n conventions). Light theme by default, dark via [data-theme=dark].
   Primary is a calm indigo that reads well in any sector; red is reserved for danger. */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-tint: rgba(79, 70, 229, .1);
  --on-primary: #ffffff;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f5;
  --canvas: #f2f3f7;
  --dots: #c9ccd6;
  --border: #e3e6ee;
  --border-strong: #cbd0db;
  --text: #1d2130;
  --text-2: #4c5366;
  --muted: #7d8497;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #f59e0b;
  --info: #2563eb;
  --edge: #a3a8b6;
  --node-border: #c4c9d6;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, .16);
  --radius: 10px;
  --nav-w: 236px;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
  --expr: #1f9d6b;
  --expr-bg: rgba(47, 179, 122, .07);
  --viz-1: #2a78d6;          /* single-series data colour (dashboards) */
  --viz-track: #e3edfa;      /* lighter step of the same ramp: meter / bar track */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --primary: #8b8ff9;
  --primary-hover: #a5a8fb;
  --primary-tint: rgba(139, 143, 249, .16);
  --on-primary: #12132a;
  --success: #34c77b;
  --danger: #f26b6b;
  --bg: #15161b;
  --surface: #1d1f26;
  --surface-2: #23252d;
  --surface-3: #2b2e37;
  --canvas: #1a1b20;
  --dots: #34373f;
  --border: #30333b;
  --border-strong: #41454f;
  --text: #e8e9ec;
  --text-2: #b8bcc6;
  --muted: #858b98;
  --edge: #6b707c;
  --node-border: #4a4f5a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  --expr: #4ad39a;
  --expr-bg: rgba(74, 211, 154, .08);
  --viz-1: #3987e5;
  --viz-track: #1f2d42;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
code, .mono, pre, kbd { font-family: var(--mono); font-size: 12.5px; }
.hidden, [hidden] { display: none !important; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.pad { padding: 16px; }

.ic { display: inline-flex; width: 16px; height: 16px; flex: none; align-items: center; justify-content: center; }
.ic svg { width: 100%; height: 100%; }
.ic.emoji { font-size: 15px; line-height: 1; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 6px;
  cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn .ic { width: 14px; height: 14px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.left { margin-right: auto; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; font-weight: 600; border-radius: 8px; box-shadow: var(--shadow); }
.btn.saved { color: var(--muted); border-color: var(--border); background: var(--surface); }
.btn.saved:hover { color: var(--muted); border-color: var(--border-strong); }
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading .ic { animation: spin .8s linear infinite; }
.btn.loading .ic svg { display: none; }
.btn.loading .ic::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; margin-left: auto; font-size: 12.5px; font-weight: 500; }
.square-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 8px; cursor: pointer; color: var(--text-2); box-shadow: var(--shadow-sm);
}
.square-btn:hover { color: var(--primary); border-color: var(--primary); }
.square-btn .ic { width: 20px; height: 20px; }
.square-btn.sm { width: 34px; height: 34px; }
.square-btn.sm .ic { width: 16px; height: 16px; }

input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input:not([type]), select, textarea {
  width: 100%; height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; line-height: 1.5; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; tab-size: 2; }
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
input.is-expr, textarea.is-expr { border-color: var(--expr); background: var(--expr-bg); font-family: var(--mono); font-size: 12.5px; }
textarea.invalid { border-color: var(--danger); }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font-size: 11.5px; text-align: center; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw-track { width: 36px; height: 20px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.sw-thumb { 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 + .sw-track { background: var(--success); }
.switch input:checked + .sw-track .sw-thumb { transform: translateX(16px); }
.switch input:focus-visible + .sw-track { box-shadow: 0 0 0 3px var(--primary-tint); }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--primary); }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 3px 8px; cursor: pointer; color: var(--muted); font-size: 12px; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button .ic { width: 13px; height: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text); }
@media (max-width: 1500px) { .seg button span:not(.ic) { display: none; } }

.callout { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.callout .ic { margin-top: 2px; }
.callout.info { border-color: rgba(61, 139, 253, .3); background: rgba(61, 139, 253, .07); }
.callout.warn { border-color: rgba(245, 166, 35, .4); background: rgba(245, 166, 35, .1); }
.callout.error { display: block; border-color: rgba(242, 85, 79, .4); background: rgba(242, 85, 79, .08); color: var(--danger); white-space: pre-wrap; word-break: break-word; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------- shell */
.app { display: flex; height: 100vh; height: 100dvh; }
.nav {
  width: var(--nav-w); flex: none; display: flex; flex-direction: column; gap: 2px; padding: 14px 12px 10px;
  background: var(--surface); border-right: 1px solid var(--border); transition: width .15s, transform .2s ease; overflow-x: hidden; overflow-y: auto;
}
.nav-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 12px; }
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); min-width: 0; letter-spacing: -.01em; }
.nav-brand-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nav-entity { font-size: 11.5px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; }
.nav-entity:empty { display: none; }
/* the trip1view icon (web/brand/) on a dark tile — its mint ribbon would vanish on a light background */
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: #0b2b33; display: grid; place-items: center; flex: none; box-shadow: var(--shadow-sm); }
.brand-mark img { width: 72%; height: 72%; display: block; }
.brand-logo { display: none; } /* the full logo — only the teal header (web/brand/header-t1v.css, HDR-T1V) shows it */
.nav-close { display: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 8px; border: 0; background: none;
  color: var(--text-2); cursor: pointer; font-weight: 500; text-align: left; white-space: nowrap; width: 100%; transition: background .12s, color .12s;
}
.nav-item .ic { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item:focus-visible, .nav-user:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.nav-item.on { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.nav-item.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav-section { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 10px 6px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; margin: 0 4px; }
.dot.on { background: var(--success); }
.nav .grow { flex: 1; min-height: 12px; }
.app.nav-collapsed .nav { width: 68px; }
.app.nav-collapsed .nav-text, .app.nav-collapsed .nav-section { display: none; }
.app.nav-collapsed .nav-top { flex-direction: column; gap: 8px; }
.app.nav-collapsed .nav-item { justify-content: center; padding: 0; }
.app.nav-collapsed .nav-item.on::before { left: -12px; }
.nav-user {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 8px; padding: 10px 8px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; transition: background .12s, border-color .12s;
}
.nav-user:hover, .nav-user[aria-expanded="true"] { background: var(--surface-3); border-color: var(--border-strong); }
.nav-user[hidden] { display: none; }
.nav-user-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.nav-user-txt b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user-more { color: var(--muted); }
.app.nav-collapsed .nav-user { justify-content: center; padding: 8px 0; border-color: transparent; background: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.ctx-head { padding: 8px 10px 9px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.help-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.help-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.help-card .ic { color: var(--primary); flex: none; margin-top: 2px; }
.help-card span { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.help-links { display: flex; flex-wrap: wrap; gap: 8px; }
.help-tips { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.help-tips dt { font-weight: 600; }
.help-tips dd { margin: 0; color: var(--text-2); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* FTR-UTP080 FR-07: agency suspended with read-only access */
.ro-banner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: color-mix(in srgb, var(--warn) 16%, var(--bg, transparent)); border-bottom: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); font-size: 13px; }
.ro-banner svg { flex: none; width: 16px; height: 16px; color: var(--warn); }
/* FTR-UTP080 FR-29: the platform's payment reminder — flashes a few times when the app opens */
.bill-banner { flex-wrap: wrap; }
.bill-banner .bill-text { flex: 1 1 260px; }
.bill-banner.overdue, .bill-banner.suspended { background: color-mix(in srgb, var(--danger, #dc2626) 14%, var(--bg, transparent)); border-bottom-color: color-mix(in srgb, var(--danger, #dc2626) 45%, transparent); }
.bill-banner.overdue svg, .bill-banner.suspended svg { color: var(--danger, #dc2626); }
.bill-banner.flash { animation: bill-flash 1s ease-in-out 3; }
/* FR-31: a free trial is information, not a warning — no flash */
.bill-banner.trial { background: color-mix(in srgb, var(--info) 10%, var(--bg, transparent)); border-bottom-color: color-mix(in srgb, var(--info) 35%, transparent); animation: none; }
.bill-banner.trial svg { color: var(--info); }
@keyframes bill-flash { 50% { filter: brightness(1.18); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warn) 70%, transparent); } }
@media (prefers-reduced-motion: reduce) { .bill-banner.flash { animation: none; } }

/* mobile top bar + off-canvas sidebar (phones and small tablets) */
.topbar { display: none; }
.nav-backdrop { position: fixed; inset: 0; z-index: 89; background: rgba(15, 18, 30, .45); }
@media (max-width: 860px) {
  .topbar {
    display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px; flex: none; position: sticky; top: 0; z-index: 60;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .icon-btn { width: 40px; height: 40px; color: var(--text); }
  .topbar .icon-btn .ic { width: 22px; height: 22px; }
  .topbar-title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-user { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; }
  .topbar-user[hidden] { display: none; }
  .nav {
    position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); padding-top: 12px;
    transform: translateX(-102%); box-shadow: var(--shadow-lg); border-right: 0;
  }
  .app.nav-open .nav { transform: none; }
  .app.nav-collapsed .nav { width: min(300px, 86vw); }
  .app.nav-collapsed .nav-text, .app.nav-collapsed .nav-section { display: revert; }
  .app.nav-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  .app.nav-collapsed .nav-top { flex-direction: row; }
  .app.nav-collapsed .nav-user { justify-content: flex-start; padding: 10px 8px; border-color: var(--border); background: var(--surface-2); }
  .nav-collapse { display: none; }
  .nav-close { display: inline-grid; }
  .nav-item { height: 44px; font-size: 15px; }
  .nav-item.on::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }

/* global search (web/js/search.js) — the middle of the Global header; the sidebar's head with the side menu; the top bar on phones */
.gsearch { position: relative; display: flex; align-items: center; min-width: 0; margin: 0 2px 10px; }
.gsearch > .ic { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.gsearch input {
  width: 100%; height: 34px; padding: 0 64px 0 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .12s, background .12s, box-shadow .12s;
}
.gsearch input::placeholder { color: var(--muted); }
.gsearch input:hover { border-color: var(--border-strong); }
.gsearch input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.gsearch input::-webkit-search-cancel-button { display: none; }
.gsearch-key { position: absolute; right: 8px; font-size: 10.5px; font-weight: 600; line-height: 1; font-family: inherit; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; background: var(--surface); pointer-events: none; }
.gsearch input:focus ~ .gsearch-key { display: none; }
.app.nav-collapsed .gsearch { display: none; }
.gsearch-list {
  position: fixed; z-index: 120; max-height: min(70vh, 560px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
}
.gs-group + .gs-group { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.gs-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.gs-hit { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.gs-hit.on { background: var(--primary-tint); }
.gs-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-hit mark { background: none; color: var(--primary); font-weight: 700; }
.gs-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.gs-foot { border-top: 1px solid var(--border); margin-top: 6px; padding: 7px 10px 3px; font-size: 11.5px; color: var(--muted); }
#topbar-search { display: none; }
@media (max-width: 860px) {
  .nav .gsearch { display: none; }
  #topbar-search { display: inline-grid; }
  .topbar.searching .topbar-title, .topbar.searching #topbar-search, .topbar.searching .nav-brand { display: none; }
  .topbar .gsearch { flex: 1; margin: 0; }
  .topbar .gsearch-key { display: none; }
}

/* menu at the top (default; Salesforce style) — row 1 Global header: product name + account; row 2 Navigation bar: the
   workspace menu with More; row 3 Sub-menu bar: the active page's sub-menu.
   The sidebar comes back with #nav-layout / ?nav=side; phones keep the off-canvas menu. */
.nav-menu { display: contents; } /* sidebar: the items sit in the column as before */
.nav-item.nav-hidden, .nav-more[hidden] { display: none; }
.nav-layout .ic { width: 18px; height: 18px; }
@media (max-width: 860px) { .nav-layout, .nav-more { display: none; } }
@media (min-width: 861px) {
  .app.nav-horiz { flex-direction: column; }
  .app.nav-horiz .nav {
    width: auto; display: grid; grid-template-columns: auto 1fr auto auto auto; grid-template-rows: 48px 42px; align-items: center;
    gap: 0; padding: 0 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; transition: none;
  }
  .app.nav-horiz .nav > :not(.nav-menu, .nav-sub) { grid-row: 1; }
  /* sub-menu: the active page's own tabs, one row under the main menu, starting below the active item (app.js) */
  .app.nav-horiz .nav-sub {
    grid-row: 3; grid-column: 1 / -1; margin: 0 -16px; padding: 0 10px; height: 38px; display: flex; align-items: stretch;
    background: var(--surface-2); border-top: 1px solid var(--border); overflow: hidden; min-width: 0;
  }
  .app.nav-horiz .nav-sub[hidden] { display: none; }
  .app.nav-horiz .nav-sub .page-tabs { margin: 0; border: 0; gap: 2px; align-items: stretch; overflow-x: auto; }
  .app.nav-horiz .nav-sub .page-tabs a { padding: 0 12px; font-size: 13px; border-radius: 0; margin: 0; border-bottom: 2px solid transparent; }
  .app.nav-horiz .nav-sub .page-tabs a:hover { background: var(--surface-3); }
  .app.nav-horiz .nav-sub .page-tabs a.on { border-color: var(--primary); background: none; }
  .app.nav-horiz .nav-top { padding: 0; gap: 8px; }
  .app.nav-horiz .nav-brand { font-size: 15px; }
  .app.nav-horiz .nav-brand-txt { flex-direction: row; align-items: baseline; gap: 8px; }
  .app.nav-horiz .brand-mark { width: 28px; height: 28px; }
  .app.nav-horiz .nav-collapse, .app.nav-horiz .nav-section { display: none; }
  .app.nav-horiz .nav .grow { display: none; }
  .app.nav-horiz .gsearch { justify-self: center; width: min(560px, 100%); margin: 0 20px; }
  .app.nav-horiz .nav-menu {
    grid-row: 2; grid-column: 1 / -1; display: flex; align-items: stretch; height: 42px; margin: 0 -16px; padding: 0 10px;
    border-top: 1px solid var(--border); overflow: hidden; min-width: 0;
  }
  .app.nav-horiz .nav-item { width: auto; height: auto; flex: none; gap: 7px; padding: 0 12px; border-radius: 0; font-size: 13.5px; }
  .app.nav-horiz .nav-menu .nav-item { height: 42px; }
  .app.nav-horiz .nav-item .ic { width: 16px; height: 16px; }
  .app.nav-horiz .nav-item:hover { background: var(--surface-2); }
  .app.nav-horiz .nav-item.on { background: none; }
  .app.nav-horiz .nav-item.on::before { left: 8px; right: 8px; top: auto; bottom: 0; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .app.nav-horiz .nav-more { gap: 4px; }
  .app.nav-horiz .nav-more .ic { width: 14px; height: 14px; }
  .app.nav-horiz .nav > .nav-item { height: 36px; padding: 0 9px; border-radius: 8px; } /* Try it out: icons only, names in the tooltip */
  .app.nav-horiz .nav > .nav-item .nav-text { display: none; }
  .app.nav-horiz .nav-user { width: auto; flex: none; margin: 0 0 0 8px; padding: 3px 4px 3px 3px; gap: 8px; border-color: transparent; background: none; border-radius: 20px; }
  .app.nav-horiz .nav-user:hover, .app.nav-horiz .nav-user[aria-expanded="true"] { background: var(--surface-3); }
  .app.nav-horiz .nav-user-txt { flex: none; max-width: 180px; } /* the account, top right: avatar + name */
  .app.nav-horiz .nav-user-txt .muted { display: none; }
  .app.nav-horiz .main { min-height: 0; }
  .app.nav-horiz .page { max-width: 1400px; } /* use the width the sidebar gave back */
}

/* ------------------------------------------------------------- overview pages */
.page-wrap { flex: 1; overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 32px 36px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 360px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
.page-head p { margin: 6px 0 0; max-width: 760px; }
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 22px 0 18px; overflow-x: auto; scrollbar-width: none; }
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a { padding: 10px 12px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; white-space: nowrap; border-radius: 6px 6px 0 0; }
.page-tabs a:hover { color: var(--text); background: var(--surface-3); }
.page-tabs a.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.count { font-size: 11.5px; background: var(--surface-3); color: var(--muted); padding: 0 7px; border-radius: 99px; }
.split-btn { display: inline-flex; }
.split-btn .btn:first-child { border-radius: 6px 0 0 6px; }
.split-btn .btn.caret { border-radius: 0 6px 6px 0; padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, .35); }
.list-toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; flex-wrap: wrap; }
.list-toolbar .search-box { flex: 1 1 260px; }
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box > .ic { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search-box input { padding-left: 34px; }
.sort { width: auto; min-width: 200px; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: border-color .12s, box-shadow .12s; outline: none;
}
.row-card:hover, .row-card:focus-visible { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.rc-main { flex: 1; min-width: 0; }
.rc-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; align-items: center; flex-wrap: wrap; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); margin: 0 8px; opacity: .6; }
.rc-icons { display: flex; gap: 4px; }
.mini-node { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--c); background: var(--surface); }
.mini-node .ic { width: 14px; height: 14px; }
.rc-side { display: flex; align-items: center; gap: 10px; }

/* workflow tiles (Automate → Workflows) */
.wf-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.wf-tile { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; outline: none; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.wf-tile:hover, .wf-tile:focus-visible { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.wf-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.wf-tile.inactive .wf-map, .wf-tile.inactive .wf-path { opacity: .55; }
.wf-tile-h { display: flex; align-items: flex-start; gap: 8px; }
.wf-tile-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* read-only miniature of the editor canvas (pages.miniCanvas) — reuses the editor's .node / .edge styles */
.wf-mini-wrap { position: relative; }
.wf-mini { position: relative; overflow: hidden; border-radius: 8px; border: 1px solid var(--border); background-color: var(--canvas);
  background-image: radial-gradient(circle, var(--dots) 1px, transparent 1.2px); background-size: 12px 12px; }
.wf-mini-vp { position: absolute; transform-origin: 0 0; }
.wf-mini .node { cursor: inherit; }
.wf-mini .node:hover .node-box { border-color: var(--border-strong); }
.wf-mini .edge { stroke-width: 2.5; }
.wf-mini .edge.err { stroke: var(--danger); stroke-dasharray: 6 5; }
.wf-mini .port.out { cursor: inherit; }
.wf-mini .port.out:hover { transform: none; background: var(--edge); }
.wf-mini.tiny .port-label { display: none; }
/* small scale: keep node names readable (≈10.5px on screen), one line, as wide as the gap between nodes */
.wf-mini.tiny .node-label { width: calc(92px / var(--k)); top: calc(100% + 4px / var(--k)); }
.wf-mini.tiny .nl-name { font-size: calc(10.5px / var(--k)); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.wf-mini.more::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 70px; pointer-events: none;
  background: linear-gradient(to right, transparent, var(--canvas) 85%); }
.wf-mini-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.wf-mini-zoom { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 12px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; opacity: 0; transition: opacity .12s; }
.wf-mini-zoom .ic { width: 12px; height: 12px; }
.wf-tile:hover .wf-mini-zoom, .wf-tile:focus-within .wf-mini-zoom, .wf-mini-zoom:focus-visible { opacity: 1; }
.wf-mini-zoom:hover { color: var(--primary); border-color: var(--primary); }
.modal.wide.wf-preview-modal { width: min(1180px, 96vw); max-width: none; }
.wf-preview-scroll { overflow: auto; max-height: 70vh; border-radius: 8px; }
.wf-mini.big { border-radius: 8px; }
.wf-path-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* contacts — detailed list + documents */
.ct-kpis { margin-top: 18px; }
.tbl.ct-tbl { width: 100%; }
.tbl.ct-tbl td { vertical-align: middle; white-space: normal; padding: 8px 10px; overflow: visible; }
.tbl.ct-tbl td.num { white-space: nowrap; }
.ct-tbl .ct-who-txt .small { word-break: break-word; }
.ct-tbl tbody tr { cursor: pointer; }
.ct-tbl tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ct-who { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.ct-who-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ct-who-txt > div { display: flex; align-items: center; gap: 6px; }
.ct-who-txt > .chip { align-self: flex-start; }
.ct-latest { max-width: 240px; }
.ct-counts { display: inline-block; max-width: 150px; color: var(--text-2); line-height: 1.5; }
.ct-docs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ct-docs .ic { width: 13px; height: 13px; vertical-align: -2px; }
.ct-docview { display: flex; flex-direction: column; gap: 8px; }
.ct-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ct-doc-head p { margin: 0; }
.ct-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.ct-doc.soon { border-left: 3px solid var(--warn); }
.ct-doc.expired { border-left: 3px solid var(--danger); }
.ct-doc-ic { font-size: 22px; }
.ct-doc-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ct-doc-main .chip { margin-left: 6px; }
.ct-file-pick { display: flex; align-items: center; gap: 10px; }
.ct-exp, .ct-exp-spacer { width: 22px; height: 22px; flex: none; }
.ct-exp { display: grid; place-items: center; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  color: var(--primary); font-weight: 700; font-size: 15px; line-height: 1; cursor: pointer; }
.ct-exp:hover, .ct-exp.open { background: var(--primary-tint); border-color: var(--primary); }
.ct-exp:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ct-th-who { display: inline-flex; align-items: center; gap: 10px; }
.ct-th-who .link-btn { font-weight: 500; text-transform: none; letter-spacing: 0; }
.ct-tbl tr.ct-child td { background: var(--surface-2); border-top-style: dashed; }
.ct-tbl tr.ct-child:hover td { background: var(--surface-3); }
.ct-tbl tr.ct-child .ct-who { padding-left: 14px; }
.ct-branch { width: 14px; height: 18px; flex: none; margin-top: -10px; border-left: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); border-bottom-left-radius: 6px; }
.ct-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.ct-who-txt .ic { width: 13px; height: 13px; vertical-align: -2px; }
.drawer .np-tabs { gap: 16px; overflow-x: auto; scrollbar-width: none; }
.drawer .np-tabs::-webkit-scrollbar { display: none; }
.drawer .np-tabs button { white-space: nowrap; font-size: 13px; }
.ct-tbl tr.ct-child .ct-who-txt b { white-space: nowrap; }
.ct-notes { display: flex; flex-direction: column; gap: 10px; }
.ct-note-add { display: flex; flex-direction: column; gap: 8px; }
.ct-note-bar { display: flex; align-items: center; gap: 8px; }
.ct-note-bar .check input { margin-top: 0; }
.ct-note-bar .check { align-items: center; color: var(--text-2); }
.ct-note { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.ct-note.pinned { border-left: 3px solid var(--warn); }
.ct-note-head { display: flex; align-items: center; gap: 8px; }
.ct-note-head .icon-btn { width: 26px; height: 26px; }
.ct-note-body { white-space: pre-wrap; font-size: 13.5px; margin-top: 4px; word-break: break-word; }
.ct-audit { display: flex; flex-direction: column; }
.ct-audit-row { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ct-audit-when { width: 130px; flex: none; padding-top: 2px; }
.ct-audit-row .tl-head { flex-wrap: wrap; }
.ct-audit-row .tl-head .ic { width: 13px; height: 13px; vertical-align: -2px; }
.ct-audit-changes { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; word-break: break-word; }
@media (max-width: 640px) { .ct-audit-row { flex-direction: column; gap: 4px; } .ct-audit-when { width: auto; } }
.empty-hero.small { padding: 28px 16px; }

/* AiK attachments */
.aik-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.aik-file { text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.aik-file:hover { color: var(--primary); }
.aik-filelist { display: flex; flex-direction: column; gap: 4px; }
.aik-filerow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; min-width: 0; }

/* travellers & contacts (record drawer) */
.party .sec-h { margin-bottom: 10px; }
.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 0; }
.party-cell dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.party-cell dt .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.party-cell dd { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.party-who { display: flex; flex-direction: column; gap: 1px; }
.party-who .btn { align-self: flex-start; margin-top: 2px; }
.party-warn { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: #b26a00; }
:root[data-theme="dark"] .party-warn { color: var(--warn); }
.party-warn .ic { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.party-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.cp { position: relative; }
.cp input { height: 30px; font-size: 13px; }
.cp-results { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cp-results:empty { display: none; }
.cp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 7px 10px; border: 0; background: none; cursor: pointer; color: var(--text); }
.cp-item:hover, .cp-item:focus-visible { background: var(--surface-2); outline: none; }
.cp-none { padding: 8px 10px; }
@media (max-width: 640px) { .party-grid { grid-template-columns: 1fr; } }
.wf-tile-meta { display: flex; align-items: center; flex-wrap: wrap; }
.wf-tile-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); margin-top: auto; }

/* run health */
.hl-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.hl-badge .ic { width: 13px; height: 13px; }
.hl-badge.ok { background: rgba(47, 179, 122, .12); color: var(--success); }
.hl-badge.warn { background: rgba(245, 166, 35, .15); color: #b26a00; }
:root[data-theme="dark"] .hl-badge.warn { color: var(--warn); }
.hl-badge.bad { background: rgba(242, 85, 79, .12); color: var(--danger); }
.hl-badge.none { background: var(--surface-3); color: var(--muted); font-weight: 500; }
.hl-badge .muted { font-weight: 400; }
.hl-recent { display: inline-flex; gap: 2px; align-items: flex-end; }
.hl-tick { width: 5px; height: 14px; border-radius: 2px; background: var(--muted); opacity: .5; }
.hl-tick.success { background: var(--success); opacity: 1; }
.hl-tick.error { background: var(--danger); opacity: 1; height: 18px; }
.hl-kpis { margin-top: 4px; }
.kpi.static { cursor: default; }
.kpi.static:hover { box-shadow: none; border-color: var(--border); }
.kpi.static.ok .kpi-value { color: var(--success); }
.kpi.static.bad .kpi-value { color: var(--danger); }
.kpi.static.warn .kpi-value { color: #b26a00; }
:root[data-theme="dark"] .kpi.static.warn .kpi-value { color: var(--warn); }
.hl-legend { display: inline-flex; align-items: center; gap: 6px; }
.hl-key { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.hl-key.ok, .hl-bar .ok { background: var(--success); }
.hl-key.bad, .hl-bar .bad { background: var(--danger); }
.hl-key.other, .hl-bar .other { background: var(--muted); opacity: .5; }
.hl-rows { display: flex; flex-direction: column; }
.hl-row { display: grid; grid-template-columns: minmax(0, 360px) minmax(120px, 1fr) 150px; grid-template-areas: "name bar rate" "meta meta err";
  gap: 6px 14px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--border); }
.hl-row:first-child { border-top: 0; }
.hl-name { grid-area: name; display: flex; align-items: center; gap: 6px; min-width: 0; }
.hl-name a { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-name .chip .ic { width: 12px; height: 12px; }
.hl-bar { grid-area: bar; display: flex; height: 12px; border-radius: 3px; overflow: hidden; gap: 1px; background: var(--surface-3); }
.hl-rate { grid-area: rate; justify-self: end; }
.hl-meta { grid-area: meta; display: flex; align-items: center; gap: 8px; }
.hl-err { grid-area: err; justify-self: end; display: inline-flex; align-items: center; gap: 4px; color: var(--danger); max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-err .ic { width: 13px; height: 13px; flex: none; }
.hl-idle summary { cursor: pointer; font-weight: 600; }
.hl-idle-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hl-idle-list .chip { text-decoration: none; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.check-inline input { width: auto; height: auto; }
@media (max-width: 760px) {
  .hl-row { grid-template-columns: 1fr auto; grid-template-areas: "name rate" "bar bar" "meta meta" "err err"; }
  .hl-err { justify-self: start; }
}
.cred-icon { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--c); flex: none; background: var(--surface); }
.cred-icon .ic { width: 20px; height: 20px; }
.empty-hero { text-align: center; padding: 56px 20px; border: 1px dashed var(--border-strong); border-radius: 12px; background: var(--surface); }
.eh-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.eh-cards { display: flex; gap: 16px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.eh-card {
  width: 220px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--text);
}
.eh-card .ic { width: 28px; height: 28px; color: var(--primary); margin-bottom: 4px; }
.eh-card span { color: var(--muted); font-size: 12.5px; }
.eh-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }

/* --------------------------------------------------------------- editor head */
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ed-head {
  height: 56px; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs a { color: var(--muted); white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--border-strong); }
.wf-name { border-color: transparent !important; background: transparent !important; font-weight: 600; font-size: 15px; max-width: 380px; padding: 0 6px; }
.wf-name:hover { border-color: var(--border-strong) !important; }
.wf-name:focus { border-color: var(--primary) !important; background: var(--surface) !important; }
.ed-tabs { display: flex; background: var(--surface-3); border-radius: 8px; padding: 3px; }
.ed-tabs a { padding: 5px 16px; border-radius: 6px; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 13.5px; }
.ed-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.ed-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.active-switch { color: var(--muted); font-weight: 500; margin-right: 6px; }
.active-switch.is-on { color: var(--success); }
.ed-body { flex: 1; min-height: 0; position: relative; display: flex; }

/* -------------------------------------------------------------------- canvas */
.canvas-wrap { flex: 1; position: relative; overflow: hidden; }
.canvas {
  position: absolute; inset: 0; overflow: hidden; background-color: var(--canvas); touch-action: none;
  background-image: radial-gradient(circle, var(--dots) 1px, transparent 1.2px);
}
.canvas.panning { cursor: grabbing; }
.canvas.connecting, .canvas.connecting * { cursor: crosshair !important; }
.viewport { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edge { fill: none; stroke: var(--edge); stroke-width: 2; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.edge-g:hover .edge { stroke: var(--text-2); }
.edge-g.taken .edge { stroke: var(--success); }
.edge-g.selected .edge { stroke: var(--primary); stroke-width: 2.5; }
.edge.temp { stroke: var(--primary); stroke-dasharray: 6 5; }
.edge-tools { opacity: 0; transition: opacity .1s; pointer-events: none; }
.edge-g:hover .edge-tools, .edge-g.selected .edge-tools { opacity: 1; pointer-events: all; }
.edge-tool { cursor: pointer; color: var(--text-2); }
.edge-tool rect { fill: var(--surface); stroke: var(--border-strong); }
.edge-tool:hover { color: var(--primary); }
.edge-tool:hover rect { stroke: var(--primary); }
.edge-tool.danger:hover { color: var(--danger); }
.edge-tool.danger:hover rect { stroke: var(--danger); }

.node { position: absolute; width: 100px; user-select: none; cursor: pointer; }
.node-box {
  position: absolute; inset: 0; border: 2px solid var(--node-border); border-radius: 10px; background: var(--surface);
  display: grid; place-items: center; transition: border-color .12s, box-shadow .12s;
}
.node-box > .ic { width: 42px; height: 42px; color: var(--c); }
.node-box > .ic svg { stroke-width: 1.6; }
.node-box > .ic.emoji { font-size: 34px; }
.node:hover .node-box { border-color: var(--text-2); }
.node.trigger .node-box { border-radius: 40px 10px 10px 40px; }
.node.selected .node-box { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.node.drop-target .node-box { border-color: var(--success); box-shadow: 0 0 0 4px rgba(47, 179, 122, .2); }
.node.st-success .node-box { border-color: var(--success); }
.node.st-error .node-box { border-color: var(--danger); }
.node.disabled .node-box { opacity: .55; border-style: dashed; }
.node.disabled .node-box::after { content: ""; position: absolute; left: 12px; right: 12px; top: 50%; height: 2px; background: var(--muted); transform: rotate(-35deg); }
.node-badge { position: absolute; right: 6px; bottom: 6px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; }
.node-badge .ic { width: 12px; height: 12px; }
.node-badge.ok { color: var(--success); }
.node-badge.ok .ic { width: 18px; height: 18px; }
.node-badge.err { color: var(--danger); }
.node-badge.err .ic { width: 18px; height: 18px; }
.node-attempts { position: absolute; left: 6px; bottom: 5px; font-size: 10.5px; color: var(--muted); }
.trigger-bolt { position: absolute; left: -26px; top: 50%; transform: translateY(-50%); color: var(--primary); }
.trigger-bolt .ic { width: 18px; height: 18px; fill: var(--primary); }

.port { position: absolute; z-index: 2; }
.port.in { left: -6px; top: 50%; margin-top: -8px; width: 8px; height: 16px; border-radius: 2px; background: var(--edge); }
.port.out { right: -7px; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--edge); border: 2px solid var(--canvas); cursor: crosshair; }
.port.out:hover { background: var(--primary); transform: scale(1.2); }
.port.out.err { background: var(--danger); }
.port-label { position: absolute; left: 16px; top: -5px; font-size: 11px; color: var(--muted); white-space: nowrap; pointer-events: none; background: var(--canvas); padding: 0 3px; border-radius: 3px; }
.port.err .port-label { color: var(--danger); }
.plus-stub { position: absolute; left: 10px; top: -1px; display: flex; align-items: center; height: 12px; }
.plus-stub.labeled { left: 10px; }
.stub-line { width: 40px; height: 2px; background: var(--edge); }
.plus-stub.labeled .stub-line { width: 60px; }
.plus-btn {
  width: 24px; height: 24px; margin-top: 0; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface); color: var(--text-2);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.plus-btn .ic { width: 14px; height: 14px; }
.plus-btn:hover { color: var(--primary); border-color: var(--primary); }

.node-toolbar {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); display: flex; gap: 2px; padding: 2px;
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
.node:hover .node-toolbar { opacity: 1; pointer-events: all; }
.tb-btn { width: 26px; height: 26px; border: 0; border-radius: 5px; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.tb-btn:hover { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tb-btn .ic { width: 15px; height: 15px; }
.node-label { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 180px; text-align: center; pointer-events: none; }
.nl-name { font-weight: 600; font-size: 13.5px; line-height: 1.25; word-break: break-word; }
.nl-off { color: var(--muted); font-weight: 400; }
.nl-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nl-note { font-size: 11.5px; color: var(--text-2); margin-top: 4px; font-style: italic; }

.canvas-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; }
.add-first {
  pointer-events: all; width: 100px; height: 100px; border: 2px dashed var(--border-strong); border-radius: 10px; background: transparent;
  display: grid; place-items: center; color: var(--muted); cursor: pointer;
}
.add-first .ic { width: 36px; height: 36px; }
.add-first:hover { border-color: var(--primary); color: var(--primary); }
.add-first-label { font-weight: 600; color: var(--text-2); }
.canvas-tr { position: absolute; top: 16px; right: 16px; z-index: 5; }
.canvas-bl { position: absolute; left: 16px; bottom: 16px; display: flex; gap: 6px; z-index: 5; }
.canvas-bc { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 10px; z-index: 5; }
.test-group { display: inline-flex; }
.test-group .btn:first-child { border-radius: 8px 0 0 8px; }
.test-group .btn.caret { border-radius: 0 8px 8px 0; padding: 0 11px; border-left: 1px solid rgba(255, 255, 255, .35); }

/* -------------------------------------------------------------- nodes panel */
.creator {
  position: absolute; top: 0; right: 0; bottom: 0; width: 380px; z-index: 20; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .18s ease;
}
.creator.open { transform: none; }
.cr-head { display: flex; align-items: flex-start; gap: 8px; padding: 18px 16px 10px; }
.cr-title-main { font-size: 17px; font-weight: 600; }
.cr-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cr-search { position: relative; margin: 0 16px 8px; }
.cr-search > .ic { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.cr-search input { height: 38px; padding-left: 36px; }
.cr-body { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.cr-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 10px; border: 0; border-left: 2px solid transparent; background: none;
  text-align: left; cursor: pointer; border-radius: 0 6px 6px 0; color: var(--text);
}
.cr-item:hover, .cr-item.active { background: var(--surface-2); border-left-color: var(--primary); }
.cr-icon { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--c); flex: none; background: var(--surface); }
.cr-icon .ic { width: 20px; height: 20px; }
.cr-icon.cat { color: var(--text-2); }
.cr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-title { font-weight: 600; }
.cr-desc { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.cr-chev { color: var(--muted); }
.cr-sep { height: 1px; background: var(--border); margin: 8px 10px; }
.cr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 0; color: var(--muted); }
.cr-empty .ic { width: 28px; height: 28px; }

/* ---------------------------------------------------------------------- NDV */
.ndv-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(15, 18, 25, .78); display: flex; padding: 22px 26px; }
.ndv { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ndv-top { height: 34px; display: flex; align-items: center; }
.ndv-back { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: #fff; cursor: pointer; font-weight: 500; opacity: .9; }
.ndv-back:hover { opacity: 1; }
.ndv-cols { flex: 1; display: flex; min-height: 0; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-lg); }
.ndv-io { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.ndv-params { width: 520px; flex: none; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); border-right: 1px solid var(--border); z-index: 1; box-shadow: 0 0 24px rgba(0, 0, 0, .08); }
.ndv.no-input .ndv-params { width: 560px; border-left: 0; }
.io-head { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 48px; border-bottom: 1px solid var(--border); flex: none; }
.io-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
.io-src { width: auto; max-width: 220px; height: 28px; font-size: 13px; }
.io-src-label { color: var(--muted); font-size: 13px; }
.io-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.io-status .ic { width: 13px; height: 13px; }
.io-status.success { color: var(--success); background: rgba(47, 179, 122, .1); }
.io-status.error { color: var(--danger); background: rgba(242, 85, 79, .1); }
.io-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.io-hint { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.io-hint .ic { width: 13px; height: 13px; }
.io-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--muted); padding: 30px; }
.io-empty > .ic { width: 30px; height: 30px; }
.io-empty-title { font-weight: 600; color: var(--text-2); font-size: 15px; }
.io-empty-text { max-width: 260px; font-size: 13px; margin-bottom: 6px; }
.io-extra > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.io-note { font-size: 13px; color: var(--muted); }
.np-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 60px; border-bottom: 1px solid var(--border); flex: none; }
.np-icon { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; color: var(--c); flex: none; }
.np-icon .ic { width: 22px; height: 22px; }
.np-name { height: 28px; border-color: transparent !important; background: transparent !important; font-weight: 600; font-size: 15px; padding: 0 6px; margin-left: -6px; }
.np-name:hover { border-color: var(--border-strong) !important; }
.np-name:focus { border-color: var(--primary) !important; background: var(--surface) !important; }
.np-type { font-size: 12px; color: var(--muted); }
.np-tabs { display: flex; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; }
.np-tabs button { border: 0; background: none; padding: 11px 0; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.np-tabs button.on { color: var(--primary); border-color: var(--primary); }
.np-body { flex: 1; overflow-y: auto; padding: 16px; }
.np-desc { margin: 0; color: var(--muted); font-size: 13px; }
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.row-field { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.row-field .f-hint { flex-basis: 100%; }
.f-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 3px; }
.req { color: var(--danger); }
.f-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.f-control { display: flex; flex-direction: column; gap: 4px; }
.expr-result { display: flex; gap: 8px; font-size: 12px; padding: 6px 8px; border-radius: 0 0 6px 6px; background: var(--surface-2); border: 1px solid var(--border); border-top: 0; margin-top: -5px; }
.expr-result .er-label { color: var(--muted); font-weight: 600; flex: none; }
.expr-result .er-val { font-family: var(--mono); word-break: break-all; white-space: pre-wrap; color: var(--text); }
.expr-result.err .er-val { color: var(--danger); }
.cred-row { position: relative; }
.cred-row > .ic { position: absolute; left: 10px; top: 9px; color: var(--muted); pointer-events: none; }
.cred-row select { padding-left: 32px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.info-card > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.info-card[open] > summary { margin-bottom: 10px; }
.info-card > * + * { margin-top: 8px; }
.url-box { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.url-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.url-row { display: flex; align-items: center; gap: 6px; }
.url-row code { flex: 1; word-break: break-all; color: var(--text); }
.url-row.ref { border: 1px solid var(--border); border-radius: 6px; padding: 3px 4px 3px 10px; }
.code-block { margin: 0; padding: 10px 12px; background: var(--surface-3); border-radius: 6px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }

/* schema / json / table data views */
.schema, .sc-children { display: flex; flex-direction: column; gap: 4px; }
.sc-children { padding-left: 18px; margin: 4px 0 2px; border-left: 1px dashed var(--border-strong); margin-left: 9px; }
.sc-det > summary { list-style: none; cursor: pointer; }
.sc-det > summary::-webkit-details-marker { display: none; }
.sc-item { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.sc-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 3px; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); cursor: grab; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.sc-pill:hover { border-color: var(--primary); color: var(--primary); }
.sc-type { min-width: 20px; height: 18px; padding: 0 3px; border-radius: 3px; background: var(--surface-3); color: var(--muted); font-size: 10px; display: grid; place-items: center; font-family: var(--mono); }
.sc-val { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sc-empty { color: var(--muted); font-size: 12px; font-style: italic; }
.json-box { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 12px; overflow: auto; max-height: 420px; }
.json-box.flat { max-height: none; }
.jt-children { padding-left: 14px; }
.json-box > .jt-children { padding-left: 0; }
.jt-row { white-space: nowrap; }
.jt-row summary { cursor: pointer; list-style: none; }
.jt-row summary::-webkit-details-marker { display: none; }
.jt-row summary::before { content: "▸ "; color: var(--muted); }
.jt-row details[open] > summary::before { content: "▾ "; }
.jt-row.leaf { padding-left: 13px; }
.jk { color: #c2410c; }
:root[data-theme="dark"] .jk { color: #fdba74; }
.jk.pick { cursor: pointer; border-radius: 3px; }
.jk.pick:hover { background: var(--primary-tint); text-decoration: underline; }
.jv.string { color: #15803d; white-space: pre-wrap; word-break: break-all; }
.jv.number { color: #1d4ed8; }
.jv.boolean { color: #9333ea; }
:root[data-theme="dark"] .jv.string { color: #86efac; }
:root[data-theme="dark"] .jv.number { color: #93c5fd; }
:root[data-theme="dark"] .jv.boolean { color: #d8b4fe; }
.jv.null, .jmeta, .jcolon { color: var(--muted); }
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.tbl { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.tbl th { background: var(--surface-3); text-align: left; padding: 6px 10px; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 6px 10px; border-top: 1px solid var(--border); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------------------------------------------- executions */
.ex-split { flex: 1; display: flex; min-height: 0; background: var(--bg); }
.page-ex { height: calc(100vh - 210px); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ex-list { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); }
.ex-filters { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--border); }
.ex-filters select { height: 30px; font-size: 13px; }
.ex-items { flex: 1; overflow-y: auto; padding: 6px; }
.ex-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; border-left: 3px solid transparent; }
.ex-item:hover { background: var(--surface-2); }
.ex-item.on { background: var(--surface-3); }
.ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-time { font-weight: 600; font-size: 13px; }
.ex-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.st-dot.success { background: var(--success); }
.st-dot.error { background: var(--danger); }
.mode-chip { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.ex-detail { flex: 1; overflow-y: auto; padding: 22px 26px 40px; min-width: 0; }
.exd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.exd-head h2 { margin: 0 0 2px; font-size: 18px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--surface-3); }
.badge.success { color: var(--success); background: rgba(47, 179, 122, .12); }
.badge.error { color: var(--danger); background: rgba(242, 85, 79, .12); }
.steps-title { margin: 20px 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; padding: 0 12px; }
.step > summary { display: flex; align-items: center; gap: 9px; padding: 10px 0; cursor: pointer; list-style: none; }
.step > summary::-webkit-details-marker { display: none; }
.step[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.step > .json-box, .step > pre, .step > .callout { margin-bottom: 12px; }
.step.st-error { border-color: rgba(242, 85, 79, .5); }
.step-icon { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; display: grid; place-items: center; color: var(--c); }
.step-icon .ic { width: 15px; height: 15px; }
.branch { color: var(--info); font-size: 12px; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-bottom: 12px; }
.io-grid .io-title { margin-bottom: 6px; }

/* ------------------------------------------------------------- menus, modals */
.ctx-menu { position: fixed; z-index: 300; min-width: 210px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); }
.ctx-item { width: 100%; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; text-align: left; color: var(--text); font-size: 13.5px; }
.ctx-item:hover:not(:disabled) { background: var(--surface-3); }
.ctx-item:disabled { opacity: .45; cursor: default; }
.ctx-item .ic { width: 15px; height: 15px; color: var(--muted); }
.ctx-item.danger, .ctx-item.danger .ic { color: var(--danger); }
.ctx-item kbd { font-size: 10.5px; border-bottom-width: 1px; color: var(--muted); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

.modal-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(15, 18, 25, .55); display: grid; place-items: center; padding: 16px; }
.modal { width: min(500px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(660px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { padding: 12px 20px 16px; overflow-y: auto; }
.modal-body p { margin-top: 0; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.cred-form { display: flex; flex-direction: column; gap: 14px; }
.cred-head { display: flex; align-items: center; gap: 12px; }
.cred-head input { font-weight: 600; font-size: 15px; }
.cred-result { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 6px; font-size: 13px; background: var(--surface-2); }
.cred-result.ok { color: var(--success); background: rgba(47, 179, 122, .1); }
.cred-result.err { color: var(--danger); background: rgba(242, 85, 79, .08); }
.type-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; max-height: 50vh; overflow-y: auto; }
.type-item { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; color: var(--text); }
.type-item:hover { border-color: var(--primary); }
.kbd-table { width: 100%; border-collapse: collapse; }
.kbd-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); }
.kbd-table td:last-child { text-align: right; white-space: nowrap; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 400; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 460px; padding: 12px 14px; border-radius: 8px; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--info); box-shadow: var(--shadow-lg); transition: opacity .3s, transform .3s;
}
.toast.ok { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }
.toast-act { border: 0; background: none; color: var(--primary); font-weight: 600; cursor: pointer; }

/* --------------------------------------------------------------- simulator */
.simulator {
  --wa-bg: #efeae2; --wa-head: #f0f2f5; --wa-in: #d9fdd3; --wa-out: #ffffff; --wa-text: #111b21; --wa-muted: #667781; --wa-link: #027eb5;
  position: fixed; right: 20px; top: 70px; bottom: 20px; width: 370px; z-index: 90; display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); color: var(--wa-text); background: var(--wa-bg);
}
:root[data-theme="dark"] .simulator { --wa-bg: #0b141a; --wa-head: #202c33; --wa-in: #005c4b; --wa-out: #202c33; --wa-text: #e9edef; --wa-muted: #8696a0; --wa-link: #53bdeb; }
.sim-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--wa-head); }
.sim-head .icon-btn { color: var(--wa-muted); }
.sim-avatar { width: 36px; height: 36px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; }
.sim-avatar .ic { width: 20px; height: 20px; }
.sim-title { font-weight: 600; }
.sim-sub { font-size: 11.5px; color: var(--wa-muted); }
.sim-identity { display: flex; gap: 8px; padding: 6px 12px 8px; background: var(--wa-head); border-top: 1px solid rgba(0, 0, 0, .05); }
.sim-identity label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--wa-muted); flex: 1; }
.sim-identity input { height: 26px; font-size: 12px; padding: 0 6px; background: var(--wa-bg); border-color: transparent; color: var(--wa-text); }
.sim-messages { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 84%; padding: 6px 9px 18px; border-radius: 8px; position: relative; word-wrap: break-word; font-size: 14px; min-width: 70px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
.bubble.in { align-self: flex-end; background: var(--wa-in); border-top-right-radius: 2px; padding-bottom: 6px; }
.bubble.out { align-self: flex-start; background: var(--wa-out); border-top-left-radius: 2px; }
.bubble.has-actions { padding-bottom: 0; min-width: 230px; }
.b-header { font-weight: 700; margin-bottom: 3px; }
.b-footer { color: var(--wa-muted); font-size: 12px; margin-top: 4px; }
.b-desc { color: var(--wa-muted); font-size: 12px; }
.b-time { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: var(--wa-muted); }
.has-actions .b-time { position: static; display: block; text-align: right; margin: 2px 0 4px; }
.b-actions { display: flex; flex-direction: column; border-top: 1px solid rgba(134, 150, 160, .25); margin: 0 -9px; }
.b-actions button, .b-list button { display: flex; align-items: center; justify-content: center; gap: 6px; background: none; border: 0; color: var(--wa-link); padding: 9px; cursor: pointer; border-top: 1px solid rgba(134, 150, 160, .25); font-weight: 500; }
.b-actions button:first-child { border-top: 0; }
.b-actions button .ic { width: 14px; height: 14px; }
.b-actions button:hover, .b-list button:hover { background: rgba(134, 150, 160, .08); }
.b-list { margin: 0 -9px; border-top: 1px solid rgba(134, 150, 160, .25); }
.b-list button { display: block; width: 100%; text-align: left; color: var(--wa-text); padding: 8px 12px; font-weight: 400; }
.b-img { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; }
.sim-sys { align-self: center; background: var(--wa-out); color: var(--wa-muted); font-size: 12px; padding: 6px 10px; border-radius: 7px; text-align: center; max-width: 92%; box-shadow: 0 1px .5px rgba(11, 20, 26, .1); }
.sim-sys.err { color: var(--danger); }
.sim-form { display: flex; gap: 8px; padding: 8px 10px; background: var(--wa-head); }
.sim-form input { height: 40px; border-radius: 20px; background: var(--wa-out); border-color: transparent; padding: 0 16px; color: var(--wa-text); }
.sim-send { width: 40px; height: 40px; border-radius: 50%; background: #00a884; border: 0; color: #fff; cursor: pointer; flex: none; display: grid; place-items: center; }
.sim-send .ic { width: 18px; height: 18px; }

@media (max-width: 1200px) {
  .ndv-params, .ndv.no-input .ndv-params { width: 440px; }
  .ndv-wrap { padding: 12px; }
}
@media (max-width: 900px) {
  .ed-head { grid-template-columns: 1fr auto; }
  .ed-tabs { display: none; }
  .ndv-io.in { display: none; }
  .ex-list { width: 260px; }
}

/* ---------------------------------------------------------- contacts / CRM */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-tint); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip .ic { width: 12px; height: 12px; }
.chip.warn { background: rgba(245, 166, 35, .15); color: #b26a00; }
.chip.ok { background: rgba(47, 179, 122, .12); color: var(--success); }
:root[data-theme="dark"] .chip.warn { color: #fbbf24; }
.chip.src-whatsapp { background: rgba(37, 211, 102, .12); color: #128c4b; }
.chip.src-webchat { background: rgba(8, 145, 178, .12); color: #0e7490; }
.chip.src-website, .chip.src-form { background: rgba(37, 99, 235, .1); color: #2563eb; }
.drawer-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(15, 18, 25, .35); display: flex; justify-content: flex-end; }
.drawer { width: min(620px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-title { font-size: 17px; font-weight: 600; }
.drawer-profile { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.state-row { display: flex; align-items: center; gap: 8px; height: 34px; }
.drawer .np-tabs { padding: 0 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 12px; }
.tl-add { display: flex; gap: 8px; align-items: flex-start; }
.tl-add textarea { min-height: 38px; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tl-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.t-quote .tl-icon { background: rgba(47, 179, 122, .12); color: var(--success); }
.t-task .tl-icon { background: rgba(245, 166, 35, .15); color: #b26a00; }
.t-chat .tl-icon { background: rgba(8, 145, 178, .12); color: #0e7490; }
.tl-head { display: flex; align-items: center; gap: 8px; }
.tl-body { white-space: pre-wrap; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.tl-quote { font-size: 13px; margin-top: 4px; }
.tl-chat > summary { cursor: pointer; color: var(--primary); font-size: 12.5px; margin: 4px 0; }
.link-btn.inline { margin-left: 10px; }
.conv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.conv, .tl-chat { display: flex; flex-direction: column; gap: 6px; }
.mini-bubble { max-width: 85%; padding: 6px 10px; border-radius: 10px; font-size: 13px; background: var(--surface-3); align-self: flex-start; }
.mini-bubble.user { align-self: flex-end; background: rgba(37, 211, 102, .16); }
.mb-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.sched { margin: 0 0 8px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--surface-2); }
.sched > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 13px; padding: 2px; }
.sched-item { display: flex; align-items: center; gap: 8px; padding: 6px 2px; }
.sched-item.boxed { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.var-list { display: flex; flex-direction: column; margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.var-head, .var-row { display: grid; grid-template-columns: 300px 1fr 34px; gap: 16px; align-items: start; padding: 12px 14px; }
.var-head { padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.var-row + .var-row { border-top: 1px solid var(--border); }
.var-key { display: flex; flex-direction: column; gap: 3px; padding: 8px 12px; background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 6px; min-width: 0; }
.var-key .var-title { font-weight: 600; font-size: 13.5px; color: var(--text); }
.var-key input.var-name { height: 24px; padding: 0 4px; margin-left: -4px; background: transparent; border-color: transparent; font-size: 12px; color: var(--text-2); }
.var-key input.var-name:hover { border-color: var(--border); }
.var-key input.var-name:focus { background: var(--surface); }
.var-ref { font-size: 11px; color: var(--muted); }
.var-val { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.var-empty { padding: 18px 14px; }
@media (max-width: 800px) { .var-head { display: none; } .var-row { grid-template-columns: 1fr 34px; } .var-val { grid-column: 1; } }

/* ------------------------------------------------- templates / agents / settings */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; transition: border-color .12s, box-shadow .12s; }
.tpl-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.tpl-icon { font-size: 26px; line-height: 1; }
.tpl-name { font-weight: 600; font-size: 15px; display: flex; align-items: center; }
.tpl-desc { color: var(--text-2); font-size: 13px; flex: 1; }
.tpl-intents { display: flex; flex-wrap: wrap; gap: 4px; }
.tpl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.set-section { margin-top: 26px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.set-section h3 { margin: 0 0 4px; font-size: 15px; }
.set-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.set-head p { margin: 0; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 12px 0 2px; border-top: 1px solid var(--border); } /* one setting: name + hint, switch on the right */
.set-row .muted.small { margin-top: 2px; }
.row-card.static { cursor: default; }
.row-card.static > .ic { color: var(--muted); }
.eps { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ep { display: grid; grid-template-columns: 56px minmax(0, auto) 30px 1fr; align-items: center; gap: 8px; }
.ep code { word-break: break-all; }
.ep-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.method { font-size: 11px; font-weight: 700; text-align: center; padding: 2px 0; border-radius: 4px; background: var(--surface-3); }
.method.m-post { color: #b26a00; background: rgba(245, 166, 35, .15); }
.method.m-get { color: var(--success); background: rgba(47, 179, 122, .12); }
.ev-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.ev-list .check { align-items: center; }
/* embed mode: suite apps iframe the editor without trip1view chrome */
.embed .nav { display: none; }
.embed .crumbs a, .embed .crumbs .sep { display: none; }

/* ------------------------------------------------------------------ records */
.tpl-section { margin: 22px 0 10px; font-size: 14px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.tpl-card.suite { border-top: 3px solid var(--primary); }
/* ------------------------------------------------------------------ dashboards */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 12px; margin-top: 22px; }
.kpi { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font: inherit; color: var(--text); transition: border-color .12s, box-shadow .12s; }
.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi:focus-visible { outline: 2px solid var(--viz-1); outline-offset: 2px; }
.kpi.on { border-color: var(--viz-1); box-shadow: 0 0 0 1px var(--viz-1) inset; }
.kpi-label { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.kpi-value { font-size: 30px; font-weight: 600; line-height: 1.15; }
.dash-panel { margin-top: 18px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.dash-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dash-h h3 { margin: 0; font-size: 15px; font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 2px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 200px) 1fr 90px; align-items: center; gap: 12px; padding: 6px 8px; border: 0;
  border-radius: 6px; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; min-height: 32px; }
.bar-row:hover:not(:disabled), .bar-row.on { background: var(--surface-2); }
.bar-row.on .bar-label { font-weight: 600; }
.bar-row:disabled { cursor: default; color: var(--muted); }
.bar-row:focus-visible { outline: 2px solid var(--viz-1); outline-offset: -2px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 18px; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-matrix td.on, .dash-matrix tr.on td { background: var(--surface-2); }
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.linkish:hover { color: var(--viz-1); }
.meter-wrap { display: inline-flex; align-items: center; gap: 8px; }
.meter { display: inline-block; width: 64px; height: 6px; border-radius: 99px; background: var(--viz-track); overflow: hidden; vertical-align: middle; }
.meter-fill { display: block; height: 100%; background: var(--viz-1); border-radius: 99px; }
.meter-num { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.lead-signals { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lead-signal { display: grid; grid-template-columns: 170px 70px 1fr; gap: 10px; align-items: center; font-size: 13px; }
.aik-row .rc-title { display: flex; gap: 8px; align-items: center; }
.aik-content { white-space: pre-wrap; color: var(--text-2); font-size: 12.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 1fr 70px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .lead-signal { grid-template-columns: 1fr 60px; }
  .lead-signal .muted { grid-column: 1 / -1; }
}
.tpl-card.mod-on { border-top: 3px solid var(--success); }
.tpl-card.mod-locked { background: var(--surface-2); }
.tpl-card.mod-locked .tpl-icon, .tpl-card.mod-locked .tpl-name, .tpl-card.mod-locked .tpl-desc { opacity: .6; }
.tpl-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dash-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dash-range select { width: auto; min-width: 150px; }
.dash-range input[type=date] { width: 150px; color-scheme: light dark; }
.sub-card { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.sub-card .grow { flex: 1; }
.sub-card b { font-size: 15px; }
.suite-list summary { cursor: pointer; color: var(--primary); font-size: 13px; }
.suite-list ol { margin: 6px 0 0; padding-left: 20px; font-size: 12.5px; color: var(--text-2); }
.rec-table { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.tbl.rec tbody tr { cursor: pointer; }
.tbl.rec tbody tr:hover td { background: var(--surface-2); }
.tbl.rec td { max-width: 320px; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-filter { width: 220px !important; }
.chip.st.bad { background: rgba(242, 85, 79, .12); color: var(--danger); }
.rec-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border-radius: 6px; background: var(--primary-tint); color: var(--primary); }
.status-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.rec-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.doc-row.clickable { cursor: pointer; }
.doc-row.clickable:hover { background: var(--surface-2); }
.rec-section .sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rec-section .sec-h h4 { margin: 0; }
.rec-section .sec-h .tpl-btns { gap: 6px; }
.rec-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.rec-kv dt, .rd-grid dt { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 3px; }
.rec-kv dd, .rd-grid dd { margin: 0; font-size: 14px; color: var(--text); word-break: break-word; }
.rec-kv > div, .rd-item { min-width: 0; }
.linked-tbl td, .linked-tbl th { padding: 7px 8px; }
.linked-tbl tbody tr { cursor: pointer; }
.linked-tbl tbody tr:hover { background: var(--surface-2); }
.linked-group + .linked-group { margin-top: 14px; }
.tab-count { margin-left: 5px; font-size: 11px; padding: 0 6px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); }

/* readable data (util.readableData) */
.rd { display: flex; flex-direction: column; gap: 10px; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; margin: 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.rd-item.wide { grid-column: 1 / -1; }
.rd-empty { color: var(--muted); }
.rd-num { font-variant-numeric: tabular-nums; }
.rd-text { white-space: pre-wrap; }
.rd-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.rd-link { display: inline-flex; align-items: center; gap: 4px; word-break: break-all; }
.rd-link .ic { width: 12px; height: 12px; flex: none; }
.rd-group { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.rd-group > summary { cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13px; list-style-position: inside; }
.rd-group[open] > summary { border-bottom: 1px solid var(--border); }
.rd-group-body { padding: 10px 12px; }
.rd-group-body > .rd > .rd-grid { background: none; border: 0; padding: 0; }
.rd-table { overflow-x: auto; }
.rd-table .tbl td, .rd-table .tbl th { padding: 6px 8px; font-size: 13px; vertical-align: top; }
.rd-cards { display: flex; flex-direction: column; gap: 8px; }
.rd-card { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.rd-card-h { margin-bottom: 6px; font-weight: 600; }
.rd-card .rd-grid { background: none; border: 0; padding: 0; }
@media (max-width: 640px) { .rec-kv { grid-template-columns: 1fr; } }
.audit { display: flex; flex-direction: column; }
.audit-row { display: flex; gap: 10px; padding: 8px 0; border-left: 2px solid var(--border); padding-left: 12px; margin-left: 4px; position: relative; }
.audit-dot { position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

/* ======================================================= app polish & responsive
   One layer on top of the component rules above: softer cards, clearer tables and tiles, consistent radii, and the
   phone / tablet layout. Keep new screens on these tokens. */
.btn { border-radius: 8px; height: 34px; }
.btn.small { height: 30px; border-radius: 7px; }
.btn.danger.primary, .btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], input[type=email], input[type=tel], input:not([type]), select {
  height: 36px; border-radius: 8px;
}
input[type=email], input[type=tel] { width: 100%; padding: 0 10px; background: var(--surface); border: 1px solid var(--border-strong); outline: none; }
textarea { border-radius: 8px; }
.icon-btn { border-radius: 8px; }
.icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* cards */
.kpi, .dash-panel, .set-section, .rec-table, .row-card, .empty-hero { border-radius: 12px; }
.kpi, .dash-panel, .set-section, .rec-table, .row-card { box-shadow: var(--shadow-sm); border-color: var(--border); }
.kpi { padding: 16px 18px; gap: 6px; transition: border-color .12s, box-shadow .12s, transform .12s; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset, var(--shadow-sm); }
.kpi:focus-visible { outline-color: var(--primary); }
.kpi-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.kpi-value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dash-panel { padding: 18px 20px; margin-top: 20px; }
.dash-h h3, .set-section h3 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
.set-section { padding: 20px 22px; }

/* tables */
.tbl th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 12px; }
.tbl.rec { font-size: 13px; }
.tbl.rec tbody tr:hover td { background: var(--primary-tint); }
.ct-tbl tr.ct-child:hover td { background: var(--surface-3); }
.chip { font-weight: 500; }

/* dashboard: more categories toggle */
.bars-more { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0 8px; padding: 6px 10px; border: 1px dashed var(--border-strong); border-radius: 8px;
  background: none; color: var(--primary); font-weight: 500; font-size: 13px; cursor: pointer; }
.bars-more:hover { background: var(--primary-tint); border-style: solid; border-color: var(--primary); }
.bars-more .ic { width: 14px; height: 14px; transition: transform .15s; }
.bars-more[aria-expanded="true"] .ic { transform: rotate(180deg); }
.bar-fill { border-radius: 0 6px 6px 0; }
.bar-row { border-radius: 8px; }

/* key–value facts (System page, contact details) */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 10px 0 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; word-break: break-word; }
.facts.two { grid-template-columns: repeat(2, max-content minmax(0, 1fr)); margin-top: 6px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 18px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv-k { font-size: 12px; color: var(--muted); }
.kv-v { font-size: 13.5px; overflow-wrap: anywhere; }
.profile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.profile-head h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.drawer-profile form.grid2 { margin-top: 4px; }
.drawer-actions { gap: 8px; }

/* theme picker */
.theme-pick { display: inline-flex; gap: 4px; padding: 4px; margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
.theme-pick button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font-weight: 500; cursor: pointer; }
.theme-pick button:hover { color: var(--text); background: var(--surface-3); }
.theme-pick button.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }
.theme-pick button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* modals and drawers */
.modal { border-radius: 14px; }
.drawer { border-radius: 14px 0 0 14px; }
.ctx-menu { border-radius: 10px; padding: 6px; }
.ctx-item { border-radius: 7px; }
.toast { border-radius: 10px; }

/* tablet */
@media (max-width: 1100px) {
  .page { padding: 26px 24px 56px; }
  .facts.two { grid-template-columns: max-content minmax(0, 1fr); }
}
/* phone */
@media (max-width: 860px) {
  body { overflow: hidden; }
  .page { padding: 18px 16px 48px; }
  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 13px; }
  .page-head .tpl-btns { flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 24px; }
  .dash-panel, .set-section { padding: 14px; }
  .bar-row { grid-template-columns: minmax(80px, 34%) 1fr 64px; gap: 8px; }
  .rec-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .list-toolbar .search-box { max-width: none; }
  .search-box { max-width: none; }
  .drawer { width: 100%; border-radius: 0; }
  .drawer-head { padding: 14px 16px; }
  .drawer-profile, .drawer-body { padding-left: 16px; padding-right: 16px; }
  .drawer .np-tabs { padding: 0 16px; }
  .modal-wrap { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .grid2 { grid-template-columns: 1fr; }
  .facts, .facts.two { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .help-tips { grid-template-columns: 1fr; gap: 2px; }
  .help-tips dd { margin-bottom: 8px; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .simulator { width: 100%; }
}

/* ---------------------------------------------------------------- journey progress (contacts list + contact panel)
   One segment per stage of the domain pack's `journey`; filled = reached. */
.jr { display: flex; flex-direction: column; gap: 5px; min-width: 140px; max-width: 210px; }
.jr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.jr-top b { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-segs { display: flex; gap: 3px; }
.jr-seg { flex: 1; height: 8px; border-radius: 99px; background: var(--viz-track, var(--surface-3)); }
.jr-seg.done { background: var(--primary); }
.jr-seg.now { box-shadow: 0 0 0 2px var(--primary-tint); }
.jr.ok .jr-seg.done { background: var(--success); }
.jr.bad .jr-seg.done { background: var(--danger); opacity: .75; }
.jr.warn .jr-seg.done { background: var(--warn); }
.jr.bad .jr-top b { color: var(--danger); }
.jr-next { max-width: 100%; }
.ct-tbl td.ct-jr { min-width: 150px; }
.ct-counts { margin-top: 2px; white-space: nowrap; }
.ct-tbl .ct-latest { max-width: 205px; }
.tbl.ct-tbl th, .tbl.ct-tbl td { padding-left: 8px; padding-right: 8px; }
.tbl.ct-tbl th:first-child, .tbl.ct-tbl td:first-child { padding-left: 12px; }

.drawer-journey { padding: 16px 24px 4px; }
.jr.full { max-width: none; gap: 12px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-tint), transparent 60%), var(--surface); box-shadow: var(--shadow-sm); }
.jr.full .jr-top { align-items: flex-start; }
.jr.full h4 { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.jr-pct { display: flex; align-items: center; gap: 10px; }
.jr-pct b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--primary); overflow: visible; }
.jr.ok .jr-pct b { color: var(--success); } .jr.bad .jr-pct b { color: var(--danger); }
.jr.full .jr-seg { height: 10px; }
.jr-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px 6px; }
.jr-steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12px; line-height: 1.25; color: var(--muted); }
.jr-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.jr-steps li.done { color: var(--text); }
.jr-steps li.done .jr-dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.jr.ok .jr-steps li.done .jr-dot { background: var(--success); border-color: var(--success); }
.jr-steps li.now { font-weight: 650; }
.jr-steps li.now .jr-dot { box-shadow: 0 0 0 4px var(--primary-tint); }
.jr-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- roomier, more inviting pop-up windows
   (dialogs and side panels: more width for content, a tinted header band, a soft entrance) */
.modal { width: min(580px, 100%); max-height: 90vh; overflow: hidden; border: 1px solid var(--border); }
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary-tint), transparent 70%), var(--surface); }
.modal-head h3 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 18px 24px 20px; font-size: 14.5px; }
.modal-foot { padding: 14px 24px; background: var(--surface-2); }
.modal-foot .btn { height: 36px; padding: 0 18px; }
.drawer { width: min(800px, 100%); }
.drawer-head { padding: 22px 24px; gap: 14px; background: linear-gradient(135deg, var(--primary-tint), transparent 65%), var(--surface); }
.drawer-title { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.drawer-head .avatar.lg { width: 56px; height: 56px; font-size: 18px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary-tint); }
.drawer-profile { padding: 18px 24px; }
.drawer .np-tabs { padding: 0 24px; }
.drawer .np-tabs button { font-size: 13.5px; }
.drawer-body { padding: 18px 24px 44px; gap: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .modal { animation: win-in .16s ease-out; }
  .drawer { animation: drawer-in .2s ease-out; }
}
@keyframes win-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes drawer-in { from { transform: translateX(28px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (max-width: 860px) {
  .modal, .modal.wide { width: 100%; max-height: 92vh; }
  .drawer { width: 100%; }
  .drawer-head { padding: 16px; }
  .drawer-profile, .drawer-body, .drawer-journey { padding-left: 16px; padding-right: 16px; }
  .drawer .np-tabs { padding: 0 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
}

/* ---------------------------------------------------------------- contact panel: compact header that scrolls with the content
   Name + mobile number, location and Edit up front; the rest behind "More info" (replaces the old Details pane). */
.ct-drawer .drawer-scroll, .rec-drawer .drawer-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.ct-drawer .drawer-body, .rec-drawer .drawer-body { flex: none; overflow: visible; }
.ct-drawer .np-tabs, .rec-drawer .np-tabs { position: sticky; top: 0; z-index: 2; background: var(--surface); flex: none; }
.ct-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--primary-tint), transparent 65%), var(--surface); }
.ct-head-main { display: flex; align-items: flex-start; gap: 12px; }
.ct-head .avatar.lg { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-tint); }
.ct-head-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ct-head-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ct-head .drawer-title { font-size: 16.5px; }
.ct-phone { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--primary); text-decoration: none; white-space: nowrap; }
.ct-phone:hover { text-decoration: underline; }
.ct-phone .ic, .ct-loc .ic, .ct-head .link-btn .ic { width: 13px; height: 13px; }
.ct-head-sub { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 12.5px; }
.ct-loc { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--text); }
.ct-head .link-btn, .ct-head .link-btn.inline { margin-left: 0; display: inline-flex; align-items: center; gap: 4px; }
.ct-more { align-self: flex-start; margin-top: 2px; }
.ct-more .ic { transition: transform .15s; }
.ct-more.open .ic { transform: rotate(180deg); }
.ct-head-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.ct-more-box { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ct-more-box .kv.wide { grid-column: 1 / -1; }
.ct-more-box .kv-v { white-space: pre-line; }
.ct-more-box .state-row { height: auto; }
.ct-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.ct-edit .field.wide { grid-column: 1 / -1; }
.ct-drawer .drawer-journey { padding: 12px 20px 2px; }
.ct-drawer .jr.full { padding: 12px 14px; gap: 9px; }
.ct-drawer .jr-pct b { font-size: 21px; }

/* ---------------------------------------------------------------- record panel header: the contact (avatar → contact page,
   name, mobile, email), the record with its status, and its reference numbers (where it came from → itself → what followed). */
.rec-head { padding: 16px 20px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--primary-tint), transparent 65%), var(--surface); }
.rec-head-main { display: flex; align-items: flex-start; gap: 12px; }
.rec-head .avatar.lg { width: 44px; height: 44px; font-size: 15px; text-decoration: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary-tint); }
.rec-head a.avatar { transition: box-shadow .15s; }
.rec-head a.avatar:hover, .rec-head a.avatar:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); outline: 0; }
.rec-head .avatar.none { background: var(--surface-3); color: var(--muted); }
.rec-head-txt { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.rec-head-name { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.rec-head .drawer-title { font-size: 16.5px; color: var(--text); text-decoration: none; }
.rec-head a.drawer-title:hover { color: var(--primary); }
.rec-head .drawer-title.muted { color: var(--muted); font-weight: 500; }
.rec-mail { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); text-decoration: none; overflow-wrap: anywhere; }
.rec-mail:hover { color: var(--primary); text-decoration: underline; }
.rec-mail .ic { width: 13px; height: 13px; flex: none; }
.rec-head-sub { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 13px; min-width: 0; }
.rec-head-sub .trunc { min-width: 0; flex: 1 1 120px; }
.rec-num { font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec-refs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rec-refs-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.rec-ref { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
button.rec-ref { cursor: pointer; }
button.rec-ref:hover { border-color: var(--primary); color: var(--primary); }
button.rec-ref:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rec-ref.on { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.rec-ref-t { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rec-ref.on .rec-ref-t { color: inherit; }
.rec-ref-sep { color: var(--muted); }
.rec-refs .link-btn.inline { margin-left: 2px; }
.rec-head .status-actions { margin-top: 12px; }
.rec-kv.summary { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0 0 10px; }

/* ---------------------------------------------------------------- sortable column headers (util.sortHead) */
.th-sort { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit;
  text-transform: inherit; letter-spacing: inherit; cursor: pointer; white-space: nowrap; }
.th-sort:hover, th.sorted .th-sort { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }
.th-arrow { font-size: 9px; opacity: .45; }
th.sorted .th-arrow { opacity: 1; color: var(--primary); }
th.sortable .link-btn.inline { margin-left: 10px; text-transform: none; letter-spacing: 0; }

/* ---------------------------------------------------------------- priority (records) */
.chip.prio { font-weight: 600; }
.chip.prio.low { color: var(--muted); }
.rec-prio { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 9px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.rec-prio select { border: 0; background: none; padding: 0 2px; height: 22px; font: inherit; font-weight: 650; color: var(--text); cursor: pointer; width: auto; }
.rec-prio select:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: 6px; }
.rec-prio.p-high { border-color: rgba(245, 166, 35, .6); background: rgba(245, 166, 35, .12); }
.rec-prio.p-urgent { border-color: var(--danger); background: rgba(242, 85, 79, .12); }
.rec-prio.p-urgent select { color: var(--danger); }

/* ---------------------------------------------------------------- quotation summary + versions list (record panel, contact panel) */
.rd-group-h { padding: 9px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); }
.rd-table .tbl tr.marked td { background: var(--primary-tint); }
.rd-table .tbl td .chip { margin-left: 6px; }
.ver-list .sec-h { flex-wrap: wrap; }
.ver-tbl tbody tr.current > td { background: var(--primary-tint); }
.ver-tbl tbody tr.open > td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.ver-tbl .ver-act { text-align: right; width: 1%; }
.ver-tbl td .chip { margin-left: 6px; }
.ver-full { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 9px; background: var(--surface-2); min-width: 0; }
.ver-full-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ver-full .rd-grid { background: var(--surface); }

/* ---------------------------------------------------------------- record editor (recordeditor.js — Edit Quote) */
.modal.wide.re-modal { width: min(1060px, 100%); max-height: 94vh; }
.re { display: flex; flex-direction: column; gap: 16px; }
.re-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 9px; background: var(--primary-tint); color: var(--text-2); font-size: 13px; line-height: 1.45; }
.re-hint .ic { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--primary); }
.re-form { display: flex; flex-direction: column; gap: 18px; }
.re-section { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px 16px; background: var(--surface); }
.re-section > h4, .re-section > .sec-h h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.re-section > .sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.re-section > .sec-h h4 { margin: 0; }
.re-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; align-items: start; }
.re-field.wide { grid-column: 1 / -1; }
.re-field input, .re-field select, .re-field textarea { width: 100%; }
.re-field textarea { resize: vertical; min-height: 38px; }
.re input, .re select, .re textarea { font-size: 13.5px; }
.re input[type=datetime-local] { height: 36px; padding: 0 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px;
  outline: none; color-scheme: light dark; }
.re input[type=date] { color-scheme: light dark; }
.re-total { align-self: stretch; }
.re-computed { display: block; padding: 7px 10px; border-radius: 7px; background: var(--surface-2); border: 1px dashed var(--border-strong); text-align: right;
  font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--text-2); min-height: 34px; }
.re-computed.strong { font-weight: 700; font-size: 15px; color: var(--text); border-style: solid; border-color: var(--primary); background: var(--primary-tint); }
.re-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.re-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.re-check input { width: auto; margin: 0; }
.re-rows { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.re-rows-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 9px; }
.re-tbl { width: 100%; }
.re-tbl th { position: static; }
.re-tbl td { padding: 5px 6px; max-width: none; overflow: visible; white-space: normal; vertical-align: top; }
.re-tbl td input, .re-tbl td select, .re-tbl td textarea { width: 100%; min-width: 0; }
.re-tbl td.num input { text-align: right; }
.re-tbl td .re-computed { min-height: 34px; white-space: nowrap; }
.re-tbl .re-c-xs { width: 76px; } .re-tbl .re-c-s { width: 132px; } .re-tbl .re-c-m { min-width: 150px; } .re-tbl .re-c-l { min-width: 220px; width: 40%; }
.re-tbl .re-c-x { width: 40px; text-align: center; }
.re-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 14px; background: var(--surface-2); }
.re-card + .re-card { margin-top: 12px; }
.re-card.picked { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.re-card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.re-card .re-tbl, .re-card input, .re-card select, .re-card textarea { background: var(--surface); }
.re-status { display: flex; align-items: center; gap: 6px; min-height: 20px; font-size: 13px; color: var(--muted); }
.re-status .ic { width: 14px; height: 14px; flex: none; }
.re-status.error { color: var(--danger); font-weight: 600; }
@media (max-width: 640px) { .re-section { padding: 12px; } .re-grid { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------------- contact panel: one tab per booking of the customer */
.bk-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.bk-strip-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.bk-pick { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; }
.bk-pick:hover { border-color: var(--primary); }
.bk-pick.on { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 0 0 1px var(--primary) inset; }
.bk-pick:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ct-links button.chip { border: 0; cursor: pointer; font-family: inherit; }
.ct-links button.chip:hover { filter: brightness(.95); text-decoration: underline; }
.dash-recent .tbl td { white-space: normal; }

/* ---------------------------------------------------------------- contact groups: agent / agency and its customers */
.chip.grp { background: var(--primary-tint); color: var(--primary); font-weight: 600; text-decoration: none; }
a.chip.grp:hover { text-decoration: underline; }
.ct-who-txt .muted.small .ic { width: 12px; height: 12px; vertical-align: -2px; }
.grp-suggest { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(245, 166, 35, .55); background: rgba(245, 166, 35, .12); font-size: 13.5px; }
.grp-suggest > .ic { width: 18px; height: 18px; flex: none; color: #b26a00; }
.grp-suggest .grow { min-width: 200px; }
.grp-results { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; }
.grp-results:empty { display: none; }
.grp-results .cp-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border);
  background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.grp-results .cp-item:last-child { border-bottom: 0; }
.grp-results .cp-item:hover, .grp-results .cp-item:focus-visible { background: var(--primary-tint); outline: 0; }
.grp-results .cp-none { padding: 12px; }
.grp-member { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 8px; }
.grp-member:hover, .grp-member:focus-visible { background: var(--surface-2); outline: 0; }
.grp-member-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grp-member-txt .chip { margin-left: 6px; }
.grp-member-latest { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
@media (max-width: 640px) { .grp-member { flex-wrap: wrap; } }
@media (max-width: 860px) { .rec-head { padding-left: 16px; padding-right: 16px; } }

/* ---------------------------------------------------------------- dashboard: customer journey + compact tiles */
.jp { margin-top: 20px; padding: 20px 22px 22px; border-radius: 18px; border: 1px solid var(--border); position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, var(--primary-tint), transparent 55%), radial-gradient(90% 120% at 100% 100%, rgba(47, 179, 122, .10), transparent 60%), var(--surface);
  box-shadow: var(--shadow); }
.jp::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--success)); }
.jp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.jp-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.015em; display: flex; align-items: center; gap: 10px; }
.jp-head p { margin: 4px 0 0; font-size: 13.5px; max-width: 760px; }
.jp-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 99px; background: rgba(47, 179, 122, .14); color: var(--success); }
.jp-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
@media (prefers-reduced-motion: no-preference) { .jp-live i { animation: jp-pulse 1.8s ease-out infinite; } }
@keyframes jp-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 179, 122, .55); } 100% { box-shadow: 0 0 0 9px rgba(47, 179, 122, 0); } }
.jp-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.jp-stopped { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 99px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.jp-stopped b { color: var(--danger); font-size: 15px; }
.jp-stopped:hover, .jp-stopped.on { border-color: var(--danger); color: var(--danger); }
.jp-flow { list-style: none; margin: 18px 0 0; padding: 0; display: flex; gap: 0; }
.jp-flow li { flex: 1; min-width: 0; margin-left: -10px; }
.jp-flow li:first-child { margin-left: 0; }
.jp-stage { width: 100%; height: 100%; border: 0; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 1px; padding: 12px 22px 12px 26px;
  background: var(--primary); color: var(--on-primary); filter: drop-shadow(0 2px 4px rgba(15, 18, 25, .14));
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%); transition: transform .14s, filter .14s, background .14s; }
.jp-flow li:first-child .jp-stage { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); padding-left: 16px; border-radius: 12px 0 0 12px; }
.jp-stage.last { background: var(--success); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 16px 50%); border-radius: 0 12px 12px 0; }
.jp-stage:hover { transform: translateY(-3px); filter: drop-shadow(0 8px 14px rgba(15, 18, 25, .22)); }
.jp-stage:focus-visible { outline: 3px solid var(--text); outline-offset: -3px; }
.jp-stage.empty { background: var(--surface-3); color: var(--muted); }
.jp-stage.on { background: var(--text); color: var(--surface); transform: translateY(-3px); }
.jp-step { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.jp-count { font-size: 30px; font-weight: 750; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.jp-label { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jp-value { font-size: 11.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 15px; }
.jp-list { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.jp-list .tbl td { white-space: normal; }
.jp-list .jr { min-width: 120px; }

/* existing dashboard tiles: compact floating rectangles (label + number on one line) */
.dash .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 10px; margin-top: 16px; }
.dash .kpi { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 0; padding: 9px 14px; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 18, 25, .06), 0 6px 16px -6px rgba(15, 18, 25, .18); text-align: left; }
.dash .kpi:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(15, 18, 25, .08), 0 12px 22px -8px rgba(15, 18, 25, .28); }
.dash .kpi-label { grid-column: 1; grid-row: 1; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash .kpi-value { grid-column: 2; grid-row: 1 / span 2; font-size: 21px; line-height: 1; }
.dash .kpi-sub { grid-column: 1; grid-row: 2; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash .kpi.on { background: var(--primary-tint); }

@media (max-width: 860px) {
  .jp { padding: 16px 14px 18px; border-radius: 14px; }
  .jp-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .jp-flow li, .jp-flow li:first-child { margin-left: 0; }
  .jp-stage, .jp-flow li:first-child .jp-stage, .jp-stage.last { clip-path: none; border-radius: 10px; padding: 10px 12px; }
  .jp-count { font-size: 24px; }
  .ct-head { padding: 14px 16px 10px; }
  .ct-edit { grid-template-columns: 1fr; }
  .ct-head-acts .btn { padding: 0 8px; }
}

/* Case layout (pack view "layout": "case" — travel enquiries): header fields, next action, notes, score breakdown */
.case-head { padding-bottom: 16px; }
.case-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.case-num { font-size: 19px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.case-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 16px; margin-top: 14px; }
.case-grid .case-f:nth-child(6) { grid-column: 1; }
.case-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.case-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.case-v { font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; min-height: 28px; }
.case-name { font-size: 15px; font-weight: 650; color: var(--text); text-decoration: none; }
.case-name:hover { color: var(--primary); text-decoration: underline; }
.case-v .ct-phone { font-size: 13.5px; }
.case-v .case-mail { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-v .link-btn .ic { width: 13px; height: 13px; margin-left: 4px; vertical-align: -2px; }
.case-sel { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; width: 100%; cursor: pointer; }
.case-sel:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.case-sel:disabled { cursor: default; color: var(--muted); }
.case-action { display: flex; gap: 12px; margin: 14px 24px 4px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--primary); border-left-width: 4px;
  background: var(--primary-tint); }
.case-action.warn { border-color: var(--warn); background: rgba(245, 158, 11, .1); }
.case-action.ok { border-color: var(--success); background: rgba(22, 163, 74, .08); }
.case-action.bad { border-color: var(--danger); background: rgba(220, 38, 38, .07); }
.case-action-ic { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.case-action.warn .case-action-ic { color: var(--warn); }
.case-action.ok .case-action-ic { color: var(--success); }
.case-action.bad .case-action-ic { color: var(--danger); }
.case-action-ic .ic { width: 15px; height: 15px; }
.case-action-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.case-action-t { font-size: 15px; font-weight: 650; margin-top: 2px; }
.case-action-d { font-size: 13.5px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.case-action-s { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
/* Case page: the next action leads; the case status underneath is secondary */
.case-next-go { margin-top: 10px; }
.case-next-wrap > .case-action:not(.case-next) { padding: 8px 14px; border-left-width: 1px; border-color: var(--border); background: transparent; }
.case-next-wrap > .case-action:not(.case-next) .case-action-ic { width: 24px; height: 24px; box-shadow: none; color: var(--muted); }
.case-next-wrap > .case-action:not(.case-next) .case-action-t { font-size: 13.5px; }
.case-next-wrap > .case-action:not(.case-next) .case-action-d { font-size: 12.5px; }
/* Lead score of the enquiry in one line, above the action it sets the tone for */
.case-intent { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 8px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border);
  font-size: 13px; color: var(--text-2); line-height: 1.45; }
.case-intent .chip { flex: none; font-weight: 650; }
.case-intent-t { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.intent-statement { margin: 10px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.intent-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.case-ok { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--success); font-size: 13.5px; }
.case-ok .ic { width: 14px; height: 14px; }
.case-missing { display: flex; flex-direction: column; gap: 10px; }
.case-missing > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.case-missing .case-l { min-width: 96px; }
.case-note-form { display: flex; flex-direction: column; }
.case-note-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; align-items: start; }
.case-note-row select { height: 34px; }
.case-note-form .party-actions { margin-top: 8px; }
.case-notes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.case-note { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.case-note-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.case-note-t { margin-top: 5px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.case-score { display: flex; align-items: center; gap: 16px; }
.case-score-n b { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.case-score .meter { width: 100%; max-width: 320px; height: 8px; margin-top: 8px; }
.case-score .meter-wrap .meter-num { display: none; }
.case-signals { display: flex; flex-direction: column; gap: 12px; }
.case-signal { display: flex; flex-direction: column; gap: 5px; }
.case-signal-h { display: flex; justify-content: space-between; font-size: 13.5px; }
.case-signal .meter { width: 100%; height: 6px; }
.case-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.guard-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--warn); border-left-width: 4px; background: rgba(245, 158, 11, .1); }
.guard-box > .ic { flex: none; width: 18px; height: 18px; color: var(--warn); margin-top: 1px; }
.guard-box p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.45; }
.guard-ok { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--success); font-size: 13.5px; }
.guard-ok .ic { width: 14px; height: 14px; flex: none; }
.origin-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.origin-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; min-width: 0; }
.origin-row .trunc { min-width: 0; flex: 1 1 120px; }
.origin-card .rec-kv { margin-top: 10px; }
.origin-sum { margin: 8px 0 0; font-size: 13.5px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.case-action-last { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.case-action-last b { font-weight: 600; color: var(--muted); }
.rec-refs.flat { margin-top: 0; }
.linked-tbl tbody tr.current > td { background: var(--primary-tint); }
/* travellers & contacts of a booking: one row per item, Modify on the right, the editor below */
.pc-rows { display: flex; flex-direction: column; }
.pc-row { display: grid; grid-template-columns: 170px 1fr auto; gap: 6px 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.pc-row:first-child { border-top: 0; padding-top: 2px; }
.pc-l { display: flex; flex-direction: column; gap: 1px; font-size: 13px; font-weight: 600; }
.pc-l .muted { font-weight: 400; }
.pc-v { min-width: 0; font-size: 13.5px; }
.pc-a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pc-edit { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.pc-edit .party-actions { margin-top: 0; }
.pc-kinds { display: flex; flex-wrap: wrap; gap: 10px; }
.pc-kinds label { display: flex; flex-direction: column; gap: 3px; }
.pc-kinds input { width: 110px; }
.pc-kinds-v { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pc-kind b { font-variant-numeric: tabular-nums; }
.pc-kind.total { padding-left: 14px; border-left: 1px solid var(--border); }
.party-warn.lock { color: var(--text-2); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--warn); background: rgba(245, 158, 11, .1); }
.party-warn.lock .ic { color: var(--warn); }
.party-warn.info { color: var(--text-2); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.party-warn.info .ic { color: var(--primary); }
/* Assign to: the owner's name, read-only, with Modify */
.case-assign { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.case-assign .case-sel { flex: 1 1 140px; width: auto; }
.case-owner { font-weight: 600; overflow-wrap: anywhere; }
.case-mod { height: 26px; padding: 0 8px; }
/* quotation versions: one card each, current on top; ▸ opens what changed, the facts and Share / Edit */
.qv-list { display: flex; flex-direction: column; gap: 10px; }
.qv-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.qv-card.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.qv-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px 2px; cursor: pointer; min-width: 0; }
.qv-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 12px; }
.qv-arrow { width: 14px; color: var(--muted); font-size: 12px; flex: none; }
.qv-num { font-size: 14.5px; }
.qv-meta { white-space: nowrap; }
.qv-total { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.qv-diff-line { padding: 0 14px 10px 36px; overflow-wrap: anywhere; }
.qv-body { padding: 4px 14px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.qv-diff { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.qv-diff ul { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.qv-from { color: var(--muted); text-decoration: line-through; }
.qv-to { font-weight: 600; }
.qv-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed var(--border); }
.qv-share { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .qv-meta { white-space: normal; flex-basis: 100%; order: 9; padding-left: 22px; }
  .qv-diff-line { padding-left: 36px; }
  .pc-row { grid-template-columns: 1fr auto; }
  .pc-v { grid-column: 1 / -1; grid-row: 2; }
  .case-top { flex-wrap: nowrap; gap: 8px; }
  .case-top .rec-type { display: none; }
  .case-grid { grid-template-columns: 1fr 1fr; }
  .case-grid .case-f:nth-child(6) { grid-column: auto; }
  .case-action { margin: 12px 16px 4px; }
  .case-note-row { grid-template-columns: 1fr; }
}
/* cases (one tracking number per request): case chip on record headers, stars of the internal rating, payment totals */
.rec-ref.case-ref { border-color: var(--primary); background: var(--primary-tint); }
.case-v .rec-ref { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 24px; }
.case-v .rec-ref .rec-ref-t { margin-right: 6px; }
.case-ref-st { margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--border-strong); font-weight: 500; color: var(--text-2); }
.cf-stars { display: inline-flex; gap: 1px; color: var(--border-strong); font-size: 14px; letter-spacing: 0; line-height: 1; }
.cf-stars .on { color: var(--warn); }
.cf-rating { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cf-stage { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-totals { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cf-totals > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; min-width: 150px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-sm); }
.cf-totals b { font-size: 17px; font-variant-numeric: tabular-nums; }
.ct-cases .doc-row .chip { flex: none; }
.tm-trip-case { margin: 4px 0 2px; } /* FTR-016: the trip's case number on the trip globe */
.tm-trip-case .rec-ref { height: 22px; font-size: 12.5px; }
/* dashboard: minimize a panel to its title bar */
.dash-min .ic { transition: transform .15s; }
.dash-min[aria-expanded="true"] .ic { transform: rotate(180deg); }
.dash-panel > .dash-h:only-child { margin-bottom: 0; }
/* dashboard trip globe: destinations as numbered points on a turning globe (MapLibre), the lists beside it */
.tmap { --t-now: #f59e0b; --t-ok: #22c55e; --t-mixed: #06b6d4; --t-plan: #6366f1; --t-appt: #e879f9; }
.tm-h h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-h h3 .ic { width: 16px; height: 16px; color: var(--primary); }
.tm-h .tpl-btns { flex-wrap: wrap; justify-content: flex-end; }
.tm-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.tm-period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-period > .ic { width: 15px; height: 15px; color: var(--muted); }
.tm-period label { display: inline-flex; align-items: center; gap: 6px; }
.tm-period input[type="date"] { height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.tm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tm-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* FTR-020 · case comments (bottom of every case tab) and the Imp flags beside reference numbers */
.cm-box { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 16px; }
.cm-form { display: flex; flex-direction: column; gap: 8px; }
.cm-form textarea { width: 100%; resize: vertical; min-height: 64px; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.cm-form-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.cm-about { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.cm-about select, .cm-sel { max-width: 220px; height: 30px; padding: 0 8px; font-size: 13px; border-radius: 7px; }
.cm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cm-head .btn { flex: none; }
.cm-box .cm-form { margin-bottom: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.cm-imp { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cm-count.over { color: var(--danger); font-weight: 600; }
.cm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.cm { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.cm.imp { border-color: color-mix(in srgb, var(--warn) 60%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.cm-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cm-h .icon-btn { width: 28px; height: 28px; }
.cm-t { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.cm.deleted .cm-t { text-decoration: line-through; color: var(--muted); }
.cm.deleted { background: var(--surface-2); }
.cm-del { margin-top: 4px; font-style: italic; }
.chip.imp-flag { display: inline-flex; align-items: center; gap: 3px; background: color-mix(in srgb, var(--warn) 18%, transparent); color: #92400e;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); font-weight: 700; cursor: pointer; }
:root[data-theme="dark"] .chip.imp-flag { color: #fcd34d; }
.chip.imp-flag .ic { width: 12px; height: 12px; }
.imp-flags { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.stg .imp-flags { margin-top: 3px; }
.cm.cm-hl { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 55%, transparent); transition: box-shadow .3s; }
.stg .chip.imp-flag { font-size: 10.5px; padding: 0 6px; }

/* ===================================================================================================================
   MAJOR FTR-019 · Travel-Case — the case list (#/cases), the stage track and cases / records in the full window.
   Only used while FTR019_TRAVEL_CASE is on (server/features.py). Stage colours: pack `cases.stage_colors`. */
:root { --stg-blue: #2563eb; --stg-violet: #7c3aed; --stg-teal: #0d9488; --stg-amber: #d97706; --stg-green: #16a34a; --stg-pink: #db2777; }
:root[data-theme="dark"] { --stg-blue: #60a5fa; --stg-violet: #a78bfa; --stg-teal: #2dd4bf; --stg-amber: #fbbf24; --stg-green: #4ade80; --stg-pink: #f472b6; }
.stg-track { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; min-width: 0; }
.stg { --stg: var(--muted); flex: 1 1 0; min-width: 0; display: flex; align-items: flex-start; gap: 6px; padding: 5px 7px; border-radius: 8px;
  border: 1px dashed var(--border-strong); color: var(--muted); background: transparent; }
.stg.reached { border-style: solid; border-color: color-mix(in srgb, var(--stg) 55%, transparent); background: color-mix(in srgb, var(--stg) 10%, var(--surface)); color: var(--text); }
.stg.todo.reached { border-style: dashed; background: transparent; color: var(--muted); } /* skipped stage before a later one */
.stg.c-blue { --stg: var(--stg-blue); } .stg.c-violet { --stg: var(--stg-violet); } .stg.c-teal { --stg: var(--stg-teal); }
.stg.c-amber { --stg: var(--stg-amber); } .stg.c-green { --stg: var(--stg-green); } .stg.c-pink { --stg: var(--stg-pink); }
.stg.now { box-shadow: 0 0 0 2px var(--stg); }
.stg.stopped, .stg.stopped[class*="c-"] { --stg: var(--muted); } /* stopped (Lost, Cancelled, Expired…) reads grey */
/* compact track (the list): no dot — the colour runs down the left edge, so number and status get the room */
.stg-track:not(.big) .stg { padding: 4px 6px 4px 7px; border-left-width: 3px; }
.stg-track:not(.big) .stg.todo { border-left-style: dashed; }
.stg-track:not(.big) .stg-dot { display: none; }
.stg-track:not(.big) .stg-l { font-size: 10px; letter-spacing: .03em; }
.stg-track:not(.big) .stg-num { font-size: 12px; }
.stg-track:not(.big) .stg-st { font-size: 11px; }
.stg[role="button"] { cursor: pointer; }
.stg[role="button"]:hover { filter: brightness(.97); }
.stg-dot { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700;
  background: var(--surface-3); color: var(--muted); }
.stg:not(.todo) .stg-dot { background: var(--stg); color: #fff; }
:root[data-theme="dark"] .stg:not(.todo) .stg-dot { color: #111318; }
.stg-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.stg-l { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stg:not(.todo) .stg-l { color: var(--stg); }
.stg-n { font-weight: 600; text-transform: none; letter-spacing: 0; }
.stg-num { font: inherit; font-size: 12.5px; font-weight: 650; color: var(--text); background: none; border: 0; padding: 0; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
button.stg-num:hover, button.stg-num:focus-visible { color: var(--stg); text-decoration: underline; }
.stg-st { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stg.stopped .stg-st { color: var(--muted); font-weight: 600; }
.stg-track.big { gap: 8px; }
.stg-track.big .stg { padding: 10px 12px; gap: 10px; border-radius: 12px; }
.stg-track.big .stg-dot { width: 26px; height: 26px; font-size: 12px; }
.stg-track.big .stg-l { font-size: 11.5px; }
.stg-track.big .stg-num { font-size: 15px; }
.stg-track.big .stg-st { font-size: 13px; }

/* the case list */
.tc-page { max-width: 1440px; }
.tc-toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.tc-toolbar .search-box { flex: 1 1 320px; max-width: 460px; }
.tc-filter { display: inline-flex; align-items: center; gap: 4px; }
table.tc td { vertical-align: middle; padding-top: 10px; padding-bottom: 10px; }
table.tc tbody tr { cursor: pointer; }
.tc-num { font-size: 14px; white-space: nowrap; }
.tc-cust b { font-weight: 600; }
.tc-stages { min-width: 500px; width: 46%; }
table.tc .nowrap { white-space: nowrap; }
.tc-kind { margin-top: 4px; }

/* a case or record in the full window: roomy and readable */
.rec-page { max-width: 1240px; margin: 0 auto; padding: 18px 28px 64px; }
.rec-page-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.drawer.as-page { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); font-size: 15px; }
.drawer.as-page .drawer-scroll { overflow: visible; }
.drawer.as-page .rec-head, .drawer.as-page .case-head { padding: 24px 32px 18px; }
.drawer.as-page .case-num { font-size: 22px; }
.drawer.as-page .case-grid { gap: 16px 24px; }
.drawer.as-page .case-l { font-size: 11.5px; }
.drawer.as-page .case-v { font-size: 15px; }
.drawer.as-page .case-action { margin: 16px 32px 6px; padding: 16px 20px; }
.drawer.as-page .case-action-t { font-size: 16.5px; }
.drawer.as-page .case-next-wrap > .case-action:not(.case-next) { padding: 8px 16px; margin-top: 6px; }
.drawer.as-page .case-next-wrap > .case-action:not(.case-next) .case-action-t { font-size: 13.5px; }
.drawer.as-page .case-action-d, .drawer.as-page .case-intent { font-size: 14.5px; }
.drawer.as-page .np-tabs { padding: 0 32px; }
.drawer.as-page .np-tabs button { font-size: 14.5px; padding-top: 12px; padding-bottom: 12px; }
.drawer.as-page .drawer-body { padding: 22px 32px 48px; gap: 18px; font-size: 15px; line-height: 1.55; }
.drawer.as-page .rec-section h4 { font-size: 12.5px; }
.drawer.as-page .rec-kv dd { font-size: 15px; }
.drawer.as-page .qv-head { padding: 12px 16px; }
.drawer.as-page .icon-btn[title="Close"] { display: none; } /* Back takes you out of the full window */
.cf-track-wrap { padding: 6px 24px 10px; display: flex; flex-direction: column; gap: 8px; }
.drawer.as-page .cf-track-wrap { padding: 4px 32px 12px; }

@media (max-width: 860px) {
  .rec-page { padding: 12px 12px 48px; }
  .drawer.as-page { border-radius: 12px; }
  .drawer.as-page .rec-head, .drawer.as-page .case-head { padding: 16px 16px 12px; }
  .drawer.as-page .case-action { margin: 12px 16px 4px; }
  .drawer.as-page .np-tabs { padding: 0 16px; }
  .drawer.as-page .drawer-body { padding: 16px 16px 40px; }
  .drawer.as-page .cf-track-wrap { padding: 4px 16px 10px; }
  .stg-track.big { flex-wrap: wrap; }
  .stg-track.big .stg { flex: 1 1 150px; }
  .tc-stages { min-width: 460px; }
}
.tm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); }
.t-now { --tone: var(--t-now); } .t-ok { --tone: var(--t-ok); } .t-mixed { --tone: var(--t-mixed); } .t-plan { --tone: var(--t-plan); } .t-appt { --tone: var(--t-appt); }
.tm-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.tm-stage { position: relative; min-width: 0; }
/* deep space behind the globe: a few stars over a blue-violet glow */
.tm-map { height: 480px; border-radius: 14px; overflow: hidden; z-index: 0;
  background: radial-gradient(1px 1px at 12% 18%, #fff8, transparent 60%), radial-gradient(1px 1px at 78% 12%, #fff9, transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 64%, #fff7, transparent 60%), radial-gradient(1px 1px at 22% 82%, #fff8, transparent 60%),
    radial-gradient(1px 1px at 54% 8%, #fff6, transparent 60%), radial-gradient(1.5px 1.5px at 6% 52%, #fff6, transparent 60%),
    radial-gradient(1px 1px at 64% 92%, #fff7, transparent 60%), radial-gradient(1px 1px at 94% 34%, #fff8, transparent 60%),
    radial-gradient(ellipse at 50% 50%, #1e3a8a 0%, #172554 38%, #0b1026 70%, #05060f 100%); }
.tm-fail { padding: 16px; color: #cbd5e1; }
.tmap .maplibregl-ctrl-attrib { background: rgba(255, 255, 255, .75); font-size: 11px; }
.tm-hint { position: absolute; left: 10px; bottom: 8px; padding: 3px 8px; border-radius: 99px; background: rgba(5, 6, 15, .55); color: #e2e8f0; pointer-events: none; }
.tm-pin { display: grid; place-items: center; width: var(--s); height: var(--s); padding: 0; border-radius: 50%; background: var(--tone); color: #fff;
  font: 700 12.5px/1 system-ui, sans-serif; border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 35%, transparent), 0 0 18px color-mix(in srgb, var(--tone) 70%, transparent); }
.tm-pin:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tm-pin.t-now { animation: tm-pulse 1.8s ease-out infinite; }
@keyframes tm-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tone) 60%, transparent), 0 0 18px var(--tone); } 100% { box-shadow: 0 0 0 16px transparent, 0 0 18px var(--tone); } }
@media (prefers-reduced-motion: reduce) { .tm-pin.t-now { animation: none; } }
.tmap .maplibregl-popup-content { border-radius: 12px; background: var(--surface); color: var(--text); padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); font-family: inherit; }
.tmap .maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.tmap .maplibregl-popup-close-button { color: var(--muted); font-size: 18px; right: 4px; top: 2px; }
.tmap .maplibregl-ctrl-group { background: var(--surface); }
.tmap .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
:root[data-theme="dark"] .tmap .maplibregl-ctrl-icon { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tmap .maplibregl-ctrl-icon { filter: invert(1); } }
.tm-pop { font-size: 13px; line-height: 1.45; }
.tm-pop-h { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; padding-right: 16px; }
.tm-pop-h b { font-size: 14.5px; }
.tm-pop-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.tm-trip { padding: 7px 9px; border-radius: 8px; border-left: 3px solid var(--t-plan); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.tm-trip.ok { border-left-color: var(--t-ok); }
.tm-trip-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tm-trip-f { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tmap a.tm-pop-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-weight: 600; color: var(--primary); text-decoration: none; }
.tm-pop-link .ic { width: 13px; height: 13px; }
.tm-side { display: flex; flex-direction: column; gap: 14px; max-height: 480px; overflow: auto; padding-right: 2px; min-width: 0; }
.tm-sec { display: flex; flex-direction: column; gap: 4px; }
.tm-sec .case-l { margin-bottom: 2px; }
.tm-dest, .tm-appt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.tm-appt { display: block; }
.tm-appt .ic { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; color: var(--muted); }
.tm-appt.overdue { border-color: var(--danger); }
.tm-dest:hover, .tm-appt:hover { border-color: var(--primary); }
.tm-dest:focus-visible, .tm-appt:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.tm-dest-n { font-weight: 600; }
.tm-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 860px) {
  .tm-body { grid-template-columns: 1fr; }
  .tm-map { height: 360px; }
  .tm-side { max-height: none; }
  .tm-hint { display: none; }
  .tm-form-row { grid-template-columns: 1fr 1fr; }
}

/* ---- FTR-029 · Enquiry updates (under FTR-019): Edit requirements (current greyed → new), changes shown old → new,
   + New case for a customer who contacted staff directly */
.req-grid .rd-item.req-changed { margin: -6px -8px; padding: 6px 8px; border-radius: 8px; background: var(--primary-tint); }
.req-when { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--primary); }
.req-diff { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.req-old { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.req-arrow { color: var(--muted); }
.req-new { font-weight: 650; }
.req-star { color: var(--danger); margin-left: 2px; font-weight: 700; }
.modal.wide.req-modal { width: min(920px, 100%); max-height: 94vh; }
.req-form { display: flex; flex-direction: column; gap: 16px; }
.req-table { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.req-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(120px, 1.2fr) 20px minmax(180px, 1.6fr); gap: 10px; align-items: center;
  padding: 9px 14px; border-top: 1px solid var(--border); transition: background .15s; }
.req-row:first-child { border-top: 0; }
.req-row.req-head { background: var(--surface-2); padding-top: 8px; padding-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.req-l { font-weight: 600; font-size: 13.5px; }
.req-cur { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.req-row .req-arrow { text-align: center; opacity: .35; }
.req-row.changed { background: var(--primary-tint); }
.req-row.changed .req-cur { text-decoration: line-through; }
.req-row.changed .req-arrow { opacity: 1; color: var(--primary); font-weight: 700; }
.req-in input, .req-in select, .req-in textarea { width: 100%; }
.req-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.req-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.req-check input { width: auto; margin: 0; }
.req-log { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.req-log-h { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.req-log-h b { font-size: 14px; }
.req-log-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-warn { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--danger); border-left-width: 4px;
  background: rgba(220, 38, 38, .08); color: var(--text); font-size: 13.5px; line-height: 1.45; }
.req-warn[hidden] { display: none; }
.req-warn .ic { flex: none; width: 16px; height: 16px; color: var(--danger); margin-top: 1px; }
input.invalid, select.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.cm-upd { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--primary); font-weight: 500; }
.cm-upd .ic { width: 13px; height: 13px; flex: none; }
.cm-upd.warn { color: #b26a00; }
:root[data-theme="dark"] .cm-upd.warn { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cm-upd.warn { color: var(--warn); } }
.req-approve { margin-top: 10px; }
.req-approve textarea { width: 100%; }
.tpl-btns .chip .ic { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.nc-form { display: flex; flex-direction: column; gap: 16px; }
.nc-sec { display: flex; flex-direction: column; gap: 10px; }
.nc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.nc-f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.nc-f > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.nc-f.wide { grid-column: 1 / -1; }
.nc-dup .nc-dup-a { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
/* A module's buttons on a record's case view (casefile.BUTTONS — e.g. travel's Build a Quote, FTR-030) */
.mod-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.qv-actions .mod-btns { margin-top: 0; }
.mod-btns .btn .chip { margin-left: 4px; font-size: 11px; padding: 1px 6px; }
@media (max-width: 640px) {
  .req-row { grid-template-columns: 1fr; gap: 4px; }
  .req-row.req-head { display: none; }
  .req-row .req-arrow { display: none; }
  .req-cur::before { content: "Now: "; font-weight: 600; }
  .nc-grid { grid-template-columns: 1fr; }
}

/* ---- FTR-034 · Contacts tab of a trip case: the travellers, each linked to their contact */
.cc-box .cc-note { margin-bottom: 12px; }
.cc-tbl td { vertical-align: middle; }
.cc-tbl .cc-name { font-weight: 600; margin-right: 6px; }
.cc-tbl .cc-acts { text-align: right; white-space: nowrap; width: 1%; }
.cc-tbl .cc-acts .icon-btn { display: inline-flex; }
.cc-add { gap: 14px; }
.cc-add .ct-edit { margin-top: 6px; }

/* ---- FTR-035 · Primary contact: "Pri" beside the customer of a case, Change customer, associated contacts */
.chip.pri { background: var(--primary-tint); color: var(--primary); font-weight: 700; font-size: 10.5px; letter-spacing: .02em; padding: 1px 6px; vertical-align: middle; }
.case-cust { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc-chosen { min-height: 18px; }
.ct-assoc .doc-row { flex-wrap: wrap; }
.ct-assoc .ct-assoc-refs { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* Agency admin view (FTR-UTP080, web/js/agencypage.js) */
.ag-body { margin-top: 18px; }
.ag-card, .ag-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.ag-card { padding: 18px; margin-bottom: 16px; min-width: 0; }
.ag-card h2 { font-size: 15px; margin: 0 0 12px; }
.ag-narrow { max-width: 640px; }
.ag-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.ag-bar span { display: block; height: 100%; background: var(--primary); }
.ag-bar.warning span { background: var(--warn); }
.ag-bar.reached span { background: var(--danger); }
.ag-check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 14px; }
.ag-form { display: flex; flex-direction: column; gap: 12px; }
.ag-err { color: var(--danger); font-size: 13px; min-height: 18px; }
.ag-link { display: flex; gap: 8px; }
.ag-link input { flex: 1; min-width: 0; }
.ag-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ag-progress-head h2 { margin: 0; }
.ag-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 8px; }
.ag-bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.ag-steps { list-style: none; margin: 0; padding: 0; }
.ag-steps li { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); }
.ag-steps li:first-child { border-top: 0; }
.ag-tick { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--border-strong); color: var(--on-primary); }
.ag-tick .ic { width: 14px; height: 14px; }
.ag-steps .done .ag-tick { background: var(--primary); border-color: var(--primary); }
.ag-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ag-step-actions { display: flex; gap: 6px; flex: none; }
.ag-scroll { overflow-x: auto; }
.ag-scroll .tbl { width: 100%; font-size: 13px; }
.ag-scroll .tbl td { padding: 9px 10px; max-width: 300px; }
.ag-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; margin-bottom: 10px; }
.ag-tile { padding: 12px 14px; }
.ag-tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; margin-top: 12px; }
.ag-req { align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.ag-features { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.ag-features li { display: flex; gap: 8px; padding: 6px 0; }
.ag-features li.off { color: var(--muted); }
.ag-mark { flex: none; width: 16px; color: var(--primary); text-align: center; }
.ag-mark .ic { width: 15px; height: 15px; }
.ag-features .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 640px) {
  .ag-steps li { flex-wrap: wrap; }
  .ag-step-text { flex-basis: calc(100% - 36px); }
  .ag-step-actions { margin-left: 36px; }
}
