.owner-shell {
  --canvas: #f6f6f5;
  --line: #e1e2df;
  --gutter: clamp(16px, 3vw, 36px);
  --owner-header: 64px;
  background: var(--canvas);
}
.owner-shell .app-header { background: var(--paper); }
.owner-shell .header-inner {
  display: flex;
  justify-content: space-between;
  min-height: var(--owner-header);
  max-width: none;
  gap: 10px;
}
.owner-shell .brand,
.owner-shell .portal-logout,
.owner-shell .portal-menu > summary,
.owner-shell .role-control select { min-height: 44px; }
.owner-shell .portal-logout,
.owner-shell .portal-menu > summary {
  min-width: 44px;
  padding-inline: 10px;
  border-radius: 10px;
  font-size: .84rem;
}
.owner-shell .portal-menu > summary { display: inline-flex; align-items: center; gap: 5px; }
.owner-shell .portal-menu[open] > summary svg { transform: rotate(180deg); }
.owner-shell .recovery-queue-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.owner-shell .header-actions { gap: 6px; }
.owner-shell .portal-menu .portal-entry-links { max-width: calc(100vw - 24px); }
.owner-shell .app-main { min-height: calc(100svh - var(--owner-header)); }
.owner-shell .app-main, .owner-shell .staff-page { min-width: 0; }
.owner-shell .nav-item { font-variant-numeric: tabular-nums; }
.owner-shell .button[aria-busy="true"] { cursor: progress; }
.owner-shell .button[aria-busy="true"]::before {
  content: "";
  flex: none;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .owner-shell .button[aria-busy="true"]::before { animation: owner-pending .8s linear infinite; }
  @keyframes owner-pending { to { transform: rotate(360deg); } }
}
.owner-shell .field :is(input, select, textarea) { scroll-margin-block: 70px; }
.owner-shell :is(button, summary, a, input, select, textarea):focus-visible { outline-offset: 2px; }
.owner-shell.portal-no-session .app-main { max-width: 600px; }

@media (min-width: 1100px) {
  .owner-shell { --owner-rail: clamp(184px, 14vw, 216px); }
  .owner-shell .header-inner { padding-inline: 22px var(--gutter); }
  .owner-shell .top-nav {
    position: fixed;
    inset: var(--owner-header) auto 0 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 5px;
    width: var(--owner-rail);
    padding: 24px 12px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--paper);
  }
  .owner-shell .top-nav .nav-item {
    justify-content: flex-start;
    min-height: 46px;
    padding-inline: 14px;
    gap: 12px;
    border-radius: 10px;
  }
  .owner-shell .top-nav .notification-badge { margin-left: auto; }
  .owner-shell .top-nav .is-active { background: #222323; color: #fff; }
  .owner-shell:not(.portal-no-session) .app-main {
    width: auto;
    margin-inline: var(--owner-rail) 0;
    padding-block: 28px 54px;
  }
  .owner-shell .staff-page { max-width: 1300px; margin-inline: auto; }
}
@media (max-width: 1099px) {
  .owner-shell .top-nav { display: none; }
  .owner-shell .bottom-nav {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-content: center;
    gap: 2px;
    padding: 5px max(6px, calc((100% - 680px) / 2)) calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
  }
  .owner-shell .bottom-nav .nav-item {
    flex-direction: column;
    gap: 3px;
    min-height: 48px;
    min-width: 0;
    padding: 4px 0;
    border-radius: 10px;
    font-weight: 550;
    font-size: .75rem;
    line-height: 1.35;
  }
  .owner-shell .bottom-nav .is-active { background: #eeeFec; color: var(--ink); font-weight: 700; }
  .owner-shell .bottom-nav .notification-badge { position: absolute; top: 0; left: 54%; }
  .owner-shell:not(.portal-no-session) .app-main { padding-block: 18px calc(84px + env(safe-area-inset-bottom)); }
  .owner-shell .notice { bottom: calc(73px + env(safe-area-inset-bottom)); }
}
@media (max-width: 460px) {
  .owner-shell { --owner-header: 58px; --gutter: 12px; }
  .owner-shell .header-actions { gap: 4px; }
  .owner-shell .portal-logout, .owner-shell .portal-menu > summary { padding-inline: 7px; }
  .owner-shell .portal-menu .portal-entry-links { right: -36px; }
}
@media (max-width: 374px) {
  .owner-shell .owner-recovery-label { display: none; }
  .owner-shell .recovery-queue-button { padding: 0; }
}

html:has(.owner-shell .app-dialog[open]) { overflow: hidden; }
.owner-shell .app-dialog {
  --dialog-pad: clamp(16px, 3vw, 24px);
  width: min(620px, calc(100% - 40px));
  max-height: min(88dvh, 850px);
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 20px 70px #1112;
}
.owner-shell .app-dialog[open] {
  display: grid;
  grid-template: "title close" auto "content content" minmax(0, 1fr) "feedback feedback" auto / minmax(0, 1fr) auto;
}
.owner-shell #owner-dialog-title {
  grid-area: title;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 12px var(--dialog-pad);
}
.owner-shell #owner-dialog-title h2 { font-size: 1.17rem; letter-spacing: -.025em; line-height: 1.4; }
.owner-shell .dialog-close {
  grid-area: close;
  position: static;
  align-self: center;
  width: 44px;
  height: 44px;
  margin: 7px 10px 7px 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
}
.owner-shell #dialog-content {
  grid-area: content;
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--dialog-pad);
  border-top: 1px solid var(--line);
}
.owner-shell #dialog-content .dialog-heading { padding-right: 0; }
.owner-shell #form-feedback {
  grid-area: feedback;
  margin: 0;
  border-radius: 0;
  padding: 11px var(--dialog-pad);
}
@media (max-width: 600px) {
  .owner-shell .app-dialog {
    inset: auto 0 0;
    margin: auto auto 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)));
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .owner-shell #dialog-content :is(input, select, textarea) { font-size: max(16px, 1rem); }
}
