/* ompweb — Kanagawa Lotus (light), mobile-first, no frameworks, no external assets */

:root {
  --bg: #f2ecbc;
  --surface: #e7dba0;
  --surface2: #ddd0a0;
  --accent: #4d699b;
  --muted: #77713f;
  --text: #545464;
  --ok: #6f894e;
  --danger: #c84053;
  --line: rgba(84, 84, 100, 0.18);
  --line2: rgba(84, 84, 100, 0.28);
  --code: #e4dcb4;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --rail: 48px;
  --side: 300px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* =============================== header =============================== */

#hdr {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: calc(6px + env(safe-area-inset-top)) 10px 4px;
  z-index: 20;
}
.hin {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 6px;
}
.htitle {
  order: 1;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0 4px 0 0;
  text-align: left;
}
#sess-title {
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}
.dot.on { background: var(--ok); box-shadow: 0 0 6px rgba(111, 137, 78, .55); }
.agent-chip {
  flex: none;
  font-size: 11px;
  color: var(--danger);
  border: 1px solid rgba(200, 64, 83, .4);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(200, 64, 83, .08);
}
.hbtns { order: 2; display: flex; gap: 2px; }
.hbtns button {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
}
.hbtns button:active { background: var(--surface2); }
.hbtns svg { width: 21px; height: 21px; }
#btn-bell.on { color: var(--accent); }
#btn-bell.denied { opacity: .45; }
.hchips {
  order: 3;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding-bottom: 2px;
}
.chip {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line2);
  color: var(--muted);
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 11px;
  min-height: 36px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70vw;
}
.chip-btn { background: var(--bg); }
.chip-btn:active { border-color: var(--accent); color: var(--text); }

/* ============================ status strip ============================ */

#status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 5px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: 12px;
  color: var(--muted);
  min-height: 28px;
}
.st-cwd {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
}
.st-item {
  flex: none;
  max-width: 28vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
}
.ctxbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
  width: min(220px, 32vw);
}
.ctx-track {
  flex: 1 1 auto;
  height: 8px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.ctx-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease;
}
.ctx-fill.warn { background: #c4a35a; }
.ctx-fill.hot { background: var(--danger); }
#ctx-pct {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  min-width: 2.6em;
  text-align: right;
  color: var(--text);
}

/* ============================ status banner ============================ */

#banner {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(196, 163, 90, .18);
  border-bottom: 1px solid rgba(119, 113, 63, .35);
  color: #6b5c22;
  font-size: 12.5px;
  padding: 4px 10px;
}
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4a35a;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

/* ============================== transcript ============================== */

#transcript {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 10px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
  text-align: left;
}
#transcript::-webkit-scrollbar { width: 8px; }
#transcript::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 4px; }

#feed {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 22px 10px; }

.msg-user {
  align-self: flex-end;
  max-width: 85%;
  background: rgba(77, 105, 155, .14);
  border: 1px solid rgba(77, 105, 155, .32);
  border-radius: 14px 14px 4px 14px;
  padding: 9px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  color: var(--text);
}

.assistant {
  align-self: stretch;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: left;
}
.sysline {
  align-self: center;
  max-width: 92%;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  overflow-wrap: anywhere;
}

