:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #e2e6ec;
  --line-strong: #cbd2db;
  --ink: #1b1f26;
  --glyph: #1b1f26;
  --text: #14181e;
  --text-2: #4d5665;
  --text-3: #7b8494;
  --accent: #ffc928;
  --accent-hover: #ffd34d;
  --accent-soft: #fff4cc;
  --data: #2457c5;
  --ok: #188a57;
  --warn: #b25e00;
  --danger: #d92d20;
  --byte-zero: #e4eaf0;
  --solid: #161a20;
  --on-solid: #ffffff;
  --band: #11151b;
  --shadow: 0 1px 2px rgba(20, 30, 45, .04), 0 2px 10px rgba(20, 30, 45, .04);
  --shadow-lift: 0 2px 4px rgba(20, 30, 45, .05), 0 12px 28px rgba(20, 30, 45, .09);
  --r: 14px;
  --side-w: 308px;
  --sans: "Pretendard Variable", Pretendard, "Malgun Gothic", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Pretendard Variable", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --surface: #161b23;
    --surface-2: #1c222b;
    --line: #29303b;
    --line-strong: #3a4250;
    --glyph: #cfd6e0;
    --text: #e7ebf0;
    --text-2: #aab2bf;
    --text-3: #7a8392;
    --accent-soft: rgba(255, 201, 40, .13);
    --data: #8db0ff;
    --ok: #3fcf8e;
    --warn: #f0a24a;
    --danger: #ff6b5e;
    --byte-zero: #252c37;
    --solid: #e7ebf0;
    --on-solid: #12161c;
    --band: #0b0e12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

/* The sidebar is always dark, like the login panel. Re-pointing the tokens
   here lets every component inside it adapt without its own dark rules. */
.sidebar {
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --glyph: #e8ecf2;
  --text: #e8ecf2;
  --text-2: #a6afbd;
  --text-3: #7f8a9a;
  --accent-soft: rgba(255, 201, 40, .14);
  --data: #8db0ff;
  --ok: #3fcf8e;
  --warn: #f0a24a;
  --danger: #ff6b5e;
  --byte-zero: rgba(255, 255, 255, .08);
  --shadow: none;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; }
.display { font-family: var(--sans); font-weight: 700; letter-spacing: -.025em; margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.ico { display: inline-flex; align-items: center; line-height: 0; }
.ico svg { width: 18px; height: 18px; flex: none; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--text-3); }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: 0; z-index: 40; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px; padding: 18px 14px 12px;
  background:
    radial-gradient(420px 320px at 100% 108%, rgba(255, 201, 40, .2), transparent 62%),
    radial-gradient(380px 260px at -10% -6%, rgba(96, 140, 255, .14), transparent 62%),
    var(--band);
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 45%); mask-image: linear-gradient(180deg, #000, transparent 45%);
}
.sidebar > * { position: relative; }
@media (prefers-color-scheme: dark) { .sidebar { border-right: 1px solid rgba(255, 255, 255, .06); } }

.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--ink); }
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }

.icon-btn {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.nav-close, .nav-btn { display: none; }

/* save slot */
.save-empty {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--text-3);
}
.save-empty-slot { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--glyph); opacity: .7; }
.save-empty-slot svg { width: 22px; height: 22px; }
.save-empty div { display: flex; flex-direction: column; min-width: 0; }
.save-empty b { font-size: 13.5px; color: var(--text); }
.save-empty span { font-size: 12px; line-height: 1.45; }

