/* iCenter 2026 — acabamento visual compartilhado.
   Mantém a linguagem atual e corrige densidade, enquadramento e estados. */

html[data-tema="claro"] {
  color-scheme: light;
  background: #f4f6fb !important;
}

html[data-tema="claro"] body.icenter-theme:not(.login-page) {
  background: #f4f6fb !important;
  color: #1e212e;
}

body.icenter-theme :is(.ops-layout, #ops-main, .dashboard-content, .screen-heading, .head-actions) {
  min-width: 0;
}

body.icenter-theme :is(button, a, input, select, textarea, summary) {
  -webkit-tap-highlight-color: transparent;
}

body.icenter-theme :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid rgba(18, 89, 239, .28) !important;
  outline-offset: 2px !important;
}

body.icenter-theme :is(.ops-primary, .ops-blue, .ic-create-action) {
  box-shadow: 0 4px 12px rgba(18, 89, 239, .14) !important;
}

body.icenter-theme :is(.ops-primary, .ops-blue, .ops-secondary, .head-actions button, .button-row button) {
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease !important;
}

body.icenter-theme :is(.ops-primary, .ops-blue, .ops-secondary, .head-actions button, .button-row button):hover:not(:disabled) {
  transform: translateY(-1px);
}

body.icenter-theme :is(.ops-primary, .ops-blue, .ops-secondary, .head-actions button, .button-row button):active:not(:disabled) {
  transform: translateY(0);
}

body.icenter-theme button:disabled {
  cursor: not-allowed;
  opacity: .56;
}

/* Visão geral: apenas enquadramento e proporção dos cartões. */
body.dashboard-page .dashboard-content {
  width: min(100%, 1680px);
  margin-inline: auto;
}

body.dashboard-page .vg-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  align-items: stretch;
}

body.dashboard-page .vg-kpis > .kpi {
  min-height: 150px !important;
  height: 100%;
  overflow: hidden;
}

body.dashboard-page .vg-grid > * {
  min-width: 0;
}

body.dashboard-page .panel {
  overflow: clip;
}

/* Nova venda: usa toda a altura do painel e mantém rodapé sempre visível. */
#biz-dialog:has(#biz-sale) {
  height: min(840px, 94dvh) !important;
  max-height: 94dvh !important;
  overflow: hidden !important;
}

#biz-sale {
  height: 100% !important;
  min-height: 0 !important;
}

#biz-sale .pos-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden;
}

#biz-sale .pos-catalog,
#biz-sale .pos-checkout {
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

#biz-sale .pos-checkout {
  display: flex !important;
  flex-direction: column;
}

#biz-sale .pos-panels {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
  scrollbar-gutter: stable;
}

#biz-sale .pos-foot {
  flex: 0 0 auto;
  margin-top: auto !important;
}

#biz-sale #pos-grid {
  scrollbar-gutter: stable;
}

#biz-sale .r23-section-title {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

#biz-sale .r23-maintenance {
  width: 100%;
  justify-content: flex-start !important;
}

.r23-maintenance-dialog {
  width: min(720px, 94vw) !important;
  max-height: 88dvh;
  overflow: auto;
  border: 0;
  border-radius: 16px !important;
  padding: 22px !important;
  box-shadow: 0 24px 70px rgba(24, 42, 70, .24) !important;
}

.r23-maintenance-dialog::backdrop {
  background: rgba(20, 31, 48, .48);
  backdrop-filter: blur(3px);
}

.r23-maintenance-dialog > header {
  padding-bottom: 12px;
  border-bottom: 1px solid #dce5f1;
  margin-bottom: 14px;
}

.r23-maintenance-dialog .trade-repairs label {
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  min-height: 36px;
  cursor: pointer;
}

.r23-maintenance-dialog .trade-repairs input[type="checkbox"] {
  appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  flex: 0 0 18px;
  padding: 0 !important;
  border: 1px solid #9eb1cc !important;
  border-radius: 5px !important;
  background: #fff;
}

.r23-maintenance-dialog .trade-repairs input[type="checkbox"]:checked {
  background: #1259ef !important;
  border-color: #1259ef !important;
  box-shadow: inset 0 0 0 3px #fff;
}

