/* Farmap Web � ERP denso, visual moderno (2026) */

:root {
    --fp-bg: #d8e0ea;
    --fp-surface: #eef2f7;
    --fp-panel: #ffffff;
    --fp-border: #c5ced9;
    --fp-border-soft: #e2e8f0;
    --fp-text: #1e293b;
    --fp-text-muted: #64748b;
    --fp-header: #1a365d;
    --fp-header-mid: #2c5282;
    --fp-accent: #2563eb;
    --fp-accent-hover: #1d4ed8;
    --fp-row-hover: #f1f5f9;
    --fp-row-sel: #fff7d6;
    --fp-row-sel-accent: #f59e0b;
    --fp-row-sel-border: #333333;
    --fp-row-efet: #e4f2eb;
    --fp-row-efet-hover: #d4ebe0;
    --fp-fnbar: #334155;
    --fp-fnbar-active: #2563eb;
    --fp-radius: 4px;
    --fp-radius-lg: 10px;
    --fp-row-h: 18px;
    --fp-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fp-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --fp-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--fp-font);
    font-size: 11px;
    color: var(--fp-text);
    background: var(--fp-bg);
    -webkit-font-smoothing: antialiased;
}

/* Barra titulo unificada (Farmap - Sistema... - User - form + nav) */
.app-topbar {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 28px;
    padding: 4px 8px;
    gap: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--fp-header) 0%, var(--fp-header-mid) 100%);
    color: #fff;
    box-shadow: var(--fp-shadow-sm);
}
.app-topbar-brand {
    flex: 0 1 auto;
    min-width: 0;
    font-weight: 600;
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 45px;
}
.app-topbar-sep {
    opacity: 0.85;
    font-weight: 400;
}
.app-topbar-page {
    font-weight: 500;
    opacity: 0.95;
}
.app-topbar-nav-wrap {
    flex: 0 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}
.app-topbar-nav {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    max-width: 100%;
}
.app-topbar--no-tagline .app-topbar-tagline {
    display: none;
}
.topbar-btn {
    display: inline-block;
    flex: 0 0 auto;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    padding: 2px 8px;
    min-height: 20px;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}
.topbar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}
.topbar-btn.topbar-active {
    background: #fff;
    border-color: #fff;
    color: var(--fp-header);
    font-weight: 600;
}
.app-topbar--compact .app-topbar-brand {
    font-size: 10px;
    padding-right: 40px;
}
.app-topbar--compact .topbar-btn {
    font-size: 10px;
    padding: 2px 5px;
    letter-spacing: -0.02em;
}
.app-topbar--tight .app-topbar-brand {
    font-size: 9px;
    padding-right: 32px;
    letter-spacing: -0.02em;
}
.app-topbar--tight .topbar-btn {
    font-size: 9px;
    padding: 1px 4px;
    letter-spacing: -0.04em;
    font-stretch: condensed;
}

