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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Selection */
::selection {
  background: rgba(99,102,241,0.3);
  color: var(--text-primary);
}

/* Links */
a { color: var(--text-brand); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--brand-300); }

/* Headings */
h1,h2,h3,h4,h5,h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

/* ── Images: Global Safety Rules ─────────────────────────────────── */
/* Prevent default inline baseline gap for all img elements */
img { max-width: 100%; display: block; vertical-align: middle; }

/* Entity Image Container (renderEntityImage overlay pattern)
   - position:relative so the absolute <img> overlay is contained
   - overflow:hidden clips both fallback and photo layers
   - The <img> inside uses position:absolute inset:0 (set inline)
   - The .entity-img-fallback span uses position:absolute inset:0 (set inline)
   These rules are SAFETY NETS only — primary styles are set inline by renderEntityImage */
.entity-image-container {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
/* Fallback layer must not intercept pointer events */
.entity-img-fallback {
  pointer-events: none;
  user-select: none;
}
/* Prevent raw text overflow inside image containers */
.entity-image-container > span:not(.entity-img-fallback) {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Table cell images: block + centered, constrained size */
td img, th img {
  display: block;
  margin: 0 auto;
  max-height: 36px;
  max-width: 80px;
  object-fit: contain;
  border-radius: 4px;
}


/* Focus */
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

/* Hidden utility */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Page backdrop glow */
.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: var(--gradient-hero);
  z-index: 0;
}