.save-card { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.save-top { display: flex; align-items: center; gap: 12px; }
.flag {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; flex: none;
  background: var(--accent); color: var(--ink); font-size: 14.5px; font-weight: 700;
}
.save-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.save-region { font-size: 12px; font-weight: 600; color: var(--text-3); }
.save-ver { font-size: 21px; line-height: 1.2; color: #fff; }
.close-save { width: 32px; height: 32px; }
.close-save svg { width: 15px; height: 15px; }
.close-save:hover:not(:disabled) { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.save-lib { display: flex; flex-direction: column; gap: 1px; margin: 12px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--text-3); }
.save-lib-top { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.save-lib .ico svg { width: 14px; height: 14px; }
.save-lib b { max-width: 100%; font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bytes { display: block; width: 100%; height: 22px; margin: 12px 0 6px; border-radius: 4px; cursor: crosshair; }
.save-meta { margin: 0; font-size: 10.5px; color: var(--text-3); overflow-wrap: anywhere; }

/* feature tree */
.side-head { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 4px 0; }
.side-title { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); }
.count { font-size: 11px; color: var(--text-3); }
.filter-wrap { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-3); }
.filter-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.filter-wrap input::placeholder { color: var(--text-3); }
.side-empty { margin: 4px; font-size: 13px; color: var(--text-3); }
.tree { flex: 1; min-height: 0; overflow: auto; margin: -4px -6px 0; padding: 0 6px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent; }
.cat { margin-bottom: 1px; }
.cat-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px;
  background: none; border: 0; border-radius: 9px; cursor: pointer; text-align: left; color: var(--glyph); font-weight: 500; font-size: 14px;
}
.cat-btn > span:nth-child(2) { color: var(--text); }
.cat-btn:hover { background: var(--surface-2); }
.cat-btn .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.cat-btn .chev { color: var(--text-3); transition: transform .15s; }
.cat-btn .chev svg { width: 14px; height: 14px; }
.cat.open > .cat-btn { background: var(--surface-2); }
.cat.open > .cat-btn > span:nth-child(2) { font-weight: 600; }
.cat.open > .cat-btn .chev { transform: rotate(90deg); }
.cat ul { list-style: none; margin: 2px 0 8px 19px; padding: 0 0 0 10px; border-left: 1px solid var(--line-strong); display: none; }
.cat.open ul, .tree.searching .cat ul { display: block; }
.feat {
  width: 100%; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px;
  background: none; border: 0; border-radius: 8px; cursor: pointer; text-align: left; color: var(--glyph); font-size: 13.5px;
}
.feat .lbl { flex: 1; line-height: 1.35; color: var(--text-2); }
.feat .ico svg { width: 16px; height: 16px; }
.feat:hover:not(:disabled) { background: var(--surface-2); }
.feat:hover:not(:disabled) .lbl { color: var(--text); }
.feat.running { background: var(--accent); }
.feat.running .lbl { color: var(--ink); font-weight: 600; }
.feat:disabled:not(.running) { opacity: .45; cursor: not-allowed; }
.risk { flex: none; font-size: 10.5px; font-weight: 600; color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-radius: 5px; padding: 1px 6px; }
.side-foot { display: flex; align-items: center; gap: 12px; padding: 10px 4px 0; border-top: 1px solid var(--line); }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 2px 0; background: none; border: 0; cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.link-btn .ico svg { width: 15px; height: 15px; }
.link-btn:hover:not(:disabled) { color: var(--text); }
.link-btn:disabled { opacity: .45; cursor: not-allowed; }
.ver { margin-left: auto; font-size: 11px; color: var(--text-3); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.crumb-root { color: var(--text-3); white-space: nowrap; }
.crumb-sep { color: var(--line-strong); }
.crumb-cur { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px; height: 38px; min-width: 240px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-3); cursor: pointer;
}
.search-btn:hover { border-color: var(--line-strong); color: var(--text-2); }
.search-btn-text { flex: 1; text-align: left; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.status {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; max-width: 240px; padding: 0 12px;
  border-radius: 999px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden;
}
#statusText { overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status.busy { background: var(--accent-soft); color: var(--text); }
.status.busy .dot { background: var(--accent); animation: ping 1.2s ease-out infinite; }
.status.off { color: var(--danger); }
.status.off .dot { background: var(--danger); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255, 201, 40, .7); } 100% { box-shadow: 0 0 0 7px rgba(255, 201, 40, 0); } }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, opacity .12s, transform .06s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--solid); color: var(--on-solid); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--solid); opacity: .88; }
.sidebar .btn-primary { background: var(--accent); color: var(--ink); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger); opacity: .9; }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------------------------------------------------------------- content */
.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 26px 28px 60px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.015em; }

