﻿/* Shared portal identity. Load after legacy and page-specific styles.
   Page layouts, semantic status colours and permission/visibility rules stay local. */
:root {
  --ui-bg: #f3f5f8;
  --ui-surface: #fff;
  --ui-soft: #f8fafc;
  --ui-border: #dfe5ed;
  --ui-ink: #0f172a;
  --ui-muted: #475569;
  --ui-primary: #c1121f;
  --ui-focus: #2563eb;
  --ui-selection: #eaf3ff;
  --ui-radius: 14px;
  --ui-shadow: 0 3px 12px rgba(15,23,42,.04);
  --tear-red: var(--ui-primary);
  --shadow: var(--ui-shadow);
  color-scheme: light;
}
.nf-details textarea.readonly-wrap { font-family: inherit; transition: none; box-sizing: border-box; width: 100%; height: 44px; min-height: 44px; padding: 10px 12px; resize: none; overflow: hidden; line-height: 1.5; overflow-wrap: anywhere; background: #f1f4f8; color: #475569; }
/* Keep the recorded verdict legible even when native radios are disabled. */
body[data-page="sac_novo"] .selection-option:has(input[name="reclamacao-procedente"]:checked) {
  background: #fff1f2;
  border-color: #be123c;
  box-shadow: inset 0 0 0 1px #be123c;
  color: #881337;
}
body[data-page="sac_novo"] input[name="reclamacao-procedente"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid #64748b;
  border-radius: 50%;
  background: #fff;
  opacity: 1;
}
body[data-page="sac_novo"] input[name="reclamacao-procedente"]:checked {
  border-color: #be123c;
  background: #be123c;
  box-shadow: inset 0 0 0 3px #fff;
}
body[data-page="sac_novo"] input[name="reclamacao-procedente"]:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 3px;
}
body[data-page="sac_novo"] .selection-option:has(input[name="reclamacao-procedente"]:disabled) {
  cursor: default;
}
@media (forced-colors: active) {
  body[data-page="sac_novo"] input[name="reclamacao-procedente"] {
    appearance: auto;
    -webkit-appearance: auto;
  }
  body[data-page="sac_novo"] .selection-option:has(input[name="reclamacao-procedente"]:checked) {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }
}
body { background: var(--ui-bg); color: var(--ui-ink); }
body::before, body::after { display: none; }
body:not([data-page="home"]) .page-wrapper { max-width: 1400px; padding: 28px 24px 48px; }
body:not([data-page="home"]) .topbar {
  padding: 18px 22px; border: 1px solid var(--ui-border); border-top: 3px solid var(--ui-primary);
  border-radius: var(--ui-radius); background: var(--ui-surface); box-shadow: var(--ui-shadow);
}
body:not([data-page="home"]) .topbar .brand { flex-wrap: nowrap; gap: 18px; min-width: 0; }
body:not([data-page="home"]) .topbar .brand-logo { height: 48px; flex-shrink: 0; }
body:not([data-page="home"]) .topbar .brand-logo img { display: block; width: auto; height: 48px; }
body:not([data-page="home"]) .topbar .home-hero { gap: 4px; min-width: 0; }
body:not([data-page="home"]) .topbar h1 { font-size: clamp(20px,2vw,24px); font-weight: 650; line-height: 1.3; letter-spacing: -.4px; }
body:not([data-page="home"]) .topbar .home-hero small { color: var(--ui-muted); font-size: 13px; line-height: 1.5; }
.portal-user { display: flex; flex-direction: column; gap: 2px; margin-right: 8px; max-width: 180px; overflow-wrap: anywhere; }
.portal-user > span { color: var(--ui-muted); font-size: 12px; }
.portal-user strong { font-size: 14px; font-weight: 600; color: #334155; }
.topbar > .actions { gap: 8px; }
.topbar a.btn { text-decoration: none; }
body:not([data-page="home"]) .card { min-height: 0; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); backdrop-filter: none; }
.panel-title { color: var(--ui-ink); font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
.muted, .field-help, .action-hint { color: var(--ui-muted); line-height: 1.6; }
.btn { min-height: 42px; border-radius: 9px; font-size: 14px; line-height: 1.4; }
.btn.btn-primary { background: var(--ui-primary); border: 1px solid var(--ui-primary); color: #fff; box-shadow: 0 2px 4px rgba(193,18,31,.1); }
.btn.btn-primary:hover { background: #a60f1b; border-color: #a60f1b; box-shadow: 0 3px 8px rgba(193,18,31,.12); filter: none; transform: none; }
.btn.btn-secondary, .btn.btn-ghost { background: var(--ui-surface); border: 1px solid #cbd5e1; color: #334155; box-shadow: none; }
.btn.btn-secondary:hover, .btn.btn-ghost:hover { background: var(--ui-soft); border-color: #94a3b8; transform: none; filter: none; }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { box-shadow: none; transform: none; }
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.input, select, textarea { border-color: #d4dce6; border-radius: 9px; color: #1e293b; background-color: var(--ui-surface); font-size: 14px; }
.input, select { min-height: 42px; }
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ui-focus); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.input[readonly], .input:disabled, select:disabled, textarea:disabled { background-color: #f1f4f8; color: #475569; }
.input-eye .btn.icon-btn, .input-eye .btn.icon-btn:hover { border: 0; background: transparent; transform: translateY(-50%); box-shadow: none; }
[aria-invalid="true"]:focus { border-color: #b91c1c; box-shadow: 0 0 0 3px rgba(185,28,28,.1); }
.tab-bar { gap: 8px; border-color: var(--ui-border); }
button.tab { border-radius: 9px; color: #475569; border-color: var(--ui-border); background: #fff; font-size: 14px; }
body[data-page="sac_novo"] button.tab { font-weight: 700; }
body[data-page="sac_novo"] .nf-actions { display: flex; gap: 10px; flex-wrap: wrap; }
body[data-page="sac_novo"] :is(#btnValidar, #btnConsultarNf, #btnRomaneio) { box-sizing: border-box; flex: 0 0 200px; width: 200px; min-width: 200px; height: 44px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
@media (max-width: 960px) {
  body[data-page="sac_novo"] :is(#btnValidar, #btnConsultarNf, #btnRomaneio) { flex-basis: 100%; width: 100%; min-width: 0; }
}
body[data-page="sac_novo"] #btnConsultarNf { background: #1d4ed8; border-color: #1d4ed8; box-shadow: 0 2px 4px rgba(29,78,216,.1); }
body[data-page="sac_novo"] #btnConsultarNf:hover { background: #1e40af; border-color: #1e40af; box-shadow: 0 3px 8px rgba(29,78,216,.12); }
body[data-page="sac_novo"] #btnRomaneio { background: #047857; border-color: #047857; color: #fff; box-shadow: 0 2px 4px rgba(4,120,87,.1); }
body[data-page="sac_novo"] #btnRomaneio:hover { background: #065f46; border-color: #065f46; box-shadow: 0 3px 8px rgba(4,120,87,.12); }
body[data-page="sac_novo"] #btnConsultarNf:disabled ,

body[data-page="sac_novo"] #btnRomaneio:disabled { background: #f1f5f9; border-color: #dfe5ed; color: #94a3b8; box-shadow: none; opacity: 1; cursor: not-allowed; }
body[data-page="sac_novo"] .pedido-field-actions { display: flex; align-items: stretch; gap: 10px; }
body[data-page="sac_novo"] .pedido-field-actions #pedido { flex: 1 1 120px; width: 0; min-width: 70px; }
body[data-page="sac_novo"] #btnConsultarPedido { flex: 0 0 auto; padding: 10px 16px; min-height: 40px; border-radius: 9px; background: #1d4ed8; border-color: #1d4ed8; color: #fff; font: 700 13px "Segoe UI", Arial, sans-serif; white-space: nowrap; box-shadow: 0 2px 4px rgba(29,78,216,.1); }
body[data-page="sac_novo"] #btnConsultarPedido:hover { background: #1e40af; border-color: #1e40af; }
body[data-page="sac_novo"] #btnConsultarPedido:disabled { background: #f1f5f9; border-color: #dfe5ed; color: #94a3b8; box-shadow: none; opacity: 1; cursor: not-allowed; }
.pedido-dialog { box-sizing: border-box; width: min(1320px, calc(100vw - 40px)); max-width: calc(100vw - 40px); height: min(92dvh, 1120px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #dfe5ed; border-radius: 16px; background: #f8fafc; color: #0f172a; box-shadow: 0 24px 70px rgba(15,23,42,.25); font: 14px/1.5 "Segoe UI", Arial, sans-serif; overflow: hidden; }
.pedido-dialog[open] { display: flex; flex-direction: column; }
.pedido-dialog::backdrop { background: rgba(15,23,42,.55); }
.pedido-dialog [hidden] { display: none !important; }
.pedido-dialog *, .pedido-dialog *::before, .pedido-dialog *::after { box-sizing: border-box; }
.pedido-heading { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; gap: 20px; padding: 24px 26px 20px; border-bottom: 1px solid #e2e8f0; background: linear-gradient(110deg,#fff 65%,#f8fafc); }
.pedido-heading > div { min-width: 0; }
.pedido-heading-main { flex: 1; }
.pedido-identity { display: flex; align-items: center; gap: 15px; }
.pedido-identity > div { min-width: 0; }
.pedido-document-icon { display: grid; place-items: center; flex: 0 0 52px; width: 52px; height: 60px; border: 1px solid #fecdd3; border-radius: 13px; color: #be123c; background: #fff1f2; }
.pedido-document-icon svg { width: 27px; height: 27px; }
.pedido-eyebrow { color: #9f1239; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pedido-heading h2 { margin: 4px 0 5px; font-size: 28px; line-height: 1.2; letter-spacing: -.5px; color: #0f172a; }
.pedido-heading .pedido-modal-subtitle { margin: 0; color: #475569; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.pedido-heading-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 17px; padding-top: 14px; border-top: 1px solid #edf2f7; }
.pedido-reference { display: inline-flex; align-items: center; color: #475569; font-size: 12px; font-weight: 600; }
.pedido-reference:empty { display: none; }
.pedido-heading .pedido-close { flex-shrink: 0; padding: 9px 18px; border-radius: 9px; font: 600 13px "Segoe UI", Arial, sans-serif; }
.pedido-statuses { display: flex; flex-wrap: wrap; gap: 7px; }
.pedido-heading .pedido-statuses { padding-left: 12px; border-left: 1px solid #e2e8f0; }
.pedido-badge { display: inline-flex; align-items: center; border: 1px solid #cbd5e1; border-radius: 20px; padding: 3px 9px; color: #475569; background: #f8fafc; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pedido-badge.is-success { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.pedido-badge.is-danger { color: #be123c; border-color: #fecdd3; background: #fff1f2; }
.pedido-body { min-height: 0; min-width: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 22px 26px; }
.pedido-loading { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: #64748b; }
.pedido-loading strong { font-size: 17px; color: #0f172a; }
.pedido-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; margin-bottom: 22px; }
.pedido-summary-group { min-width: 0; }
.pedido-summary-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.pedido-summary-heading h3 { margin: 0; color: #334155; font-size: 12px; font-weight: 650; }
.pedido-summary-heading > span { color: #64748b; font-size: 11px; }
.pedido-summary-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.pedido-metric { min-width: 0; padding: 15px; border: 1px solid #dfe5ed; border-radius: 12px; background: #fff; box-shadow: 0 2px 5px rgba(15,23,42,.025); }
.pedido-metric span { display: block; min-height: 30px; color: #64748b; font-size: 12px; line-height: 15px; }
.pedido-metric strong { display: block; margin-top: 5px; color: #0f172a; font-size: clamp(16px, 1.8vw, 24px); line-height: 1.3; letter-spacing: -.4px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pedido-metric.is-balanced { background: #ecfdf5; border-color: #a7f3d0; box-shadow: none; }
.pedido-metric.is-balanced strong { color: #047857; }
.pedido-metric.is-open { background: #eff6ff; border-color: #bfdbfe; }
.pedido-metric.is-open strong { color: #1d4ed8; }
.pedido-metric.is-negative { background: #fffbeb; border-color: #fde68a; }
.pedido-metric.is-negative strong { color: #92400e; }
.pedido-tabs { display: flex; gap: 6px; margin: 0 0 18px; padding-bottom: 9px; border-bottom: 1px solid #dbe5f1; }
.pedido-tabs button { padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; color: #475569; background: transparent; font: 600 13px "Segoe UI", Arial, sans-serif; cursor: pointer; }
.pedido-tabs button[aria-selected="true"] { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.pedido-tabs button:focus-visible, .pedido-dialog .pedido-table-scroll:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.pedido-section { margin-bottom: 16px; padding: 20px; border: 1px solid #dbe5f1; border-radius: 12px; background: #fff; }
.pedido-section h3 { margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid #edf2f7; font-size: 15px; font-weight: 700; color: #0f172a; }
.pedido-section h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: #64748b; }
.pedido-section p { margin: 0 0 12px; color: #64748b; font-size: 12px; }
.pedido-info-card { box-shadow: 0 2px 8px rgba(15,23,42,.025); }
.pedido-section .pedido-section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 13px; font-size: 15px; font-weight: 650; }
.pedido-section-icon { flex: 0 0 30px; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #dbe5f1; border-radius: 8px; color: #475569; background: #f8fafc; }
.pedido-section-icon svg { width: 18px; height: 18px; }
.pedido-data-grid { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: 14px 22px; margin: 0; }
.pedido-data-grid > div { min-width: 0; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.pedido-data-grid > .pedido-span-2 { grid-column: span 2; }
.pedido-data-grid > .pedido-span-3 { grid-column: span 3; }
.pedido-data-grid > .pedido-span-4 { grid-column: span 4; }
.pedido-data-grid dt { min-height: 18px; color: #64748b; font-size: 12px; line-height: 18px; margin-bottom: 5px; }
.pedido-data-grid dd { margin: 0; font-size: 13px; line-height: 20px; font-weight: 500; color: #1e293b; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pedido-data-grid dd.is-empty { color: #94a3b8; font-weight: 400; }
.pedido-data-grid .pedido-span-4 dd:not(.is-empty) { font-weight: 600; }
.pedido-control-list { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 0; }
.pedido-control { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.pedido-control dt { color: #475569; font-size: 12px; line-height: 18px; }
.pedido-control dd { margin: 0; }
.pedido-control .pedido-badge { min-width: 45px; justify-content: center; padding: 4px 10px; background: #fff; }
.pedido-control .pedido-badge.is-enabled { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.pedido-control .pedido-badge.is-success { background: #ecfdf5; }
.pedido-control .pedido-badge.is-danger { background: #fff1f2; }
.pedido-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pedido-note-box { min-width: 0; padding: 15px 16px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.pedido-note-box h4 { margin-bottom: 8px; color: #475569; font-size: 12px; font-weight: 600; }
.pedido-note-box p { margin: 0; line-height: 1.65; }
.pedido-note-box p.is-empty { color: #94a3b8 !important; font-weight: 400; }
.pedido-notes p, .pedido-prewrap { white-space: pre-wrap; overflow-wrap: anywhere; color: #334155 !important; font-size: 13px !important; }
.pedido-table-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.pedido-table-heading h3 { margin-bottom: 6px; }
.pedido-search-label { color: #64748b; font-size: 11px; flex-shrink: 0; }
.pedido-search-label input { display: block; margin-top: 4px; width: 260px; font: 13px "Segoe UI", Arial, sans-serif; }
.pedido-items-card .pedido-table-heading { align-items: center; gap: 22px; padding-bottom: 16px; margin-bottom: 13px; border-bottom: 1px solid #edf2f7; }
.pedido-items-card .pedido-table-heading > div { min-width: 0; }
.pedido-items-card .pedido-section-title { border: 0; padding-bottom: 0; margin-bottom: 8px; }
.pedido-items-card .pedido-table-heading p { margin: 0; line-height: 1.6; }
.pedido-items-card .pedido-search-label { color: #475569; font-size: 12px; }
.pedido-search-control { display: block; position: relative; margin-top: 6px; }
.pedido-search-control svg { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; color: #64748b; transform: translateY(-50%); pointer-events: none; }
.pedido-items-card .pedido-search-control input { width: 280px; margin: 0; padding-left: 36px; min-height: 42px; border-radius: 9px; background: #f8fafc; }
.pedido-items-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 12px; }
.pedido-items-meta p { margin: 0; font-size: 11px; }
.pedido-items-meta .pedido-item-count { flex-shrink: 0; border-radius: 6px; padding: 4px 9px; background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.pedido-items-card .pedido-table thead { position: sticky; top: 0; z-index: 2; }
.pedido-items-card .pedido-table th { position: static; padding: 9px 10px; font-size: 11px; }
.pedido-items-card .pedido-table td { padding: 12px 10px; }
.pedido-items-card .pedido-table .pedido-col-product { min-width: 150px; }
.pedido-items-card .pedido-table .pedido-col-classification { min-width: 135px; max-width: 160px; }
.pedido-items-card .pedido-table .pedido-quantity-group { background: #edf4ff; color: #1e40af; border-inline: 1px solid #dbe5f1; }
.pedido-items-card .pedido-table .pedido-value-group { background: #eef8f5; color: #065f46; border-inline: 1px solid #dbe5f1; }
.pedido-items-card .pedido-table .is-group-start { border-left: 1px solid #e2e8f0; }
.pedido-items-card .pedido-table .pedido-value-total { color: #0f172a; font-weight: 600; }
.pedido-items-card .pedido-table .pedido-document-group { background: #f1f5f9; color: #334155; border-inline: 1px solid #dbe5f1; }
.pedido-invoice-counts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pedido-items-meta .pedido-distinct-count { color: #475569; background: #f1f5f9; }
.pedido-document-number { display: inline-block; padding: 3px 7px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; color: #0f172a; font-weight: 650; font-variant-numeric: tabular-nums; }
.pedido-invoices-card .pedido-table .is-date { min-width: 90px; }
.pedido-invoices-card .pedido-table td.is-empty { color: #94a3b8; }
.pedido-table-scroll { max-width: 100%; overflow: auto; max-height: 58vh; border: 1px solid #e2e8f0; border-radius: 9px; }
.pedido-dialog .pedido-table { border-collapse: collapse; width: 100%; margin: 0; font-size: 12px; }
.pedido-table th { position: sticky; top: 0; z-index: 1; padding: 12px; background: #f1f5f9; color: #475569; text-align: left; vertical-align: middle; font-size: 12px; line-height: 18px; font-weight: 600; border-bottom: 1px solid #dbe5f1; white-space: nowrap; }
.pedido-table td { padding: 12px; border-bottom: 1px solid #edf2f7; color: #334155; text-align: left; line-height: 18px; vertical-align: middle; white-space: nowrap; }
.pedido-table tr:last-child td { border-bottom: 0; }
.pedido-table tbody tr:nth-child(even) { background: #f8fafc; }
.pedido-table tbody tr:hover { background: #eff6ff; }
.pedido-dialog .pedido-table .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.pedido-dialog .pedido-table :is(.is-center, .is-date) { text-align: center; font-variant-numeric: tabular-nums; }
.pedido-dialog .pedido-table .pedido-col-product { min-width: 165px; max-width: 250px; white-space: normal; }
.pedido-dialog .pedido-table .pedido-col-classification { min-width: 160px; max-width: 190px; white-space: normal; }
.pedido-cell-subtitle { display: block; margin-top: 3px; color: #64748b; font-size: 11px; }
.pedido-empty { text-align: center; color: #64748b; padding: 30px !important; }
.pedido-warning, .pedido-error { padding: 14px 16px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e; font-size: 13px; }
.pedido-error { border-color: #fecdd3; background: #fff1f2; color: #be123c; }
.pedido-footer { flex-shrink: 0; padding: 11px 26px; border-top: 1px solid #e2e8f0; background: #fff; color: #64748b; font-size: 11px; }
@media (max-width: 1000px) {
  .pedido-summary { grid-template-columns: 1fr; gap: 16px; }
  .pedido-data-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pedido-data-grid > :is(.pedido-span-2, .pedido-span-3) { grid-column: span 1; }
  .pedido-data-grid > .pedido-span-4 { grid-column: span 2; }
  .pedido-control-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .pedido-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .pedido-heading, .pedido-body { padding: 16px; }
  .pedido-heading h2 { font-size: 22px; }
  .pedido-heading { gap: 10px; }
  .pedido-document-icon { display: none; }
  .pedido-heading-meta { gap: 9px; margin-top: 12px; padding-top: 10px; }
  .pedido-heading .pedido-statuses { padding-left: 0; border-left: 0; }
  .pedido-heading .pedido-close { padding: 8px 12px; }
  .pedido-summary { grid-template-columns: 1fr; gap: 14px; }
  .pedido-summary-cards { gap: 7px; }
  .pedido-metric { padding: 10px 8px; }
  .pedido-tabs { gap: 0; }
  .pedido-tabs button { flex: 1; padding: 9px 5px; font-size: 11px; }
  .pedido-section { padding: 14px; }
  .pedido-data-grid { gap: 16px; }
  .pedido-notes { grid-template-columns: 1fr; gap: 12px; }
  .pedido-table-heading { flex-direction: column; gap: 4px; }
  .pedido-search-label, .pedido-search-label input { width: 100%; }
  .pedido-items-card .pedido-search-control input { width: 100%; }
  .pedido-items-card .pedido-table-heading { align-items: stretch; gap: 14px; }
  .pedido-items-meta { align-items: flex-start; }
  .pedido-footer { padding: 10px 16px; font-size: 10px; }
}
@media (max-width: 380px) {
  .pedido-control-list { grid-template-columns: 1fr; }
}
.nf-danfe-dialog { box-sizing: border-box; width: min(1180px, calc(100vw - 40px)); max-width: calc(100vw - 40px); height: min(92dvh, 1100px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #dfe5ed; border-radius: 16px; background: #fff; color: #0f172a; box-shadow: 0 24px 70px rgba(15,23,42,.25); font-family: "Segoe UI", Arial, sans-serif; overflow: hidden; }
.nf-danfe-dialog[open] { display: flex; flex-direction: column; }
.nf-danfe-dialog::backdrop { background: rgba(15,23,42,.55); }
.nf-danfe-dialog [hidden] { display: none !important; }
.danfe-heading { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.danfe-eyebrow { color: #9f1239; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.danfe-heading h2 { margin: 4px 0; font-size: 24px; line-height: 1.25; font-weight: 650; }
.danfe-heading p { margin: 0; color: #475569; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.danfe-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.danfe-actions .btn { font: inherit; font-size: 12px; font-weight: 600; min-height: 40px; text-decoration: none; white-space: nowrap; }
.nf-danfe-dialog .danfe-actions .danfe-download { background: #1d4ed8; border-color: #1d4ed8; color: #fff; box-shadow: none; }
.nf-danfe-dialog .danfe-actions .danfe-download:hover { background: #1e40af; border-color: #1e40af; }
.danfe-toolbar { flex: 0 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 22px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.danfe-toolbar > div { display: flex; align-items: center; gap: 8px; }
.danfe-toolbar span { font-size: 12px; color: #475569; min-width: 45px; text-align: center; font-variant-numeric: tabular-nums; }
.danfe-toolbar button { min-width: 36px; min-height: 36px; border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 7px; padding: 6px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.danfe-toolbar button:disabled { color: #94a3b8; cursor: default; }
.nf-danfe-dialog button:focus-visible, .nf-danfe-dialog a:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.danfe-feedback { flex: 0 0 auto; margin: 0; padding: 8px 22px; color: #475569; font-size: 12px; line-height: 1.5; }
.nf-danfe-dialog .danfe-feedback.is-ready { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.danfe-feedback.is-error { color: #9f1239; background: #fff1f2; padding-block: 14px; }
.danfe-viewport { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; scrollbar-width: auto; padding: 20px; background: #e9eef4; text-align: center; }
.danfe-viewport::-webkit-scrollbar { display: block; width: 12px; height: 12px; }
.danfe-viewport::-webkit-scrollbar-thumb { background: #94a3b8; border: 3px solid #e9eef4; border-radius: 8px; }
.danfe-viewport:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.danfe-page-image { display: block; box-sizing: border-box; width: 100%; max-width: none; height: auto; margin: 0 auto; box-shadow: 0 3px 16px #0f172a20; background: #fff; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; touch-action: pan-x pan-y; }
.danfe-viewport.is-panning, .danfe-viewport.is-panning .danfe-page-image { cursor: grabbing; }
.danfe-loading { height: 100%; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 13px; color: #64748b; }
.danfe-loading strong { color: #334155; font-size: 15px; font-weight: 600; }
.danfe-spinner { width: 32px; height: 32px; border: 3px solid #cbd5e1; border-top-color: #b40f24; border-radius: 50%; animation: danfe-spin .9s linear infinite; }
.danfe-footer { flex: 0 0 auto; padding: 10px 22px; border-top: 1px solid #e2e8f0; font-size: 11px; color: #64748b; line-height: 1.5; }
@keyframes danfe-spin { to { transform: rotate(360deg); } }
@media(max-width:700px) {
  .nf-danfe-dialog { width: calc(100vw - 16px); max-width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .danfe-heading { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
  .danfe-heading h2 { font-size: 20px; }
  .danfe-actions { justify-content: flex-start; }
  .danfe-actions .btn { min-height: 40px; padding: 8px 10px; }
  .danfe-toolbar { padding: 6px 14px; }
  .danfe-toolbar > div { gap: 5px; }
  .danfe-toolbar button { min-height: 40px; }
  .danfe-feedback { padding: 6px 14px; }
  .danfe-viewport { padding: 10px; }
  .danfe-footer { padding: 8px 14px; font-size: 10px; }
}
@media(prefers-reduced-motion:reduce) { .danfe-spinner { animation: none; } }
button.tab.active { background: #fff1f2; color: #9f1239; border-color: #e9b9c1; box-shadow: none; }
body[data-representative="true"]:not([data-mode="view"]) .tab[data-target="tab-parecer"],
body[data-representative="true"]:not([data-mode="view"]) .tab[data-target="tab-outras"],
body[data-representative="true"]:not([data-mode="view"]) #tab-parecer,
body[data-representative="true"]:not([data-mode="view"]) #tab-outras { display: none; }
.table-panel { border-color: var(--ui-border); border-radius: 12px; background: var(--ui-surface); }
.table-panel header, .table-panel.compact header { background: var(--ui-soft); color: #334155; border-bottom: 1px solid #e2e8f0; font-size: 14px; padding: 12px 14px; }
th { background: var(--ui-soft); color: #475569; }
.sac-table tbody tr.is-selected, .sac-table tbody tr.selected { background: var(--ui-selection); outline: none; }
.sac-table tbody tr.is-selected td, .sac-table tbody tr.selected td { background: var(--ui-selection); color: #1e293b; }
.sac-table tbody tr.is-selected td:first-child, .sac-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--ui-focus); }
.sac-table tr[tabindex]:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
.table-footer { background: var(--ui-surface); border-color: var(--ui-border); }
.sac-filter-side .selection-box { background: var(--ui-soft); border-color: var(--ui-border); border-radius: 12px; }
/* Search filters share one type scale and control height, including dates. */
.sac-consultar .filters-title { font-size: 17px; line-height: 1.5; font-weight: 650; letter-spacing: -.2px; }
.sac-consultar .filters-title::before { width: 8px; height: 8px; border-radius: 3px; background: var(--ui-primary); box-shadow: none; }
.sac-consultar .sac-filter-form { font-family: "Segoe UI",Arial,sans-serif; font-size: 14px; }
.sac-consultar .sac-filter-form .sac-filter-grid { gap: 22px 24px; align-items: start; }
.sac-consultar .sac-filter-form .field-help { margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: 9px; background: var(--ui-soft); color: var(--ui-muted); font-size: 13px; line-height: 1.6; }
.sac-consultar .sac-filter-form .range-field > label { display: block; margin: 0 0 8px; color: #334155; font-size: 13px; line-height: 20px; font-weight: 600; letter-spacing: 0; }
.sac-consultar .sac-filter-form .range-inline { gap: 10px; align-items: end; }
.sac-consultar .sac-filter-form .range-cell { gap: 6px; }
.sac-consultar .sac-filter-form .range-label { color: #64748b; font-size: 12px; line-height: 18px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.sac-consultar .sac-filter-form .range-cell .input { width: 100%; height: 44px; min-height: 44px; padding: 10px 12px; border-radius: 9px; font-family: inherit; font-size: 14px; font-weight: 400; line-height: 22px; font-variant-numeric: tabular-nums; }
.sac-consultar .sac-filter-form input::placeholder { color: #94a3b8; opacity: 1; font-family: inherit; font-size: inherit; font-weight: 400; }
.sac-consultar .sac-filter-form input[type="date"]::-webkit-datetime-edit { font: inherit; padding: 0; }
.sac-consultar .sac-filter-form .range-sep { height: 44px; margin: 0; padding: 0 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #64748b; font-size: 12px; line-height: 20px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.sac-consultar .sac-filter-form .advanced-filters { margin-top: 8px; padding: 6px 18px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-soft); }
.sac-consultar .sac-filter-form .advanced-filters[open] { padding-bottom: 18px; background: #fff; }
.sac-consultar .sac-filter-form .advanced-filters > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 0; color: #334155; font-size: 14px; line-height: 22px; font-weight: 600; list-style: none; }
.sac-consultar .sac-filter-form .advanced-filters > summary::-webkit-details-marker { display: none; }
.sac-consultar .sac-filter-form .advanced-filters > summary::after { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-right: 1.5px solid #64748b; border-bottom: 1.5px solid #64748b; transform: rotate(45deg); margin-right: 3px; }
.sac-consultar .sac-filter-form .advanced-filters[open] > summary::after { transform: rotate(225deg); }
.sac-consultar .sac-filter-form .advanced-filters[open] > .sac-filter-grid { margin-top: 14px; }
.sac-consultar .sac-filter-form .selection-title { color: #334155; font-size: 13px; line-height: 20px; font-weight: 600; }
.sac-consultar .sac-filter-form .selection-option { font-size: 13px; line-height: 20px; }
.sac-consultar .sac-filter-form .selection-option span { font-weight: 500; }
.sac-consultar .sac-filter-actions { justify-content: flex-end; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--ui-border); }
.sac-consultar .sac-filter-actions .btn { min-height: 44px; padding: 10px 20px; font-size: 14px; font-weight: 600; }
@media (max-width: 720px) {
  .sac-consultar .sac-filter-form .range-cell .input { font-size: 16px; }
  .sac-consultar .sac-filter-form .advanced-filters { padding-left: 14px; padding-right: 14px; }
}
.sac-action-bar { background: var(--ui-soft); border-color: var(--ui-border); border-radius: 12px; }
.sac-action-bar .action-btn { border-radius: 10px; box-shadow: none; }
.action-btn:not(:hover):not(:focus-visible) .action-tooltip { display: none; }
.action-btn .action-tooltip { background: #fff; color: #334155; border-color: var(--ui-border); box-shadow: 0 8px 24px rgba(15,23,42,.12); }
.sac-summary, .nf-details { background: var(--ui-soft); border-color: var(--ui-border); }
.sac-summary {
  padding: 0; overflow: hidden; background: var(--ui-surface);
  border: 1px solid var(--ui-border); border-radius: 12px;
}
.sac-summary dl {
  display: grid; grid-template-columns: minmax(140px,.8fr) minmax(0,2.4fr) minmax(130px,1fr) minmax(150px,1fr);
  gap: 0; padding: 16px 22px; margin: 0; align-items: start;
}
.sac-summary dl > div { min-width: 0; padding: 0 22px; border-left: 1px solid var(--ui-border); }
.sac-summary dl > div:first-child { padding-left: 0; border-left: 0; }
.sac-summary dl > div:last-child { padding-right: 0; }
.sac-summary dt { color: #64748b; font-size: 12px; line-height: 1.5; margin: 0 0 7px; }
.sac-summary dd { color: var(--ui-ink); font-size: 15px; font-weight: 600; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.sac-summary [data-summary-field="sac-numero"] { color: #9f1239; font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.sac-summary [data-summary-field="nf"], .sac-summary [data-summary-field="data-implantacao"] { font-variant-numeric: tabular-nums; }
.sac-summary-footer { padding: 8px 22px; border-top: 1px solid #edf0f5; background: var(--ui-soft); }
.sac-summary .sac-step-status { display: flex; align-items: baseline; gap: 9px; margin: 0; color: #475569; font-size: 12px; line-height: 1.6; font-weight: 500; }
.sac-summary .sac-step-status::before { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-primary); align-self: center; }
@media (max-width: 760px) {
  .sac-summary dl { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px 16px; row-gap: 16px; }
  .sac-summary dl > div { padding: 0 0 0 16px; }
  .sac-summary dl > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .sac-summary dd { font-size: 14px; }
  .sac-summary-footer { padding: 8px 16px; }
}
.view-mode-banner { border-radius: 10px; background: #eff6ff; color: #1e40af; box-shadow: none; border: 1px solid #bfdbfe; }
.edit-mode-banner { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.sac-mode-strip { display: none; align-items: center; gap: 12px; padding: 12px 18px; margin-bottom: 12px; border: 1px solid var(--ui-border); border-radius: 12px; background: var(--ui-soft); }
body[data-mode="view"] .sac-mode-strip-view, body[data-mode="edit"] .sac-mode-strip-edit { display: flex; }
.sac-mode-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border: 1px solid #dbeafe; border-radius: 11px; background: #eff6ff; color: #2563eb; }
.sac-mode-icon svg { width: 22px; height: 22px; }
.sac-mode-strip-edit .sac-mode-icon { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.sac-mode-copy { min-width: 0; flex: 1; }
.sac-mode-strip .view-mode-banner { padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--ui-ink); box-shadow: none; text-align: left; font-size: 15px; font-weight: 650; line-height: 1.5; }
.sac-mode-copy p { margin: 3px 0 0; color: #64748b; font-size: 12px; line-height: 1.5; }
.sac-mode-strip .legend-items { margin: 0; justify-content: flex-end; }
body[data-page="sac_novo"] .sac-mode-strip .legend-item { gap: 7px; border: 1px solid #dfe5ed; padding: 6px 11px; font-size: 12px; font-weight: 600; letter-spacing: 0; line-height: 1.5; text-align: left; }
.sac-mode-strip .legend-item::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.sac-mode-strip .status-aberta { background: #fff1f2; border-color: #fecdd3 !important; color: #9f1239; }
.sac-mode-strip .status-parecer { background: #ecfdf5; border-color: #a7f3d0 !important; color: #065f46; }
.sac-mode-strip .status-concluida { background: #eff6ff; border-color: #bfdbfe !important; color: #1d4ed8; }
@media (max-width: 600px) {
  .sac-mode-strip { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .sac-mode-strip .legend-items { flex-basis: 100%; justify-content: flex-start; padding-left: 50px; min-width: 0; box-sizing: border-box; }
}
.problem-picker { position: relative; min-width: 0; }
.problem-native { display: none; }
.problem-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 44px; padding: 11px 14px; border: 1px solid #d4dce6; border-radius: 9px; background: #fff; color: #1e293b; text-align: left; font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer; }
.problem-trigger::after { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border: solid #64748b; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin: -4px 3px 0; }
.problem-trigger[aria-expanded="true"] { border-color: var(--ui-focus); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.problem-trigger[aria-expanded="true"]::after { transform: rotate(225deg); margin-top: 4px; }
.problem-trigger:disabled { background: #f1f4f8; color: #475569; cursor: not-allowed; }
.problem-popup { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; padding: 8px; background: #fff; border: 1px solid #d4dce6; border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.14); }
.problem-popup[hidden], .problem-empty[hidden] { display: none; }
.problem-popup .problem-search { box-sizing: border-box; width: 100%; min-height: 40px; margin-bottom: 6px; padding: 9px 12px; border: 1px solid #d4dce6; border-radius: 8px; background: #f8fafc; font: inherit; font-size: 13px; }
.problem-popup .problem-search:focus { outline: none; border-color: var(--ui-focus); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.problem-list { max-height: min(280px,40vh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.problem-option { display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 2px 0; border-radius: 7px; color: #334155; font-size: 14px; line-height: 1.5; cursor: pointer; }
.problem-option:hover { background: #f1f5f9; }
.problem-option[aria-selected="true"], .problem-option:focus { background: var(--ui-selection); color: #1e40af; }
.problem-option:focus { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
.problem-code { display: inline-flex; justify-content: center; min-width: 28px; padding: 2px 5px; border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; font-size: 12px; color: #64748b; font-variant-numeric: tabular-nums; }
.problem-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.problem-check { width: 16px; color: #2563eb; font-weight: 700; }
.problem-empty { margin: 0; padding: 16px 10px; color: #64748b; font-size: 13px; }
.item-desc { border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-soft); }
.attachment-card, .docs-modal { border-color: var(--ui-border); border-radius: 12px; box-shadow: var(--ui-shadow); }
.attachment-box { padding: 16px; border: 1px solid #ead5da; border-radius: 12px; background: linear-gradient(135deg,#fffafb,#fff); box-shadow: 0 2px 8px rgba(15,23,42,.03); }
.attachment-box .attachment-header { gap: 14px; margin-bottom: 14px; }
.attachment-box .field-label { margin-bottom: 5px; }
.attachment-box .attachment-header .muted { font-size: 12px; color: #64748b; }
.attachment-box #btnAdicionarImagem { display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 16px; }
.attachment-box #btnAdicionarImagem svg { width: 19px; height: 19px; flex-shrink: 0; }
.attachment-box .attachment-list.empty { display: grid; place-items: center; min-height: 96px; padding: 18px; border: 1px dashed #d9b9c2; background: rgba(255,255,255,.8); box-sizing: border-box; }
.attachment-empty-content { display: flex; align-items: center; justify-content: center; gap: 14px; text-align: left; }
.attachment-empty-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 1px solid #f5dce2; border-radius: 12px; background: #fff1f2; color: #a61b35; }
.attachment-empty-icon svg { width: 24px; height: 24px; }
.attachment-empty-content strong { color: #334155; font-size: 13px; font-weight: 600; line-height: 1.5; }
.attachment-empty-content p { margin: 4px 0 0; color: #64748b; font-size: 12px; line-height: 1.5; }
@media (max-width: 600px) {
  .attachment-box { padding: 14px; }
  .attachment-box .attachment-actions { width: 100%; flex-wrap: wrap; }
  .attachment-box #btnAdicionarImagem { width: 100%; }
  .attachment-box .attachment-list.empty { padding: 16px 12px; }
  .attachment-empty-content { gap: 10px; }
}
.modal-backdrop, .backlog-modal, .rec-modal { background: rgba(15,23,42,.42); backdrop-filter: blur(2px); }
.modal, .system-alert-backdrop .modal, .docs-modal, .backlog-modal-card, .rec-modal-card, #uf-details-dialog {
  background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15,23,42,.18); backdrop-filter: none;
}
.modal h3, .modal h4, .settings-modal-backdrop .modal h4 { color: var(--ui-ink); }
.settings-wa-hero { background: var(--ui-soft); color: var(--ui-ink); border-bottom: 1px solid var(--ui-border); }
.settings-wa-hero .settings-wa-title { color: var(--ui-ink); }
.settings-wa-hero .settings-wa-sub { color: var(--ui-muted); }
.settings-wa-shell, .settings-modal-backdrop .modal { background: #fff; border-color: var(--ui-border); box-shadow: 0 20px 60px rgba(15,23,42,.18); }
.backlog-modal-top, .rec-modal-top, .uf-dialog-top { background: var(--ui-soft); border-bottom-color: var(--ui-border); }
#backlog-modal { --backlog-accent: #1d4ed8; --backlog-tint: #eff6ff; --backlog-line: #bfdbfe; padding: 20px; background: rgba(15,23,42,.55); font-family: "Segoe UI", Arial, sans-serif; }
#backlog-modal, #backlog-modal *, #backlog-modal *::before, #backlog-modal *::after { box-sizing: border-box; }
#backlog-modal[data-tone="watch"] { --backlog-accent: #a16207; --backlog-tint: #fffbeb; --backlog-line: #fde68a; }
#backlog-modal[data-tone="alert"] { --backlog-accent: #c2410c; --backlog-tint: #fff7ed; --backlog-line: #fed7aa; }
#backlog-modal[data-tone="critical"] { --backlog-accent: #be123c; --backlog-tint: #fff1f2; --backlog-line: #fecdd3; }
#backlog-modal .backlog-modal-card { box-sizing: border-box; width: min(780px,100%); max-height: min(90dvh,860px); display: grid; grid-template-rows: auto minmax(0,1fr) auto; border: 1px solid #dfe5ed; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.25); }
#backlog-modal .backlog-modal-top { align-items: flex-start; padding: 22px 24px; gap: 18px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.backlog-modal-heading { min-width: 0; flex: 1; }
.backlog-modal-identity { display: flex; align-items: center; gap: 13px; }
.backlog-modal-identity > div { min-width: 0; }
.backlog-modal-icon { flex: 0 0 46px; display: grid; place-items: center; width: 46px; height: 50px; border: 1px solid var(--backlog-line); border-radius: 12px; color: var(--backlog-accent); background: var(--backlog-tint); }
.backlog-modal-icon svg { width: 25px; height: 25px; }
.backlog-modal-eyebrow { display: block; font-size: 10px; line-height: 1.5; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
#backlog-modal .backlog-modal-top h4 { margin: 4px 0 6px; color: #0f172a; font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -.3px; }
#backlog-modal-description { margin: 0; color: #64748b; font-size: 12px; line-height: 1.6; }
.backlog-modal-total { display: inline-flex; margin-top: 14px; padding: 5px 10px; border: 1px solid var(--backlog-line); border-radius: 7px; background: var(--backlog-tint); color: var(--backlog-accent); font-size: 12px; font-weight: 600; }
.backlog-modal-total[hidden] { display: none; }
#backlog-modal .backlog-modal-close { min-height: 38px; padding: 8px 16px; border-radius: 9px; border-color: #cbd5e1; background: #fff; color: #334155; font: 600 12px "Segoe UI", Arial, sans-serif; white-space: nowrap; }
#backlog-modal .backlog-modal-close:hover { background: #f8fafc; border-color: #94a3b8; transform: none; }
#backlog-modal .backlog-modal-close:focus-visible, #backlog-modal a:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
#backlog-modal .backlog-modal-body { min-height: 0; padding: 0 24px 22px; overflow: auto; overscroll-behavior: contain; background: #f8fafc; }
#backlog-modal .backlog-list-head { position: sticky; top: 0; z-index: 3; grid-template-columns: minmax(0,1fr) 150px; align-items: center; gap: 12px; margin: 18px 0 0; padding: 11px 15px; border: 1px solid #dfe5ed; border-radius: 10px 10px 0 0; background: #f1f5f9; color: #64748b; font-size: 11px; font-weight: 600; letter-spacing: .03em; }
#backlog-modal .backlog-list-head span:last-child { text-align: right; }
#backlog-modal .backlog-sac-list { gap: 0; border: 1px solid #dfe5ed; border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden; }
#backlog-modal .backlog-sac-list li { grid-template-columns: minmax(0,1fr) 150px; min-height: 48px; gap: 12px; padding: 8px 15px; border: 0; border-bottom: 1px solid #edf2f7; border-radius: 0; background: #fff; font-size: 13px; }
#backlog-modal .backlog-sac-list li:last-child { border-bottom: 0; }
#backlog-modal .backlog-sac-list li:nth-child(even) { background: #fbfcfe; }
#backlog-modal .backlog-sac-list li:hover { background: #eff6ff; box-shadow: none; }
#backlog-modal .backlog-sac-list a { justify-self: start; padding: 4px 0; color: #1d4ed8; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
#backlog-modal .backlog-sac-list .backlog-open-days { justify-self: end; display: inline-flex; align-items: baseline; justify-content: flex-end; gap: 5px; padding: 4px 9px; border-radius: 7px; color: var(--backlog-accent); background: var(--backlog-tint); font-variant-numeric: tabular-nums; }
.backlog-open-days strong { font-size: 16px; font-weight: 700; line-height: 1.4; }
.backlog-open-days small { font-size: 11px; font-weight: 500; }
#backlog-modal .backlog-sac-list li.is-empty { display: block; padding: 24px 15px; text-align: center; color: #64748b; }
#backlog-modal .backlog-modal-note { margin-top: 12px; padding: 10px 12px; border: 1px solid #dbe5f1; border-radius: 8px; background: #fff; color: #64748b; font-size: 12px; line-height: 1.5; }
.backlog-modal-footer { padding: 12px 24px; border-top: 1px solid #e2e8f0; color: #64748b; background: #fff; font-size: 11px; line-height: 1.6; }
@media (max-width: 600px) {
  #backlog-modal { padding: 8px; }
  #backlog-modal .backlog-modal-card { max-height: calc(100dvh - 16px); border-radius: 12px; }
  #backlog-modal .backlog-modal-top { padding: 16px; gap: 10px; }
  .backlog-modal-icon { display: none; }
  #backlog-modal .backlog-modal-top h4 { font-size: 19px; }
  #backlog-modal .backlog-modal-close { padding: 8px 12px; }
  #backlog-modal .backlog-modal-body { padding: 0 16px 16px; }
  #backlog-modal .backlog-list-head { margin-top: 14px; }
  #backlog-modal .backlog-list-head, #backlog-modal .backlog-sac-list li { grid-template-columns: minmax(0,1fr) 130px; padding-inline: 12px; }
  .backlog-modal-footer { padding: 10px 16px; }
}
.system-alert-backdrop .system-alert-icon { box-shadow: none; }
.sac-created-backdrop { z-index: 10020; padding: 16px; box-sizing: border-box; }
.sac-created-backdrop .sac-created-dialog { width: 480px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; box-sizing: border-box; }
.sac-created-heading, .sac-created-notice-heading { display: flex; align-items: center; gap: 13px; }
.sac-created-check { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 1px solid #bbf7d0; border-radius: 13px; background: #ecfdf5; color: #15803d; }
.sac-created-check svg { width: 24px; height: 24px; }
.sac-created-heading h2 { margin: 0; color: var(--ui-ink); font-size: 19px; font-weight: 650; line-height: 1.4; letter-spacing: -.3px; }
.sac-created-heading p, .sac-created-notice-heading p { margin: 4px 0 0; color: #475569; font-size: 13px; line-height: 1.6; }
.sac-created-reference { display: flex; flex-direction: column; gap: 5px; padding: 16px 18px; margin: 22px 0 18px; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-soft); }
.sac-created-reference span { color: #64748b; font-size: 12px; }
.sac-created-reference strong { color: var(--ui-ink); font-size: 26px; font-weight: 700; letter-spacing: -.5px; }
#sac-created-description { color: #475569; margin: 0; font-size: 14px; line-height: 1.7; }
.sac-created-next { color: #475569; font-size: 13px; line-height: 1.7; margin: 12px 0 0; }
.sac-created-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.sac-created-actions a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; box-sizing: border-box; }
.sac-created-notice { padding: 18px 20px; border: 1px solid #bbdfcb; border-radius: 12px; background: #f3fcf6; }
.sac-created-notice-heading strong { color: #166534; font-size: 16px; font-weight: 650; line-height: 1.5; }
.sac-created-notice .sac-created-check { flex-basis: 38px; height: 38px; border-radius: 11px; background: #fff; }
.sac-created-notice .sac-created-actions { justify-content: flex-start; margin-top: 16px; }
@media (max-width: 480px) {
  .sac-created-backdrop .sac-created-dialog { padding: 20px; }
  .sac-created-heading h2 { font-size: 17px; }
  .sac-created-notice { padding: 16px; }
  .sac-created-actions { flex-direction: column; align-items: stretch; }
  .sac-created-actions .btn { width: 100%; }
}
.status { border-radius: 10px; line-height: 1.5; }
.dash-panel, .kpi, .rec-card { border-color: var(--ui-border); border-radius: 12px; box-shadow: none; }
.primary-kpis .kpi { background: #fff; }
.dash-title h2 { font-size: 23px; letter-spacing: -.4px; }
.filters-resume > div { background: var(--ui-soft); border-color: var(--ui-border); }
.map-detail-sidebar .map-3d-tooltip, .map-overview { border-color: var(--ui-border); border-radius: 12px; }
/* Login retains its dedicated layout while sharing the same surfaces and controls. */
body[data-page="login"] { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; background: #f3f5f8 url("login-textile.svg") center / cover no-repeat fixed; }
body[data-page="login"] .login-shell { flex: 1; min-height: 0; padding: 40px 20px; }
body[data-page="login"] .login-shell::before { display: none; }
body[data-page="login"] .login-card { max-width: 460px; padding: 32px; text-align: left; background: #fff; border: 1px solid var(--ui-border); border-radius: 18px; box-shadow: 0 12px 36px rgba(15,23,42,.06),0 2px 6px rgba(15,23,42,.025); backdrop-filter: none; }
body[data-page="login"] .login-brand { display: flex; align-items: center; gap: 18px; padding-bottom: 24px; border-bottom: 1px solid #e5eaf0; }
body[data-page="login"] .login-logo { flex: 0 0 100px; }
body[data-page="login"] .login-logo img { width: 100px; height: auto; margin: 0; }
body[data-page="login"] .login-brand-text { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
body[data-page="login"] .login-brand-text strong { color: var(--ui-ink); font-size: 15px; line-height: 1.45; font-weight: 650; letter-spacing: .2px; text-wrap: balance; }
body[data-page="login"] .login-brand-text span { color: #64748b; font-size: 11px; line-height: 1.4; font-weight: 600; letter-spacing: 1.1px; }
body[data-page="login"] .login-title { margin: 24px 0 8px; color: var(--ui-ink); font-size: 27px; line-height: 1.3; font-weight: 650; letter-spacing: -.6px; }
body[data-page="login"] .login-subtitle, body[data-page="login"] .login-note { color: var(--ui-muted); line-height: 1.6; }
body[data-page="login"] .login-subtitle { margin-bottom: 26px; font-size: 14px; }
body[data-page="login"] .field { margin-bottom: 18px; }
body[data-page="login"] .field > label { display: block; margin-bottom: 7px; color: #334155; font-size: 13px; font-weight: 600; }
body[data-page="login"] .login-field-control { position: relative; }
body[data-page="login"] .login-field-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: #64748b; pointer-events: none; }
body[data-page="login"] .login-field-icon svg { display: block; width: 20px; height: 20px; }
body[data-page="login"] .login-field-control .input { min-height: 48px; padding-left: 44px; font-size: 15px; }
body[data-page="login"] .login-field-control:focus-within .login-field-icon { color: var(--ui-focus); }
body[data-page="login"] .field-msg:empty { display: none; }
body[data-page="login"] .login-btn { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 48px; margin-top: 6px; font-size: 15px; font-weight: 650; }
body[data-page="login"] .login-btn > span { font-size: 20px; font-weight: 400; line-height: 1; }
body[data-page="login"] .login-note { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e5eaf0; font-size: 12px; color: #64748b; }
body[data-page="login"] .login-footer { margin: 0; padding: 0 20px 20px; color: #64748b; background: transparent; }
@media (max-width: 480px) {
  body[data-page="login"] { background-position: 38% center; background-attachment: scroll; }
  body[data-page="login"] .login-shell { padding: 24px 16px; }
  body[data-page="login"] .login-card { padding: 24px; }
  body[data-page="login"] .login-title { font-size: 25px; }
  body[data-page="login"] .login-field-control .input { font-size: 16px; }
  body[data-page="login"] .login-brand { gap: 14px; }
  body[data-page="login"] .login-logo { flex-basis: 86px; }
  body[data-page="login"] .login-logo img { width: 86px; }
  body[data-page="login"] .login-brand-text strong { font-size: 13px; }
}
/* Public landing pages use a lightweight card, without the operational navigation. */
body[data-page="share"], body[data-page="deleted-share"] { color: var(--ui-ink); }
body[data-page="share"] .card, body[data-page="deleted-share"] .card { background: #fff; border: 1px solid var(--ui-border); border-top: 3px solid var(--ui-primary); box-shadow: var(--ui-shadow); backdrop-filter: none; }
body[data-page="share"] .brand, body[data-page="deleted-share"] .brand { padding: 22px; border-bottom: 1px solid var(--ui-border); }
body[data-page="share"] .brand img, body[data-page="deleted-share"] .brand img { width: 140px; height: auto; padding: 0; }
body[data-page="share"] h1, body[data-page="deleted-share"] h1 { color: var(--ui-ink); }
body[data-page="share"] p, body[data-page="deleted-share"] p { color: var(--ui-muted); }
body[data-page="share"] .content > a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 16px; background: var(--ui-primary); color: #fff; border-radius: 9px; }
body[data-page="deleted-share"] .warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.diagnostic-content .form-card form { display: grid; grid-template-columns: minmax(180px,260px) auto; justify-content: start; align-items: end; gap: 10px 12px; }
.diagnostic-content .form-card label { grid-column: 1 / -1; margin: 0; }
.diagnostic-content .form-card input[type="number"] { width: 100%; border-color: #d4dce6; border-radius: 9px; }
.diagnostic-table { overflow: auto; max-width: 100%; border: 1px solid var(--ui-border); border-radius: 12px; background: #fff; }
/* WhatsApp keeps semantic delivery colours; its shell matches the portal. */
body[data-page="whatsapp"] .wa-wrap { max-width: 1400px; margin: 28px auto 48px; padding: 0 24px; }
body[data-page="whatsapp"] .wa-head { background: #fff; color: var(--ui-ink); border: 1px solid var(--ui-border); border-top: 3px solid var(--ui-primary); border-radius: 14px; box-shadow: var(--ui-shadow); }
body[data-page="whatsapp"] .wa-head h1 { font-size: 23px; letter-spacing: -.4px; }
body[data-page="whatsapp"] .wa-head p { color: var(--ui-muted); }
body[data-page="whatsapp"] .wa-head .brand { gap: 18px; flex-wrap: nowrap; min-width: 0; }
body[data-page="whatsapp"] .wa-head .brand-logo { height: 48px; flex-shrink: 0; }
body[data-page="whatsapp"] .wa-head .brand-logo img { height: 48px; width: auto; min-height: 48px; }
body[data-page="whatsapp"] .wa-head-bottom { border-top-color: var(--ui-border); }
body[data-page="whatsapp"] .wa-action-main, body[data-page="whatsapp"] .wa-action-sub { background: var(--ui-soft); border-color: var(--ui-border); backdrop-filter: none; }
body[data-page="whatsapp"] .wa-switch { color: #334155; }
body[data-page="whatsapp"] .wa-live { color: #166534; background: #ecfdf5; border: 1px solid #bbf7d0; border-radius: 999px; padding: 6px 10px; }
body[data-page="whatsapp"] .wa-live.off { color: #475569; background: var(--ui-soft); border-color: var(--ui-border); }
body[data-page="whatsapp"] .wa-actions .btn { min-height: 42px; padding: 8px 14px; }
body[data-page="whatsapp"] .wa-more-btn { color: #334155; background: #fff; border: 1px solid #cbd5e1; }
body[data-page="whatsapp"] .wa-filters, body[data-page="whatsapp"] .wa-card, body[data-page="whatsapp"] .wa-table-wrap, body[data-page="whatsapp"] .wa-pager { background: #fff; border-color: var(--ui-border); border-radius: 12px; box-shadow: var(--ui-shadow); }
body[data-page="whatsapp"] .wa-filter-input, body[data-page="whatsapp"] .wa-filter-select { background: #fff; color: #1e293b; border-color: #d4dce6; border-radius: 9px; min-height: 42px; }
body[data-page="whatsapp"] .wa-filter-input:focus, body[data-page="whatsapp"] .wa-filter-select:focus { border-color: var(--ui-focus); box-shadow: 0 0 0 3px rgba(37,99,235,.1); outline: none; }
body[data-page="whatsapp"] .wa-table th { background: var(--ui-soft); color: #475569; }
@media (max-width: 960px) {
  body:not([data-page="home"]) .topbar { flex-wrap: wrap; }
  .topbar > .actions { margin-left: auto; }
}
@media (max-width: 640px) {
  body:not([data-page="home"]) .page-wrapper { padding: 16px 12px 32px; }
  body:not([data-page="home"]) .topbar { padding: 16px; gap: 16px; align-items: stretch; }
  body:not([data-page="home"]) .topbar .brand { gap: 12px; }
  body:not([data-page="home"]) .topbar .brand-logo, body:not([data-page="home"]) .topbar .brand-logo img { height: 42px; min-height: 42px; }
  .topbar > .actions { width: 100%; margin: 0; justify-content: flex-end; flex-wrap: wrap; }
  .topbar > .actions .btn { width: auto; padding: 9px 11px; font-size: 13px; }
  .portal-user { margin-right: auto; max-width: 120px; }
  .diagnostic-content .form-card form { grid-template-columns: minmax(0,1fr); }
  body:not([data-page="home"]) .card { padding: 16px; }
  .input, select, textarea { font-size: 16px; }
  .tab-bar { gap: 6px; }
  button.tab { font-size: 13px; }
  .modal { padding: 18px; }
  body[data-page="whatsapp"] .wa-wrap { margin: 16px auto 32px; padding: 0 12px; }
  body[data-page="whatsapp"] .wa-head { padding: 16px; }
  body[data-page="whatsapp"] .wa-head h1 { font-size: 21px; }
  body[data-page="whatsapp"] .wa-head-top { flex-wrap: wrap; }
  body[data-page="whatsapp"] .wa-head .brand { gap: 12px; }
  body[data-page="whatsapp"] .wa-head .brand-logo, body[data-page="whatsapp"] .wa-head .brand-logo img { height: 42px; min-height: 42px; }
  body[data-page="whatsapp"] .wa-head-bottom { align-items: stretch; flex-direction: column; }
}
@media (max-width: 720px) {
  #tab-identificacao .items-empty { display: block; border: 0; margin: 0; }
  #tab-identificacao .items-empty td { white-space: normal; overflow-wrap: break-word; }
}
@media print {
  body { background: #fff; }
  .topbar, .card, .modal { box-shadow: none; }
}
.csv-export-backdrop { padding: 20px; align-items: center; overflow: hidden; }
.modal.docs-modal.csv-export-modal { display: flex; flex-direction: column; width: min(1180px,100%); max-width: 1180px; height: min(760px,calc(100vh - 40px)); height: min(760px,calc(100dvh - 40px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); padding: 0; overflow: hidden; border: 1px solid var(--ui-border); border-radius: 16px; background: #fff; box-shadow: 0 24px 64px rgba(15,23,42,.22); }
.csv-export-modal .docs-modal-header { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 16px; margin: 0; padding: 22px 24px; border-bottom: 1px solid var(--ui-border); }
.csv-export-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.csv-export-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border: 1px solid #cde8dc; border-radius: 12px; color: #17704a; background: #edf8f2; }
.csv-export-icon svg { width: 24px; height: 24px; }
.csv-export-modal .docs-modal-title { margin: 0; color: var(--ui-ink); font-size: 20px; line-height: 1.4; font-weight: 650; letter-spacing: -.3px; }
.csv-export-modal .docs-modal-subtitle { margin-top: 4px; color: #64748b; font-size: 13px; line-height: 1.6; }
.csv-export-modal .docs-modal-actions { flex: 0 0 auto; width: auto; justify-content: flex-end; }
.csv-export-modal .docs-modal-actions .csv-close { display: grid; flex: 0 0 36px; place-items: center; width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 8px; border: 1px solid var(--ui-border); border-radius: 9px; color: #64748b; background: #fff; }
.csv-export-modal .csv-close svg { display: block; width: 18px; height: 18px; }
.csv-export-modal .docs-modal-content { display: flex; flex: 1 1 auto; flex-direction: column; gap: 14px; min-height: 0; padding: 20px 24px; overflow: hidden; }
.csv-export-modal .status { flex: 0 0 auto; margin: 0; padding: 12px 14px; font-size: 13px; line-height: 1.6; }
.csv-export-summary { display: grid; flex: 0 0 auto; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.csv-export-summary > div { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--ui-soft); border: 1px solid var(--ui-border); border-radius: 10px; }
.csv-export-summary span { color: #64748b; font-size: 12px; line-height: 1.5; }
.csv-export-summary strong { color: var(--ui-ink); font-size: 21px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; }
.csv-preview-heading { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 10px; }
.csv-preview-heading strong { color: #334155; font-size: 14px; font-weight: 600; }
.csv-preview-heading span { color: #64748b; font-size: 12px; }
.csv-export-modal .csv-preview-wrap { flex: 1 1 0; min-height: 0; margin: 0; padding: 0; max-height: none; border: 1px solid var(--ui-border); border-radius: 10px; background: #fff; box-shadow: none; overflow: auto; overscroll-behavior: contain; }
.csv-export-modal .csv-preview-table { width: 100%; min-width: 1050px; margin: 0; border-collapse: separate; border-spacing: 0; }
.csv-export-modal .csv-preview-table th, .csv-export-modal .csv-preview-table td { padding: 11px 12px; font-size: 12px; line-height: 1.5; white-space: nowrap; word-break: normal; color: #334155; border-bottom: 1px solid #e5eaf0; }
.csv-export-modal .csv-preview-table th { position: sticky; top: 0; z-index: 3; color: #475569; background: #f8fafc; font-weight: 600; }
.csv-export-modal .csv-preview-table tr > :first-child { position: sticky; left: 0; z-index: 2; min-width: 72px; background: #fff; box-shadow: 1px 0 0 #e5eaf0; }
.csv-export-modal .csv-preview-table thead tr > :first-child { z-index: 4; background: #f8fafc; }
.csv-export-modal .csv-preview-table tbody tr:nth-child(even) > :first-child { background: #fafbfd; }
.csv-export-modal .csv-preview-table tbody tr:nth-child(even) { background: #fafbfd; }
.csv-export-modal .csv-preview-table tbody tr:last-child td { border-bottom: 0; }
.csv-export-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 24px; border-top: 1px solid var(--ui-border); background: #f8fafc; }
.csv-export-footer p { margin: 0; color: #64748b; font-size: 12px; line-height: 1.6; }
.csv-export-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.csv-export-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; font-size: 14px; font-weight: 600; text-decoration: none; }
@media (max-width: 600px) {
  .csv-export-backdrop { padding: 12px; }
  .modal.docs-modal.csv-export-modal { height: min(760px,calc(100vh - 24px)); height: min(760px,calc(100dvh - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .csv-export-modal .docs-modal-header { flex-direction: row; align-items: flex-start; padding: 18px 16px; gap: 10px; }
  .csv-export-heading { gap: 10px; }
  .csv-export-icon { flex-basis: 36px; height: 36px; border-radius: 10px; }
  .csv-export-icon svg { width: 20px; height: 20px; }
  .csv-export-modal .docs-modal-title { font-size: 18px; }
  .csv-export-modal .docs-modal-subtitle { font-size: 12px; }
  .csv-export-modal .docs-modal-content { padding: 16px; gap: 12px; }
  .csv-export-summary { gap: 8px; }
  .csv-export-summary > div { padding: 12px 10px; }
  .csv-export-summary strong { font-size: 19px; }
  .csv-preview-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .csv-export-footer { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .csv-export-actions .btn { flex: 1; width: auto; padding: 10px 14px; }
}
@media (max-height: 520px) {
  .csv-export-modal .csv-export-summary { display: none; }
  .csv-export-modal .docs-modal-subtitle { display: none; }
  .csv-export-modal .docs-modal-header { padding: 12px 16px; }
  .csv-export-modal .csv-export-icon { flex-basis: 36px; height: 36px; }
  .csv-export-modal .docs-modal-content { padding: 12px 16px; gap: 10px; }
  .csv-export-modal .status { padding: 8px 12px; font-size: 12px; line-height: 20px; }
  .csv-export-modal .csv-export-footer { padding: 12px 16px; gap: 8px; }
}
.log-modal-backdrop { padding: 20px; align-items: center; overflow: hidden; }
.modal.log-modal { display: flex; flex-direction: column; width: min(980px,100%); max-width: 980px; height: min(760px,calc(100vh - 40px)); height: min(760px,calc(100dvh - 40px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--ui-border); border-radius: 16px; background: #fff; overflow: hidden; box-shadow: 0 24px 64px rgba(15,23,42,.22); }
.log-modal .log-modal-header { position: relative; flex: 0 0 auto; gap: 5px; margin: 0; padding: 22px 76px 20px 82px; border-bottom: 1px solid var(--ui-border); }
.log-modal .log-modal-header::before { content: ""; position: absolute; top: 22px; left: 24px; width: 44px; height: 44px; border: 1px solid #dbe5f1; border-radius: 12px; background: #f0f5fb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11a9 9 0 1 1 2.6 7M3 4v7h7M12 7v5l3 2'/%3E%3C/svg%3E") center / 24px no-repeat; }
.log-modal .log-modal-title { margin: 0; color: var(--ui-ink); font-size: 20px; line-height: 1.4; font-weight: 650; letter-spacing: -.3px; }
.log-modal .log-modal-subtitle { color: #64748b; font-size: 13px; line-height: 1.6; }
.log-modal .log-modal-close { position: absolute; top: 24px; right: 24px; display: grid; place-items: center; min-width: 36px; width: 36px; height: 36px; min-height: 36px; padding: 8px; border: 1px solid var(--ui-border); border-radius: 9px; color: #64748b; background: #fff; }
.log-modal .log-modal-close svg { display: block; width: 18px; height: 18px; }
.log-modal .log-modal-tools { display: block; flex: 0 0 auto; margin: 0; padding: 16px 24px; border-bottom: 1px solid var(--ui-border); }
.log-modal .log-modal-tools label { display: block; margin-bottom: 7px; color: #334155; font-size: 13px; line-height: 20px; font-weight: 600; }
.log-modal .log-modal-search { min-height: 44px; height: 44px; padding: 10px 12px; font: 14px/22px "Segoe UI",Arial,sans-serif; }
.log-modal .log-modal-content { flex: 1 1 auto; min-height: 0; max-height: none; gap: 12px; padding: 18px 24px; background: var(--ui-soft); overflow: hidden; }
.log-modal .log-modal-content > .status { flex: 0 0 auto; margin: 0; font-size: 13px; line-height: 1.6; }
.log-modal .log-result-summary { flex: 0 0 auto; color: #64748b; font-size: 13px; line-height: 20px; }
.log-modal .log-timeline-wrap { flex: 1 1 0; min-height: 0; max-height: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: auto; overscroll-behavior: contain; }
.log-modal .log-timeline { min-width: 0; padding: 0; gap: 16px; }
.log-modal .log-day { flex: 0 0 auto; border: 1px solid var(--ui-border); border-radius: 12px; background: #fff; overflow: visible; }
.log-modal .log-day-header { position: sticky; top: 0; z-index: 3; padding: 12px 16px; border-radius: 11px 11px 0 0; background: #fff; border-bottom: 1px solid #e5eaf0; }
.log-modal .log-day-title { color: #334155; font-size: 13px; line-height: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.log-modal .log-day-badge { padding: 4px 9px; border: 1px solid var(--ui-border); border-radius: 7px; background: #f8fafc; color: #64748b; font-size: 12px; line-height: 18px; }
.log-modal .log-entry { grid-template-columns: 80px minmax(0,1fr); gap: 16px; padding: 18px 20px 18px 38px; border-bottom: 1px solid #edf1f5; }
.log-modal .log-entry::before { left: 18px; top: 24px; z-index: 1; width: 8px; height: 8px; background: #94a3b8; box-shadow: 0 0 0 4px #fff; }
.log-modal .log-entry::after { content: ""; position: absolute; left: 21px; top: 32px; bottom: -24px; width: 1px; background: #e2e8f0; }
.log-modal .log-entry:last-child { border-bottom: 0; }
.log-modal .log-entry:last-child::after { display: none; }
.log-modal .log-entry.is-changed::before { background: #3b82f6; }
.log-modal .log-entry.is-created::before { background: #64748b; }
.log-modal .log-entry.is-concluded::before { background: #16a34a; }
.log-modal .log-entry-time { padding-left: 0; color: #64748b; font-size: 12px; line-height: 22px; font-weight: 500; }
.log-modal .log-entry-main { gap: 5px; }
.log-modal .log-entry-desc { color: #1e293b; font-size: 14px; line-height: 22px; font-weight: 600; overflow-wrap: anywhere; }
.log-modal .log-entry-meta { color: #64748b; font-size: 12px; line-height: 20px; }
.log-modal .log-entry-diff { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 10px; max-width: 560px; margin-top: 6px; }
.log-modal .log-value { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; min-width: 0; }
.log-modal .log-value span { color: #64748b; font-size: 11px; line-height: 16px; }
.log-modal .log-value strong { color: #475569; font-size: 13px; line-height: 20px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: pre-wrap; overflow-wrap: anywhere; }
.log-modal .log-value-after { border-color: #d5e4fb; background: #f0f6ff; }
.log-modal .log-value-after strong { color: #1e40af; font-weight: 600; }
.log-modal .log-value-arrow { color: #94a3b8; font-size: 18px; }
.log-modal .log-empty { padding: 24px 16px; border: 1px dashed #cbd5e1; border-radius: 10px; background: #fff; color: #64748b; font-size: 13px; line-height: 1.7; }
.log-modal .actions.log-modal-footer { flex: 0 0 auto; justify-content: space-between; align-items: center; gap: 16px; margin: 0; padding: 16px 24px; border-top: 1px solid var(--ui-border); background: #fff; }
.log-modal-footer p { margin: 0; color: #64748b; font-size: 12px; line-height: 1.6; }
.log-modal .log-modal-footer .btn { min-width: 100px; min-height: 44px; width: auto; padding: 10px 20px; font-size: 14px; }
@media (max-width: 600px) {
  .log-modal-backdrop { padding: 12px; }
  .modal.log-modal { height: min(760px,calc(100vh - 24px)); height: min(760px,calc(100dvh - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .log-modal .log-modal-header { padding: 18px 62px 16px 64px; }
  .log-modal .log-modal-header::before { left: 16px; top: 18px; width: 36px; height: 36px; border-radius: 10px; background-size: 20px; }
  .log-modal .log-modal-title { font-size: 18px; }
  .log-modal .log-modal-subtitle { font-size: 12px; }
  .log-modal .log-modal-close { top: 18px; right: 16px; }
  .log-modal .log-modal-tools { padding: 12px 16px; }
  .log-modal .log-modal-search { font-size: 16px; }
  .log-modal .log-modal-content { padding: 14px 16px; }
  .log-modal .log-entry { grid-template-columns: minmax(0,1fr); padding: 14px 14px 14px 30px; gap: 4px; }
  .log-modal .log-entry::before { left: 12px; top: 21px; }
  .log-modal .log-entry::after { left: 15px; top: 29px; bottom: -21px; }
  .log-modal .log-entry-diff { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .log-modal .log-value-arrow { display: none; }
  .log-modal .log-value { padding: 9px; }
  .log-modal .actions.log-modal-footer { padding: 12px 16px; }
}
@media (max-height: 520px) {
  .log-modal .log-modal-subtitle, .log-modal-footer p { display: none; }
  .log-modal .log-modal-header { padding-top: 16px; padding-bottom: 16px; min-height: 64px; }
  .log-modal .log-modal-header::before { top: 14px; }
  .log-modal .log-modal-close { top: 14px; }
  .log-modal .log-modal-tools { padding-top: 10px; padding-bottom: 10px; }
  .log-modal .log-modal-tools label { display: none; }
  .log-modal .actions.log-modal-footer { justify-content: flex-end; padding: 10px 16px; }
}
body[data-page="sac_novo"] .items-panel-header .items-remove-actions { gap: 10px; }
body[data-page="sac_novo"] .items-remove-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 13px; border-radius: 9px; font-size: 13px; font-weight: 600; line-height: 1.4; box-shadow: none; }
body[data-page="sac_novo"] .items-remove-actions .btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
body[data-page="sac_novo"] .items-remove-actions .btn-remove-selected { color: #9f1239; background: #fff1f2; border: 1px solid #e9b8c3; }
body[data-page="sac_novo"] .items-remove-actions .btn-remove-all { color: #9f1239; background: #fff; border: 1px solid #e9b8c3; }
body[data-page="sac_novo"] .items-remove-actions .btn:not(:disabled):hover { color: #881337; background: #ffe4e6; border-color: #d48a9c; transform: none; }
body[data-page="sac_novo"] .items-remove-actions .btn:disabled { opacity: 1; color: #94a3b8; background: #f8fafc; border-color: #e2e8f0; cursor: not-allowed; }
@media (max-width: 520px) {
  body[data-page="sac_novo"] .items-panel-header .items-remove-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; gap: 8px; }
  body[data-page="sac_novo"] .items-remove-actions .btn { width: 100%; min-width: 0; min-height: 44px; padding: 8px; gap: 6px; font-size: 12px; white-space: normal; }
  body[data-page="sac_novo"] .items-remove-actions .btn svg { width: 16px; height: 16px; flex-basis: 16px; }
}
.nf-access-backdrop { z-index: 10020; padding: 16px; box-sizing: border-box; }
.nf-access-backdrop .nf-access-dialog { width: 510px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; box-sizing: border-box; border-radius: 16px; }
.nf-access-heading { display: flex; align-items: center; gap: 14px; }
.nf-access-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border: 1px solid #f1d49c; border-radius: 12px; background: #fff8eb; color: #946200; }
.nf-access-icon svg { width: 23px; height: 23px; }
.nf-access-heading h2 { margin: 0; font-size: 19px; line-height: 1.4; font-weight: 650; color: #172238; }
.nf-access-dialog p { margin: 18px 0 0; font-size: 14px; line-height: 1.65; color: #475569; }
.nf-access-dialog #nf-access-guidance { padding: 14px 16px; background: #f7f9fc; border: 1px solid #dce4ef; border-radius: 10px; font-size: 13px; }
.nf-access-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.nf-access-actions .btn { min-height: 42px; font-size: 14px; }
.nf-access-notice { display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px; border: 1px solid #f1d49c; border-radius: 12px; background: #fffcf5; color: #172238; }
.nf-access-notice strong { font-size: 14px; font-weight: 650; }
.nf-access-notice p { margin: 5px 0 0; font-size: 13px; line-height: 1.6; color: #475569; }
@media (max-width: 480px) {
  .nf-access-backdrop .nf-access-dialog { padding: 20px; }
  .nf-access-heading h2 { font-size: 17px; }
  .nf-access-notice { padding: 14px; gap: 10px; }
  .nf-access-actions .btn { width: 100%; }
}

/* Portal feedback: shared alerts, confirmations and inline messages. */
.portal-feedback-backdrop { z-index: 10100; padding: 16px; box-sizing: border-box; }
.modal.portal-feedback-dialog { width: 510px; max-width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; box-sizing: border-box; border: 1px solid #dfe5ed; border-radius: 16px; background: #fff; font-family: "Segoe UI",Arial,sans-serif; box-shadow: 0 24px 64px rgba(15,23,42,.22); }
.portal-feedback-heading { display: flex; align-items: center; gap: 14px; }
.portal-feedback-heading h2 { margin: 0; color: #172238; font-size: 19px; font-weight: 650; line-height: 1.4; letter-spacing: -.2px; }
.portal-feedback-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border: 1px solid #f1d49c; border-radius: 12px; background: #fff8eb; color: #946200; }
.portal-feedback-icon svg { width: 23px; height: 23px; }
[data-type="error"] .portal-feedback-icon { background: #fff1f2; border-color: #fecdd3; color: #b42339; }
[data-type="success"] .portal-feedback-icon { background: #ecfdf5; border-color: #bbdfcb; color: #15803d; }
[data-type="info"] .portal-feedback-icon { background: #eff6ff; border-color: #c9dcf5; color: #1d4d85; }
.portal-feedback-message { margin-top: 20px; color: #475569; font-size: 14px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.portal-feedback-guidance { margin: 18px 0 0; padding: 14px 16px; color: #475569; background: #f7f9fc; border: 1px solid #dce4ef; border-radius: 10px; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.portal-feedback-guidance[hidden] { display: none; }
.portal-feedback-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.portal-feedback-actions .btn { min-height: 42px; padding: 10px 16px; font-family: inherit; font-size: 14px; font-weight: 600; }
.portal-feedback-dialog :focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.status { padding: 12px 15px; border-radius: 10px; font-family: "Segoe UI",Arial,sans-serif; font-size: 13px; font-weight: 400; line-height: 1.65; overflow-wrap: anywhere; }
.status strong { font-weight: 600; }
.portal-feedback-notice { display: block; }
@media (max-width: 480px) {
  .modal.portal-feedback-dialog { padding: 20px; }
  .portal-feedback-heading h2 { font-size: 17px; }
  .portal-feedback-actions { flex-direction: column-reverse; align-items: stretch; }
  .portal-feedback-actions .btn { width: 100%; }
}

.portal-feedback-notice > strong, .portal-feedback-notice > span { display: block; }
.portal-feedback-notice > strong { margin-bottom: 3px; }
.portal-feedback-notice-guidance { margin-top: 5px; font-size: 12px; }
.portal-feedback-message label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.portal-feedback-message input { width: 100%; box-sizing: border-box; }
.settings-modal-backdrop .modal > h4 { font-size: 19px; line-height: 1.4; font-weight: 650; }

/* One accessible explanation for a rejected login, without duplicate field text. */
body[data-page="login"] .login-feedback { display: flex; align-items: flex-start; gap: 11px; padding: 14px; margin: 4px 0 14px; border: 1px solid #efcbd1; border-radius: 12px; background: #fff5f6; color: #9f2436; }
body[data-page="login"] .login-feedback[hidden] { display: none; }
body[data-page="login"] .login-feedback-icon { flex: 0 0 20px; height: 20px; margin-top: 1px; }
body[data-page="login"] .login-feedback-icon svg { display: block; width: 20px; height: 20px; }
body[data-page="login"] .login-feedback > div { min-width: 0; }
body[data-page="login"] .login-feedback strong { display: block; font-size: 13px; line-height: 1.5; font-weight: 600; }
body[data-page="login"] .login-feedback p { margin: 4px 0 0; font-size: 13px; line-height: 1.6; color: #73424b; overflow-wrap: anywhere; }
body[data-page="login"] .login-field-control .input.error { border-color: #d88b97; box-shadow: none; }
body[data-page="login"] .login-field-control .input.error:focus { box-shadow: 0 0 0 3px rgba(193,18,31,.09); }
body[data-page="login"] .status > strong { flex-shrink: 0; }
body[data-page="login"] .status > span { min-width: 0; }

/* Keep deletion progress visible while the server finishes the operation. */
.sac-delete-progress .loading-card { gap: 16px; align-items: flex-start; }
.sac-delete-progress .loading-title { margin: 0; font-size: 18px; font-weight: 650; line-height: 1.4; letter-spacing: -.2px; }
.sac-delete-progress .loading-text { margin: 9px 0 0; font-size: 13px; line-height: 1.65; }
.sac-delete-progress .loading-spinner { background: #fff1f2; border: 1px solid #efcbd1; box-shadow: none; }
.sac-delete-progress .loading-spinner::after { display: none; }
.sac-delete-progress .loading-spinner-ring { border-color: #efcbd1; border-top-color: #b40f24; }

/* Open dialogs in one paint. Full-page blur combined with nested entry
   animations causes uneven frames on Firefox, especially over long tables. */
.modal-backdrop, .backlog-modal, .rec-modal {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
  transition: none;
}
.modal-backdrop > .modal, .backlog-modal-card, .rec-modal-card, #uf-details-dialog {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: none;
  transition: none;
}
#uf-details-dialog::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; animation: none; transition: none; }

.nf-mobile-help { display: none; }

/* Mobile SAC forms and results: no desktop table sizing inside card layouts. */
@media (max-width: 720px) {
  body[data-page="sac_novo"] .home-hero h1,
  body[data-page="consultar"] .home-hero h1 { overflow-wrap: anywhere; white-space: normal; }
  body[data-page="sac_novo"] .page-wrapper,
  body[data-page="consultar"] .page-wrapper { padding: 14px 10px 30px; }
  body[data-page="sac_novo"] .card,
  body[data-page="consultar"] .card { padding: 14px 12px; }
  body[data-page="sac_novo"] .input,
  body[data-page="sac_novo"] select,
  body[data-page="sac_novo"] textarea,
  body[data-page="sac_novo"] .problem-popup .problem-search,
  body[data-page="consultar"] .input,
  body[data-page="consultar"] select { font-size: 16px; box-sizing: border-box; max-width: 100%; }
  body[data-page="sac_novo"] .items-grid,
  body[data-page="sac_novo"] .items-col,
  body[data-page="sac_novo"] .grid-2 > div,
  body[data-page="sac_novo"] .grid-3 > div { min-width: 0; }
  body[data-page="sac_novo"] #tab-identificacao .table-panel.compact .table-scroll .nf-table,
  body[data-page="sac_novo"] #tab-identificacao .table-panel.compact .table-scroll .defeitos-table,
  body[data-page="consultar"] .table-panel.compact .sac-table { display: block; width: 100%; min-width: 0; max-width: 100%; }
  body[data-page="sac_novo"] .nf-table colgroup,
  body[data-page="sac_novo"] .defeitos-table colgroup { display: none; }
  body[data-page="sac_novo"] .nf-table thead,
  body[data-page="sac_novo"] .defeitos-table thead,
  body[data-page="consultar"] .sac-table thead { display: none; }
  body[data-page="sac_novo"] .nf-table tbody,
  body[data-page="sac_novo"] .defeitos-table tbody,
  body[data-page="consultar"] .sac-table tbody { display: block; width: 100%; }
  body[data-page="sac_novo"] .nf-table tbody tr,
  body[data-page="sac_novo"] .defeitos-table tbody tr,
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; min-width: 0; box-sizing: border-box; margin: 8px 0; }
  body[data-page="sac_novo"] .nf-table td,
  body[data-page="sac_novo"] .defeitos-table td,
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td { display: block; box-sizing: border-box; width: auto; min-width: 0; max-width: 100%; padding: 10px !important; white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
  body[data-page="sac_novo"] .defeitos-table td:has(input[data-field="qtdeDefeito"]) { grid-column: 1 / -1; }
  body[data-page="sac_novo"] .defeitos-table td:nth-child(5) { grid-column: 1 / -1; }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table .defeito-input { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; min-height: 44px; font-size: 16px; padding: 10px; }
  body[data-page="sac_novo"] .items-empty td { grid-column: 1 / -1; }
  /* Dense invoice table: bounded scrolling keeps actions near large invoices. */
  body[data-page="sac_novo"] #tab-identificacao .table-panel.compact .nf-items-scroll {
    overflow: auto; max-height: 310px; padding: 0; position: relative;
    overscroll-behavior: contain; border-top: 1px solid #dfe5ed;
  }
  body[data-page="sac_novo"] #tab-identificacao .table-panel.compact .table-scroll .nf-table {
    display: table; width: 640px; min-width: 100%; max-width: none;
    table-layout: auto; border-collapse: separate; border-spacing: 0;
  }
  body[data-page="sac_novo"] .nf-table thead {
    display: table-header-group; position: static; width: auto; height: auto;
    overflow: visible; clip-path: none;
  }
  body[data-page="sac_novo"] .nf-table tbody { display: table-row-group; width: auto; }
  body[data-page="sac_novo"] .nf-table tbody tr[data-index] {
    display: table-row; height: 44px; margin: 0; padding: 0; border: 0;
    border-radius: 0; outline: 0; box-shadow: none; cursor: pointer;
  }
  body[data-page="sac_novo"] .nf-table tbody tr[data-index] td,
  body[data-page="sac_novo"] .nf-table thead th {
    display: table-cell; width: auto; max-width: none; padding: 10px !important;
    white-space: nowrap; overflow-wrap: normal; line-height: 1.4;
    border: 0; border-bottom: 1px solid #e5eaf1; font-size: 12px;
    text-align: left !important; background: #fff; color: #334155;
  }
  body[data-page="sac_novo"] .nf-table thead th {
    position: sticky; top: 0; z-index: 2; background: #f1f5f9;
    font-size: 10px; color: #475569; height: 34px; box-sizing: border-box;
  }
  body[data-page="sac_novo"] .nf-table tbody td[data-label]::before,
  body[data-page="sac_novo"] .nf-table tbody tr::after { display: none; content: none; }
  body[data-page="sac_novo"] .nf-table tbody tr[data-index] td:first-child,
  body[data-page="sac_novo"] .nf-table thead th:first-child {
    position: sticky; left: 0; z-index: 1; font-weight: 650;
    border-right: 1px solid #dfe5ed;
  }
  body[data-page="sac_novo"] .nf-table thead th:first-child { z-index: 3; }
  body[data-page="sac_novo"] .nf-table tbody tr.selected td { background: #fff1f2; color: #9f1239; }
  body[data-page="sac_novo"] .nf-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 #c1121f; }
  body[data-page="sac_novo"] .nf-table tbody tr.is-blocked td { background: #f1f5f9; color: #64748b; }
  body[data-page="sac_novo"] .nf-mobile-help { display: block; margin: 0; padding: 8px 12px; font-size: 12px; line-height: 1.5; color: #475569; }
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td:nth-child(7),
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td:nth-child(8),
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td:nth-child(9) { grid-column: 1 / -1; }
  body[data-page="consultar"] .sac-table-panel .table-scroll { max-height: none; overflow: visible; }
  body[data-page="sac_novo"] .items-actions { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; width: 100%; }
  body[data-page="sac_novo"] .items-actions .btn { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; white-space: normal; font-size: 14px; }
  body[data-page="sac_novo"] .items-panel-header { flex-wrap: wrap; gap: 10px; }
  body[data-page="sac_novo"] .item-desc,
  body[data-page="sac_novo"] #items-action-status { overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
  body[data-page="sac_novo"] .sac-summary dl { grid-template-areas: "sac nf" "client client" "date date"; gap: 12px; padding: 14px; }
  body[data-page="sac_novo"] .sac-summary dl > div { padding: 0; border: 0; }
  body[data-page="sac_novo"] .sac-summary dl > div:nth-child(1) { grid-area: sac; }
  body[data-page="sac_novo"] .sac-summary dl > div:nth-child(2) { grid-area: client; }
  body[data-page="sac_novo"] .sac-summary dl > div:nth-child(3) { grid-area: nf; }
  body[data-page="sac_novo"] .sac-summary dl > div:nth-child(4) { grid-area: date; }
  body[data-page="sac_novo"] .sac-summary dt { margin-bottom: 3px; }
  body[data-page="sac_novo"] .problem-trigger { font-size: 16px; box-sizing: border-box; }
  body[data-page="sac_novo"] .problem-popup { position: relative; inset: auto; margin-top: 6px; box-sizing: border-box; max-width: 100%; }
  body[data-page="sac_novo"] .problem-list { max-height: min(280px,40dvh); }
  body[data-page="sac_novo"] .problem-option { min-height: 44px; box-sizing: border-box; font-size: 14px; }
  body[data-page="sac_novo"] .attachment-item { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 10px; padding: 12px; min-width: 0; }
  body[data-page="sac_novo"] .attachment-thumb { width: 56px; height: 56px; min-width: 0; min-height: 0; }
  body[data-page="sac_novo"] .attachment-meta { min-width: 0; width: auto; }
  body[data-page="sac_novo"] .attachment-meta .name { font-size: 13px; line-height: 1.5; font-weight: 600; overflow-wrap: anywhere; white-space: normal; }
  body[data-page="sac_novo"] .attachment-meta .details { font-size: 12px; overflow-wrap: anywhere; }
  body[data-page="sac_novo"] .attachment-remove { grid-column: 1 / -1; justify-self: end; width: auto; min-width: 90px; min-height: 44px; padding: 10px 14px; font-size: 14px; }
  body[data-page="sac_novo"] .char-counter { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
  body[data-page="consultar"] .selection-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  body[data-page="consultar"] .selection-option { display: flex; box-sizing: border-box; width: auto; min-width: 0; min-height: 44px; padding: 9px; gap: 8px; flex-wrap: nowrap; white-space: normal; }
  body[data-page="consultar"] .selection-option:has(input[type="checkbox"]) { grid-column: 1 / -1; }
  body[data-page="consultar"] .selection-option input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; }
  body[data-page="consultar"] .selection-option span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  body[data-page="consultar"] .sac-pagination { display: grid; gap: 10px; padding: 12px; }
  body[data-page="consultar"] .sac-pagination .page-info { text-align: center; font-size: 13px; }
  body[data-page="consultar"] .sac-pagination .page-actions { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 8px; width: 100%; }
  body[data-page="consultar"] .sac-pagination .page-actions .btn { width: auto; min-width: 0; min-height: 44px; padding: 9px; font-size: 12px; }
  body[data-page="consultar"] .sac-pagination .page-actions > span:not(.btn) { font-size: 12px; text-align: center; }
  body[data-page="consultar"] .sac-legend { padding: 12px; gap: 10px; }
  body[data-page="consultar"] .sac-legend .legend-items { justify-content: flex-start; width: 100%; gap: 8px; }
  body[data-page="consultar"] .sac-legend .legend-item { max-width: 100%; box-sizing: border-box; white-space: normal; font-size: 12px; }
}

/* Separate compact item identity from the editable quantities on phones. */
@media (max-width: 720px) {
  body[data-page="sac_novo"] .defeitos-table tbody tr[data-index] {
    grid-template-columns: repeat(6,minmax(0,1fr)); background: #fff;
  }
  body[data-page="sac_novo"] .defeitos-table tbody tr[data-index] td {
    grid-column: span 2; padding: 7px 8px !important; font-size: 12px;
    line-height: 1.4; background: transparent;
  }
  body[data-page="sac_novo"] .defeitos-table tbody tr[data-index] td:nth-child(-n+2) {
    grid-column: span 3; font-size: 14px; font-weight: 650;
  }
  body[data-page="sac_novo"] .defeitos-table tbody tr[data-index] td:nth-child(6) { grid-column: 1 / -1; border-top: 1px solid #dfe5ed; }
  body[data-page="sac_novo"] .defeitos-table tbody tr[data-index] td:nth-child(n+7) { grid-column: span 3; }
  body[data-page="sac_novo"] .defeitos-table tbody td[data-label]::before {
    font-size: 10px; font-weight: 500; margin-bottom: 3px; color: #475569;
  }
  body[data-page="sac_novo"] .defeitos-table tbody tr.selected { background: #f8fbff; }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table .defeito-input { padding: 8px 10px; height: 44px; }
}

/* Size the entire dialog, not just its document viewport. */
.modal-backdrop.sac-document-backdrop { box-sizing: border-box; padding: 16px; overflow: hidden; }
.modal.docs-modal.sac-document-viewer {
  display: flex; flex-direction: column; box-sizing: border-box; margin: 0;
  width: min(1120px,100%); height: min(900px,calc(100vh - 32px));
  height: min(900px,calc(100dvh - 32px));
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  min-height: 0; overflow: hidden; background: #fff;
}
.sac-document-viewer .docs-modal-header { flex: 0 0 auto; min-width: 0; }
.sac-document-viewer .docs-modal-content { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.sac-document-viewer .docs-modal-content > .status { flex: 0 0 auto; }
.sac-document-viewer .docs-modal-frame { flex: 1 1 auto; min-height: 0; height: auto; box-sizing: border-box; }
.sac-document-viewer .docs-modal-placeholder { overflow: auto; }

.sac-document-viewer .docs-modal-canvas-inner { will-change: auto; transform: none; }
.sac-document-viewer .docs-modal-canvas-page { contain: none; }
.sac-document-viewer .docs-btn-close { flex: 0 0 auto; }
@media (max-width: 900px) {
  .modal-backdrop.sac-document-backdrop {
    padding: 0; overflow: hidden; align-items: stretch;
  }
  .modal.docs-modal.sac-document-viewer {
    display: flex; flex-direction: column; box-sizing: border-box;
    width: 100%; max-width: none; height: 100vh; height: 100dvh;
    max-height: 100vh; max-height: 100dvh; padding: 0;
    border: 0; border-radius: 0; overflow: hidden; background: #f1f5f9;
  }
  .sac-document-viewer .docs-modal-header {
    display: grid; grid-template-columns: minmax(0,1fr) auto;
    flex: 0 0 auto; gap: 10px; margin: 0; background: #fff;
    padding: max(12px,env(safe-area-inset-top)) 12px 10px;
    border-bottom: 1px solid #dfe5ed; align-items: center;
  }
  .sac-document-viewer .docs-modal-title { font-size: 16px; line-height: 1.35; margin: 0; }
  .sac-document-viewer .docs-modal-subtitle { font-size: 11px; margin-top: 3px; line-height: 1.4; }
  .sac-document-viewer .docs-btn-close {
    grid-column: 2; grid-row: 1; width: auto; min-height: 44px;
    padding: 8px 12px; font-size: 12px; margin: 0;
  }
  .sac-document-viewer .docs-modal-actions {
    grid-column: 1 / -1; grid-row: 2; display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr)); width: 100%; gap: 6px;
  }
  .sac-document-viewer .docs-modal-actions .btn {
    width: 100%; min-width: 0; min-height: 44px; padding: 8px 4px;
    box-sizing: border-box; font-size: 12px; white-space: nowrap;
  }
  .sac-document-viewer .docs-modal-actions .hidden { display: none; }
  .sac-document-viewer .docs-modal-content {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    gap: 8px; overflow: hidden; padding: 8px 6px max(6px,env(safe-area-inset-bottom));
  }
  .sac-document-viewer .docs-modal-content .status { margin: 0; padding: 10px; font-size: 12px; flex-shrink: 0; }
  .sac-document-viewer .docs-modal-content .status.success { display: none; }
  .sac-document-viewer .docs-modal-frame {
    flex: 1 1 auto; min-height: 0; height: auto; width: 100%;
    box-sizing: border-box; border-radius: 6px; box-shadow: none;
  }
  .sac-document-viewer .docs-modal-canvas-host { padding: 6px; }
  .sac-document-viewer .docs-modal-placeholder { overflow: auto; }
}

.sac-table-mobile-help { display: none; }
@media (max-width: 720px) {
  body[data-page="consultar"] .table-panel.compact .sac-table:not(:has(tr[data-sac-number])) { width: 100%; }
  body[data-page="consultar"] .sac-table:not(:has(tr[data-sac-number])) thead { display: none; }
  body[data-page="consultar"] .sac-table-mobile-help { display: block; margin: 0; padding: 8px 12px; font-size: 12px; line-height: 1.5; color: #475569; }
  body[data-page="consultar"] .sac-table-panel .table-scroll {
    max-height: 420px; max-height: min(55dvh,420px); overflow: auto;
    position: relative; padding: 0; overscroll-behavior: none;
    /* Suppress elastic overscroll on both axes, not just scroll chaining. */
    -webkit-overflow-scrolling: auto;
    isolation: isolate; touch-action: pan-x pan-y pinch-zoom;
    border-top: 1px solid #dfe5ed;
  }
  body[data-page="consultar"] .table-panel.compact .sac-table {
    display: table; width: 1100px; min-width: 100%; max-width: none;
    table-layout: auto; border-collapse: separate; border-spacing: 0; margin: 0;
  }
  body[data-page="consultar"] .sac-table thead {
    display: table-header-group; position: static; width: auto; height: auto;
    overflow: visible; clip-path: none;
  }
  body[data-page="consultar"] .sac-table tbody { display: table-row-group; width: auto; }
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] {
    display: table-row; height: 44px; margin: 0; padding: 0; border: 0;
    border-radius: 0; outline: 0; box-shadow: none;
  }
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td,
  body[data-page="consultar"] .sac-table thead th {
    display: table-cell; width: auto; max-width: none; padding: 10px !important;
    white-space: nowrap; overflow-wrap: normal; line-height: 1.4;
    border: 0; border-bottom: 1px solid #dfe5ed; font-size: 12px;
  }
  body[data-page="consultar"] .sac-table thead th {
    position: sticky; top: 0; z-index: 2; background: #f1f5f9;
    font-size: 11px; color: #475569;
  }
  body[data-page="consultar"] .sac-table td[data-label]::before { display: none; content: none; }
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td:first-child,
  body[data-page="consultar"] .sac-table thead th:first-child {
    position: sticky; left: 0; z-index: 1; font-weight: 650;
    border-right: 1px solid #dfe5ed;
  }
  body[data-page="consultar"] .sac-table thead th:first-child { z-index: 3; }
  body[data-page="consultar"] .sac-table tbody tr[data-sac-number] td { background: #fff; }
  body[data-page="consultar"] .sac-table tbody tr.row-aberta td { background: #fdf0f0; }
  body[data-page="consultar"] .sac-table tbody tr.row-parecer td { background: #edfaf5; }
  body[data-page="consultar"] .sac-table tbody tr.row-concluida td { background: #eff4ff; }
  body[data-page="consultar"] .sac-table tbody tr.is-selected td,
  body[data-page="consultar"] .sac-table tbody tr.selected td { background: #dceaff; color: #1e293b; }
}

/* Align mobile filter choices; override the desktop flex layout explicitly. */
@media (max-width: 720px) {
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-box {
    padding: 12px; height: auto; min-width: 0;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-title {
    margin: 0 0 10px; white-space: normal; line-height: 1.4;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-options {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px; align-items: stretch; width: 100%;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option {
    display: flex; align-items: center; justify-content: flex-start;
    width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box;
    margin: 0; padding: 8px; gap: 8px; border-radius: 8px;
    font-size: 12px; line-height: 18px; white-space: normal;
    background: #fff; border: 1px solid #dfe5ed;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option span {
    white-space: normal; min-width: 0; overflow-wrap: anywhere; text-align: left;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option input {
    flex: 0 0 18px; width: 18px; height: 18px; margin: 0;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option:has(input[value="TODOS"]),
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option:has(input[type="checkbox"]) { grid-column: 1 / -1; }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option:has(input:checked) {
    background: #fff5f6; border-color: #e5a7af; color: #9f1239;
  }
  body[data-page="consultar"] .sac-consultar .sac-filter-side .selection-option:focus-within {
    outline: 2px solid #2563eb; outline-offset: 2px;
  }
}

/* Keep feedback labels intact and give long messages the full mobile width. */
body[data-page="sac_novo"] .status > strong { flex-shrink: 0; white-space: nowrap; }
body[data-page="sac_novo"] .status > span { min-width: 0; }
@media (max-width: 720px) {
  body[data-page="sac_novo"] #status-area .status {
    flex-direction: column; gap: 4px; padding: 12px; line-height: 1.6;
  }
}

.nf-blocked-notice { margin-top: 10px; padding: 14px; border: 1px solid #f0cf8d; border-left: 4px solid #b77914; border-radius: 10px; background: #fffbeb; color: #783f0a; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.nf-blocked-notice > strong { display: block; font-size: 14px; }
.nf-blocked-notice p { margin: 5px 0 10px; }
.nf-blocked-notice ul { list-style: none; padding: 0; margin: 0; }
.nf-blocked-notice li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 8px 0; border-top: 1px solid #efdfba; }
.nf-blocked-notice li span { min-width: 0; font-weight: 600; }
@media(max-width:720px) { .nf-blocked-notice { padding: 12px; } }

/* Distinguish added items and their editing area from the surrounding panel. */
@media (max-width: 720px) {
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index] {
    border: 1px solid #9db8d9; border-radius: 12px;
    background: #f1f6fc; box-shadow: 0 2px 6px rgba(30,64,110,.08);
    margin: 10px 0 14px; outline: none;
  }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index] td:nth-child(-n+5) {
    background: #e6eef8; color: #162e50;
  }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index] td:nth-child(n+6) {
    background: #f1f6fc;
  }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index] td:nth-child(6) { border-top-color: #b8cce4; }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody td[data-label]::before { color: #3b5270; font-weight: 600; }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table .defeito-input {
    background: #fff; border-color: #91accd; color: #0f172a;
  }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table .defeito-input:focus {
    border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.16);
  }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table .defeito-input[aria-invalid="true"] { border-color: #b91c1c; }
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index].selected,
  body[data-page="sac_novo"] #tab-identificacao .defeitos-table tbody tr[data-index]:focus-within {
    border-color: #2563eb; outline: 2px solid #2563eb; outline-offset: -2px;
  }
}

.docs-page-nav { display: flex; align-items: center; justify-content: center; gap: 12px; flex: 0 0 auto; padding: 6px 0; }
.docs-page-nav > span { font-size: 13px; text-align: center; min-width: 100px; }
.sac-document-viewer .docs-page-nav .btn { width: auto; min-width: 80px; min-height: 44px; padding: 8px 12px; font-size: 12px; }

/* Keep document zoom inside its scroll viewport, including mobile Safari. */
.modal.docs-modal.sac-document-viewer { min-width: 0; max-width: 100%; }
.sac-document-viewer .docs-modal-content,
.sac-document-viewer .docs-modal-frame,
.sac-document-viewer .docs-modal-canvas-host { min-width: 0; }
.sac-document-viewer .docs-modal-frame { contain: inline-size; }
.sac-document-viewer .docs-modal-canvas-inner { width: 100%; }
.sac-document-viewer .docs-modal-header .btn,
.sac-document-viewer .docs-page-nav .btn { touch-action: manipulation; }
@media (max-width: 900px) {
  .sac-document-backdrop { width: 100%; max-width: 100%; box-sizing: border-box; }
  .sac-document-viewer .docs-modal-actions .docs-btn-fit { grid-column: 1 / -1; }
}

.sac-document-viewer .docs-modal-canvas-host { scrollbar-width: auto; cursor: grab; }
.sac-document-viewer .docs-modal-canvas-host::-webkit-scrollbar { display: block; width: 12px; height: 12px; }
.sac-document-viewer .docs-modal-canvas-host::-webkit-scrollbar-thumb { background: #94a3b8; border: 3px solid #fff; border-radius: 8px; }
.sac-document-viewer .docs-modal-canvas-host.is-dragging { cursor: grabbing; }

.customer-search { margin: 8px 0 14px; padding: 12px; border: 1px solid #d9e2ee; border-radius: 10px; background: #f8fafc; min-width: 0; }
.customer-search > label { display: block; font-size: 12px; margin-bottom: 6px; }
.customer-search-controls { display: flex; gap: 8px; align-items: stretch; }
.customer-search-controls .input { flex: 1; min-width: 0; }
.customer-search-controls .btn { flex: 0 0 auto; min-height: 44px; }
.customer-search p { font-size: 12px; line-height: 1.5; margin: 8px 0 0; overflow-wrap: anywhere; }
.customer-search p:empty { display: none; }
.customer-search-results { max-height: 280px; overflow-y: auto; margin-top: 10px; border: 1px solid #d9e2ee; border-radius: 8px; background: #fff; }
.customer-search-choice { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #e2e8f0; padding: 12px; min-height: 44px; background: #fff; color: #172033; font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.customer-search-choice:last-child { border-bottom: 0; }
.customer-search-choice span { display: block; font-size: 12px; margin-top: 4px; color: #475569; }
.customer-search-choice:hover { background: #eff6ff; }
.customer-search-choice:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
@media(max-width: 600px) {
  .customer-search-controls { flex-direction: column; }
  .customer-search-controls .input { font-size: 16px; width: 100%; box-sizing: border-box; }
  .customer-search-controls .btn { width: 100%; }
}

/* Customer lookup occupies its own row; code range remains a separate option. */
.sac-filter-grid > .customer-filter { grid-column: 1 / -1; order: 1; }
.customer-filter-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; padding: 16px; border: 1px solid #d9e2ee; border-radius: 10px; background: #f8fafc; }
.customer-filter .customer-search { margin: 0; padding: 0; border: 0; background: transparent; }
.customer-code-range { min-width: 0; border-left: 1px solid #d9e2ee; padding-left: 20px; }
.customer-code-title { margin: 0 0 8px; font-size: 12px; color: #475569; }
.customer-selected { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 12px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; }
.customer-selected[hidden] { display: none; }
.customer-selected > div { min-width: 0; overflow-wrap: anywhere; }
.customer-selected span { display: block; color: #475569; font-size: 12px; margin-bottom: 4px; }
.customer-selected strong { display: block; font-size: 14px; color: #1e3a5f; }
.customer-selected .btn { flex-shrink: 0; min-height: 44px; }
@media(min-width: 1200px) {
  .sac-consultar .sac-filter-main > .sac-filter-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(max-width: 900px) {
  .customer-filter-layout { grid-template-columns: minmax(0,1fr); gap: 16px; padding: 12px; }
  .customer-code-range { border-left: 0; border-top: 1px solid #d9e2ee; padding: 12px 0 0; }
}
@media(max-width: 600px) {
  .customer-selected { align-items: stretch; flex-direction: column; }
  .customer-selected .btn { width: 100%; }
}

/* Align customer controls and keep results outside the code-range column. */
.customer-filter { font-family: "Segoe UI", Arial, sans-serif; }
.customer-filter-layout { gap: 16px 24px; background: #fafbfd; padding: 18px; }
.customer-filter .customer-search-title,
.customer-filter .customer-code-title { font-size: 13px; font-weight: 600; line-height: 20px; color: #334155; margin: 0 0 10px; }
.customer-filter .customer-search > label { font-size: 12px; font-weight: 400; line-height: 18px; color: #64748b; margin: 0 0 6px; }
.customer-filter .customer-search-controls .input,
.customer-filter .customer-search-controls .btn { box-sizing: border-box; min-height: 44px; height: 44px; font-family: inherit; font-size: 14px; line-height: 22px; }
.customer-filter .customer-search-controls .btn { color: #9f1239; border-color: #e6b8c3; background: #fff; font-weight: 600; }
.customer-filter .customer-search-controls .btn:hover { background: #fff1f2; border-color: #be123c; }
.customer-filter #customer-search-help { color: #64748b; font-size: 12px; line-height: 18px; }
.customer-code-range { align-self: start; }
.customer-search-feedback { grid-column: 1 / -1; border-top: 1px solid #e2e8f0; padding-top: 14px; min-width: 0; }
.customer-search-feedback:not(:has(#customer-search-status:not(:empty), #customer-search-results:not([hidden]))) { display: none; }
.customer-search-feedback #customer-search-status { margin: 0; color: #475569; font-size: 13px; line-height: 20px; }
.customer-search-feedback .customer-search-choice { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; box-sizing: border-box; font-family: inherit; }
.customer-result-info { min-width: 0; }
.customer-result-info strong { font-size: 14px; line-height: 21px; font-weight: 600; }
.customer-search-choice .customer-result-action { flex-shrink: 0; color: #9f1239; font-size: 13px; font-weight: 600; margin: 0; }
@media(max-width: 600px) {
  .customer-filter-layout { padding: 12px; }
  .customer-filter .customer-search-controls .input { font-size: 16px; }
  .customer-search-feedback .customer-search-choice { align-items: stretch; flex-direction: column; gap: 8px; }
  .customer-search-choice .customer-result-action { align-self: flex-end; }
}

.sac-consultar .sac-filter-header { margin-bottom: 0; }
.sac-consultar .filters-title { margin-top: 0; margin-bottom: 12px; }

body[data-representative="true"] .tab[data-target="tab-outras"],
body[data-representative="true"] #tab-outras { display: none; }

/* Internal technical fields are hidden from representatives in consultation. */
body[data-representative="true"][data-mode="view"] .internal-technical-field { display: none; }

.sac-video-area { padding:16px; border:1px solid #dbe3ec; background:#f8fafc; border-radius:12px; min-width:0; }
.sac-video-area h3 { margin:0 0 8px; font-size:15px; }
.sac-video-area h3 span { color:#64748b; font-size:12px; font-weight:400; }
.sac-video-area p { font-size:12px; line-height:1.6; color:#475569; }
.sac-video-actions { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0; }
.sac-video-area video { display:block; max-width:100%; max-height:320px; margin-top:12px; border-radius:8px; background:#111827; }
.sac-video-area [hidden] { display:none!important; }
.sac-video-area [data-video-name] { display:block; overflow-wrap:anywhere; font-size:13px; }
.sac-document-viewer .docs-btn-video { grid-column:1 / -1; }
@media(max-width:600px){.sac-video-actions .btn{width:100%;min-height:44px;}}

/* Photo and video attachments use the same hierarchy and control sizes. */
body[data-page="sac_novo"] .attachment-box,
body[data-page="sac_novo"] .sac-video-area { padding:20px; border-radius:14px; box-shadow:0 3px 12px rgba(15,23,42,.025); font-family:"Segoe UI",Arial,sans-serif; }
body[data-page="sac_novo"] .attachment-box { background:#fffafa; border-color:#edcdd5; }
body[data-page="sac_novo"] .sac-video-area { background:#f8fbff; border-color:#cedef1; }
body[data-page="sac_novo"] .attachment-header,
.media-section-header { display:flex; justify-content:space-between; align-items:center; gap:16px; margin-bottom:16px; }
body[data-page="sac_novo"] .attachment-header .field-label,
.sac-video-area .media-section-header h3 { font-size:15px; line-height:1.5; font-weight:650; color:#1e293b; margin:0 0 5px; }
body[data-page="sac_novo"] .attachment-header .muted,
.sac-video-area .media-limits { font-size:12px; line-height:1.5; color:#64748b; margin:0; }
body[data-page="sac_novo"] .attachment-header .required-label,
.sac-video-area .media-optional-badge { display:inline-block; vertical-align:middle; margin-left:6px; padding:2px 7px; border-radius:6px; font-size:11px; line-height:18px; font-weight:600; }
body[data-page="sac_novo"] .attachment-header .required-label { background:#fff1f2; color:#9f1239; }
.sac-video-area .media-optional-badge { color:#475569; background:#eaf0f7; }
body[data-page="sac_novo"] .attachment-actions .btn,
.media-section-header .btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 16px; font:600 13px/20px "Segoe UI",Arial,sans-serif; white-space:nowrap; box-sizing:border-box; }
.media-section-header .btn { color:#1e40af; border-color:#bdd1ec; background:#fff; }
.media-section-header .btn:hover { background:#eff6ff; }
.media-section-header .btn svg { width:18px; height:18px; flex-shrink:0; }
body[data-page="sac_novo"] .attachment-list.empty,
.video-empty-state { min-height:96px; box-sizing:border-box; padding:20px; border:1px dashed #d6aeb9; border-radius:10px; background:#fff; display:flex; justify-content:flex-start; align-items:center; gap:14px; }
body[data-page="sac_novo"] .attachment-empty-content { display:flex; align-items:center; justify-content:flex-start; gap:14px; width:100%; max-width:none; }
body[data-page="sac_novo"] .attachment-empty-content strong,
.video-empty-state strong { font-size:14px; font-weight:600; color:#334155; line-height:1.5; }
body[data-page="sac_novo"] .attachment-empty-content p,
.sac-video-area .video-empty-state p { font-size:12px; line-height:1.6; color:#64748b; margin:4px 0 0; max-width:none; }
.video-empty-state { border-color:#bfd0e8; }
.video-empty-icon { display:grid; place-items:center; width:42px; height:42px; flex:0 0 42px; background:#eff6ff; border:1px solid #dbeafe; border-radius:11px; color:#2563eb; }
.video-empty-icon svg { width:23px; height:23px; }
.sac-video-area:has([data-video-name]:not(:empty)) .video-empty-state,
.sac-video-area:has([data-video-existing]:not([hidden])) .video-empty-state { display:none; }
.sac-video-area .video-format-note { margin-top:14px; padding-top:12px; border-top:1px solid #dce6f2; }
.video-format-note > span { font-size:12px; font-weight:600; color:#3b5270; }
.sac-video-area .video-format-note p { margin:4px 0 0; color:#64748b; }
.sac-video-area .sac-video-actions { margin:12px 0 0; }
.sac-video-area .sac-video-actions:not(:has(.btn:not([hidden]))) { display:none; }
.sac-video-area [data-video-name]:empty,.sac-video-area .video-status:empty { display:none; }
.sac-video-area [data-video-name]:not(:empty) { padding:12px; background:#fff; border:1px solid #dbe3ec; border-radius:9px; color:#334155; }
.sac-video-area .video-status:not(:empty) { margin:12px 0 0; padding:10px 12px; border-radius:8px; background:#eff6ff; color:#334155; }
@media(max-width:600px) {
 body[data-page="sac_novo"] .attachment-box,body[data-page="sac_novo"] .sac-video-area { padding:14px; }
 body[data-page="sac_novo"] .attachment-header,.media-section-header { flex-direction:column; align-items:stretch; gap:12px; }
 .media-section-header .btn { width:100%; }
 body[data-page="sac_novo"] .attachment-list.empty,.video-empty-state { padding:14px; }
}

/* Matching media selection controls; full width on mobile. */
body[data-page="sac_novo"] #btnAdicionarImagem,
body[data-page="sac_novo"] #sac-video-area [data-video-choose] {
  width: 186px; min-width: 186px; height: 44px; min-height: 44px;
  padding: 10px 16px; box-sizing: border-box; gap: 8px;
  border-radius: 9px; font: 600 13px/20px "Segoe UI",Arial,sans-serif;
}
body[data-page="sac_novo"] #btnAdicionarImagem svg,
body[data-page="sac_novo"] #sac-video-area [data-video-choose] svg { width:18px; height:18px; flex:0 0 18px; }
@media(max-width:600px) {
 body[data-page="sac_novo"] #btnAdicionarImagem,
 body[data-page="sac_novo"] #sac-video-area [data-video-choose] { width:100%; min-width:0; }
}

body[data-page="sac_novo"] #sac-video-area [data-video-choose] { background:#1d4ed8; border-color:#1d4ed8; color:#fff; }
body[data-page="sac_novo"] #sac-video-area [data-video-choose]:hover { background:#1e40af; border-color:#1e40af; color:#fff; }
body[data-page="sac_novo"] #sac-video-area [data-video-choose]:disabled { opacity:.55; }

.sac-video-area .video-file-card { display:flex; align-items:center; gap:14px; padding:12px; background:#f8fafc; border:1px solid #dfe5ed; border-radius:12px; }
.sac-video-area .video-thumbnail { position:relative; display:grid; place-items:center; flex:0 0 56px; width:56px; height:56px; padding:0; border:1px solid #d3dce8; border-radius:9px; overflow:hidden; background:#1e293b; cursor:pointer; }
.sac-video-area .video-thumbnail video { position:absolute; inset:0; width:100%; height:100%; max-height:none; margin:0; border-radius:0; object-fit:cover; pointer-events:none; }
.video-thumbnail > span { position:relative; display:grid; place-items:center; width:26px; height:26px; border-radius:50%; background:rgba(15,23,42,.7); color:#fff; font-size:12px; }
.video-file-info { flex:1; min-width:0; }
.sac-video-area .video-file-info [data-video-name]:not(:empty) { border:0; background:transparent; padding:0; font-size:13px; line-height:1.5; }
.video-file-info [data-video-meta] { display:block; font-size:12px; color:#64748b; margin-top:3px; }
.video-open-link { display:inline-block; padding:0; border:0; background:none; font:600 12px/1.6 "Segoe UI",Arial,sans-serif; color:#1d4ed8; margin-top:4px; cursor:pointer; }
.sac-video-area .video-file-card .video-remove { width:auto; flex:0 0 auto; min-height:36px; padding:7px 10px; color:#be123c; border-color:#fecdd3; background:#fff; font-size:12px; }
.video-preview-dialog { display:none; }
.video-preview-dialog[open] { display:flex; flex-direction:column; }
.video-preview-canvas { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; overflow:hidden; background:#0f172a; }
.video-preview-canvas video { display:block; max-width:100%; max-height:100%; width:100%; height:100%; object-fit:contain; }
@media(max-width:480px) {
 .sac-video-area .video-file-card { flex-wrap:wrap; gap:10px; }
 .sac-video-area .video-file-card .video-remove { margin-left:66px; }
}

.saved-video-actions { display:flex; gap:8px; align-items:center; flex-shrink:0; }
.saved-video-actions .btn { min-height:44px; box-sizing:border-box; }
@media(max-width:600px) {
 .saved-video-dialog .attachment-preview-header { display:grid; grid-template-columns:minmax(0,1fr); padding:12px; }
 .saved-video-actions { justify-content:flex-end; }
 .saved-video-dialog .attachment-preview-header h2 { font-size:17px; }
}
