/* ============================================================
   EasyCabinet app shell chrome — single-screen IA
   Top header · floating left icon rail · slide-in workspace drawer ·
   floating stage dock. Layered over the existing panels (all IDs kept).
   ============================================================ */

body { display: flex; flex-direction: column; }

/* ---- top header ---- */
#ec-header {
  flex: none;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.ec-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16.5px; letter-spacing: -.01em; color: var(--text); }
.ec-brand-mark {
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  background: var(--accent); box-shadow: 0 3px 12px rgba(236,154,60,.4);
  background-image: linear-gradient(var(--amber-ink) 0 0), linear-gradient(var(--amber-ink) 0 0);
  background-size: 11px 2px, 2px 11px; background-position: center, center; background-repeat: no-repeat;
}
.ec-nav { display: flex; align-items: center; gap: 22px; margin-left: 8px; padding-left: 16px; border-left: 1px solid var(--line); }
.ec-nav a { font-size: 13.5px; color: var(--muted); font-weight: 500; text-decoration: none; }
.ec-nav a:hover { color: var(--text); }
.ec-header-spacer { flex: 1; }
.ec-header-right { display: flex; align-items: center; gap: 9px; }
#ec-header #authStubMount { display: flex; align-items: center; }
.ec-header-btn {
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--accent-softer); color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.ec-header-btn:hover { border-color: var(--accent); }
.ec-header-btn.theme-toggle { width: 36px; padding: 0; height: 34px; display: inline-flex; align-items: center; justify-content: center; }

/* ---- app grid: icon rail · stage · chat ---- */
#app { flex: 1; min-height: 0; height: auto; grid-template-columns: 88px 1fr var(--chat-w, 33.33vw); position: relative; }
#app.chat-collapsed { grid-template-columns: 88px 1fr 0; }

/* ---- floating left icon rail ---- */
#ec-iconrail { position: relative; display: flex; align-items: center; justify-content: center; }
.ec-rail {
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  background: var(--rail); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.ec-rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 60px; padding: 9px 2px; border: none; border-radius: 11px;
  background: transparent; color: var(--muted); cursor: pointer;
  font: 600 9.5px/1.15 var(--font-ui); text-align: center; white-space: normal;
}
.ec-rail-btn svg { width: 20px; height: 20px; }
.ec-rail-btn:hover { color: var(--text); background: var(--accent-softer); }
.ec-rail-btn.active { color: var(--amber-2); background: var(--accent-soft); }
.ec-rail-sep { height: 1px; margin: 4px 6px; background: var(--line-2); }

/* Project stays available but styled subtly — Inspect/Plans are the primary rail actions. */
.ec-rail-btn-subtle { opacity: .6; }
.ec-rail-btn-subtle:hover { opacity: 1; }
.ec-rail-btn-subtle.active { opacity: 1; }

/* ---- workspace drawer (was #sidebar) ---- */
#sidebar, #wallDrawer, #inspectDrawer {
  position: absolute; top: 0; left: 88px; bottom: 0; width: 340px; z-index: 35;
  background: var(--rail); border: 1px solid var(--line); border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transform: translateX(calc(-100% - 96px)); transition: transform .32s cubic-bezier(.2,.8,.25,1);
  border-left: none;
}
#sidebar.open, #wallDrawer.open, #inspectDrawer.open { transform: translateX(0); }
.ec-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line-2);
}
.ec-drawer-head h2 { margin: 0; font-size: 14.5px; font-weight: 800; }
.ec-drawer-head .dims { margin: 2px 0 0; }
.ec-drawer-close {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.ec-drawer-close:hover { color: var(--text); }

/* ---- minimal hover toolbar: view/undo buttons top-right, dock bottom-left ---- */
#ec-hover-toolbar { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
#ec-hover-toolbar #toolbar,
#ec-hover-toolbar #ec-stage-dock { pointer-events: auto; }

/* ---- explode bar: prominent, top-center of the stage (smoke 8-12 #3) ---- */
#ec-explode-bar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 7; pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  width: clamp(240px, 34%, 460px);
  padding: 10px 16px;
}
#ec-explode-bar label {
  font: 600 11px var(--font-ui); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); cursor: pointer;
}
#ec-explode-bar input[type="range"] { flex: 1; height: 22px; margin: 0; }
#ec-explode-bar .val {
  font-family: var(--font-mono); font-size: 12.5px; color: var(--amber-2);
  min-width: 38px; text-align: right;
}
/* Below ~1600px window the top row (badge + view buttons) can crowd the
   center — drop the bar to its own second row instead of overlapping. */
@media (max-width: 1600px) { #ec-explode-bar { top: 58px; } }
@media (max-width: 900px) { #ec-explode-bar { width: min(320px, calc(100% - 24px)); } }

/* ---- floating stage dock (legend) ---- */
#ec-stage-dock {
  position: absolute; left: 16px; bottom: 16px; width: 208px;
  padding: 11px 13px; display: flex; flex-direction: column; gap: 9px;
}
#ec-stage-dock .control { margin: 0; }
#ec-stage-dock label { font: 600 10.5px var(--font-ui); letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
#hiddenPartsRow {
  margin: 6px 0 0; padding: 6px 8px; border: 1px dashed var(--line);
  border-radius: 8px; background: none; cursor: pointer;
  font: 500 11.5px var(--font-ui); color: var(--muted); text-align: left;
}
#hiddenPartsRow:hover { color: var(--text); border-color: var(--accent); }
#hiddenPartsRow.hidden { display: none; }
#ec-stage-dock #legend {
  position: static; inset: auto; padding: 9px 0 0; margin: 0;
  border: none; border-top: 1px solid var(--line-2); border-radius: 0;
  background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
}

/* Dims readout sits directly above the stage dock so the two never collide. */
.ec-stage-dims { left: 16px; bottom: 96px; }

/* keep the old separate themeToggle hidden if present in toolbar; main.js mode toggle hidden (rail owns it) */
#toolbar #themeToggle { display: none; }
#modeToggle { display: none !important; }

/* The grid stacks to a single column at ≤900px (ui/chat-panel.css), so the
   icon rail must become the horizontal strip for that whole range — a vertical
   88px pill stack stretched across a full-width grid row broke 761-900px. */
@media (max-width: 900px) {
  #ec-iconrail {
    display: flex;
    position: static;
    width: 100%;
    justify-content: flex-start;
  }
  #ec-iconrail .ec-rail {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
    justify-content: flex-start;
  }
  #ec-iconrail .ec-rail-btn { flex: none; min-width: 60px; min-height: 44px; }
  #ec-iconrail .ec-rail-sep { width: 1px; height: auto; margin: 4px 6px; }
}

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr !important; }

  #ec-header {
    flex-wrap: wrap;
    height: auto;
    row-gap: 6px;
    padding-block: 6px;
  }
  .ec-nav { flex-wrap: wrap; row-gap: 6px; }
  .ec-header-right { flex-wrap: wrap; }

  #sidebar, #wallDrawer, #inspectDrawer { left: 0; width: min(94vw, 360px); }
}
