/* Keep every module reachable in short windows and on mobile. */
.app-shell .sidebar {height:100vh;height:100dvh;overflow-y:auto;overflow-x:hidden}
.app-shell .sidebar > .brand,.app-shell .sidebar > .sidebar-footer {flex-shrink:0}
.app-shell .sidebar > .nav {
  flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;
  align-content:start;overscroll-behavior-y:contain;
  scrollbar-width:thin;scrollbar-color:#64748b transparent;
  padding-right:4px;padding-bottom:10px;
}
.app-shell .sidebar > .nav::-webkit-scrollbar {width:6px}
.app-shell .sidebar > .nav::-webkit-scrollbar-thumb {background:#64748b;border-radius:6px}
/* Compact desktop item rows, with readable totals and responsive small screens. */
.modal.xlarge:has(.builder-item) {width:min(1480px,98vw)}
.modal .builder-item {
  grid-template-columns:minmax(90px,1fr) minmax(100px,1.2fr) minmax(90px,1fr) minmax(62px,.6fr) minmax(62px,.6fr) minmax(85px,.8fr) minmax(90px,.8fr) minmax(72px,.7fr) minmax(115px,1fr) 30px;
  gap:6px;align-items:end;padding:10px;
}
.modal .builder-item:has(.sale-art-field) {grid-template-columns:64px minmax(90px,1fr) minmax(100px,1.2fr) minmax(90px,1fr) minmax(62px,.6fr) minmax(62px,.6fr) minmax(85px,.8fr) minmax(90px,.8fr) minmax(72px,.7fr) minmax(115px,1fr) 30px}
.modal .builder-item .form-group {min-width:0}
.modal .builder-item .form-group label {font-size:10px;line-height:1.3}
.modal .builder-item input:not([type=file]),.modal .builder-item select {width:100%;min-width:0;height:38px;padding:6px;font-size:12px}
.modal .builder-item input.line-total {
  min-height:38px;font-size:15px;font-weight:800;text-align:right;
}
.modal .builder-item .item-total {white-space:normal;overflow-wrap:anywhere;height:auto;min-height:38px;font-size:12px;padding:6px 2px}
.modal .builder-item .sale-art-field {min-width:0}
.modal .builder-item label.sale-art-upload {height:38px;min-height:38px;padding:3px;gap:3px;font-size:9px;overflow:hidden}
.modal .builder-item .sale-art-upload img {width:26px;height:28px;flex-shrink:0;object-fit:cover}
.modal .builder-item .sale-art-upload span {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.modal .builder-item .remove-item {width:30px;min-width:0;height:38px;padding:4px}
@media(max-width:1100px){.modal .builder-item,.modal .builder-item:has(.sale-art-field){grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(max-width:750px){.modal .builder-item,.modal .builder-item:has(.sale-art-field){grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:500px){.modal .builder-item,.modal .builder-item:has(.sale-art-field){grid-template-columns:repeat(2,minmax(0,1fr))}}
/* One shared palette for application surfaces, including dialogs outside app-shell. */
@media screen {
html[data-theme="dark"] {
  color-scheme:dark;
  --vc-bg:#080f1b;--vc-panel:#121e2f;--vc-subtle:#17263b;--vc-input:#0d1828;
  --vc-text:#e8eff8;--vc-muted:#a6b6cc;--vc-line:#34455d;
  --vc-link:#85b9ff;--vc-soft:#19375c;--vc-hover:#20344e;
  --vc-success:#75e5b4;--vc-success-bg:#123c30;
  --vc-danger:#ffadb5;--vc-danger-bg:#43232e;
  --vc-warning:#ffd08b;--vc-warning-bg:#44321b;
  --vc-shadow:0 8px 26px #0003;
}
html[data-theme="light"] {
  color-scheme:light;
  --vc-bg:#f1f5fa;--vc-panel:#fafdff;--vc-subtle:#eaf1f8;--vc-input:#ffffff;
  --vc-text:#172a43;--vc-muted:#536780;--vc-line:#c9d7e6;
  --vc-link:#075fbd;--vc-soft:#e0edff;--vc-hover:#dce9f7;
  --vc-success:#076648;--vc-success-bg:#dff4ea;
  --vc-danger:#a12738;--vc-danger-bg:#ffe7eb;
  --vc-warning:#7b4b0a;--vc-warning-bg:#fff0d3;
  --vc-shadow:0 8px 26px #1c416b0d;
}
html[data-theme],html[data-theme] body {background:var(--vc-bg);color:var(--vc-text)}
html[data-theme] :is(.app-shell,.modal-backdrop) {
  --text:var(--vc-text);--muted:var(--vc-muted);--panel:var(--vc-panel);
  --bg:var(--vc-bg);--line:var(--vc-line);--primary-soft:var(--vc-soft);
  --green:var(--vc-success);--red:var(--vc-danger);--orange:var(--vc-warning);
  --shadow:var(--vc-shadow);color:var(--vc-text);
}
html[data-theme] .app-shell,html[data-theme] .app-shell .main-content {background:var(--vc-bg)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .panel,.metric-card,.metric-card.highlight,.media-card,.production-package,
  .module-cards button,.pro-summary article,.work-card,.modal,.print-choice,
  .production-dashboard-summary button,.production-detail-drawer,.platform-summary article,
  .theme-choice button,.quick-action,.alert-row,.permission-check,.dashboard-config-row,
  .production-sale-list button,.production-dispatch-items>label,.plan-option,.merge-sale-option
) {background:var(--vc-panel)!important;color:var(--vc-text)!important;border-color:var(--vc-line)!important;box-shadow:var(--vc-shadow)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .panel-header,.modal-header,.form-footer,.items-title,.client-summary,
  .document-totals-editor,.filter-strip,.report-filter-panel,.update-content,.backup-content,
  .backup-intro,.backup-items span,.kanban-column,.kanban-column>header,.package-data div,
  .package-detail div,.batch-history>div,.production-live-summary,.attachment-list>div,
  .production-art,.production-drawer-art,.update-status,.update-steps span,.plan-limits-note
) {background:var(--vc-subtle)!important;color:var(--vc-text)!important;border-color:var(--vc-line)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .topbar h1,.panel-header h2,.modal-header h2,.metric-card strong,.module-cards strong,
  .work-card strong,.backup-intro strong,.platform-summary strong,.production-board-head strong,
  .production-card-meta strong,.production-progress strong,.production-live-summary strong,
  .production-pagination strong,.document-final-summary,.quick-action strong,
  .production-dashboard-summary strong,.package-data strong,.package-detail strong
) {color:var(--vc-text)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .topbar p,.today,.panel-header p,.modal-header p,.metric-card span,.metric-card small,
  .module-cards small,.quick-action small,.alert-row small,.empty-state,.table-subtitle,
  .production-dashboard-summary small,.production-card-meta small,.production-detail-drawer label,
  .production-package header small,.production-package>p,.package-data span,.package-detail span,
  .production-progress span,.production-pagination,.production-pagination small,
  .production-details-link,.work-card span,.work-card small,.work-card em,
  .platform-summary span,.platform-summary small,.print-choice small,.audit-controls label,
  .merge-sales-head,.merge-sale-option span small,.production-art-empty,.digit-line,
  .form-group label,.filter-strip label,.form-group small,.form-body small
) {color:var(--vc-muted)!important}
html[data-theme] .modal-backdrop label {color:var(--vc-muted)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .form-control,.filter-strip .form-control,.search-box,.search-box input,.pix-key,
  .production-progress input,.production-quick-transfer input,option
) {background:var(--vc-input)!important;color:var(--vc-text)!important;border-color:var(--vc-line)!important;color-scheme:inherit}
html[data-theme] :is(.app-shell,.modal-backdrop) input::placeholder,
html[data-theme] :is(.app-shell,.modal-backdrop) textarea::placeholder {color:var(--vc-muted);opacity:1}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(input[type="date"],input[type="month"],input[type="time"]) {color-scheme:inherit;max-width:100%;min-width:0}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(
  .secondary-button,.icon-button,.report-tab,.small-button,.upload-button,
  .widget-resize-controls,.production-progress button,.production-pagination button,
  .sale-art-upload
) {background:var(--vc-subtle)!important;color:var(--vc-link)!important;border-color:var(--vc-line)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.secondary-button,.icon-button,.report-tab,.quick-action,.theme-choice button,.production-dashboard-summary button,.work-card):hover {background:var(--vc-hover)!important;border-color:var(--vc-link)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.primary-button,.report-tab.active,.production-room-tabs button.active,.quick-next) {background:#1263d7!important;color:#fff!important;border-color:#1263d7!important}
html[data-theme] :is(.app-shell,.modal-backdrop) .theme-choice button[aria-pressed="true"] {border:2px solid var(--vc-link)!important;background:var(--vc-soft)!important;color:var(--vc-link)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.text-button,.production-board-head small,.production-package header>strong,.plan-limits-note strong) {color:var(--vc-link)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.count-badge,.status-pendente,.status-rascunho,.production-room-tabs button span) {background:var(--vc-subtle);color:var(--vc-muted)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.filter-summary,.update-version,.formula-banner,.source-banner,.pix-summary,.access-total,.merge-sale-option em,.status-enviado,.status-em-andamento) {background:var(--vc-soft);color:var(--vc-link);border-color:var(--vc-line)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.metric-icon.blue,.metric-icon.purple,.metric-icon.dark,.quick-action>span,.production-dashboard-summary button>span,.media-symbol,.client-avatar,.user-row-avatar) {background:var(--vc-soft);color:var(--vc-link)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.status-aprovado,.status-recebida,.status-convertido,.status-pago,.status-concluido,.stock-box,.margin-tag,.metric-icon.green) {background:var(--vc-success-bg);color:var(--vc-success)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.danger-button,.status-recusado,.status-cancelada,.status-vencido,.stock-box.out,.metric-icon.red) {background:var(--vc-danger-bg);color:var(--vc-danger);border-color:var(--vc-danger)}
html[data-theme] :is(.app-shell,.modal-backdrop) :is(.stock-box.low,.status-aguardando,.status-agendado,.metric-icon.orange,.backup-warning,.quick-return) {background:var(--vc-warning-bg);color:var(--vc-warning);border-color:var(--vc-line)}
html[data-theme] :is(.app-shell,.modal-backdrop) .status-unificada {background:var(--vc-soft);color:var(--vc-link)}
html[data-theme] :is(.app-shell,.modal-backdrop) .production-dashboard-summary em {color:var(--vc-success)}
html[data-theme] :is(.app-shell,.modal-backdrop) .entry-type.in {color:var(--vc-success)}
html[data-theme] :is(.app-shell,.modal-backdrop) .entry-type.out {color:var(--vc-danger)}
html[data-theme] :is(.app-shell,.modal-backdrop) table {color:var(--vc-text)}
html[data-theme] :is(.app-shell,.modal-backdrop) table th {background:var(--vc-subtle)!important;color:var(--vc-muted)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) table td {border-color:var(--vc-line)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) tbody tr:hover {background:var(--vc-hover)!important}
html[data-theme] :is(.app-shell,.modal-backdrop) .total-box {background:var(--vc-soft);color:var(--vc-text)}
html[data-theme] :is(.app-shell,.modal-backdrop) .total-box span {color:var(--vc-muted)}
html[data-theme] .app-shell .pie-chart:after {background:var(--vc-panel)}
html[data-theme] .app-shell .pie-legend,
html[data-theme] .app-shell .pie-legend :is(span,strong) {color:var(--vc-text)}
html[data-theme] .app-shell .pie-legend>div {font-size:12px}
html[data-theme] .app-shell .bar-row {color:var(--vc-text)}
html[data-theme] .app-shell .bar-row>div {background:var(--vc-subtle)}
html[data-theme] .dashboard-line-svg text {fill:var(--vc-muted)}
html[data-theme] .dashboard-line-svg .chart-grid line {stroke:var(--vc-line)}
html[data-theme] .dashboard-line-svg circle {fill:var(--vc-panel)}
html[data-theme] .app-shell .sidebar {background:#0b192c;border-color:#26374f;color:#e8eff8}
html[data-theme] .app-shell .sidebar :is(.brand strong,.user-meta strong) {color:#e8eff8}
html[data-theme] .app-shell .sidebar :is(.brand span,.user-meta span,.nav-item,.logout-button) {color:#b2c2d7}
html[data-theme] .app-shell .nav-item.active {color:#fff;background:#1263d7}
html[data-theme] .app-shell .sidebar-footer {background:#0b192c;border-color:#34455d}
html[data-theme] .app-shell ::-webkit-scrollbar-track {background:var(--vc-bg)}
html[data-theme] .app-shell ::-webkit-scrollbar-thumb {background:var(--vc-line)}
html[data-theme] #page-production:fullscreen {background:var(--vc-bg);color:var(--vc-text)}
html[data-theme] .external-quote-notice {background:var(--vc-panel);color:var(--vc-text);border-color:var(--vc-link);box-shadow:var(--vc-shadow)}
html[data-theme] .external-quote-notice small {color:var(--vc-muted)}
html[data-theme] .external-quote-notice span {color:var(--vc-link)}
html[data-theme] :is(.app-shell,.modal-backdrop) .toast {background:var(--vc-panel);color:var(--vc-text)}
html[data-theme] :is(.app-shell,.modal-backdrop) :focus-visible {outline:3px solid var(--vc-link);outline-offset:2px}
}
