/* Produzido integralmente pelo Professor Thiago Szozda! */

@layer tokens, reset, base, layout, components, utilities;

@layer tokens {
  :root {
    color-scheme: light;

    /* Paleta semantica Aura OS. */
    --aura-color-01: #f8faff;
    --aura-color-02: #ffffff;
    --aura-color-03: #eef2ff;
    --aura-color-04: #8795a5;
    --aura-color-05: #667085;
    --aura-color-06: #1f2430;
    --aura-color-07: #1f3fbe;
    --aura-color-08: #2f4fd7;
    --aura-color-09: #1f6fb2;
    --aura-color-10: #187f51;
    --aura-color-11: #9a5b00;
    --aura-color-12: #c83c3c;
    --aura-color-13: #c94735;

    --color-bg: var(--aura-color-01);
    --color-surface: var(--aura-color-02);
    --color-surface-muted: var(--aura-color-03);
    --color-border: var(--aura-color-04);
    --color-muted: var(--aura-color-05);
    --color-text: var(--aura-color-06);
    --color-primary-strong: var(--aura-color-07);
    --color-primary: var(--aura-color-08);
    --color-info: var(--aura-color-09);
    --color-success: var(--aura-color-10);
    --color-warning: var(--aura-color-11);
    --color-danger: var(--aura-color-12);
    --color-accent: var(--aura-color-13);
    --color-on-primary: var(--color-surface);
    --color-on-status: var(--color-surface);
    --color-hover: var(--color-surface-muted);
    --color-active: var(--color-surface-muted);
    --color-disabled: var(--color-surface-muted);
    --color-overlay: rgb(0 0 0 / 55%);
    --color-barra-superior: var(--color-surface);
    --color-barra-lateral: var(--color-surface-muted);
    --color-selection: var(--color-primary);
    --color-selection-text: var(--color-on-primary);

    /* Papeis tipograficos; projetos escolhem pilhas, nao downloads obrigatorios. */
    --fonte-interface: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --fonte-texto: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --fonte-titulo: Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --fonte-destaque: Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --fonte-dados: Inter, "Segoe UI", Arial, sans-serif;
    --fonte-codigo: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --fonte-marca: Manrope, Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 22px;
    --font-size-3xl: 28px;
    --font-weight-regular: 400;
    --font-weight-medium: 600;
    --font-weight-bold: 700;
    --line-tight: 1.2;
    --line-normal: 1.5;
    --line-relaxed: 1.7;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 32px;
    --space-8: 40px;

    --radius-1: 4px;
    --radius-2: 6px;
    --radius-3: 8px;
    --radius-4: 12px;
    --radius-pill: 999px;

    --border-width: 1px;
    --focus-width: 2px;
    --shadow-1: 0 1px 2px color-mix(in srgb, var(--color-text) 12%, transparent);
    --shadow-2: 0 8px 24px color-mix(in srgb, var(--color-text) 12%, transparent);
    --shadow-3: 0 18px 48px color-mix(in srgb, var(--color-text) 16%, transparent);

    --duration-fast: 120ms;
    --duration-normal: 180ms;
    --ease-standard: cubic-bezier(.2, 0, .2, 1);

    --z-sticky: 10;
    --z-modal: 50;
    --z-toast: 70;

    --largura-barra-lateral: 280px;
    --largura-barra-lateral-recolhida: 68px;
    --altura-barra-superior: 56px;
    --tap-target: 44px;
    --content-narrow: 640px;
    --content-max: 960px;
    --content-wide: 1200px;
    --card-min: 240px;
    --largura-assinatura-rodape: 520px;
    --altura-assinatura-rodape: 48px;
  }
}

