/* ==========================================================================
   Boomi Insights — Base / Reset / App Shell
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--fg);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); letter-spacing: -0.015em; line-height: var(--lh-tight); }
h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); letter-spacing: -0.008em; line-height: var(--lh-snug); }
h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-base); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }

/* Numeric alignment for every metric-bearing surface. */
.num, .mono-num, td.num, .kpi__value, .metric-value, .log-time, .table td.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.mono { font-family: var(--font-mono); font-size: 0.94em; letter-spacing: -0.01em; }

/* ---------- Focus ------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.on-dark :focus-visible { outline-color: var(--brand-300); }

/* ---------- Scrollbars -------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--n-300);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app {
  display: flex;
  min-height: 100vh;
}

.app__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: var(--sb-w);
  transition: margin-left var(--dur-3) var(--ease);
}

.app[data-sidebar="collapsed"] .app__main { margin-left: var(--sb-w-collapsed); }

.app__content {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--content-pad) var(--content-pad) var(--s-12);
  max-width: var(--content-max);
  width: 100%;
}

/* Skip link for a11y */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-toast);
  background: var(--brand-600);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--r-md) 0;
  font-weight: var(--fw-semibold);
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   Utility layer (subset — enough to avoid bespoke CSS for one-off cases)
   ========================================================================== */
.u-row { display: flex; align-items: center; }
.u-row-top { display: flex; align-items: flex-start; }
.u-between { display: flex; align-items: center; justify-content: space-between; }
.u-wrap { flex-wrap: wrap; }
.u-col { display: flex; flex-direction: column; }
.u-grow { flex: 1 1 auto; min-width: 0; }
.u-shrink0 { flex: 0 0 auto; }
.u-gap-1 { gap: var(--s-1); } .u-gap-2 { gap: var(--s-2); }
.u-gap-3 { gap: var(--s-3); } .u-gap-4 { gap: var(--s-4); }
.u-gap-5 { gap: var(--s-5); } .u-gap-6 { gap: var(--s-6); }
.u-gap-7 { gap: var(--s-7); } .u-gap-8 { gap: var(--s-8); }
.u-mt-2 { margin-top: var(--s-2); } .u-mt-3 { margin-top: var(--s-3); }
.u-mt-5 { margin-top: var(--s-5); } .u-mt-7 { margin-top: var(--s-7); }
.u-mt-8 { margin-top: var(--s-8); } .u-mb-5 { margin-bottom: var(--s-5); }
.u-right { text-align: right; }
.u-center { text-align: center; }
.u-hidden { display: none !important; }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.u-clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.u-text-muted { color: var(--fg-muted); }
.u-text-secondary { color: var(--fg-secondary); }
.u-text-secondary-strong { color: var(--fg-secondary); font-weight: var(--fw-medium); }
.u-text-xs { font-size: var(--fs-xs); }
.u-text-sm { font-size: var(--fs-sm); }
.u-text-2xs { font-size: var(--fs-2xs); }
.u-upper { text-transform: uppercase; letter-spacing: var(--ls-wide); font-weight: var(--fw-semibold); }
.u-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  :root { --content-pad: 18px; }
}

@media (max-width: 1024px) {
  .app__main { margin-left: 0; }
  .app[data-sidebar="collapsed"] .app__main { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
