/* A1 Product UI 2.1.0 · Obsidiana, fonte semântica: spec/tokens.json. */
@import './tokens.css';

:root {
  /* Aliases de compatibilidade da API 1.x; não constituem outra paleta. */
  --a1p-stone: var(--a1p-surface-soft);
  --a1p-sidebar-width: var(--a1p-context-width);
  --a1p-disabled-surface: var(--a1p-surface-soft);
  --a1p-disabled-text: var(--a1p-text-muted);
}

.a1p-system {
  color: var(--a1p-text);
  background: var(--a1p-canvas);
  font-family: var(--a1p-font-body);
  font-size: var(--a1p-font-size-body);
  line-height: var(--a1p-line-height-body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

.a1p-system *, .a1p-system *::before, .a1p-system *::after { box-sizing: border-box; }
.a1p-system [hidden] { display: none !important; }
.a1p-system :where(button, input, select, textarea) { font: inherit; }
.a1p-system :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
:where(.a1p-button, .a1p-input, .a1p-select, .a1p-textarea, .a1p-nav-item, .a1p-table-container):focus-visible {
  outline: var(--a1p-focus-width) solid var(--a1p-focus);
  outline-offset: var(--a1p-focus-offset);
}
.a1p-system ::selection { background: var(--a1p-accent-soft); color: var(--a1p-text); }

.a1p-app-frame {
  display: grid;
  grid-template-columns: var(--a1p-sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--a1p-canvas);
  isolation: isolate;
  transition: grid-template-columns var(--a1p-motion-transition) var(--a1p-motion-ease);
}
.a1p-app-frame[data-collapsed='true'] { grid-template-columns: var(--a1p-sidebar-rail) minmax(0, 1fr); }
.a1p-app-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  padding: var(--a1p-space-2);
  background: var(--a1p-canvas);
  z-index: var(--a1p-z-sticky);
}
.a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar { padding-inline: 0; }
.a1p-app-body { min-width: 0; display: flex; flex-direction: column; }
.a1p-app-topbar { position: sticky; top: 0; z-index: var(--a1p-z-sticky); }
.a1p-app-main {
  width: 100%;
  min-width: 0;
  margin-inline: auto;
  padding: var(--a1p-gutter) var(--a1p-gutter) var(--a1p-space-8);
  flex: 1;
  scroll-margin-top: calc(var(--a1p-topbar-height) + var(--a1p-space-4));
}
.a1p-app-main:focus:not(:focus-visible) { outline: none; }
.a1p-app-footer { padding: var(--a1p-space-4) var(--a1p-gutter); color: var(--a1p-text-muted); font-size: var(--a1p-font-size-meta); }

.a1p-sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  gap: var(--a1p-space-4);
  padding: var(--a1p-space-2) 0;
  border: 0;
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
}
.a1p-sidebar-brand { display: flex; align-items: center; min-width: 0; min-height: var(--a1p-nav-size); padding-inline: var(--a1p-space-2); flex-shrink: 0; }
.a1p-sidebar-brand > :first-child { min-width: 0; }
.a1p-sidebar-workspace { min-width: 0; padding-inline: var(--a1p-space-2); }
.a1p-sidebar-workspace > * { min-width: 0; max-width: 100%; }
.a1p-sidebar-workspace [data-a1p-expanded] { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.a1p-sidebar-nav { flex: 1; min-width: 0; }
.a1p-sidebar-nav :where(nav, ul) { display: grid; gap: var(--a1p-nav-gap); margin: 0; padding: 0; list-style: none; }
.a1p-sidebar-footer { display: grid; gap: var(--a1p-space-2); padding-top: var(--a1p-space-2); }
.a1p-sidebar-footer :where(nav, ul) { display: grid; gap: var(--a1p-nav-gap); margin: 0; padding: 0; list-style: none; }
.a1p-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--a1p-space-3);
  min-height: var(--a1p-nav-size);
  padding: var(--a1p-space-2) var(--a1p-space-3);
  border: 1px solid transparent;
  border-radius: var(--a1p-radius-control);
  color: var(--a1p-text-secondary);
  background: transparent;
  font-family: var(--a1p-font-body);
  font-size: var(--a1p-font-size-body);
  font-weight: var(--a1p-font-weight-regular);
  line-height: var(--a1p-line-height-body);
  text-decoration: none;
  transition: background-color var(--a1p-motion-fast) var(--a1p-motion-ease), color var(--a1p-motion-fast) var(--a1p-motion-ease), box-shadow var(--a1p-motion-fast) var(--a1p-motion-ease);
}
.a1p-nav-item:hover { background: var(--a1p-surface); color: var(--a1p-text); }
.a1p-nav-item[data-active='true'] { background: var(--a1p-accent-soft); color: var(--a1p-accent); font-weight: var(--a1p-font-weight-bold); }
.a1p-nav-icon { display: grid; place-items: center; width: var(--a1p-space-5); height: var(--a1p-space-5); flex: 0 0 var(--a1p-space-5); }
.a1p-nav-icon > :where(svg, img) { width: var(--a1p-space-5); height: var(--a1p-space-5); }
.a1p-nav-icon > svg { stroke-width: 1.5; }
.a1p-nav-label { min-width: 0; overflow-wrap: anywhere; }
.a1p-nav-count { margin-left: auto; min-width: var(--a1p-space-6); flex-shrink: 0; padding: 0 var(--a1p-space-1); border-radius: var(--a1p-radius-pill); background: var(--a1p-surface-soft); color: var(--a1p-text-muted); font-size: var(--a1p-font-size-meta); font-weight: var(--a1p-font-weight-regular); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.a1p-nav-item[data-compact='true'], .a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar .a1p-nav-item {
  justify-content: center;
  gap: 0;
  width: var(--a1p-nav-size);
  height: var(--a1p-nav-size);
  min-height: var(--a1p-nav-size);
  margin-inline: auto;
  padding: 0;
  border: 1px solid var(--a1p-glass-border);
  border-radius: var(--a1p-radius-pill);
  background: var(--a1p-glass);
  box-shadow: var(--a1p-glass-shadow);
  backdrop-filter: blur(var(--a1p-glass-blur));
}
.a1p-nav-item[data-compact='true']:hover, .a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar .a1p-nav-item:hover { background: var(--a1p-surface); color: var(--a1p-text); }
.a1p-nav-item[data-compact='true'][data-active='true'], .a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar .a1p-nav-item[data-active='true'] { background: var(--a1p-accent-soft); color: var(--a1p-accent); border-color: var(--a1p-accent); }
.a1p-nav-item[data-compact='true'] .a1p-nav-label,
.a1p-nav-item[data-compact='true'] .a1p-nav-count,
.a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar .a1p-nav-label,
.a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar .a1p-nav-count,
.a1p-app-frame[data-collapsed='true'] .a1p-app-sidebar [data-a1p-expanded] {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.a1p-app-frame[data-collapsed='true'] .a1p-sidebar-brand { padding-inline: 0; justify-content: center; }
.a1p-app-frame[data-collapsed='true'] .a1p-sidebar-workspace { padding-inline: 0; }

.a1p-topbar {
  display: flex;
  align-items: center;
  gap: var(--a1p-space-3);
  min-height: var(--a1p-topbar-height);
  padding: var(--a1p-space-1) var(--a1p-gutter);
  background: var(--a1p-canvas);
}
.a1p-topbar-start, .a1p-topbar-actions { display: flex; align-items: center; gap: var(--a1p-space-2); flex-shrink: 0; }
.a1p-topbar-content { min-width: 0; flex: 1; }
.a1p-page-header { display: grid; min-width: 0; gap: var(--a1p-space-4); margin-bottom: var(--a1p-space-6); }
.a1p-page-header > * { min-width: 0; }
.a1p-page-crumbs { font-size: var(--a1p-font-size-meta); line-height: var(--a1p-line-height-meta); color: var(--a1p-text-muted); }
.a1p-page-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--a1p-space-4); }
.a1p-page-title-group { min-width: 0; }
.a1p-page-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--a1p-space-2); }
.a1p-page-title {
  margin: 0;
  color: var(--a1p-text);
  font-family: var(--a1p-font-body);
  font-size: var(--a1p-font-size-title);
  font-weight: var(--a1p-font-weight-regular);
  line-height: var(--a1p-line-height-title);
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  scroll-margin-top: calc(var(--a1p-topbar-height) + var(--a1p-space-4));
}
.a1p-page-title[data-title-size='sm'] { font-size: var(--a1p-font-size-section); line-height: var(--a1p-line-height-section); }
/* lg mantém a escala operacional; a diferenciação editorial fica no site institucional. */
.a1p-page-title[data-title-size='lg'] { font-size: var(--a1p-font-size-title); }
.a1p-page-title:focus:not(:focus-visible) { outline: none; }
.a1p-page-meta { margin-top: var(--a1p-space-1); max-width: 65ch; color: var(--a1p-text-muted); font-size: var(--a1p-font-size-body); line-height: var(--a1p-line-height-body); }
.a1p-page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--a1p-space-2); flex-shrink: 0; }
.a1p-page-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--a1p-space-2); padding-block: var(--a1p-space-1); }

