:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #20272c;
  --muted: #67717a;
  --faint: #98a1a8;
  --line: #dfe2de;
  --line-strong: #c9cec9;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e2f1ee;
  --warn: #9a6700;
  --warn-soft: #fbf0d9;
  --danger: #b3261e;
  --danger-soft: #fbe7e5;
  --ok: #2e7d32;
  --ok-soft: #e6f2e7;
  --shadow: 0 1px 2px rgba(32, 39, 44, .06), 0 8px 24px rgba(32, 39, 44, .08);
  --radius: 8px;
  --topbar-h: 56px;
  --aside-w: 236px;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
pre, code { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  font-family: inherit;
  font-size: 13.5px;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* topbar */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
}
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; color: var(--faint); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.project-select {
  max-width: 280px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); outline: none;
}
.project-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* shell */
.shell { display: flex; flex: 1; min-height: 0; }
.gates {
  width: var(--aside-w); flex: 0 0 var(--aside-w);
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  padding: 12px 10px 16px;
  overflow-y: auto;
}
.gates-label {
  font-size: 11px; color: var(--faint); letter-spacing: 1.2px;
  padding: 10px 8px 6px; text-transform: uppercase;
}
.tools-label { margin-top: 10px; border-top: 1px solid var(--line); }
.gate {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 2px 0;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted);
  text-align: left; transition: background .12s, color .12s;
}
.gate:hover { background: #fff; color: var(--ink); }
.gate.active {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: #cde5e1; font-weight: 600;
}
.gate-icon { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; }
.gate-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.gate-text { flex: 1; font-size: 13.5px; }
.gate-count {
  font-size: 11px; color: var(--faint);
  background: #eef0ed; border-radius: 999px; padding: 2px 7px;
}
.gate.active .gate-count { background: #fff; color: var(--accent-strong); }

.main { flex: 1; min-width: 0; padding: 22px 24px 60px; overflow-y: auto; }

/* generic */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.btn svg, .import-tab svg {
  width: 15px; height: 15px; flex: 0 0 auto;
  stroke: currentColor; fill: none; stroke-width: 1.8;
}
.btn:hover { border-color: var(--faint); background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef0ed; color: var(--ink); }
.btn.danger { color: var(--danger); border-color: #e6c4c1; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--muted);
}
.icon-btn:hover { background: #eef0ed; color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 15px; }
.panel-head h2 { font-size: 16px; }
.panel-hint { line-height: 1.45; max-width: 62%; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 10px; background: var(--surface); outline: none;
  font-size: 13.5px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfcfa; }
td .title-cell { font-weight: 500; display: block; max-width: 520px; line-height: 1.4; }
td .sub-cell { color: var(--muted); font-size: 12px; display: block; margin-top: 3px; }
.table-actions { display: flex; gap: 6px; align-items: center; }
select.mini {
  height: 28px; font-size: 12px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); padding: 0 6px;
}

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #eef0ed; color: var(--muted);
}
.badge.pass { background: var(--ok-soft); color: var(--ok); }
.badge.review { background: var(--warn-soft); color: var(--warn); }
.badge.reject { background: var(--danger-soft); color: var(--danger); }
.badge.background { background: #e8edf5; color: #34507e; }
.badge.method { background: var(--accent-soft); color: var(--accent-strong); }
.badge.benchmark { background: #f3e8f6; color: #7c3aed; }

.tag { display: inline-block; margin: 2px 3px 2px 0; padding: 1px 7px; font-size: 11px; border-radius: 5px; background: #f0f2ef; color: var(--muted); }

/* empty state */
.empty {
  min-height: 260px; display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); padding: 30px;
}
.empty .empty-icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--faint); }
.empty .empty-icon svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 1.4; }
.empty h3 { margin: 0 0 6px; font-size: 15px; }
.empty p { margin: 0 0 16px; color: var(--muted); max-width: 420px; line-height: 1.6; font-size: 13px; }

