/* DIMI Gestão v7.99.0 R12
   Segunda rodada de auditoria visual: menus laterais, tabelas, subtítulos e paridade claro/escuro. */

#app-shell{
  --dimi-audit-surface:#ffffff;
  --dimi-audit-surface-2:#f6f9fb;
  --dimi-audit-surface-3:#eef3f6;
  --dimi-audit-text:#17261f;
  --dimi-audit-text-2:#3e5364;
  --dimi-audit-muted:#5d7082;
  --dimi-audit-border:#d7e3df;
  --dimi-audit-table-head:#f1f5f4;
  --dimi-audit-table-zebra:#f9fbfa;
  --dimi-audit-table-hover:#eef9f4;
}

/* 1) MENU LATERAL — hierarquia e contraste */
#app-shell .sidebar{
  border-right-color:rgba(180,205,219,.18)!important;
}
#app-shell .dimi674-platform-brand span{
  color:#9af1c7!important;
}
#app-shell .shop-brand-copy:before{
  color:#8de8bd!important;
}
#app-shell .shop-brand-copy strong{
  color:#f8fbff!important;
}
#app-shell .shop-brand-copy span,
#app-shell .sidebar-brand span{
  color:#afc1d0!important;
}
#app-shell .nav-item{
  color:#d6e3ec!important;
  font-weight:760;
  border:1px solid transparent;
}
#app-shell .nav-item:hover{
  color:#ffffff!important;
  background:rgba(255,255,255,.075)!important;
  border-color:rgba(190,215,230,.14)!important;
}
#app-shell .nav-item.active{
  color:#ffffff!important;
  background:linear-gradient(135deg,color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 31%,transparent),color-mix(in srgb,var(--dimi-ui-accent,#0f8f66) 23%,transparent))!important;
  border-color:color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 46%,transparent)!important;
  box-shadow:0 10px 26px rgba(0,0,0,.16),inset 3px 0 0 color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 80%,#fff)!important;
}
#app-shell .stock-sidebar-subnav,
#app-shell .product-side-nested{
  border-left-color:rgba(160,196,214,.30)!important;
}
#app-shell .stock-sidebar-subnav button,
#app-shell .product-side-nested button{
  color:#b8c9d7!important;
  font-weight:650;
}
#app-shell .stock-sidebar-subnav button:hover,
#app-shell .product-side-nested button:hover{
  color:#f5fbff!important;
  background:rgba(255,255,255,.065)!important;
}
#app-shell .stock-sidebar-subnav button.active,
#app-shell .product-side-nested button.active,
#app-shell #fiscal-sidebar-subnav>button.active,
#app-shell #fiscal-aux-subnav>button.active,
#app-shell #finance-sidebar-subnav button.active{
  color:#eafff5!important;
  background:color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 22%,transparent)!important;
  box-shadow:inset 2px 0 0 color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 78%,#fff);
}
#app-shell .shop-brand-chevron,
#app-shell .shop-brand-menu-title,
#app-shell .shop-brand-option-copy small{
  color:#abc0d1!important;
}
#app-shell .sidebar-footer,
#app-shell .sidebar-footer #current-user-mini{
  color:#c6d5e1!important;
}
#app-shell .sidebar-footer{
  border-top-color:rgba(180,205,219,.18)!important;
}

/* 2) TABELAS — leitura, cabeçalho e estados */
#app-shell .table-wrap,
#app-shell .v4-table-card{
  background:var(--dimi-audit-surface)!important;
  border-color:var(--dimi-audit-border)!important;
}
#page-content table{
  color:var(--dimi-audit-text);
}
#page-content table thead th{
  background:var(--dimi-audit-table-head)!important;
  color:#34485a!important;
  border-color:var(--dimi-audit-border)!important;
  font-weight:850!important;
}
#page-content table tbody td{
  color:#22342c;
  border-color:#dfe8e4!important;
}
#app-shell .gc-table tbody tr:nth-child(odd),
#app-shell .product-table tbody tr:nth-child(odd),
#app-shell .quote-table tbody tr:nth-child(odd),
#app-shell .sale-table tbody tr:nth-child(odd){
  background:var(--dimi-audit-table-zebra)!important;
}
#app-shell .gc-table tbody tr:hover,
#app-shell .product-table tbody tr:hover,
#app-shell .quote-table tbody tr:hover,
#app-shell .sale-table tbody tr:hover,
#app-shell .dimi-fiscal-table tbody tr:hover{
  background:var(--dimi-audit-table-hover)!important;
}
#page-content table thead th.v678-sortable:hover{
  background:color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 10%,var(--dimi-audit-table-head))!important;
  color:#0d704c!important;
}