.a1p-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--a1p-space-2);
  min-height: var(--a1p-control-height);
  padding: var(--a1p-space-1) var(--a1p-space-3);
  border: 1px solid transparent;
  border-radius: var(--a1p-radius-control);
  background: var(--a1p-primary);
  color: var(--a1p-on-primary);
  font-family: var(--a1p-font-body);
  font-size: var(--a1p-font-size-body);
  font-weight: var(--a1p-font-weight-regular);
  line-height: var(--a1p-line-height-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--a1p-motion-fast) var(--a1p-motion-ease), color var(--a1p-motion-fast) var(--a1p-motion-ease), box-shadow var(--a1p-motion-fast) var(--a1p-motion-ease);
}
.a1p-button:hover { background: color-mix(in srgb, var(--a1p-primary) 88%, var(--a1p-surface)); }
.a1p-button:active { box-shadow: inset 0 0 0 2px color-mix(in srgb, currentColor 16%, transparent); }
.a1p-button[data-variant='secondary'] { border-color: var(--a1p-control-line); color: var(--a1p-text); background: var(--a1p-surface); }
.a1p-button[data-variant='ghost'], .a1p-button[data-variant='link'] { color: var(--a1p-text); background: transparent; }
.a1p-button[data-variant='secondary']:hover, .a1p-button[data-variant='ghost']:hover { background: var(--a1p-surface-soft); }
.a1p-button:is([data-variant='secondary'], [data-variant='ghost'])[aria-pressed='true'] { color: var(--a1p-accent); background: var(--a1p-accent-soft); border-color: var(--a1p-accent); }
.a1p-button[data-variant='link'] { padding-inline: 0; color: var(--a1p-accent); text-decoration: underline; text-underline-offset: var(--a1p-space-1); }
.a1p-button[data-variant='link']:hover { text-decoration-thickness: 2px; }
.a1p-button[data-variant='danger'] { background: var(--a1p-error); color: var(--a1p-error-soft); }
.a1p-button[data-variant='danger']:hover { background: var(--a1p-error); box-shadow: inset 0 0 0 2px currentColor; }
.a1p-button[data-size='sm'] { min-height: var(--a1p-space-8); padding-block: var(--a1p-space-1); padding-inline: var(--a1p-space-2); }
.a1p-button[data-size='lg'] { min-height: var(--a1p-nav-size); padding-inline: var(--a1p-space-4); }
.a1p-button[data-size='icon'], .a1p-button[data-size='icon-sm'] { width: var(--a1p-control-height); min-height: var(--a1p-control-height); padding: var(--a1p-space-1); flex: 0 0 auto; }
.a1p-button[data-size='icon'] { height: var(--a1p-control-height); }
.a1p-button[data-size='icon-sm'] { width: var(--a1p-space-8); height: var(--a1p-space-8); min-height: var(--a1p-space-8); }
.a1p-button > svg { width: var(--a1p-icon-size); height: var(--a1p-icon-size); flex-shrink: 0; stroke-width: 1.5; }
.a1p-button:is(:disabled, [aria-disabled='true']),
.a1p-button:is(:disabled, [aria-disabled='true']):hover,
.a1p-button:is(:disabled, [aria-disabled='true']):active { background: var(--a1p-disabled-surface); color: var(--a1p-disabled-text); border-color: var(--a1p-line); box-shadow: none; cursor: not-allowed; opacity: 1; }
.a1p-button[aria-busy='true'] { cursor: progress; }

