/*
 * App screens around the editor (S13): what design/app.css and the mockups
 * draw inline or leave to the app. Tokens only, so light and dark both work.
 */

/* ---------- menus opened by MenuButton ---------- */
.app-menu { z-index: var(--z-menu); display: grid; }
.app-menu .menu-item { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--fg); text-decoration: none; }
.app-menu .menu-item.is-danger { color: var(--danger-fg); }
.app-ws-menu { width: 232px; }
.app-new-doc { width: 260px; }
.app-new-doc .menu-item.is-tall { gap: var(--space-2-5, 10px); }

/* ---------- sidebar ---------- */
.sidebar > .menu-root { display: block !important; }
.app-ws-switch { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; color: var(--fg); }
.app-ws-switch:hover { background: var(--bg-hover); }
.app-ws-menu { left: var(--space-2) !important; }
.app-ws-mark-sm { width: 20px; height: 20px; font-size: 10px; border-radius: var(--radius-sm); }
.sidebar-foot .nav-item { width: 100%; }
.nav-item .truncate { min-width: 0; }

/* ---------- pages ---------- */
.app-card { position: relative; display: grid; }
.app-card > .pcard { min-height: 100%; padding-right: var(--space-10, 40px); }
.app-card-actions { position: absolute; top: var(--space-2); right: var(--space-2); }
.app-table { border: 1px solid var(--border); border-radius: var(--radius-lg); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.app-section { display: grid; gap: var(--space-3); padding-top: var(--space-5); border-top: 1px solid var(--border); }
.app-danger-zone h2 { color: var(--danger-fg); }
.app-danger-text, .btn.app-danger-text { color: var(--danger-fg); }
.page-head .crumbs { margin-bottom: 2px; }

/* ---------- loading, toasts ---------- */
.app-loading { display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 160px; padding: var(--space-8); }
body > .app-loading, .auth-main > .app-loading { min-height: 100vh; }
.toast.app-toast.is-error { border-color: var(--danger-border, var(--border)); }
.toast.app-toast.is-error > .icon { color: var(--danger-fg); }
.toast.app-toast > .icon { flex: none; }

/* ---------- editor top bar on a server document ---------- */
a.crumb-btn, a.crumb-btn:hover { text-decoration: none; }
.app-crumb { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.app-save-text { max-width: 280px; }
.save-status { min-width: 0; }
.app-conflict { gap: var(--space-1); }
.topbar .avatar-stack .avatar { width: 24px; height: 24px; font-size: 10px; }

/* ---------- history panel (mockup panels.html#history) ---------- */
.app-history { width: var(--details-w); min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; background: var(--bg-chrome);
  border-left: 1px solid var(--border); z-index: var(--z-pane); }
.app-history .tabs { padding: 0 var(--space-4); }
.hist-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--space-2); align-items: start; padding: 8px var(--space-4); cursor: pointer; }
.hist-item:hover { background: var(--bg-hover); }
.hist-item.is-selected { background: var(--bg-selected); }
/* subtle text falls under 4.5:1 on the selected row's tint (light theme) */
.hist-item.is-selected .t-subtle { color: var(--fg-muted); }
.hist-item:focus-visible { outline: 2px solid var(--focus-ring, var(--accent)); outline-offset: -2px; }
.hist-item .icon { margin-top: 2px; color: var(--fg-subtle); }
.hist-item.is-named .icon { color: var(--accent-fg); }
.hist-item .spinner { margin-top: 3px; }
.hist-group { padding: 10px var(--space-4) 4px; }
.hist-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--fg-subtle); margin: 4px 0 0 4px; }
.app-history-more { display: flex; justify-content: center; padding: var(--space-2); }
.app-history-empty { padding: var(--space-3) var(--space-4); }
.app-history-error { margin: var(--space-2) var(--space-3); }
/* below the dock width the panel overlays the canvas, as details does */
@media (max-width: 1599px) {
  .app-history { position: absolute; top: 0; right: 0; bottom: 0; z-index: var(--z-panel-overlay); box-shadow: var(--shadow-2); }
  body.history-open .canvas-corner, body.history-open .canvas-tools { right: calc(var(--details-w) + var(--space-3)); }
  body.history-open .canvas-banner { left: calc(50% - var(--details-w) / 2); }
}

/* the open version's banner, centred at the top of the canvas; the canvas
   toolbar row moves down under it, so it hides neither the find box nor
   Show details at 1280 px; the error banner below the row (design 60 px)
   moves down by the same amount */
:root { --version-banner-h: 40px; }
.app-version-banner { position: absolute; top: var(--space-3); height: var(--version-banner-h); box-sizing: border-box; z-index: var(--z-canvas-overlay); box-shadow: var(--shadow-1); white-space: nowrap;
  left: calc(var(--code-w) + (100% - var(--code-w)) / 2); transform: translateX(-50%); }
body.history-open .app-version-banner { left: calc(var(--code-w) + (100% - var(--code-w) - var(--details-w)) / 2); }
body:has(.app-version-banner) .canvas-tools { top: calc(var(--space-3) * 2 + var(--version-banner-h)); }
body:has(.app-version-banner) .canvas-banner { top: calc(60px + var(--space-3) + var(--version-banner-h)); }

