/* ==========================================================================
   Kloser CRM — Reset & base typography
   ========================================================================== */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  letter-spacing: var(--tr-body);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--wash);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex: none; }

button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: none;
}
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

ul, ol { list-style: none; }

table { border-collapse: separate; border-spacing: 0; width: 100%; }

/* ---- Headings: Apple-style optical tightening ---- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-strong);
  font-weight: 640;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-title);
}
h1 { font-size: var(--fs-30); letter-spacing: var(--tr-display); }
h2 { font-size: var(--fs-20); }
h3 { font-size: var(--fs-16); }
h4 { font-size: var(--fs-14); }

.display {
  font-size: clamp(2rem, 1.2rem + 2.6vw, var(--fs-48));
  font-weight: 680;
  letter-spacing: var(--tr-display);
  line-height: 1.06;
}

/* ---- Numerals ---- */
.tnum, table, .metric, .stat-value { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.94em; letter-spacing: 0; }

/* ---- Utility text ---- */
.eyebrow {
  font-size: var(--fs-11);
  font-weight: 620;
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.strong  { color: var(--text-strong); font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Focus: a single, consistent brand ring ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: var(--s-4); z-index: 999;
  padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-lg);
  font-weight: 600; transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: var(--s-4); text-decoration: none; }

/* ---- Scrollbars: thin, brand-tinted ---- */
* { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
:root[data-theme="dark"] * { scrollbar-color: rgba(150,175,220,.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--wp-navy) 16%, transparent);
  border: 3px solid transparent; background-clip: content-box;
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--wp-navy) 28%, transparent); background-clip: content-box; }

::selection { background: color-mix(in srgb, var(--wp-blue) 22%, transparent); color: var(--text-strong); }

/* ---- Layout helpers ---- */
.row   { display: flex; align-items: center; gap: var(--s-2); }
.row-b { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.col   { display: flex; flex-direction: column; gap: var(--s-2); }
.wrap  { flex-wrap: wrap; }
.grow  { flex: 1 1 auto; min-width: 0; }
.spacer{ flex: 1 1 auto; }
.hide  { display: none !important; }
[hidden] { display: none !important; }

.grid { display: grid; gap: var(--s-4); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }

@media (max-width: 1240px) { .g-6 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1080px) { .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 860px)  {
  .g-3, .g-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* Phones keep stat rows two-up — a single tall column buries the numbers. */
@media (max-width: 560px)  {
  .g-2, .g-3, .g-4, .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-auto { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: var(--s-3); }
}
@media (max-width: 380px)  {
  .g-2, .g-3, .g-4, .g-6 { grid-template-columns: minmax(0, 1fr); }
}
