/* The frame: a grey shell with the menu on it, and the page as a white panel inset on the right
   (like TBX Analytics). */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; background: var(--shell); }
@media (min-width: 901px) {
  .app.nav-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app.nav-collapsed .sidebar { display: none; }
  .app.nav-collapsed .main-col { margin-left: 8px; }
}

.main-col { min-width: 0; display: flex; flex-direction: column; margin: 8px 8px 8px 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0.75rem 1rem;
  overflow: hidden;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.6rem 0.6rem; color: var(--text);
  text-decoration: none; font-size: 20px; font-weight: 500; }


.nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem;
  scrollbar-width: thin; scrollbar-color: var(--field) transparent; }
.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-title { padding: 0 0.75rem 0.3rem; font-weight: 600; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 0.75rem; min-height: 40px; padding: 0 0.85rem;
  border-radius: 10px; color: var(--text); text-decoration: none; }
.nav a:hover { background: rgba(0, 0, 0, 0.05); }
/* The current page is a white card on the grey shell. */
.nav a.active { background: var(--bg); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.06); }
.icon { flex: none; }

.sidebar-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding-top: 0.75rem; }
.who { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--bg); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sign-out { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 0.5rem; text-decoration: none; }

.topbar { display: flex; align-items: center; gap: 0.75rem; height: 64px; padding: 0 1.5rem;
  border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }
.menu-toggle { display: inline-flex; padding: 0 0.5rem; }
.crumb-divider { width: 1px; height: 20px; background: var(--line); }
.crumb { font-weight: 600; }
.scrim { display: none; }
.pop-anchor { position: relative; }

.search { flex: 0 1 300px; display: flex; align-items: center; gap: 0.55rem; height: 42px;
  padding: 0 0.6rem 0 0.8rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.search:focus-within { border-color: var(--field); }
/* (the field is a plain input inside the box: the box carries the shape, so this beats the form-control style) */
.search input[type="search"] { flex: 1; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; outline: none; }
.key-hint { font: 12px var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--muted); white-space: nowrap; }

.popover { position: absolute; z-index: 30; top: calc(100% + 8px); background: var(--surface);
  border-radius: 16px; box-shadow: var(--shadow); color: var(--text); }
.search-panel { left: 0; right: 0; max-height: 60vh; overflow: auto; padding: 0.35rem; }
.search-group { padding: 0.55rem 0.6rem 0.2rem; font-weight: 600; color: var(--muted); }
.search-empty { padding: 0.7rem 0.6rem; }
.hit { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%;
  padding: 0.45rem 0.6rem; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; }
.hit.active, .hit:hover { background: var(--card); }

.status-pill { display: inline-flex; align-items: center; gap: 0.5rem; height: 40px; padding: 0 1.1rem;
  border: 0; border-radius: 999px; background: var(--pill); color: var(--text); font: inherit; cursor: pointer; }
.status-pill:hover { background: var(--pill-hover); }
.pill-ok .mark, .row-ok .mark { color: var(--st-good); }
.pill-warn .mark, .row-warn .mark { color: var(--st-warning); }
.pill-bad .mark, .row-bad .mark { color: var(--st-critical); }
.pill-bad { background: var(--bad-bg); color: var(--bad-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }

.status-panel { right: 0; width: min(360px, 92vw); padding: 0.6rem; }
.status-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.status-row { display: grid; grid-template-columns: 1.1rem 9.5rem 1fr; gap: 0.4rem; align-items: baseline;
  padding: 0.5rem 0.3rem; }
.status-row + .status-row { border-top: 1px solid var(--line); }
.status-name { font-weight: 600; }
.status-text { color: var(--muted); }
.status-more { display: block; padding: 0.35rem 0.3rem 0.1rem; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main-col { margin: 0; border: 0; border-radius: 0; }
  .sidebar { position: fixed; left: 0; top: 0; width: 264px; transform: translateX(-102%); background: var(--shell);
    transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.45); opacity: 0;
    pointer-events: none; transition: opacity 0.2s; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 0.9rem; }
  .search { flex: 1 1 auto; }
  .key-hint { display: none; }
  .pill-text { display: none; }
}