/* 3) SUBTÍTULOS E TEXTOS SECUNDÁRIOS */
#page-subtitle,
#app-shell .topbar span,
#app-shell .gc-header-path,
#app-shell .metric-label,
#app-shell .metric-foot,
#app-shell .muted,
#app-shell .empty,
#app-shell .product-sub,
#app-shell .theme-status,
#app-shell .v679-general-card span,
#app-shell .dimi-fiscal-hero p,
#app-shell .dimi-fiscal-card p,
#app-shell .dimi-fiscal-kpi span,
#app-shell .dimi-fiscal-kpi small,
#app-shell .dimi-fiscal-section-head p{
  color:var(--dimi-audit-muted)!important;
}
#app-shell .section-title h3,
#app-shell .gc-section-title,
#app-shell .v4-box h3,
#app-shell .quote-section-title,
#app-shell .product-section-title,
#app-shell .purchase-section-title{
  color:var(--dimi-audit-text)!important;
}

/* Superfícies e abas que tinham branco fixo */
#app-shell .product-tabs,
#app-shell .product-tab,
#app-shell .product-form-box,
#app-shell .product-section,
#app-shell .product-photo-card,
#app-shell .product-view-panel,
#app-shell .stock-module-tabs,
#app-shell .purchase-section,
#app-shell .purchase-view-tabs,
#app-shell .purchase-view-tab,
#app-shell .purchase-attachment,
#app-shell .quote-section,
#app-shell .quote-view-card,
#app-shell .quote-view-panel,
#app-shell .sale-view-tab,
#app-shell .sale-history-item,
#app-shell .sale-attachment,
#app-shell .quote-config-card,
#app-shell .v4-filter-panel,
#app-shell .v4-kpi,
#app-shell .v4-payment-strip,
#app-shell .v4-columns-menu,
#app-shell .v4-form-panel,
#app-shell .v4-settings-section,
#app-shell .v4-box,
#app-shell .dimi-fiscal-card,
#app-shell .dimi-fiscal-section,
#app-shell .dimi-fiscal-section-head,
#app-shell .dimi-fiscal-editor{
  background:var(--dimi-audit-surface)!important;
  border-color:var(--dimi-audit-border)!important;
}
#app-shell .quote-section-title,
#app-shell .quote-view-card-title,
#app-shell .quote-view-panel h4,
#app-shell .quote-config-card .head,
#app-shell .dimi-fiscal-section>header,
#app-shell .dimi-fiscal-editor>summary,
#app-shell .dimi-fiscal-view-panel h4{
  background:var(--dimi-audit-surface-2)!important;
  color:var(--dimi-audit-text)!important;
  border-color:var(--dimi-audit-border)!important;
}
#app-shell .product-menu-pop,
#app-shell .product-menu-pop button,
#app-shell .product-menu-pop label,
#app-shell .v4-columns-menu{
  background:var(--dimi-audit-surface)!important;
  color:var(--dimi-audit-text)!important;
  border-color:var(--dimi-audit-border)!important;
}
#app-shell .product-menu-pop button:hover,
#app-shell .product-menu-pop label:hover{
  background:var(--dimi-audit-surface-2)!important;
}

/* Formulários e estados neutros */
#app-shell input,
#app-shell select,
#app-shell textarea{
  color:#17261f;
  border-color:#cfddd7;
}
#app-shell input::placeholder,
#app-shell textarea::placeholder{
  color:#7a8b98;
}
#app-shell .btn.secondary{
  color:#21352d;
  border:1px solid #d4dfdb;
}

