:root {
  /* палитра и шрифт — из шаблона презентации хакатона: синий #002150, оранжевый #F26722, узкий гротеск */
  --brand: #002150;
  --navy: #002150;
  --navy-2: #2a4f8f;
  --primary: #f26722;
  --primary-2: #ff7a35;
  --act: #002150;
  --act-text: #ffffff;
  --sky: #e8eef8;
  --accent: #f26722;
  --accent-2: #ff7a35;
  --accent-bg: #fdeee6;
  --mark: #ffd9c4;
  --bg: #f1f4f9;
  --panel: #ffffff;
  --field: #ffffff;
  --paper: #ffffff;
  --line: #d6deea;
  --text: #142033;
  --muted: #5b6a80;
  --ok: #1f8a4c;
  --ok-bg: #e6f5ec;
  --warn: #b7791f;
  --warn-bg: #fff6e0;
  --warn-line: #f5d29b;
  --warn-text: #7c4a03;
  --err: #bf1e2e;
  --err-bg: #fdecec;
  --overlay: rgba(255, 255, 255, .86);
  --shadow: rgba(0, 33, 80, .14);
  color-scheme: light;
  --radius: 4px;
  font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  font-size: 15px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #ffffff;
    --navy-2: #a9c1e6;
    --act: #ffffff;
    --act-text: #002150;
    --sky: rgba(255, 255, 255, .08);
    --accent-bg: rgba(242, 103, 34, .16);
    --mark: rgba(242, 103, 34, .38);
    --bg: #001838;
    --panel: #002150;
    --field: #0a2c5e;
    --paper: #e9edf3;
    --line: rgba(255, 255, 255, .16);
    --text: #ffffff;
    --muted: rgba(255, 255, 255, .66);
    --ok: #4cc38a;
    --ok-bg: rgba(76, 195, 138, .15);
    --warn: #f0b44c;
    --warn-bg: rgba(240, 180, 76, .14);
    --warn-line: rgba(240, 180, 76, .4);
    --warn-text: #f3c879;
    --err: #ff7b7b;
    --err-bg: rgba(255, 107, 107, .15);
    --overlay: rgba(0, 24, 56, .88);
    --shadow: rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #ffffff;
  --navy-2: #a9c1e6;
  --act: #ffffff;
  --act-text: #002150;
  --sky: rgba(255, 255, 255, .08);
  --accent-bg: rgba(242, 103, 34, .16);
  --mark: rgba(242, 103, 34, .38);
  --bg: #001838;
  --panel: #002150;
  --field: #0a2c5e;
  --paper: #e9edf3;
  --line: rgba(255, 255, 255, .16);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .66);
  --ok: #4cc38a;
  --ok-bg: rgba(76, 195, 138, .15);
  --warn: #f0b44c;
  --warn-bg: rgba(240, 180, 76, .14);
  --warn-line: rgba(240, 180, 76, .4);
  --warn-text: #f3c879;
  --err: #ff7b7b;
  --err-bg: rgba(255, 107, 107, .15);
  --overlay: rgba(0, 24, 56, .88);
  --shadow: rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); height: 100vh; display: flex; flex-direction: column; }

.top { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 18px; background: var(--brand); color: #fff; }
.top::before { content: ""; position: absolute; left: -120px; top: -150px; width: 600px; height: 591px; background: url(/img/dots.png) 0 0/100% 100%; opacity: .35; pointer-events: none; }
.top > * { position: relative; }
.brand { display: flex; gap: 14px; align-items: center; }
.brand .ira { height: 46px; width: auto; display: block; }
.brand .sep { width: 1px; align-self: stretch; margin: 4px 0; background: rgba(255, 255, 255, .25); }
.brand b { display: block; font-size: 26px; font-weight: 400; line-height: 1.05; letter-spacing: .2px; }
.brand small { display: block; color: rgba(255, 255, 255, .72); font-size: 13px; margin-top: 2px; }
.brand small em { font-style: normal; color: var(--accent); font-weight: 700; }
.top .ghost, .top .icon { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); }
.top .ghost:hover:not(:disabled), .top .icon:hover { border-color: var(--accent); color: #fff; }
.top .switch { color: #fff; }
.icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; }
.icon svg { width: 18px; height: 18px; }
.actions { display: flex; gap: 8px; align-items: center; }
.group { display: flex; }
.group button { border-radius: 0; margin-left: -1px; }
.group button:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.group button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.group .primary { border-color: var(--accent); }

button { font: inherit; font-size: 14px; border-radius: var(--radius); padding: 8px 14px; border: 1px solid transparent; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--primary); color: #fff; font-weight: 700; letter-spacing: .2px; }
.primary:hover:not(:disabled) { background: var(--primary-2); }
.ghost { background: var(--field); color: var(--navy); border-color: var(--line); }
.ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.secondary { background: var(--field); color: var(--navy); border-color: var(--line); width: 100%; margin-top: 8px; }
.secondary:hover { border-color: var(--navy-2); }
.big { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; margin-top: 10px; }
.big small { display: block; font-size: 12px; font-weight: 400; opacity: .85; margin-top: 2px; }
.step-head { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--navy); margin: 4px 0 8px; }
.step-head ~ .step-head { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.step-head .num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; }