/* steps */
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step {
  flex: 1; min-width: 130px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); text-align: left;
}
.step.done { border-color: #bcdcd6; background: var(--accent-soft); }
.step.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); box-shadow: 0 0 0 2px var(--accent-soft); }
.step.stale { border-style: dashed; }
.step .step-no { font-size: 11px; color: var(--faint); display: block; }
.step .step-name { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.step .step-desc { font-size: 11px; color: var(--muted); margin-top: 3px; }
.step-results { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.step-result { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px; }
.step-result summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; padding: 9px 0; font-size: 12.5px; font-weight: 600; color: var(--accent-strong);
}
.step-result summary .btn { color: var(--muted); }
.step-result .markdown-body { font-size: 13px; line-height: 1.65; color: var(--ink); padding-bottom: 10px; }
.step-workspace { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.step-workspace-head { gap: 10px; }
.step-title { font-size: 14px; font-weight: 600; }
.step-desc-line { margin: 8px 0 12px; line-height: 1.6; }
.step-qa { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.old-tag { display: block; font-size: 11px; color: var(--faint); margin-bottom: 2px; }
.msg.old { opacity: .65; }

/* chat */
.chat {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); max-height: 420px; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg { max-width: 86%; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.system { align-self: center; color: var(--faint); font-size: 12px; background: transparent; }
.msg.assistant p { margin: 0 0 4px; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input textarea { flex: 1; }


/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  padding: 8px 14px; border: none; background: transparent; color: var(--muted);
  border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500;
}
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.markdown-body { font-size: 13.5px; line-height: 1.75; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { line-height: 1.35; margin: 18px 0 8px; }
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; }
.markdown-body ul, .markdown-body ol { padding-left: 22px; }
.markdown-body pre { background: #f0f2ef; padding: 10px; border-radius: 6px; overflow-x: auto; }
.markdown-body code { background: #f0f2ef; padding: 1px 5px; border-radius: 4px; }
.markdown-body blockquote { border-left: 3px solid var(--line-strong); margin: 0; padding-left: 12px; color: var(--muted); }
.markdown-body img { max-width: 100%; height: auto; border-radius: 6px; }
.math-block { display: block; overflow-x: auto; }

/* modal & drawer */
.overlay {
  position: fixed; inset: 0; background: rgba(32, 39, 44, .34);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  width: min(760px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow);
  padding: 20px;
}
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.drawer-wrap { position: fixed; inset: 0; z-index: 90; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(32, 39, 44, .28); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 94vw);
  background: var(--surface); box-shadow: -8px 0 24px rgba(32,39,44,.12);
  padding: 18px; overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-head h3 { margin: 0; font-size: 15px; }
.pm-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.pm-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto auto auto; gap: 8px; align-items: center; }
.pm-title, .pm-domain { height: 32px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 8px; font-size: 13px; background: #fff; }
@media (max-width: 640px) { .pm-row { grid-template-columns: 1fr; } }
#qr-question { width: 420px; max-width: 100%; resize: vertical; }

/* notices */
.notice { padding: 10px 12px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.err { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* gate pages */
.gate-page > h1 { margin: 0 0 4px; font-size: 21px; }
.gate-page .subtitle { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
.primary-action { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.segment { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segment button { border: none; background: var(--surface); padding: 0 12px; height: 32px; font-size: 12.5px; }
.segment button.active { background: var(--accent); color: #fff; }

.filter-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); margin-bottom: 12px;
}
.filter-bar input, .filter-bar select {
  height: 30px; border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0 8px; font-size: 12.5px; background: #fff;
}
.filter-bar input[type="text"] { width: 150px; }

.filter-row-2 { flex-wrap: wrap; }
.multi-select { position: relative; }
.ms-btn {
  height: 30px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; color: var(--ink); font-size: 12.5px; cursor: pointer;
}
.ms-btn:hover { border-color: var(--faint); }
.ms-menu {
  display: none; position: absolute; top: 34px; left: 0; z-index: 30;
  min-width: 150px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow); padding: 6px;
}
.multi-select.open .ms-menu { display: block; }
.ms-group { font-size: 11px; color: var(--faint); padding: 4px 8px; }
.ms-menu label {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  font-size: 12.5px; cursor: pointer; white-space: nowrap; border-radius: 5px;
}
.ms-menu label:hover { background: var(--surface-2); }
.ms-menu input { width: 14px; height: 14px; accent-color: var(--accent); }

.query-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.query-input {
  flex: 1; min-width: 0; height: 30px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0 8px; font-size: 12.5px; background: #fff;
}
.query-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grade-badge {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.grade-a { background: var(--ok); }
.grade-b { background: #0f766e; }
.grade-c { background: #b8860b; }
.grade-d { background: #9aa0a6; }
.family-card .panel-head { flex-wrap: wrap; }

/* knowledge library */
.kb-tabs { margin-bottom: 12px; }
.kb-module-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.kb-module-input {
  flex: 1; min-width: 0; height: 30px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0 8px; background: #fff; font-size: 12.5px;
}
.kb-module-list { margin-top: 10px; }
.kb-mod-check {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: 12px;
  margin: 2px 4px 2px 0; cursor: pointer; white-space: nowrap;
}
.kb-mod-check input { width: 13px; height: 13px; margin: 0; accent-color: var(--accent); }
.kb-mod-boxes { display: flex; flex-wrap: wrap; gap: 2px; }
.kb-annotate-wrap { max-height: 60vh; overflow: auto; }
.kb-annotate-wrap textarea {
  width: 100%; min-height: 44px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 6px 8px; font-size: 12px;
}
.kb-text {
  height: 30px; width: 100%;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0 8px; font-size: 12px;
}
.kb-conc-row { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 6px; }
.kb-conc-row textarea { flex: 1; }
.kb-conc-name {
  font-size: 12px; font-weight: 600; color: var(--accent-strong);
  min-width: 72px; padding-top: 6px;
}
.kb-if-journal, .kb-if-value {
  width: 100%; height: 30px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 0 8px; font-size: 12.5px;
}
.kb-quick {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; background: var(--surface-2);
}
.kb-quick textarea {
  width: 100%; min-height: 40px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 6px 8px; font-size: 12px;
}
.kb-filter label { white-space: nowrap; }

.import-head { display: block; }
.import-head .panel-hint {
  display: block; max-width: none; margin-top: 3px;
  text-align: left; font-size: 11px; color: var(--faint); line-height: 1.4;
}
.import-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.import-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 10px; white-space: nowrap; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.import-tab:hover { border-color: var(--faint); background: var(--surface-2); }
.import-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.import-body { display: flex; flex-direction: column; gap: 10px; }
.src-label { font-size: 12px; color: var(--muted); }
.src-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.import-run, #import-parse { width: 100%; }
.import-footer {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.import-footer .btn { width: 100%; }
#import-status { min-height: 14px; text-align: center; font-size: 11px; color: var(--muted); }
.src-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.src-chip:hover { border-color: var(--faint); background: var(--surface-2); }
.src-chip input { margin: 0; width: 14px; height: 14px; accent-color: var(--accent); }
.import-paste {
  width: 100%; min-height: 78px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 8px 10px; background: var(--surface);
  font-size: 13px; line-height: 1.55; color: var(--ink); outline: none;
}
.import-paste:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.kpi .kpi-num { font-size: 22px; font-weight: 700; }
.kpi .kpi-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
.list-pane { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.list-item {
  width: 100%; text-align: left; padding: 10px 12px; border: none; border-bottom: 1px solid var(--line);
  background: transparent; display: block;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #fff; }
.list-item.active { background: var(--accent-soft); }
.list-item .li-title { font-weight: 600; font-size: 13px; display: block; }
.list-item .li-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; display: block; }
.session-row { display: flex; align-items: center; gap: 6px; }
.session-row .list-item { flex: 1; min-width: 0; }
.session-row .icon-btn { flex: 0 0 auto; }

svg.graph { width: 100%; height: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.node text { font-size: 9px; fill: var(--ink); }
.edge { stroke: var(--line-strong); stroke-width: 1; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .gates {
    width: 100%; flex: none; display: flex; gap: 4px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--line); padding: 8px;
  }
  .gates-label { display: none; }
  .gate { min-width: max-content; padding: 8px 10px; }
  .gate-count { display: none; }
  .main { padding: 16px 14px 40px; }
  .topbar { padding: 0 10px; }
  .project-select { max-width: 160px; }
}

.global-hint {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 90; max-width: min(90vw, 560px);
  color: var(--faint); background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; font-size: 12px; line-height: 1.5;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.global-hint.show { opacity: 1; }
