/* admin-base.css — reset, typography, app shell (sidebar / header / layout / login).
 * Consumes tokens from admin-tokens.css only. ISC-85 layer 2. */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: var(--fs-h3); font-weight: 700; }

p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

code, kbd, pre, .mono { font-family: var(--font-mono); }
kbd {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--paper);
}

.muted { color: var(--ink-muted); }
.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.error { color: var(--danger-ink); font-size: var(--fs-small); }

/* ── App shell ───────────────────────────────────────────────────────────── */

/* Demo mode (ISA ISC-94): fixed strip across the top of the whole shell.
   Hidden only with ?record=1 so recordings keep clean chrome. */
.demo-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-border);
  color: var(--warn-ink);
  font-family: var(--font-body);
  font-size: var(--fs-small);
}
.demo-banner[hidden] { display: none; }
.demo-banner code { font-family: var(--font-mono); font-size: var(--fs-small); }
body[data-demo] #dashboard-view { padding-top: 28px; }

#dashboard-view {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: var(--sp-6) 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand { padding: 0 10px var(--sp-5); }
.sidebar-brand .brand-eyebrow {
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--accent);
}
.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: var(--sp-4); }
.nav-group-label {
  padding: var(--sp-4) 10px var(--sp-2);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--ink-muted);
}
.nav-group:first-of-type .nav-group-label { padding-top: 10px; }

.nav-tab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2);
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-size: var(--fs-body);
  color: var(--ink-2);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
.nav-tab:hover { background: var(--tint); }
.nav-tab.active, .nav-tab[aria-pressed="true"] {
  background: var(--accent-bg);
  color: var(--accent-deep);
  font-weight: 600;
}

.nav-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--tint-2);
  color: var(--ink-2);
  font-size: var(--fs-label);
  text-align: center;
}
.nav-count.attention { background: var(--danger-ink); color: var(--white); }

.health-dot {
  width: 8px; height: 8px;
  border-radius: var(--r-xs);
  background: var(--ink-faint);
  flex-shrink: 0;
}
.health-dot.ok { background: var(--ok-ink); }
.health-dot.warn { background: var(--warn); }
.health-dot.bad { background: var(--danger-ink); }

.sidebar-account {
  margin-top: auto;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--tint-2);
  position: relative;
}
.account-button {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-size: var(--fs-body);
  color: var(--ink-2);
  text-align: left;
}
.account-button:hover { background: var(--tint); }
.account-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: var(--sp-1);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: var(--sp-1);
  z-index: 30;
}
.account-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: var(--fs-small);
  color: var(--ink-2);
  text-align: left;
}
.account-menu-item:hover { background: var(--tint); }

/* Main column */
.dashboard-content {
  flex-grow: 1;
  min-width: 0;
  padding: var(--page-pad);
  display: flex;
  flex-direction: column;
  gap: var(--page-gap);
}

/* View header (mockup: H1 + context count left; Updated + global search right) */
.dashboard-content > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}
.header-brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}
.title-group { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
#dashboard-title { white-space: nowrap; }
.view-subtitle {
  font-size: var(--fs-item);
  color: var(--ink-2);
  white-space: nowrap;
}
.help-button {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink-muted);
  font-size: var(--fs-small);
  font-weight: 600;
  align-self: center;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.view-updated {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Global search (⌘K) */
.global-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 300px;
  height: var(--control-h);
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink-muted);
  font-size: var(--fs-body);
}
.global-search input {
  flex-grow: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: var(--fs-body);
  outline: none;
  color: var(--ink);
}
.global-search svg { flex-shrink: 0; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-8);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
}
.login-card h1 { font-size: 26px; }
.login-card label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-2);
}

/* Session-expired notice shown above the login card (ISC-7) */
.session-note {
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: var(--fs-small);
}

/* 404 / unknown view */
.notfound-card {
  padding: var(--sp-10);
  text-align: center;
}

/* ── Migrated from legacy admin.css (ISC-84..89) ─────────────────────────── */

[hidden] { display: none !important; }

/* Sidebar group wrapper + account identity bits used by the live markup */
.nav-groups { display: flex; flex-direction: column; gap: 10px; }
.account-avatar {
  width: 30px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--tint-2);
  color: var(--accent-deep);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-label);
  flex: 0 0 30px;
}
.account-name b { font-size: var(--fs-small); }

/* Disclosure elements */
details {
  margin-top: var(--sp-5);
  border-top: 1px solid var(--tint);
  padding-top: var(--sp-4);
}
summary { cursor: pointer; font-weight: 700; color: var(--ink); }

/* Shell responsive collapse (migrated from admin.css) */
@media (max-width: 800px) {
  #dashboard-view { padding: var(--sp-4); display: block; }
  .admin-sidebar { position: static; min-height: 0; height: auto; margin-bottom: var(--sp-5); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-xl); }
  .sidebar-brand { padding: 0 3px var(--sp-3); }
  .nav-groups { flex-direction: row; overflow-x: auto; }
  .nav-tab { text-align: center; width: auto; white-space: nowrap; flex: 1; }
  .dashboard-content > header { flex-direction: column; align-items: flex-start; gap: var(--sp-4); }
  .header-actions { flex-wrap: wrap; width: 100%; justify-content: flex-end; }
}
@media (max-width: 480px) {
  .login-card { padding: var(--sp-6); }
  .header-actions span { width: 100%; text-align: right; }
}
