/* ==========================================================================
   mailkoo — Base Styles (authenticated pages)
   Resets, typography, utility classes.
   Loaded by layouts/app.blade.php
   ========================================================================== */

/* Bare URL, matching every other sheet's import. The hand-pinned `?v=` that used
   to live here was a second, separately-cached copy of variables.css frozen at
   whatever the string last said — it went stale the moment a token was added and
   nobody remembered to bump it. Freshness is now guaranteed by the versioned
   <link> the layouts emit after this sheet; see refactor/layouts/app.blade.php. */
@import url('variables.css');

/* Google Fonts.
   800 is required by --weight-black; without it Inter falls back to a
   synthesised faux-bold. 300 is unused by the token scale but kept so any
   legacy light-weight markup does not reflow. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    /* Was pinned to 14px, which silently overrode the reader's browser
       font-size preference and made every rem in the codebase resolve
       against a non-standard root. 100% restores that preference; the
       --text-* scale is expressed in rem so rendered sizes are unchanged. */
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    letter-spacing: var(--tracking-normal);
    color: var(--color-text);
    background-color: var(--color-page-bg);
    /* Proportional figures read better in prose; numeric surfaces opt into
       tabular alignment explicitly via .mc-tabular / the value classes. */
    font-variant-numeric: proportional-nums;
    font-optical-sizing: auto;
}

/* Keyboard focus fallback. Zero specificity (:where) on purpose: every
   component that draws its own ring (.mc-btn, .mc-form-input:focus, ...) still
   wins, while anything without one gets a brand-coloured outline instead of
   the UA default. Components that set `outline: none` in their base rule carry
   their own :focus-visible / :focus-within rule next to it. */
:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"]), [role="button"], [contenteditable="true"]):focus-visible {
    outline: var(--space-0-5) solid var(--color-border-focus);
    outline-offset: var(--space-0-5);
}

/* ==========================================================================
   Material Symbols Rounded — icon font overrides for refactored UI
   Thin weight (200), inherits font-size, no old transform hacks
   ========================================================================== */

.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    font-size: inherit;
    line-height: 1;
    vertical-align: middle;
    display: inline-block;
    transform: none;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/* Headings. Each step pairs a size with the line-height and tracking that
   suit it: as type grows, leading tightens and tracking goes negative.
   `text-wrap: balance` evens the ragged edge on multi-line headings and is
   ignored by engines that do not support it. */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: var(--space-2);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}

h1 { font-size: var(--text-2xl); line-height: var(--leading-display); }
h2 { font-size: var(--text-xl);  line-height: var(--leading-tight); }
h3 { font-size: var(--text-lg);  line-height: var(--leading-snug); letter-spacing: var(--tracking-snug); }
h4 { font-size: var(--text-md);  line-height: var(--leading-snug); letter-spacing: var(--tracking-snug); }
h5 { font-size: var(--text-base); line-height: var(--leading-snug); letter-spacing: var(--tracking-normal); }
h6 { font-size: var(--text-sm);  line-height: var(--leading-snug); letter-spacing: var(--tracking-normal); }

p {
    margin-top: 0;
    margin-bottom: var(--space-4);
    /* Avoids a single orphaned word on the last line. */
    text-wrap: pretty;
}

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

/* ==========================================================================
   Display type — for hero numbers, empty-state headlines, report figures.
   No display tier existed before, so oversized text was hardcoded ad hoc.
   ========================================================================== */

.mc-display-sm,
.mc-display,
.mc-display-lg {
    font-weight: var(--weight-bold);
    color: var(--color-text);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-tighter);
    text-wrap: balance;
    margin: 0;
}
.mc-display-sm { font-size: var(--text-3xl); }
.mc-display    { font-size: var(--text-4xl); }
.mc-display-lg { font-size: var(--text-5xl); }

/* ==========================================================================
   Numerals

   Dashboards are read in columns. With proportional figures a `1` is
   narrower than a `7`, so stacked numbers jitter left-to-right and the eye
   cannot scan the column. Tabular figures fix every digit to one advance
   width. Apply to any surface where numbers stack or update in place.
   ========================================================================== */

.mc-tabular,
.mc-stat-value,
.mc-ranked-stat-value,
.mc-info-grid-item-value,
.mc-table td.mc-num,
.mc-table th.mc-num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

.mc-table td.mc-num,
.mc-table th.mc-num { text-align: right; }

/* ==========================================================================
   Type utilities
   ========================================================================== */

small, .text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-muted { color: var(--color-text-muted) !important; }
.text-disabled { color: var(--color-text-disabled) !important; }
.font-normal { font-weight: var(--weight-normal); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

/* Eyebrow / overline — the small uppercase label used above section titles
   and on stat cards. Positive tracking is required at this size or the
   capitals crowd. */
.mc-eyebrow {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--color-text-muted);
    line-height: var(--leading-snug);
}

.tracking-tight  { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide   { letter-spacing: var(--tracking-wider); }

/* ==========================================================================
   Selection
   ========================================================================== */

::selection {
    background-color: var(--color-teal-light);
    color: var(--color-teal-active);
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar { width: var(--space-1-5); height: var(--space-1-5); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* ==========================================================================
   Focus
   ========================================================================== */

:focus-visible {
    outline: var(--space-0-5) solid var(--color-teal);
    outline-offset: var(--space-0-5);
}

/* ==========================================================================
   Utility classes
   ========================================================================== */

.mc-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.mc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
}

.mc-page-title {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    margin: 0;
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    text-wrap: balance;
}

.mc-page-subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: var(--space-0-5) 0 0 0;
    line-height: var(--leading-normal);
    text-wrap: pretty;
}

.mc-page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    margin-left: auto;
}

.mc-section {
    margin-bottom: var(--space-12);
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: var(--space-px);
    height: var(--space-px);
    padding: 0;
    margin: calc(var(--space-px) * -1);
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Mobile UX — Page header, content, layout (≤767px)
   ========================================================================== */

@media (max-width: 767px) {
    /* Page header: stack title + actions vertically */
    .mc-page-header {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .mc-page-title {
        font-size: var(--text-lg);
        width: 100%;
    }

    .mc-page-actions {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
    }

    /* Full-width buttons on mobile */
    .mc-page-actions .mc-btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    /* Section spacing reduced on mobile */
    .mc-section {
        margin-bottom: var(--space-6);
    }
}
