/* Day mode relies on the app's original palette. */
html #app-appearance{
 touch-action:manipulation;
 position:fixed!important;inset:auto max(16px,env(safe-area-inset-right)) calc(22px + env(safe-area-inset-bottom)) auto!important;
 width:46px!important;height:46px!important;min-height:46px!important;padding:0!important;margin:0!important;
 border-radius:50%!important;border:1px solid #b6bbcc!important;background:#fffdf7!important;color:#292e48!important;
 display:grid!important;place-items:center!important;box-shadow:0 3px 14px #0b15292b;z-index:2147483000;cursor:pointer;
}
html #app-appearance svg{pointer-events:none;width:23px;height:23px}
html #app-appearance:focus-visible{outline:3px solid #8b79ff!important;outline-offset:3px}
html[data-appearance=night] #app-appearance{background:#253145!important;border-color:#767d89!important;color:#ffdc91!important}
@media(max-width:700px){html #app-appearance{bottom:calc(76px + env(safe-area-inset-bottom))!important}}
@media print{html #app-appearance{display:none!important}}
@media screen {
  html[data-appearance=night] {
    color-scheme: dark;
    --ink: #f3f6f1;
    --muted: #b9cdc7;
    --brand: #9be4ce;
    --wash: #21423f;
    --page: #0b1b22;
    --surface: #112a30;
    --raised: #19383c;
    --input: #0d2229;
    --line: #44615f;
    --action: #286459;
  }
  html[data-appearance=night] :is(body, .workspace-page, .auth-page, footer) {
    background: var(--page);
    color: var(--ink);
  }
  html[data-appearance=night] :is(.overview-card, .auth-page .auth-card, .card, .document-card, .case-row, .case-detail, .case-tools, .operation-card, .monitor-card, .workspace-dialog, .petition-dialog, .file-sheet, .court-history, .case-fold, .folder-card, .process-row, .workspace-page>header, .portal-metrics button, .client-file-tile, .document-preview-body, .sheet-placeholder, .petition-options, .petition-dialog .petition-paper) {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
  }
  html[data-appearance=night] :is(.case-fold>summary, .court-event-body, .latest-update, .monitor-state, .document-count, .case-split-badge, .folder-card:hover, .document-card:hover, .new-case-notice, .petition-options .petition-choices label:has(:checked)) {
    background: var(--raised);
    color: var(--ink);
    border-color: var(--line);
  }
  html[data-appearance=night] :is(.case-fold[open]>summary, .case-fold.case-unread>summary) {
    background: #1c3d40;
  }
  html[data-appearance=night] :is(.brand-lockup, .brand-lockup>span, .lawyer-toolbar h2, .filter-label, .fold-identity, .portal-metrics strong, legend, .petition-paper) { color: var(--ink); }
  html[data-appearance=night] :is(.brand-lockup strong, .eyebrow, .fold-symbol, .back-site, .link, .monitor-source, .document-list h3, a:not(.button):not(.brand-lockup)) { color: var(--brand); }
  html[data-appearance=night] :is(.portal-metrics small, .portal-metrics span, .priority-key, .field-caption, .fold-counts, .monitor-state, .case-tools small, .muted, .process-row small, .process-column-head, .case-latest p, .fold-checked, .auth-brand>p, .process-deadline-strip, .workspace-dialog [role=status], .session-loader, .sheet-placeholder, .petition-options header p, .petition-money span) { color: var(--muted); }
  html[data-appearance=night] :is(.account-bar, .case-toolbar, .case-fold, .document-line, .deadline-row, .case-row, fieldset, table, th, td) { border-color: var(--line); }
  html[data-appearance=night] :is(input:not([type=checkbox]):not([type=radio]), select, textarea, .auth-card input[readonly], .search-label) {
    background: var(--input);
    border-color: var(--line);
    color: var(--ink);
  }
  html[data-appearance=night] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
  html[data-appearance=night] :is(button:not(#app-appearance), .button, .workspace-dialog .document-action, .install-app, .case-tools .button) {
    background: var(--action); color: #fffaf4; border-color: var(--line);
  }
  html[data-appearance=night] :is(button.quiet, .portal-metrics button, .portal-nav button, button.folder-card, .petition-mode button) {
    background: var(--raised); color: var(--ink); border-color: var(--line);
  }
  html[data-appearance=night] :is(.portal-nav button[aria-current=page], button[aria-pressed=true], .petition-mode button[aria-pressed=true]) {
    color: #0c2723; background: var(--brand);
  }
  html[data-appearance=night] :is(.pill, .priority-badge, .document-count) { color: #b6efde; background: #254740; }
  html[data-appearance=night] :is(.new-case-badge, .workspace-page .case-unread .new-case-badge, .priority-badge.priority-urgent, .error) { color: #ffd1cd; background: #542e35; }
  html[data-appearance=night] :is(.pill.filing-pending,.deadline-row.date-passed,.deferred-document-alert,.deferred-document-badge,.lawyer-fold .fold-status .open-deadline-count,.petition-dialog [data-petition-pending],.petition-dialog [data-petition-pending] li) { background: #473c2b; color: #ffdc9d; border-color: #806a43; }
  html[data-appearance=night] :is(.workspace-dialog,.petition-dialog)::backdrop { background: rgb(3 13 18 / 78%); }
  html[data-appearance=night] :focus-visible, html[data-appearance=night] .search-label:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
  html[data-appearance=night] .search-label input:focus-visible { outline: 0; }
  html[data-appearance=night] #app-appearance { background: var(--raised)!important; border-color: var(--line)!important; }
}
@media screen and (max-width:700px) {
  .lawyer-overview, .lawyer-overview :is(.search-toolbar,.process-filters,.filter-label,.fold-controls,.search-label) { min-width: 0; }
  .lawyer-overview .fold-controls { margin-inline: 0; }
  .lawyer-overview .fold-controls button { flex: 1 1 auto; white-space: normal; }
  .lawyer-overview :is(select,input[type=search]) { font-size: 16px; }
}

/* Keep the search control in the same position across both themes. */
@media screen {
  .lawyer-overview .search-label {
    display: flex; align-items: center; gap: .65rem;
    padding-inline: .85rem; border-radius: .85rem;
  }
  .lawyer-overview .search-label input[type=search] {
    flex: 1 1 0%; min-width: 0; width: 0; margin: 0;
    padding: .85rem 0; background: transparent; border: 0; border-radius: 0;
  }
}

/* The account header is shared by all views in the lawyer workspace. */
.workspace-page .account-bar::after {
 content:""; display:block; width:40px; height:40px; flex:0 0 40px;
 background:center / contain no-repeat url("./icone-dia.svg");
}
html[data-appearance=night] .workspace-page .account-bar::after {
 background-image:url("./icone-noite.svg");
}
.workspace-page .account-bar .account-actions { margin-inline-start:auto; }
@media(max-width:700px) {
 .workspace-page .account-bar { display:grid;grid-template-columns:minmax(0,1fr) 40px;align-items:center; }
 .workspace-page .account-bar::after { grid-column:2;grid-row:1;justify-self:end; }
 .workspace-page .account-bar .account-actions { grid-column:1/-1;grid-row:2;margin-inline-start:0;flex-wrap:wrap; }
}
