/* r111 (API 0.7.19-cfg, 20/10/2026): Configuracao da frota (janela ?frota=1) e o cartao "Configuracao atual da moto" da janela
   ?config=1. Mesmos tokens do portal (styles.css: --surface, --line, --gold...). Sem rolagem horizontal no celular: tabelas
   viram cartoes abaixo de 740 px. */
body.frota-window { background: var(--bg); }
.fc-root { max-width: 1320px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 14px; min-width: 0; }
.fc-header { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -16px; padding: 12px 16px; background: var(--header); border-bottom: 1px solid var(--line); }
.fc-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fc-brand img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.fc-brand h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.fc-tabs { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.fc-tab { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.fc-tab[aria-selected="true"] { background: var(--gold); color: #14110b; }
.fc-tab:focus-visible, .fc-batch-button:focus-visible, .fc-option input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fc-note { margin: 0; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--surface); color: var(--muted); font-size: 13px; border-radius: 0 6px 6px 0; }
.fc-panel { display: grid; gap: 14px; min-width: 0; }
.fc-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.fc-card h2 { margin: 0 0 12px; font-size: 16px; }
.fc-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fc-card-head h2 { margin: 0 0 4px; }
.fc-card-head p { margin: 0; }
.fc-muted { color: var(--muted); }
.fc-hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.fc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.fc-small { font-size: 12.5px; color: var(--muted); }
.fc-danger { color: #f19494; }
.fc-ok { color: #78daa7; }
.fc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.fc-options { display: grid; gap: 8px; }
.fc-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-elevated); cursor: pointer; }
.fc-option input { min-height: auto; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--gold); }
.fc-option span, .fc-radio span { display: grid; gap: 2px; min-width: 0; }
.fc-option small, .fc-radio small { color: var(--muted); font-size: 12.5px; }
.fc-option-body { display: grid; gap: 6px; margin: -2px 0 6px 30px; min-width: 0; }
.fc-option-body select, .fc-filter select, .fc-filter input, .fc-dialog select, .fc-compare select { width: 100%; min-width: 0; }
.fc-fieldset { display: grid; gap: 6px; margin: 6px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.fc-fieldset legend { padding: 0 4px; color: var(--muted); font-size: 13px; }
.fc-radio { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.fc-radio input { min-height: auto; width: 16px; height: 16px; margin-top: 3px; accent-color: var(--gold); }
.fc-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.fc-filter { display: grid; gap: 4px; min-width: 0; }
.fc-filter label { font-size: 12.5px; color: var(--muted); }
.fc-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.fc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fc-status { min-height: 20px; margin: 8px 0 0; font-size: 13.5px; }
.fc-status[data-tone="error"] { color: #f19494; }
.fc-status[data-tone="ok"] { color: #78daa7; }
.fc-table-wrap { min-width: 0; overflow-x: auto; }
.fc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fc-table th { text-align: left; font-size: 12px; font-weight: 750; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fc-table td { padding: 9px 8px; border-bottom: 1px solid #26292d; vertical-align: top; min-width: 0; }
.fc-table td > small { display: block; margin-top: 2px; }
.fc-table tr.fc-selected td { background: #1d1a12; }
.fc-check { width: 36px; }
.fc-check input { min-height: auto; width: 18px; height: 18px; accent-color: var(--gold); }
.fc-empty { text-align: center; color: var(--muted); padding: 18px !important; }
.fc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fc-chip { display: inline-block; max-width: 100%; padding: 2px 7px; border-radius: 5px; font-size: 11.5px; background: #292c30; color: var(--silver); overflow-wrap: anywhere; }
.fc-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; background: #292c30; color: var(--silver); white-space: nowrap; }
.fc-pending { background: #3a2f17; color: #efd38d; }
.fc-sleep { background: #3a2f17; color: var(--gold-light); }
.fc-delivered { background: #1f2a44; color: #9db7ff; }
.fc-applied { background: #153c2a; color: #78daa7; }
.fc-failed { background: #421e22; color: #f19494; }
.fc-muted.fc-badge, .fc-chip.fc-muted { background: #25272a; color: #8d9297; }
.fc-link { min-height: 36px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--gold-light); font-weight: 700; }
.fc-link:hover { text-decoration: underline; }
.fc-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }
/* Revisao do Codex (20/10, P2): filtro "so com pendencias" e paginacao dos lotes; "Carregar mais firmwares". */
.fc-check-label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.fc-check-label input { min-height: auto; width: 16px; height: 16px; accent-color: var(--gold); }
.fc-batches .fc-pager { justify-content: space-between; }
.fc-option-body .fc-link, .fc-dialog .fc-link { justify-self: start; min-height: 32px; padding: 4px 0; font-size: 13px; }
.fc-totals { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-elevated); }
.fc-totals strong { font-size: 16px; }
.fc-alert { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid #6b2b30; border-radius: 8px; background: #2a1517; color: #f6c4c4; }
.fc-preview { margin-top: 12px; display: grid; gap: 10px; min-width: 0; }
.fc-preview-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fc-preview-row { display: grid; grid-template-columns: minmax(160px, 260px) minmax(0, 1fr); gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-elevated); }
.fc-preview-row.fc-blocked { border-color: #6b2b30; }
.fc-preview-moto { display: grid; gap: 2px; min-width: 0; align-content: start; }
.fc-decisions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.fc-decision { display: grid; gap: 3px; min-width: 0; }
.fc-decision-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fc-decision-text { display: grid; gap: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.fc-decision-line { display: block; min-width: 0; }
.fc-decision-line .fc-badge { min-height: 18px; padding: 1px 6px; font-size: 10px; vertical-align: 1px; }
.fc-wait-firmware { color: #efd38d; }
.fc-track { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 14px; align-items: start; }
.fc-batches { position: sticky; top: 76px; max-height: calc(100dvh - 96px); overflow-y: auto; }
.fc-batch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fc-batch-button { width: 100%; display: grid; gap: 4px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-elevated); color: var(--text); cursor: pointer; }
.fc-batch-button.fc-current { border-color: var(--gold); }
.fc-batch-button small { font-size: 12px; }
.fc-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #26292d; }
.fc-bar > span { display: block; min-width: 4px; }
.fc-bar-applied { background: var(--green); }
.fc-bar-delivered { background: #6f8fe0; }
.fc-bar-pending { background: var(--gold); }
.fc-bar-failed { background: var(--red); }
.fc-bar-muted { background: #4a4d52; }
.fc-line { display: block; overflow-wrap: anywhere; }
.fc-line + .fc-line { margin-top: 3px; color: var(--muted); font-size: 12.5px; }
/* Chips e acoes vao num div dentro da celula: td com display:flex sai do layout de tabela e a borda da linha quebra. */
.fc-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fc-dialog { width: min(94vw, 560px); }
.fc-dialog-body { display: grid; gap: 8px; }
.fc-dialog-body h2 { margin: 0; font-size: 17px; }
.fc-denied { max-width: 560px; margin: 48px auto; }
/* cartao da moto (?config=1) */
.fc-device-card .fc-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 10px 0; }
.fc-device-card .fc-facts div { min-width: 0; }
.fc-device-card .fc-facts dt { font-size: 12px; color: var(--muted); }
.fc-device-card .fc-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.fc-subtitle { margin: 14px 0 0; font-size: 14px; }
.fc-compare { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 10px; }
.fc-compare label { font-size: 13px; color: var(--muted); }
.fc-diff { margin-top: 8px; }
.fc-diff-added td:last-child { color: #78daa7; }
.fc-diff-removed td:nth-child(3) { color: #f19494; }

/* r115 / pedido 125: editor e ferramentas usam os mesmos cartoes, grades, tabelas e tokens do portal. */
#fcEditorPanel { --pe-sticky-top: 84px; --pe-scroll-offset: 202px; }
#fcEditorPanel .fc-card { display: grid; gap: 10px; }
#fcEditorPanel input:not([type="checkbox"]), #fcEditorPanel select, #fcEditorPanel textarea { width: 100%; min-width: 0; }
.fc-card h2.pe-title { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pe-reference p { margin: 0; }
.pe-reference .fc-link { justify-self: start; padding-left: 0; }
.pe-filter-bar { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.pe-filter-bar .fc-check-label { margin: 14px 0 0; }
.pe-filter-bar > p { grid-column: 1 / -1; margin: 0; }
#fcEditorPanel .pe-action-bar { position: sticky; top: var(--pe-sticky-top); z-index: 10; grid-template-columns: minmax(180px, 1fr) auto; align-items: end;
  border-color: var(--gold-dark); box-shadow: 0 4px 12px var(--bg); }
.pe-package-name, .pe-package-actions { display: grid; gap: 6px; min-width: 0; }
.pe-package-actions > strong { color: var(--gold-light); font-size: 13px; }
.pe-action-bar .button { padding: 8px 12px; }
.pe-fields { display: grid; gap: 14px; min-width: 0; }
.pe-group { min-width: 0; background: var(--surface); }
.pe-group > summary { cursor: pointer; padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface-elevated); color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pe-group > summary .fc-small { margin-left: 10px; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.pe-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; min-width: 0; background: transparent; }
.pe-field { display: grid; gap: 6px; min-width: 0; align-content: start; padding: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); overflow-wrap: anywhere; }
.pe-field.pe-replacement, .pe-field:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pe-field-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; min-width: 0; }
.pe-field-head > label:first-child { display: grid; gap: 3px; min-width: 0; }
.pe-field-head strong { font-size: 14px; }
.pe-field-head code { color: var(--muted); font-weight: 400; font-size: 11px; }
.pe-selected { box-shadow: inset 3px 0 var(--gold), 0 0 0 1px var(--line); }
.pe-field p { margin: 0; }
.pe-metadata { line-height: 1.6; }
.pe-select { display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--gold-light); font-size: 12px; cursor: pointer; }
.pe-select input { width: 18px; height: 18px; min-height: auto; accent-color: var(--gold); }
.pe-current { display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--surface-elevated); font-size: 13px; }
.pe-current > span { max-height: 90px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.pe-current > small { color: var(--muted); font-size: 11px; }
.pe-unavailable .pe-select { color: var(--muted); }
.pe-schema { max-height: 300px; overflow: auto; padding: 10px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pe-field textarea { min-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; resize: vertical; }
.pe-field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pe-group > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.pe-contract summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.pe-contract .pe-schema { margin-bottom: 0; }
.pe-hash { overflow-wrap: anywhere; }
.pe-diff { table-layout: fixed; }
.pe-diff td { white-space: pre-wrap; overflow-wrap: anywhere; }
.pe-omitted { columns: 2; font-size: 12px; overflow-wrap: anywhere; }
#peFilterBar, #peFields, #pePreview, .pe-field, .pe-group, .pe-group > summary, #fcEditorPanel input, #fcEditorPanel select, #fcEditorPanel textarea {
  scroll-margin-top: var(--pe-scroll-offset); }
#fcEditorPanel #peSearch { scroll-margin-top: calc(var(--pe-scroll-offset) + 24px); }

.bridge-tools-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.bridge-tool-card { min-width: 0; }
.bridge-tool-card-body { display: grid; gap: 10px; padding: 12px; min-width: 0; }
.bridge-tools-grid > .bridge-tool-reading { grid-row: span 2; }
.bridge-tool-card .form-stack, .bridge-tool-card .device-facts, .bridge-tool-firmware-status { margin: 0; }
.bridge-tool-card .settings-grid { margin-top: 0; }
.bridge-tool-card summary, .bridge-tools-panel > summary { padding: 8px 12px; background: var(--surface-elevated); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); cursor: pointer; }

@media (max-width: 980px) {
  .fc-header { position: static; }
  #fcEditorPanel { --pe-sticky-top: 0px; --pe-scroll-offset: 118px; }
  .fc-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fc-track { grid-template-columns: 1fr; }
  .fc-batches { position: static; max-height: none; }
}
@media (max-width: 740px) {
  .fc-root { padding: 0 16px 32px; }
  /* No celular o cabecalho nao fica preso no topo (ocuparia um quinto da tela); fechar fica ao lado do titulo. */
  .fc-header { position: static; gap: 8px; }
  .fc-header #fcCloseWindow { order: 2; }
  .fc-tabs { order: 3; width: 100%; }
  .fc-tab { flex: 1 1 0; }
  .fc-tabs { flex-wrap: wrap; }
  .fc-tab { padding: 6px 8px; font-size: 12px; }
  .pe-omitted { columns: 1; }
  .pe-group-grid, .pe-filter-bar, #fcEditorPanel .pe-action-bar, .bridge-tools-grid { grid-template-columns: minmax(0, 1fr); }
  .pe-field-head { flex-wrap: wrap; }
  .pe-group > summary .fc-small { display: block; margin: 4px 0 0 16px; }
  .pe-filter-bar .fc-check-label { margin-top: 0; }
  #fcEditorPanel { --pe-scroll-offset: 154px; }
  #fcEditorPanel .pe-action-bar { gap: 6px; padding: 10px; }
  .pe-package-name { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .pe-package-actions .fc-actions { display: grid; grid-template-columns: 1fr 1.4fr .75fr; gap: 6px; }
  .pe-action-bar .button { min-width: 0; padding: 8px 6px; font-size: 12px; white-space: normal; }
  .bridge-tools-grid > .bridge-tool-reading { grid-row: auto; }
  .fc-filters { grid-template-columns: 1fr; }
  .fc-option-body { margin-left: 0; }
  .fc-preview-row { grid-template-columns: 1fr; }
  .fc-compare { grid-template-columns: 1fr; }
  .fc-device-card .fc-facts { grid-template-columns: 1fr; }
  /* Tabelas viram cartoes (sem rolagem horizontal) */
  .fc-table-wrap { overflow-x: visible; }
  .fc-table, .fc-table tbody, .fc-table tr, .fc-table td { display: block; width: 100%; }
  .fc-table thead { display: none; }
  .fc-table tr { margin-bottom: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-elevated); }
  .fc-table td { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 0; }
  .fc-table td::before { content: attr(data-label); grid-column: 1; color: var(--muted); font-size: 12px; }
  .fc-table td > * { grid-column: 2; min-width: 0; }
  .fc-table td > .fc-badge, .fc-table td > .fc-chip, .fc-table td > button, .fc-table td > input { justify-self: start; }
  .fc-table td .fc-badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .fc-table td.fc-check { grid-template-columns: minmax(96px, 38%) auto; }
  .fc-table td.fc-empty { display: block; }
  .fc-table td.fc-empty::before { content: none; }
}
