/*
 * App shell chrome — the parts of the screen that stay put across every
 * app/module view: topbar, bottom nav, scroll area, toasts, install
 * banner. Built from tokens + primitives, not its own one-off values.
 */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--topbar-height) + var(--safe-top));
  padding-top: var(--safe-top);
  padding-left: 16px;
  padding-right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-topbar);
  border-bottom: var(--border-width) solid var(--ink);
  z-index: var(--z-chrome);
}

.topbar h1 {
  font-size: 13px;
  margin: 0;
  font-weight: 400;
  font-family: var(--font-pixel);
  letter-spacing: 0.02em;
}

/* Persistent laptop + active-jobs strip under the topbar. Hidden until
   the user is signed in (body.has-agent-status). */

.agent-status {
  position: fixed;
  top: calc(var(--topbar-height) + var(--safe-top));
  left: 0;
  right: 0;
  height: var(--agent-status-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-2, var(--card));
  border-bottom: var(--border-width) solid var(--ink);
  z-index: var(--z-chrome);
  font-size: 12px;
  color: var(--text-secondary);
}

.agent-status[hidden] {
  display: none;
}

.agent-status-online {
  background: color-mix(in srgb, var(--success) 10%, var(--card));
}

.agent-status-offline {
  background: color-mix(in srgb, var(--danger) 10%, var(--card));
  color: var(--text);
}

.agent-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-tertiary);
}

.agent-status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent);
}

.agent-status-dot.offline {
  background: var(--danger);
}

.agent-status-text {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.agent-status-text:hover {
  text-decoration: underline;
}

/* Main scroll area */

.view {
  position: absolute;
  top: calc(var(--topbar-height) + var(--safe-top));
  bottom: calc(var(--bottomnav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 32px;
}

body.has-agent-status .view {
  top: calc(var(--topbar-height) + var(--agent-status-height) + var(--safe-top));
}

.pull-indicator {
  position: absolute;
  top: calc(var(--topbar-height) + var(--safe-top));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base);
  z-index: var(--z-pull-indicator);
}

body.has-agent-status .pull-indicator {
  top: calc(var(--topbar-height) + var(--agent-status-height) + var(--safe-top));
}

.pull-indicator.visible {
  opacity: 1;
}

/* Bottom nav */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottomnav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--surface-bottomnav);
  border-top: var(--border-width) solid var(--ink);
  z-index: var(--z-chrome);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-height: 44px;
}

.nav-item .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent);
}

/* Toasts */

.toast-container {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--bottomnav-height) + var(--safe-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-slow), transform var(--duration-slow);
  border: var(--border-width) solid var(--ink);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: var(--success);
}

.toast-error {
  border-color: var(--danger);
}