/* wallet strip */
.wallet-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.wallet { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.coin {
  display: flex; align-items: center; gap: 11px; padding: 14px 16px; color: var(--glyph);
  box-shadow: inset -1px 0 var(--line), inset 0 -1px var(--line);
}
.coin .ico svg { width: 26px; height: 26px; }
.coin dt { font-size: 12px; color: var(--text-3); line-height: 1.25; }
.coin dd { margin: 0; font-family: var(--mono); font-weight: 600; font-size: 16px; color: var(--text); line-height: 1.35; }
.coin.bump { animation: bump .8s ease; }
@keyframes bump { 30% { background: var(--accent-soft); } }

/* load panel */
.load-card { padding: 30px 32px 32px; }
.load-title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.load-card > .muted { margin: 6px 0 0; max-width: 640px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 22px 0 18px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg-btn:hover { color: var(--text); }
.seg-btn.is-on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 30, 45, .08), 0 0 0 1px var(--line); }
.seg-btn .ico svg { width: 16px; height: 16px; }
.seg-count:not(:empty) { margin-left: 2px; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--warn); }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2); transition: background .12s, border-color .12s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { color: var(--text-3); }
.drop-icon svg { width: 30px; height: 30px; }
.form-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input { height: 40px; width: 100%; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.opt-card p { margin: 0 0 8px; }

/* save library */
.lib-list { display: flex; flex-direction: column; gap: 8px; }
.lib-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--text-3); border: 1.5px dashed var(--line-strong); border-radius: var(--r); }
.lib-empty .ico svg { width: 32px; height: 32px; }
.lib-empty p { margin: 0; }
.lib-row { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.lib-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.lib-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.lib-flag {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: var(--ink); font-size: 13px; font-weight: 700;
}
.lib-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.lib-name { font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.lib-meta { font-size: 12px; color: var(--text-3); }
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-actions .btn-ghost { color: var(--text-2); }
.lib-actions .ico svg { width: 15px; height: 15px; }
.lib-actions .confirm { border-color: var(--danger); color: var(--danger); }
.lib-rename { display: flex; gap: 6px; align-items: center; }
.lib-rename .input { height: 32px; max-width: 260px; }
.lib-versions { list-style: none; margin: 0; padding: 4px 14px 12px 64px; border-top: 1px solid var(--line); }
.lib-versions li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.lib-versions li:last-child { border-bottom: 0; }
.lib-versions .vn { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); min-width: 34px; }
.lib-versions .vl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-versions .vt { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.lib-versions .latest { font-size: 10.5px; font-weight: 600; color: var(--ok); }

/* work area: quick actions beside the task log */
.work { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.work.solo { grid-template-columns: minmax(0, 1fr); }
.quick-panel { position: sticky; top: 78px; padding: 16px 10px 10px; }
.quick-panel .panel-title { padding: 0 8px 8px; }
.quick-grid { display: flex; flex-direction: column; gap: 1px; }
.qa {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 7px 8px;
  border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; color: var(--glyph);
  transition: background .12s;
}
.qa:hover:not(:disabled) { background: var(--surface-2); }
.qa:disabled { opacity: .5; cursor: not-allowed; }
.qa > .ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); flex: none; }
.qa:hover:not(:disabled) > .ico { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.qa .ico svg { width: 22px; height: 22px; }
.qa-label { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.qa .risk { order: 2; }
.qa-val { order: 3; font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- log */
.log-card { display: flex; flex-direction: column; min-height: 460px; }
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.log-head .panel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console { padding: 18px 20px 22px; overflow-wrap: anywhere; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 70px 0; color: var(--text-3); text-align: center; }
.empty-cat { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--surface-2); color: var(--glyph); }
.empty-cat svg { width: 38px; height: 38px; }
.empty p { margin: 0; }
.task { position: relative; padding: 0 0 16px 22px; border-left: 1px solid var(--line-strong); margin-left: 6px; }
.task::before { content: ""; position: absolute; left: -6.5px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.task.done::before { background: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.task.failed::before { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.task:last-child { border-left-color: transparent; }
.task-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.task-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.task-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.task-state { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--warn); }
.task.done .task-state { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.task.failed .task-state { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.line { margin: 2px 0; white-space: pre-wrap; }
.line.progress { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.line.queued { color: var(--text-3); }
.answered { margin: 3px 0 5px; font-size: 13.5px; color: var(--text-3); }
.answered b { color: var(--text); font-weight: 600; background: var(--accent-soft); border-radius: 6px; padding: 0 7px; margin-left: 4px; }
.error-box { margin: 8px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--danger) 7%, transparent); }
.error-box pre { white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; max-height: 260px; overflow: auto; }
.dl { margin: 8px 0; }

/* questions */
.prompt-wrap { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0 12px; animation: rise .18s ease-out; }
.prompt-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--ink); }
.prompt-avatar svg { width: 26px; height: 26px; }
.prompt {
  position: relative; flex: 1; min-width: 0; padding: 14px 16px 16px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lift);
}
.prompt-q { font-weight: 500; font-size: 14.5px; margin-bottom: 12px; white-space: pre-wrap; }
.prompt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.opt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 6px; max-height: 380px; overflow: auto; padding: 2px; }
.opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px; text-align: left; cursor: pointer; font-size: 13.5px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text);
}
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.num { flex: none; display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; cursor: pointer; font-size: 13.5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }
.filter { margin-bottom: 8px; max-width: 320px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 210px; overflow: auto; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); cursor: pointer; font-size: 12.5px; color: var(--text); }
.chip:hover { border-color: var(--accent); }
.num-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.num-row .input { max-width: 240px; font-family: var(--mono); font-size: 15px; }
.hint { margin: 0 0 8px; font-size: 12px; color: var(--text-3); }
.num-row .hint { margin: 0; font-family: var(--mono); }

