/* Incremental Viper operational styling. Last stylesheet, Atendimento only.
   The measured desktop viewport already has a correct bounded shell; do not
   rewrite app/sidebar/body height ownership or add viewport subtraction math. */
#tab-atendimento .service-workspace,
#tab-atendimento .detail-layout,
#tab-atendimento .chat-shell { min-height: 0; min-width: 0; }
#tab-atendimento .messages { min-height: 0; overscroll-behavior: contain; }
/* This exact legacy control is disabled and explicitly labelled as future
   functionality. Do not occupy the live toolbar with a non-action. */
#tab-atendimento .chat-composer > .quick-replies-placeholder:disabled { display: none; }
#tab-atendimento .context-rail.v1-rail { overflow-anchor: none; scrollbar-gutter: stable; }

/* Existing internal navigation is moved ahead of the context stack by JS.
   Sticky within the existing rail, never fixed relative to the document. */
#tab-atendimento #emptyContext > .v1-rail-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 0 10px;
  padding: 0 0 6px;
  gap: 3px;
  background: var(--v1-surface, #fff);
  border-bottom: 1px solid var(--v1-line, #e4e7ec);
  border-radius: 0;
}
#tab-atendimento #emptyContext .v1-rail-tab {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 6px 3px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: 6px;
  color: #475467;
  touch-action: manipulation;
}
#tab-atendimento #emptyContext .v1-rail-tab.active {
  color: var(--v1-brand-strong, #0b4f66);
  background: var(--v1-brand-soft, #e6f3f7);
  box-shadow: inset 0 -2px 0 var(--v1-brand, #0d5f7a);
}
#tab-atendimento #emptyContext .v1-rail-tab:hover { background: var(--v1-surface-subtle, #f1f5f9); }
#tab-atendimento #emptyContext :is(button, summary, input, select):focus-visible {
  outline: 2px solid var(--v1-brand, #0d5f7a);
  outline-offset: 2px;
}

/* Section hierarchy replaces nested decorative cards; preserve every field,
   domain warning, relationship and existing action. No instructional copy hidden. */
#tab-atendimento #emptyContext .v1-person-head { padding: 0 0 10px; margin: 0 0 10px; }
#tab-atendimento #emptyContext .v1-person-head h3 { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
#tab-atendimento #emptyContext .v1-person-head p { font-size: 12px; line-height: 1.4; }
#tab-atendimento #emptyContext .v1-person-head .row > div { min-width: 0; flex: 1 1 auto; }
#tab-atendimento #emptyContext .v1-person-head button { flex: 0 0 auto; white-space: nowrap; }
#tab-atendimento #emptyContext .v1-control-panel.compact {
  height: auto;
  min-height: 0;
  padding: 8px;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--v1-surface-soft, #f8fafc);
}
#tab-atendimento #emptyContext .v1-control-grid { gap: 6px; align-content: start; }
#tab-atendimento #emptyContext .v1-control-row { min-width: 0; grid-template-columns: 88px minmax(0, 1fr); }
#tab-atendimento #emptyContext .v1-control-row label { white-space: nowrap; }
#tab-atendimento #emptyContext .v1-control-row select { width: 100%; min-width: 0; }
#tab-atendimento #emptyContext #railTabContent > .rail-block,
#tab-atendimento #emptyContext > details.rail-block {
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--v1-line, #e4e7ec);
  border-radius: 0;
  box-shadow: none;
}
#tab-atendimento #emptyContext .rail-block h4 { margin: 0 0 6px; font-size: 13px; line-height: 1.4; }
#tab-atendimento #emptyContext .field-list { font-variant-numeric: tabular-nums; }
#tab-atendimento #emptyContext .field-list > div:last-child { border-bottom: 0; }
#tab-atendimento #emptyContext details.rail-block > summary { text-transform: none; letter-spacing: 0; }

/* Proven 1280x577 starvation: header108 + composer177 inside383px shell.
   Compact the fixed chrome, keep the message pane as the flexible scroller.
   No assistant/quote/attachment selector or state lifecycle is overridden. */
@media (min-width: 1161px) and (max-width: 1600px) {
  #tab-atendimento:not(.atendimento-info-collapsed) .service-workspace {
    grid-template-columns: clamp(220px, 18vw, 280px) minmax(0, 1fr) clamp(284px, 21vw, 320px);
  }
  #tab-atendimento .atendimento-filters > :is(input, select, button) {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }
  #tab-atendimento .chat-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 7px 10px;
  }
  #tab-atendimento .chat-actions {
    max-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
  }
  #tab-atendimento .chat-actions button { flex: 0 0 auto; min-height: 32px; }
  #tab-atendimento .chat-composer { padding-block: 7px; gap: 6px; }
  #tab-atendimento .chat-composer .composer-mode { width: auto; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; }
  #tab-atendimento .chat-composer textarea { height: 48px; min-height: 44px; max-height: 88px; }
  #tab-atendimento .chat-composer > button,
  #tab-atendimento .chat-composer .composer-mode button { min-height: 32px; padding: 6px 8px; font-size: 12px; }
}
@media (max-width: 860px) {
  /* Keep existing fixed overlay, safe areas, keyboard and close semantics. */
  /* Context is the primary rail entry, not an offscreen trailing chat action. */
  #tab-atendimento .chat-actions #mobileContextButton { order: -1; min-width: 44px; }
  #tab-atendimento #emptyContext > .v1-rail-tabs { position: static; }
  #tab-atendimento #emptyContext .v1-rail-tab,
  #tab-atendimento #emptyContext .v1-control-row select,
  #tab-atendimento #emptyContext button,
  #tab-atendimento #emptyContext summary { min-height: 44px; }
  #tab-atendimento #emptyContext .v1-control-row { grid-template-columns: 88px minmax(0, 1fr); }
}