@supports (color: color-mix(in srgb, red, blue)) {
  @layer tokens {
    :root {
      --color-hover: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
      --color-active: color-mix(in srgb, var(--color-primary) 14%, var(--color-surface));
      --color-disabled: color-mix(in srgb, var(--color-muted) 22%, var(--color-surface));
      --color-overlay: color-mix(in srgb, var(--color-text) 55%, transparent);
      --color-barra-superior: color-mix(in srgb, var(--color-surface) 92%, transparent);
      --color-barra-lateral: color-mix(in srgb, var(--color-surface) 88%, var(--color-surface-muted));
    }
  }
}

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

  html {
    min-height: 100%;
    scrollbar-gutter: stable;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    min-height: 100%;
    margin: 0;
  }

  :where(h1, h2, h3, h4, p, figure, blockquote, dl, dd) {
    margin: 0;
  }

  :where(ul, ol) {
    margin: 0;
    padding: 0;
  }

  :where(img, video, canvas, svg) {
    display: block;
    max-width: 100%;
    height: auto;
  }

  :where(iframe) {
    max-width: 100%;
  }

  :where(button, input, select, textarea) {
    font: inherit;
  }

  :where(fieldset) {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
  }

  :where(dialog) {
    padding: 0;
    border: 0;
  }

  :where(button) {
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }

  :where(button:disabled, input:disabled, select:disabled, textarea:disabled) {
    cursor: not-allowed;
  }

  :where(table) {
    border-collapse: collapse;
    width: 100%;
  }

  :where([hidden]) {
    display: none !important;
  }
}

@layer base {
  body {
    min-width: 240px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--fonte-texto);
    font-size: var(--font-size-lg);
    line-height: var(--line-normal);
  }

  :where(button, input, select, textarea, option) {
    font-family: var(--fonte-interface);
  }

  ::selection {
    background: var(--color-selection);
    color: var(--color-selection-text);
  }

  :where(a) {
    color: var(--color-primary-strong);
    text-underline-offset: 3px;
  }

  :where(a:hover) {
    color: var(--color-primary);
  }

  :where(:focus-visible) {
    outline: var(--focus-width) solid var(--color-info);
    outline-offset: 2px;
  }

  :where(h1, h2, h3, h4) {
    font-family: var(--fonte-titulo);
    font-weight: var(--font-weight-bold);
    scroll-margin-block-start: calc(var(--altura-barra-superior) + var(--space-4));
  }

  :where(h1) {
    color: var(--color-primary-strong);
    font-size: var(--font-size-2xl);
    line-height: var(--line-tight);
  }

  :where(h2) {
    font-size: var(--font-size-xl);
    line-height: var(--line-tight);
  }

  :where(h3) {
    font-size: var(--font-size-lg);
    line-height: var(--line-tight);
  }

  :where(h4) {
    font-size: var(--font-size-md);
    line-height: var(--line-tight);
  }

  :where(p) {
    color: var(--color-muted);
  }

  :where(code, kbd, samp, pre) {
    font-family: var(--fonte-codigo);
  }

  :where(code, kbd) {
    border-radius: var(--radius-1);
    background: var(--color-surface-muted);
    padding: 0.1em 0.35em;
    font-size: 0.9em;
  }

  :where(mark) {
    background: var(--color-accent);
    color: var(--color-on-status);
    padding-inline: 0.2em;
  }

  :where(hr) {
    width: 100%;
    margin: var(--space-5) 0;
    border: 0;
    border-top: var(--border-width) solid var(--color-border);
  }

  :where(input[type="checkbox"], input[type="radio"], progress) {
    accent-color: var(--color-primary);
  }

  :where(input, select, textarea)::placeholder {
    color: var(--color-muted);
    opacity: 1;
  }

  :where(h1, h2, h3, p, li, dt, dd, a, button, label) {
    overflow-wrap: anywhere;
  }

  :where(h4, legend) {
    overflow-wrap: anywhere;
  }

  :where(pre) {
    max-width: 100%;
    min-width: 0;
    overflow: auto;
  }
}