/* MODO ESCURO — mesma hierarquia, sem cinzas apagados */
html[data-theme="dark"] #app-shell{
  --dimi-audit-surface:#0e1929;
  --dimi-audit-surface-2:#121f32;
  --dimi-audit-surface-3:#18283d;
  --dimi-audit-text:#eef5fb;
  --dimi-audit-text-2:#d4dfeb;
  --dimi-audit-muted:#b0c0d1;
  --dimi-audit-border:#2f425a;
  --dimi-audit-table-head:#111e31;
  --dimi-audit-table-zebra:#0f1b2c;
  --dimi-audit-table-hover:#162b3d;
}
html[data-theme="dark"] #app-shell .nav-item{
  color:#d8e6f0!important;
}
html[data-theme="dark"] #app-shell .stock-sidebar-subnav button,
html[data-theme="dark"] #app-shell .product-side-nested button{
  color:#b9cad8!important;
}
html[data-theme="dark"] #app-shell .table-wrap,
html[data-theme="dark"] #app-shell .v4-table-card,
html[data-theme="dark"] #app-shell .product-tabs,
html[data-theme="dark"] #app-shell .product-tab,
html[data-theme="dark"] #app-shell .product-form-box,
html[data-theme="dark"] #app-shell .product-section,
html[data-theme="dark"] #app-shell .product-photo-card,
html[data-theme="dark"] #app-shell .product-view-panel,
html[data-theme="dark"] #app-shell .stock-module-tabs,
html[data-theme="dark"] #app-shell .purchase-section,
html[data-theme="dark"] #app-shell .purchase-view-tabs,
html[data-theme="dark"] #app-shell .purchase-view-tab,
html[data-theme="dark"] #app-shell .purchase-attachment,
html[data-theme="dark"] #app-shell .quote-section,
html[data-theme="dark"] #app-shell .quote-view-card,
html[data-theme="dark"] #app-shell .quote-view-panel,
html[data-theme="dark"] #app-shell .sale-view-tab,
html[data-theme="dark"] #app-shell .sale-history-item,
html[data-theme="dark"] #app-shell .sale-attachment,
html[data-theme="dark"] #app-shell .quote-config-card,
html[data-theme="dark"] #app-shell .v4-filter-panel,
html[data-theme="dark"] #app-shell .v4-kpi,
html[data-theme="dark"] #app-shell .v4-payment-strip,
html[data-theme="dark"] #app-shell .v4-columns-menu,
html[data-theme="dark"] #app-shell .v4-form-panel,
html[data-theme="dark"] #app-shell .v4-settings-section,
html[data-theme="dark"] #app-shell .v4-box,
html[data-theme="dark"] #app-shell .dimi-fiscal-card,
html[data-theme="dark"] #app-shell .dimi-fiscal-section,
html[data-theme="dark"] #app-shell .dimi-fiscal-section-head,
html[data-theme="dark"] #app-shell .dimi-fiscal-editor{
  background:var(--dimi-audit-surface)!important;
  border-color:var(--dimi-audit-border)!important;
  color:var(--dimi-audit-text)!important;
}
html[data-theme="dark"] #page-content table{
  color:var(--dimi-audit-text)!important;
}
html[data-theme="dark"] #page-content table thead th{
  background:var(--dimi-audit-table-head)!important;
  color:#dbe7f3!important;
  border-color:var(--dimi-audit-border)!important;
}
html[data-theme="dark"] #page-content table tbody td{
  color:#e6eef7!important;
  border-color:#293b51!important;
}
html[data-theme="dark"] #app-shell .gc-table tbody tr:nth-child(odd),
html[data-theme="dark"] #app-shell .product-table tbody tr:nth-child(odd),
html[data-theme="dark"] #app-shell .quote-table tbody tr:nth-child(odd),
html[data-theme="dark"] #app-shell .sale-table tbody tr:nth-child(odd){
  background:var(--dimi-audit-table-zebra)!important;
}
html[data-theme="dark"] #app-shell .gc-table tbody tr:hover,
html[data-theme="dark"] #app-shell .product-table tbody tr:hover,
html[data-theme="dark"] #app-shell .quote-table tbody tr:hover,
html[data-theme="dark"] #app-shell .sale-table tbody tr:hover,
html[data-theme="dark"] #app-shell .dimi-fiscal-table tbody tr:hover{
  background:var(--dimi-audit-table-hover)!important;
}
html[data-theme="dark"] #page-subtitle,
html[data-theme="dark"] #app-shell .topbar span,
html[data-theme="dark"] #app-shell .gc-header-path,
html[data-theme="dark"] #app-shell .metric-label,
html[data-theme="dark"] #app-shell .metric-foot,
html[data-theme="dark"] #app-shell .muted,
html[data-theme="dark"] #app-shell .empty,
html[data-theme="dark"] #app-shell .product-sub,
html[data-theme="dark"] #app-shell .theme-status,
html[data-theme="dark"] #app-shell .v679-general-card span,
html[data-theme="dark"] #app-shell .dimi-fiscal-hero p,
html[data-theme="dark"] #app-shell .dimi-fiscal-card p,
html[data-theme="dark"] #app-shell .dimi-fiscal-kpi span,
html[data-theme="dark"] #app-shell .dimi-fiscal-kpi small,
html[data-theme="dark"] #app-shell .dimi-fiscal-section-head p{
  color:var(--dimi-audit-muted)!important;
}
html[data-theme="dark"] #app-shell .section-title h3,
html[data-theme="dark"] #app-shell .gc-section-title,
html[data-theme="dark"] #app-shell .v4-box h3,
html[data-theme="dark"] #app-shell .quote-section-title,
html[data-theme="dark"] #app-shell .product-section-title,
html[data-theme="dark"] #app-shell .purchase-section-title{
  color:var(--dimi-audit-text)!important;
}
html[data-theme="dark"] #app-shell .quote-section-title,
html[data-theme="dark"] #app-shell .quote-view-card-title,
html[data-theme="dark"] #app-shell .quote-view-panel h4,
html[data-theme="dark"] #app-shell .quote-config-card .head,
html[data-theme="dark"] #app-shell .dimi-fiscal-section>header,
html[data-theme="dark"] #app-shell .dimi-fiscal-editor>summary,
html[data-theme="dark"] #app-shell .dimi-fiscal-view-panel h4{
  background:var(--dimi-audit-surface-2)!important;
  color:var(--dimi-audit-text)!important;
  border-color:var(--dimi-audit-border)!important;
}
html[data-theme="dark"] #app-shell .product-menu-pop,
html[data-theme="dark"] #app-shell .product-menu-pop button,
html[data-theme="dark"] #app-shell .product-menu-pop label,
html[data-theme="dark"] #app-shell .v4-columns-menu{
  background:#111f32!important;
  color:#eaf2fa!important;
  border-color:#30445e!important;
}
html[data-theme="dark"] #app-shell .product-menu-pop button:hover,
html[data-theme="dark"] #app-shell .product-menu-pop label:hover{
  background:#182a40!important;
}
html[data-theme="dark"] #app-shell input,
html[data-theme="dark"] #app-shell select,
html[data-theme="dark"] #app-shell textarea{
  background:#0c1727!important;
  color:#edf5fc!important;
  border-color:#344a63!important;
}
html[data-theme="dark"] #app-shell input::placeholder,
html[data-theme="dark"] #app-shell textarea::placeholder{
  color:#8fa3b8!important;
}
html[data-theme="dark"] #app-shell .btn.secondary{
  background:#142338!important;
  color:#eef5fb!important;
  border-color:#354a62!important;
}
html[data-theme="dark"] #app-shell .dimi-fiscal-checkline,
html[data-theme="dark"] #app-shell .dimi-fiscal-cert-choice>div,
html[data-theme="dark"] #app-shell .dimi-fiscal-payment-row,
html[data-theme="dark"] #app-shell .dimi-fiscal-tax-row td,
html[data-theme="dark"] #app-shell .dimi-fiscal-total-grid input[readonly]{
  background:#111e30!important;
  color:#e8f1f9!important;
  border-color:#30445e!important;
}
html[data-theme="dark"] #app-shell .dimi-fiscal-check .ico{
  background:#16263a!important;
  color:#eef5fb!important;
  border-color:#30445e!important;
}
html[data-theme="dark"] #app-shell .dimi-cert-clean-card{
  background:linear-gradient(135deg,#10261f,#102a25)!important;
  border-color:#285f49!important;
}
html[data-theme="dark"] #app-shell .dimi-cert-clean-copy>b{color:#f0f8f4!important}
html[data-theme="dark"] #app-shell .dimi-cert-clean-copy>small{color:#b7c7d5!important}
html[data-theme="dark"] #app-shell .dimi-cert-clean-copy>em{color:#8fa4b5!important}

