@import url("/common/styles/modern.css?v=theme-20260929-3");

/* Shared components and motion, loaded after module styles. */
.mobile-menu-toggle { display: none; }
.ui-skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 11000;
  padding: 12px 18px;
  border-radius: 10px;
  color: #fff;
  background: var(--primary, #2563eb);
  transform: translateY(-160%);
}
.ui-skip-link:focus { transform: translateY(0); color: #fff; }
:where(button, a, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--primary, #2563eb);
  outline-offset: 3px;
}
:where(button, .btn):disabled { cursor: not-allowed; transform: none; box-shadow: none; }
:where(input, textarea, select, button) { font-family: inherit; }
:where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--primary, #2563eb); }

/* A nonblocking indication of actual pending requests. Quick requests do not flash. */
.ui-activity { position: fixed; inset: 0; z-index: 10000; pointer-events: none; }
.ui-activity[hidden] { display: none; }
.ui-activity-track, .ui-navigating::after {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  overflow: hidden;
  background: var(--primary-soft, #dbeafe);
}
.ui-activity-track > span, .ui-navigating::after {
  background: linear-gradient(90deg, transparent, var(--primary, #2563eb), var(--theme-accent, #38bdf8));
  animation: ui-progress 1.5s cubic-bezier(.4, 0, .2, 1) infinite;
}
.ui-activity-track > span { display: block; width: 42%; height: 100%; }
.ui-navigating::after { content: ""; z-index: 10001; width: 42%; pointer-events: none; }
.ui-activity-caption {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 11px 17px;
  border: 1px solid var(--border, #dce2eb);
  border-radius: 100px;
  background: var(--surface, #fff);
  box-shadow: 0 4px 24px rgb(15 23 42 / 10%);
  color: var(--text-soft, #334155);
  font: 500 12px/1.4 var(--font-main, "Segoe UI", sans-serif);
  animation: ui-caption-in .25s ease-out;
}
.ui-spinner, .continuous-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid var(--border, #dce2eb);
  border-top-color: var(--primary, #2563eb);
  border-right-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: continuous-loader-spin .8s linear infinite;
}
.continuous-loader[hidden] { display: none; }
.ui-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  min-height: 140px;
  padding: 24px;
  color: var(--muted, #64748b);
  font-size: 13px;
  font-weight: 500;
}
.ui-loading-caption { display: inline-flex; align-items: center; gap: 10px; }
.ui-loading--compact { display: inline-flex; width: auto; min-height: 0; padding: 6px 0; }
.ui-skeleton { display: grid; gap: 10px; width: min(440px, 100%); }
.ui-skeleton > span {
  position: relative;
  display: block;
  height: 11px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-muted, #edf1f6);
}
.ui-skeleton > span:nth-child(2n) { width: 83%; }
.ui-skeleton > span:last-child { width: 61%; }
.ui-skeleton > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface, #fff), transparent);
  animation: ui-shimmer 1.7s ease-in-out infinite;
}
.ui-button-busy { cursor: wait !important; }
.ui-button-busy::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  vertical-align: middle;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: continuous-loader-spin .8s linear infinite;
}

/* One visual vocabulary for the working surfaces used across modules. */
.app-layout :is(.page-head, .page-header, .logs-header, .asbuilt-commandbar, .sheet-toolbar) {
  border-radius: var(--radius-md);
  border-color: var(--border);
  box-shadow: none;
}
.app-layout :is(.page-head, .page-header, .logs-header) h1 {
  letter-spacing: -.035em;
  font-weight: 650;
  line-height: 1.2;
}
.app-layout :is(.page-head, .page-header, .logs-header) p { color: var(--muted); }
.app-layout :is(.card, .panel, .filter-panel, .sheet, .tabela-card, .filter-card) {
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}
.app-layout :is(.cards, .kpi-grid, .stats-grid) > article {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.app-layout :is(.cards, .kpi-grid, .stats-grid) > article:hover {
  border-color: var(--border-strong);
  box-shadow: 0 5px 16px rgb(15 23 42 / 5%);
}
.app-layout :is(.cards, .kpi-grid, .stats-grid) strong { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.app-layout :is(.badge, .page-badge) { font-weight: 650; letter-spacing: .065em; }
.app-layout :is(.table-wrapper, .sheet-wrapper, .logs-table-wrap) { scrollbar-gutter: stable; }
.app-layout :is(.modal-card, .modal-content, .floating-card) {
  border-color: var(--border);
  box-shadow: var(--shadow-card);
  animation: ui-dialog-in .22s cubic-bezier(.2, .8, .2, 1);
}
.app-layout :is(.modal-header, .tabela-header, .solicitar-card-header) {
  background: var(--surface);
  border-color: var(--border);
}
.app-layout :is(.empty-state, .empty-row, .logs-empty, .cell-history-empty, .pending-history-empty) {
  color: var(--muted);
  line-height: 1.6;
}
.app-layout .btn-secondary { background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); }
.app-layout .btn-secondary:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.app-layout .btn-secondary.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); }
.app-layout :is(.command-search input, .logs-filters input, .logs-filters select) { border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: no-preference) {
  .app-layout > :is(.main-content, .solicitacoes-page) > :is(header, section, nav) {
    animation: ui-reveal .35s cubic-bezier(.2, .8, .2, 1) backwards;
  }
  .app-layout > :is(.main-content, .solicitacoes-page) > :nth-child(2) { animation-delay: .04s; }
  .app-layout > :is(.main-content, .solicitacoes-page) > :nth-child(3) { animation-delay: .08s; }
  .app-layout > :is(.main-content, .solicitacoes-page) > :nth-child(4) { animation-delay: .12s; }
  .nav-section.is-open .nav-group-links { animation: ui-reveal .2s ease-out; }
  details[open] > :not(summary) { animation: ui-reveal .18s ease-out; }
  .app-layout tbody tr { transition: background-color .14s ease; }
}
@keyframes ui-progress { from { transform: translateX(-110%); } to { transform: translateX(350%); } }
@keyframes continuous-loader-spin { to { transform: rotate(360deg); } }
@keyframes ui-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes ui-reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes ui-dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ui-caption-in { from { opacity: 0; margin-bottom: -5px; } to { opacity: 1; margin-bottom: 0; } }
@media (max-width: 800px) {
  .ui-activity-caption { bottom: max(16px, env(safe-area-inset-bottom)); font-size: 11px; }
  body:has(.field-app) .ui-activity-caption { bottom: calc(72px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .ui-activity-track > span, .ui-navigating::after { width: 100%; }
}
@media print {
  .ui-activity, .ui-skip-link, .sidebar-toggle-corner, .message-container { display: none !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