@layer layout {
  .aura-app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .app-loading {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    background: var(--color-surface);
  }

  .app-loading img {
    max-width: min(40vw, 160px);
    max-height: min(40vw, 160px);
  }

  .app-loading-visual {
    display: grid;
    place-items: center;
  }

  .app-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .app-barra-superior {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    max-width: 100%;
    min-width: 0;
    min-height: var(--altura-barra-superior);
    padding: var(--space-2) var(--space-3);
    border-bottom: var(--border-width) solid var(--color-border);
    background: var(--color-barra-superior);
    backdrop-filter: blur(12px);
  }

  .app-barra-superior-espaco {
    flex: 1;
    min-width: 0;
  }

  .app-barra-superior-acoes {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
  }

  .app-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
  }

  .app-brand-logo {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    object-fit: contain;
  }

  .app-brand-title {
    overflow: hidden;
    color: var(--color-text);
    font-family: var(--fonte-marca);
    font-size: var(--font-size-lg);
    font-weight: 700;
    line-height: var(--line-tight);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-body {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 100%;
    min-width: 0;
    min-height: calc(100vh - var(--altura-barra-superior));
    min-height: calc(100dvh - var(--altura-barra-superior));
    transition: grid-template-columns var(--duration-normal) var(--ease-standard);
  }

  .app-barra-lateral {
    position: fixed;
    inset: var(--altura-barra-superior) auto 0 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: min(86vw, var(--largura-barra-lateral));
    min-width: 0;
    min-height: auto;
    padding: var(--space-3);
    border-right: var(--border-width) solid var(--color-border);
    background: var(--color-barra-lateral);
    overflow: hidden auto;
    box-shadow: var(--shadow-3);
    pointer-events: none;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--duration-normal) var(--ease-standard);
  }

  .app-shell.barra-lateral-aberta .app-barra-lateral {
    pointer-events: auto;
    transform: translateX(0);
    visibility: visible;
  }

  .app-barra-lateral-cabecalho {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: var(--tap-target);
  }

  .app-main {
    position: relative;
    max-width: 100%;
    min-width: 0;
    padding: var(--space-4);
  }

  .app-shell-loading {
    position: absolute;
    z-index: var(--z-sticky);
    inset: 0;
    min-height: 240px;
  }

  .app-stage {
    max-width: 100%;
    min-width: 0;
    min-height: 240px;
    container: palco / inline-size;
  }

  .app-rodape {
    position: static;
    z-index: var(--z-sticky);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    max-width: 100%;
    min-height: 28px;
    padding: var(--space-2) var(--space-4) var(--space-3);
    color: var(--color-muted);
    font-size: 11px;
    line-height: var(--line-tight);
    pointer-events: none;
    text-align: center;
  }

  .app-rodape-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }

  .app-rodape.tem-assinatura-rodape {
    min-height: calc(var(--altura-assinatura-rodape) + var(--space-3));
    padding: var(--space-2) var(--space-4) var(--space-2);
  }

  .app-rodape-assinatura {
    width: min(100%, var(--largura-assinatura-rodape));
    max-width: calc(100vw - (var(--space-4) * 2));
    height: min(var(--altura-assinatura-rodape), 12vw);
    min-height: 28px;
    object-fit: contain;
  }

  .container {
    width: min(100%, var(--content-max));
    margin-inline: auto;
  }

  .container-narrow {
    width: min(100%, var(--content-narrow));
    margin-inline: auto;
  }

  .container-wide {
    width: min(100%, var(--content-wide));
    margin-inline: auto;
  }

  .stack {
    display: grid;
    gap: var(--stack-gap, var(--space-4));
  }

  .stack > *,
  .cluster > *,
  .split > *,
  .form-grid > *,
  .metric-grid > *,
  .grid-auto > * {
    min-width: 0;
  }

  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cluster-gap, var(--space-3));
  }

  .split {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--card-min)), 1fr));
    gap: var(--space-4);
  }

  .form-grid,
  .metric-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .flow > * + * {
    margin-block-start: var(--flow-space, var(--space-4));
  }
}

