/* =============================================================================
 * Fractur — BackOffice tenant theme
 *
 * Fonte da verdade: Fractur Brand Guidelines, Edition 01 (resumo em
 * Utils/docs/fractur/design-system.md). Mesmo desenho do Midas-Web
 * (Midas-Web/Frontend/Core/devops/fractur/theme.css), traduzido para os tokens
 * --bo-* do BackOffice (src/assets/style/theme-tokens.css).
 *
 * "Institutional Restraint": preto e branco, sem cor de acento. A primária é a
 * própria tinta — preta no claro, branca no escuro — por isso é redefinida por
 * tema (os tokens do BackOffice supõem uma primária única).
 *
 * ESPECIFICIDADE — assets/theme.css é carregado ANTES do bundle, e o bundle
 * declara os mesmos tokens em :root / :root[data-theme=...]. Empate perde por
 * ordem, então todo seletor aqui é um degrau mais específico:
 *   html:root                   (0,1,1) > :root                   (0,1,0)
 *   html:root[data-theme=light] (0,2,1) > :root[data-theme=light] (0,2,0)
 *   html:root[data-theme=dark]  (0,2,1) > :root[data-theme=dark]  (0,2,0)
 * Não "simplifique" para :root: o tema deixa de aplicar.
 * ============================================================================= */


