/* Optional appearance preferences. The approved light layout stays the default. */
.field[data-complaint-content-field][hidden] { display: none; }
.operation-editor-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.operation-editor-dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 36px); }
.operation-editor-dialog .dialog-body { min-height: 0; max-height: none; flex: 1; }
.operation-editor-dialog :is(.dialog-head,.dialog-actions) { flex: 0 0 auto; }
.full-complaint-editor { display: block; width: 100%; min-height: 280px; max-height: none; resize: vertical; overflow: auto; white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.7; padding: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; }
.operation-editor-error { color: var(--danger-700); padding: 12px; border: 1px solid currentColor; border-radius: 9px; font-size: 12px; line-height: 1.6; }
.operation-editor-progress { margin: 12px 0; padding: 12px; color: var(--text-soft); background: var(--surface-soft); border: 1px solid var(--border); border-radius: 9px; font-size: 12px; line-height: 1.6; }
.account-inline-action.is-last-copied { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700); }
.account-copy-indicator { display: block; margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--brand-700); }
.account-last-text { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.account-last-text-button { padding: 0; border: 0; background: transparent; color: var(--brand-700); text-align: left; font: inherit; cursor: pointer; }
.account-last-text-button:hover, .account-last-text-button:focus-visible { text-decoration: underline; }
.account-last-text small { color: var(--muted); font-size: 11px; }
.account-text-copy-dialog { width: min(720px, calc(100vw - 32px)); }
#accountTextPreviewDialog[open] { display: flex; flex-direction: column; }
#accountTextPreviewDialog .dialog-body { overflow: auto; min-height: 0; }
.operation-textarea { width: 100%; min-height: 220px; padding: 12px; font: inherit; font-size: 14px; line-height: 1.7; resize: vertical; white-space: pre-wrap; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); }
.triage-findings ul { margin: 0; padding-left: 20px; }
.triage-findings li { margin: 8px 0; font-size: 12px; line-height: 1.6; color: var(--text-soft); }
#complaintTriageDialog .triage-review-grid { grid-template-columns: 1fr; }
#complaintTriageDialog .triage-review-column textarea { height: auto; max-height: none; min-height: 280px; font-size: 14px; line-height: 1.7; }
.complaint-form-actions { flex-wrap: wrap; }
.company-responsibles { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; }
.company-responsibles legend { padding-inline: 4px; font-size: 12px; font-weight: 600; }
#companyEditResponsibleOptions { max-height: 240px; overflow: auto; }
.company-responsible-option { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.company-responsible-option:last-child { border: 0; }
.company-responsible-option label { display: flex; align-items: center; gap: 8px; margin: 0; }
.company-responsible-option input[type="checkbox"] { width: 16px; height: 16px; min-height: 16px; flex: 0 0 auto; }
.company-responsible-option select { width: auto; min-width: 150px; padding: 8px; }
.company-card-title-line { flex-wrap: wrap; align-items: flex-start; }
.company-card-title-line h2 { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.company-card-owner strong, #companyResponsible { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
@media (min-width: 1200px) { .companies-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 960px) and (max-width: 1199px) { .companies-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 640px) and (max-width: 959px) { .companies-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .companies-grid { grid-template-columns: 1fr; } .company-responsible-option { flex-wrap: wrap; } .company-responsible-option select { width: 100%; } .full-complaint-editor { min-height: 320px; } }
.schedule-editor-dialog { width: min(1000px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.schedule-editor-dialog form, .create-company-dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 36px); }
.schedule-editor-dialog .dialog-body, .create-company-dialog .dialog-body { min-height: 0; flex: 1; max-height: none; }
.schedule-editor-dialog .dialog-head, .schedule-editor-dialog .dialog-actions, .create-company-dialog .dialog-head, .create-company-dialog .dialog-actions { flex: 0 0 auto; }
.schedule-editor-dialog .dialog-head .field-help, .create-company-dialog .dialog-head .field-help { margin-top: 4px; }
.schedule-editor-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.schedule-editor-stat { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.schedule-editor-stat span { display: block; color: var(--muted); font-size: 10px; line-height: 1.4; }
.schedule-editor-stat strong { display: block; margin-top: 4px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule-editor-controls { display: grid; grid-template-columns: minmax(100px, .7fr) 1fr 1.4fr auto; align-items: start; gap: 12px; }
.schedule-editor-controls .btn { margin-top: 24px; }
.schedule-editor-controls .field { margin-bottom: 12px; }
.schedule-editor-notice { margin: 0 0 16px; color: var(--text-soft); font-size: 11px; line-height: 1.6; }
.schedule-editor-error, .schedule-deadline-change, .schedule-discard { padding: 12px; margin: 12px 0; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface-soft); font-size: 12px; line-height: 1.6; }
.schedule-editor-error { color: var(--danger-700); border-color: var(--danger-700); }
.schedule-deadline-change { border-color: var(--amber-600); }
.schedule-confirm-label { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.schedule-editor-distribution h3 { margin: 18px 0 4px; font-size: 13px; }
.schedule-editor-distribution p { margin: 0 0 12px; color: var(--muted); font-size: 11px; }
.schedule-editor-table-wrap { max-height: min(350px, 42dvh); overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
.schedule-editor-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 11px; font-variant-numeric: tabular-nums; }
.schedule-editor-table th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; background: var(--surface-soft); color: var(--text-soft); font-size: 10px; }
.schedule-editor-table td { padding: 8px 12px; border-top: 1px solid var(--border); }
.schedule-editor-table td:first-child { white-space: nowrap; }
.schedule-editor-table small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.schedule-editor-table input { width: 76px; min-height: 36px; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.schedule-editor-table input[readonly] { background: var(--surface-soft); color: var(--muted); cursor: default; }
.schedule-editor-table tr[data-today="true"] td:first-child { color: var(--brand-700); font-weight: 700; }
.schedule-editor-save-note { margin-right: auto; align-self: center; color: var(--muted); font-size: 10px; line-height: 1.5; }
.schedule-discard p { margin: 0 0 8px; }
.schedule-discard .btn { margin: 0 8px 0 0; }
.create-company-optional { margin: 8px 0 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.create-company-optional summary { padding: 14px 0; cursor: pointer; font-size: 12px; font-weight: 650; }
.create-company-optional summary span { margin-left: 4px; font-size: 10px; font-weight: 400; color: var(--muted); }
.create-company-preview { padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); color: var(--text-soft); font-size: 11px; line-height: 1.7; }
.create-company-preview h3 { margin: 0 0 8px; font-size: 12px; color: var(--text); }
.create-company-preview strong { color: var(--text); }
.create-company-preview ul { margin: 8px 0 0; padding-left: 20px; }
:is(.schedule-editor-dialog,.create-company-dialog) :is(input,button,summary):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 760px) {
  .schedule-editor-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .schedule-editor-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-editor-controls .btn { margin-top: 24px; white-space: normal; }
  .schedule-editor-table th, .schedule-editor-table td { padding: 8px; }
  .schedule-editor-table input { width: 60px; }
  .schedule-editor-dialog .dialog-actions { flex-wrap: wrap; }
  .schedule-editor-save-note { width: 100%; }
}
@media (max-width: 480px) {
  .schedule-editor-dialog { width: calc(100vw - 16px); }
  .schedule-editor-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-editor-controls { grid-template-columns: 1fr; gap: 4px; }
  .schedule-editor-controls .btn { margin: 0 0 12px; }
  .schedule-editor-table { min-width: 430px; }
}

.dashboard-calendar-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 12px 15px 0; }
.dashboard-calendar-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.dashboard-calendar-picker label { color: var(--muted); font-size: 10px; font-weight: 650; }
.dashboard-calendar-picker input { min-height: 36px; min-width: 136px; max-width: 100%; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 11px; font-variant-numeric: tabular-nums; color-scheme: light; }
html[data-theme="dark"] .dashboard-calendar-picker input { color-scheme: dark; }
.dashboard-calendar-actions { display: flex; align-items: center; gap: 4px; }
.dashboard-calendar-actions .btn { min-height: 36px; height: 36px; padding: 6px 10px; font-size: 10px; }
.dashboard-calendar-actions .dashboard-calendar-arrow { width: 36px; padding: 0; font-size: 20px; }
.dashboard-calendar-actions [aria-pressed="true"] { border-color: var(--brand-500); color: var(--brand-700); background: var(--brand-50); }
.dashboard-calendar-status { min-height: 16px; margin: 8px 15px 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.dashboard-calendar-status[data-state="error"], .dashboard-calendar-status[data-state="offline"] { color: var(--amber-700); }
.dashboard-calendar-empty { margin: 0; padding: 16px 0; color: var(--muted); font-size: 11px; }
:is(.dashboard-calendar-picker input, .dashboard-calendar-actions button):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.company-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.company-card-footer { flex-wrap: wrap; }
.company-ra-link { text-decoration: none; white-space: nowrap; }
.company-ra-link:disabled { opacity: .55; cursor: not-allowed; }
.company-daily-demand { margin-top: 16px; margin-bottom: 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.company-daily-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 20px 12px; }
.company-daily-head h2 { margin: 0; color: var(--text); font-size: 13px; font-weight: 750; }
.company-daily-head > span { color: var(--muted); font-size: 10px; }
.company-daily-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 20px; }
.company-daily-phase { padding: 14px 16px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.company-daily-phase h3 { margin: 0 0 12px; color: var(--text-soft); font-size: 11px; font-weight: 650; }
.company-daily-phase dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.company-daily-phase dt { color: var(--muted); font-size: 9px; }
.company-daily-phase dd { margin: 4px 0 0; color: var(--text); font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.company-daily-phase [data-daily-done] { color: var(--brand-700); }
.company-daily-note { margin: 0; padding: 12px 20px 16px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.company-daily-sync { margin: -8px 20px 14px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.company-daily-sync[data-state="error"], .company-daily-sync[data-state="offline"] { color: var(--amber-700); }
.schedule-loading { padding: 16px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
@media (max-width: 600px) {
  .company-daily-grid { grid-template-columns: 1fr; gap: 8px; padding-inline: 14px; }
  .company-daily-head { padding-inline: 14px; }
  .company-daily-note { padding-inline: 14px; }
  .company-daily-sync { margin-inline: 14px; }
  .company-daily-phase dd { font-size: 20px; }
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding-right: 12px;
}

.brand-row .brand-mark { flex: 0 0 auto; }
.brand-row .brand-copy { min-width: 0; flex: 1; }

.sidebar-toggle,
.appearance-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  background: rgba(255, 255, 255, .035);
  color: #bcc8da;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}

#sidebarToggle { flex: 0 0 auto; width: 32px; min-height: 32px; padding: 5px; }
.sidebar-toggle:hover,
.appearance-theme-toggle:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; }
.appearance-theme-toggle { justify-content: flex-start; width: calc(100% - 20px); margin: 0 10px 8px; padding: 9px 12px; font-size: 11px; font-weight: 620; }
.appearance-theme-toggle .icon { width: 17px; height: 17px; }
.appearance-toggle-label { min-width: 0; }

.app-theme-toggle {
  position: fixed;
  top: 12px;
  right: 24px;
  z-index: 24;
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 8px 11px;
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
}
.app-theme-toggle:hover { border-color: var(--brand-600); background: var(--surface-soft); color: var(--text); }

.login-panel { position: relative; }
#loginThemeToggle {
  position: absolute;
  width: auto;
  margin: 0;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 10px;
}

#loginThemeToggle:hover { border-color: var(--brand-600); color: var(--text); }
#loginThemeToggle .icon { width: 16px; height: 16px; }
:is(#sidebarToggle, #themeToggle, #loginThemeToggle, #appThemeToggle):focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sidebar { transition: width var(--ease); }

/* A narrow desktop rail never changes the mobile drawer's independent behavior. */
@media (min-width: 821px) {
  .breadcrumb-row { padding-right: 130px; }
  /* Auto expansion overlays the page: the content always keeps an 80px rail. */
  html[data-sidebar-mode="auto"] { --sidebar-width: 80px; }
  html[data-sidebar-mode="auto"][data-sidebar="expanded"] .sidebar { width: 248px; box-shadow: 8px 0 24px rgba(4, 9, 18, .1); }
  html[data-sidebar-mode="static"] #sidebarToggle { display: none; }
  html[data-sidebar="collapsed"] { --sidebar-width: 80px; }
  html[data-sidebar="collapsed"] .brand-row { min-height: 96px; flex-direction: column; justify-content: center; gap: 7px; padding: 12px 0 8px; }
  html[data-sidebar="collapsed"] #sidebarToggle { width: 36px; min-height: 30px; }
  html[data-sidebar="collapsed"] .sidebar :is(.brand-copy, .workspace-copy, .workspace-tag, .nav-text, .profile-copy, .appearance-toggle-label) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  html[data-sidebar="collapsed"] .sidebar-workspace { justify-content: center; min-height: 34px; margin: 0 16px 8px; padding: 0; }
  html[data-sidebar="collapsed"] .nav-scroll { padding-inline: 10px; overflow-x: hidden; }
  html[data-sidebar="collapsed"] .nav-label { height: 1px; margin: 6px 9px; border-top: 1px solid rgba(255, 255, 255, .09); overflow: hidden; color: transparent; font-size: 0; line-height: 0; }
  html[data-sidebar="collapsed"] .nav-label:first-child { margin-top: 4px; }
  html[data-sidebar="collapsed"] .nav-item { position: relative; justify-content: center; min-height: 42px; padding: 4px; gap: 0; }
  html[data-sidebar="collapsed"] .nav-icon { width: 32px; height: 32px; }
  html[data-sidebar="collapsed"] .nav-icon .icon { width: 19px; height: 19px; }
  html[data-sidebar="collapsed"] .nav-badge { position: absolute; top: 8px; right: 7px; width: 6px; min-width: 0; height: 6px; padding: 0; overflow: hidden; border-radius: 50%; background: #9aa8bc; color: transparent; font-size: 0; }
  html[data-sidebar="collapsed"] .nav-badge.alert { background: #e5b982; }
  html[data-sidebar="collapsed"] .sidebar .appearance-theme-toggle { justify-content: center; width: 44px; min-height: 38px; margin: 0 18px 8px; padding: 8px; gap: 0; }
  html[data-sidebar="collapsed"] #sidebarToggle .icon { transform: rotate(180deg); }
  html[data-sidebar="collapsed"] .sidebar-profile { grid-template-columns: 1fr; justify-items: center; gap: 8px; margin: 0 10px 10px; padding: 9px 10px; }
  html[data-sidebar="collapsed"] .profile-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: 10px; }
  html[data-sidebar="collapsed"] .profile-action { width: 30px; height: 30px; }

  /* Hover must not move the target under the pointer: reserve identical row
     heights in the automatic rail and its expanded overlay. Pinned and mobile
     layouts continue using their existing dimensions. */
  html[data-sidebar-mode="auto"] .brand-row { height: 72px; min-height: 72px; flex: 0 0 72px; flex-direction: row; padding: 15px 16px 15px 12px; }
  html[data-sidebar-mode="auto"] :is(.brand-copy, .workspace-copy, .nav-text) { white-space: nowrap; }
  html[data-sidebar-mode="auto"] .sidebar-workspace { height: 48px; min-height: 48px; flex: 0 0 48px; margin: 0 11px 8px; padding: 10px 11px; }
  html[data-sidebar-mode="auto"] .nav-scroll { padding: 6px 10px 18px; overflow-x: hidden; }
  html[data-sidebar-mode="auto"] .nav-label { position: relative; height: 12px; margin: 17px 10px 7px; border-top: 0; font-size: 8px; line-height: 12px; }
  html[data-sidebar-mode="auto"] .nav-label:first-child { margin-top: 8px; }
  html[data-sidebar-mode="auto"] .nav-item { height: 42px; min-height: 42px; padding: 4px 8px; }
  html[data-sidebar-mode="auto"] .nav-icon { width: 32px; height: 32px; }
  html[data-sidebar-mode="auto"] .nav-icon .icon { width: 19px; height: 19px; }
  html[data-sidebar-mode="auto"][data-sidebar="collapsed"] .brand-row { justify-content: center; gap: 0; padding-inline: 16px; }
  html[data-sidebar-mode="auto"][data-sidebar="collapsed"] #sidebarToggle { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
  html[data-sidebar-mode="auto"][data-sidebar="collapsed"] .nav-label { color: transparent; }
  html[data-sidebar-mode="auto"][data-sidebar="collapsed"] .nav-label::before { content: ""; position: absolute; top: 6px; inset-inline: 0; border-top: 1px solid rgba(255, 255, 255, .09); }
}

/* Dark tokens are semantic: photos and attached screenshots keep their colors. */
html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0b1220;
  --surface: #131e30;
  --surface-soft: #18253a;
  --border: #2a3a50;
  --border-strong: #3a4d67;
  --text: #edf2f8;
  --text-soft: #c9d4e4;
  --muted: #a0afc3;
  --muted-light: #91a0b5;
  --brand-700: #afd49f;
  --brand-500: #91bd82;
  --brand-100: #243c2c;
  --brand-50: #1a3027;
  --amber-700: #ecc18a;
  --amber-600: #d49a52;
  --amber-100: #3b3022;
  --amber-50: #2b261f;
  --danger-700: #f2a5ad;
  --danger-100: #3d2631;
  --focus: #9dc0ff;
  --shadow-float: 0 16px 48px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
  border-color: var(--border-strong);
  background-color: #101b2c;
  color: var(--text);
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: var(--muted-light); opacity: 1; }
html[data-theme="dark"] :is(input[readonly], input:disabled, select:disabled, textarea[readonly], textarea:disabled) { border-color: var(--border); background-color: var(--surface-soft); color: var(--muted); }
html[data-theme="dark"] :is(input, select, textarea, button, a, summary):focus-visible { outline-color: var(--focus); }
html[data-theme="dark"] input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px #101b2c inset; caret-color: var(--text); }
html[data-theme="dark"] .login-view { background: var(--canvas); }
html[data-theme="dark"] .login-panel { background: radial-gradient(circle at 100% 0, rgba(99, 139, 83, .08), transparent 45%), var(--canvas); }
html[data-theme="dark"] .login-help-card { background: var(--surface); }
html[data-theme="dark"] .login-divider { color: var(--muted); }
html[data-theme="dark"] .login-field-control > .icon { color: var(--muted); }
html[data-theme="dark"] .login-showcase { border-right: 1px solid var(--border); }

html[data-theme="dark"] :is(.dashboard-open, .account-inline-action, .snapshot-card, .timeline-item, .tiny-icon-button, .row-action, .viewer-nav, .report-period-button.active, .accounts-view-tab.active, .efficiency-score-inner, .client-contact-mail, .client-meta-item, .client-company-chip) { background: var(--surface); }
html[data-theme="dark"] :is(.table-toolbar, .triage-table-toolbar, .team-toolbar, .accounts-toolbar, .settings-actions, .settings-profile-note, .settings-card-footer, .account-rule-note, .security-hint, .viewer-stage) { background: var(--surface-soft); }
html[data-theme="dark"] :is(.snapshot-preview, .viewer-content) { border-color: var(--border); background: #0e1828; }
html[data-theme="dark"] :is(.data-table th, .data-table-wrap, .analysis-table tbody, .client-history-table tbody) { background: var(--surface-soft); }
html[data-theme="dark"] :is(.analysis-table tbody tr, .client-history-table tbody tr) { background: var(--surface); }
html[data-theme="dark"] .data-table tbody tr:hover td { background: #1c2c42; }
html[data-theme="dark"] :is(.company-card-owner, .demand-overview-item, .deadline-item, .triage-step, .setting-row, .role-matrix th, .role-matrix td, .settings-profile-meta > div, .linked-company-item, .client-relationship-row, .active-demand-item, .client-history-table td, .analysis-table td, .trend-item, .access-row, .data-table td, .timeline, .snapshot-preview, .list-company-logo, .company-logo, .client-avatar, .dialog-note, .account-bulk-bar) { border-color: var(--border); }
html[data-theme="dark"] :is(.company-list-card, .client-card, .snapshot-card, .timeline-item):hover { border-color: #5b765f; }
html[data-theme="dark"] :is(.company-progress-track, .owner-load-bar, .triage-category-bar, .team-goal-track, .progress-track, .blocker-track, .art-bar) { background: #2a3b51; }
html[data-theme="dark"] :is(.list-company-logo.navy, .dashboard-kpi-icon.navy, .complaints-summary-icon:not(.green):not(.amber), .triage-step-icon, .team-summary-icon:not(.green):not(.amber), .team-alert-icon.neutral, .account-summary-icon.navy, .client-summary-icon.navy, .client-avatar.navy, .report-kpi-icon.navy, .account-history-icon, .triage-flag.textual) { border-color: var(--border); background: #25344b; color: #bdcfea; }
html[data-theme="dark"] :is(.snapshot-kicker.current, .company-card-status.finished) { color: #b5c9e2; }
html[data-theme="dark"] .company-card-status.paused { color: #c4b9a7; }
html[data-theme="dark"] .row-status.info { background: #243a55; color: #b8d6fb; }
html[data-theme="dark"] .row-status.neutral { background: #2a3547; color: #becbdd; }
html[data-theme="dark"] .client-status.onboarding { background: #243a55; color: #b8d6fb; }
html[data-theme="dark"] .client-status.paused { background: #2a3547; color: #becbdd; }
html[data-theme="dark"] .role-no { color: var(--muted); }
html[data-theme="dark"] .complaint-dropzone { border-color: var(--border-strong); }

html[data-theme="dark"] :is(.company-start-block, .operation-alert:not(.danger), .schedule-cell.warning, .accounts-alert) { border-color: #655035; background: var(--amber-50); }
html[data-theme="dark"] :is(.company-missing-item, .operation-alert-icon, .accounts-alert-icon) { background: var(--amber-100); color: var(--amber-700); }
html[data-theme="dark"] .operation-alert.danger { border-color: #6a3a49; background: var(--danger-100); }
html[data-theme="dark"] .operation-alert.danger .operation-alert-icon { background: #532c3a; color: var(--danger-700); }
html[data-theme="dark"] .delay-notice { border-color: #655035; }
html[data-theme="dark"] .btn-primary { color: #fff; background: #507d45; border-color: #507d45; }
html[data-theme="dark"] .btn-primary:hover { color: #fff; background: #426d39; border-color: #426d39; }
html[data-theme="dark"] :is(.schedule-cell:hover, .row-action:hover) { border-color: #5b765f; }
html[data-theme="dark"] :is(.dashboard-open, .account-inline-action, .row-action):hover { background: var(--brand-50); color: var(--brand-700); }
html[data-theme="dark"] :is(.row-action, .tiny-icon-button).danger:hover { border-color: #8b485b; background: var(--danger-100); color: var(--danger-700); }

/* Report marks stay distinct against navy, including the assessment series. */
html[data-theme="dark"] :is(.production-bar.av, .legend-dot.av) { background: #8ba9cf; }
html[data-theme="dark"] .production-chart-plot { background-image: linear-gradient(to bottom, transparent 24%, var(--border) 25%, transparent 25%, transparent 49%, var(--border) 50%, transparent 50%, transparent 74%, var(--border) 75%, transparent 75%); }
html[data-theme="dark"] .funnel-stage::before { background: #263c31; }
html[data-theme="dark"] .funnel-stage.navy::before { background: #26394f; }
html[data-theme="dark"] .trend-spark i { background: #526b55; }
html[data-theme="dark"] .trend-spark i:last-child { background: #91bd82; }
html[data-theme="dark"] .efficiency-score { background: conic-gradient(var(--brand-600) 0 82%, #2a3b51 82% 100%); }
html[data-theme="dark"] .snapshot-art { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .art-score small { color: var(--muted); }
html[data-theme="dark"] .art-foot { border-color: var(--border); color: var(--muted); }
html[data-theme="dark"] dialog::backdrop { background: rgba(3, 8, 17, .76); }
html[data-theme="dark"] .toast { border: 1px solid #3a4d67; background: #1d2b40; }
html[data-theme="dark"] :is(.nav-label, .workspace-copy span, .profile-copy span, .login-insight span, .login-insight small, .login-showcase-footer, .login-secure) { color: #a0afc3; }
html[data-theme="dark"] { scrollbar-color: #4d607b #111c2d; }
html[data-theme="dark"] ::selection { background: #3c6241; color: #fff; }

@media (max-width: 820px) {
  #sidebarToggle { display: none; }
  .brand-row { padding-right: 0; }
  html[data-theme="dark"] .mobile-bar { background: rgba(19, 30, 48, .94); }
  #loginThemeToggle { top: 22px; right: 20px; }
  .app-theme-toggle { top: 13px; right: 66px; width: 36px; height: 36px; padding: 8px; }
  .app-theme-toggle .appearance-toggle-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .breadcrumb-row { padding-right: 0; }
}

@media (max-width: 560px) {
  #loginThemeToggle { top: 20px; right: 16px; min-height: 34px; }
  #loginThemeToggle .appearance-toggle-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  html[data-theme="dark"] .data-table tbody tr { background: var(--surface); }
  html[data-theme="dark"] .data-table tbody tr:hover td { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .main-shell, .sidebar-toggle, .appearance-theme-toggle { transition: none; }
}

/* Clientes — one visual group per verified company profile. */
.client-company-groups { display: grid; gap: 12px; }
.client-company-group-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.client-company-group-identity .list-company-logo { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 8px; font-size: 9px; }
.client-company-group-identity h2 { overflow-wrap: anywhere; }
.client-company-group .client-detail-card-head .btn { flex: 0 0 auto; }
.client-company-group [data-client-demand-status="active"] td:first-child { color: var(--brand-700); }
.client-demand-date-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 8px; }
.client-group-records { border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.client-group-records summary { padding: 10px 14px; cursor: pointer; font-weight: 650; color: var(--text-soft); }
.client-group-records summary:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.client-group-records ul { display: grid; gap: 8px; margin: 0; padding: 0 14px 12px; list-style: none; }
.client-group-records li { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); }
.client-group-records li span { min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.client-group-records li small { color: var(--muted); }
.client-group-record-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.client-group-customer-records { position: relative; align-self: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.client-group-customer-records summary { white-space: nowrap; }
.client-group-customer-records ul { position: absolute; inset: calc(100% + 6px) 0 auto auto; z-index: 3; width: min(300px, calc(100vw - 48px)); max-height: min(340px, 45dvh); overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
@media (max-width: 560px) {
  .client-company-group .client-detail-card-head { flex-wrap: wrap; }
  .client-group-customer-records summary { padding-inline: 8px; }
}

.client-demand-dialog[open] { display: flex; flex-direction: column; }
.client-demand-dialog .dialog-head, .client-demand-dialog .dialog-actions { flex: none; }
.client-demand-dialog .dialog-head h2 { overflow-wrap: anywhere; }
.client-demand-dialog .dialog-head .field-help { margin: 5px 0 0; }
.client-demand-dialog .dialog-body { min-height: 0; }
.client-demand-dialog .dialog-actions { flex-wrap: wrap; }
.client-demand-dialog .dialog-actions button:disabled { opacity: .55; cursor: not-allowed; }
.client-demand-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.client-demand-totals > div { display: grid; gap: 5px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); }
.client-demand-totals span { color: var(--muted); font-size: 11px; }
.client-demand-totals strong { color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
.client-demand-selection { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; color: var(--text-soft); font-size: 12px; }
.client-demand-selection label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.client-demand-dialog input[type="checkbox"] { margin: 0; width: 17px; height: 17px; accent-color: var(--brand-600); cursor: pointer; }
.client-demand-dialog td { overflow-wrap: anywhere; }
.client-demand-dialog [data-client-demand-retry] { margin-top: 8px; }

#createCompanyDialog [hidden] { display: none; }
.company-demand-picker {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin: 12px 0; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.company-demand-label { display: grid; gap: 5px; min-width: min(100%, 245px); color: var(--text-soft); font-size: 11px; font-weight: 700; }
.company-demand-label select {
  width: 100%; min-height: 34px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px;
}
.client-demand-row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.company-active-cycles { display: grid; gap: 5px; margin: 8px 0 0; padding: 0; list-style: none; }
.company-active-cycles li {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
  padding: 7px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-soft);
}
.company-active-cycle-copy { display: grid; gap: 2px; min-width: 0; color: var(--text-soft); font-size: 10px; }
.company-active-cycle-copy strong { color: var(--text); }
.company-active-cycle-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.company-text-select-all { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.company-text-select-all label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 12px; cursor: pointer; }
:is(.company-text-select-all, .company-text-check) input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-600); cursor: pointer; }
.company-text-delete { color: var(--danger-700); }

/* Empresas — remaining work for the Bahia operational day. */
.company-card-daily { margin: 9px 0; padding: 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.company-card-daily-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; color: var(--text); font-size: 10px; }
.company-card-daily-head time { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.company-card-daily-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.company-card-daily-value { display: grid; gap: 2px; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; font-size: 9px; font-weight: 700; line-height: 1.2; }
.company-card-daily-value strong { font-size: 19px; line-height: 1; font-variant-numeric: tabular-nums; }
.company-card-daily-value[data-card-daily-mode="ra"] { color: var(--amber-700); background: var(--amber-50); border-color: var(--amber-100); }
.company-card-daily-value[data-card-daily-mode="av"] { color: #1e4d82; background: #edf5ff; border-color: #dceafa; }
html[data-theme="dark"] .company-card-daily-value[data-card-daily-mode="av"] { color: #bedbff; background: #243a55; border-color: #365270; }

@media (max-width: 560px) {
  .client-demand-dialog .dialog-body { padding: 12px; }
  .client-demand-totals > div { padding: 8px; }
  .client-demand-dialog .dialog-actions { display: grid; grid-template-columns: 1fr; padding: 8px 12px; }
}

/* Authentication startup and session preference. */
.login-remember-help { margin: -8px 0 16px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.login-submit:disabled, .login-forgot:disabled { opacity: .65; cursor: default; }
.login-restore-retry { display: block; min-height: 32px; margin: 8px auto 0; }
.login-activity { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--text-soft); font-size: 11px; }
.login-activity-spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--brand-700); border-radius: 50%; animation: login-activity-spin .75s linear infinite; }
@keyframes login-activity-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .login-activity-spinner { animation: none; } }

#reportsView .reports-filters { display: grid; gap: 12px; padding: 14px; }
.reports-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-field { display: grid; align-content: start; min-width: 0; gap: 5px; color: var(--text-soft); font-size: 10px; font-weight: 700; }
#reportsView .report-filter { width: 100%; min-width: 0; background: var(--surface); color: var(--text); font-size: 12px; }
#reportsView .report-filter:disabled { opacity: .6; }
.report-custom-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 12px; }
.report-custom-dates[hidden] { display: none; }
.report-filter-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#reportPeriodMeta, .report-filter-message { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.report-filter-message { color: var(--danger-700); }
#reportsView .report-kpi-bottom:empty { display: none; }
#reportsView .report-card-head > .row-status:empty { display: none; }
#reportsView .report-card-head p { line-height: 1.5; }

#reportsView .production-chart-plot {
  --report-chart-height: 138px;
  height: auto;
  min-height: 175px;
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(42px, 1fr);
  align-items: stretch;
  gap: 7px;
  overflow-x: auto;
  background-image: none;
  border-bottom-color: var(--border);
}
#reportsView .production-day { min-width: 0; grid-template-rows: var(--report-chart-height) auto; }
#reportsView .production-bars { position: relative; align-items: end; width: 40px; justify-self: center; }
#reportsView .production-label { white-space: nowrap; }
#reportsView .report-count-bar {
  appearance: none;
  position: absolute;
  bottom: 0;
  left: 9px;
  width: var(--report-chart-height);
  height: 11px;
  min-height: 0;
  transform: translateY(5.5px) rotate(-90deg);
  transform-origin: left center;
  background: transparent;
  border: 0;
  color: var(--brand-600);
}
#reportsView .report-count-bar.av { left: 25px; color: var(--navy-700); }
#reportsView .report-count-bar::-webkit-progress-bar { background: transparent; }
#reportsView .report-count-bar::-webkit-progress-value { background: currentColor; border-radius: 0 4px 4px 0; }
#reportsView .report-count-bar::-moz-progress-bar { background: currentColor; border-radius: 0 4px 4px 0; }
#reportsView .report-bar-zero { visibility: hidden; }
html[data-theme="dark"] #reportsView .report-count-bar.av { color: #91baf0; }

#reportsView .funnel-stage::before { display: none; }
#reportsView .report-proportion { display: block; width: 100%; height: 6px; margin-top: 6px; accent-color: var(--brand-600); }
#reportsView .efficiency-score { background: var(--surface-soft); border: 1px solid var(--border); }
#reportsView .trend-item { grid-template-columns: minmax(0, 1fr) auto; }
.report-demand-links { display: flex; flex-wrap: wrap; gap: 5px 7px; margin-top: 4px; }
.report-demand-links button { min-height: 25px; }

@media (max-width: 860px) {
  .reports-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .reports-filter-grid { grid-template-columns: minmax(0, 1fr); }
  .report-filter-footer { align-items: stretch; flex-direction: column; }
  #reportsView .reports-filters { padding: 10px; }
}