@layer components {
  .app-icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: var(--tap-target);
    height: var(--tap-target);
    flex: 0 0 auto;
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-2);
    color: var(--color-muted);
    transition:
      background var(--duration-fast) var(--ease-standard),
      color var(--duration-fast) var(--ease-standard),
      border-color var(--duration-fast) var(--ease-standard);
  }

  .app-icon-button:hover,
  .app-icon-button:focus-visible {
    border-color: var(--color-border);
    background: var(--color-hover);
    color: var(--color-primary-strong);
  }

  .app-icon-button:disabled {
    background: transparent;
    color: var(--color-disabled);
  }

  .app-icon {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
  }

  .app-icon-menu,
  .app-icon-menu::before,
  .app-icon-menu::after {
    height: 2px;
    border-radius: var(--radius-pill);
    background: currentColor;
  }

  .app-icon-menu {
    top: 9px;
  }

  .app-icon-menu::before,
  .app-icon-menu::after {
    position: absolute;
    left: 0;
    width: 20px;
    content: "";
  }

  .app-icon-menu::before {
    top: -6px;
  }

  .app-icon-menu::after {
    top: 6px;
  }

  .app-icon-close::before,
  .app-icon-close::after {
    position: absolute;
    top: 9px;
    left: 2px;
    width: 16px;
    height: 2px;
    border-radius: var(--radius-pill);
    background: currentColor;
    content: "";
  }

  .app-icon-close::before {
    transform: rotate(45deg);
  }

  .app-icon-close::after {
    transform: rotate(-45deg);
  }

  .pwa-install-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-target);
    padding: 0 var(--space-3);
    border: var(--border-width) solid var(--color-primary);
    border-radius: var(--radius-2);
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    white-space: nowrap;
  }

  .pwa-install-trigger:hover,
  .pwa-install-trigger:focus-visible {
    background: var(--color-primary-strong);
  }

  .app-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    min-height: 32px;
    overflow: hidden;
    padding: 0 var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-2);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-status::before {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 3px var(--color-primary-strong);
    content: "";
  }

  .section-title {
    margin-bottom: var(--space-3);
    font-size: var(--font-size-md);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    text-transform: uppercase;
  }

  .app-barra-lateral-cabecalho .section-title {
    min-width: 0;
    overflow: hidden;
    margin-bottom: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-nav {
    display: grid;
    gap: var(--space-4);
    min-width: 0;
  }

  .module-nav-group {
    display: grid;
    gap: var(--space-2);
  }

  .module-group-title {
    color: var(--color-muted);
    font-size: var(--font-size-xs);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    overflow-wrap: anywhere;
    text-transform: uppercase;
  }

  .module-nav-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: var(--tap-target);
    padding: var(--space-1);
    border: var(--border-width) solid transparent;
    border-radius: var(--radius-2);
    color: var(--color-muted);
    text-align: left;
    transition:
      background var(--duration-fast) var(--ease-standard),
      color var(--duration-fast) var(--ease-standard),
      border-color var(--duration-fast) var(--ease-standard);
  }

  .module-nav-item:hover,
  .module-nav-item:focus-visible,
  .module-nav-item.is-active {
    border-color: var(--color-border);
    background: var(--color-active);
    color: var(--color-primary-strong);
  }

  .module-nav-icon {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-2);
    background: color-mix(in srgb, currentColor 10%, var(--color-surface));
    color: currentColor;
    font-size: var(--font-size-xs);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
    line-height: 1;
  }

  .module-nav-icon::before {
    display: block;
    width: 20px;
    height: 20px;
    background: currentColor;
    content: "";
    -webkit-mask: var(--module-icon-url) center / contain no-repeat;
    mask: var(--module-icon-url) center / contain no-repeat;
  }

  .module-nav-icon-iniciais::before {
    display: none;
  }

  .module-nav-label {
    min-width: 0;
  }

  .module-nav-name {
    display: block;
    overflow: hidden;
    font-size: var(--font-size-md);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-nav-item.is-unavailable {
    border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
    background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface));
    color: var(--color-danger);
    cursor: not-allowed;
  }

  .module-nav-status {
    display: block;
    margin-top: var(--space-1);
    color: var(--color-danger);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .module-nav-empty {
    padding: var(--space-3);
    border: var(--border-width) dashed var(--color-border);
    border-radius: var(--radius-2);
    font-size: var(--font-size-sm);
  }

  .app-barra-lateral-usuario {
    display: grid;
    gap: var(--space-1);
    margin-top: auto;
    padding: var(--space-3);
    border-top: var(--border-width) solid var(--color-border);
    color: var(--color-muted);
    font-size: var(--font-size-sm);
  }

  .app-barra-lateral-usuario-nome {
    overflow: hidden;
    color: var(--color-text);
    font-weight: var(--font-weight-bold);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-barra-lateral-usuario-papel {
    text-transform: uppercase;
  }

  .list {
    display: grid;
    gap: var(--list-gap, var(--space-2));
    list-style: none;
  }

  .list-item {
    min-height: var(--tap-target);
    padding: var(--space-2) var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-2);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: var(--font-size-md);
    overflow-wrap: anywhere;
  }

  .panel,
  .card {
    width: min(100%, var(--content-max));
    max-width: 100%;
    min-width: 0;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
    padding: var(--space-4);
    overflow-wrap: anywhere;
    box-shadow: var(--shadow-1);
  }

  .card {
    width: 100%;
  }

  .card-header,
  .card-body,
  .card-footer {
    min-width: 0;
  }

  .card-header,
  .card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .card-footer {
    padding-top: var(--space-3);
    border-top: var(--border-width) solid var(--color-border);
  }

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    max-width: 100%;
    width: 100%;
    min-height: var(--tap-target);
    padding: 0 var(--space-4);
    border: var(--border-width) solid var(--color-primary);
    border-radius: var(--radius-2);
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    overflow-wrap: anywhere;
    text-align: center;
    text-decoration: none;
    transition:
      background var(--duration-fast) var(--ease-standard),
      border-color var(--duration-fast) var(--ease-standard),
      color var(--duration-fast) var(--ease-standard),
      transform var(--duration-fast) var(--ease-standard);
  }

  .button:hover {
    background: var(--color-primary-strong);
  }

  .button-secondary {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
  }

  .button-secondary:hover {
    background: var(--color-hover);
    color: var(--color-primary-strong);
  }

  .button-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--color-primary-strong);
  }

  .button-ghost:hover {
    background: var(--color-hover);
  }

  .button-danger {
    border-color: var(--color-danger);
    background: var(--color-danger);
    color: var(--color-on-status);
  }

  .button-danger:hover {
    border-color: var(--color-danger);
    background: var(--color-danger);
    filter: brightness(0.9);
  }

  .button:active:not(:disabled) {
    transform: translateY(1px);
  }

  .button:disabled,
  .button[aria-disabled="true"] {
    border-color: var(--color-border);
    background: var(--color-disabled);
    color: var(--color-muted);
    cursor: not-allowed;
    transform: none;
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    min-height: var(--tap-target);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-2);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 0 var(--space-3);
    transition:
      border-color var(--duration-fast) var(--ease-standard),
      box-shadow var(--duration-fast) var(--ease-standard);
  }

  .input:hover,
  .select:hover,
  .textarea:hover {
    border-color: var(--color-muted);
  }

  .input:focus,
  .select:focus,
  .textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 var(--focus-width) var(--color-info);
    outline: 0;
  }

  .input[aria-invalid="true"],
  .select[aria-invalid="true"],
  .textarea[aria-invalid="true"] {
    border-color: var(--color-danger);
  }

  .input:disabled,
  .select:disabled,
  .textarea:disabled {
    background: var(--color-disabled);
    color: var(--color-muted);
  }

  .textarea {
    min-height: 112px;
    padding-block: var(--space-3);
    resize: vertical;
  }

  .field {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
  }

  .field-label,
  .fieldset-legend {
    color: var(--color-text);
    font-family: var(--fonte-interface);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
  }

  .field-help,
  .field-error {
    font-size: var(--font-size-sm);
    line-height: var(--line-normal);
  }

  .field-help {
    color: var(--color-muted);
  }

  .field-error {
    color: var(--color-danger);
    font-weight: var(--font-weight-medium);
  }

  .choice {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--space-2);
    min-height: var(--tap-target);
    padding-block: var(--space-2);
    color: var(--color-text);
    font-family: var(--fonte-interface);
  }

  .choice :where(input[type="checkbox"], input[type="radio"]) {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin: 1px 0 0;
  }

  .form-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .table-wrap {
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
  }

  .table {
    min-width: 640px;
    font-family: var(--fonte-dados);
    font-size: var(--font-size-md);
    font-variant-numeric: tabular-nums;
  }

  .table th,
  .table td {
    padding: var(--space-3);
    border-bottom: var(--border-width) solid var(--color-border);
    text-align: left;
    vertical-align: top;
  }

  .table th {
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
  }

  .table tbody tr:hover {
    background: var(--color-hover);
  }

  .alert {
    border-left: 3px solid var(--alert-color, var(--color-warning));
    background: var(--color-surface-muted);
    background: color-mix(in srgb, var(--alert-color, var(--color-warning)) 8%, var(--color-surface));
    color: var(--alert-color, var(--color-warning));
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-md);
    overflow-wrap: anywhere;
  }

  .alert-info {
    --alert-color: var(--color-info);
  }

  .alert-success {
    --alert-color: var(--color-success);
  }

  .alert-danger {
    --alert-color: var(--color-danger);
  }

  .badge {
    --badge-color: var(--color-muted);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    max-width: 100%;
    min-height: 24px;
    padding: 2px var(--space-2);
    border: var(--border-width) solid var(--badge-color);
    border-radius: var(--radius-pill);
    background: var(--color-surface-muted);
    background: color-mix(in srgb, var(--badge-color) 9%, var(--color-surface));
    color: var(--badge-color);
    font-family: var(--fonte-interface);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
    overflow-wrap: anywhere;
  }

  .badge-info {
    --badge-color: var(--color-info);
  }

  .badge-success {
    --badge-color: var(--color-success);
  }

  .badge-warning {
    --badge-color: var(--color-warning);
  }

  .badge-danger {
    --badge-color: var(--color-danger);
  }

  .badge-accent {
    --badge-color: var(--color-accent);
  }

  .metric-card {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
    padding: var(--space-4);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
    box-shadow: var(--shadow-1);
  }

  .metric-label {
    color: var(--color-muted);
    font-family: var(--fonte-interface);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
  }

  .metric-value {
    color: var(--color-text);
    font-family: var(--fonte-dados);
    font-size: var(--font-size-3xl);
    font-variant-numeric: tabular-nums;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-tight);
  }

  .metric-detail {
    color: var(--color-muted);
    font-size: var(--font-size-sm);
  }

  .empty-state {
    display: grid;
    justify-items: center;
    gap: var(--space-3);
    width: min(100%, var(--content-narrow));
    margin-inline: auto;
    padding: var(--space-7) var(--space-4);
    border: var(--border-width) dashed var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
    text-align: center;
  }

  .empty-state > :where(p) {
    max-width: 60ch;
  }

  .stepper {
    display: grid;
    gap: var(--space-3);
    padding: 0;
    list-style: none;
    counter-reset: etapa;
  }

  .step {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    gap: var(--space-3);
    color: var(--color-muted);
    counter-increment: etapa;
  }

  .step::before {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-muted);
    content: counter(etapa);
    font-family: var(--fonte-dados);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
  }

  .step.is-active,
  .step[aria-current="step"] {
    color: var(--color-text);
  }

  .step.is-active::before,
  .step[aria-current="step"]::before {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-on-primary);
  }

  .step.is-complete::before {
    border-color: var(--color-success);
    background: var(--color-success);
    color: var(--color-on-status);
    content: "✓";
  }

  .pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
  }

  .pagination-item {
    display: inline-grid;
    place-items: center;
    min-width: var(--tap-target);
    min-height: var(--tap-target);
    padding-inline: var(--space-2);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-2);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--fonte-dados);
    text-decoration: none;
  }

  .pagination-item:hover,
  .pagination-item[aria-current="page"] {
    border-color: var(--color-primary);
    background: var(--color-active);
    color: var(--color-primary-strong);
  }

  .accordion {
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
  }

  .accordion + .accordion {
    margin-top: var(--space-2);
  }

  .accordion > summary {
    min-height: var(--tap-target);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text);
    cursor: pointer;
    font-family: var(--fonte-interface);
    font-weight: var(--font-weight-bold);
  }

  .accordion[open] > summary {
    border-bottom: var(--border-width) solid var(--color-border);
  }

  .accordion-body {
    padding: var(--space-4);
  }

  .progress {
    width: 100%;
    height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--color-surface-muted);
  }

  .progress::-webkit-progress-bar {
    background: var(--color-surface-muted);
  }

  .progress::-webkit-progress-value {
    border-radius: var(--radius-pill);
    background: var(--color-primary);
  }

  .progress::-moz-progress-bar {
    border-radius: var(--radius-pill);
    background: var(--color-primary);
  }

  .skeleton {
    position: relative;
    min-height: 1em;
    overflow: hidden;
    border-radius: var(--radius-1);
    background: var(--color-disabled);
    color: transparent;
  }

  .skeleton::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--color-hover), transparent);
    content: "";
    transform: translateX(-100%);
    animation: aura-skeleton 1.4s infinite;
  }

  .tabs {
    display: flex;
    gap: var(--space-1);
    min-width: 0;
    overflow-x: auto;
    border-bottom: var(--border-width) solid var(--color-border);
  }

  .tab {
    min-height: var(--tap-target);
    padding: 0 var(--space-4);
    border-bottom: 2px solid transparent;
    color: var(--color-muted);
    font-family: var(--fonte-interface);
    white-space: nowrap;
  }

  .tab[aria-selected="true"] {
    border-color: var(--color-primary);
    color: var(--color-primary-strong);
    font-weight: var(--font-weight-bold);
  }

  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    overflow: auto;
    background: var(--color-overlay);
    padding: var(--space-4);
  }

  .modal {
    width: min(100%, 640px);
    max-height: min(720px, 100%);
    overflow: auto;
    border-radius: var(--radius-4);
    background: var(--color-surface);
    box-shadow: var(--shadow-3);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--space-4);
  }

  .modal-header,
  .modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .modal-header {
    border-bottom: var(--border-width) solid var(--color-border);
  }

  .modal-footer {
    border-top: var(--border-width) solid var(--color-border);
  }

  .pwa-install-screen {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: end center;
    overflow: auto;
    background: rgb(0 0 0 / 32%);
    background: color-mix(in srgb, var(--color-text) 32%, transparent);
    padding: var(--space-4);
  }

  .pwa-install-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: var(--space-4);
    width: min(100%, 560px);
    max-height: 100%;
    overflow: auto;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
    padding: var(--space-4);
    box-shadow: var(--shadow-3);
  }

  .pwa-install-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
  }

  .pwa-install-content {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .pwa-install-hint {
    font-size: var(--font-size-sm);
  }

  .toast {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: var(--z-toast);
    width: min(100% - 32px, 420px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    overflow-wrap: anywhere;
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-3);
    background: var(--color-surface);
    padding: var(--space-4);
    box-shadow: var(--shadow-2);
  }

  @keyframes aura-skeleton {
    to {
      transform: translateX(100%);
    }
  }
}