/* -----------------------------------------------------------------------------
 * 1. TIPOGRAFIA — Aeonik (licenciada, binários pendentes) com Manrope como
 * substituta oficial. Face declarada só até 500: a marca não usa negrito, então
 * qualquer 600/700 dos componentes resolve para medium.
 * ----------------------------------------------------------------------------- */
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-display: swap;
    font-weight: 300 500;
    src: url('fonts/manrope-latin-ext.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-display: swap;
    font-weight: 300 500;
    src: url('fonts/manrope-latin.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html {
    font-synthesis: none;
}


/* -----------------------------------------------------------------------------
 * 2. TOKENS COMUNS + MODO CLARO (tom inverso da marca: preto sobre #FAF9F5)
 * O bundle declara o claro em ":root, :root[data-theme=light]" (0,2,0), por
 * isso o seletor [data-theme=light] também é necessário aqui.
 * ----------------------------------------------------------------------------- */
html:root,
html:root[data-theme="light"] {
    --bo-font-display: 'Aeonik', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bo-font-body:    'Aeonik', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* Tipografia do Angular Material (botões, campos, tabelas) — ver variables.scss */
    --bo-font-material: 'Aeonik', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Três pesos: Light 300 · Regular 400 · Medium 500. Sem negrito. */
    --bo-fw-light: 300;
    --bo-fw-regular: 400;
    --bo-fw-medium: 500;
    --bo-fw-semibold: 500;
    --bo-fw-bold: 500;

    /* Raios da marca: 5 botões/campos · 10 cards · pills em cápsula */
    --bo-radius-xs: 3px;
    --bo-radius-sm: 5px;
    --bo-radius-md: 5px;
    --bo-radius-lg: 10px;
    --bo-radius-xl: 10px;
    --bo-shell-sidebar-item-radius: 5px;

    /* Login (account-theme.scss): card 10, campos/botão 5, sem brilho radial */
    --bo-auth-radius: 10px;
    --bo-auth-input-radius: 5px;
    --bo-auth-glow-strong: 0;
    --bo-auth-glow-soft: 0;

    /* Marca — modo claro: tinta preta */
    --bo-primary: #000000;
    --bo-primary-focus: #373838;
    --bo-primary-on-dark: #FFFFFF;
    --bo-on-primary: #FFFFFF;
    --bo-primary-rgb: 0, 0, 0;
    --bo-secondary: #373838;
    --bo-secondary-focus: #000000;
    --bo-secondary-on-dark: #FAF9F5;
    --bo-on-secondary: #FFFFFF;
    --bo-secondary-rgb: 55, 56, 56;
    /* Sem gradiente: cabeçalho legado vira superfície chapada. */
    --bo-header-gradient-from: #000000;
    --bo-header-gradient-to: #000000;

    /* Legado --custom-color-* (o bundle os aponta para --bo-*, mas também são
     * lidos por telas antigas; declarados aqui para não depender da ordem). */
    --custom-color-primary: var(--bo-primary);
    --custom-color-secondary: var(--bo-secondary);
    --custom-color-primary-rgb: var(--bo-primary-rgb);
    --custom-color-secondary-rgb: var(--bo-secondary-rgb);
    --custom-color-gradient-left-header: #000000;
    --custom-color-gradient-right-header: #000000;
    --custom-color-gradient-left-header-rgb: 0, 0, 0;
    --custom-color-gradient-right-header-rgb: 0, 0, 0;

    /* Superfícies — claro */
    --bo-canvas: #FFFFFF;
    --bo-canvas-elevated: #FAF9F5;
    --bo-canvas-muted: #F2F1EC;
    --bo-surface: #FAF9F5;
    --bo-surface-tile-strong: #000000;

    /* Texto — hierarquia por opacidade (100 / 60 / 56 / 30 sobre branco).
       O degrau fraco é 56%, não 45%: 45% dava 3.36:1 no branco e reprovava AA. */
    --bo-text: #000000;
    --bo-text-muted: #666666;
    --bo-text-subtle: #707070;
    --bo-text-disabled: #B3B3B3;
    --bo-text-on-dark: #FFFFFF;
    --bo-text-rgb: 0, 0, 0;
    --bo-text-muted-rgb: 102, 102, 102;
    --bo-canvas-rgb: 255, 255, 255;
    --bo-canvas-elevated-rgb: 250, 249, 245;

    /* Hairlines, não caixas */
    --bo-hairline: rgba(0, 0, 0, 0.12);
    --bo-divider: rgba(0, 0, 0, 0.06);
    --bo-border-strong: rgba(0, 0, 0, 0.24);

    --bo-accent: #000000;
    --bo-accent-link: #000000;
    --bo-accent-secondary: #373838;
    --bo-on-accent: #FFFFFF;

    --bo-nav: #000000;
    --bo-nav-text: #FFFFFF;
    --bo-menu-bg: #FFFFFF;
    --bo-menu-text: #000000;
    --bo-menu-text-active: #000000;
    --bo-menu-hairline: rgba(0, 0, 0, 0.12);

    --bo-input-bg: #F2F1EC;
    --bo-input-bg-elevated: #FFFFFF;
    --bo-input-text: #000000;
    --bo-input-placeholder: #8C8C8C;
    --bo-input-border: rgba(0, 0, 0, 0.16);

    /* Estados operacionais — a excecao do console (o app do investidor fica nas
     * quatro tintas). Tintas de baixa croma encostadas nos neutros da marca:
     * musgo, argila, ocre fosco e a propria tinta. Chip = hairline + tint quase
     * transparente, nunca pilula chapada; a palavra sempre acompanha a cor. */
    --status-positive: #4A6B54;
    --status-positive-rgb: 74, 107, 84;
    --status-positive-surface: rgba(74, 107, 84, 0.07);
    --status-positive-border: rgba(74, 107, 84, 0.32);
    --status-negative: #7D4E48;
    --status-negative-rgb: 125, 78, 72;
    --status-negative-surface: rgba(125, 78, 72, 0.07);
    --status-negative-border: rgba(125, 78, 72, 0.32);
    --status-attention: #6B5A3C;
    --status-attention-rgb: 107, 90, 60;
    --status-attention-surface: rgba(107, 90, 60, 0.07);
    --status-attention-border: rgba(107, 90, 60, 0.32);
    --status-neutral: #373838;
    --status-neutral-rgb: 55, 56, 56;
    --status-neutral-surface: rgba(55, 56, 56, 0.05);
    --status-neutral-border: rgba(55, 56, 56, 0.20);

    --bo-status-success: var(--status-positive);
    --bo-status-success-soft: var(--status-positive-surface);
    --bo-status-success-rgb: var(--status-positive-rgb);
    --bo-status-warning: var(--status-attention);
    --bo-status-warning-soft: var(--status-attention-surface);
    --bo-status-warning-rgb: var(--status-attention-rgb);
    --bo-status-error: var(--status-negative);
    --bo-status-error-soft: var(--status-negative-surface);
    --bo-status-error-rgb: var(--status-negative-rgb);
    --bo-status-info: var(--status-neutral);
    --bo-status-info-soft: var(--status-neutral-surface);
    --bo-tx-credit: var(--status-positive);
    --bo-tx-debit: var(--status-negative);
    --bo-tx-income: var(--status-attention);

    --bo-tooltip-bg: #000000;
    --bo-tooltip-text: #FFFFFF;
    --bo-snackbar-bg: #000000;
    --bo-snackbar-text: #FFFFFF;

    /* Sem sombra: profundidade por hairline */
    --bo-shadow-soft: 0 0 0 1px rgba(0, 0, 0, 0.06);
    --bo-shadow-softer: 0 0 0 1px rgba(0, 0, 0, 0.04);
    --bo-shadow-card: 0 0 0 1px rgba(0, 0, 0, 0.08);
    --bo-shadow-modal: 0 0 0 1px rgba(0, 0, 0, 0.12);

    --bo-overlay-scrim: rgba(0, 0, 0, 0.6);
    --bo-overlay-frosted: rgba(250, 249, 245, 0.9);

    /* Shell — claro */
    --bo-shell-sidebar-bg: #FAF9F5;
    --bo-shell-sidebar-text: rgba(0, 0, 0, 0.68);
    --bo-shell-sidebar-text-muted: rgba(0, 0, 0, 0.56);
    --bo-shell-sidebar-section-label: rgba(0, 0, 0, 0.56);
    --bo-shell-sidebar-divider: rgba(0, 0, 0, 0.08);
    --bo-shell-sidebar-hover-bg: rgba(0, 0, 0, 0.04);
    --bo-shell-sidebar-active-bg: rgba(0, 0, 0, 0.06);
    --bo-shell-sidebar-active-text: #000000;
    --bo-shell-sidebar-active-indicator: #000000;
    --bo-shell-topbar-bg: #FAF9F5;
    --bo-shell-topbar-border: rgba(0, 0, 0, 0.08);
    --bo-shell-topbar-text: #000000;
    --bo-shell-topbar-text-muted: rgba(0, 0, 0, 0.56);
    --bo-shell-topbar-icon: #000000;
    --bo-shell-topbar-hover-bg: rgba(0, 0, 0, 0.04);
    --bo-shell-content-bg: #FAF9F5;
}


/* -----------------------------------------------------------------------------
 * 3. MODO ESCURO (padrão da Fractur — tenant.js: defaultTheme 'dark')
 * "Four Near-Blacks and a Wash": página #000 · seção #050505 · card #0a0a0a ·
 * card hover #141414; lavagens brancas de 2–8%.
 * ----------------------------------------------------------------------------- */
html:root[data-theme="dark"] {
    --bo-primary: #FFFFFF;
    --bo-primary-focus: #FAF9F5;
    --bo-primary-on-dark: #FFFFFF;
    --bo-on-primary: #000000;
    --bo-primary-rgb: 255, 255, 255;
    --bo-secondary: #FAF9F5;
    --bo-secondary-focus: #FFFFFF;
    --bo-secondary-on-dark: #FAF9F5;
    --bo-on-secondary: #000000;
    --bo-secondary-rgb: 250, 249, 245;

    --custom-color-primary: var(--bo-primary);
    --custom-color-secondary: var(--bo-secondary);
    --custom-color-primary-rgb: var(--bo-primary-rgb);
    --custom-color-secondary-rgb: var(--bo-secondary-rgb);

    --bo-canvas: #0A0A0A;
    --bo-canvas-elevated: #000000;
    --bo-canvas-muted: #141414;
    --bo-surface: #050505;
    --bo-surface-tile-strong: #000000;

    /* Texto: 100 / 68 / 48 / 30 (o degrau fraco subiu de 45% para 48%: 45%
       sobre o chão de card #0A0A0A dava 4.48:1 e reprovava AA por um fio). */
    --bo-text: #FFFFFF;
    --bo-text-muted: #ADADAD;
    --bo-text-subtle: #808080;
    --bo-text-disabled: #4D4D4D;
    --bo-text-on-dark: #FFFFFF;
    --bo-text-rgb: 255, 255, 255;
    --bo-text-muted-rgb: 173, 173, 173;
    --bo-canvas-rgb: 10, 10, 10;
    --bo-canvas-elevated-rgb: 0, 0, 0;

    --bo-hairline: rgba(255, 255, 255, 0.12);
    --bo-divider: rgba(255, 255, 255, 0.06);
    --bo-border-strong: rgba(255, 255, 255, 0.24);

    --bo-accent: #FFFFFF;
    --bo-accent-link: #FFFFFF;
    --bo-accent-secondary: #FAF9F5;
    --bo-on-accent: #000000;

    --bo-nav: #000000;
    --bo-nav-text: #FFFFFF;
    --bo-menu-bg: #0A0A0A;
    --bo-menu-text: #FFFFFF;
    --bo-menu-text-active: #FFFFFF;
    --bo-menu-hairline: rgba(255, 255, 255, 0.12);

    --bo-input-bg: #141414;
    --bo-input-bg-elevated: #0A0A0A;
    --bo-input-text: #FFFFFF;
    --bo-input-placeholder: #737373;
    --bo-input-border: rgba(255, 255, 255, 0.16);

    /* Estados operacionais — mesmas familias, subidas na escada para o chao preto. */
    --status-positive: #A9BFB0;
    --status-positive-rgb: 169, 191, 176;
    --status-positive-surface: rgba(169, 191, 176, 0.08);
    --status-positive-border: rgba(169, 191, 176, 0.30);
    --status-negative: #C7A49E;
    --status-negative-rgb: 199, 164, 158;
    --status-negative-surface: rgba(199, 164, 158, 0.08);
    --status-negative-border: rgba(199, 164, 158, 0.30);
    --status-attention: #C2B392;
    --status-attention-rgb: 194, 179, 146;
    --status-attention-surface: rgba(194, 179, 146, 0.08);
    --status-attention-border: rgba(194, 179, 146, 0.30);
    --status-neutral: #FFFFFF;
    --status-neutral-rgb: 255, 255, 255;
    --status-neutral-surface: rgba(255, 255, 255, 0.06);
    --status-neutral-border: rgba(255, 255, 255, 0.22);

    --bo-status-success: var(--status-positive);
    --bo-status-success-soft: var(--status-positive-surface);
    --bo-status-success-rgb: var(--status-positive-rgb);
    --bo-status-warning: var(--status-attention);
    --bo-status-warning-soft: var(--status-attention-surface);
    --bo-status-warning-rgb: var(--status-attention-rgb);
    --bo-status-error: var(--status-negative);
    --bo-status-error-soft: var(--status-negative-surface);
    --bo-status-error-rgb: var(--status-negative-rgb);
    --bo-status-info: var(--status-neutral);
    --bo-status-info-soft: var(--status-neutral-surface);
    --bo-tx-credit: var(--status-positive);
    --bo-tx-debit: var(--status-negative);
    --bo-tx-income: var(--status-attention);

    --bo-tooltip-bg: #FAF9F5;
    --bo-tooltip-text: #000000;
    --bo-snackbar-bg: #FFFFFF;
    --bo-snackbar-text: #000000;

    --bo-shadow-soft: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --bo-shadow-softer: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --bo-shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.08);
    --bo-shadow-modal: 0 0 0 1px rgba(255, 255, 255, 0.12);

    --bo-overlay-scrim: rgba(0, 0, 0, 0.75);
    --bo-overlay-frosted: rgba(0, 0, 0, 0.85);

    --bo-shell-sidebar-bg: #000000;
    --bo-shell-sidebar-text: rgba(255, 255, 255, 0.68);
    --bo-shell-sidebar-text-muted: rgba(255, 255, 255, 0.48);
    --bo-shell-sidebar-section-label: rgba(255, 255, 255, 0.48);
    --bo-shell-sidebar-divider: rgba(255, 255, 255, 0.06);
    --bo-shell-sidebar-hover-bg: rgba(255, 255, 255, 0.04);
    --bo-shell-sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --bo-shell-sidebar-active-text: #FFFFFF;
    --bo-shell-sidebar-active-indicator: #FFFFFF;
    --bo-shell-topbar-bg: #000000;
    --bo-shell-topbar-border: rgba(255, 255, 255, 0.08);
    --bo-shell-topbar-text: #FFFFFF;
    --bo-shell-topbar-text-muted: rgba(255, 255, 255, 0.48);
    --bo-shell-topbar-icon: #FFFFFF;
    --bo-shell-topbar-hover-bg: rgba(255, 255, 255, 0.06);
    --bo-shell-content-bg: #000000;
}
