* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

a {
  text-decoration: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

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

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* Selection */
::selection {
  background-color: var(--accent-solid, var(--accent-primary));
  color: var(--accent-contrast);
}

/* ============================================
 * Standardized Icon & Badge Utility System
 * ============================================ */
svg.lucide, i[data-lucide] {
  stroke-width: 1.75;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  color: var(--accent-primary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.icon-badge-sm { width: 28px; height: 28px; border-radius: 6px; }
.icon-badge-md { width: 34px; height: 34px; border-radius: 8px; }
.icon-badge-lg { width: 44px; height: 44px; border-radius: var(--radius-md); }
.icon-badge-xl { width: 56px; height: 56px; border-radius: var(--radius-md); }


/* ============================================
 * Accessibility System (WCAG 2.1 AA)
 * ============================================ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  inset-inline-start: 16px;
  background: var(--accent-solid, var(--accent-primary));
  color: var(--accent-contrast) !important;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 100000;
  box-shadow: var(--shadow-md);
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
}

[dir="rtl"] .skip-link {
  left: auto;
  right: auto;
  inset-inline-start: 16px;
}

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

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Exclude rich text contenteditable editors from jarring bounding-box focus outlines */
.ql-editor:focus-visible,
.ql-editor:focus,
[contenteditable="true"]:focus-visible,
[contenteditable="true"]:focus {
  outline: none !important;
  box-shadow: none !important;
}


/* ============================================
 * Direction & RTL Base System
 * ============================================ */
html[dir="rtl"], body[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

html[dir="ltr"], body[dir="ltr"] {
  direction: ltr;
  text-align: left;
}
