:root {
    /* Fluent 2 Design Tokens + legacy aliases.
       Tokens se definen solo aqui (base.css). app.css no debe redefinir :root. */

    /* Typography */
    --fontFamilyBase: "Segoe UI", system-ui, sans-serif;
    --font-ui: var(--fontFamilyBase);

    /* Backgrounds */
    --colorNeutralBackground1: #ffffff;
    --bg-shell: var(--colorNeutralBackground1);

    --colorNeutralBackground2: #faf9f8;
    --bg-sidebar: var(--colorNeutralBackground2);

    --colorNeutralBackground3: #f5f5f5;
    --bg-app: var(--colorNeutralBackground3);

    --colorSubtleBackground: #f8f8f8;
    --bg-subtle: var(--colorSubtleBackground);

    --colorNeutralBackground1Hover: #f3f6fa;
    --bg-hover: var(--colorNeutralBackground1Hover);

    --colorNeutralBackground1Selected: #eaf3ff;
    --bg-selected: var(--colorNeutralBackground1Selected);

    --colorNeutralBackgroundOverlay: rgba(0, 0, 0, 0.3);
    --colorNeutralBackgroundTooltip: rgba(32, 31, 30, 0.94);
    --colorNeutralForegroundInverted: #fff;

    /* Foregrounds / text */
    --colorNeutralForeground1: #242424;
    --text: var(--colorNeutralForeground1);

    --colorNeutralForeground2: #616161;
    --text-secondary: var(--colorNeutralForeground2);

    --colorNeutralForeground3: #605e5c;
    --muted: var(--colorNeutralForeground3);

    --colorNeutralForeground4: #8a8886;
    --muted-2: var(--colorNeutralForeground4);

    /* Strokes / borders */
    --colorNeutralStroke1: #e5e7eb;
    --line: var(--colorNeutralStroke1);

    --colorNeutralStroke1Active: #d2d0ce;
    --line-strong: var(--colorNeutralStroke1Active);

    /* Brand */
    --colorBrandBackground: #0078d4;
    --brand: var(--colorBrandBackground);

    --colorBrandBackgroundHover: #005fb8;
    --brand-strong: var(--colorBrandBackgroundHover);

    --colorBrandBackground2: #deecf9;
    --brand-soft: var(--colorBrandBackground2);

    /* Status */
    --colorStatusSuccessBackground1: #dff6dd;
    --success-bg: var(--colorStatusSuccessBackground1);

    --colorStatusSuccessForeground1: #0b6a0b;
    --success-text: var(--colorStatusSuccessForeground1);

    --colorStatusDangerBackground1: #fde7e9;
    --error-bg: var(--colorStatusDangerBackground1);

    --colorStatusDangerForeground1: #a80000;
    --error-text: var(--colorStatusDangerForeground1);

    --colorStatusWarningBackground1: #fff4ce;
    --warning-bg: var(--colorStatusWarningBackground1);

    --colorStatusWarningForeground1: #8a6d00;
    --warning-text: var(--colorStatusWarningForeground1);

    /* Shadows */
    --shadow4: 0 1.6px 3.6px rgba(0, 0, 0, 0.06), 0 0.3px 0.9px rgba(0, 0, 0, 0.04);
    --shadow-card: var(--shadow4);

    /* Radii */
    --borderRadiusSmall: 4px;
    --radius-sm: var(--borderRadiusSmall);

    --borderRadiusMedium: 8px;
    --radius-md: var(--borderRadiusMedium);

    --borderRadiusLarge: 12px;
    --radius-lg: var(--borderRadiusLarge);

    /* Metric charts */
    --metric-line-blue: #4ba1e8;
    --metric-line-green: #4caf50;
    --metric-line-red: #e57373;
    --metric-line-purple: #9575cd;
    --metric-line-cyan: #4dd0e1;

    /* z-index layers: base 0, scrim 100, drawer 1000, dialog 1100, toast 1200 */
    --z-scrim: 100;
    --z-drawer: 1000;
    --z-dialog: 1100;
    --z-toast: 1200;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-ui);
    background: var(--bg-app);
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}

body {
    min-height: 100vh;
}

#app,
#app > div {
    min-height: 100vh;
}

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

button,
input,
textarea,
select {
    font: inherit;
}

.app-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.app-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.app-icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.muted-text {
    color: var(--colorNeutralForeground3);
}

.outline-none {
    outline: none;
}

.ghost,
.solid,
.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 7px 12px;
    font-size: 0.8125rem;
    cursor: pointer;
}

.ghost {
    background: white;
    border-color: var(--line-strong);
    color: var(--text);
}

.ghost:hover {
    background: var(--bg-subtle);
}

.ghost.small {
    padding: 6px 10px;
}

.icon-button {
    gap: 8px;
}

.nav-icon {
    color: var(--muted);
}

.rail-link.active .nav-icon,
.rail-subtle-link:hover .nav-icon,
.rail-link:hover .nav-icon {
    color: currentColor;
}

.solid,
.auth-submit {
    background: var(--brand);
    color: white;
}

.solid:hover,
.auth-submit:hover {
    background: var(--brand-strong);
}

.page-loading,
.auth-guard {
    min-height: calc(100vh - 56px);
    display: grid;
    place-items: center;
    padding: 24px;
}

.boot-splash {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(18, 117, 188, 0.12), transparent 34%),
        radial-gradient(circle at top right, rgba(31, 176, 135, 0.1), transparent 26%),
        linear-gradient(180deg, #f7fbff 0%, #f3f5f8 58%, #eef2f6 100%);
}

.boot-splash-card,
.loader-card {
    width: min(100%, 470px);
    border-radius: 22px;
    padding: 28px 28px 24px;
    border: 1px solid var(--line);
    background: var(--bg-shell);
    box-shadow: var(--shadow-card);
    display: grid;
    gap: 16px;
}

.loader-card-head {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.loader-brand-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
    display: grid;
    place-items: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.loader-brand-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

.loader-copy {
    display: grid;
    gap: 2px;
}

.loader-copy strong {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
}

.loader-copy span {
    font-size: 0.8rem;
    color: var(--muted);
}

.loading-progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 999px;
    background: #e7edf5;
    overflow: hidden;
}

.loading-progress-bar-value {
    display: block;
    width: 54%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4aa0e6 0%, #0f6cbd 100%);
    animation: loading-progress-slide 1.6s ease-in-out infinite alternate;
}

.loader-status-copy {
    display: grid;
    gap: 6px;
}

.loader-status-copy strong {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1f2937;
}

.loader-status-copy span {
    font-size: 0.82rem;
    color: var(--muted);
}

.loading-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-card);
    color: var(--muted);
}

.skip-link {
    position: absolute;
    top: -100%;
    left: 0.5rem;
    z-index: 10000;
    padding: 0.5rem 1rem;
    background: var(--brand);
    color: #fff;
    border-radius: 0 0 4px 4px;
    font-weight: 600;
    text-decoration: none;
    outline: none;
}

.skip-link:focus {
    top: 0;
}
