/* Base reset and typography. Native CSS nesting throughout - no preprocessor, no bundler. */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background-color: var(--color-canvas-default);
  color: var(--color-fg-default);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  /* Lining figures of equal width, so every number column in the app lines up without having to
     reach for the mono face on each individual cell. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 8px 0;
  font-weight: 600;
  color: var(--color-fg-default);
}

h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p {
  margin: 0 0 8px 0;
}

a {
  color: var(--color-accent-fg);
  text-decoration: none;

  &:hover {
    text-decoration: underline;
  }

  &:focus-visible {
    outline: 2px solid var(--color-accent-emphasis);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
  }
}

code, pre, .mono {
  font-family: var(--font-mono);
}

/* The recurring "field name above a value" micro-label, used by the filter bar, the context rail,
   detail panels and table headers. */
.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-fg-muted);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border-muted);
  margin: 16px 0;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

::selection {
  background-color: var(--color-accent-subtle);
}

/* ---- Figures ------------------------------------------------------------------------------- */
/* Money is mono and right-aligned wherever it appears - in a table cell, a KPI tile or a detail
   row - so magnitudes are comparable at a glance. Only negatives are coloured. */

.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money[data-sign="negative"] {
  color: var(--color-money-negative);
}

.money-currency {
  color: var(--color-fg-subtle);
  font-size: 0.85em;
  margin-right: 3px;
}

/* ---- Small utilities, kept deliberately minimal -------------------------------------------- */

.text-muted { color: var(--color-fg-muted); }
.text-subtle { color: var(--color-fg-subtle); }
.text-danger { color: var(--color-danger-fg); }
.text-success { color: var(--color-success-fg); }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.d-flex { display: flex; }
.d-block { display: block; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.w-100 { width: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Scrollbars, so they do not clash in dark mode. */
* {
  scrollbar-color: var(--color-border-strong) transparent;
}

/* Blazor's own circuit-error banner. The framework sets display:block on it when a circuit fails
   unrecoverably; without this rule the div has no styling at all and renders permanently visible,
   which looks exactly like a standing error. */
#blazor-error-ui {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 12px 20px;
  background-color: var(--color-attention-subtle);
  color: var(--color-attention-fg);
  border-top: 1px solid var(--color-attention-emphasis);
  box-shadow: var(--shadow-overlay);

  & .reload {
    color: var(--color-accent-fg);
    font-weight: 600;
    margin-left: 8px;
  }

  & .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 10px;
  }
}

@media print {
  /* Printing a screen prints the document on it, not the app around it. */
  .app-topbar,
  .app-sidebar,
  .app-context,
  .page-header-actions,
  .filter-panel,
  .pager {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .app-main {
    padding: 0;
    overflow: visible;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}
