
/* Consultas internas: Consultar Vendas + Produtos */
#screen-consultar-vendas,
#screen-catalogo{
    width: 100%;
    max-width: none;
    margin: 18px auto 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.pot-module-shell{ display:grid; gap:14px; }

.pot-module-top,
.pot-module-filters,
.pot-list-card,
.pot-kpis article{
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.pot-module-top{
    padding: 20px 22px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
}

.pot-module-top h2{ margin:0; color:var(--primary); font-size:22px; letter-spacing:-.025em; }
.pot-module-top p{ margin:5px 0 0; color:var(--muted); font-size:12px; max-width:760px; }
.pot-top-actions{ display:flex; gap:9px; }
.pot-top-actions .btn,
.pot-pagination .btn,
.pot-list-head .btn,
.pot-consulta-head .btn{ width:auto; min-width:112px; }

.pot-module-filters{ padding:18px; }
.pot-filter-grid{ display:grid; gap:12px; align-items:end; }
.pot-filter-grid .field{ margin:0; }
.pot-filter-grid-sales{ grid-template-columns:minmax(260px,1.55fr) 160px 160px minmax(180px,.9fr) minmax(180px,.9fr) auto; }
.pot-filter-grid-products{ grid-template-columns:minmax(320px,1.45fr) 180px auto; }
.pot-filter-search{ min-width:0; }
.pot-filter-action .btn{ width:auto; min-width:160px; }

.pot-quick{ display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.pot-quick button{
    border:1px solid var(--line);
    border-radius:999px;
    padding:8px 12px;
    background:#fff;
    color:#5f7289;
    font-size:10px;
    font-weight:800;
    cursor:pointer;
    transition:all .16s ease;
}
.pot-quick button:hover,
.pot-quick button.active{ color:var(--primary-2); border-color:#9bc8e6; background:#edf7fd; }

.pot-kpis{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:11px; }
.pot-kpis article{ padding:15px 16px; }
.pot-kpis small{ display:block; color:var(--muted); font-size:10px; font-weight:700; }
.pot-kpis strong{ display:block; margin-top:5px; color:var(--primary); font-size:19px; letter-spacing:-.02em; }

.pot-list-card{ overflow:hidden; }
.pot-list-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:15px 17px;
    border-bottom:1px solid var(--line);
}
.pot-list-head strong{ display:block; color:var(--primary); font-size:14px; }
.pot-list-head span{ display:block; margin-top:2px; color:var(--muted); font-size:10px; }
.pot-status{ color:var(--muted); font-size:10px; font-weight:700; text-align:right; }

.pot-results{ background:#fff; }
.pot-result{
    width:100%;
    border:0;
    border-bottom:1px solid #e9eff5;
    padding:16px 17px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:14px;
    text-align:left;
    cursor:pointer;
    color:inherit;
    background:transparent;
}
.pot-result:last-child{ border-bottom:0; }
.pot-result:hover{ background:#f8fbfe; }
.pot-result-main{ min-width:0; }
.pot-result-title-row{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}
.pot-result-title-row strong{
    color:var(--primary);
    font-size:13px;
    letter-spacing:-.01em;
    overflow-wrap:anywhere;
}
.pot-result-price{ color:var(--primary); font-size:15px; font-weight:900; white-space:nowrap; }
.pot-result-sub{ margin-top:8px; display:flex; flex-wrap:wrap; gap:8px; }
.pot-inline-chip,
.pot-inline-meta{
    display:inline-flex;
    align-items:center;
    gap:5px;
    padding:5px 9px;
    border-radius:999px;
    font-size:10px;
    font-weight:800;
}
.pot-inline-chip{ background:#edf7fd; color:var(--primary-2); border:1px solid #cae2f0; }
.pot-inline-meta{ background:#f6f9fc; color:#67798f; border:1px solid #e4ecf4; }
.pot-result-tail{ display:flex; align-items:center; gap:10px; }
.pot-result-link{ color:var(--primary-2); font-size:11px; font-weight:800; white-space:nowrap; }
.pot-chevron{ color:#8aa1b9; font-size:18px; line-height:1; }
.pot-empty{
    padding:34px 20px;
    text-align:center;
    color:var(--muted);
    font-size:12px;
}

.pot-stock-chip{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:5px 9px;
    border-radius:999px;
    font-size:10px;
    font-weight:900;
    color:#267a59;
    background:#edf9f3;
    border:1px solid #ccebdc;
}
.pot-stock-chip.low{ color:#98640c; background:#fff5e4; border-color:#f2dfb1; }
.pot-stock-chip.zero{ color:#b83d3d; background:#fff0f0; border-color:#f4caca; }

.pot-pagination{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:13px 16px;
    background:#fafcfe;
    border-top:1px solid var(--line);
}
.pot-pagination span{ color:var(--muted); font-size:10px; font-weight:700; }

.pot-modal-backdrop{
    position:fixed;
    inset:0;
    z-index:180;
    display:none;
    place-items:center;
    padding:14px;
    background:rgba(9,28,48,.60);
    backdrop-filter:blur(7px);
}
.pot-modal-backdrop:not(.hidden){ display:grid; }
.pot-modal{
    width:min(760px,100%);
    max-height:calc(100vh - 28px);
    overflow:auto;
    background:#fff;
    border-radius:18px;
    box-shadow:0 28px 80px rgba(0,0,0,.28);
}
.pot-modal > header{
    position:sticky;
    top:0;
    z-index:2;
    padding:18px 22px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:15px;
    background:#fff;
    border-bottom:1px solid var(--line);
}
.pot-modal > header small{ display:block; color:var(--muted); font-size:10px; font-weight:700; }
.pot-modal > header h3{ margin:3px 0 0; color:var(--primary); font-size:20px; }
.pot-modal > header button{
    width:38px;
    height:38px;
    border:1px solid var(--line);
    border-radius:11px;
    background:#fff;
    color:var(--primary);
    font-size:22px;
    cursor:pointer;
}
#cv-modal-body,
#cat-modal-body{ padding:18px 20px 22px; }
.pot-modal-summary{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:10px;
    margin-bottom:14px;
}
.pot-modal-summary article{
    padding:13px 14px;
    background:#f7fafd;
    border:1px solid var(--line);
    border-radius:14px;
}
.pot-modal-summary span{ display:block; color:var(--muted); font-size:9px; font-weight:700; }
.pot-modal-summary strong{ display:block; margin-top:5px; color:var(--primary); font-size:14px; word-break:break-word; }
.pot-detail-section{ border:1px solid var(--line); border-radius:15px; background:#fff; overflow:hidden; }
.pot-detail-section + .pot-detail-section{ margin-top:12px; }
.pot-detail-section-head{
    padding:13px 15px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    border-bottom:1px solid var(--line);
    background:#f9fbfd;
}
.pot-detail-section-head strong{ color:var(--primary); font-size:13px; }
.pot-detail-section-head span{ color:var(--muted); font-size:10px; }
.pot-detail-lines{ padding:14px 15px; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px 14px; }
.pot-detail-line span{ display:block; color:var(--muted); font-size:9px; font-weight:700; }
.pot-detail-line strong{ display:block; margin-top:4px; color:#26364a; font-size:12px; word-break:break-word; }
.pot-detail-items{ padding:0 15px 12px; }
.pot-detail-item{
    padding:12px 0;
    border-top:1px solid #e8eef4;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:10px;
    align-items:flex-start;
}
.pot-detail-item:first-child{ border-top:0; }
.pot-detail-item strong{ display:block; color:#26364a; font-size:12px; overflow-wrap:anywhere; }
.pot-detail-item small{ display:block; margin-top:4px; color:var(--muted); font-size:10px; }
.pot-detail-item b{ color:var(--primary); font-size:12px; white-space:nowrap; }
.pot-detail-total{
    margin-top:8px;
    padding:14px 15px 15px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-top:1px solid var(--line);
    background:#f9fbfd;
    font-size:13px;
    font-weight:900;
    color:var(--primary);
}
.pot-history-empty{ padding:15px; color:var(--muted); font-size:11px; }

body.logged-app.theme-dark #screen-consultar-vendas,
body.logged-app.theme-dark #screen-catalogo{ background:transparent; }
body.logged-app.theme-dark .pot-module-top,
body.logged-app.theme-dark .pot-module-filters,
body.logged-app.theme-dark .pot-list-card,
body.logged-app.theme-dark .pot-kpis article,
body.logged-app.theme-dark .pot-modal,
body.logged-app.theme-dark .pot-detail-section{ background:#122033; border-color:#24364d; box-shadow:none; }
body.logged-app.theme-dark .pot-module-top h2,
body.logged-app.theme-dark .pot-kpis strong,
body.logged-app.theme-dark .pot-list-head strong,
body.logged-app.theme-dark .pot-result-title-row strong,
body.logged-app.theme-dark .pot-result-price,
body.logged-app.theme-dark .pot-modal > header h3,
body.logged-app.theme-dark .pot-detail-line strong,
body.logged-app.theme-dark .pot-detail-item strong,
body.logged-app.theme-dark .pot-detail-item b,
body.logged-app.theme-dark .pot-detail-total{ color:#eef5ff; }
body.logged-app.theme-dark .pot-module-top p,
body.logged-app.theme-dark .pot-kpis small,
body.logged-app.theme-dark .pot-list-head span,
body.logged-app.theme-dark .pot-status,
body.logged-app.theme-dark .pot-detail-line span,
body.logged-app.theme-dark .pot-detail-item small,
body.logged-app.theme-dark .pot-modal > header small,
body.logged-app.theme-dark .pot-empty,
body.logged-app.theme-dark .pot-history-empty{ color:#97acc4; }
body.logged-app.theme-dark .pot-quick button,
body.logged-app.theme-dark .pot-inline-meta,
body.logged-app.theme-dark .pot-modal > header button,
body.logged-app.theme-dark .pot-pagination,
body.logged-app.theme-dark .pot-detail-section-head,
body.logged-app.theme-dark .pot-detail-total,
body.logged-app.theme-dark .pot-modal-summary article{ background:#16263b; border-color:#2a405b; color:#d9e6f5; }
body.logged-app.theme-dark .pot-result:hover{ background:#15253a; }
body.logged-app.theme-dark .pot-result{ border-bottom-color:#21354e; }
body.logged-app.theme-dark .pot-inline-chip{ background:#15314d; border-color:#295276; color:#8ac8ff; }
body.logged-app.theme-dark .pot-stock-chip{ background:#133125; border-color:#24513f; color:#9ce5c0; }
body.logged-app.theme-dark .pot-stock-chip.low{ background:#332a12; border-color:#5d4b1b; color:#f3d184; }
body.logged-app.theme-dark .pot-stock-chip.zero{ background:#351818; border-color:#5f2c2c; color:#f3a7a7; }

@media (max-width: 1100px){
    .pot-filter-grid-sales{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .pot-filter-grid-sales .pot-filter-search{ grid-column:1 / -1; }
    .pot-filter-grid-products{ grid-template-columns:1fr 180px auto; }
}

@media (max-width: 780px){
    #screen-consultar-vendas,
    #screen-catalogo{ margin:8px 4px; width:auto; max-width:calc(100vw - 8px); }
    .pot-module-shell{ gap:12px; }
    .pot-module-top{ padding:15px; align-items:flex-start; flex-direction:column; }
    .pot-top-actions{ width:100%; }
    .pot-top-actions .btn{ width:100%; }
    .pot-module-top h2{ font-size:20px; }
    .pot-filter-grid-sales,
    .pot-filter-grid-products{ grid-template-columns:1fr; }
    .pot-filter-search,
    .pot-filter-action{ grid-column:auto; }
    .pot-filter-action .btn{ width:100%; }
    .pot-kpis{ grid-template-columns:1fr; }
    .pot-list-head{ align-items:flex-start; flex-direction:column; }
    .pot-status{ text-align:left; }
    .pot-result{ grid-template-columns:1fr; gap:10px; padding:14px 15px; }
    .pot-result-title-row{ flex-direction:column; gap:6px; }
    .pot-result-tail{ justify-content:space-between; }
    .pot-pagination{ align-items:stretch; flex-direction:column; }
    .pot-pagination .btn{ width:100%; }
    .pot-modal-backdrop{ padding:0; align-items:stretch; }
    .pot-modal{ width:100%; max-height:none; min-height:100%; border-radius:0; }
    .pot-modal > header,
    #cv-modal-body,
    #cat-modal-body{ padding-left:14px; padding-right:14px; }
    .pot-modal-summary{ grid-template-columns:1fr 1fr; }
    .pot-detail-lines{ grid-template-columns:1fr; }
    .pot-detail-item{ grid-template-columns:1fr; }
}