/* Novo cadastro: leitura mais curta e agrupamento claro. */
#biz-dialog:has(#new-item) {
  width: min(900px, 94vw) !important;
  max-height: 92dvh !important;
  padding: 20px 24px !important;
}

#new-item {
  gap: 10px 12px !important;
  align-items: end;
}

#new-item :is(input, select) {
  min-height: 38px !important;
}

#new-item .cad-preview {
  min-height: 92px;
  border: 1px solid #dbe5f2;
  background: linear-gradient(135deg, #f7f9fc, #eef3fa);
}

#new-item .ni-imei-warn {
  border: 1px solid #f0d58a;
  background: #fff8df;
}

#new-item .pay-way {
  padding: 12px 14px !important;
  border-radius: 10px !important;
}

#new-item > button[type="submit"] {
  min-width: 160px;
}

/* Manutenção: kanban semântico, colorido e com ação seguinte explícita. */
body[data-view="maintenance"] .mg-stats {
  margin: 10px 0 12px;
}

body[data-view="maintenance"] .r122-repair-note {
  margin: 0 0 12px;
  border: 1px solid #dce6f5;
}

body[data-view="maintenance"] .r122-kanban {
  gap: 14px;
  align-items: start;
}

body[data-view="maintenance"] .r122-kanban > section {
  --stage: #5b7cfa;
  --stage-soft: #edf2ff;
  position: relative;
  overflow: hidden;
  padding: 12px !important;
  background: var(--stage-soft) !important;
  border-color: color-mix(in srgb, var(--stage) 24%, white) !important;
}

body[data-view="maintenance"] .r122-kanban > section:nth-child(1) { --stage: #3b82f6; --stage-soft: #eef5ff; }
body[data-view="maintenance"] .r122-kanban > section:nth-child(2) { --stage: #8b5cf6; --stage-soft: #f5f1ff; }
body[data-view="maintenance"] .r122-kanban > section:nth-child(3) { --stage: #f59e0b; --stage-soft: #fff8e8; }
body[data-view="maintenance"] .r122-kanban > section:nth-child(4) { --stage: #10a56f; --stage-soft: #edf9f4; }

body[data-view="maintenance"] .r122-kanban h2 {
  color: #23324a;
  margin: 5px 0 12px !important;
}

body[data-view="maintenance"] .r122-kanban h2 small {
  color: var(--stage);
  border: 1px solid color-mix(in srgb, var(--stage) 24%, white);
}

body[data-view="maintenance"] .r122-os {
  padding: 12px !important;
  border-color: color-mix(in srgb, var(--stage) 22%, white) !important;
  box-shadow: 0 5px 14px rgba(39, 57, 82, .08) !important;
}

body[data-view="maintenance"] .r122-os > span:not(.r123-repair-device),
body[data-view="maintenance"] .r122-os > small {
  color: #58697d;
}

.r122-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  width: 100%;
  margin-top: 5px;
  padding-top: 10px;
  border-top: 1px solid #e1e8f2;
}

.r122-card-actions button {
  min-height: 34px !important;
  height: auto !important;
  padding: 7px 9px !important;
  border-radius: 7px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  white-space: normal !important;
}

.r122-card-actions .r122-advance {
  grid-column: 1 / -1;
  background: var(--stage) !important;
  border-color: var(--stage) !important;
  color: #fff !important;
}

.r122-card-actions .r122-open {
  grid-column: 1 / -1;
  background: #fff !important;
  border: 1px solid #cbd8e8 !important;
  color: #29445f !important;
}

@media (max-width: 1100px) {
  body.dashboard-page .vg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body[data-view="maintenance"] .r122-kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body.dashboard-page .vg-kpis { grid-template-columns: 1fr 1fr !important; }
  body.dashboard-page .vg-kpis > .kpi { min-height: 132px !important; }
  #biz-dialog:has(#biz-sale) { height: 96dvh !important; max-height: 96dvh !important; overflow: auto !important; }
  #biz-sale .pos-body { overflow: visible; }
  #biz-sale .pos-catalog, #biz-sale .pos-checkout { height: auto !important; }
  #new-item { grid-template-columns: 1fr !important; }
  body[data-view="maintenance"] .r122-kanban { grid-template-columns: 1fr; }
}

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