/* iCenter Finish 10 — camada final de consistência, acessibilidade e responsividade. */
:root {
  --ui-bg: #f4f6fb;
  --ui-surface: #ffffff;
  --ui-surface-subtle: #f8faff;
  --ui-text: #172033;
  --ui-text-soft: #5c6b82;
  --ui-border: #dce4f0;
  --ui-border-strong: #c8d4e4;
  --ui-brand: #1769e8;
  --ui-brand-hover: #0e57c8;
  --ui-success: #07875f;
  --ui-warning: #b86a04;
  --ui-danger: #c4334d;
  --ui-focus: #126df0;
  --ui-radius-control: 8px;
  --ui-radius-card: 12px;
  --ui-shadow-card: 0 2px 8px rgba(31, 54, 86, .07);
  --ui-shadow-dialog: 0 24px 64px rgba(24, 38, 61, .18);
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;
}

body.icenter-finish {
  color: var(--ui-text);
  background: var(--ui-bg);
  font-family: "Apex Geist", "Geist", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.icenter-finish :where(h1, h2, h3) {
  color: var(--ui-text);
  text-wrap: balance;
  letter-spacing: -.025em;
  line-height: 1.18;
}

body.icenter-finish :where(p, li, dd) { text-wrap: pretty; }

body.icenter-finish :where(.ops-main, .dashboard-content, .workspace) small {
  font-size: 12px !important;
  line-height: 1.4;
}

body.icenter-finish .ui-readable {
  font-size: 12px !important;
  line-height: 1.4 !important;
}

body.icenter-finish :where(button, a, input, select, textarea, summary) {
  font: inherit;
}

body.icenter-finish :where(button, [role="button"], a, summary, select) { cursor: pointer; }

body.icenter-finish :where(button, [role="button"], a, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ui-focus) 72%, white) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ui-focus) 14%, transparent) !important;
}

body.icenter-finish :where(button, [role="button"], .ops-primary, .ops-secondary, .ops-accent) {
  min-height: 38px;
  border-radius: var(--ui-radius-control) !important;
  transition: transform .12s ease, border-color .18s ease, background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

body.icenter-finish :where(button, [role="button"], .ops-primary, .ops-secondary, .ops-accent):hover:not(:disabled) {
  transform: translateY(-1px);
}

body.icenter-finish :where(button, [role="button"], .ops-primary, .ops-secondary, .ops-accent):active:not(:disabled),
body.icenter-finish [data-ui-pressed="true"] {
  transform: translateY(0) scale(.98) !important;
}

body.icenter-finish :where(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: .58;
}

body.icenter-finish :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 42px;
  border-radius: var(--ui-radius-control) !important;
  border-color: var(--ui-border-strong) !important;
  background: var(--ui-surface-subtle) !important;
  color: var(--ui-text) !important;
}

body.icenter-finish :where(input, select, textarea):focus {
  border-color: var(--ui-brand) !important;
  background: var(--ui-surface) !important;
}

body.icenter-finish :where(label, legend) {
  color: #344258;
  font-size: 12px;
  font-weight: 650;
}

body.icenter-finish :where(.ops-panel, .ops-stat, .kpi, .vg-card, .r122-card, .home-card, .summary-card) {
  border-radius: var(--ui-radius-card) !important;
  border-color: var(--ui-border) !important;
  box-shadow: var(--ui-shadow-card) !important;
}

body.icenter-finish :where(dialog, .biz-dialog) {
  border-radius: 14px !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: var(--ui-shadow-dialog) !important;
}

body.icenter-finish :where(dialog, .biz-dialog)::backdrop {
  background: rgba(23, 32, 51, .48) !important;
  backdrop-filter: blur(4px);
}

body.icenter-finish :where(.dialog-close, .close) {
  min-width: 38px;
  min-height: 38px;
  border-radius: 8px !important;
}

body.icenter-finish .ops-toast,
body.icenter-finish #toast {
  max-width: min(440px, calc(100vw - 32px));
  border-radius: 10px !important;
  box-shadow: 0 12px 30px rgba(23, 32, 51, .18) !important;
  font-size: 13px !important;
}

/* Tabelas: leitura, cabeçalho fixo e escolha de densidade. */
.ui-table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: var(--ui-surface-subtle);
}