/* bcsfe markup colours */
.m-s { color: var(--data); font-weight: 500; }
.m-t { font-weight: 600; }
.m-q { color: #7a5af5; font-weight: 500; }
.m-e { color: var(--danger); font-weight: 500; }
.m-w { color: var(--warn); }
.m-su { color: var(--ok); font-weight: 500; }

/* ---------------------------------------------------------------- overlays */
.palette-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding-top: 12vh; background: rgba(10, 15, 22, .45); }
.palette { width: min(600px, 92vw); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: rise .14s ease-out; }
.palette-input { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--text-3); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15.5px; color: var(--text); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--glyph); }
.palette-list li > span:nth-child(2) { color: var(--text); }
.palette-list li .path { margin-left: auto; font-size: 12px; color: var(--text-3); }
.palette-list li.sel { background: var(--accent-soft); }
.palette-list .none { color: var(--text-3); cursor: default; }
.palette-foot { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

.modal {
  width: min(440px, 92vw); padding: 24px 24px 20px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: rise .14s ease-out;
}
.modal-title { font-size: 18px; margin-bottom: 6px; }
.modal p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.danger-text { color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%); max-width: min(500px, 90vw);
  padding: 11px 16px; border-radius: 12px; background: var(--band); color: #fff; font-size: 13.5px;
  border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- login */
.login-screen {
  position: fixed; inset: 0; z-index: 70; overflow-y: auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--surface); color: var(--text);
}
.login-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  min-height: 100vh; padding: 36px 48px 32px; color: #e8ecf2;
  background:
    radial-gradient(640px 420px at 88% 108%, rgba(255, 201, 40, .24), transparent 62%),
    radial-gradient(520px 340px at -6% -8%, rgba(96, 140, 255, .16), transparent 62%),
    var(--band);
}
.login-aside::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 20%, transparent 92%); mask-image: linear-gradient(180deg, #000 20%, transparent 92%);
}
.login-aside > * { position: relative; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.login-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--ink); }
.login-mark svg { width: 21px; height: 21px; }
.login-pitch { max-width: 440px; }
.login-pitch h2 { margin: 0 0 14px; font-size: clamp(30px, 3.2vw, 42px); font-weight: 700; line-height: 1.18; letter-spacing: -.03em; }
.login-pitch h2 em { font-style: normal; color: var(--accent); }
.login-pitch > p { margin: 0 0 30px; font-size: 15px; color: #a6afbd; }
.login-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.login-points li { display: flex; align-items: center; gap: 14px; }
.login-points div { display: flex; flex-direction: column; }
.login-points b { font-size: 14px; font-weight: 600; }
.login-points div span { font-size: 13px; color: #8d97a6; }
.pt-ico {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09); color: #e8ecf2;
}
.pt-ico svg { width: 19px; height: 19px; }
.login-aside-foot { margin: 0; font-family: var(--mono); font-size: 11.5px; color: #6c7686; }

.login-main { display: grid; place-items: center; padding: 48px 28px; }
.login { width: min(380px, 100%); display: flex; flex-direction: column; animation: login-in .4s ease-out both; }
.login.shake { animation: login-shake .4s ease; }
@keyframes login-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes login-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.login-title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.login-sub { margin: 6px 0 8px; font-size: 14px; color: var(--text-2); }

.login-field { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }
.login-field .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-input {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 13px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px; color: var(--text-3);
  transition: border-color .12s, box-shadow .12s;
}
.login-input:hover { border-color: var(--text-3); }
.login-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); color: var(--text-2); }
.login-input > .ico svg { width: 18px; height: 18px; }
.login-input input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); }
.login-input input[type="password"] { letter-spacing: .16em; }
.pw-toggle { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--text-3); cursor: pointer; }
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; }

