/* The workbench frame: the app grid, title bar, workspace columns, drawer backdrop, main column,
   breadcrumbs, editor, status bar, and the workspace menu's card and meter. */
#app { display: grid; grid-template-rows: 44px minmax(0, 1fr) 26px; height: 100vh; height: 100dvh; }

/* title bar */
.titlebar { display: flex; align-items: center; gap: 8px; min-width: 0; background: var(--chrome); border-bottom: 1px solid var(--line);
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; margin-right: 4px; }
.brand small { font-weight: 400; color: var(--fg-3); }
.brand-mark { width: 20px; height: 20px; }
.brand-mark circle { fill: var(--accent); }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 6px; color: var(--fg-2); white-space: nowrap; }
.tb-btn:hover, .tb-btn[aria-expanded="true"] { background: var(--hover); color: var(--fg); }
.tb-files { display: none; }
.tb-spacer { flex: 1; }
.swap { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.swap-label { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 4px; font: 500 11px/1 var(--mono); letter-spacing: .08em; color: var(--fg-3); }
.swap button { height: 26px; padding: 0 10px; border-radius: 5px; color: var(--fg-2); white-space: nowrap; }
.swap button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.swap button:not([aria-pressed="true"]):hover { background: var(--hover); color: var(--fg); }
.swap .short-fl { display: none; }
.round-btn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--raise); border: 1px solid var(--line); color: var(--fg-2); flex: none; }
.round-btn:hover, .round-btn[aria-expanded="true"] { border-color: var(--accent-line); color: var(--fg); }

/* workspace and main column */
.workspace { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 0; }
.backdrop { display: none; }
.main { display: grid; grid-template-rows: 35px auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
#crumbs { display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 14px; font-size: 12px; color: var(--fg-3); border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; }
#crumbs svg { width: 10px; height: 10px; }
#crumbs span:last-child { color: var(--fg-2); }
#editor { min-height: 0; overflow: auto; position: relative; }

/* status bar */
.statusbar { display: flex; align-items: center; gap: 12px; min-width: 0; background: var(--chrome); border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-3);
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); white-space: nowrap; }
.statusbar .mode { font: 600 11px/1 var(--mono); letter-spacing: .08em; color: var(--accent); }
.statusbar .note { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.statusbar .right { display: flex; gap: 12px; flex: none; align-items: center; }
.statusbar .sb-btn { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 5px; color: var(--fg-3); flex: none; }
.statusbar .sb-btn svg { width: 14px; height: 14px; }
.statusbar .sb-btn:hover { background: var(--hover); color: var(--fg); }
.statusbar .sb-btn[aria-pressed="true"] { background: var(--raise); color: var(--fg); }

/* workspace menu */
.ws-card { padding: 8px; max-width: 320px; }
.ws-card .who { font-weight: 600; }
.ws-card .sub { font-size: 12px; color: var(--fg-3); margin-top: 2px; line-height: 1.45; }
.meter-row { padding: 6px 8px 8px; font-size: 12px; color: var(--fg-2); }
.meter-row .bar { height: 5px; border-radius: 3px; background: var(--raise); margin-top: 6px; overflow: hidden; }
.meter-row .bar i { display: block; height: 100%; background: var(--accent); }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 220px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .tb-files { display: inline-flex; }
  .brand small, .swap-label, .swap .long, .tb-menu-label { display: none; }
  .swap .short-fl { display: inline; }
  .tb-btn { padding: 0 8px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .backdrop.show { display: block; position: fixed; inset: 44px 0 26px; z-index: 39; background: rgba(0,0,0,.4); }
  #crumbs { padding: 0 16px; }
  .statusbar .right .wide { display: none; }
}

@media (max-width: 440px) {
  .brand-text { display: none; }
}
