/* ==========================================================================
   base.css — reset, typography, native element defaults, focus, utilities
   ========================================================================== */

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

/* The UA's [hidden] rule loses to any author rule that sets display, so a
   class like .notif-panel { display: flex } keeps painting while hidden.
   This restores the attribute's meaning across the whole app. */
[hidden] { display: none !important; }

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

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

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;           /* the app scrolls its panes, never the page */
}

/* The sign-in screen is the exception: it has no panes of its own, so on a
   short viewport the page itself must be able to scroll rather than clip. */
body[data-view="auth"] { overflow-y: auto; overflow-x: hidden; }

/* Optical letterspacing: the larger the type, the tighter it wants to be. */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.018em; }
h1 { font-size: var(--text-2xl); letter-spacing: -0.028em; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }

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

ul, ol { margin: 0; padding: 0; list-style: none; }

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

/* An <svg> with no width/height falls back to 300x150, which silently wrecks
   any layout that inlines an icon without sizing it. This is the floor;
   every component rule below overrides it. */
svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* For an icon sitting inside a run of text rather than in a sized box. */
.icon-inline { display: inline-block; vertical-align: -3px; }

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

/* --- Native controls, normalised ---------------------------------------- */

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

button:disabled { cursor: not-allowed; opacity: 0.5; }

textarea { resize: vertical; }

/* --- Focus. Always visible for keyboard users, never for mouse clicks. --- */

:focus { outline: none; }

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

.on-dark :focus-visible { outline-color: #F0894A; }

/* --- Numbers. Tabular everywhere so columns line up. -------------------- */

.num,
td.num,
th.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* --- Scrollbars --------------------------------------------------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-faint); background-clip: content-box; }

/* --- Selection ---------------------------------------------------------- */

::selection { background: var(--color-primary-wash); color: var(--color-text); }

/* --- Screen-reader-only ------------------------------------------------- */

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

/* Skip link — first tab stop on the page. */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.skip-link:focus { top: var(--space-3); text-decoration: none; }

/* --- Small shared text roles -------------------------------------------- */

.eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.muted  { color: var(--color-text-muted); }
.faint  { color: var(--color-text-faint); }
.strong { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-center { text-align: center; }

/* --- Layout helpers used across pages ----------------------------------- */

.row { display: flex; align-items: center; gap: var(--space-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.hidden { display: none !important; }