/* Consistência de foco nos dois temas */
#app-shell button:focus-visible,
#app-shell input:focus-visible,
#app-shell select:focus-visible,
#app-shell textarea:focus-visible{
  outline:2px solid color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 76%,#ffffff);
  outline-offset:2px;
}

@media(max-width:760px){
  #app-shell .nav-item{font-weight:720}
}

/* Cobertura de componentes legados que ainda definiam superfícies claras fixas */
html[data-theme="dark"] #app-shell .supplier-check,
html[data-theme="dark"] #app-shell .stock-module-tab.active,
html[data-theme="dark"] #app-shell .v4-tab.active,
html[data-theme="dark"] #app-shell .v4-subtab,
html[data-theme="dark"] #app-shell .v4-groups-table,
html[data-theme="dark"] #app-shell .v4-perm-grid,
html[data-theme="dark"] #app-shell .v4-perm-card,
html[data-theme="dark"] #app-shell .v4-logo-preview,
html[data-theme="dark"] #app-shell .dash-carousel-controls button,
html[data-theme="dark"] #app-shell .finance-batch-bar select,
html[data-theme="dark"] #app-shell .dimi643-model-thumb,
html[data-theme="dark"] #app-shell .dimi643-col-grid label,
html[data-theme="dark"] #app-shell .v753-print-preview-logo,
html[data-theme="dark"] #app-shell .client-card,
html[data-theme="dark"] #app-shell .commercial-card,
html[data-theme="dark"] #app-shell .notes-card,
html[data-theme="dark"] #app-shell .payment-card,
html[data-theme="dark"] #app-shell .summary-card,
html[data-theme="dark"] #app-shell .v757-config-steps>div,
html[data-theme="dark"] #app-shell .dimi767-summary-badges span,
html[data-theme="dark"] #app-shell .dimi772-preview-frame{
  background:var(--dimi-audit-surface)!important;
  color:var(--dimi-audit-text)!important;
  border-color:var(--dimi-audit-border)!important;
}
html[data-theme="dark"] #app-shell .v4-tab.active,
html[data-theme="dark"] #app-shell .stock-module-tab.active{
  background:color-mix(in srgb,var(--dimi-ui-primary,#1fbd70) 14%,var(--dimi-audit-surface-2))!important;
  color:#8ff0be!important;
}
html[data-theme="dark"] #app-shell .v4-subtab:hover,
html[data-theme="dark"] #app-shell .dash-carousel-controls button:hover{
  background:var(--dimi-audit-surface-3)!important;
  color:#f5f9fc!important;
}
html[data-theme="dark"] #app-shell .dimi643-preview-paper{
  background:#eef2f7!important;
  color:#172033!important;
  border-color:#9fb0c2!important;
}

/* Separadores e títulos de grupos ficam legíveis em qualquer tema */
#app-shell .sidebar .admin-nav-separator,
#app-shell .sidebar [class*="separator"]{
  border-color:rgba(180,205,219,.18)!important;
}
#app-shell .sidebar .admin-nav-separator,
#app-shell .sidebar .side-title{
  color:#91aabe!important;
}

/* Evita subtítulos lavados em cabeçalhos e cartões menores */
#app-shell .card small,
#app-shell .v4-kpi small,
#app-shell .admin-kpi small,
#app-shell .dimi675-health-item span{
  color:var(--dimi-audit-muted);
}
html[data-theme="dark"] #app-shell .card small,
html[data-theme="dark"] #app-shell .v4-kpi small,
html[data-theme="dark"] #app-shell .admin-kpi small,
html[data-theme="dark"] #app-shell .dimi675-health-item span{
  color:var(--dimi-audit-muted)!important;
}