.a1p-input, .a1p-select, .a1p-textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: var(--a1p-control-height);
  padding: var(--a1p-space-1) var(--a1p-space-3);
  border: 1px solid var(--a1p-control-line);
  border-radius: var(--a1p-radius-control);
  background: var(--a1p-surface);
  color: var(--a1p-text);
  font-family: var(--a1p-font-body);
  font-size: var(--a1p-font-size-body);
  line-height: var(--a1p-line-height-body);
  transition: border-color var(--a1p-motion-fast) var(--a1p-motion-ease), box-shadow var(--a1p-motion-fast) var(--a1p-motion-ease);
}
.a1p-textarea { resize: vertical; min-height: calc(var(--a1p-control-height) * 2); padding-block: var(--a1p-space-2); }
.a1p-select { padding-right: var(--a1p-space-6); }
:is(.a1p-input, .a1p-textarea)::placeholder { color: var(--a1p-text-muted); opacity: 1; }
:is(.a1p-input, .a1p-select, .a1p-textarea)[aria-invalid='true'] { border-color: var(--a1p-error); box-shadow: inset 0 0 0 1px var(--a1p-error); }
:is(.a1p-input, .a1p-select, .a1p-textarea):disabled { background: var(--a1p-disabled-surface); color: var(--a1p-disabled-text); cursor: not-allowed; opacity: 1; }
.a1p-input[type='file'] { padding: var(--a1p-space-1); }
.a1p-input::file-selector-button { margin-right: var(--a1p-space-2); padding: var(--a1p-space-1) var(--a1p-space-2); border: 0; border-radius: var(--a1p-radius-control); background: var(--a1p-surface-soft); color: var(--a1p-text); font: inherit; cursor: pointer; }

