/* =====================================================================
   finaxis-base.css · v3.0
   ---------------------------------------------------------------------
   Reset, root typography, layout primitives, scrollbar, focus rings,
   global animations, and print rules. Loaded once on every page after
   finaxis-tokens.css and before finaxis-components.css.
   ===================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fnx-font-sans);
  font-size: var(--fnx-fs-base);
  line-height: var(--fnx-lh-base);
  color: var(--fnx-text-h);
  background: var(--fnx-bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: transparent; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { display: inline-block; vertical-align: middle; }
img { max-width: 100%; display: block; }

/* ---- App-shell layout helpers (sidebar + main) ----
   Use these to build the chrome shared by every screen. Pages compose
   .fnx-app > .fnx-app__sidebar + .fnx-app__main > .fnx-app__header + body.

   .fnx-app           — flex h-screen overflow-hidden
   .fnx-app__sidebar  — 248px white column, vertical flex
   .fnx-app__main     — flex column, fills remaining space
   .fnx-app__header   — 64px sticky topbar (white, border-b)
   .fnx-app__body     — 1fr scroll region (use .fnx-scroll-y if needed)
*/
.fnx-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
.fnx-app__sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--fnx-bg-card);
  border-right: 1px solid var(--fnx-border);
  display: flex;
  flex-direction: column;
}
.fnx-app__sidebar-brand {
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--fnx-border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.fnx-app__sidebar-brand-mark {
  width: 36px; height: 36px;
  border-radius: var(--fnx-radius-xl);
  background: linear-gradient(135deg, var(--fnx-brand-600), var(--fnx-brand-800));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--fnx-shadow-2);
}
.fnx-app__sidebar-brand-name {
  font-weight: 700;
  color: var(--fnx-text-h);
  line-height: 1.2;
}
.fnx-app__sidebar-brand-name .dot { color: var(--fnx-brand-600); }
.fnx-app__sidebar-brand-tag {
  font-size: var(--fnx-fs-sm);
  color: var(--fnx-text-d);
  line-height: 1.2;
}
.fnx-app__sidebar-nav {
  flex: 1;
  padding: 8px 12px 0;
  overflow-y: auto;
}
.fnx-app__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.fnx-app__header {
  height: 64px;
  background: var(--fnx-bg-card);
  border-bottom: 1px solid var(--fnx-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  flex-shrink: 0;
}
.fnx-app__body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.fnx-app__crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fnx-fs-base);
}
.fnx-app__crumbs-sep { color: var(--fnx-ink-200); }
.fnx-app__crumbs-leaf { font-weight: 600; color: var(--fnx-text-h); }
.fnx-app__crumbs-trunk { color: var(--fnx-text-faint); }

/* ---- Page-grid backdrop (subtle dot grid behind workspace) ---- */
.fnx-bg-grid {
  background-image: radial-gradient(rgba(15,23,42,0.04) 1px, transparent 1px);
  background-size: 22px 22px;
}

/* ---- Containers ---- */
.fnx-container { max-width: 1400px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.fnx-container--narrow { max-width: 960px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* ---- Scrollbars (custom, opt-in via .fnx-scroll-y/.fnx-scroll-x) ---- */
.fnx-scroll-y { overflow-y: auto; }
.fnx-scroll-x { overflow-x: auto; }
.fnx-scroll-y::-webkit-scrollbar,
.fnx-scroll-x::-webkit-scrollbar { width: 10px; height: 10px; }
.fnx-scroll-y::-webkit-scrollbar-track,
.fnx-scroll-x::-webkit-scrollbar-track { background: transparent; }
.fnx-scroll-y::-webkit-scrollbar-thumb,
.fnx-scroll-x::-webkit-scrollbar-thumb {
  background: var(--fnx-border-2);
  border-radius: var(--fnx-radius-sm);
  background-clip: padding-box;
  border: 2px solid transparent;
}
.fnx-scroll-y::-webkit-scrollbar-thumb:hover,
.fnx-scroll-x::-webkit-scrollbar-thumb:hover { background: var(--fnx-text-d); background-clip: padding-box; border: 2px solid transparent; }

/* ---- Focus visibility (global) ---- */
:focus-visible { outline: 2px solid transparent; box-shadow: var(--fnx-focus-ring); border-radius: var(--fnx-radius-md); }

/* ---- Global animations (used by toasts, modals, palette, balance badge) ---- */
@keyframes fnx-toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes fnx-modal-in {
  from { transform: translateY(8px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes fnx-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}
@keyframes fnx-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
@keyframes fnx-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}
@keyframes fnx-spin {
  to { transform: rotate(360deg); }
}
@keyframes fnx-flash-row {
  0%   { background: var(--fnx-brand-50); }
  100% { background: transparent; }
}
@keyframes fnx-added-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.96); background: var(--fnx-brand-50); }
  100% { transform: scale(1); }
}
@keyframes fnx-march-ants {
  0%, 100% { border-color: var(--fnx-brand-400); }
  50%      { border-color: var(--fnx-brand-300); }
}
@keyframes fnx-autopulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ---- Print ---- */
@media print {
  body { background: #fff; }
  .fnx-no-print { display: none !important; }
}
