/* base.css — reset, base type, layout primitives, focus ring, utilities. */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-stack);
  font-weight: var(--weight-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: var(--weight-heading);
  line-height: var(--lh-heading);
  color: var(--color-text);
  letter-spacing: normal;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0; }

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; font-size: inherit; font-weight: var(--weight-body); color: inherit; }

input, select, textarea {
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
}

/* Visible focus ring on every interactive element. Never outline:none alone. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 6px;
}
/* keep default outline only for keyboard users; hide for mouse */
:focus:not(:focus-visible) { outline: none; }

.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;
}

/* ---- Layout primitives ---- */

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar content";
  min-height: 100vh;
  gap: var(--space-5);
  padding: var(--space-5);
}

.sidebar  { grid-area: sidebar; }
.topbar   { grid-area: topbar; }
.content  { grid-area: content; min-width: 0; }

.stack { display: flex; flex-direction: column; }
.cluster { display: flex; align-items: center; flex-wrap: wrap; }

.view[hidden] { display: none !important; }

/* Desktop collapse toggle: shrink the sidebar to an icon rail. */
@media (min-width: 993px) {
  .app-shell.is-collapsed { grid-template-columns: 84px minmax(0, 1fr); }
  .app-shell.is-collapsed .sidebar { padding: var(--space-4) var(--space-2); align-items: center; }
  .app-shell.is-collapsed .brand__name,
  .app-shell.is-collapsed .nav__label,
  .app-shell.is-collapsed .nav-pill__text,
  .app-shell.is-collapsed .user-chip__meta { display: none; }
  .app-shell.is-collapsed .nav-pill { justify-content: center; padding: var(--space-3); }
  .app-shell.is-collapsed .user-chip { justify-content: center; }
  .app-shell.is-collapsed .collapse-btn svg { transform: rotate(180deg); }
}

.view {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Page section heading row */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.view-head__title { display: flex; flex-direction: column; gap: var(--space-1); }
.view-head__sub { color: var(--color-text-muted); font-size: var(--fs-sm); }