.a1p-surface { box-sizing: border-box; min-width: 0; border: 1px solid var(--a1p-line); border-radius: var(--a1p-radius-surface); background: var(--a1p-surface); color: var(--a1p-text); }
.a1p-surface[data-variant='soft'] { background: var(--a1p-surface-soft); }
.a1p-surface[data-variant='glass'] { background: var(--a1p-glass); border-color: var(--a1p-glass-border); box-shadow: var(--a1p-glass-shadow); backdrop-filter: blur(var(--a1p-glass-blur)); }
.a1p-surface[data-padding='none'] { padding: 0; }
.a1p-surface[data-padding='sm'] { padding: var(--a1p-space-3); }
.a1p-surface[data-padding='md'] { padding: var(--a1p-space-4); }
.a1p-surface[data-padding='lg'] { padding: var(--a1p-space-6); }
.a1p-badge { display: inline-flex; align-items: center; gap: var(--a1p-space-1); max-width: 100%; padding: 2px var(--a1p-space-2); border-radius: var(--a1p-radius-pill); background: var(--a1p-surface-soft); color: var(--a1p-text-secondary); font-family: var(--a1p-font-body); font-size: var(--a1p-font-size-meta); font-weight: var(--a1p-font-weight-regular); line-height: var(--a1p-line-height-meta); }
.a1p-badge[data-tone='success'] { color: var(--a1p-success); background: var(--a1p-success-soft); }
.a1p-badge[data-tone='warning'] { color: var(--a1p-warning); background: var(--a1p-warning-soft); }
.a1p-badge[data-tone='error'] { color: var(--a1p-error); background: var(--a1p-error-soft); }
.a1p-badge[data-tone='info'] { color: var(--a1p-info); background: var(--a1p-info-soft); }