.grid { flex: 1; display: grid; grid-template-columns: 340px 1fr 330px; min-height: 0; }
.panel { background: var(--panel); padding: 16px; overflow: auto; }
.input { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.report { border-left: 1px solid var(--line); }
label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 10px 0 6px; }
select, textarea { width: 100%; font: inherit; font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--field); color: var(--text); }
textarea { flex: 1; min-height: 240px; resize: none; line-height: 1.5; }
.highlight { flex: 1; min-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.highlight mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.canvas-wrap { position: relative; min-width: 0; display: flex; flex-direction: column; }
#canvas { position: relative; flex: 1; min-height: 0; background: var(--paper); }
.empty { position: absolute; inset: 0; overflow: hidden; background: var(--bg); display: grid; place-content: center; text-align: center; padding: 40px; color: var(--muted); pointer-events: none; }
.empty::before { content: ""; position: absolute; left: -196px; top: -60px; width: 900px; height: 886px; background: url(/img/dots.png) 0 0/100% 100%; opacity: .5; }
.empty > * { position: relative; }
.empty .kicker { font-size: 18px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }
.empty h2 { color: var(--navy); margin: 0 0 14px; font-size: 38px; line-height: 1.1; font-weight: 300; }
.empty p { max-width: 560px; margin: 0 auto; line-height: 1.45; font-size: 17px; }
.flow { list-style: none; counter-reset: f; display: grid; grid-template-columns: repeat(4, minmax(0, 165px)); gap: 10px; padding: 0; margin: 26px auto 0; text-align: left; }
.flow li { counter-increment: f; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px; background: var(--field); font-size: 14px; line-height: 1.35; }
.flow li { border-top: 3px solid var(--accent); }
.flow li::before { content: counter(f); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.flow b { display: block; color: var(--navy); font-size: 16px; margin-bottom: 2px; }
.zoom { position: absolute; right: 16px; bottom: 56px; z-index: 5; display: flex; flex-direction: column; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px var(--shadow); overflow: hidden; }
.zoom button { width: 34px; height: 34px; padding: 0; border-radius: 0; background: var(--field); color: var(--navy); font-size: 18px; line-height: 1; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--bg); }
#canvas .djs-palette { left: 12px; top: 56px; border-radius: var(--radius); border-color: var(--line); box-shadow: 0 2px 8px var(--shadow); }
#canvas .djs-palette.open { width: 74px; }
#canvas .djs-palette .entry, #canvas .djs-palette .djs-palette-toggle { width: 36px; height: 36px; line-height: 36px; font-size: 24px; }
#canvas .djs-palette .separator { margin: 3px 5px; padding-top: 3px; }
#canvas .djs-palette .group { flex-wrap: wrap; }
#canvas .djs-palette .entry { flex: 0 0 36px; }
.canvas-wrap:has(#empty:not([hidden])) :is(.djs-palette, .bts-toggle-mode, .bjs-breadcrumbs, .bjsl-button) { display: none !important; }
#canvas .bts-toggle-mode { top: 12px; left: 12px; border-radius: var(--radius); padding: 6px 10px; font-size: 13px; background: var(--field); border: 1px solid var(--line); color: var(--navy); box-shadow: 0 2px 8px var(--shadow); }
#canvas.simulation .bts-toggle-mode, #canvas .bjs-container.simulation .bts-toggle-mode, #canvas .bts-toggle-mode:hover { background: var(--ok); border-color: var(--ok); color: #fff; }
.loading { position: absolute; inset: 0; background: var(--overlay); display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--navy); font-weight: 600; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--sky); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 18px 0 8px; }
h3:first-child { margin-top: 0; }
.badge { padding: 10px 12px; border-radius: var(--radius); background: var(--bg); font-weight: 600; font-size: 14px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--err-bg); color: var(--err); }
.badge.stale { background: var(--warn-bg); color: var(--warn-text); font-weight: 500; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.tile b { display: block; font-size: 26px; font-weight: 400; color: var(--navy); }
.tile span { font-size: 12px; color: var(--muted); }
.tile.good b { color: var(--ok); }
.tile.bad b { color: var(--err); }
.issues { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.issues li { font-size: 13px; line-height: 1.4; padding: 8px 10px; border-radius: var(--radius); background: var(--bg); border-left: 3px solid var(--line); cursor: default; }
.issues li[data-el] { cursor: pointer; }
.issues li.error { border-left-color: var(--err); }
.issues li.warning { border-left-color: var(--warn); }
.issues li.info { border-left-color: #7f93b0; }
.issues li.group { background: none; border: 0; padding: 10px 2px 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7a90); }
.issues .tag { font-size: 11px; font-weight: 700; margin-right: 6px; text-transform: uppercase; }
.issues .fixed { color: var(--ok); }
.muted { color: var(--muted); font-size: 13px; }
.trace { font-size: 13px; line-height: 1.5; }
.trace b { color: var(--navy); }
.trace q { display: block; margin-top: 6px; padding: 8px 10px; background: var(--accent-bg); border-left: 3px solid var(--accent); border-radius: var(--radius); quotes: "«" "»"; }

.djs-element.issue-mark .djs-visual > :first-child { stroke: var(--accent) !important; stroke-width: 3px !important; }

.tabs { display: flex; gap: 4px; margin: 10px 0 6px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 8px; color: var(--muted); font-size: 14px; }
.tab.active { color: var(--navy); border-bottom-color: var(--accent); font-weight: 600; }
.code-pane { flex: 1 0 320px; display: flex; flex-direction: column; }
.code-pane .hint { margin: 0 0 6px; }
#code { flex: 1; min-height: 0; font-family: "JetBrains Mono", "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.45; white-space: pre; resize: none; }

@media (max-width: 1100px) {
  body { height: auto; min-height: 100vh; }
  .top { flex-wrap: wrap; gap: 10px; }
  .grid { grid-template-columns: 1fr; }
  .input, .report { border: none; border-bottom: 1px solid var(--line); }
  .canvas-wrap { height: 70vh; }
  textarea#text, .highlight { min-height: 200px; }
}
.fast { text-transform: none; letter-spacing: 0; display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.fast input { margin-top: 2px; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 3px; }
.seg { background: none; color: var(--muted); padding: 7px 6px; font-size: 13px; line-height: 1.25; border-radius: var(--radius); }
.seg.active { background: var(--act); color: var(--act-text); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.seg:not(.active):hover { color: var(--navy); background: var(--field); }
.segmented.three { grid-template-columns: .9fr 1fr 1.3fr; }
.qseg { background: none; color: var(--muted); padding: 7px 3px; font-size: 12px; line-height: 1.25; border-radius: var(--radius); }
.qseg.active { background: var(--act); color: var(--act-text); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.qseg:not(.active):hover { color: var(--navy); background: var(--field); }
.clarify-head { margin: 12px 0 6px; font-size: 13px; font-weight: 600; color: var(--navy); }
.clarify-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.clarify-row label { margin: 0; }
.stepper { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stepper button { background: var(--field); color: var(--navy); padding: 4px 11px; border-radius: 0; font-size: 16px; line-height: 1; }
.stepper button:hover { background: var(--bg); }
.stepper input { width: 38px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: inherit; font-weight: 600; color: var(--navy); background: var(--field); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
#q-hint { margin-top: 4px; }

.questions { position: absolute; inset: 0; z-index: 6; overflow: auto; background: var(--bg); padding: 28px 24px; }
.q-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.q-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--navy); }
.q-head h2 { margin: 0; font-size: 28px; font-weight: 300; }
#q-list { display: grid; gap: 12px; }
.q-actions { display: flex; gap: 10px; position: sticky; bottom: -28px; padding: 12px 0 28px; background: var(--bg); }
.q-actions button { width: auto; flex: 0 0 auto; padding-left: 22px; padding-right: 22px; }
.q-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 0; background: var(--field); }
.q-card legend { float: left; width: 100%; font-weight: 600; font-size: 15px; color: var(--navy); padding: 0; margin-bottom: 2px; line-height: 1.35; }
.q-card legend + * { clear: both; }
.q-card .why { margin: 2px 0 8px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.opt { display: flex; gap: 8px; align-items: flex-start; text-transform: none; letter-spacing: 0; color: var(--text); font-size: 14px; margin: 4px 0; padding: 6px 8px; border-radius: var(--radius); line-height: 1.35; cursor: pointer; }
.opt:hover { background: var(--bg); }
.opt:has(input:checked) { background: var(--sky); }
.opt input { margin-top: 3px; accent-color: var(--accent); }
.opt em { font-style: normal; font-size: 11px; color: var(--ok); background: var(--ok-bg); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
.own-text { width: 100%; font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; margin-top: 4px; background: var(--field); color: var(--text); }

.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--navy); text-transform: none; letter-spacing: 0; margin: 0 6px 0 0; cursor: pointer; }
.switch input { accent-color: var(--accent); }

.view-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.vtab { background: none; color: var(--muted); border-radius: 0; padding: 6px 12px; font-size: 15px; border-bottom: 2px solid transparent; }
.vtab:hover:not(:disabled):not(.active) { color: var(--primary); }
.vtab.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--accent); }
.spacer { flex: 1; }
#level-hint { font-size: 12px; margin-right: 8px; }
.small { white-space: nowrap; background: var(--field); border: 1px solid var(--line); color: var(--navy); padding: 5px 10px; font-size: 12px; border-radius: var(--radius); }
.small:hover:not(:disabled) { border-color: var(--navy-2); }

.doc { position: absolute; inset: 47px 0 0 0; overflow: auto; background: var(--panel); color: var(--text); font-family: "Open Sans", Arial, sans-serif; padding: 28px 40px 60px; line-height: 1.5; font-size: 14px; }
.doc h1 { font-family: "Roboto Condensed", Arial, sans-serif; font-size: 30px; font-weight: 300; color: var(--navy); margin: 0 0 18px; }
.doc h2 { font-family: "Roboto Condensed", Arial, sans-serif; font-size: 19px; color: var(--navy); margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.doc h2.stage { border-bottom: 2px solid var(--accent); }
.doc table { border-collapse: collapse; width: 100%; max-width: 900px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc .kv th { width: 210px; background: var(--bg); font-weight: 600; }
.doc .grid2 tr:first-child th { background: var(--bg); }
.doc .card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; max-width: 900px; }
.doc .card h3 { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--navy); margin: 0 0 8px; }
.doc dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 0; }
.doc dt { color: var(--muted); font-size: 13px; }
.doc dd { margin: 0; }
.doc dd ul, .doc ul { margin: 0; padding-left: 18px; }
.doc .card p { margin: 8px 0 0; color: var(--text); }
.doc .route { margin-top: 8px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }

.small.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.small.accent:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
#loading-time { color: var(--muted); font-weight: 400; font-size: 13px; }
.toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 8; max-width: min(640px, calc(100% - 32px)); padding: 10px 16px; border-radius: var(--radius); background: var(--brand); color: #fff; font-size: 14px; line-height: 1.4; box-shadow: 0 6px 20px var(--shadow); cursor: pointer; }
.toast.error { background: var(--err); }
.toast.ok { background: var(--ok); }

@media (max-width: 1400px) {
  #level-hint { display: none; }
}

@media (max-width: 700px) {
  .djs-palette { display: none; }
  .brand small { display: none; }
  .actions { flex-wrap: wrap; }
  .actions button { padding: 7px 10px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .view-tabs { overflow-x: auto; scrollbar-width: none; }
  .view-tabs > * { flex: 0 0 auto; }
  #canvas .bjsl-button { font-size: 12px; padding: 4px 10px; max-width: calc(100% - 140px); white-space: nowrap; }
  #level-hint { display: none; }
  .doc { padding: 18px 16px 40px; }
  .doc dl { grid-template-columns: 1fr; }
  .doc .kv th { width: auto; }
  .questions { padding: 16px; }
  .q-actions { flex-wrap: wrap; bottom: -16px; padding-bottom: 16px; }
  .q-actions button { flex: 1 1 100%; }
}
.doc .blank { color: var(--warn); font-style: italic; }

.canvas-wrap { --ed-w: min(44%, 560px); }
.canvas-wrap.editing #canvas { margin-left: var(--ed-w); border-left: 1px solid var(--line); }
.editor { position: absolute; left: 0; bottom: 0; width: var(--ed-w); overflow: auto; background: var(--bg); padding: 14px 14px 60px; font-size: 13px; }
.editor input, .editor textarea, .editor select { font: inherit; font-size: 13px; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 7px; background: var(--field); color: var(--text); }
.editor input:focus, .editor textarea:focus, .editor select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(242, 103, 34, .22); }
.editor textarea { resize: vertical; min-height: 34px; }
.editor .bad { border-color: var(--err); background: var(--err-bg); }
.editor label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
.editor label small { font-size: 11px; opacity: .8; }
.ed-top { position: sticky; top: -14px; z-index: 2; background: var(--bg); padding: 0 0 8px; margin: 0 0 6px; }
.editor .ed-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.ed-status { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); min-height: 16px; }
.ed-status.ok { color: var(--ok); }
.ed-status.warn { color: var(--warn); }
.ed-status.err { color: var(--err); }
.ed-passport { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 10px; }
.ed-passport summary, .ed-step details summary { cursor: pointer; color: var(--navy-2); font-size: 12px; }
.ed-passport .ed-grid { margin-top: 8px; }
.ed-stage { margin: 14px 0; }
.ed-stage-head { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); margin-bottom: 8px; }
.ed-stage-head span { font-weight: 700; color: var(--accent); white-space: nowrap; }
.ed-stage-head input { font-weight: 600; color: var(--navy); }
.ed-stage-head button, .ed-tools button, .ed-branch button, .ed-branch-head button { flex: none; background: var(--field); border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius); width: 26px; height: 26px; padding: 0; font-size: 13px; line-height: 1; cursor: pointer; }
.ed-stage-head button:hover, .ed-tools button:hover, .ed-branch button:hover, .ed-branch-head button:hover { color: var(--navy); border-color: var(--navy-2); }
.ed-step { background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; margin: 6px 0; transition: border-color .2s, box-shadow .2s; }
.ed-step.open, .ed-step:focus-within { border-color: var(--accent); box-shadow: 0 2px 10px var(--shadow); }
.ed-step.par { margin-left: 18px; border-left: 3px solid var(--navy-2); }
.ed-step.flash { animation: ed-flash 1.2s; }
@keyframes ed-flash { 0%, 40% { background: var(--accent-bg); } 100% { background: var(--field); } }
.ed-step-head { display: flex; align-items: center; gap: 6px; }
.ed-num { flex: none; font-weight: 700; color: var(--navy); min-width: 28px; }
.editor .ed-name { font-weight: 600; }
.ed-tools { display: flex; gap: 3px; flex: none; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.ed-grid .wide { grid-column: 1 / -1; }
.ed-step details { margin-top: 6px; }
.ed-step details textarea { margin-top: 4px; }
.ed-route { margin-top: 8px; padding: 7px 9px; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 var(--radius) var(--radius) 0; display: flex; flex-direction: column; gap: 5px; }
.editor .ed-route label.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.editor .ed-route label.chk input { width: auto; accent-color: var(--accent); }
.editor .ed-next { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.ed-branch-head, .ed-branch { display: flex; align-items: center; gap: 6px; }
.ed-branch-head span { font-weight: 600; color: var(--text); white-space: nowrap; }
.ed-branch input { flex: 0 0 34%; }
.ed-branch span { color: var(--muted); }
.ed-note { margin: 0; color: var(--navy-2); font-size: 12px; }
.ed-link { align-self: flex-start; background: none; border: none; color: var(--accent); padding: 0; font-size: 12px; cursor: pointer; }
.ed-add { width: 100%; background: var(--field); border: 1px dashed var(--line); color: var(--navy-2); border-radius: var(--radius); padding: 7px; font-size: 13px; cursor: pointer; }
.ed-add:hover { border-color: var(--accent); color: var(--accent); }
#canvas .ed-focus .djs-visual > rect { stroke: var(--accent) !important; stroke-width: 4px !important; }
@media (max-width: 700px) {
  .canvas-wrap { --ed-w: 100%; }
  .canvas-wrap.editing #canvas { visibility: hidden; }
  .ed-grid { grid-template-columns: 1fr; }
}
@media (min-width: 1101px) {
  .grid:has(.canvas-wrap.editing) { grid-template-columns: 0 1fr 0; }
  .grid:has(.canvas-wrap.editing) > .panel { visibility: hidden; overflow: hidden; padding: 0; border: 0; }
}
.canvas-wrap.editing :is(.djs-palette, .bts-toggle-mode, .bjsl-button) { display: none !important; }
.canvas-wrap.editing #level-hint { display: none; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.menu-list button { background: none; border: 0; border-radius: var(--radius); text-align: left; color: var(--text); padding: 8px 10px; font-size: 14px; }
.menu-list button:hover:not(:disabled) { background: var(--sky); }
.menu-list button small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.settings { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.settings summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--navy); }
.settings summary .muted { font-weight: 400; }
.settings[open] summary { margin-bottom: 4px; }

.editor .ed-name:not(:focus):not(.bad) { border-color: transparent; background: transparent; padding-left: 2px; }
.ed-tools { visibility: hidden; }
.ed-step:hover .ed-tools, .ed-step.open .ed-tools { visibility: visible; }
.ed-stage-head button { visibility: hidden; }
.ed-stage-head:hover button { visibility: visible; }
.ed-meta { margin: 1px 0 0 34px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-meta i { font-style: normal; margin: 0 5px; opacity: .6; }
.ed-meta .miss { color: var(--err); font-weight: 500; }
.ed-step.open .ed-meta { display: none; }
.ed-body { display: none; margin-top: 8px; }
.ed-step.open .ed-body { display: block; }
.ed-warn { flex: none; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: var(--radius); font-size: 11px; font-weight: 700; padding: 1px 7px; cursor: help; }
.ed-notes { margin: 0 0 8px; padding: 7px 9px 7px 24px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); font-size: 12px; color: var(--warn-text); }
.ed-notes li + li { margin-top: 4px; }
.ed-step .ed-route { margin-top: 8px; }
.ed-more { margin-top: 8px; }
.ed-more summary { cursor: pointer; color: var(--navy-2); font-size: 12px; }
.ed-more[open] summary { margin-bottom: 6px; }
.editor label { text-transform: none; letter-spacing: 0; margin: 0; }
@media (min-width: 1101px) {
  .grid.left-hidden { grid-template-columns: 0 1fr 330px; }
  .grid.right-hidden { grid-template-columns: 340px 1fr 0; }
  .grid.left-hidden.right-hidden, .grid:is(.left-hidden, .right-hidden):has(.canvas-wrap.editing) { grid-template-columns: 0 1fr 0; }
  .grid.left-hidden > .panel.input, .grid.right-hidden > .panel.report { visibility: hidden; overflow: hidden; padding: 0; border: 0; }
}
@media (max-width: 1100px) {
  .grid.left-hidden > .panel.input, .grid.right-hidden > .panel.report { display: none; }
}
.canvas-wrap.editing :is(#btn-left, #btn-right) { display: none; }
.side-toggle { font-size: 16px; line-height: 1; padding: 4px 10px; }

select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.report h3 { color: var(--accent); font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }

.epc { position: absolute; inset: 47px 0 0 0; display: flex; flex-direction: column; background: var(--bg); }
.epc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.epc-stats { flex: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text); }
.pill { font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: var(--radius); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--err-bg); color: var(--err); }
.epc-bar .small:not(.ghost) { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.epc-bar .small:not(.ghost):hover { background: var(--primary-2); }
.epc-issues { margin: 0; padding: 8px 14px 8px 32px; background: var(--err-bg); color: var(--err); font-size: 13px; }
.epc-canvas { flex: 1; overflow: auto; padding: 16px; }
.epc-canvas svg { display: block; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); max-width: none; }
@media (max-width: 720px) {
  .epc-stats { flex-basis: 100%; gap: 4px 10px; }
  .epc-canvas { padding: 8px; }
}

textarea#text, .highlight { font-family: "Open Sans", Arial, sans-serif; font-size: 14px; }
body { transition: background-color .2s; }
@media (max-width: 700px) {
  .empty { padding: 20px 16px; place-content: start center; overflow: auto; }
  .empty h2 { font-size: 26px; }
  .empty p { font-size: 15px; }
  .empty .kicker { font-size: 15px; }
  .brand .ira { height: 38px; }
  .brand b { font-size: 22px; }
}