/* markdown */
.md { overflow-wrap: anywhere; text-align: left; }
.md.live-text { white-space: pre-wrap; }
.md pre {
  margin: 8px 0;
  background: var(--code);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  font: 12.5px/1.55 var(--mono);
  color: var(--text);
  text-align: left;
}
.md code {
  background: var(--code);
  border-radius: 5px;
  padding: 1px 5px;
  font: 12.5px/1.4 var(--mono);
  color: var(--text);
}
.md pre code { background: none; padding: 0; font: inherit; color: inherit; }
.md a { color: var(--accent); }
.md strong { color: #3d3d4e; }
.md h3, .md h4, .md h5 { margin: 10px 0 4px; line-height: 1.3; color: var(--text); }
.md h3 { font-size: 1.05em; }
.md h4 { font-size: 1em; }
.md h5 { font-size: .95em; color: var(--muted); }
details.thinking {
  margin: 2px 0 6px;
  border-left: 3px solid rgba(77, 105, 155, .4);
  padding: 2px 0 2px 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}
details.thinking summary {
  cursor: pointer;
  user-select: none;
  min-height: 28px;
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 550;
  font-size: 12px;
}
.think-body {
  overflow-wrap: anywhere;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}

/* tool cards */
.tool-card {
  align-self: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 3px;
  text-align: left;
}
.assistant > .tool-card:first-child { margin-top: 0; }
.tool-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  padding: 4px 8px;
  background: none;
  border: 0;
  text-align: left;
  font-size: 12px;
}
.tstat {
  flex: none;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.tstat svg { width: 13px; height: 13px; }
.spin {
  width: 11px;
  height: 11px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }
.tool-card[data-st="ok"] .tstat { color: var(--ok); }
.tool-card[data-st="fail"] .tstat { color: var(--danger); }

.scroll-bot {
  position: absolute;
  bottom: calc(10px + 64px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 4px 18px rgba(84, 84, 100, .25);
  cursor: pointer;
  white-space: nowrap;
}
.scroll-bot:active { background: var(--surface2); }
.tname {
  flex: none;
  max-width: 40%;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.targs {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font: 11.5px/1.3 var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.chev {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 3px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.tool-card.exp .chev { transform: rotate(45deg); }
.tool-body {
  border-top: 1px solid var(--line);
  background: var(--code);
  padding: 8px 10px;
  max-height: 300px;
  overflow: auto;
  text-align: left;
}
.tool-body pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11.5px/1.5 var(--mono);
  color: var(--text);
  text-align: left;
}

/* ============================== composer ============================== */

#composer {
  flex: none;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
}
.crow {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
#input {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  padding: 8px 12px;
  min-height: calc(4 * 1.45em + 18px);
  max-height: calc(10 * 1.45em + 18px);
}
#input:focus { outline: none; border-color: var(--accent); }
@media (pointer: coarse) { #input { font-size: 16px; } }

.cside { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
#btn-send, #btn-stop {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#btn-send { background: var(--accent); color: #f2ecbc; }
#btn-send:disabled { opacity: .4; cursor: default; }
#btn-stop {
  background: rgba(200, 64, 83, .12);
  border: 1px solid rgba(200, 64, 83, .45);
  color: var(--danger);
}
#btn-send svg, #btn-stop svg { width: 20px; height: 20px; }

.pill {
  position: relative;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line2);
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: pointer;
}
.pill input { position: absolute; inset: 0; margin: 0; opacity: 0; }
.pill.on {
  background: rgba(77, 105, 155, .16);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 650;
}

/* =============================== sidebar =============================== */

#scrim {
  position: fixed;
  inset: 0;
  background: rgba(84, 84, 100, .28);
  z-index: 39;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#scrim.show { opacity: 1; pointer-events: auto; }

#sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-height: 78dvh;
  background: var(--surface);
  border-top: 1px solid var(--line2);
  border-radius: 14px 14px 0 0;
  transform: translateY(110%);
  visibility: hidden;
  transition: transform .22s ease, visibility .22s;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: auto;
}
#sidebar.open { transform: none; visibility: visible; }

.rail { display: none; }

.sidebar-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  pointer-events: auto;
}
.dhead {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}
.dhead h2 { margin: 0; font-size: 15px; }
.side-tabs {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
.side-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 13.5px;
  min-height: 40px;
  padding: 6px 10px;
}
.side-tab.on {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.dclose {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
}
.dclose svg { width: 20px; height: 20px; }
.dstatus {
  flex: none;
  padding: 8px 16px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
.newbtn {
  flex: none;
  margin: 10px 12px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px dashed var(--accent);
  background: rgba(77, 105, 155, .08);
  color: var(--accent);
  font-weight: 650;
}
.slist {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px 16px;
  pointer-events: auto;
}
.sess-item {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 4px 6px 4px 4px;
  min-height: 52px;
  pointer-events: auto;
  color: var(--text);
}
.sess-item:active { background: var(--surface2); }
.sess-item.active {
  background: rgba(77, 105, 155, .12);
  border-color: rgba(77, 105, 155, .4);
}
.sess-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  padding: 6px 4px;
  cursor: pointer;
}
.s-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.s-meta { font-size: 11.5px; color: var(--muted); }
.s-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.s-act {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 10px;
  min-height: 22px;
  padding: 0 6px;
  border-radius: 6px;
}
.s-act:hover { background: var(--surface2); color: var(--text); }
.ctx-abs {
  font-size: 10px;
  color: var(--muted);
  opacity: .85;
  white-space: nowrap;
}
.dfoot {
  flex: none;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

#pane-sessions, #pane-subagents {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

/* subagents */
.sublist {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 8px 16px;
}
.sub-item {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  margin-bottom: 6px;
  overflow: hidden;
  background: var(--bg);
}
.sub-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  background: none;
  border: 0;
  text-align: left;
}
.sub-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  flex: none;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--line2);
  color: var(--muted);
}
.badge.running { color: var(--accent); border-color: rgba(77, 105, 155, .5); background: rgba(77, 105, 155, .12); }
.badge.done { color: var(--ok); border-color: rgba(111, 137, 78, .5); background: rgba(111, 137, 78, .1); }
.badge.failed { color: var(--danger); border-color: rgba(200, 64, 83, .5); background: rgba(200, 64, 83, .1); }
.sub-panel {
  border-top: 1px solid var(--line2);
  background: var(--code);
  max-height: 260px;
  overflow: auto;
  padding: 8px 10px;
  text-align: left;
}
.sub-panel pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11.5px/1.5 var(--mono);
  color: var(--muted);
  text-align: left;
}

