/* ============================================================
   CSS Reset — Hosting CRM Theme
   ============================================================
   Modern reset that normalizes browser defaults and applies
   consistent base styles. Import AFTER tokens.css.
   ============================================================ */

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

/* ── Document ─────────────────────────────────────────────── */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    tab-size: 4;
}

/* ── Body ─────────────────────────────────────────────────── */
body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background-color: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

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

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

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

small {
    font-size: var(--text-sm);
}

strong, b {
    font-weight: var(--font-semibold);
}

/* ── Lists ────────────────────────────────────────────────── */
ul, ol {
    list-style: none;
}

/* ── Links ────────────────────────────────────────────────── */
a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

a:hover {
    color: var(--text-link-hover);
}

/* ── Media ────────────────────────────────────────────────── */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

/* ── Forms ────────────────────────────────────────────────── */
input, button, textarea, select {
    font: inherit;
    color: inherit;
}

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

textarea {
    resize: vertical;
}

fieldset {
    border: none;
}

legend {
    padding: 0;
}

/* ── Tables ───────────────────────────────────────────────── */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* ── Misc ─────────────────────────────────────────────────── */
hr {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: var(--space-6) 0;
}

pre, code, kbd, samp {
    font-family: var(--font-mono);
}

code {
    font-size: 0.9em;
    padding: 0.15em 0.4em;
    background: var(--bg-subtle);
    border-radius: var(--radius-xs);
}

pre {
    overflow-x: auto;
    padding: var(--space-4);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
}

pre code {
    padding: 0;
    background: none;
}

/* ── Focus ────────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
    background-color: var(--color-primary-light);
    color: var(--text-primary);
}

/* ── Scrollbar (Webkit) ───────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

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

/* ── Print ────────────────────────────────────────────────── */
@media print {
    body {
        background: white;
        color: black;
    }

    a, a:visited {
        text-decoration: underline;
    }

    img {
        page-break-inside: avoid;
    }

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