@layer utilities {
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    border: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .hidden {
    display: none !important;
  }

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

  .text-danger {
    color: var(--color-danger);
  }

  .text-success {
    color: var(--color-success);
  }

  .text-info {
    color: var(--color-info);
  }

  .text-warning {
    color: var(--color-warning);
  }

  .text-accent {
    color: var(--color-accent);
  }

  .fonte-interface {
    font-family: var(--fonte-interface);
  }

  .fonte-texto {
    font-family: var(--fonte-texto);
  }

  .fonte-titulo {
    font-family: var(--fonte-titulo);
  }

  .fonte-destaque {
    font-family: var(--fonte-destaque);
  }

  .fonte-dados {
    font-family: var(--fonte-dados);
    font-variant-numeric: tabular-nums;
  }

  .fonte-codigo {
    font-family: var(--fonte-codigo);
  }

  .fonte-marca {
    font-family: var(--fonte-marca);
  }

  .numeric {
    font-family: var(--fonte-dados);
    font-variant-numeric: tabular-nums;
  }

  .text-center {
    text-align: center;
  }
}

@media (min-width: 481px) {
  .panel,
  .card {
    padding: var(--space-5);
  }

  .button,
  .button-secondary {
    width: auto;
  }

  .form-actions {
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
  }
}

