/* ==========================================================================
   SHELL — camadas, barra lateral, barra superior, conteúdo e cabeçalhos
   (design_system.md §7.9–7.11, §9, §14)
   ========================================================================== */
.layer { min-height: 100vh; }
.shell { --sbw: var(--sidebar-w); display: grid; grid-template-columns: var(--sbw) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns var(--d3) var(--ease); }
.shell.collapsed { --sbw: var(--sidebar-min); }
.shell.saindo { animation: sair .45s var(--ease-in) forwards; }
/* Enquanto a casca (barra lateral e topo) não existir — Onda 2 — o conteúdo ocupa a tela inteira. */
.shell[data-casca="pendente"] { grid-template-columns: minmax(0, 1fr); }
.shell[data-casca="pendente"] .sidebar, .shell[data-casca="pendente"] .topbar, .shell[data-casca="pendente"] .sb-scrim { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: var(--z-sidebar); display: flex; flex-direction: column; min-width: 0;
  background: var(--bg-elev); border-right: 1px solid var(--border); overflow: hidden;
}
.sb-top { padding: 10px 10px 6px; }
.ws-switch { width: 100%; height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 8px; border-radius: var(--r); text-align: left; transition: background var(--d1); }
.ws-switch:hover, .ws-switch[aria-expanded="true"] { background: var(--hover); }
.ws-logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; background: var(--fg); color: var(--bg); }
.ws-logo svg { width: 17px; height: auto; }
.ws-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.ws-text .sep { color: var(--fg-4); font-weight: 400; }
.ws-text .proj { color: var(--fg-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ws-switch .ic { color: var(--fg-3); font-size: 14px; flex: none; }
.sb-search {
  margin: 4px 10px 8px; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px;
  border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface); color: var(--fg-3); font-size: 13px;
  transition: border-color var(--d1), color var(--d1);
}
.sb-search:hover { border-color: var(--border-3); color: var(--fg-2); }
.sb-search .ic { font-size: 15px; }
.sb-search .grow { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 12px; }
.sb-sec { margin-top: 14px; }
.sb-sec:first-child { margin-top: 4px; }
.sb-sec-t { padding: 0 8px 6px; font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; display: flex; justify-content: space-between; }
.sb-item {
  position: relative; width: 100%; height: 30px; display: flex; align-items: center; gap: 10px; padding: 0 8px; border-radius: 7px;
  font-size: 13px; font-weight: 450; color: var(--fg-2); white-space: nowrap; text-align: left;
  transition: background var(--d1), color var(--d1);
}
.sb-item:hover { background: var(--hover); color: var(--fg); }
.sb-item .ic { font-size: 16px; flex: none; width: 18px; text-align: center; }
.sb-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-item .cnt { font: 11px var(--mono); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.sb-item .kbds { opacity: 0; transition: opacity var(--d1); }
.sb-item:hover .kbds { opacity: 1; }
.sb-item:hover .cnt.hide-h { display: none; }
.sb-item.active { background: var(--press); color: var(--fg); font-weight: 500; }
.sb-item.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 2px; border-radius: 2px; background: var(--accent); }
.sb-item.disabled { color: var(--fg-4); cursor: not-allowed; }
.sb-item.disabled:hover { background: transparent; color: var(--fg-4); }
.sb-item .mini-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.sb-item .mini-dot.err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.sb-item .mini-dot.warn { background: var(--warn); }
.sb-item .cnt.err-t { color: var(--err); }
.sb-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sb-foot { border-top: 1px solid var(--border); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-foot-row { display: flex; align-items: center; gap: 4px; }
.sb-collapse { margin-left: auto; }
.shell.collapsed .ws-text, .shell.collapsed .ws-switch > .ic, .shell.collapsed .sb-search .grow, .shell.collapsed .sb-search kbd,
.shell.collapsed .sb-item .lbl, .shell.collapsed .sb-item .cnt, .shell.collapsed .sb-item .kbds, .shell.collapsed .sb-item .selo,
.shell.collapsed .sb-sec-t span, .shell.collapsed .sb-foot .sb-item .lbl { display: none; }
.shell.collapsed .sb-sec-t { height: 1px; padding: 0; margin: 0 8px 8px; background: var(--border); }
.shell.collapsed .sb-search, .shell.collapsed .ws-switch, .shell.collapsed .sb-item { justify-content: center; padding: 0; }
.shell.collapsed .sb-item .mini-dot { position: absolute; top: 6px; right: 8px; }
.shell.collapsed .sb-foot-row { flex-direction: column; }
.shell.collapsed .sb-collapse { margin: 0; }
.shell.collapsed .sb-collapse .ic { transform: scaleX(-1); }
.sb-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar); height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px; padding: 0 14px 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(12px); backdrop-filter: saturate(1.5) blur(12px);
}
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; }
.crumbs a, .crumbs span.cur { padding: 3px 6px; border-radius: var(--r-sm); color: var(--fg-3); display: inline-flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--fg); background: var(--hover); }
.crumbs span.cur { color: var(--fg); font-weight: 500; }
.crumbs .div { color: var(--fg-4); font-size: 12px; }
.crumbs .ic { font-size: 14px; }
.tb-right { display: flex; align-items: center; gap: 2px; flex: none; }
.live {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 4px 0 10px; margin-right: 6px;
  border: 1px solid var(--border-2); border-radius: var(--r-full); font-size: 12px; color: var(--fg-2); background: var(--surface);
}
.live .dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.live .dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok); animation: ping 2s var(--ease) infinite; }
.live b { font-weight: 500; color: var(--fg); }
.live .t { font-family: var(--mono); font-size: 11.5px; color: var(--fg-3); font-variant-numeric: tabular-nums; min-width: 92px; }
.live .icon-btn { width: 22px; height: 22px; border-radius: 50%; }
.live .icon-btn .ic { font-size: 13px; }
.live .icon-btn.girando .ic { animation: rot .8s var(--ease) infinite; }
.badge-count {
  position: absolute; top: 3px; right: 3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--accent-solid); color: var(--on-accent); font: 600 9.5px/15px var(--mono); text-align: center; box-shadow: 0 0 0 2px var(--bg);
}
.user-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; margin-left: 4px; border-radius: var(--r-full); transition: background var(--d1); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--hover); }
.user-btn .nm { font-size: 13px; font-weight: 500; }
.user-btn .ic { font-size: 12px; color: var(--fg-3); }
.only-mobile { display: none !important; }

