/* Final fit-and-finish layer. Loaded last. Purely additive: it refines focus,
 * scrolling, selection, motion and print behaviour without altering layout or
 * the semantics of any component defined in the earlier stylesheets. */

/* ---- Focus: visible for keyboard, quiet for pointer -------------------- */

:where(button, a, input, select, textarea, [tabindex]):focus {
  outline: none;
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

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

/* ---- Scrollbars: thin, recessive, macOS-like ---------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--stroke-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
  background-clip: content-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* ---- Numerals: tabular everywhere a figure is compared ------------------ */

table,
.metric-value,
.stat-value,
.kpi-value,
.money,
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---- Text rendering ----------------------------------------------------- */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Interaction feel: settled, not bouncy ------------------------------ */

button,
.nav-item,
.chip,
.tab {
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    opacity 140ms var(--ease-out);
}

button:active:not(:disabled) {
  transform: translateY(0.5px);
}

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

/* ---- Respect the OS motion preference ----------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Print: board memo and partner brief should print cleanly ----------- */

@media print {
  :root {
    --bg-canvas: #ffffff;
    --bg-elevated: #ffffff;
    --bg-panel: #ffffff;
    --bg-panel-alt: #ffffff;
    --text-primary: #101215;
    --text-secondary: #3d434b;
    --text-tertiary: #6b7280;
    --stroke-hairline: rgba(0, 0, 0, 0.14);
    --stroke-strong: rgba(0, 0, 0, 0.26);
  }

  .app-sidebar,
  .app-topbar,
  .view-actions,
  .filter-bar,
  button {
    display: none !important;
  }

  .app-shell,
  .app-main,
  .view-host {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    padding: 0 !important;
  }

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

  .card,
  .panel {
    box-shadow: none !important;
    border: 1px solid rgba(0, 0, 0, 0.16) !important;
    break-inside: avoid;
  }

  h1, h2, h3 {
    break-after: avoid;
  }
}
