* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--font-size-base);
  line-height: 1.5;
}

h1, h2, h3 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
}
h1 { font-size: var(--font-size-xl); }
h2 { font-size: var(--font-size-lg); }
h3 { font-size: var(--font-size-base); }
p { margin: 0 0 var(--space-3); }

a { color: var(--color-primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.text-muted { color: var(--color-text-muted); }

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
/* Unauthenticated pages (e.g. login) render with no sidebar; without this the
   single remaining grid child would only occupy the first 220px track and the
   page content would be squeezed into a narrow column. */
.app-shell.app-shell-solo {
  grid-template-columns: 1fr;
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 1fr; }
}

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Grid items default to min-width: auto (content-based), which stops this
     column from ever shrinking narrower than its widest child (e.g. a data
     table) and forces the whole page to scroll horizontally. min-width: 0
     lets it shrink to the grid track and pushes overflow handling down to
     .table-scroll instead. */
  min-width: 0;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-5);
  max-width: 1100px;
}

.page-footer {
  padding: var(--space-3) var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  border-top: 1px solid var(--color-border);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.page-header h1 { margin-bottom: var(--space-1); }
.page-subtitle {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin: 0;
}

.section { margin-bottom: var(--space-6); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
