/* Editor da paleta, disponível mesmo quando a empresa usa o tema padrão. */
.company-colors { min-width: 0; }
.company-colors > p { max-width: 760px; line-height: 1.6; }
.theme-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.theme-colors { display: grid; grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); gap: 12px; margin-bottom: 14px; }
.theme-color { padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 8px; }
.theme-color label { font-size: 12px; }
.theme-color input[type=color] { width: 100%; height: 52px; padding: 4px; cursor: pointer; }
.theme-color input[type=text] { width: 100%; box-sizing: border-box; font-family: monospace; }
.theme-color button { justify-self: start; }
.theme-status { min-height: 1.6em; font-size: 13px; }
.theme-preview { display: grid; grid-template-columns: 150px minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--theme-on-bg); }
.theme-preview aside { display: flex; flex-direction: column; gap: 18px; padding: 22px 16px; background: var(--theme-menu); color: var(--theme-on-menu); font-size: 12px; }
.theme-preview-content { padding: 22px; }
.theme-preview h4 { margin: 0 0 16px; color: var(--theme-on-bg); }
.theme-preview article { background: var(--theme-surface); color: var(--ink); padding: 20px; border-radius: 10px; }
.theme-preview article p { color: var(--ink); font-size: 12px; }
.theme-preview-button,.theme-preview-tag { display: inline-block; padding: 9px 12px; margin: 4px 8px 0 0; border-radius: 8px; font-size: 12px; }
.theme-preview-button { background: var(--theme-primary); color: var(--theme-on-primary); }
.theme-preview-tag { background: var(--theme-highlight); color: var(--theme-on-highlight); }
@media(max-width:600px) { .theme-preview { grid-template-columns: 1fr; } .theme-preview aside { flex-direction: row; flex-wrap: wrap; padding: 14px; } .theme-preview-content { padding: 14px; } }

