/* PLAYER.ID authenticated App Shell V1.
   Generic shell anatomy only; role-specific modules stay in their workspace CSS. */
.pid-app-shell {
  display: grid;
  grid-template-columns: var(--pid-app-sidebar-width) minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  background: var(--pid-color-canvas);
  color: var(--pid-color-text);
}

.pid-app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  width: var(--pid-app-sidebar-width);
  min-height: 100vh;
  padding: 0 var(--pid-space-3) var(--pid-space-4);
  border-right: 1px solid var(--pid-color-border);
  background: linear-gradient(180deg, var(--pid-color-surface) 0%, #f4fbfb 100%);
}

.pid-app-sidebar-brand { display: flex; align-items: center; min-height: var(--pid-app-header-height); color: var(--pid-color-text); text-decoration: none; }
.pid-app-nav { display: grid; gap: 3px; }
.pid-app-nav-item { display: flex; align-items: center; gap: var(--pid-space-2); width: 100%; min-height: var(--pid-control-height); padding: 0 11px; border: 0; border-radius: var(--pid-radius-sm); outline: 0; background: transparent; color: #405766; font: inherit; font-size: .78rem; font-weight: 650; line-height: 1.25; text-align: left; text-decoration: none; cursor: pointer; transition: background-color .16s ease, color .16s ease, box-shadow .16s ease; }
.pid-app-nav-item > span { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; border-radius: var(--pid-radius-sm); background: #eaf8f7; color: var(--pid-color-teal-hover); }
.pid-app-nav-item:hover { background: #edf8f7; color: #075e5b; }
.pid-app-nav-item.is-active { background: linear-gradient(90deg, #d9f6f4, #edfafa); color: #075e5b; box-shadow: inset 3px 0 0 var(--pid-color-teal); }
.pid-app-nav-item:focus-visible { box-shadow: inset 3px 0 0 var(--pid-color-teal), var(--pid-focus-ring); }
.pid-app-nav-item:disabled, .pid-app-nav-item[aria-disabled="true"] { color: var(--pid-color-text-soft); opacity: .62; cursor: not-allowed; }

.pid-app-main { min-width: 0; background: var(--pid-color-canvas); }
.pid-app-header { position: sticky; top: 0; z-index: 35; display: flex; align-items: center; min-height: var(--pid-app-header-height); border-bottom: 1px solid var(--pid-color-border); background: var(--pid-color-surface); }
.pid-app-header-title { margin: 0; color: var(--pid-color-text); font-size: 1.34rem; font-weight: 800; line-height: 1.15; }
.pid-app-header-subtitle { display: block; margin-top: 3px; color: var(--pid-color-text-muted); font-size: .78rem; line-height: 1.35; }
.pid-app-header-status { display: flex; align-items: center; align-self: center; gap: var(--pid-space-2); margin-left: auto; color: var(--pid-color-text-muted); }

.pid-app-contextbar { display: flex; align-items: center; justify-content: space-between; gap: var(--pid-space-4); min-height: 70px; margin: var(--pid-space-3) var(--pid-space-4) 0; padding: var(--pid-space-3) var(--pid-space-4); border: 1px solid var(--pid-color-border); border-radius: var(--pid-radius-md); background: var(--pid-color-surface); box-shadow: var(--pid-shadow-sm); }
.pid-app-contextbar-primary { display: flex; align-items: center; gap: var(--pid-space-2); flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.pid-app-contextbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--pid-space-2); flex-wrap: wrap; }
.pid-app-contextbar :where(.pid-input, .pid-select, .pid-btn) { min-height: var(--pid-control-height); }
.pid-app-contextbar .pid-field { flex: 1 1 180px; max-width: 320px; }
.pid-app-content { width: 100%; min-width: 0; padding: var(--pid-space-4); }

/* Icon rules are deliberately scoped; charts and data visualisations are untouched. */
.pid-app-nav-item > span > svg,
.pid-app-header-status > span > svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 980px) {
  .pid-app-shell { grid-template-columns: 1fr; }
  .pid-app-sidebar { position: static; width: 100%; min-height: 0; }
  .pid-app-nav { grid-auto-flow: column; grid-auto-columns: minmax(130px, 1fr); overflow-x: auto; overscroll-behavior-inline: contain; }
  .pid-app-nav-item { justify-content: center; white-space: nowrap; }
  .pid-app-main { grid-column: 1; }
}

@media (max-width: 768px) {
  .pid-app-header { position: static; min-height: 68px; }
  .pid-app-contextbar { align-items: stretch; flex-direction: column; margin-inline: var(--pid-space-3); }
  .pid-app-contextbar-primary { align-items: stretch; }
  .pid-app-contextbar-actions { justify-content: flex-start; }
  .pid-app-contextbar .pid-field { max-width: none; }
  .pid-app-content { padding: var(--pid-space-3); }
}

@media (max-width: 430px) {
  .pid-app-nav { grid-auto-columns: minmax(110px, 1fr); }
  .pid-app-nav-item > span { display: none; }
  .pid-app-contextbar-actions > .pid-btn { flex: 1 1 100%; }
}