.ui-table-tools__summary {
  color: var(--ui-text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ui-table-tools__density { display: inline-flex; gap: 4px; }

.ui-density-button {
  min-height: 32px !important;
  padding: 5px 10px !important;
  border: 1px solid var(--ui-border-strong) !important;
  background: var(--ui-surface) !important;
  color: #40506a !important;
  font-size: 12px !important;
}

.ui-density-button[aria-pressed="true"] {
  border-color: var(--ui-brand) !important;
  background: #edf4ff !important;
  color: #0d56be !important;
}

.ui-table-scroll {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

body.icenter-finish table.ui-data-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100%;
  font-size: 13px !important;
}

body.icenter-finish table.ui-data-table :where(th, td) {
  padding: 11px 10px !important;
  border-bottom: 1px solid #e6ebf3 !important;
  vertical-align: middle;
}

body.icenter-finish table.ui-data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eef3fb !important;
  color: #42526a !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  letter-spacing: .035em !important;
  text-transform: uppercase;
}

body.icenter-finish table.ui-data-table tbody tr { transition: background-color .15s ease; }
body.icenter-finish table.ui-data-table tbody tr:hover { background: #f6f9ff; }

body.icenter-finish.ui-density-compact table.ui-data-table :where(th, td) {
  padding-block: 7px !important;
}

body.icenter-finish.ui-density-compact table.ui-data-table { font-size: 12px !important; }

/* Estados vazios ficam reconhecíveis sem ocupar um bloco exagerado. */
body.icenter-finish :where(.saas-empty, .empty-column, .empty-state) {
  min-height: 76px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 18px !important;
  border: 1px dashed var(--ui-border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, .55);
  color: var(--ui-text-soft) !important;
  text-align: center;
}

/* Cabeçalhos e áreas de ação com hierarquia mais clara. */
body.icenter-finish :where(.screen-heading, .page-heading, .ops-page-head, .r122-heading) {
  gap: 12px !important;
  margin-bottom: 16px !important;
}

body.icenter-finish :where(.screen-actions, .ops-actions, .action-strip, .page-actions) {
  gap: 8px !important;
  align-items: center;
  flex-wrap: wrap;
}

body.icenter-finish .screen-heading .head-actions :where(button.ops-secondary, button.ops-blue, button.payment-launch-button) {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border-strong) !important;
  color: #40506a !important;
  box-shadow: none !important;
}

body.icenter-finish .screen-heading .head-actions :where(button.ops-secondary, button.ops-blue, button.payment-launch-button):hover:not(:disabled) {
  background: #f2f6fc !important;
  border-color: #9fb2cb !important;
  color: #183f73 !important;
}

body.icenter-finish[data-view="sales"] .screen-heading .head-actions > button.payment-launch-button {
  background: #fff !important;
  border: 1px solid #c5afd0 !important;
  color: #7d3269 !important;
  box-shadow: none !important;
}

body.icenter-finish[data-view="sales"] .screen-heading .head-actions > button.ops-secondary:nth-of-type(3) {
  background: #fff !important;
  border: 1px solid #e1a8b3 !important;
  color: #a52840 !important;
  box-shadow: none !important;
}

.ui-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  align-items: center;
  justify-content: center;
  vertical-align: -3px;
}

.ui-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

body.icenter-finish :where(.ops-primary, .pos-cta) {
  background: var(--ui-brand) !important;
  border-color: var(--ui-brand) !important;
  color: white !important;
  box-shadow: 0 3px 8px rgba(23, 105, 232, .18) !important;
}

body.icenter-finish :where(.ops-primary, .pos-cta):hover:not(:disabled) {
  background: var(--ui-brand-hover) !important;
}

body.icenter-finish .skip-ops:focus,
body.icenter-finish .skip:focus {
  position: fixed !important;
  top: 8px !important;
  left: 8px !important;
  z-index: 10000 !important;
  padding: 10px 14px !important;
  background: #fff !important;
  color: #15345f !important;
  border-radius: 8px;
}

/* Barra de carregamento discreta para mudanças de página. */
.ui-page-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 99999;
  width: 100%;
  height: 3px;
  background: var(--ui-brand);
  transform-origin: left;
  animation: ui-progress-in .7s ease both;
  pointer-events: none;
}

body.ui-ready .ui-page-progress {
  opacity: 0;
  transform: scaleX(1);
  transition: transform .22s ease, opacity .22s ease .12s;
}

@keyframes ui-progress-in {
  from { transform: scaleX(.05); opacity: .4; }
  to { transform: scaleX(.34); opacity: 1; }
}

@media (max-width: 760px) {
  body.icenter-finish { font-size: 14px; }

  body.icenter-finish :where(button, [role="button"], input, select, textarea) {
    min-height: 44px;
  }

  .ui-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .ui-table-tools__density { width: 100%; }
  .ui-density-button { flex: 1; }

  body.icenter-finish :where(dialog, .biz-dialog) {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    margin: 8px auto !important;
  }

  body.icenter-finish .ui-card-table,
  body.icenter-finish .ui-card-table :where(tbody, tr, td) { display: block; }

  body.icenter-finish .ui-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  body.icenter-finish .ui-card-table tbody { display: grid; gap: 10px; }

  body.icenter-finish .ui-card-table tbody tr {
    padding: 8px 10px;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-card);
  }

  body.icenter-finish .ui-card-table tbody td {
    display: grid;
    grid-template-columns: minmax(100px, 40%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0 !important;
    white-space: normal !important;
  }

  body.icenter-finish .ui-card-table tbody td::before {
    content: attr(data-ui-label);
    color: var(--ui-text-soft);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-page-progress { display: none; }
  body.icenter-finish *, body.icenter-finish *::before, body.icenter-finish *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .ui-table-tools, .ui-page-progress { display: none !important; }
}