.view { position: relative; flex: 1; width: 100%; max-width: 1640px; margin: 0 auto; padding: 26px 32px 96px; container-type: inline-size; }
.view:focus { outline: none; }
.view.leaving > * { opacity: 0; transform: translateY(-4px); transition: opacity 90ms ease, transform 90ms ease; }
.rise { animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 38ms); }

/* cabeçalhos */
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h .ttl { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.page-h h1 { font-size: 28px; letter-spacing: -0.035em; }
.page-h p.sub { color: var(--fg-2); font-size: 14px; max-width: 640px; }
.page-h .acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; }
.page-h .acts kbd { margin-left: 4px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.sec-h h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; display: flex; align-items: center; gap: 10px; }
.sec-h p { color: var(--fg-3); font-size: 13px; }
.chip-mono { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); font: 500 11px var(--mono); letter-spacing: .06em; color: var(--fg-2); text-transform: uppercase; }

.mod-h { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 18px; }
.mod-h .ttl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mod-h h1 { font-size: 24px; letter-spacing: -0.03em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mod-h .right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.mod-stats { display: flex; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.mod-stats > div { padding: 7px 14px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); min-width: 0; }
.mod-stats > div:last-child { border-right: 0; }
.mod-stats .k { font: 500 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); white-space: nowrap; }
.mod-stats .v { font: 600 16px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.view-sel { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.view-sel > .eyebrow { font-size: 9.5px; }

/* barra flutuante de filtros */
.float-bar { position: sticky; bottom: 16px; z-index: var(--z-float); width: fit-content; max-width: 100%; margin: 16px auto 0; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xl); border: 1px solid var(--border-2); background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: var(--shadow-md); }
.fb-stat { display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.fb-stat .k { font: 500 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-3); }
.fb-stat .v { font: 600 17px/1 var(--mono); font-variant-numeric: tabular-nums; }
.fb-btn { height: 36px; padding: 0 10px; display: inline-flex; align-items: center; gap: 8px; border-radius: var(--r-md); border: 1px solid var(--border-2); background: var(--surface-2); font-size: 13px; color: var(--fg-2); }
.fb-btn:hover { border-color: var(--border-3); color: var(--fg); }
.fb-btn.on { color: var(--accent-text); }

@media (max-width: 1023px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); --sbw: 0px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform var(--d4) var(--ease); box-shadow: var(--shadow-lg); }
  .shell.menu-open .sidebar { transform: none; }
  .shell.collapsed .ws-text, .shell.collapsed .sb-item .lbl, .shell.collapsed .sb-item .cnt, .shell.collapsed .sb-sec-t span, .shell.collapsed .sb-search .grow { display: initial; }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: calc(var(--z-sidebar) - 1); background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--d3); }
  .shell.menu-open .sb-scrim { opacity: 1; pointer-events: auto; }
  .sb-collapse { display: none !important; }
  .only-mobile { display: inline-grid !important; }
  .view { padding: 20px 16px 96px; }
  .topbar { padding: 0 10px; }
}
@media (max-width: 760px) {
  .live .lbl-full, .user-btn .nm, .user-btn .ic, .tb-hide-sm { display: none; }
  .live { padding-left: 8px; }
  .live .t { min-width: 0; }
  .crumbs a, .crumbs .div { display: none; }  /* só o último item (o atual) */
  .float-bar { position: static; margin-top: 16px; }
}
@container (max-width: 900px) {
  .mod-h { grid-template-columns: auto auto minmax(0, 1fr); }
  .mod-h .right { grid-column: 1 / -1; justify-content: flex-start; }
}
@container (max-width: 620px) {
  .page-h h1 { font-size: 24px; }
}