@media (min-width: 721px) {
  .app-shell {
    --largura-barra-lateral-atual: var(--largura-barra-lateral-recolhida);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .app-shell.barra-lateral-aberta {
    --largura-barra-lateral-atual: var(--largura-barra-lateral);
  }

  .app-barra-superior {
    padding-inline: var(--space-5);
  }

  .app-body {
    grid-template-columns: var(--largura-barra-lateral-atual) minmax(0, 1fr);
    min-height: 0;
  }

  .app-barra-lateral {
    position: static;
    z-index: auto;
    width: auto;
    min-height: calc(100vh - var(--altura-barra-superior));
    min-height: calc(100dvh - var(--altura-barra-superior));
    box-shadow: none;
    pointer-events: auto;
    transform: none;
    visibility: visible;
    transition:
      padding var(--duration-normal) var(--ease-standard),
      width var(--duration-normal) var(--ease-standard);
  }

  .app-shell.barra-lateral-recolhida .app-barra-lateral-cabecalho {
    justify-content: center;
  }

  .app-shell.barra-lateral-recolhida .app-barra-lateral-cabecalho .section-title,
  .app-shell.barra-lateral-recolhida .fechar-barra-lateral,
  .app-shell.barra-lateral-recolhida .module-group-title,
  .app-shell.barra-lateral-recolhida .module-nav-label,
  .app-shell.barra-lateral-recolhida .module-nav-empty,
  .app-shell.barra-lateral-recolhida .app-barra-lateral-usuario {
    display: none;
  }

  .app-main {
    padding: var(--space-5);
  }

  .app-rodape {
    position: fixed;
    inset: auto 0 0;
  }

  .pwa-install-card {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: var(--space-5);
  }

  .pwa-install-icon {
    width: 64px;
    height: 64px;
  }

  .split {
    align-items: center;
    flex-direction: row;
  }
}

@container palco (min-width: 42rem) {
  .form-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-full,
  .grid-full {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-normal: 0ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border-width: 2px;
    --focus-width: 3px;
  }

  .text-muted,
  :where(p) {
    color: var(--color-text);
  }
}

@media (forced-colors: active) {
  :root {
    --border-width: 1px;
    --focus-width: 3px;
  }

  .app-barra-superior,
  .app-barra-lateral,
  .panel,
  .card,
  .metric-card,
  .table-wrap,
  .modal,
  .toast,
  .accordion {
    border: var(--border-width) solid CanvasText;
  }

  .module-nav-icon::before {
    background: CanvasText;
  }

  .skeleton::after {
    display: none;
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  :root {
    color-scheme: light;
  }

  body {
    min-width: 0;
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .app-shell,
  .app-body {
    display: block;
    min-height: 0;
  }

  .app-barra-superior,
  .app-barra-lateral,
  .app-rodape,
  .pwa-install-screen,
  .toast,
  .tabs,
  .pagination,
  .form-actions,
  .no-print {
    display: none !important;
  }

  .app-main,
  .panel,
  .card,
  .metric-card {
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .app-stage,
  .table-wrap,
  :where(pre) {
    overflow: visible;
  }

  .table {
    min-width: 0;
  }

  :where(a[href])::after {
    content: " (" attr(href) ")";
    font-family: var(--fonte-codigo);
    font-size: 0.85em;
  }

  :where(a[href^="#"], a[href^="javascript:"])::after {
    content: "";
  }

  :where(h1, h2, h3, h4, .panel, .card, .metric-card, table, figure) {
    break-inside: avoid;
  }
}