/* ================================ modals ================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(84, 84, 100, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
#wmodal { z-index: 50; }
#picker { z-index: 55; }
.sheet {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 14px;
  width: min(94vw, 480px);
  max-height: 82dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  box-shadow: 0 18px 60px rgba(84, 84, 100, .22);
  text-align: left;
}
.m-title { margin: 0; font-size: 15.5px; overflow-wrap: anywhere; }
.m-desc { margin: 0; color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; }
.mbtn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  font-size: 14px;
  text-align: left;
  color: var(--text);
}
.mbtn:active { border-color: var(--accent); }
.mbtn .sub { font-size: 11.5px; color: var(--muted); }
.mbtn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f2ecbc;
  font-weight: 650;
  justify-content: center;
  align-items: center;
}
.m-row { display: flex; gap: 8px; }
.m-row .mbtn { flex: 1; justify-content: center; align-items: center; }
.m-input, .m-area {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  min-height: 44px;
}
.m-input:focus, .m-area:focus { outline: none; border-color: var(--accent); }
.m-area { min-height: 150px; max-height: 40dvh; resize: vertical; font: 12.5px/1.5 var(--mono); }
.m-count { font-size: 11.5px; color: var(--muted); text-align: center; }
.m-more { font-size: 11px; color: var(--muted); text-align: center; }
.m-dismiss {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12.5px;
  min-height: 44px;
}

.think-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.think-chip {
  background: var(--surface);
  border: 1px solid var(--line2);
  color: var(--muted);
  border-radius: 999px;
  font-size: 11px;
  padding: 3px 8px;
  min-height: 28px;
}
.think-chip:active { border-color: var(--accent); color: var(--accent); }
.browse-path {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

/* ============================ screenshot overlay ============================ */

#shot {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(84, 84, 100, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  cursor: pointer;
  overflow: auto;
}
#shot img {
  object-fit: contain;
  max-width: 100%;
  max-height: 100dvh;
  width: auto;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line2);
}
#shot .notavail { color: #f2ecbc; font-size: 15px; }

/* ================================ toasts ================================ */

#toasts {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 80;
  pointer-events: none;
  padding: 0 12px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 14px;
  max-width: 92vw;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(84, 84, 100, .22);
  animation: tIn .18s ease;
  overflow-wrap: anywhere;
}
.toast.out { opacity: 0; transition: opacity .25s; }
.toast b { display: block; font-weight: 650; }
.toast span { color: var(--muted); }
@keyframes tIn { from { opacity: 0; transform: translateY(-6px); } }

/* ============================ desktop collab layout ============================ */

@media (min-width: 860px) {
  #app {
    flex-direction: row;
    align-items: stretch;
  }
  #scrim { display: none !important; }

  #sidebar {
    position: relative;
    inset: auto;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    z-index: 12;
    max-height: none;
    height: 100%;
    width: auto;
    flex: none;
    flex-direction: row;
    transform: none;
    visibility: visible;
    border: 0;
    border-right: 1px solid var(--line2);
    border-radius: 0;
    padding-bottom: 0;
    background: var(--surface);
  }

  .rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: none;
    width: var(--rail);
    padding: 8px 4px;
    background: var(--surface2);
    border-right: 1px solid var(--line);
  }
  .rail button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
  }
  .rail button:hover { background: var(--surface); color: var(--text); }
  .rail button.on { color: var(--accent); background: rgba(77, 105, 155, .14); }
  .rail svg { width: 20px; height: 20px; }

  .sidebar-panel {
    width: 0;
    overflow: hidden;
    visibility: hidden;
    flex: none;
  }
  #sidebar.open .sidebar-panel {
    width: var(--side);
    overflow: hidden;
    visibility: visible;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  #sidebar.open .dclose { display: none; }

  #main { flex: 1 1 auto; min-width: 0; }
  .hchips { min-height: 32px; }
  .chip { min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