.a1p-table-container { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--a1p-line); border-radius: var(--a1p-radius-surface); background: var(--a1p-surface); color: var(--a1p-text); }
.a1p-table { width: 100%; border-collapse: collapse; border-spacing: 0; background: var(--a1p-surface); color: var(--a1p-text); font-family: var(--a1p-font-body); font-size: var(--a1p-font-size-body); line-height: var(--a1p-line-height-body); text-align: left; }
.a1p-table-head, .a1p-table-cell { height: var(--a1p-row-height); padding: var(--a1p-space-2) var(--a1p-space-3); border-bottom: 1px solid var(--a1p-line); vertical-align: middle; }
.a1p-table-head { color: var(--a1p-text-secondary); font-weight: var(--a1p-font-weight-bold); background: var(--a1p-surface-soft); text-align: left; }
.a1p-table-footer { font-weight: var(--a1p-font-weight-bold); background: var(--a1p-surface-soft); }
.a1p-table-body .a1p-table-row:last-child > .a1p-table-cell, .a1p-table-footer .a1p-table-row:last-child > .a1p-table-cell { border-bottom: 0; }
.a1p-table-footer .a1p-table-cell { border-top: 1px solid var(--a1p-line); }
.a1p-table-body .a1p-table-row:hover { background: var(--a1p-surface-soft); }
.a1p-table-row[data-state='selected'] { background: var(--a1p-accent-soft); }
.a1p-table-row[data-state='selected']:hover { background: var(--a1p-accent-soft); }
:is(.a1p-table-head, .a1p-table-cell)[data-align='right'] { text-align: right; font-variant-numeric: tabular-nums; }
.a1p-table-caption { caption-side: bottom; padding: var(--a1p-space-3); color: var(--a1p-text-muted); font-size: var(--a1p-font-size-meta); text-align: left; }
:root[data-a1p-density='compact'] :is(.a1p-table-head, .a1p-table-cell) { padding-block: var(--a1p-space-1); }

/* Aplicar o atributo apenas durante a troca; hover volta imediatamente depois. */
:root[data-a1p-theme-changing] *, :root[data-a1p-theme-changing] *::before, :root[data-a1p-theme-changing] *::after { transition: none !important; }

@media (max-width: 760px) {
  .a1p-app-frame, .a1p-app-frame[data-collapsed='true'] { grid-template-columns: minmax(0, 1fr); }
  .a1p-app-sidebar { display: none; }
  .a1p-page-heading { flex-wrap: wrap; align-items: flex-start; }
  .a1p-page-actions { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .a1p-app-main { padding-top: var(--a1p-space-4); }
  .a1p-page-header { margin-bottom: var(--a1p-space-4); }
  .a1p-topbar { flex-wrap: wrap; gap: var(--a1p-space-2); }
  .a1p-topbar-content { flex-basis: 0; }
  .a1p-page-toolbar > * { min-width: 0; }
}
@media (pointer: coarse), (max-width: 760px) {
  .a1p-button, .a1p-button[data-size='sm'], .a1p-button[data-size='lg'], .a1p-button[data-size='icon'], .a1p-button[data-size='icon-sm'], .a1p-nav-item { min-height: var(--a1p-touch-target); }
  .a1p-button[data-size='icon'], .a1p-button[data-size='icon-sm'] { width: var(--a1p-touch-target); height: var(--a1p-touch-target); }
  .a1p-input, .a1p-select, .a1p-textarea { font-size: 1rem; }
}
@media (prefers-contrast: more) {
  .a1p-surface, .a1p-table-container, .a1p-nav-item[data-compact='true'] { border-color: var(--a1p-control-line); }
  .a1p-nav-item[data-active='true'] { outline: 2px solid currentColor; outline-offset: -2px; }
}
@media (forced-colors: active) {
  .a1p-button { border-color: ButtonText; }
  .a1p-badge { border: 1px solid CanvasText; }
  .a1p-nav-item[data-active='true'] { outline: 2px solid Highlight; outline-offset: -2px; }
}
@media (prefers-reduced-motion: reduce) {
  .a1p-system *, .a1p-system *::before, .a1p-system *::after,
  .a1p-app-frame, .a1p-button, .a1p-input, .a1p-select, .a1p-textarea, .a1p-nav-item {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
}
@media print {
  .a1p-app-frame, .a1p-app-frame[data-collapsed='true'] { display: block; background: Canvas; color: CanvasText; }
  .a1p-app-sidebar, .a1p-app-topbar, .a1p-app-footer { display: none; }
  .a1p-app-main { max-width: none; padding: 0; }
  .a1p-surface, .a1p-table, .a1p-table-container { background: Canvas !important; color: CanvasText; box-shadow: none !important; backdrop-filter: none !important; }
  .a1p-table-container { overflow: visible; }
}