.login-caps { margin: 8px 0 0; font-size: 12.5px; font-weight: 500; color: var(--warn); }
.login-error { min-height: 20px; margin: 12px 0 6px; font-size: 13px; font-weight: 500; color: var(--danger); }
.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px;
  border: 0; border-radius: 11px; cursor: pointer;
  background: var(--solid); color: var(--on-solid); font-size: 15px; font-weight: 600;
  transition: opacity .12s, transform .06s;
}
.login-btn:hover:not(:disabled) { opacity: .9; }
.login-btn:active:not(:disabled) { transform: translateY(1px); }
.login-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.login-arrow { transition: transform .15s; }
.login-btn:hover:not(:disabled) .login-arrow { transform: translateX(3px); }
.login-btn.loading { cursor: progress; }
.login-btn.loading .login-arrow { display: none; }
.login-btn.loading .login-btn-text::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 10px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-help { margin: 18px 0 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
@media (prefers-color-scheme: dark) { .login-aside { border-right: 1px solid var(--line); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .quick-panel { position: static; }
  .quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 8px; }
  .search-btn { min-width: 0; }
  .search-btn-text, .search-btn kbd { display: none; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); height: auto;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .35);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open { overflow: hidden; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(10, 15, 22, .45); }
  .nav-btn, .nav-close { display: grid; }
  .topbar { padding: 0 14px; gap: 10px; }
  .content { padding: 18px 14px 40px; }
  .crumb-root, .crumb-sep { display: none; }
  .load-card { padding: 22px 18px 22px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-aside { min-height: 0; padding: 16px 20px; }
  .login-pitch, .login-aside-foot { display: none; }
  .login-main { place-items: start center; padding: 40px 20px; }
}
@media (max-width: 560px) {
  .status { display: none; }
  .btn-label { display: none; }
  #btnSave { width: 38px; padding: 0; }
  .wallet { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .coin { gap: 8px; padding: 10px; }
  .coin .ico svg { width: 20px; height: 20px; }
  .coin dt { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .coin dd { font-size: 14px; }
  .coin > div { min-width: 0; }
  .lib-versions { padding-left: 14px; }
  .prompt-wrap { gap: 8px; }
  .prompt-avatar { width: 32px; height: 32px; border-radius: 10px; }
  .prompt-avatar svg { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
