/* Hyrax Operator Console - layout: pre-auth centered card, authenticated shell
   (sidebar + topbar + main), responsive collapse under ~768px. Served same-origin
   (style-src 'self'); no CDN. ASCII-only. */

/* --- pre-auth (login / enroll) centered card --- */
.preauth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.preauth .card {
  width: min(420px, 100%);
}
.preauth-status {
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  min-height: 1.2em;
  margin: 0.5rem 0 0 0;
}
.preauth-status.is-error {
  color: hsl(var(--destructive-foreground));
}
.preauth-link {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* --- authenticated shell grid --- */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 100vh;
  min-height: 100vh;
}

/* --- sidebar --- */
.sidebar {
  grid-column: 1;
  background: hsl(var(--card));
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  gap: 0.5rem;
  overflow-y: auto;
}
.sidebar-brand {
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem 0.75rem 0.5rem;
  color: hsl(var(--foreground));
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.nav-item-active {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

/* --- topbar --- */
.main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  padding: 0.75rem 1.25rem;
  flex: 0 0 auto;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.whoami {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}
.whoami-handle {
  color: hsl(var(--foreground));
  font-weight: 500;
}

/* --- main scrollable view region --- */
.view-root {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}
.dashboard-stat {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
/* compact stat tiles: small muted label, tight padding, big number */
.dashboard-card-link .card-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.dashboard-card-link .card-header {
  padding-bottom: 0.25rem;
}
.dashboard-card-link .card-content {
  padding-top: 0;
}
.dashboard-card-link {
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.dashboard-card-link:hover {
  border-color: hsl(var(--ring));
}
.dashboard-card-link:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

/* --- responsive: collapse the sidebar to a top nav under ~768px --- */
@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .sidebar {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid hsl(var(--border));
    overflow-x: auto;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .main {
    grid-column: 1;
    grid-row: 2;
    height: auto;
  }
}