/* A identidade é ativada só no painel autenticado; alertas fiscais e documentos mantêm suas cores semânticas. */
html.company-theme body { background: var(--bg); color: var(--theme-on-bg); }
.company-theme :is(.panel,.stat,dialog,.table-scroll,.topbar,.dialog-footer,.dialog-header,.panel-heading,.toolbar,.tabs,.filter-grid) { background: var(--theme-surface); color: var(--ink); border-color: var(--line); }
.company-theme :is(.panel,.stat,dialog) :is(h1,h2,h3,h4,strong,label) { color: inherit; }
.company-theme .page-heading h1,.company-theme #breadcrumb { color: var(--theme-on-bg); }
.company-theme .topbar #breadcrumb { color: var(--ink); }
.company-theme #sidebar { background: var(--theme-menu); border-color: var(--theme-menu); color: var(--theme-on-menu); }
.company-theme #sidebar :is(nav a,nav .nav-icon,.sidebar-footer,.sidebar-footer a) { color: var(--theme-on-menu); }
.company-theme #sidebar nav a:hover { background: color-mix(in srgb,var(--theme-on-menu) 10%,transparent); }
.company-theme #sidebar nav a.active { background: var(--theme-highlight); color: var(--theme-on-highlight); box-shadow: none; }
.company-theme #sidebar nav a.active .nav-icon { color: inherit; }
.company-theme #sidebar nav a.active::before { background: currentColor; }
.company-theme :is(.primary:not(.danger),.welcome-card .primary) { background: var(--theme-primary); color: var(--theme-on-primary); box-shadow: none; border-color: transparent; }
.company-theme :is(.primary:not(.danger),.welcome-card .primary):hover { background: var(--theme-primary); color: var(--theme-on-primary); filter: brightness(.94); }
.company-theme :is(.secondary,.logout-button,.icon-button) { background: var(--theme-surface); color: var(--ink); border-color: var(--line); }
.company-theme :is(.secondary:hover,.quick-link:hover,.tabs button:hover) { background: var(--accent); color: var(--ink); border-color: var(--blue); }
.company-theme :is(.text-button,.link-button,.quick-link,.editor-title-name) { color: var(--blue); }
.company-theme :is(.stat-icon,.count-badge,.tabs button.active) { background: var(--theme-highlight); color: var(--theme-on-highlight); box-shadow: none; border-color: transparent; }
.company-theme .welcome-card { background: var(--theme-menu); border-color: var(--line); color: var(--theme-on-menu); }
.company-theme .welcome-card :is(h2,p,.eyebrow) { color: inherit; }
.company-theme :is(input,select,textarea,.password-wrap) { background: var(--theme-surface); color: var(--ink); border-color: var(--line); accent-color: var(--theme-primary); }
.company-theme :is(input,textarea)::placeholder { color: var(--muted); }
.company-theme input[readonly] { background: var(--accent); color: var(--ink); }
.company-theme :is(input,select,textarea):focus { background: var(--theme-surface); border-color: var(--theme-focus); box-shadow: 0 0 0 3px color-mix(in srgb,var(--theme-focus) 20%,transparent); }
.company-theme :is(button,a):focus-visible { outline-color: var(--theme-focus); }
.company-theme :is(th,.tag,.check-label:has(input:checked),.permission-row,.nfsem-card-head,.nfsem-summary-card) { background: var(--accent); color: var(--ink); border-color: var(--line); }
.company-theme :is(.permission-screen,.permissions-admin-note) { border-color: var(--line); }
.company-theme :is(.tag,.check-label:has(input:checked)) { color: var(--blue); }
.company-theme :is(.check-label input:checked,.logout-icon) { background: var(--theme-primary); color: var(--theme-on-primary); }
.company-theme tbody tr:hover { background: var(--accent); }
.company-theme tbody tr.row-selected,.company-theme tbody tr.row-selected:hover { background: var(--theme-highlight); color: var(--theme-on-highlight); }
.company-theme tbody tr.row-selected a { color: inherit; }
.company-theme :is(.chart-grid,.chart-base) { stroke: var(--line); }
.company-theme :is(.chart-axis,.chart-legend text) { fill: var(--muted); }
.company-theme #toast { background: var(--theme-menu); color: var(--theme-on-menu); border-color: var(--line); }
.company-theme .loading::before { border-color: var(--line); border-top-color: var(--theme-primary); }
.company-theme .nfsem-result { background:var(--theme-surface); color:var(--ink); }
.company-theme .nfsem-result:hover,.company-theme .nfsem-result:focus-visible { background:var(--accent); }
.company-theme ::selection { background: var(--theme-highlight); color: var(--theme-on-highlight); }
.company-theme :is(.stat-top,.stat small,.date-chip,.app-footer) { color: inherit; }
.company-theme :is(.tabs button,.toolbar .search-wrap input,.date-chip) { background: var(--theme-surface); color: var(--ink); }
.company-theme .tabs button.active { background: var(--theme-highlight); color: var(--theme-on-highlight); }
.company-theme tbody tr.row-selected > td:first-child { color: inherit; }
.company-theme :is(.map-toolbar,.model-list article,.models-empty,.model-editor-overlay header,.model-toolbar,.model-pages,.model-properties) { background: var(--theme-surface); color: var(--ink); border-color: var(--line); }
.company-theme .models-head h1 { color: var(--theme-on-bg); }
.company-theme .model-card-icon { background: var(--theme-primary); color: var(--theme-on-primary); }
.company-theme .model-toolbar button,.company-theme .model-pages button { background: var(--accent); color: var(--ink); border-color: var(--line); }
.company-theme .model-pages .active { background: var(--theme-highlight); color: var(--theme-on-highlight); }
/* Fichas e folhas impressas permanecem legíveis sobre o papel branco. */
.company-theme .document { --blue:#2955a6; --ink:#2d3546; --navy:#252d40; --muted:#66748a; color:var(--ink); background:white; }
@media print { html.company-theme body { background:white; color:#000; } }