/* Legado — login / telas antigas */
.titlebar-main {
    background: linear-gradient(135deg, var(--fp-header) 0%, var(--fp-header-mid) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 11px;
    padding: 5px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
    box-shadow: var(--fp-shadow-sm);
}

/* Botoes */
.btn-farmap {
    display: inline-block;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    padding: 3px 10px;
    min-height: 22px;
    background: var(--fp-panel);
    color: var(--fp-text);
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    white-space: nowrap;
    vertical-align: middle;
    box-shadow: var(--fp-shadow-sm);
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn-farmap:hover:not(.disabled):not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}
.btn-farmap:active:not(.disabled):not(:disabled),
.btn-farmap.pressed {
    background: #e2e8f0;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}
.btn-farmap u { text-decoration: none; font-style: normal; }

.acc-key {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.lbl-inline .acc-key {
    cursor: pointer;
}
.btn-farmap.disabled,
.btn-farmap:disabled {
    color: #94a3b8;
    background: #f1f5f9;
    cursor: default;
    box-shadow: none;
}
.btn-farmap.btn-primary {
    background: var(--fp-accent);
    border-color: var(--fp-accent-hover);
    color: #fff;
    font-weight: 600;
}
.btn-farmap.btn-primary:hover:not(.disabled):not(:disabled) {
    background: var(--fp-accent-hover);
    border-color: var(--fp-accent-hover);
    color: #fff;
}
.btn-farmap.btn-blink-dark {
    background: var(--fp-header) !important;
    color: #fff !important;
    border-color: var(--fp-header) !important;
}
.btn-farmap.btn-calc-needed:not(.disabled):not(:disabled) {
    background: #f59e0b !important;
    border-color: #d97706 !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.45);
}
.btn-farmap.btn-mini { min-width: 22px; padding: 2px 6px; }

.fn-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 4px 4px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 3px;
}

/* Menu principal (fnbar): habilitado = claro; desabilitado = escuro/discreto */
.fnbar .fn-btn:not(.disabled) {
    background: #e8eef4;
    border-color: #94a3b8;
    color: #1e293b;
    font-weight: 500;
}
.fnbar .fn-btn:not(.disabled):hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}
.fnbar .fn-btn.fn-active {
    background: var(--fp-fnbar-active);
    border-color: #1d4ed8;
    color: #fff;
    font-weight: 600;
}
.fnbar .fn-btn.disabled {
    background: #3d4d61;
    border-color: #2d3a4a;
    color: #64748b;
    cursor: default;
    box-shadow: none;
    opacity: 0.9;
}

/* Login */
.login-desktop { min-height: 100vh; background: var(--fp-bg); }
.login-workspace {
    min-height: calc(100vh - 32px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.logon-window {
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-lg);
    background: var(--fp-panel);
    min-width: 380px;
    box-shadow: var(--fp-shadow-md);
    overflow: hidden;
}
.logon-title {
    background: linear-gradient(135deg, var(--fp-header), var(--fp-header-mid));
    color: #fff;
    font-weight: 600;
    padding: 8px 12px;
    font-size: 12px;
}
.logon-body { padding: 14px 16px 16px; }
.logon-msg {
    margin-bottom: 10px;
    padding: 6px 8px;
    border: 1px solid #fecaca;
    border-radius: var(--fp-radius);
    background: #fef2f2;
    color: #b91c1c;
}
.logon-form td { padding: 4px 8px 4px 0; vertical-align: middle; }
.logon-form td:first-child { white-space: nowrap; }
.logon-btns { text-align: right; white-space: nowrap; }
.logon-btns .btn-farmap { margin-left: 6px; }

/* Inputs */
.inp, .memo {
    font-family: inherit;
    font-size: 11px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: #fff;
    padding: 3px 6px;
    color: var(--fp-text);
    transition: border-color 0.12s, box-shadow 0.12s;
}
.inp:focus, .memo:focus {
    outline: none;
    border-color: var(--fp-accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.memo { width: 100%; resize: none; display: block; line-height: 1.35; }
.memo-hidden { display: none !important; }

/* Desktop app */
.farmap-desktop {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.workspace-full {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--fp-surface);
    min-height: 0;
}
.form-body {
    flex: 1;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    min-height: 0;
}
.hint-center {
    text-align: center;
    padding: 40px 10px;
    color: var(--fp-text-muted);
}

/* Grids */
.grid-wrap {
    overflow: auto;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: var(--fp-panel);
    box-shadow: var(--fp-shadow-sm);
}
.grid-main { flex: 1; min-height: 0; max-height: none; height: 100%; }

.ped-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    gap: 4px;
}
.ped-list-zone {
    flex: 1 1 auto;
    min-height: 48px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ped-list-zone .grid-wrap { flex: 1; min-height: 0; height: 100%; }

.split-bottom {
    flex: 0 0 auto;
    display: flex;
    gap: 4px;
    height: 254px;
    min-height: 254px;
    max-height: 254px;
}
.grid-sub-fixed {
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: auto;
}
.ped-shell .split-left .grid-sub-fixed {
    flex: 1 1 auto;
    min-height: 0;
}
.ped-shell .grid-itens thead th {
    vertical-align: bottom;
}
.ped-shell .grid-itens thead th.col-mp-head {
    padding: 0 2px 0 4px;
    height: 22px;
    line-height: normal;
    text-transform: none;
    letter-spacing: normal;
}
.grid-sub-head {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
    height: 100%;
    min-height: 20px;
    box-sizing: border-box;
}
.grid-sub-head-title {
    flex: 0 0 auto;
    align-self: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--fp-text-muted);
}
.grid-sub-head-actions {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
    padding-bottom: 1px;
}
.grid-sub-head-actions .nav-label {
    border: none;
    background: transparent;
    padding: 0;
    min-width: auto;
}
.btn-sub-compact {
    padding: 0 5px !important;
    font-size: 9px !important;
    min-height: 16px !important;
    line-height: 14px !important;
}
.nav-label-compact {
    font-size: 9px;
    margin: 0;
    line-height: 14px;
}
.grid-sub { min-height: 0; max-height: none; }

.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    table-layout: fixed;
}
.grid th, .grid td {
    border-bottom: 1px solid var(--fp-border-soft);
    border-right: 1px solid var(--fp-border-soft);
    padding: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: var(--fp-row-h);
    line-height: var(--fp-row-h);
}
.grid th {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    font-weight: 600;
    font-size: 10px;
    color: var(--fp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}
.grid tbody tr { cursor: pointer; transition: background 0.08s; }
.grid tbody tr:nth-child(even) { background: #fafbfc; }
.grid tbody tr:nth-child(odd) { background: #fff; }
.grid tbody tr:hover:not(.row-sel) { background: var(--fp-row-hover); }
.grid tbody tr.row-sel {
    position: relative;
    z-index: 2;
    box-shadow: inset 3px 0 0 var(--fp-row-sel-accent), inset 0 1px 0 0 var(--fp-row-sel-border);
}
.grid tbody tr.row-sel td {
    border-bottom: 1px solid var(--fp-row-sel-border);
}
.grid tbody tr.row-sel td:first-child {
    border-left: 1px solid var(--fp-row-sel-border);
}
.grid tbody tr.row-sel td:last-child {
    border-right: 1px solid var(--fp-row-sel-border);
}
.ped-shell .grid-ped tbody tr.row-efet {
    background: var(--fp-row-efet);
}
.ped-shell .grid-ped tbody tr.row-efet:hover {
    background: var(--fp-row-efet-hover);
}
.ped-shell .grid-ped td.cell-dteft-prod {
    color: #15803d;
    font-weight: 600;
}
.ped-shell .grid-ped td.cell-retirada-rot {
    color: #15803d;
    font-weight: 600;
}
/* Pedidos/Orcamentos lista principal: sem col-sel (marcador = barra inset, igual grid-itens) */
.ped-shell.screen-shell--fill .grid-ped .col-sel,
.orc-shell .grid-ped .col-sel {
    display: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}
/* Clientes: manter indicador de selecao no mesmo padrao compacto do Pedidos */
.cli-shell #tblClientes .col-sel {
    display: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}
.grid .col-sel::before { content: ''; }
.grid tbody tr.row-sel .col-sel::before { content: '\25B6'; font-size: 8px; }
.empty-row {
    text-align: center;
    color: var(--fp-text-muted);
    cursor: default !important;
    font-style: italic;
}

/* Grid pedidos */
/* Pedidos: rotulos em title case (menos largura que ALL CAPS) */
.ped-shell .grid th,
.ped-shell .memo-lbl,
.ped-shell .lbl-inline,
.dlg-wizard .grid th,
.dlg-wizard .dlg-section-lbl,
.dlg-wizard .dlg-search label,
.dlg-wizard .wiz-lbl,
.dlg-wizard .dlg-wiz-qty label {
    text-transform: none;
    letter-spacing: 0;
}
.ped-shell .grid th,
.dlg-wizard .grid th {
    font-size: 10px;
}
.grid-ped th.col-h-sm {
    font-size: 9px;
    line-height: 11px;
    padding: 0 1px;
    letter-spacing: 0.02em;
}
/* Larguras .col-*: farmap-columns.css (--fp-col-*) */
.grid-ped td.cell-editable { cursor: cell; background: rgba(255, 252, 230, 0.35); }
.grid-ped td.cell-editable:hover { background: rgba(255, 248, 200, 0.55); }
.grid-ped td.cell-editing { padding: 0; }
.grid-ped td.cell-editing input.cell-inp {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #4a7ec7;
    font-size: 10px;
    padding: 1px 1px;
    margin: 0;
    font-family: inherit;
    text-align: center;
}

/* Pedidos grid itens: Calc/End/Fator/Lote/Forn/Validade fixos; MP = resto da largura */
.ped-shell.screen-shell--fill .grid-itens th.col-mp,
.ped-shell.screen-shell--fill .grid-itens td.col-mp {
    width: auto;
    min-width: 48px;
    max-width: none;
}
.ped-shell.screen-shell--fill .grid-itens th.col-calc,
.ped-shell.screen-shell--fill .grid-itens td.col-calc {
    width: var(--fp-col-calc);
    min-width: var(--fp-col-calc);
    max-width: var(--fp-col-calc);
}
.ped-shell.screen-shell--fill .grid-itens th.col-enduso,
.ped-shell.screen-shell--fill .grid-itens td.col-enduso {
    width: var(--fp-col-enduso);
    min-width: var(--fp-col-enduso);
    max-width: var(--fp-col-enduso);
}
.ped-shell.screen-shell--fill .grid-itens th.col-fator,
.ped-shell.screen-shell--fill .grid-itens td.col-fator {
    width: var(--fp-col-fator);
    min-width: var(--fp-col-fator);
    max-width: var(--fp-col-fator);
}
.ped-shell.screen-shell--fill .grid-itens th.col-lote,
.ped-shell.screen-shell--fill .grid-itens td.col-lote {
    width: var(--fp-col-lote);
    min-width: var(--fp-col-lote);
    max-width: var(--fp-col-lote);
}
.ped-shell.screen-shell--fill .grid-itens th.col-forn,
.ped-shell.screen-shell--fill .grid-itens td.col-forn {
    width: var(--fp-ped-itens-forn-w);
    min-width: var(--fp-ped-itens-forn-w);
    max-width: var(--fp-ped-itens-forn-w);
}
.ped-shell.screen-shell--fill .grid-itens th.col-valitem,
.ped-shell.screen-shell--fill .grid-itens td.col-valitem {
    width: var(--fp-col-valitem);
    min-width: var(--fp-col-valitem);
    max-width: var(--fp-col-valitem);
}
.grid-itens { table-layout: fixed; width: 100%; }

.farmap-dialog {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(0.80px);
    display: none;
    z-index: 9000;
}
.farmap-dialog.is-open {
    display: block;
}
.farmap-dialog .dlg-window {
    position: fixed;
    margin: 0;
    width: 480px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-lg);
    background: var(--fp-panel);
    box-shadow: var(--fp-shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.farmap-dialog .dlg-title {
    background: linear-gradient(135deg, var(--fp-header), var(--fp-header-mid));
    color: #fff;
    font-weight: 600;
    padding: 8px 12px;
    font-size: 12px;
}
.farmap-dialog .dlg-body { padding: 12px 14px; }
.farmap-dialog .dlg-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.farmap-dialog .dlg-search label {
    color: var(--fp-text-muted);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.farmap-dialog .dlg-search .inp { flex: 1; min-width: 0; }
.farmap-dialog .dlg-hint {
    font-size: 10px;
    color: var(--fp-text-muted);
    margin-bottom: 6px;
}
.farmap-dialog .dlg-grid { height: 255px; max-height: 42vh; }
.farmap-dialog .dlg-btns {
    text-align: right;
    padding: 0 14px 14px;
    border-top: 1px solid var(--fp-border-soft);
    padding-top: 10px;
    margin-top: 0;
}
.farmap-dialog .dlg-btns .btn-farmap { margin-left: 6px; }

.farmap-hide-custo .col-custo-restr { display: none !important; }

.dlg-tabelas .dlg-window { width: min(520px, 96vw); }
.dlg-tabelas-wide .dlg-window { width: min(780px, 98vw); }
.dlg-tabelas-posol .dlg-window { width: min(860px, 98vw); }
.dlg-tabelas-tprec .dlg-window { width: min(680px, 98vw); max-height: 90vh; }
.dlg-tab-actions-compact { flex-wrap: nowrap; }
.dlg-tab-actions-compact .btn-farmap { white-space: nowrap; }
.dlg-tabelas-small .dlg-window { width: min(440px, 94vw); }
.dlg-tabelas-hub .dlg-window { width: min(560px, 96vw); }
.dlg-tab-hub-body { padding-top: 8px; }
.tab-hub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.tab-hub-btn {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}
.dlg-tab-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}
.dlg-tab-actions .tab-status {
    flex: 1;
    text-align: left;
    font-size: 10px;
    color: var(--fp-text-muted);
    min-width: 80px;
}
.dlg-forn-pick .dlg-window { width: min(720px, 96vw); }
.dlg-mp-pick {
    --fp-mp-pick-nome-w: 240px;
    --fp-mp-pick-forn-w: 120px;
    --fp-mp-pick-val-w: 90px;
    --fp-mp-pick-forn-boost: 100px;
    --fp-mp-pick-table-w: calc(var(--fp-mp-pick-nome-w) * 1.125 + var(--fp-mp-pick-val-w) - 20px + var(--fp-mp-pick-forn-w) * 1.3);
}
.dlg-mp-pick .dlg-window {
    width: max-content;
    min-width: calc(var(--fp-mp-pick-table-w) + 20px);
    max-width: min(96vw, 780px);
    height: 480px;
    min-height: 480px;
    max-height: calc(100vh - 16px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: fixed;
    overflow: hidden;
}
.dlg-mp-pick .dlg-list-pick-filter {
    width: var(--fp-mp-pick-table-w);
    max-width: 100%;
    box-sizing: border-box;
}
.dlg-mp-pick .dlg-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: max-content;
    max-width: 100%;
    box-sizing: border-box;
}
.dlg-mp-pick #dlgMpPickListView {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: max-content;
    max-width: 100%;
}
.dlg-mp-pick-actions .dlg-mp-pick-spacer { flex: 1; min-width: 8px; }
.dlg-mp-pick-novo-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 36px 12px 12px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.92);
}
.dlg-mp-pick-novo-panel {
    width: max-content;
    min-width: 350px;
    max-width: calc(100% - 8px);
    height: auto;
    box-sizing: border-box;
    padding: 10px 12px 8px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: var(--fp-panel);
    box-shadow: var(--fp-shadow-md);
}
.dlg-mp-pick-novo-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.dlg-mp-pick-novo-row .lbl-inline { width: 52px; flex-shrink: 0; }
.dlg-mp-pick-novo-row .inp { flex: 1; min-width: 0; }
.dlg-mp-pick-novo-row-split { gap: 10px; }
.dlg-mp-pick-novo-row-split .dlg-mp-pick-novo-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.dlg-mp-pick-novo-btns { display: flex; gap: 6px; margin-top: 10px; }
.grid-mp-pick {
    table-layout: fixed;
    width: var(--fp-mp-pick-table-w);
    min-width: var(--fp-mp-pick-table-w);
    max-width: var(--fp-mp-pick-table-w);
}
.grid-mp-pick .col-mp-nome {
    width: calc(var(--fp-mp-pick-nome-w) * 1.125 - 25px);
    min-width: calc(var(--fp-mp-pick-nome-w) * 1.125 - 25px);
    max-width: calc(var(--fp-mp-pick-nome-w) * 1.125 - 25px);
}
.grid-mp-pick .col-mp-forn {
    width: calc(var(--fp-mp-pick-forn-w) * 1.3 + var(--fp-mp-pick-forn-boost));
    min-width: calc(var(--fp-mp-pick-forn-w) * 1.3 + var(--fp-mp-pick-forn-boost));
    max-width: calc(var(--fp-mp-pick-forn-w) * 1.3 + var(--fp-mp-pick-forn-boost));
}
.grid-mp-pick .col-mp-val-lote {
    width: calc(var(--fp-mp-pick-val-w) - 25px);
    min-width: calc(var(--fp-mp-pick-val-w) - 25px);
    max-width: calc(var(--fp-mp-pick-val-w) - 25px);
    text-align: right;
}
.grid-mp-pick th.col-mp-val-lote { text-align: right; }
.grid-mp-pick .col-mp-saldo {
    width: calc(var(--fp-mp-pick-val-w) - 25px);
    min-width: calc(var(--fp-mp-pick-val-w) - 25px);
    max-width: calc(var(--fp-mp-pick-val-w) - 25px);
    text-align: right;
}
.dlg-forn-pick-actions .dlg-forn-pick-spacer { flex: 1; min-width: 8px; }
.dlg-forn-pick-novo { padding: 4px 0 8px; }
.dlg-forn-pick-novo-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.dlg-forn-pick-novo-row .lbl-inline { width: 52px; flex-shrink: 0; }
.dlg-forn-pick-novo-row .inp { flex: 1; min-width: 0; }
.dlg-forn-pick-novo-btns { display: flex; gap: 6px; margin-top: 10px; }
.grid-forn-pick { table-layout: fixed; width: 100%; }
.grid-forn-pick .col-forn-nome { width: 60%; }
.grid-forn-pick .col-forn-cnpj { width: 118px; text-align: right; }
.grid-forn-pick th.col-forn-cnpj { text-align: right; }
.grid-forn-pick .col-forn-tel { width: 119px; text-align: right; }
.grid-forn-pick th.col-forn-tel { text-align: right; }
.tab-restr-check {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    cursor: pointer;
}
.grid-tab-users .col-dt { width: 108px; }
.grid-tab-users .col-num { width: 48px; text-align: right; }
.grid-tab-users .col-chk { width: 52px; text-align: center; }
.logon-hint { font-size: 12px; margin-bottom: 8px; color: #444; }

.dlg-tabelas-volcap .dlg-window { width: min(168px, 94vw); }
.grid-tab-volcap { table-layout: fixed; width: 100%; }
.grid-tab-volcap .col-vc-nome,
.grid-tab-volcap td[data-field="NomeCap"] {
    width: 52px; min-width: 52px; max-width: 52px;
    text-align: center; padding-left: 4px; padding-right: 4px;
}
.grid-tab-volcap .col-vc-vol,
.grid-tab-volcap td[data-field="Volume"] {
    width: 88px; min-width: 88px; max-width: 88px;
    text-align: right;
}
.dlg-tabelas-master .dlg-window { width: min(920px, 98vw); max-height: 88vh; }
.tab-md-body { min-height: 0; }
.tab-md-split { display: flex; gap: 10px; min-height: 280px; max-height: 52vh; }
.tab-md-list { flex: 0 0 240px; min-width: 200px; display: flex; flex-direction: column; gap: 6px; }
.tab-md-list .dlg-grid { flex: 1; min-height: 0; }
.tab-md-detail { flex: 1; min-width: 0; overflow: auto; }
.tab-md-fieldset { border: 1px solid var(--fp-border); border-radius: var(--fp-radius); padding: 8px 10px; margin: 0; height: 100%; }
.tab-md-fieldset legend { font-size: 11px; font-weight: 600; padding: 0 4px; }
.tab-md-form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 11px; }
.tab-md-row { display: contents; }
.tab-md-row-nome { display: flex; gap: 8px; grid-column: 1 / -1; margin-bottom: 4px; }
.tab-md-lbl { color: var(--fp-text-muted); font-weight: 600; font-size: 10px; text-transform: uppercase; }
.tab-md-val { padding: 2px 4px; border: 1px solid transparent; border-radius: 3px; cursor: cell; min-height: 18px; }
.tab-md-val:hover { border-color: var(--fp-border); background: #fffef8; }
.tab-md-empty { color: var(--fp-text-muted); font-size: 11px; margin: 0; }
.grid-tab-posol .col-num-sm { width: 44px; text-align: right; }
.grid-tab-posol td[data-field="PosolNom"] { width: auto; }
.tab-tprec-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.tab-tprec-grid { height: 220px; max-height: 34vh; flex-shrink: 0; }
.tab-tprec-matriz-lbl { font-size: 11px; font-weight: 600; color: var(--fp-text-muted); margin: 0; }
.tab-tprec-matriz { width: 100%; min-height: 120px; max-height: 22vh; resize: vertical; font-family: Consolas, 'Courier New', monospace; font-size: 11px; }
.grid-tab-tprec { table-layout: fixed; width: 100%; }
.grid-tab-tprec td[data-field="TPRecNom"] { width: auto; }
.grid-tab-tprec .col-money { width: 96px; text-align: right; }
.grid-tab-tprec td[data-field="CustoFixo"],
.grid-tab-tprec td[data-field="CustoUnit"] { text-align: right; }
.grid-tab-tprec td[data-field="Grupo"] { width: 88px; }
.grid-tab-tprec td[data-field="TPCalculoNom"] { width: 108px; }

/* Wizard Novo Pedido */
.dlg-wizard .dlg-window { width: min(1180px, 98vw); max-height: 88vh; display: flex; flex-direction: column; }
.dlg-wizard .dlg-body { overflow-y: auto; flex: 1; min-height: 0; }
.dlg-wiz-columns { display: flex; gap: 10px; align-items: stretch; }
.dlg-wiz-columns-2 .dlg-wiz-col:first-child { flex: 1.15; min-width: 0; }
.dlg-wiz-columns-2 .dlg-wiz-col-detail { flex: 1; min-width: 0; }
.dlg-wiz-columns-3 .dlg-wiz-col { flex: 1; min-width: 0; }
.dlg-wiz-columns-3 .dlg-wiz-col:nth-child(1) { flex: 1.2; }
.dlg-wiz-columns-3 .dlg-wiz-col:nth-child(2) { flex: 1.35; }
.dlg-wiz-columns-3 .dlg-wiz-col:nth-child(3) { flex: 0.88; }
.dlg-wiz-columns-3 .dlg-grid-wiz { height: 248px; max-height: 36vh; }
.dlg-grid-wiz { height: 188px; max-height: 28vh; overflow: auto; }
#dlgListWrap.dlg-grid-wiz {
    height: 298px;
    max-height: 46vh;
}
.dlg-wiz-columns-2 .dlg-cli-preview,
.dlg-wiz-columns-2 .dlg-medi-preview { min-height: 298px; }
#dlgMediListWrap.dlg-grid-wiz {
    height: 298px;
    max-height: 46vh;
}
.dlg-wiz-chosen-bar {
    margin-bottom: 10px;
    padding: 6px 8px;
    border: 1px solid #bfdbfe;
    border-radius: var(--fp-radius);
    background: #eff6ff;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlg-wiz-rec-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
}
.dlg-wiz-rec-head .dlg-wiz-chips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.dlg-wiz-rec-head .dlg-wiz-chip { max-width: 100%; }
.dlg-wiz-rec-head .dlg-wiz-fields {
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.dlg-wiz-fixed { margin-bottom: 8px; }
.dlg-wiz-chip {
    font-size: 11px;
    padding: 5px 8px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: #f8fafc;
    color: var(--fp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlg-wiz-chip-click {
    cursor: pointer;
    border-color: var(--fp-accent);
    background: #eff6ff;
}
.dlg-wiz-chip-click:hover { background: #dbeafe; }
.dlg-wiz-chip .wiz-lbl {
    font-size: 9px;
    font-weight: 600;
    color: var(--fp-text-muted);
    margin-right: 6px;
}
.dlg-rec-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.dlg-rec-toolbar .dlg-search { flex: 1; min-width: 0; margin-bottom: 0; }
.dlg-rec-search { display: flex; align-items: center; gap: 8px; }
.dlg-rec-mode-radio {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
}
.dlg-rec-search-lbl {
    flex: 0 0 auto;
    width: 9.8em;
    min-width: 9.8em;
    color: var(--fp-text-muted);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.dlg-rec-search .inp { flex: 1; min-width: 0; }
.dlg-section-lbl {
    font-size: 11px;
    font-weight: 600;
    color: var(--fp-text-muted);
    margin-bottom: 4px;
}
.dlg-wiz-qty.inp-qty-await {
    background: #fef3c7;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}
.dlg-wiz-qty.inp-qty-await label { color: #b45309; }
.dlg-wiz-qty.inp-qty-await .inp-qty {
    background: #fffbeb;
    border-color: #f59e0b;
    font-weight: 700;
}
.dlg-wiz-retira {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #e8f0fb;
    border: 1px solid #9bb8e8;
    border-radius: 4px;
}
.dlg-wiz-retira label { font-size: 12px; font-weight: 600; color: #1a4a8a; white-space: nowrap; }
.dlg-wiz-retira .inp-retira {
    width: 108px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}
.dlg-wiz-retira.inp-retira-await {
    background: #fef3c7;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}
.dlg-wiz-retira.inp-retira-await label { color: #b45309; }
.dlg-wiz-retira.inp-retira-await .inp-retira {
    background: #fffbeb;
    border-color: #f59e0b;
    font-weight: 700;
}
.grid-dlg-cli .cell-cli-edit {
    cursor: pointer;
    color: #1d4ed8;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}
.grid-dlg-cli .cell-cli-edit:hover { background: rgba(219, 234, 254, 0.55); }
.dlg-cli-preview {
    margin-top: 0;
    border: 1px solid var(--fp-border);
    border-radius: 6px;
    background: #f8fafc;
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.dlg-cli-preview-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-bottom: 1px solid #e2e8f0;
}
.dlg-cli-preview-body {
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.4;
    overflow-y: auto;
}
.cli-prev-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.cli-prev-line:last-child { margin-bottom: 0; }
.cli-prev-lbl {
    color: #64748b;
    font-weight: 600;
    margin-right: 4px;
}
.btn-farmap.btn-tiny {
    font-size: 10px;
    padding: 2px 8px;
    min-height: 0;
}
.dlg-wizard .dlg-wiz-btns {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    text-align: center;
}
.dlg-wizard .dlg-wiz-btns .btn-farmap { margin-left: 0; float: none; }
.dlg-btns .dlg-btn-left { float: left; margin-left: 0 !important; margin-right: 6px; }
.dlg-btns:not(.dlg-wiz-btns)::after { content: ""; display: table; clear: both; }
.dlg-toast-msg {
    font-size: 11px;
    line-height: 28px;
    color: #16a34a;
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
    white-space: nowrap;
}
.dlg-toast-msg.show { opacity: 1; }

.dlg-inter .dlg-window { width: min(1150px, 96vw); max-height: 88vh; }

.dlg-rotulo .dlg-window { width: min(560px, 96vw); }
.dlg-rotulo .dlg-body { display: flex; flex-direction: column; gap: 8px; }
.dlg-rotulo .rotulo-header { font-size: 12px; color: #334155; }
.dlg-rotulo .rotulo-memo { width: 100%; box-sizing: border-box; resize: vertical; font-size: 12px; line-height: 1.4; min-height: 160px; }
.dlg-rotulo .rotulo-flags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; }
.dlg-rotulo .rotulo-flags span { background: #f1f5f9; border: 1px solid var(--fp-border-soft); border-radius: var(--fp-radius); padding: 2px 8px; }
.dlg-rotulo .rotulo-opts { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--fp-border-soft); border-radius: var(--fp-radius); }
.dlg-rotulo .rotulo-opts-col { display: flex; flex-direction: column; gap: 4px; }
.dlg-rotulo .rotulo-opt { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; }
.dlg-rotulo .rotulo-opt input { margin: 0; }
.dlg-rotulo .rotulo-geom { display: flex; flex-wrap: wrap; gap: 10px; }
.dlg-rotulo .rotulo-geom label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: #334155; }
.dlg-rotulo .rotulo-geom input { width: 70px; box-sizing: border-box; text-align: right; }

.dlg-posol { width: min(520px, 94vw); max-height: 88vh; display: flex; flex-direction: column; }
.dlg-posol .dlg-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-posol .dlg-body { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.posol-filters { display: flex; flex-direction: row; flex-wrap: wrap; gap: 18px; padding: 6px 10px; background: #f1f5f9; border: 1px solid var(--fp-border-soft); border-radius: var(--fp-radius); }
.posol-filter-item { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; user-select: none; }
.posol-filter-item input { margin: 0; }
.posol-filter-item input[type="radio"] { accent-color: var(--fp-fnbar-active); }
.posol-list { flex: 1; min-height: 240px; max-height: min(54vh, 440px); overflow: auto; border: 1px solid var(--fp-border-soft); background: #fff; padding: 4px; outline: none; }
.posol-grp-title { font-size: 10px; font-weight: 700; color: var(--fp-text-muted); margin: 8px 4px 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.posol-grp-title:first-child { margin-top: 2px; }
.posol-list-item { padding: 4px 8px; cursor: pointer; font-size: 12px; line-height: 1.35; border-radius: 3px; }
.posol-list-item:hover { background: var(--fp-row-hover); }
.posol-list-item.sel { background: var(--fp-row-sel); box-shadow: inset 3px 0 0 var(--fp-row-sel-accent); font-weight: 600; }
.posol-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.posol-hint { margin: 0; font-size: 10px; color: var(--fp-text-muted); }
.posol-search { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.posol-search label { font-size: 11px; font-weight: 600; color: var(--fp-text-muted); white-space: nowrap; }
.posol-search .inp { flex: 1; min-width: 0; }

/* Orcamentos: largura fixa (colunas pedidos), centralizado; encolhe se viewport menor */
.ped-shell.screen-shell--fixed {
    align-self: center;
    flex: 0 1 auto;
    width: var(--fp-orc-shell-min);
    max-width: 100%;
    min-width: 0;
}
.orc-shell .grid-ped .col-rec {
    width: var(--fp-orc-rec-w);
    min-width: var(--fp-orc-rec-w);
    max-width: var(--fp-orc-rec-w);
}
.orc-shell .grid-ped td.col-rec {
    position: relative;
    padding-right: 16px;
}
.orc-shell .grid-ped td.col-rec .cell-rec-nome {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.orc-shell .grid-ped .cell-rec-down {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 15px;
    height: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    border-left: 1px solid var(--fp-border-soft);
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    cursor: pointer;
}
.orc-shell .grid-ped tr.row-sel .cell-rec-down {
    display: block;
}
.orc-shell .grid-ped .cell-rec-down::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -3px;
    margin-top: -1px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 4px solid #334155;
}
.orc-shell .grid-ped .cell-rec-down:hover {
    background: linear-gradient(180deg, #eef2f7 0%, #cbd5e1 100%);
}
.orc-shell .grid-ped .col-qty {
    width: var(--fp-orc-qty-w);
    min-width: var(--fp-orc-qty-w);
    max-width: var(--fp-orc-qty-w);
}
.orc-shell .grid-ped .col-money-md {
    width: var(--fp-orc-money-md-w);
    min-width: var(--fp-orc-money-md-w);
    max-width: var(--fp-orc-money-md-w);
}
.orc-shell .grid-ped .col-money {
    width: var(--fp-orc-custo-w);
    min-width: var(--fp-orc-custo-w);
    max-width: var(--fp-orc-custo-w);
}
.orc-shell .grid-itens .col-mp {
    width: var(--fp-orc-mp-w);
    max-width: var(--fp-orc-mp-w);
}
.orc-shell .grid-itens .col-lote {
    width: var(--fp-orc-lote-w);
    min-width: var(--fp-orc-lote-w);
    max-width: var(--fp-orc-lote-w);
}
.orc-shell .grid-itens .col-forn {
    width: var(--fp-orc-forn-w);
    min-width: var(--fp-col-forn-min);
    max-width: var(--fp-orc-forn-w);
}
.orc-shell .split-bottom {
    width: 100%;
    max-width: 100%;
}
.orc-shell .split-left {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - var(--fp-orc-memo-w) - 4px);
}
.orc-shell .orc-memo-pane {
    flex: 0 0 var(--fp-orc-memo-w);
    width: var(--fp-orc-memo-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.orc-shell .orc-memo-pane .memo-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.orc-shell .orc-memo-pane .memo { flex: 1; min-height: 0; height: auto; }
.orc-shell .grid-main .grid,
.orc-shell .grid-sub-fixed {
    overflow-x: hidden !important;
}
.orc-shell .grid-sub-fixed .grid {
    width: 100% !important;
    table-layout: fixed !important;
}
.memo-lbl-action { cursor: pointer; }
.memo-lbl-action:hover { color: var(--fp-accent); }
.memo-clickable { cursor: pointer; }
.memo-clickable:hover { background: #fafbfc; }
.memo-lbl-disabled { opacity: 0.55; cursor: default; }
textarea.memo:not(.memo-clickable) { cursor: default; }
.dlg-inter .dlg-body { display: flex; flex-direction: column; max-height: 68vh; }
.dlg-inter-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.dlg-inter-filter label { font-size: 11px; white-space: nowrap; }
.dlg-inter-filter .inp { flex: 1; min-width: 120px; }
.dlg-inter-count { font-size: 10px; color: #555; white-space: nowrap; }
.grid-wrap.dlg-grid-inter { flex: 1; min-height: 200px; max-height: 58vh; overflow: auto; }
.grid-dlg-inter td { font-size: 11px; vertical-align: top; white-space: normal; line-height: 1.35; }
.dlg-wiz-fixed { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.dlg-wiz-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #e8f0fb;
    border: 1px solid #9bb8e8;
    border-radius: 4px;
}
.dlg-wiz-qty label { font-size: 12px; font-weight: 600; color: #1a4a8a; white-space: nowrap; }
.dlg-wiz-qty .inp-qty {
    width: 72px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

/* Barra acoes */
.action-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 3px;
    padding: 4px 6px;
    background: var(--fp-panel);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    box-shadow: var(--fp-shadow-sm);
}
.action-bar .btn-farmap {
    padding: 2px 7px;
    font-size: 10px;
    min-height: 20px;
    flex-shrink: 0;
}
.action-bar .lbl-inline {
    margin: 0 2px 0 6px;
    flex-shrink: 0;
    color: var(--fp-text-muted);
    font-weight: 600;
    font-size: 10px;
}
.action-bar .inp { flex-shrink: 0; width: 110px; }
.action-bar .inp-select {
    flex-shrink: 0;
    width: auto;
    min-width: 200px;
    max-width: 240px;
    font-size: 10px;
    padding: 1px 4px;
    min-height: 20px;
}
.action-bar-spacer { flex: 1 1 auto; min-width: 8px; }
.action-bar .nav-label { flex-shrink: 0; margin: 0 4px; }

.nav-label {
    display: inline-block;
    min-width: 54px;
    text-align: center;
    padding: 2px 6px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: #f8fafc;
    line-height: 16px;
    font-size: 10px;
    font-weight: 600;
    color: var(--fp-text-muted);
    font-variant-numeric: tabular-nums;
}

.split-left { flex: 1 1 52%; min-width: 0; display: flex; flex-direction: column; gap: 4px; height: 100%; }
.split-right { flex: 1 1 48%; min-width: 0; display: flex; flex-direction: column; gap: 4px; height: 100%; }
.sub-nav { display: flex; align-items: center; gap: 3px; padding: 2px 0; flex-shrink: 0; }

/* Observacoes: stack Obs.Pedido + Obs.Receita | Rotulo */
.memo-layout {
    flex-direction: row !important;
    gap: 4px;
    min-width: 0;
    height: 100%;
}
.memo-stack {
    flex: 0 0 53.33%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
}
.memo-stack .memo-panel {
    flex: 1 1 33%;
    min-height: 0;
}
.memo-rotulo {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}
.memo-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.memo-lbl {
    font-size: 10px;
    font-weight: 600;
    color: var(--fp-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 2px;
    flex-shrink: 0;
}
.memo-panel .memo {
    flex: 1;
    min-height: 0;
    height: auto;
    font-size: 11px;
    line-height: 1.35;
}
.memo-panel .memo:not([readonly]) {
    background: #fffef8;
}
.memo-panel .memo[readonly] {
    background: #f8fafc;
    color: var(--fp-text-muted);
}

.fnbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 4px;
    background: var(--fp-fnbar);
    border-bottom: 1px solid #1e293b;
    overflow-x: auto;
    flex-shrink: 0;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    z-index: 9999;
    letter-spacing: 0.02em;
}
.loading-overlay::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    margin-right: 10px;
    animation: fp-spin 0.7s linear infinite;
}
@keyframes fp-spin { to { transform: rotate(360deg); } }

/* Cursor ampulheta nao-bloqueante durante recalculo rapido (ex.: quant/desconto em pedidos.js,
   quant/divisor em orcamentos.js) - reusavel via classe body.fp-busy em qualquer tela, sem
   overlay de tela cheia. */
body.fp-busy, body.fp-busy * { cursor: wait !important; }

/* Largura do shell: pedidos = tela cheia; demais = compacto se couber */
.ped-shell.screen-shell--fill,
.screen-shell--fill {
    width: 100%;
}
.screen-shell--compact {
    align-self: flex-start;
    width: max-content;
    max-width: 100%;
}
.screen-shell--compact .grid-main .grid {
    width: max-content;
    max-width: 100%;
}
.screen-shell--compact .split-bottom {
    width: 100%;
    min-width: min(100%, max-content);
}
.screen-shell--medium {
    align-self: flex-start;
    width: 100%;
    max-width: 960px;
}
.screen-shell--fixed {
    align-self: center;
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 768px) {
    .split-bottom { flex-direction: column; }
    .fnbar { flex-wrap: wrap; }
    .fn-btn { flex: 1 1 30%; }
}

/* Painel detalhe CRUD */
.crud-detail-panel { flex: 1; min-width: 0; padding: 6px 8px; }
.crud-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 12px;
}
.crud-field { font-size: 11px; line-height: 1.35; }
.crud-field-wide { grid-column: 1 / -1; }
.crud-lbl {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--fp-text-muted);
    text-transform: uppercase;
}
.crud-val {
    display: block;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 3px;
    min-height: 22px;
}
.crud-val[data-field] {
    cursor: cell;
    border-color: var(--fp-border);
    background: rgba(255, 252, 230, 0.35);
}
.crud-val[data-field]:hover { background: rgba(255, 248, 200, 0.55); }

.hint-block {
    margin: 8px 0 12px;
    padding: 8px 10px;
    color: var(--fp-text-muted);
    font-size: 13px;
}
.db-update-log {
    margin: 8px 0 12px;
    padding: 10px 12px;
    background: #f8f8f4;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    white-space: pre-wrap;
    overflow: auto;
    max-height: 360px;
}
.posol-rebuild-progress {
    height: 14px;
    background: #e8e8e4;
    border: 1px solid var(--fp-border);
    border-radius: 7px;
    overflow: hidden;
    margin: 8px 0 6px;
}
.posol-rebuild-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    min-width: 2px;
    transition: width 0.3s ease;
}
.section-title {
    margin: 12px 0 6px;
    font-size: 14px;
    font-weight: 600;
}

/* Formularios pequenos (Ferramentas, dialogs utilitarios) */
.tool-form {
    align-self: flex-start;
    width: 100%;
    max-width: none;
    margin: 8px 0 16px;
    padding: 12px 14px;
    background: var(--fp-panel);
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    box-shadow: var(--fp-shadow-sm);
}
.tool-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    align-items: start;
}
.tool-form .tool-card {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--farmap-border, #c8c8c8);
    border-radius: 4px;
    background: #fafafa;
}
.tool-form .tool-card .section-title {
    margin-top: 0;
}
.tool-form--wide {
    max-width: 640px;
}
.tool-form .hint-block {
    margin: 0 0 10px;
    padding: 0;
    background: none;
    border: none;
    font-size: 12px;
    line-height: 1.45;
}
.tool-form .section-title {
    margin: 10px 0 6px;
    font-size: 13px;
}
.tool-form .tool-links {
    list-style: none;
    margin: 0;
    padding: 0;
}
.tool-form .tool-links li {
    margin: 0 0 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--fp-border);
}
.tool-form .tool-links li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.tool-form .tool-links .btn-farmap {
    display: inline-block;
    margin-bottom: 4px;
}
.tool-form .tool-desc {
    display: block;
    margin: 0;
    color: var(--fp-text-muted);
    font-size: 11px;
    line-height: 1.4;
}
.tool-form .tool-option-block {
    margin: 16px 0 20px;
    padding: 12px 14px;
    border: 1px solid var(--farmap-border, #c8c8c8);
    border-radius: 4px;
    background: #fafafa;
}
.tool-form .tool-check-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
}
.tool-form .tool-check-label input {
    margin-top: 3px;
}
.tool-form .tool-option-block .tool-desc {
    margin: 8px 0 0 24px;
}
.tool-form .tool-print-card .tool-desc {
    margin: 8px 0 0 0;
}
.tool-form .tool-print-card .btn-farmap {
    margin-bottom: 0;
}
.dlg-print-config .dlg-print-config-window {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(500px, 96vw);
}
.dlg-print-config .dlg-print-field {
    margin: 0 0 12px;
}
.dlg-print-config .dlg-print-field label {
    display: block;
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--fp-text-muted);
}
.dlg-print-config .dlg-print-field select {
    width: 100%;
    box-sizing: border-box;
}
.dlg-print-config .dlg-print-empty {
    margin: 0;
    padding: 10px 12px;
    background: #fff8e6;
    border: 1px solid #e8d9a8;
    border-radius: var(--fp-radius);
    color: #6b5a1e;
    font-size: 12px;
    line-height: 1.45;
}
.dlg-print-config .dlg-print-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px 14px;
    border-top: 1px solid var(--fp-border-soft);
}
.tool-form .dlg-small {
    width: min(420px, 92vw);
}
.tool-form .dlg-small .farmap-input {
    width: 100%;
    box-sizing: border-box;
    margin: 8px 0 12px;
    padding: 6px 8px;
    font-size: 14px;
}
.tool-form .dlg-small .dlg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Relatorios (relatorios.asp/js) - painel unico e compacto (largura no conteudo,
   nao a tela toda), grade de 2 colunas, botoes "de verdade" (relevo/sombra, nao
   so uma caixa em volta do rotulo) todos com a mesma largura (calculada em JS a
   partir do rotulo mais largo). */
.rel-shell {
    width: max-content;
    max-width: 96vw;
    align-self: center;
    margin: 10px auto;
}
.rel-panel {
    background: var(--fp-panel);
    border: 1px solid var(--fp-border-soft);
    border-radius: var(--fp-radius-lg);
    box-shadow: var(--fp-shadow-md);
    padding: 18px;
}
.rel-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 10px 12px;
}
.btn-report {
    display: block;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    padding: 10px 14px;
    background: linear-gradient(180deg, #ffffff, #f2f5fb);
    border: 1px solid var(--fp-border);
    color: var(--fp-text);
    font-family: var(--fp-font);
    font-weight: 600;
    font-size: 12px;
    line-height: 1.3;
    border-radius: var(--fp-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.08s ease;
}
.btn-report:hover {
    background: linear-gradient(180deg, #eef4ff, #dce8ff);
    border-color: var(--fp-accent);
    color: var(--fp-accent-hover);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}
.btn-report:focus-visible {
    outline: none;
    border-color: var(--fp-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.btn-report:active {
    background: linear-gradient(180deg, #dce8ff, #cbe0ff);
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.sngpc-shell {
    width: min(640px, 96vw);
    align-self: center;
    margin: 10px auto;
}
.sngpc-note {
    margin: 0 0 14px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--fp-text);
}
.sngpc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 12px;
}
.sngpc-field label {
    display: block;
    margin: 0 0 4px;
    font-size: 10px;
    font-weight: 700;
}
.sngpc-field .farmap-input {
    width: 100%;
    box-sizing: border-box;
}
.sngpc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 14px;
}
.sngpc-log {
    width: 100%;
    box-sizing: border-box;
    min-height: 140px;
    margin: 0;
    padding: 8px;
    font-family: Consolas, monospace;
    font-size: 11px;
    white-space: pre-wrap;
    background: #fff;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
}

/* Dialogo de parametros do relatorio - "form tipo window" pequeno, fonte proporcional
   ao resto do app (nada de 14px solto no meio de uma UI que roda a 11px base). */
.dlg-report-params .dlg-window {
    width: min(340px, 92vw);
    border-radius: var(--fp-radius-lg);
}
.dlg-report-params .dlg-title {
    font-size: 11px;
    padding: 10px 14px;
}
.dlg-report-params .dlg-body {
    padding: 16px 18px 4px;
}
.dlg-report-params .rp-field {
    margin: 0 0 14px;
}
.dlg-report-params .rp-label {
    display: block;
    margin: 0 0 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fp-header-mid);
}
.dlg-report-params .farmap-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-family: var(--fp-font);
    font-size: 12px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: var(--fp-panel);
    color: var(--fp-text);
}
.dlg-report-params .farmap-input:focus {
    outline: none;
    border-color: var(--fp-accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.dlg-report-params .dlg-period-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dlg-report-params .dlg-period-row .farmap-input {
    flex: 1 1 0;
    min-width: 0;
}
.dlg-report-params .dlg-period-row span {
    color: var(--fp-text-muted);
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}
.dlg-report-params .dlg-btns {
    padding: 8px 18px 16px;
}
.dlg-report-params .dlg-btns .btn-farmap {
    font-size: 11px;
    padding: 6px 12px;
}
.tool-form .tool-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}
.tool-form .tool-actions .btn-farmap {
    flex: 0 0 auto;
}
.tool-form .db-update-log {
    margin: 0;
    max-height: 220px;
    min-height: 120px;
    font-size: 11px;
}
.tool-form .loading-overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--fp-radius);
}
.hint-diverge {
    color: #b45309;
    font-size: 11px;
}
.cell-diverge {
    background: rgba(251, 191, 36, 0.25);
}
.grid .row-total td {
    border-top: 1px solid var(--fp-border);
    background: #f8fafc;
}

/* --- Layout cadastros VB6 (MatPri, Clientes, Receitas, Orcamentos) --- */
.mp-shell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    width: var(--fp-mp-shell-min);
    min-width: var(--fp-mp-shell-min);
    max-width: var(--fp-mp-shell-min);
    flex: 0 0 auto;
}
.mp-shell.screen-shell--fixed {
    min-width: var(--fp-mp-shell-min);
    max-width: var(--fp-mp-shell-min);
}
.mp-action-bar { flex-shrink: 0; }
.mp-action-bar .inp-filtro-mp { width: 180px; max-width: 28vw; }
.mp-action-bar .inp-tipo { width: 100px; max-width: 100px; }
.mp-action-bar .lbl-chk-inline { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; white-space: nowrap; }
.mp-action-bar .lbl-chk-inline input { margin: 0; }
.mp-top {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 120px;
    overflow: hidden;
}
.mp-main-col {
    flex: 0 0 var(--fp-mp-list-w);
    min-width: var(--fp-mp-list-w);
    max-width: var(--fp-mp-list-w);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.mp-side-col {
    flex: 0 0 var(--fp-mp-side-w);
    max-width: var(--fp-mp-side-w);
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mp-memo-head,
.mp-sin-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.mp-memo-head .memo-lbl,
.mp-sin-head .memo-lbl {
    flex: 1 1 auto;
    min-width: 0;
}
.mp-memo-head .btn-farmap {
    flex-shrink: 0;
    margin-left: auto;
}
.mp-sin-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}
.mp-side-col .mp-obs {
    cursor: pointer;
    flex: 1 1 auto;
    min-height: 108px;
}
.mp-list-zone { flex: 1; min-height: 0; }
.mp-lotes-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--fp-text-muted);
    padding: 2px 4px;
    border-top: 1px solid var(--fp-border);
}
.mp-lotes-head .mp-lotes-title {
    flex-shrink: 0;
}
.mp-lotes-head .nav-label {
    margin-left: 4px;
}
.mp-excipiente-wrap {
    margin-left: auto;
    display: none;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.mp-excipiente-wrap .inp-excipiente {
    max-width: 180px;
    min-width: 120px;
}
.mp-lotes-zone {
    flex: 0 0 auto;
    height: 254px;
    min-height: 254px;
    max-height: 254px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.mp-lotes-zone .grid-wrap { flex: 1; min-height: 0; }
.grid-lotes .grid { width: 100%; table-layout: fixed; }
.grid-sin { flex: 1 1 auto; min-height: 88px; max-height: 168px; }
.sub-nav-spacer { flex: 1 1 auto; min-width: 8px; }
.sub-nav-mp .inp-filtro-mp { width: 180px; max-width: 28vw; }
.sub-nav-mp .inp-tipo { width: 120px; }
.sub-nav-lotes { flex-shrink: 0; padding: 2px 4px; border-top: 1px solid var(--fp-border); }
.btn-sm { padding: 2px 8px; font-size: 10px; min-height: 22px; }
.btn-nav { min-width: 26px; padding: 2px 6px; }

.cli-shell {
    flex: 0 1 auto;
    align-self: center;
    width: min(1100px, calc(100vw - 24px));
    max-width: 100%;
    max-height: 100%;
    margin: auto;
    padding: 8px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    min-height: 0;
}
.cli-master { display: flex; flex-direction: row; gap: 8px; flex: 1; min-height: 0; }
.cli-list-col { flex: 0 0 42%; max-width: 480px; min-width: 280px; display: flex; flex-direction: column; gap: 2px; }
.cli-detail-col { flex: 1 1 58%; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cli-list-zone { flex: 1; min-height: 0; }
.cli-frame {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 8px 10px 6px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius);
    background: #fff;
    position: relative;
}
.cli-frame legend { font-size: 11px; font-weight: 600; padding: 0 4px; }
.cli-desde { position: absolute; top: 8px; right: 10px; font-size: 10px; color: var(--fp-text-muted); }
.cli-form { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.cli-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-start; }
.cli-field { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cli-w-cep { flex: 0 0 80px; }
.cli-w-ender { flex: 1 1 220px; min-width: 140px; }
.cli-w-bairro { flex: 1 1 160px; min-width: 120px; }
.cli-w-full { flex: 1 1 100%; width: 100%; }
.cli-w-cidade { flex: 1 1 140px; min-width: 120px; }
.cli-w-uf { flex: 0 0 44px; }
.cli-w-tel { flex: 1 1 92px; min-width: 88px; }
.cli-w-doc { flex: 0 0 120px; }
.cli-w-nasc { flex: 0 0 88px; }
.cli-w-email { flex: 1 1 180px; min-width: 120px; }
.cli-w-dsc { flex: 0 0 52px; }
.cli-w-func { flex: 0 0 160px; min-width: 120px; }
.cli-w-com { flex: 0 0 64px; }
.cli-obs { min-height: 132px; height: 132px; flex: 0 0 auto; }
.cli-inp { width: 100%; box-sizing: border-box; font-size: 11px; min-height: 22px; }
.cli-inp:disabled { background: var(--fp-bg-input, #f4f4f4); color: var(--fp-text-muted, #666); }
.cli-cep-msg { min-height: 12px; font-size: 10px; line-height: 1.2; color: var(--fp-text-muted); }
.cli-cep-msg.err { color: #b91c1c; }
.cli-cep-msg.ok { color: #166534; }
.cli-readonly { display: block; min-height: 22px; padding: 2px 4px; font-size: 11px; }
.cli-pick-wrap { display: flex; gap: 4px; align-items: center; }
.btn-pick { min-width: 28px; padding: 1px 6px; }
.cli-pick-wrap .cli-readonly { flex: 1 1 auto; min-height: 22px; border: 1px solid var(--fp-border); border-radius: 3px; background: #fff; }
.cli-pick-wrap .btn-pick[disabled] { opacity: .65; }
.cli-row-med { margin-top: 2px; }
.cli-med-flag { font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.cli-falecido-flag { font-size: 11px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cli-w-falecido { flex: 0 0 auto; align-self: flex-end; padding-bottom: 2px; }
.cli-row-med-fields { margin-top: -2px; }
.cli-med-frame { width: 100%; border: 1px solid var(--fp-border); border-radius: 4px; padding: 6px 8px 8px; }
.cli-med-frame[disabled] { opacity: .8; }
.cli-med-frame legend { font-size: 11px; padding: 0 4px; }
.cli-med-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cli-med-cr-label { min-width: 28px; text-align: right; }
.cli-med-cr-wrap { display: flex; align-items: center; gap: 4px; width: 212px; }
.cli-med-cr-wrap .cli-inp { flex: 1 1 auto; }
.cli-med-esp-wrap { min-width: 220px; flex: 1 1 220px; }
#dTipoCR { width: 190px; flex: 0 0 auto; }
.cli-med-row-espec { margin-top: 6px; }
.cli-btn-salvar { margin-left: 4px; }
.cli-footer { display: flex; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.cli-actions-top { padding-bottom: 4px; border-bottom: 1px solid var(--fp-border); }
.cli-detail-col > .cli-actions-top { justify-content: flex-start; }
.dlg-cli-novo .dlg-window { width: min(380px, 96vw); }
/* Dialogo modular de edicao Cliente/Medico (include/cli_edit_dialog.asp + farmap-cli-edit.js) */
.dlg-cli-edit .dlg-window { width: min(780px, 96vw); max-height: 92vh; }
.dlg-cli-edit-body { flex: 1; min-height: 0; overflow-y: auto; }
#dlgCliEditTipoCR { width: 190px; flex: 0 0 auto; }
.dlg-cli-novo-body { display: flex; flex-direction: row; gap: 12px; align-items: flex-start; }
.dlg-cli-novo-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dlg-cli-lbl { font-size: 11px; font-weight: 600; margin-top: 4px; }
.dlg-cli-lbl:first-child { margin-top: 0; }
.dlg-cli-novo-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; padding-top: 18px; }
.dlg-cli-novo-btns .btn-farmap { min-width: 72px; }
.inp-filtro-cli { width: 200px; }
.dlg-list-pick .dlg-window { width: min(420px, 96vw); }
.dlg-list-pick .dlg-body { padding: 8px 10px; }
.dlg-list-pick-filter { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.dlg-list-pick-filter .lbl-inline { margin: 0; }
.dlg-list-pick-filter .inp { flex: 1; min-width: 0; }
.dlg-list-pick .grid-wrap { max-height: 320px; min-height: 120px; overflow: auto; border: 1px solid var(--fp-border); }
.dlg-mp-pick.dlg-list-pick .grid-wrap {
    flex: 1 1 auto;
    width: var(--fp-mp-pick-table-w);
    min-width: var(--fp-mp-pick-table-w);
    max-width: var(--fp-mp-pick-table-w);
    height: 340px;
    min-height: 340px;
    max-height: 340px;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}
.dlg-forn-pick.dlg-list-pick .grid-wrap {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow-y: auto;
    box-sizing: border-box;
}
.dlg-list-pick tbody tr { cursor: pointer; }
.dlg-list-pick .dlg-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 10px 10px; border-top: 1px solid var(--fp-border); }

/* Formularios nao-pedidos: largura natural, centralizado (ver docs/WEB_FORMS_LAYOUT.md) */
.screen-shell--centered {
    align-self: center;
    width: max-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.dlg-rec-novo .dlg-window { width: min(600px, 96vw); }
.dlg-rec-novo .dlg-rec-novo-inp { width: 100%; box-sizing: border-box; }

.rec-shell.screen-shell--fixed {
    min-height: 0;
    align-self: center;
    flex: 0 1 auto;
    width: var(--fp-rec-shell-min);
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
    margin-top: -1px;
    gap: 3px;
}
body.rec-picker-mode .rec-shell.screen-shell--fixed {
    flex: 1 1 auto;
    height: 100%;
}
.rec-action-bar {
    flex-shrink: 0;
    padding-top: 3px;
    padding-bottom: 3px;
}
.rec-action-bar .btn-farmap,
.rec-action-bar .inp,
.rec-action-bar .inp-select {
    min-height: 19px;
}
.rec-top { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; width: 100%; }
.rec-list-zone { flex: 1; min-height: 0; }
.rec-shell .rec-split.split-bottom {
    flex: 0 0 auto;
    /* Altura da linha = altura do conteudo do .split-left (grid de 12 linhas).
       min-height precisa ser zerado: .split-bottom base tem min-height:254px,
       que sobrava aqui e deixava a linha ~16px mais alta que o grid. */
    height: auto;
    min-height: 0;
    max-height: none;
    /* row explicito: vence o @media (max-width:768px){.split-bottom{flex-direction:column}}
       que dispara dentro do iframe do picker (.rec-picker-frame ~= 754px de largura). */
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
    margin-top: -5px;
}
.rec-split {
    width: 100%;
    max-width: 100%;
}
.inp-filtro-rec { width: 280px; max-width: 40vw; }

.rec-shell .grid-rec {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
}
.rec-shell .grid-rec .col-sel {
    display: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}
.rec-shell .col-valrec {
    width: var(--fp-rec-valrec-w);
    min-width: var(--fp-rec-valrec-w);
    max-width: var(--fp-rec-valrec-w);
    text-align: center;
}
.rec-shell .col-uso {
    width: var(--fp-rec-uso-w);
    min-width: var(--fp-rec-uso-w);
    max-width: var(--fp-rec-uso-w);
    font-size: 10px;
}
.rec-shell .col-chk-agite,
.rec-shell .grid-rec td.col-chk-agite {
    width: var(--fp-rec-agite-w);
    min-width: var(--fp-rec-agite-w);
    max-width: var(--fp-rec-agite-w);
    text-align: center;
    font-size: 15px;
    line-height: 15px;
    vertical-align: middle;
}
.rec-shell .col-chk-gel,
.rec-shell .grid-rec td.col-chk-gel {
    width: var(--fp-rec-gel-w);
    min-width: var(--fp-rec-gel-w);
    max-width: var(--fp-rec-gel-w);
    text-align: center;
    font-size: 15px;
    line-height: 15px;
    vertical-align: middle;
}
.rec-shell .col-forma {
    width: var(--fp-rec-forma-w);
    min-width: var(--fp-rec-forma-w);
    max-width: var(--fp-rec-forma-w);
}
.rec-shell .col-qty {
    width: var(--fp-rec-qty-w);
    min-width: var(--fp-rec-qty-w);
    max-width: var(--fp-rec-qty-w);
}
.rec-shell .col-rec {
    width: var(--fp-rec-rec-w);
    min-width: var(--fp-rec-rec-w);
    max-width: var(--fp-rec-rec-w);
}
.rec-shell .rec-split .split-left {
    flex: 0 0 55%;
    width: 55%;
    max-width: 55%;
    min-width: 0;
    min-height: 0;
    height: auto;
}
.rec-shell .split-left .grid-sub-fixed {
    flex: 0 0 auto;
    height: calc(12 * var(--fp-row-h) + 22px);
    min-height: 0;
}
.rec-shell .rec-sub-nav {
    margin-top: -5px;
}
.rec-shell .rec-sub-nav .rec-posol-inp {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 15px;
    box-sizing: border-box;
    cursor: pointer;
    background: #fff;
    text-align: right;
}
.rec-shell .rec-posol-inp:disabled {
    cursor: default;
    background: var(--fp-row-hover);
    color: var(--fp-text-muted);
}
.rec-shell .rec-posol-inp.rec-posol-tight {
    font-size: 10px;
}
.rec-shell .rec-split .split-right,
.rec-shell .rec-memo-pane {
    flex: 0 0 45%;
    width: 45%;
    min-width: 0;
    max-width: 45%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* height auto + align-self:stretch => o painel recebe exatamente a altura
       da linha (definida pelo .split-left), e o memo abaixo preenche o que
       sobra depois do .memo-lbl => fundo do textarea == fundo do grid. */
    height: auto;
    align-self: stretch;
}
.rec-shell .rec-memo-pane .memo {
    /* flex-basis 0: a altura intrinseca do textarea (rows="8") nao entra no
       calculo da altura da linha; quem manda e sempre o grid da esquerda. */
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    resize: none;
}
.rec-shell .rec-list-zone .grid-wrap,
.rec-shell .split-left .grid-wrap {
    overflow-x: hidden;
    overflow-y: auto;
}
.rec-shell .grid-itens {
    table-layout: fixed;
    width: 100%;
}
.rec-shell .grid-itens .cell-inline-edit {
    cursor: text;
}
.rec-shell .grid-itens .cell-inline-edit:focus {
    outline: 1px solid #93c5fd;
    outline-offset: -1px;
    background: #eff6ff;
}
.rec-shell .grid-itens th.col-mp,
.rec-shell .grid-itens td.col-mp {
    width: var(--fp-rec-mp-w);
    min-width: var(--fp-rec-mp-w);
    max-width: var(--fp-rec-mp-w);
}
.rec-shell .grid-itens th.col-calc,
.rec-shell .grid-itens td.col-calc {
    width: var(--fp-rec-calc-w);
    max-width: var(--fp-rec-calc-w);
}
.rec-shell .grid-itens th.col-ing-qtd,
.rec-shell .grid-itens td.col-ing-qtd {
    width: var(--fp-rec-ing-qtd-w);
    min-width: var(--fp-rec-ing-qtd-w);
    max-width: var(--fp-rec-ing-qtd-w);
    text-align: right;
}
.rec-shell .grid-itens th.col-calc,
.rec-shell .grid-itens td.col-calc {
    width: var(--fp-col-calc);
    min-width: var(--fp-col-calc);
    max-width: var(--fp-col-calc);
}
.rec-sub-nav {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 0;
}


.mp-shell .col-mp-name {
    width: var(--fp-mp-name-w);
    min-width: var(--fp-mp-name-w);
    max-width: var(--fp-mp-name-w);
}
.mp-shell .col-mp-rot {
    width: var(--fp-mp-rot-w) !important;
    min-width: var(--fp-mp-rot-w) !important;
    max-width: var(--fp-mp-rot-w) !important;
}
.mp-shell .col-mp-rot .mp-th-rot {
    font-size: 9px;
    letter-spacing: -0.2px;
}
.mp-shell .grid-mp th.col-mp-volume,
.mp-shell .grid-mp td.col-mp-volume {
    width: var(--fp-mp-volume-w);
    min-width: var(--fp-mp-volume-w);
    max-width: var(--fp-mp-volume-w);
}
.mp-shell .col-mp-saldo {
    width: var(--fp-mp-saldo-w);
    min-width: var(--fp-mp-saldo-w);
    max-width: var(--fp-mp-saldo-w);
}
.mp-shell .col-mp-un {
    width: var(--fp-mp-un-w);
    min-width: var(--fp-mp-un-w);
    max-width: var(--fp-mp-un-w);
}
.mp-shell .col-mp-cntr {
    width: var(--fp-mp-cntr-w) !important;
    min-width: var(--fp-mp-cntr-w) !important;
    max-width: var(--fp-mp-cntr-w) !important;
    text-align: center;
}
.mp-shell .col-mp-cntr .mp-th-cntr {
    font-size: 9px;
    letter-spacing: -0.2px;
}
.mp-shell .grid-mp th.col-mp-saldo,
.mp-shell .grid-mp td.col-mp-saldo {
    text-align: right;
}
.mp-shell .grid-mp th.col-mp-volume,
.mp-shell .grid-mp td.col-mp-volume,
.mp-shell .grid-mp th.col-mp-peso,
.mp-shell .grid-mp td.col-mp-peso {
    text-align: right;
}
.mp-shell .grid-mp th.col-mp-peso,
.mp-shell .grid-mp td.col-mp-peso {
    width: var(--fp-col-calc);
    min-width: var(--fp-col-calc);
    max-width: var(--fp-col-calc);
}
.mp-shell .col-mp-tipo {
    width: var(--fp-mp-tipo-w);
    min-width: var(--fp-mp-tipo-w);
    max-width: var(--fp-mp-tipo-w);
}
.mp-shell .grid-mp th.col-calc,
.mp-shell .grid-mp td.col-calc {
    width: var(--fp-col-calc);
    min-width: var(--fp-col-calc);
    max-width: var(--fp-col-calc);
}
.mp-shell .grid-mp th.col-mp-dos,
.mp-shell .grid-mp td.col-mp-dos {
    width: var(--fp-mp-dos-w);
    min-width: var(--fp-mp-dos-w);
    max-width: var(--fp-mp-dos-w);
}
.mp-shell .grid-mp th.col-mp-homeo-grau,
.mp-shell .grid-mp td.col-mp-homeo-grau {
    width: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
}
.mp-shell .grid-mp td.col-mp-homeo-grau .grau-edit {
    width: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
    box-sizing: border-box;
}
.mp-shell .grid-mp {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.mp-shell .grid-mp .col-sel {
    display: none;
    width: 0;
    min-width: 0;
    max-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}
.mp-shell input[type="number"].input-no-spin::-webkit-outer-spin-button,
.mp-shell input[type="number"].input-no-spin::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.mp-shell input[type="number"].input-no-spin {
    -moz-appearance: textfield;
}
.mp-shell .mp-list-zone .grid-wrap {
    overflow-x: hidden;
    overflow-y: auto;
}
.mp-shell .mp-list-zone .grid-wrap:focus {
    outline: none;
}
.mp-shell .grid-lotes th.col-date,
.mp-shell .grid-lotes td.col-date {
    width: var(--fp-mp-lote-date-w);
    min-width: var(--fp-mp-lote-date-w);
    max-width: var(--fp-mp-lote-date-w);
}
.mp-shell .grid-lotes th.col-mp-lote-correc,
.mp-shell .grid-lotes td.col-mp-lote-correc {
    width: var(--fp-mp-lote-correc-w);
    min-width: var(--fp-mp-lote-correc-w);
    max-width: var(--fp-mp-lote-correc-w);
    text-align: center;
}
.mp-shell .grid-lotes th.col-fator,
.mp-shell .grid-lotes td.col-fator {
    width: var(--fp-mp-lote-fator-w);
    min-width: var(--fp-mp-lote-fator-w);
    max-width: var(--fp-mp-lote-fator-w);
}
.mp-shell .grid-lotes th.col-lote,
.mp-shell .grid-lotes td.col-lote {
    width: var(--fp-mp-lote-nome-w);
    min-width: var(--fp-mp-lote-nome-w);
    max-width: var(--fp-mp-lote-nome-w);
}
.mp-shell .grid-lotes th.col-valitem,
.mp-shell .grid-lotes td.col-valitem {
    width: var(--fp-mp-lote-val-w);
    min-width: var(--fp-mp-lote-val-w);
    max-width: var(--fp-mp-lote-val-w);
}
.mp-shell .grid-lotes th.col-mp-lote-saldo,
.mp-shell .grid-lotes td.col-mp-lote-saldo {
    width: var(--fp-mp-lote-saldo-w);
    min-width: var(--fp-mp-lote-saldo-w);
    max-width: var(--fp-mp-lote-saldo-w);
}
.mp-shell .grid-lotes th.col-mp-lote-dens,
.mp-shell .grid-lotes td.col-mp-lote-dens {
    width: var(--fp-mp-lote-dens-w);
    min-width: var(--fp-mp-lote-dens-w);
    max-width: var(--fp-mp-lote-dens-w);
}
.mp-shell .grid-lotes th.col-mp-lote-end,
.mp-shell .grid-lotes td.col-mp-lote-end {
    width: var(--fp-mp-lote-end-w);
    min-width: var(--fp-mp-lote-end-w);
    max-width: var(--fp-mp-lote-end-w);
}
.mp-shell .grid-lotes th.col-mp-lote-forn,
.mp-shell .grid-lotes td.col-mp-lote-forn {
    width: var(--fp-mp-lote-forn-w);
    min-width: var(--fp-mp-lote-forn-w);
    max-width: var(--fp-mp-lote-forn-w);
}
.mp-shell .grid-mp td.cell-combo { cursor: pointer; }
.mp-shell .grid-mp .cell-combo-select {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}

.dlg-mp-obs.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-mp-obs .dlg-window {
    position: relative;
    width: 50vw;
    height: 80vh;
    max-width: 50vw;
    max-height: 80vh;
    left: auto;
    top: auto;
    transform: none;
    display: flex;
    flex-direction: column;
}
.dlg-mp-obs .dlg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 14px;
}
.dlg-mp-obs .dlg-body .memo {
    flex: 1;
    min-height: 0;
    width: 100%;
    resize: none;
    font-size: 12px;
    line-height: 1.4;
}

/* Descarte lote MatPri */
.dlg-mp-descarte.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-mp-descarte .dlg-window {
    position: relative;
    width: 480px;
    max-width: 92vw;
    left: auto;
    top: auto;
    transform: none;
}
.dlg-mp-descarte-body {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dlg-mp-descarte-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.dlg-mp-descarte-row .lbl-inline {
    width: 88px;
    flex-shrink: 0;
}
.dlg-mp-descarte-row .inp,
.dlg-mp-descarte-row .inp-select {
    flex: 1;
    min-width: 0;
}
.dlg-mp-descarte-obs-row {
    align-items: flex-start;
}
.dlg-mp-descarte-obs-row .memo {
    flex: 1;
    min-height: 54px;
    resize: vertical;
    font-size: 12px;
}

/* Prescricoes medicas Receitas */
.dlg-rec-presc.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-rec-presc .dlg-window {
    position: relative;
    width: min(920px, 96vw);
    max-height: 82vh;
    left: auto;
    top: auto;
    transform: none;
    display: flex;
    flex-direction: column;
}
.dlg-rec-presc .dlg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 8px 10px;
}
.dlg-rec-presc .grid-rec-presc {
    flex: 1;
    min-height: 280px;
    max-height: 58vh;
    overflow: auto;
}
.dlg-rec-presc .dlg-rec-presc-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dlg-rec-presc .dlg-title-close {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 4px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
}
.dlg-rec-presc .dlg-title-close:hover {
    opacity: 0.85;
}
.dlg-rec-presc #tblRecPresc {
    table-layout: fixed;
    width: 100%;
}
.dlg-rec-presc #tblRecPresc th.col-rec-presc-cli,
.dlg-rec-presc #tblRecPresc td.col-rec-presc-cli {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dlg-rec-presc #tblRecPresc th.col-rec-presc-med,
.dlg-rec-presc #tblRecPresc td.col-rec-presc-med {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dlg-rec-presc #tblRecPresc th.col-date,
.dlg-rec-presc #tblRecPresc td.col-date {
    width: 54px;
    min-width: 54px;
    max-width: 54px;
    white-space: nowrap;
    padding-left: 2px;
    padding-right: 2px;
}
.dlg-rec-presc .edit-presc {
    border: none !important;
    background: transparent !important;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    padding: 2px 4px;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
}
.dlg-rec-presc .edit-presc:focus {
    background-color: #fff !important;
    outline: 1px solid #4a90e2;
}
.dlg-rec-presc #tblRecPresc td.col-rec-presc-dt .edit-presc,
.dlg-rec-presc #tblRecPresc .edit-presc.input-data {
    text-align: right;
}
.dlg-rec-presc #tblRecPresc td.col-rec-presc-quant .edit-presc,
.dlg-rec-presc #tblRecPresc td.col-rec-presc-saldo .edit-presc {
    text-align: right;
}
.dlg-rec-presc #tblRecPresc tr.row-sel td {
    background: var(--fp-row-sel-bg, #d8e8f8);
}
.dlg-rec-presc #tblRecPresc th.col-calc,
.dlg-rec-presc #tblRecPresc td.col-calc {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    text-align: right;
}

/* Extrato/Movimentacao MatPri (mig 63) */
.dlg-mp-extrato.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-mp-extrato .dlg-window {
    position: relative;
    width: 72vw;
    height: 78vh;
    max-width: 72vw;
    max-height: 78vh;
    left: auto;
    top: auto;
    transform: none;
    display: flex;
    flex-direction: column;
}
.dlg-mp-extrato .dlg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 8px 10px;
}
.dlg-mp-extrato .grid-extrato {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.dlg-mp-extrato .dlg-mp-extrato-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dlg-mp-extrato .dlg-title-close {
    flex: 0 0 auto;
    float: right;
    margin: 0;
    padding: 0 4px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
}
.dlg-mp-extrato .dlg-title-close:hover {
    opacity: 0.85;
}
.dlg-mp-extrato #tblExtrato {
    table-layout: fixed;
}
.dlg-mp-extrato #tblExtrato th.col-mp-tipo,
.dlg-mp-extrato #tblExtrato td.col-mp-tipo {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}
.dlg-mp-extrato #tblExtrato th.col-date,
.dlg-mp-extrato #tblExtrato td.col-date {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
}
.dlg-mp-extrato #tblExtrato th.col-mp-extrato-nom,
.dlg-mp-extrato #tblExtrato td.col-mp-extrato-nom {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dlg-mp-extrato #tblExtrato th.col-lote,
.dlg-mp-extrato #tblExtrato td.col-lote {
    width: 137px;
    min-width: 137px;
    max-width: 137px;
}
.dlg-mp-extrato #tblExtrato th.col-mp-extrato-acao,
.dlg-mp-extrato #tblExtrato td.col-mp-extrato-acao {
    width: 108px;
    min-width: 108px;
    max-width: 108px;
    text-align: center;
    vertical-align: middle;
}
.dlg-mp-extrato .btn-extrato-estorno {
    font-size: 10px;
    line-height: 1.15;
    padding: 2px 4px;
    white-space: normal;
    max-width: 100%;
}
.dlg-mp-extrato .btn-extrato-estorno.disabled,
.dlg-mp-extrato .btn-extrato-estorno:disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* Vencimentos MatPri */
.dlg-mp-vencimentos.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-mp-vencimentos .dlg-window {
    position: relative;
    width: 68vw;
    height: 78vh;
    max-width: 68vw;
    max-height: 78vh;
    left: auto;
    top: auto;
    transform: none;
    display: flex;
    flex-direction: column;
}
.dlg-mp-vencimentos .dlg-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 8px 10px;
    gap: 8px;
}
.dlg-venc-filtros {
    flex: 0 0 auto;
}
.dlg-venc-filtro-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}
.dlg-venc-filtro-row .inp-venc-dias {
    width: 35px;
    min-width: 35px;
    max-width: 35px;
}
.dlg-venc-filtro-row .inp-venc-data {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}
.dlg-mp-vencimentos .grid-venc {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.dlg-mp-vencimentos .dlg-mp-venc-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.dlg-mp-vencimentos .dlg-title-close {
    flex: 0 0 auto;
    margin: 0;
    padding: 0 4px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    cursor: pointer;
}
.dlg-mp-vencimentos .dlg-title-close:hover {
    opacity: 0.85;
}
.dlg-mp-vencimentos #tblVencimentos {
    table-layout: fixed;
    width: 100%;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-chk,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-chk {
    width: 4%;
    text-align: center;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-nome,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-nome {
    width: 41%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-lote,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-lote {
    width: 20%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-val,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-val {
    width: 8%;
    text-align: right;
    padding: 2px 4px;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-saldo-lote,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-saldo-lote {
    width: 12%;
    text-align: right;
    padding: 2px 4px;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-saldo-mestre,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-saldo-mestre {
    width: 10%;
    text-align: right;
    padding: 2px 4px;
}
.dlg-mp-vencimentos #tblVencimentos th.col-venc-bate,
.dlg-mp-vencimentos #tblVencimentos td.col-venc-bate {
    width: 5%;
    text-align: center;
    padding: 2px 4px;
}
.dlg-mp-vencimentos #tblVencimentos tbody tr.linha-selecionada {
    background: var(--fp-row-sel) !important;
    box-shadow: inset 3px 0 0 var(--fp-row-sel-accent);
}

/* Progresso / historico descarte em massa (Vencimentos) */
.dlg-mp-progress-descarte.farmap-dialog.is-open,
.dlg-mp-historico-descarte.farmap-dialog.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.dlg-mp-progress-descarte .dlg-window {
    min-width: 320px;
    max-width: 480px;
}
.dlg-mp-progress-body {
    padding: 16px 20px;
    text-align: center;
}
.dlg-mp-progress-body h3 {
    margin: 0;
    font-size: 15px;
    font-weight: normal;
}
.dlg-mp-historico-descarte .dlg-window {
    width: 72vw;
    max-width: 900px;
    height: 70vh;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
.dlg-mp-historico-descarte .dlg-body.dlg-historico-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 12px;
    min-height: 0;
    padding: 10px 12px;
}
.dlg-historico-list-wrap {
    flex: 0 0 240px;
    min-width: 200px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dlg-historico-list-wrap #lista-datas-historico {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: auto;
    border: 1px solid #c8c8c8;
    background: #fff;
}
/* Overlay de escolha de receita (tela de Receitas por cima de Pedidos) */
.rec-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.12);
}
.rec-picker-frame {
    width: calc(var(--fp-rec-shell-min) + 20px);
    max-width: 96vw;
    height: 94vh;
    border: none;
    border-radius: var(--fp-radius-lg);
    box-shadow: var(--fp-shadow-md);
    background: #fff;
}
body.rec-picker-open .app-topbar,
body.rec-picker-open .ped-shell {
    filter: blur(0.80px);
}
/* Overlay de Materias Primas (matpri.asp por cima de Pedidos/Orcamentos/Receitas).
   Sem "top" fixo em CSS - Farmap.openMpOverlay calcula e seta via JS o topo logo
   abaixo da .app-topbar, que fica de fora da area coberta (continua visivel e
   clicavel: clicar no menu "Materias Primas" so navega a janela toda, fechando
   o overlay de brinde). */
.mp-picker-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.12);
}
.pix-overlay {
    position: fixed;
    inset: 0;
    z-index: 9600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.28);
}
.pix-window {
    position: relative;
    max-width: 60vw;
    max-height: 90vh;
    background: #fff;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pix-bar {
    flex: 0 0 28px;
    height: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 2px;
}
.pix-zoom-group { display: flex; align-items: center; }
.pix-zoom,
.pix-close {
    width: 28px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0f172a;
    font-size: 18px;
    line-height: 24px;
    cursor: pointer;
}
.pix-close { font-size: 20px; }
.pix-zoom:hover,
.pix-close:hover { background: #e2e8f0; }
.pix-scroll {
    overflow: auto;
    max-width: 60vw;
    max-height: calc(90vh - 28px);
    background: #f8fafc;
}
.pix-scroll canvas { display: block; }
.pix-msg {
    padding: 28px 36px;
    color: #334155;
    font-size: 13px;
    white-space: nowrap;
}
.mp-picker-frame {
    width: min(1400px, 98vw);
    height: 96%;
    border: none;
    border-radius: var(--fp-radius-lg);
    box-shadow: var(--fp-shadow-md);
    background: #fff;
}
body.mp-picker-open .ped-shell,
body.mp-picker-open .rec-shell {
    filter: blur(0.80px);
}
.dlg-historico-list-wrap #lista-datas-historico li {
    padding: 6px 8px;
    border-bottom: 1px solid #ececec;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dlg-historico-list-wrap #lista-datas-historico li:hover {
    background: #eef4fc;
}
.dlg-historico-list-wrap #lista-datas-historico li.is-selected {
    background: #dce8f8;
    font-weight: bold;
}
.dlg-historico-list-wrap #lista-datas-historico li.empty-hist {
    cursor: default;
    color: #666;
}
.dlg-historico-view-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
}
.dlg-historico-text {
    flex: 1;
    min-height: 200px;
    font-family: Consolas, "Courier New", monospace;
    width: 100%;
    resize: none;
    box-sizing: border-box;
}
.dlg-historico-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.dlg-mp-historico-descarte .dlg-mp-historico-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Edicao inline grid de lotes MatPri */
.mp-shell .grid-lotes td.cell-edit { cursor: cell; }
.mp-shell .grid-lotes td.cell-pick { cursor: pointer; }
.mp-shell .grid-lotes .cell-edit-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    padding: 0 2px;
}
