:root {
  --side: #0f2a2c;
  --side-2: #163a3c;
  --side-3: #1f4a4c;
  --side-text: #b5cccb;
  --side-mut: #7b9a99;
  --side-strong: #ffffff;
  --side-icon: #86a5a4;
  --side-cnt: rgba(255, 255, 255, .14);
  --c1: #0f6e66;
  --c2: #e9a23b;
  --mark-bg: #e9a23b;
  --mark-ink: #0f2a2c;

  --primary: #0f6e66;
  --primary-hover: #0b5751;
  --primary-soft: #e7f3f1;
  --accent: #e9a23b;

  --ink: #101828;
  --body: #344054;
  --mut: #667085;
  --mut-2: #98a2b3;
  --line: #eaecf0;
  --line-2: #d0d5dd;
  --bg: #f6f7f9;
  --card: #ffffff;
  --head: #f9fafb;

  --red: #d92d20;
  --red-soft: #fef3f2;
  --grn: #067647;
  --grn-soft: #ecfdf3;
  --amb: #b54708;
  --amb-soft: #fffaeb;

  --r: 10px;
  --r-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
svg.i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
button { font-family: inherit; }
a { color: inherit; }
b, strong { font-weight: 600; }

/* ================= shell ================= */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.brand .mark { width: 32px; height: 32px; flex: none; }
.brand .w { font-weight: 600; font-size: 16.5px; color: var(--side-strong); letter-spacing: -.2px; line-height: 1.2; }
.brand .de { display: block; font-size: 11.5px; color: var(--side-mut); }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .grp { font-size: 11.5px; font-weight: 500; color: var(--side-mut); padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--side-text); font-weight: 500; font-size: 14px; }
.nav a svg { color: var(--side-icon); }
.nav a:hover { background: var(--side-2); color: var(--side-strong); }
.nav a.on { background: var(--side-3); color: var(--side-strong); }
.nav a.on svg { color: var(--side-strong); }
.nav a .cnt { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--side-text); background: var(--side-2); padding: 0 8px; border-radius: 10px; line-height: 20px; }
.nav a.on .cnt { background: var(--side-cnt); color: var(--side-strong); }
.side-foot { margin: auto 12px 14px; padding: 14px; border-radius: var(--r); background: var(--side-2); font-size: 12.5px; color: var(--side-mut); }
.side-foot .ws { display: flex; align-items: center; gap: 8px; color: var(--side-strong); font-weight: 500; }
.side-foot .ws i { width: 8px; height: 8px; border-radius: 50%; background: #17b26a; }
.side-foot p { margin: 6px 0 0; line-height: 1.45; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; height: 64px; background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 32px; }
.menu-btn { display: none; border: 1px solid var(--line-2); background: #fff; border-radius: var(--r-sm); width: 38px; height: 38px; align-items: center; justify-content: center; cursor: pointer; }
.crumbs { font-size: 14px; color: var(--mut); white-space: nowrap; }
.crumbs b { color: var(--ink); font-weight: 500; }
.search { margin-left: auto; position: relative; width: 320px; max-width: 34vw; }
.top .search #globalSearch { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 12px 0 38px; font: 400 14px var(--font); background: #fff; box-shadow: var(--shadow-xs); }
.top .search #globalSearch:focus { outline: none; border-color: #7fb8b0; box-shadow: 0 0 0 4px var(--primary-soft); }
.search svg { position: absolute; left: 12px; top: 12px; color: var(--mut-2); z-index: 1; pointer-events: none; }
.chip-demo { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--body); background: #fff; border: 1px solid var(--line-2); padding: 5px 11px; border-radius: 20px; white-space: nowrap; }
.chip-demo i { width: 7px; height: 7px; border-radius: 50%; background: #17b26a; }
.user { display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user .who b { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.2; }
.user .who span { font-size: 12px; color: var(--mut); }

.page { padding: 28px 32px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.ph h1 { font-size: 26px; font-weight: 600; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.3px; }
.ph p { margin: 0; color: var(--mut); max-width: 660px; font-size: 14.5px; }
.ph .acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* ================= primitives ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 14px/1 var(--font); padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s; box-shadow: var(--shadow-xs); }
.btn.red, .btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.red:hover, .btn.primary:hover { background: var(--primary-hover); }
.btn.blk { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.blk:hover { background: var(--head); }
.btn.line { background: #fff; color: var(--body); border-color: var(--line-2); }
.btn.line:hover { background: var(--head); color: var(--ink); }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.btn.xs { padding: 5px 9px; font-size: 12px; border-radius: 6px; box-shadow: none; }
.btn:disabled { opacity: .55; cursor: progress; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-xs); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card-h .sub { font-size: 13px; color: var(--mut); }
.card-b { padding: 0 20px 20px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-xs); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.kpi .c { font-size: 14px; font-weight: 500; color: var(--mut); }
.kpi .ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.kpi .ic svg { width: 18px; height: 18px; }
.kpi .v { font-size: 30px; font-weight: 600; line-height: 1.1; margin: 6px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .v small { font-size: 16px; color: var(--mut); font-weight: 500; margin-left: 2px; }
.kpi .d { font-size: 13px; color: var(--mut); }
.kpi .d b { color: var(--grn); font-weight: 600; }

.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

/* chart */
.chart { position: relative; height: 240px; }
.chart svg { display: block; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 7px; white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .12s; box-shadow: var(--shadow-sm); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--mut); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bars .row .t { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.bars .row .t span:first-child { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.bars .row .t i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bars .row .t span:last-child { color: var(--mut); font-variant-numeric: tabular-nums; }
.bars .track { height: 8px; background: #f2f4f7; border-radius: 4px; overflow: hidden; }
.bars .track div { height: 100%; border-radius: 4px; }
.split { display: flex; height: 28px; border-radius: 7px; overflow: hidden; margin: 6px 0 10px; font-size: 12.5px; font-weight: 500; color: #fff; }
.split div { display: flex; align-items: center; padding: 0 10px; white-space: nowrap; overflow: hidden; }
.mini-h { font-size: 13.5px; font-weight: 600; color: var(--ink); margin: 22px 0 10px; }

/* pipeline */
.pipe { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.pipe > div { padding: 12px 14px; }
.pipe > div:nth-child(odd) { border-right: 1px solid var(--line); }
.pipe > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.pipe .k { font-size: 12.5px; color: var(--mut); }
.pipe .v { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pipe .v small { font-size: 12px; color: var(--mut); font-weight: 500; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
table.t thead th { background: var(--head); color: var(--mut); font-size: 12.5px; font-weight: 500; text-align: left; padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.t tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13.5px; color: var(--body); }
table.t tbody tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fafbfc; }
td.ref { font: 400 13px var(--mono); color: var(--mut); white-space: nowrap; }
td.who b { display: block; font-weight: 500; color: var(--ink); white-space: nowrap; }
td.who span { font-size: 12.5px; color: var(--mut); }
td.who span.mono { font: 400 12px var(--mono); }
td.when { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.dl { white-space: nowrap; text-align: right; }
td.dl .btn + .btn { margin-left: 4px; }
.cl { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.cl i { width: 8px; height: 8px; border-radius: 50%; }
.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 12px; background: #f2f4f7; color: var(--body); white-space: nowrap; border: 1px solid #e4e7ec; }
.tag.ok { background: var(--grn-soft); color: var(--grn); border-color: #abefc6; }
.tag.red { background: #fef6e7; color: #a15c07; border-color: #f7d9a4; }
.tag.blk { background: var(--primary-soft); color: var(--primary); border-color: #c7e2dd; }
.tag.file { font: 400 12px var(--mono); }
.empty-row td { text-align: center; color: var(--mut); padding: 32px !important; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 12px; font: 400 14px var(--font); background-color: #fff; width: auto; box-shadow: var(--shadow-xs); }
.filters select { padding-right: 32px; }
.filters input { width: 280px; max-width: 100%; }
.filters .count { margin-left: auto; font-size: 13px; color: var(--mut); }

/* ================= form page ================= */
.compose { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: 20px; align-items: start; }
.steps-bar { display: flex; gap: 6px; }
.steps-bar div { padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--mut); border: 1px solid var(--line-2); border-radius: 20px; background: #fff; display: flex; gap: 7px; align-items: center; white-space: nowrap; }
.steps-bar div b { font-weight: 600; font-size: 11px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: #f2f4f7; color: var(--mut); }
.steps-bar div.on { color: var(--grn); border-color: #abefc6; background: var(--grn-soft); }
.steps-bar div.on b { background: var(--grn); color: #fff; }

.fs { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px 22px; margin-bottom: 14px; box-shadow: var(--shadow-xs); }
.fs.cfg { background: #fff; border-color: #c7e2dd; box-shadow: inset 3px 0 0 var(--primary), var(--shadow-xs); }
.fs h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.fs h2 .n { font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.fs h2 .k { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--mut); background: #f2f4f7; padding: 2px 9px; border-radius: 12px; }

.grid { display: grid; gap: 16px 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cfg .g3 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; }
.grid.tight { gap: 0 12px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.fs > .field + .field { margin-top: 16px; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--body); }
.field em { color: var(--red); font-style: normal; }
input:not([type=radio]):not([type=checkbox]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; font: 400 14.5px var(--font); color: var(--ink); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background-color: #fff; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #7fb8b0; box-shadow: 0 0 0 4px var(--primary-soft); }
::placeholder { color: var(--mut-2); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: #fda29b; }
.field.invalid input:focus, .field.invalid select:focus, .field.invalid textarea:focus { box-shadow: 0 0 0 4px #fee4e2; }
.field .err { font-size: 13px; color: var(--red); }
.field small { font-size: 13px; color: var(--mut); }
.field small.calc.good { color: var(--grn); font-weight: 500; }
.field small.calc.bad { color: var(--red); }
.count { align-self: flex-end; }
.sig { font-family: "Segoe Script", "Brush Script MT", cursive !important; font-size: 19px !important; }
.hint { margin: 14px 0 0; padding: 10px 14px; border: 1px solid #c7e2dd; background: var(--primary-soft); font-size: 13.5px; border-radius: var(--r-sm); color: var(--primary); }
.color-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 4px 10px 4px 4px; box-shadow: var(--shadow-xs); }
.color-row input { width: 32px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-row code { font: 400 13px var(--mono); color: var(--body); }
.seg { display: inline-flex; background: #f2f4f7; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; align-self: flex-start; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 14px; border-radius: 6px; font-size: 13.5px; font-weight: 500; color: var(--mut); }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid #7fb8b0; }
input[type=range] { accent-color: var(--primary); width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; cursor: pointer; font-size: 14px; color: var(--body); }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.check.invalid span { color: var(--red); }
.meds { display: flex; flex-direction: column; gap: 8px; }
.med-row { display: grid; grid-template-columns: 1.4fr .8fr 1fr 40px; gap: 8px; }
.med-row button { border: 1px solid var(--line-2); background: #fff; border-radius: var(--r-sm); cursor: pointer; color: var(--mut); font-size: 18px; line-height: 1; box-shadow: var(--shadow-xs); }
.med-row button:hover { color: var(--red); border-color: #fda29b; }
.btn.add { align-self: flex-start; margin-top: 8px; }

.submit-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 12px 20px; margin-bottom: 8px; box-shadow: 0 12px 24px -10px rgba(16, 24, 40, .18), var(--shadow-xs); }
.status { font-size: 13.5px; color: var(--mut); display: flex; align-items: center; gap: 12px; }
.status .bar { width: 120px; height: 6px; border-radius: 3px; background: #f2f4f7; overflow: hidden; }
.status .bar i { display: block; height: 100%; background: #17b26a; transition: width .25s; }
.status b { color: var(--ink); }

.out { position: sticky; top: 84px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 104px); min-height: 560px; box-shadow: var(--shadow-xs); }
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { font: 500 14px var(--font); color: var(--mut); background: none; border: 0; padding: 14px 6px 12px; margin-right: 14px; border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabpane { display: none; flex: 1; min-height: 0; overflow: auto; }
.tabpane.on { display: flex; flex-direction: column; }
.pane-note { margin: 16px 18px 0; color: var(--mut); font-size: 13.5px; }
.pane-note code { font: 400 12.5px var(--mono); background: #f2f4f7; padding: 1px 6px; border-radius: 5px; color: var(--ink); }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; color: var(--mut); }
.empty h3 { margin: 18px 0 4px; color: var(--ink); font-size: 16px; font-weight: 600; }
.empty p { margin: 0; max-width: 38ch; }
.sheet-ghost { width: 148px; height: 190px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 9px; box-shadow: 0 12px 24px -12px rgba(16, 24, 40, .25); }
.sheet-ghost i { display: block; height: 6px; background: #f2f4f7; border-radius: 3px; }
.sheet-ghost i:first-child { height: 14px; width: 55%; background: var(--primary); }
.sheet-ghost i:nth-child(2) { height: 10px; background: #c7e2dd; }
.sheet-ghost i:nth-child(4) { width: 70%; } .sheet-ghost i:nth-child(6) { width: 45%; }

#result { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.res-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 16px 18px 12px; }
.res-h h3 { margin: 8px 0 2px; font-size: 17px; font-weight: 600; }
.res-h p { margin: 0; color: var(--mut); font-size: 13px; }
.res-h .dl { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.timings { list-style: none; margin: 0; padding: 0 18px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.timings li { font-size: 12.5px; border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; color: var(--mut); background: var(--head); }
.timings li b { font: 500 12px var(--mono); color: var(--ink); margin-left: 5px; }
.viewer { flex: 1; min-height: 420px; display: flex; flex-direction: column; background: #eef0f3; border-top: 1px solid var(--line); }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--body); }
.pv-pages-count { font-weight: 500; color: var(--ink); }
.pv-zoom { display: flex; align-items: center; gap: 6px; margin: 0 auto; }
.pv-zoom span { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.pv-btn { display: inline-flex; align-items: center; justify-content: center; height: 30px; min-width: 30px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 7px; background: #fff; color: var(--body); font: 500 15px/1 var(--font); cursor: pointer; text-decoration: none; }
.pv-btn.wide { font-size: 13px; padding: 0 10px; }
.pv-btn:hover { background: var(--head); color: var(--ink); }
.pv-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.pv-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pv-page { display: block; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .12), 0 8px 24px -12px rgba(16, 24, 40, .25); border-radius: 2px; }
.json { margin: 14px 18px 18px; padding: 16px 18px; background: var(--side); color: #cbd5e1; border-radius: var(--r-sm); font: 400 12.5px/1.65 var(--mono); overflow: auto; flex: 1; white-space: pre-wrap; word-break: break-word; }
.json .k { color: #93c5fd; } .json .s { color: #e2e8f0; } .json .n { color: #fdba74; } .json .b { color: #86efac; }

/* ================= templates / brands / api ================= */
.tpl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tpl { padding: 20px; }
.tpl-top { display: flex; gap: 16px; }
.tpl-thumb { width: 92px; height: 118px; flex: none; border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 9px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow-sm); }
.tpl-thumb i { display: block; height: 4px; background: #eef0f3; border-radius: 2px; }
.tpl-thumb i.h { height: 8px; width: 60%; background: var(--primary); }
.tpl-thumb i.b { height: 7px; background: #c7e2dd; }
.tpl h3 { margin: 0; font-size: 16px; font-weight: 600; }
.tpl .meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tpl .facts { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 22px; justify-content: start; font-size: 13px; color: var(--mut); }
.tpl .facts b { display: block; font-size: 20px; font-weight: 600; color: var(--ink); }
.fields { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fields code { font: 400 12px var(--mono); background: var(--head); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; color: var(--body); }
.fields code.c { background: var(--amb-soft); border-color: #fedf89; color: var(--amb); }
.fields code.l { background: var(--primary-soft); color: var(--primary); border-color: #c7e2dd; }

.brand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.bc { overflow: hidden; }
.bc .strip { height: 4px; }
.bc .in { padding: 18px 20px 20px; }
.bc .hd { display: flex; gap: 12px; align-items: center; }
.bc img { width: 44px; height: 44px; border-radius: 10px; }
.bc h3 { margin: 0; font-size: 15px; font-weight: 600; }
.bc .hex { font: 400 12.5px var(--mono); color: var(--mut); }
.bc dl { margin: 16px 0; display: grid; grid-template-columns: 80px 1fr; gap: 6px 10px; font-size: 13.5px; }
.bc dt { color: var(--mut); }
.bc dd { margin: 0; overflow-wrap: anywhere; color: var(--body); }

.api { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.endpoint { display: flex; align-items: center; gap: 10px; font: 400 14px var(--mono); padding: 12px 14px; background: var(--head); border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 14px; }
.endpoint .m { font: 600 12px var(--font); color: var(--grn); background: var(--grn-soft); border: 1px solid #abefc6; padding: 2px 8px; border-radius: 6px; }
.code { background: var(--side); color: #e2e8f0; border-radius: var(--r-sm); padding: 16px 18px; font: 400 12.5px/1.65 var(--mono); overflow: auto; white-space: pre; max-height: 470px; margin: 0; }
.code .c { color: #74839a; }
.params { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--body); }
.params td { padding: 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.params td:first-child { font: 400 13px var(--mono); width: 150px; color: var(--ink); }
.params code { font: 400 12.5px var(--mono); background: var(--head); padding: 1px 5px; border-radius: 4px; }
.note { border: 1px solid #c7e2dd; background: var(--primary-soft); padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; color: var(--primary); margin-bottom: 16px; }
.note b { color: var(--primary); }

.toast { position: fixed; right: 24px; bottom: 24px; transform: translateY(14px); opacity: 0; background: var(--ink); color: #fff; padding: 12px 16px 12px 14px; border-radius: var(--r-sm); font-size: 14px; transition: all .2s; pointer-events: none; z-index: 60; display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px); box-shadow: 0 12px 24px -8px rgba(16, 24, 40, .3); }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #17b26a; flex: none; }
.toast.err::before { background: #f04438; }
.toast.show { opacity: 1; transform: none; }
.foot-note { text-align: center; color: var(--mut-2); font-size: 12.5px; padding: 0 16px 24px; }


/* ================= responsive ================= */
@media (max-width: 1180px) {
  .compose, .grid2, .api { grid-template-columns: minmax(0, 1fr); }
  .card, .kpi { min-width: 0; }
  .out { position: static; height: auto; min-height: 0; }
  .viewer { height: 80vh; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tpl-grid { grid-template-columns: 1fr; }
  .user .who { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-flex; }
  .search, .chip-demo { display: none; }
  .user { margin-left: auto; border-left: 0; padding-left: 0; }
  .top { padding: 0 16px; }
  .page { padding: 20px 16px 32px; }
  .steps-bar { display: none; }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .ic { display: none; }
  .kpi .v { font-size: 24px; }
  .kpi .c { font-size: 13px; }
  .ph h1 { font-size: 22px; }
  .g2, .g3, .cfg .g3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .grid.tight { grid-template-columns: 1fr 1fr; }
  .fs { padding: 16px; }
  .med-row { grid-template-columns: 1fr 1fr; }
  .med-row input:first-child { grid-column: 1 / -1; }
  .submit-bar { padding: 10px 10px 10px 14px; }
  .status .bar { display: none; }
  .res-h { flex-direction: column; }
  .res-h .dl { justify-content: flex-start; }
  .viewer { min-height: 0; }
  .pv-scroll { max-height: 70vh; padding: 10px; }
  .pv-zoom .wide { display: none; }
  .tpl-top { flex-direction: column; }
  .filters input { width: 100%; }
  .tpl .facts { grid-template-columns: repeat(2, auto); }
}
