/* ============================================================
   base.css — Reset, body, typography, layout primitives
   Import order: design-tokens.css → base.css → components.css
   ============================================================ */

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-base);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--font-size-3xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent-hover); }

ul, ol { list-style: none; }

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

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

button { cursor: pointer; border: none; background: none; }

/* ── Monospace (amounts) ──────────────────────────────────────── */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ── Focus Visible ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg-surface); }
::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

/* ── App Shell Layouts ───────────────────────────────────────── */

/* Login page: centered card */
.layout-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: radial-gradient(ellipse at 30% 20%, rgba(246, 36, 64, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(217, 119, 6, 0.04) 0%, transparent 60%),
              var(--color-bg-base);
}

/* Dashboard: sidebar + main area */
.layout-app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: auto;
  min-height: 100dvh;
}

.layout-app .sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  color: var(--sidebar-text);
}

.layout-app .main-content {
  min-height: 100dvh;
  overflow-y: auto;
  padding: var(--space-8);
  max-width: calc(var(--content-max-width) + var(--space-16));
}

/* Client layout: single-column centered */
.layout-client {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg-base);
}

.layout-client .client-topbar {
  height: var(--topbar-height);
  background: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.layout-client .client-body {
  flex: 1;
  padding: var(--space-6) var(--space-4);
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Utility Classes ─────────────────────────────────────────── */
.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;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-semibold { font-weight: var(--font-weight-semibold); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout-app {
    grid-template-columns: 1fr;
  }
  .layout-app .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 220px;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: var(--z-modal);
  }
  .layout-app .sidebar.open {
    transform: translateX(0);
  }
  .layout-app .main-content {
    padding: var(--space-4);
  }
  .sidebar-logo-sub{
    font-size: 1.5rem;
  }
}
