@layer layout {
/* Framed app shell: rail | sidebar | main */
.page-frame {
  height: 100%;
  padding-block: 12px;
  padding-left: var(--gutter);
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-16);
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 80px -30px rgb(var(--black-rgb) / 0.8);
}
.app.no-side { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.app.no-side .side { display: none; }
/* The big sidebar folded away (html[data-side=off], set by browser.js): the rail offers it back and a New ticket button. */
html[data-side="off"] .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
html[data-side="off"] .app .side { display: none; }
.rail .side-off-only { display: none; }
html[data-side="off"] .rail .side-off-only { display: grid; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.scroll { flex: 1; min-height: 0; overflow: auto; }

.page { padding: 26px 32px 80px; max-width: 1320px; }
.page.wide { max-width: 1500px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-h h1 { font-family: var(--f-display); font-weight: 700; font-size: var(--fs-30); letter-spacing: -0.02em; line-height: 1.05; text-wrap: balance; }
.page-h .sub { color: var(--fg-3); margin-top: 6px; font-size: var(--fs-13); max-width: 80ch; }
.page-h .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: var(--fs-10-5); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-4); font-weight: 600; display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

.h2 { font-family: var(--f-display); font-weight: 700; font-size: var(--fs-15); margin: 28px 0 10px; display: flex; align-items: center; gap: 10px; }
.h2:first-child { margin-top: 0; }
.h2 .aside { font-family: var(--f-ui); font-weight: 400; font-size: var(--fs-11-5); color: var(--fg-3); margin-left: auto; display: flex; align-items: center; gap: 6px; }
.h2 .aside button.link { color: var(--accent); }
.h2 .count { font-family: var(--f-ui); font-size: var(--fs-11); color: var(--fg-3); font-weight: 500; background: var(--bg-4); border-radius: var(--r-5); padding: 0 6px; }

/* Narrow windows start with the sidebar folded; the rail's "Show the sidebar" brings it back (html[data-side=on]). */
@media (max-width: 1100px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .app .side { display: none; }
  .rail .side-off-only { display: grid; }
  html[data-side="on"] .app:not(.no-side) { grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr); }
  html[data-side="on"] .app:not(.no-side) .side { display: flex; }
  html[data-side="on"] .rail .side-off-only { display: none; }
}
@media (max-width: 560px) {
  .page-frame { padding: 0; }
  .app { grid-template-columns: minmax(0, 1fr); border-radius: 0; border-inline: 0; }
  .app .rail { display: none; }
  .page { padding: 20px 16px 60px; }
}
}
