html[data-theme="light"] {
  /* Match the central plus, without changing the separate danger tokens. */
  --emerald-gradient: linear-gradient(180deg, #36dfad 0%, #12b98b 35%, #0b8060 70%, #064d3c 100%);
  --emerald-tint: linear-gradient(180deg, rgb(54 223 173 / .15) 0%, rgb(18 185 139 / .15) 35%, rgb(11 128 96 / .15) 70%, rgb(6 77 60 / .15) 100%);
  --emerald-button-two: linear-gradient(145deg, rgb(11 106 80 / .88), rgb(6 77 60 / .90));
  --creation-button-fill: var(--emerald-gradient);
  --creation-button-shadow: 0 8px 20px rgba(22, 136, 98, .2);
  --brand-action-fill: linear-gradient(145deg, #32ad7e 0%, #137b59 100%);
  --brand-action-shadow: 0 12px 28px rgba(22, 136, 98, .28);
  --creation-button-focus: #168862;
  color-scheme: light;
  --surface-raised: #ffffff;
  --surface-subtle: #f2f8f4;
  --surface-accent: #e4f3eb;
  --surface-switch-off: #ccd8d2;
  --surface-scrim: rgba(45, 65, 56, .32);
  --surface-shadow: 0 10px 24px rgba(30, 78, 61, .08);
}

html[data-theme="light"] .ios-reference-event-form .calendar-event-form-head {
  background: linear-gradient(180deg, #f4faf7, #eff7f2);
  box-shadow: 0 8px 14px rgba(30, 78, 61, .06);
}

html[data-theme="light"] .ios-reference-event-form .calendar-event-form-head button {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--accent);
}

html[data-theme="light"] .ios-reference-event-form .calendar-event-form-head button:last-child {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(22, 136, 98, .18);
}

html[data-theme="light"] .calendar-event-backdrop,
html[data-theme="light"] .calendar-event-discard-backdrop {
  background: var(--surface-scrim);
}

html[data-theme="light"] .calendar-event-discard-sheet {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--surface-shadow);
}

html[data-theme="light"] .case-discussion-preview,
html[data-theme="light"] .case-discussion-state,
html[data-theme="light"] .case-recommendation-preview {
  background: linear-gradient(145deg, var(--surface-raised), var(--surface-subtle));
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--surface-shadow);
}

html[data-theme="light"] .case-discussion-orb,
html[data-theme="light"] .case-recommendation-orb {
  background: var(--surface-accent);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--line);
}

html[data-theme="light"] .case-discussion-preview time,
html[data-theme="light"] .case-recommendation-priority {
  color: var(--muted);
}

html[data-theme="light"] .toggle-row input:not(:checked) + span,
html[data-theme="light"] .notification-setting-row input:not(:checked) + span,
html[data-theme="light"] .case-attention-switch input:not(:checked) + span,
html[data-theme="light"] .home-layout-row input:not(:checked) + i {
  background: var(--surface-switch-off);
}

html[data-theme="light"] .assistant-avatar {
  background: var(--surface-accent);
  color: var(--accent) !important;
}

/* Entry medallions and reply avatars share the traced brain silhouette,
   masking the baked-in perimeter outside it. */
html[data-theme="light"] body.case-route #app .assistant-fab.case-brain-fab,
html[data-theme="light"] body #app .chat-intro > span.assistant-intro-brain {
  background: #fff !important;
  border: 1.5px solid #168862 !important;
  color: #12694e !important;
  box-shadow: 0 0 0 3px rgba(22,136,98,.10), 0 8px 22px rgba(22,136,98,.20), 0 0 20px rgba(38,198,145,.28) !important;
  animation: assistant-emerald-halo 2.8s ease-in-out infinite;
}
html[data-theme="light"] body .case-brain-fab-orb {
  background: #fff;
}
body.case-route #app .case-brain-fab-orb video,
html body :is(.case-brain-fab-orb, .assistant-intro-brain) video,
html body :is(#app, #desktopAssistantPanel) .assistant-avatar.assistant-brain :is(img, video) {
  /* Outer boundary traced from the 240×240 poster, not a surrounding oval.
     Retain the brain's interior shadows; no filter/recolour of the video. */
  --brain-silhouette: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20240%20240%27%3E%3Cpath%20fill%3D%27white%27%20d%3D%27M100%2022%20L111%2022%20L112%2024%20L114%2024%20L116%2026%20L117%2031%20L119%2033%20L119%2047%20L120%2047%20L120%2044%20L123%2044%20L122%2035%20L123%2035%20L123%2032%20L124%2032%20L124%2028%20L131%2022%20L141%2022%20L141%2023%20L147%2024%20L149%2026%20L154%2027%20L158%2031%20L162%2032%20L163%2034%20L165%2034%20L166%2037%20L170%2041%20L172%2041%20L175%2044%20L176%2048%20L181%2052%20L182%2056%20L186%2060%20L187%2064%20L189%2065%20L190%2073%20L196%2077%20L196%2079%20L197%2079%20L199%2085%20L200%2085%20L200%2089%20L201%2089%20L200%20101%20L204%20104%20L205%20109%20L206%20109%20L206%20116%20L207%20116%20L207%20122%20L208%20122%20L208%20128%20L209%20128%20L210%20142%20L209%20142%20L208%20154%20L206%20156%20L205%20162%20L204%20162%20L202%20168%20L200%20169%20L200%20171%20L195%20176%20L187%20179%20L187%20183%20L184%20186%20L184%20188%20L182%20188%20L181%20191%20L179%20191%20L177%20194%20L174%20195%20L174%20198%20L172%20199%20L172%20201%20L168%20205%20L166%20205%20L163%20209%20L159%20210%20L157%20213%20L155%20213%20L153%20215%20L150%20215%20L150%20216%20L147%20216%20L147%20217%20L144%20217%20L144%20218%20L132%20218%20L132%20217%20L128%20216%20L125%20213%20L124%20209%20L121%20208%20L121%20206%20L118%20207%20L119%20210%20L116%20212%20L116%20215%20L114%20215%20L110%20218%20L105%20218%20L105%20219%20L97%20218%20L95%20216%20L92%20216%20L92%20215%20L89%20215%20L89%20214%20L86%20214%20L86%20213%20L82%20212%20L75%20205%20L73%20205%20L71%20203%20L71%20201%20L68%20199%20L68%20197%20L66%20196%20L65%20193%20L63%20193%20L61%20190%20L58%20189%20L58%20187%20L56%20186%20L53%20178%20L49%20178%20L45%20174%20L43%20174%20L43%20172%20L40%20170%20L40%20168%20L38%20167%20L38%20165%20L36%20163%20L36%20159%20L35%20159%20L34%20153%20L33%20153%20L33%20145%20L32%20145%20L32%20128%20L33%20128%20L33%20123%20L34%20123%20L33%20119%20L35%20119%20L35%20116%20L34%20116%20L35%20109%20L36%20109%20L38%20103%20L40%20103%20L40%20101%20L41%20101%20L41%2098%20L40%2098%20L41%2082%20L48%2076%20L49%2072%20L52%2070%20L52%2066%20L53%2066%20L53%2063%20L54%2063%20L55%2059%20L58%2058%20L59%2054%20L64%2050%20L66%2045%20L71%2040%20L73%2040%20L74%2037%20L78%2033%20L80%2033%20L84%2029%20L86%2029%20L90%2026%20L93%2026%20L97%2023%20L100%2023%20L100%2022%20Z%27%2F%3E%3C%2Fsvg%3E");
  -webkit-mask-image: var(--brain-silhouette);
  mask-image: var(--brain-silhouette);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
@keyframes assistant-emerald-halo {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(38,198,145,.08)); }
  50% { filter: drop-shadow(0 0 7px rgba(38,198,145,.32)); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="light"] body.case-route #app .assistant-fab.case-brain-fab,
  html[data-theme="light"] body #app .chat-intro > span.assistant-intro-brain { animation: none; }
}

html[data-theme="light"] .assistant-new-chat,
html[data-theme="light"] .case-discussion-preview > b,
html[data-theme="light"] .case-discussion-state > b,
html[data-theme="light"] .document-action:not(.retry):not(.quiet),
html[data-theme="light"] .assistant-attachment > span {
  color: var(--accent);
}

html[data-theme="light"] .avatar,
html[data-theme="light"] .profile-avatar,
html[data-theme="light"] .chat-intro > span {
  color: #fff;
}

html[data-theme="light"] .ui-button.danger {
  color: #ae3042;
}

html[data-theme="light"] .camera-preview,
html[data-theme="light"] .urgent-date,
html[data-theme="light"] .calendar-tag-row,
html[data-theme="light"] .assistant-attachment {
  background: var(--surface-subtle);
  color: var(--text);
}

html[data-theme="light"] .discussion-summary > span,
html[data-theme="light"] .history-item time,
html[data-theme="light"] .profile-choice-list button.active,
html[data-theme="light"] .material-job-steps li.current span,
html[data-theme="light"] .document-text-head button,
html[data-theme="light"] .document-action.text,
html[data-theme="light"] .document-index-action.resume,
html[data-theme="light"] .auth-data-note {
  color: var(--accent, #168862);
}

html[data-theme="light"] .auth-message,
html[data-theme="light"] .profile-confirm-logout,
html[data-theme="light"] .document-index-action,
html[data-theme="light"] .rag-index-progress.failed > span {
  color: #ae3042;
}

html[data-theme="light"] .document-action.retry,
html[data-theme="light"] .audio-warning {
  color: #865c13;
}

html[data-theme="light"] .audio-turn textarea {
  border-color: var(--line);
}

html[data-theme="light"] svg.ui-icon {
  background: none;
  color: inherit;
}

/* Ordinary action paint only. No geometry, global accent or danger-token changes.
   Secondary cancel/reset/close controls are deliberately not selected. */
html[data-theme="light"] body :is(
  .primary, .assistant-fab, .send-question, .home-attach, .case-action.pin,
  .calendar .days button.today, .calendar-week-strip button.today
):not(:is(.danger, .profile-confirm-logout, .upload-cancel, .file-upload-cancel,
  [data-audio-cancel], [data-split-cancel], [data-close-sheet],
  [data-duty-reset], [data-article395-reset], [data-reset-interface-hints],
  [data-assistant-stop], [data-bulk-stop], [data-clear-completed-uploads])) {
  background: var(--creation-button-fill) !important;
  color: #fff !important;
  box-shadow: var(--creation-button-shadow) !important;
}

html[data-theme="light"] body :is(
  .document-action:not(.retry):not(.quiet), .system-notification-card button,
  .urgent-panel button, .notification-actions button, .calendar-voice-examples button,
  .calendar-search-result > button, .profile-choice-list button.active,
  .calendar-view-popover button.active, .calendar-year-grid button.active,
  .scanner-filters button.active
):not(.danger):not(.delete):not(.document-delete-action):not([data-delete-notification]):not([data-system-notifications="disconnect"]) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
  color: var(--accent);
}

html[data-theme="light"] body :is(
  .section-title button, .head-text-action, .upload-history-title button,
  .case-type-current button, .calendar-picker-display, .scanner-page-actions button
):not(.danger):not(.delete):not([data-scanner-delete-page]):not([data-clear-completed-uploads]):not([data-duty-reset]):not([data-article395-reset]) {
  color: var(--accent);
}
html[data-theme="light"] .sheet > button:not(.danger):not([data-storage-erase]):not([data-request-logout]) > span,
html[data-theme="light"] .upload-case-dropdown button > span {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
}
html[data-theme="light"] body :is(.primary, .home-attach, .case-material-trigger, .assistant-fab, .send-question):not(.danger):focus-visible {
  outline-color: var(--accent);
}

/* Light counterpart of the IQ palette. Paint only, with explicit critical
   exclusions; neutral surfaces and semantic red/yellow signals stay local. */
html[data-theme="light"] body :is(#app, #sheetRoot, .tabbar) :is(
  #addMain, .home-attach, .send-question, .chat-send, .assistant-send,
  .case-edit-save, .case-brain-fab, .audio-hero button, .calendar-ai-followup button,
  .avatar, .profile-avatar:not(:has(img)), .auth-brand > span, .about-app-card > span,
  .ios-reference-event-form .calendar-event-form-head button:last-child,
  .chips .filter-token.active, .document-filter-chips .chip.active,
  .case-tabs button.active, .case-section-option.active,
  .timeline-switch button[aria-selected="true"], .timeline-filters button.active,
  .calendar-view-popover button.active, .calendar-year-grid button.active,
  .calendar .days button.today, .calendar-week-strip button.today,
  .text-size-options button.active, .profile-choice-list button.active,
  .upload-case-dropdown button.active, .auth-tabs button.active, .scanner-filters button.active,
  .notification-setting-row input:checked + span, .toggle-row input:checked + span
) {
  background-image: var(--emerald-gradient) !important;
  color: #fff !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot) :is(
  .chips .filter-token:not(.active), .document-filter-chips .chip:not(.active),
  .case-tabs button:not(.active), .case-section-option:not(.active),
  .timeline-switch button:not([aria-selected="true"]), .timeline-filters button:not(.active),
  .calendar-view-popover button:not(.active), .calendar-year-grid button:not(.active),
  .text-size-options button:not(.active), .profile-choice-list button:not(.active),
  .calendar-ai-case-choices button, .assistant-followups button, .audit-source,
  .answer-page-link, .summary-edit, .chips .chip.filter-add,
  .document-action:not(.retry):not(.quiet):not(.document-delete-action),
  .system-notification-card button:not([data-system-notifications="disconnect"])
):not(.danger):not(.delete) {
  background-image: var(--emerald-tint) !important;
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}
/* Filter labels inherit selected contrast from their existing parent token. */
html[data-theme="light"] body .chips .filter-token > button[data-filter] {
  background: transparent;
  color: inherit;
}
html[data-theme="light"] body :is(#app, #sheetRoot) :is(
  .quick i, .camera-symbol, .upload-zone > span,
  .profile-tool-icon, .preference-row > span,
  .storage-type:not(.photo):not(.audio), .storage-row div > i, .note-case-result > span,
  .profile-photo-pick, .case-type-option > span, .case-type-current > span,
  .document-case-option > span, .upload-case-current > span,
  .upload-case-dropdown button > span, .case-sections-head > span,
  .unified-case-result > span, .search-result-icon, .rich-empty > span,
  .upload-job-head > span, .case-sections-arrow, .analysis-icon:not(.alert),
  .new-case-choice .new-case-avatar, .case-discussion-orb,
  .profile-unified-icon:not(.profile-unified-delete), .assistant-attachment > span,
  .scanner-recovery > span, .first-case-steps b, .document-builder-brain,
  .document-builder-ready > span, .case-preview-avatar:not(.has-type-art),
  .sheet > button:not(.danger):not([data-storage-erase]):not([data-request-logout]) > span
):not([data-reset-interface-hints] *):not([data-storage-erase] *) {
  background-image: var(--emerald-gradient) !important;
  color: #fff !important;
}
html[data-theme="light"] body #app :is(.profile-unified-icon:not(.profile-unified-delete), .analysis-icon:not(.alert),
  .case-type-option > span, .document-case-option > span, .upload-zone > span, .rich-empty > span):not([data-reset-interface-hints] *):not([data-storage-erase] *) svg {
  stroke: #fff !important;
}

/* Home-only raster artwork matches the existing volumetric tool illustrations.
   The badge counts unread notifications, not processing jobs. */
html body #app .home-header .bell { overflow: visible; }
html body #app .home-header .bell .home-bell-art {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  pointer-events: none;
  filter: none !important;
}
html body #app .home-header .bell > .badge {
  position: absolute;
  z-index: 2;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 1.5px solid var(--bg);
  border-radius: 999px;
  background: #e52d38 !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-shadow: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  animation: none !important;
  pointer-events: none;
}

/* Upload Center actions share geometry; retain each action's semantic paint.
   In particular, the global compact danger-button rule must not shrink Stop. */
html body #app .material-job-actions > button.ui-button,
html body #app .material-job-actions > button:is(.button-variant-1, .button-variant-2) {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  height: 100%;
  margin: 0;
  padding: 10px 16px;
  font-size: calc(13px * var(--ui-font-scale,1)) !important;
  font-weight: 750;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
html[data-theme="light"] body #app .profile-unified-icon:not(.profile-unified-delete):not([data-reset-interface-hints] *):not([data-storage-erase] *) {
  border-color: transparent;
  background-origin: border-box;
  background-repeat: no-repeat;
  box-shadow: none;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .tabbar) :is(
  .tab.active, .home-ai-spark, .doc-icon, .analysis-card > span,
  .notice > span, .menu-row:not([data-storage-erase]):not([data-reset-interface-hints]) > span, .case-card-pin-mark, .app-icon-option b
) svg.ui-icon { stroke: url(#iq-emerald-paint); }
html[data-theme="light"] body :is(#app, #sheetRoot) :is(.ui-icon-button, .summary-edit):not(.primary):not(.danger):not(.cases-add-button):not(.case-material-trigger) > svg.ui-icon { stroke: url(#iq-emerald-paint); }
html[data-theme="light"] body .tabbar .tab.active small {
  background-image: var(--emerald-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation and reset controls use the central plus's theme-specific paint.
   Their existing actions and placement stay unchanged. */
html[data-theme="light"] body :is(#app, .document-viewer-layer, .document-text-layer) :is(button[data-back], .scanner-head button[data-scanner-back], .state-duty-reset, .document-viewer-close.button-variant-2, [data-close-document-text]) {
  background-color: transparent !important;
  background-image: var(--brand-action-fill) !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  border-color: transparent !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: var(--brand-action-shadow) !important;
}
html[data-theme="light"] body :is(#app, .document-viewer-layer, .document-text-layer) :is(button[data-back], .scanner-head button[data-scanner-back], [data-close-document-text]) svg.ui-icon {
  color: #fff !important;
  stroke: #fff !important;
  fill: none !important;
}
html[data-theme="light"] body #app .state-duty-reset {
  border-radius: 14px;
}
@media (forced-colors: active) {
  html[data-theme="light"] body .tabbar .tab.active small { -webkit-text-fill-color: currentColor; }
  html[data-theme="light"] body svg.ui-icon { stroke: currentColor !important; }
}

/* Use the supplied green JPGs unchanged; blend their white background into
   the light card without a recoloring filter. */
html[data-theme="light"] body.home-route #app :is(.plan-home-card, .scanner-home-card) .home-card-art.art-light {
  mix-blend-mode: multiply;
}

/* Calendar event form polish: preserve the shared card surfaces while removing
   nested control chrome that made the schedule feel like a card inside a card. */
html body #app .calendar-add-event {
  /* The shared creation-action selector includes form IDs and otherwise wins. */
  display: flex !important;
  width: fit-content;
  max-width: calc(100% - 8px);
  margin-right: auto !important;
  margin-left: auto !important;
  padding-right: 20px;
  padding-left: 20px;
  box-sizing: border-box;
}
html body #app .calendar-add-event > strong {
  min-width: 0;
  flex: 0 1 auto;
  text-align: left;
}

#sheetRoot .ios-reference-event-form .calendar-event-form-head {
  background: transparent;
  box-shadow: none;
}
.ios-reference-event-form .calendar-event-form-head button:first-child {
  border-radius: 14px;
}

#calendarEventForm .calendar-schedule-card .calendar-form-row,
#calendarEventForm .calendar-reminders-card > .calendar-form-row {
  background: transparent;
  box-shadow: none;
}
#calendarEventForm .calendar-schedule-card .calendar-picker-display {
  min-width: 0;
  padding-right: 0;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}
#calendarEventForm .calendar-schedule-card,
#calendarEventForm .calendar-reminders-card,
#calendarEventForm .calendar-case-row {
  color: var(--text);
}
#calendarEventForm .calendar-reminders-card {
  overflow: hidden;
  border-radius: 24px;
}
#calendarEventForm .calendar-reminders-card .calendar-second-reminder-row {
  border-top: 0;
}
.calendar-tag-swatch {
  background-image: none;
  background-clip: border-box;
  background-origin: border-box;
  background-repeat: no-repeat;
}

/* Shared destructive paint contract. The legacy screens have competing theme
   and high-specificity rules; important is limited to paint/state, never layout,
   fonts or event handlers. Red error/status/recording styles are not selected. */
html body button:is(
  .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
  .case-action.delete, .task-delete-action, .calendar-event-delete-action,
  .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
):not(.link-button) {
  background: var(--danger-bg) !important;
  color: var(--danger-text) !important;
  border-color: var(--danger-border) !important;
  box-shadow: var(--danger-shadow) !important;
  transition: background-color 140ms ease, box-shadow 140ms ease, scale 140ms ease;
}

@media (hover: hover) {
  html body button:is(
    .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
    .case-action.delete, .task-delete-action, .calendar-event-delete-action,
    .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
  ):not(.link-button):not(:disabled):hover {
    background: var(--danger-bg-hover) !important;
  }
}

html body button:is(
  .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
  .case-action.delete, .task-delete-action, .calendar-event-delete-action,
  .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
):not(.link-button):not(:disabled):active {
  background: var(--danger-bg-active) !important;
  scale: .98;
}

html body button:is(
  .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
  .case-action.delete, .task-delete-action, .calendar-event-delete-action,
  .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
):not(.link-button):disabled {
  opacity: .5 !important;
  box-shadow: none !important;
  transition: none;
}

/* Critical action geometry. Compact and centered, while swipe-menu hit
   areas retain their full action-cell width. */
html body button:is(
  .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
  .case-action.delete, .task-delete-action, .calendar-event-delete-action,
  .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
):not(.link-button) {
  box-sizing: border-box;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
}

html body button:is(.danger, .profile-confirm-logout, .case-edit-delete):not(.link-button),
html body button.profile-logout {
  display: flex;
  width: fit-content !important;
  min-width: 112px;
  max-width: 100%;
  padding-inline: 20px;
  margin-inline: auto;
}

/* Keep critical confirmation actions on the same centered vertical axis. */
html body :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions:has(button.danger)
) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) !important;
  justify-items: center;
}

html body :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions:has(button.danger)
) button.secondary {
  box-sizing: border-box;
  display: flex;
  width: fit-content !important;
  min-width: 112px;
  max-width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  padding-inline: 20px;
  text-align: center;
}

html body button:is(
  .case-action.delete, .task-delete-action, .calendar-event-delete-action,
  .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
):not(.link-button) {
  width: 100%;
  min-width: 0;
  padding-inline: 8px;
}

html body button:is(
  [data-close-calendar-ai-preview], [data-close-calendar-case-matches],
  [data-close-case-category-picker],
  [data-close-notification-detail],
  [data-close-profile-sheet], [data-close-sheet]
):not([aria-label]):not(.profile-cancel-logout) {
  box-sizing: border-box;
  width: fit-content !important;
  min-width: 112px;
  max-width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline: auto;
  padding-inline: 20px;
  text-align: center;
}

/* Header actions keep their established grid/flex cell geometry. */
html body button:is([data-close-calendar-event], [data-close-calendar-search], [data-close-date-wheel], [data-close-task-editor]) {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

html body .jurisdiction-choice-sheet > button[data-close-profile-sheet] {
  margin-top: 22px;
}

/* .case-delete-actions also occurs in ordinary editing forms: only real
   danger confirmation groups (with a danger button) get outline cancellation. */
html body :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions:has(button.danger)
) button.secondary {
  background: transparent !important;
  color: var(--danger-outline-text) !important;
  border-color: var(--danger-outline-border) !important;
  box-shadow: none !important;
  transition: background-color 140ms ease, scale 140ms ease;
}

html body :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions:has(button.danger)
) button.secondary:not(:disabled):active {
  background: var(--danger-outline-hover) !important;
  scale: .98;
}

@media (prefers-reduced-motion: reduce) {
  html body button:is(
    .danger, .profile-logout, .profile-confirm-logout, .case-edit-delete,
    .case-action.delete, .task-delete-action, .calendar-event-delete-action,
    .document-delete-action, .upload-history-delete, .upload-cancel, .file-upload-cancel
  ):not(.link-button) { transition: none; }
}


/* Button 2: a translucent accent fill with a clear outline. Existing .secondary
   controls already represent this variant; semantic close/back/reset actions
   reuse it without changing their event handlers or layout. */
html body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .button-variant-2:not(.danger),
  .secondary:not(.danger),
  [data-back],
  [data-scanner-back]:not(.button-variant-3),
  [data-close-calendar-search],
  [data-close-calendar-ai-preview],
  [data-close-calendar-event],
  [data-close-date-wheel],
  [data-close-case-category-picker],
  [data-close-task-editor],
  [data-close-notification-detail],
  [data-close-document-text],
  [data-close-document-viewer]:not(.button-variant-3),
  [data-close-pdf-preview],
  [data-close-profile-sheet],
  [data-close-sheet],
  [data-close-calendar-case-matches],
  [data-calendar-voice-cancel],
  [data-onboarding-back],
  [data-doc-edit-cancel],
  [data-cancel-storage-erase],
  [data-delete-filter-cancel],
  [data-cancel-stage-change],
  [data-cancel-document-delete],
  [data-cancel-calendar-event-discard],
  [data-cancel-calendar-event-delete],
  [data-cancel-case-delete],
  [data-cancel-home-card-delete],
  [data-split-cancel],
  [data-audio-cancel],
  [data-file-upload-cancel],
  [data-bulk-sheet-x],
  [data-collapse-upload-job],
  [data-duty-reset],
  [data-article395-reset],
  [data-confirm-calendar-event-discard],
  [data-timeline-revert],
  [aria-label="Закрыть"],
  [aria-label^="Закрыть "]:not(.button-variant-3),
  [aria-label="Назад"],
  [aria-label^="Вернуться"]
) {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

/* Profile's logout confirmation used to turn its cancel button into a red
   danger outline. It is a cancel action, so it uses the agreed Button 2 style. */
html body #sheetRoot .profile-logout-actions button.profile-cancel-logout {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  box-shadow: none !important;
}

html body .document-viewer-layer button.document-viewer-close.button-variant-2 {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

/* The IQ theme paints back arrows as solid primary buttons with higher
   specificity. Match those exact selectors here so Button 2 wins in both
   themes, including the icon stroke and the subtle full outline. */
html:not([data-theme="light"]) body #app button.icon-btn[data-back][aria-label],
html[data-theme="light"] body #app button.icon-btn[data-back][aria-label],
html:not([data-theme="light"]) body #app .scanner-head button[data-scanner-back][aria-label],
html[data-theme="light"] body #app .scanner-head button[data-scanner-back][aria-label],
html:not([data-theme="light"]) body :is(#app, .document-viewer-layer, .document-text-layer) :is(button.icon-btn[data-back][aria-label], .scanner-head button[data-scanner-back][aria-label], .state-duty-reset[data-duty-reset], .state-duty-reset[data-article395-reset], .document-viewer-close.button-variant-2, [data-close-document-text]),
html[data-theme="light"] body :is(#app, .document-viewer-layer, .document-text-layer) :is(button.icon-btn[data-back][aria-label], .scanner-head button[data-scanner-back][aria-label], .state-duty-reset[data-duty-reset], .state-duty-reset[data-article395-reset], .document-viewer-close.button-variant-2, [data-close-document-text]) {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: none !important;
}

html:not([data-theme="light"]) body #app button.icon-btn[data-back][aria-label] svg.ui-icon,
html[data-theme="light"] body #app button.icon-btn[data-back][aria-label] svg.ui-icon,
html:not([data-theme="light"]) body #app .scanner-head button[data-scanner-back][aria-label] svg.ui-icon,
html[data-theme="light"] body #app .scanner-head button[data-scanner-back][aria-label] svg.ui-icon,
html:not([data-theme="light"]) body :is(#app, .document-viewer-layer, .document-text-layer) :is(button.icon-btn[data-back][aria-label], .scanner-head button[data-scanner-back][aria-label], .document-viewer-close.button-variant-2, [data-close-document-text]) svg.ui-icon,
html[data-theme="light"] body :is(#app, .document-viewer-layer, .document-text-layer) :is(button.icon-btn[data-back][aria-label], .scanner-head button[data-scanner-back][aria-label], .document-viewer-close.button-variant-2, [data-close-document-text]) svg.ui-icon {
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  stroke: currentColor !important;
  fill: none !important;
}

/* PDF viewer Button 3 is a plain theme-colored text action; Button 2 above
   remains the translucent back control while viewing a focused page. */
html body .document-viewer-layer button.document-viewer-close.button-variant-3 {
  width:auto !important;
  min-width:48px !important;
  padding:0 !important;
  border:0 !important;
  border-radius:0 !important;
  background:transparent !important;
  background-image:none !important;
  color:var(--accent) !important;
  -webkit-text-fill-color:currentColor !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
  font-size:calc(14px * var(--ui-font-scale, 1));
  font-weight:700;
  text-decoration:none;
}
html body .document-viewer-layer button.document-viewer-close.button-variant-3:focus-visible {
  outline:2px solid var(--accent);
  outline-offset:3px;
}

html body #sheetRoot :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions:has(button.danger)
) button.secondary:not(.danger) {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: color-mix(in srgb, var(--accent) 78%, var(--text, #fff)) !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: none !important;
}

/* Button 3: popup actions share the event-form spacing and remain text-only
   over component-specific and theme-specific button paint. */
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head).popup-action-header-three {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  column-gap: 8px !important;
  box-sizing: border-box !important;
}

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head).popup-action-header-three > .popup-action-header-title {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: center !important;
  min-width: 0 !important;
  width: min(100%, calc(100vw - 176px)) !important;
  max-width: calc(100vw - 176px) !important;
  overflow-wrap: anywhere !important;
  text-align: center !important;
}

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  appearance: none !important;
  border: 0 !important;
  border-image: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  box-shadow: none !important;
  color: #0b8060 !important;
  -webkit-text-fill-color: currentColor !important;
  font-family: inherit !important;
  font-size: calc(15px * var(--ui-font-scale, 1)) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: none !important;
}

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) :is(button.popup-action-button-three-left, .popup-action-slot-left) { grid-column: 1 !important; justify-self: start !important; }
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) :is(button.popup-action-button-three-right, .popup-action-slot-right) { grid-column: 3 !important; justify-self: end !important; }
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) :is(button.popup-action-button-three-middle, .popup-action-slot-middle) { grid-column: 2 !important; justify-self: center !important; }
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) .popup-action-actions-wrapper { display: contents !important; }

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three:is(:hover, :active, :focus) {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three:focus-visible {
  outline: 2px solid #0b8060 !important;
  outline-offset: 3px !important;
  border-radius: 3px !important;
}

html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three:disabled { opacity: .55 !important; }

html:not([data-theme="light"]) body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three { color: #75dfb8 !important; }

/* Live camera's «Cancel» is Button 3 outside a popup; keep native-camera
   placement, a 44px touch target, and the shared per-theme text treatment. */
html body #app .scanner-live-toolbar button.button-variant-3[data-scanner-back] {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 4px 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #0b8060 !important;
  font-size: calc(15px * var(--ui-font-scale, 1)) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  transition: none !important;
}
html:not([data-theme="light"]) body #app .scanner-live-toolbar button.button-variant-3[data-scanner-back] { color: #75dfb8 !important; }
html body #app .scanner-live-toolbar button.button-variant-3[data-scanner-back]:focus-visible {
  outline: 2px solid currentColor !important;
  outline-offset: 2px !important;
  border-radius: 3px !important;
}

/* Recovery actions are compact siblings with the shared Button 1/2 type scale.
   Delete remains red, but uses Button 2's outline surface rather than the
   filled Button 1 danger treatment. */
html body #app .scanner-recovery button.scanner-recovery-action {
  box-sizing: border-box !important;
  display: block !important;
  width: fit-content !important;
  min-width: 112px !important;
  max-width: 100% !important;
  min-height: 49px !important;
  padding: 10px 20px !important;
  border-radius: 12px !important;
  text-align: center !important;
  font-size: var(--text-md) !important;
  font-weight: var(--weight-semibold) !important;
  line-height: var(--leading-tight) !important;
  margin: 9px auto 0 !important;
}
html body #app .scanner-recovery button.scanner-recovery-delete.secondary {
  background: rgba(255, 92, 108, .08) !important;
  background-color: rgba(255, 92, 108, .08) !important;
  background-image: none !important;
  color: #ff8793 !important;
  -webkit-text-fill-color: currentColor !important;
  border: 1px solid rgba(255, 92, 108, .3) !important;
  box-shadow: none !important;
}
html[data-theme="light"] body #app .scanner-recovery button.scanner-recovery-delete.secondary {
  color: #bd3044 !important;
  border-color: rgba(189, 48, 68, .32) !important;
  background: rgba(189, 48, 68, .045) !important;
  background-color: rgba(189, 48, 68, .045) !important;
}
html body #app .scanner-recovery button.scanner-recovery-delete.secondary:not(:disabled):active {
  background: rgba(255, 92, 108, .16) !important;
  background-color: rgba(255, 92, 108, .16) !important;
  scale: .98;
}
html body #app .scanner-recovery button.scanner-recovery-action:focus-visible {
  outline: 2px solid currentColor !important;
  outline-offset: 3px !important;
}

/* Permission errors live inside a grid overlay; unlike recovery choices, the
   grid's default stretch must not turn the single retry action into a banner. */
html body #app .scanner-camera-state button.scanner-permission-retry {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  width: fit-content !important;
  min-width: 112px !important;
  max-width: 100% !important;
  min-height: 49px !important;
  margin: 9px auto 0 !important;
  padding: 10px 20px !important;
  border-radius: 12px !important;
  text-align: center !important;
  font-size: var(--text-md) !important;
  font-weight: var(--weight-semibold) !important;
  line-height: var(--leading-tight) !important;
}
html body #app .scanner-camera-state button.scanner-permission-retry:focus-visible {
  outline: 2px solid currentColor !important;
  outline-offset: 3px !important;
}

/* The older IQ palette includes a high-specificity gradient for the calendar
   submit control. This final action contract wins over that selector as well. */
html:not([data-theme="light"]) body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head).popup-action-header-three button.popup-action-button-three:not(.ui-button):not(.article395-submit) {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}
html:not([data-theme="light"]) body #sheetRoot .ios-reference-event-form .calendar-event-form-head button.popup-action-button-three {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}
html:not([data-theme="light"]) body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(header, .calendar-event-form-head, .bulk-sheet-head) button.popup-action-button-three:focus-visible { outline-color: #75dfb8 !important; }

/* Filled status/action pills must not use the same violet as their tinted
   surface for text. Keep the existing status fills and switch only the text
   paint to white in dark mode; light-mode emerald labels remain dark-on-pale. */
@media (forced-colors: none) {
  html:not([data-theme="light"]) body :is(#app, #sheetRoot) :is(
    .case-analysis-confidence:not(.low), .workflow-badge,
    .notification-actions button, .system-notification-card:not(.connected) button,
    .notification-detail-case, .pdf-page-badge,
    .document-action:not(.retry):not(.quiet):not(.edit),
    .summary-edit, .chips .chip.filter-add
  ) {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }
}

/* Creation is a compact centered action; the edit-save action keeps a complete
   theme gradient instead of a partially painted light surface. */
html[data-theme="light"] body #app button.case-create-submit {
  width:fit-content !important;
  max-width:100% !important;
  min-height:44px !important;
  padding:10px 20px !important;
  margin-inline:auto !important;
  background-color:var(--accent) !important;
  background-image:var(--emerald-gradient) !important;
  background-repeat:no-repeat !important;
  background-size:100% 100% !important;
  background-origin:border-box !important;
  background-clip:border-box !important;
  -webkit-background-clip:border-box !important;
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
  border-color:transparent !important;
}
html[data-theme="light"] body #app button.case-edit-save {
  box-sizing:border-box !important;
  min-height:44px !important;
  padding:8px 16px !important;
  border:1px solid transparent !important;
  background-color:var(--accent) !important;
  background-image:var(--emerald-gradient) !important;
  background-repeat:no-repeat !important;
  background-size:100% 100% !important;
  background-origin:border-box !important;
  background-clip:border-box !important;
  -webkit-background-clip:border-box !important;
  color:#fff !important;
  -webkit-text-fill-color:#fff !important;
  box-shadow:var(--brand-action-shadow) !important;
}
html[data-theme="light"] body #app button.case-edit-save:focus-visible { outline-color:var(--accent) !important; }

/* Confirmation choices stay side by side, including narrow screens and large text. */
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(
  .case-delete-actions:has(button.danger),
  .filter-confirm-actions,
  .home-card-delete-actions,
  .plan-delete-actions,
  .profile-logout-actions
) {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  gap: 10px !important;
  align-items: stretch !important;
}
html body :is(#sheetRoot, #app) :is([role="dialog"], [role="alertdialog"], .sheet) :is(
  .case-delete-actions:has(button.danger),
  .filter-confirm-actions,
  .home-card-delete-actions,
  .plan-delete-actions,
  .profile-logout-actions
) > button {
  grid-column: auto !important;
  grid-row: 1 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding-inline: 10px !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

/* Unified external spacing: cards and adjacent text share one 12px boundary. */
html body :is(#app, #caseContent, .plan-screen, .plan-group, .sheet, .case-audit, .case-audit-group) > :is(h1, h2, h3, h4, p, .section-title, .page-head, .profile-section-title,
.setting-group-title, .legal-news-disclaimer, .doc-library-count,
.security-note, .profile-security-note, .app-icon-hint,
.note-case-hint, .scanner-case-hint) {
  margin-block: 0 !important;
}
html body :is(#app, #caseContent, .plan-screen, .plan-group, .sheet, .case-audit, .case-audit-group) > :is(.card, .case-card, .rec-card, .calendar-event, .upload-job,
.case-swipe-row, .upload-history-row, .calendar-event-swipe-row, .task-swipe-row,
.plan-swipe-row, .plan-task-row, .draft-list-row, .discussion-card,
.case-audit-card, .case-audit-note-card, .case-insight-progress,
.case-insight-retry, .case-insight-limit, .calendar-empty, .calendar-search-empty,
.rich-empty, .profile-hero-card, .profile-card, .settings-card,
.profile-info-panel, .profile-copy, .profile-caution, .profile-account-readonly,
.storage-summary, .storage-breakdown, .storage-note, .storage-erase,
.about-app-card, .system-notification-card, .notification-settings-card,
.notification-detail-card, .notification-detail-note, .legal-news-card,
.state-duty-card, .article-395-card, .scanner-result-card,
.case-timeline-item, .timeline-hidden-item, .case-recommendation-preview,
.case-discussion-state, .audio-material, .audio-material-list, .upload-zone,
.upload-center-summary, .draft-sources-card, .draft-checks, .draft-progress,
.audit-summary, .audit-segment, .discussion-summary, .urgent-summary,
.deadline-empty-state, .case-data-empty, .notice, .draft-error,
.split-suggestion, .scanner-page-row, .scanner-pages-summary,
.state-duty-result-group, .state-duty-price, .document-builder-intro,
.file-upload-progress-card, .material-job-card, .urgent-panel,
.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread, .plan-group, .calendar-add-event,
.calendar-search-field, .plan-filters, .chips, .case-tabs, h1, h2, h3, h4, p, .section-title, .page-head, .profile-section-title,
.setting-group-title, .legal-news-disclaimer, .doc-library-count,
.security-note, .profile-security-note, .app-icon-hint,
.note-case-hint, .scanner-case-hint):has(+ :is(.card, .case-card, .rec-card, .calendar-event, .upload-job,
.case-swipe-row, .upload-history-row, .calendar-event-swipe-row, .task-swipe-row,
.plan-swipe-row, .plan-task-row, .draft-list-row, .discussion-card,
.case-audit-card, .case-audit-note-card, .case-insight-progress,
.case-insight-retry, .case-insight-limit, .calendar-empty, .calendar-search-empty,
.rich-empty, .profile-hero-card, .profile-card, .settings-card,
.profile-info-panel, .profile-copy, .profile-caution, .profile-account-readonly,
.storage-summary, .storage-breakdown, .storage-note, .storage-erase,
.about-app-card, .system-notification-card, .notification-settings-card,
.notification-detail-card, .notification-detail-note, .legal-news-card,
.state-duty-card, .article-395-card, .scanner-result-card,
.case-timeline-item, .timeline-hidden-item, .case-recommendation-preview,
.case-discussion-state, .audio-material, .audio-material-list, .upload-zone,
.upload-center-summary, .draft-sources-card, .draft-checks, .draft-progress,
.audit-summary, .audit-segment, .discussion-summary, .urgent-summary,
.deadline-empty-state, .case-data-empty, .notice, .draft-error,
.split-suggestion, .scanner-page-row, .scanner-pages-summary,
.state-duty-result-group, .state-duty-price, .document-builder-intro,
.file-upload-progress-card, .material-job-card, .urgent-panel,
.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread, .plan-group, .calendar-add-event,
.calendar-search-field, .plan-filters, .chips, .case-tabs, h1, h2, h3, h4, p, .section-title, .page-head, .profile-section-title,
.setting-group-title, .legal-news-disclaimer, .doc-library-count,
.security-note, .profile-security-note, .app-icon-hint,
.note-case-hint, .scanner-case-hint)) {
  margin-block-end: 0 !important;
}
html body :is(#app, #caseContent, .plan-screen, .plan-group, .sheet, .case-audit, .case-audit-group) > :is(.card, .case-card, .rec-card, .calendar-event, .upload-job,
.case-swipe-row, .upload-history-row, .calendar-event-swipe-row, .task-swipe-row,
.plan-swipe-row, .plan-task-row, .draft-list-row, .discussion-card,
.case-audit-card, .case-audit-note-card, .case-insight-progress,
.case-insight-retry, .case-insight-limit, .calendar-empty, .calendar-search-empty,
.rich-empty, .profile-hero-card, .profile-card, .settings-card,
.profile-info-panel, .profile-copy, .profile-caution, .profile-account-readonly,
.storage-summary, .storage-breakdown, .storage-note, .storage-erase,
.about-app-card, .system-notification-card, .notification-settings-card,
.notification-detail-card, .notification-detail-note, .legal-news-card,
.state-duty-card, .article-395-card, .scanner-result-card,
.case-timeline-item, .timeline-hidden-item, .case-recommendation-preview,
.case-discussion-state, .audio-material, .audio-material-list, .upload-zone,
.upload-center-summary, .draft-sources-card, .draft-checks, .draft-progress,
.audit-summary, .audit-segment, .discussion-summary, .urgent-summary,
.deadline-empty-state, .case-data-empty, .notice, .draft-error,
.split-suggestion, .scanner-page-row, .scanner-pages-summary,
.state-duty-result-group, .state-duty-price, .document-builder-intro,
.file-upload-progress-card, .material-job-card, .urgent-panel,
.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread, .plan-group, .calendar-add-event,
.calendar-search-field, .plan-filters, .chips, .case-tabs, h1, h2, h3, h4, p, .section-title, .page-head, .profile-section-title,
.setting-group-title, .legal-news-disclaimer, .doc-library-count,
.security-note, .profile-security-note, .app-icon-hint,
.note-case-hint, .scanner-case-hint) + :is(.card, .case-card, .rec-card, .calendar-event, .upload-job,
.case-swipe-row, .upload-history-row, .calendar-event-swipe-row, .task-swipe-row,
.plan-swipe-row, .plan-task-row, .draft-list-row, .discussion-card,
.case-audit-card, .case-audit-note-card, .case-insight-progress,
.case-insight-retry, .case-insight-limit, .calendar-empty, .calendar-search-empty,
.rich-empty, .profile-hero-card, .profile-card, .settings-card,
.profile-info-panel, .profile-copy, .profile-caution, .profile-account-readonly,
.storage-summary, .storage-breakdown, .storage-note, .storage-erase,
.about-app-card, .system-notification-card, .notification-settings-card,
.notification-detail-card, .notification-detail-note, .legal-news-card,
.state-duty-card, .article-395-card, .scanner-result-card,
.case-timeline-item, .timeline-hidden-item, .case-recommendation-preview,
.case-discussion-state, .audio-material, .audio-material-list, .upload-zone,
.upload-center-summary, .draft-sources-card, .draft-checks, .draft-progress,
.audit-summary, .audit-segment, .discussion-summary, .urgent-summary,
.deadline-empty-state, .case-data-empty, .notice, .draft-error,
.split-suggestion, .scanner-page-row, .scanner-pages-summary,
.state-duty-result-group, .state-duty-price, .document-builder-intro,
.file-upload-progress-card, .material-job-card, .urgent-panel,
.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread, .plan-group, .calendar-add-event,
.calendar-search-field, .plan-filters, .chips, .case-tabs, h1, h2, h3, h4, p, .section-title, .page-head, .profile-section-title,
.setting-group-title, .legal-news-disclaimer, .doc-library-count,
.security-note, .profile-security-note, .app-icon-hint,
.note-case-hint, .scanner-case-hint) {
  margin-block-start: var(--card-stack-gap, 12px) !important;
}
/* Lists own the gap: child margins must never add a second 12px. */
html body :is(#app, #sheetRoot) :is(.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread) {
  gap: var(--card-stack-gap, 12px) !important;
}
html body :is(#app, #sheetRoot) :is(.home-cards, .home-library-grid, .quick-grid, .urgent-list,
.analysis-grid, .case-analytics-list, .case-proposal-list, .case-calendar-events,
.case-task-list, .case-timeline-list, .case-audit, .case-audit-cards,
.legal-news-list, .discussion-history, .draft-list, .plan-list, .plan-case-list,
.doc-library, .deadline-list, .calendar-search-results, .scanner-page-list,
.scanner-case-list, .split-confirmed-list, .profile-section-card,
.preference-list, .notification-settings-card, .storage-breakdown, .storage-summary,
.theme-options, .text-size-options, .app-icon-options, .case-type-list,
.case-category-picker-list, .case-section-options, .profile-choice-list,
.assistant-thread) > :is(*, [class]) {
  margin-block: 0 !important;
}
html body :is(#app, #sheetRoot) :is(
  .case-swipe-row, .upload-history-row, .calendar-event-swipe-row,
  .task-swipe-row, .plan-swipe-row
) > :is(.case-card, .upload-job, .calendar-event, .task-row, .plan-task-row) {
  margin-block: 0 !important;
}
/* Block-based lists become stacks; existing flexible/grid layouts retain their model. */
html body :is(#app, #sheetRoot) :is(
  .case-task-list, .storage-breakdown, .notification-settings-card,
  .preference-list, .profile-section-card, .profile-choice-list
) { display: grid; gap: var(--card-stack-gap, 12px) !important; }
/* Flex/grid sheets own their gap, just like card lists. */
html body #sheetRoot .sheet:is(
  .calendar-search-sheet, .task-sheet, .scan-quality-sheet,
  .plan-sheet[data-plan-stage="picker"]
) { gap: var(--card-stack-gap, 12px) !important; }
html body #sheetRoot .sheet:is(
  .calendar-search-sheet, .task-sheet, .scan-quality-sheet,
  .plan-sheet[data-plan-stage="picker"]
) > * { margin-block: 0 !important; }
/* End unified external spacing. */

/* A completed paragraph followed by a separate action row or choice surface
   has one 12px boundary. These block-flow sheets do not own a grid gap, so
   place it on the following surface rather than restoring paragraph margins. */
html body #sheetRoot .case-delete-sheet > p + .case-delete-actions,
html body #sheetRoot .home-card-delete-sheet > p + .home-card-delete-actions,
html body #sheetRoot .filter-confirm > p + .filter-confirm-actions,
html body #sheetRoot .stage-change-sheet > p + .case-delete-actions,
html body #sheetRoot .profile-logout-sheet > p + .profile-logout-actions {
  margin-top: 12px !important;
}
html body #sheetRoot .sheet.plan-sheet > p + .plan-actions,
html body #sheetRoot .sheet.storage-erase-sheet > p + form.storage-erase-form,
html body #sheetRoot .sheet.case-category-picker-sheet > p + form,
html body #sheetRoot .sheet.home-library-sheet > p + .home-library-grid {
  margin-top: 12px !important;
}
html body #sheetRoot .sheet.attachment-sheet > p + button,
html body #sheetRoot .sheet:not(.scan-quality-sheet):not(.calendar-search-sheet):not(.calendar-ai-preview) > p + button {
  margin-top: 12px !important;
}

/* Nested finding cards keep a tighter 6px rhythm inside the analytics group. */
html body #app .case-audit-cards { gap: var(--nested-card-gap) !important; }

/* Button 1 and Button 2 labels use the same white text in every theme. */

/* Dark sign-in mode uses two distinct controls. Keep the inactive choice quiet
   and the selected violet choice on a neutral dark edge. */
html[data-theme="dark"] body #app .auth-cinematic .auth-tabs {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: var(--space-1) !important;
  padding: var(--space-1) !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body #app .auth-cinematic .auth-tabs > button {
  border: 1px solid rgba(105, 124, 154, .24) !important;
  border-radius: var(--radius-full) !important;
  background: rgba(12, 27, 49, .72) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body #app .auth-cinematic .auth-tabs > button.active {
  border-color: rgba(8, 17, 33, .94) !important;
  background-image: var(--iq-gradient) !important;
  box-shadow: 0 0 0 1px rgba(8, 17, 33, .9) !important;
}

/* Logout confirmation keeps its fill, without a legacy border or coloured glow. */
html body #sheetRoot .profile-logout-sheet button.profile-confirm-logout {
  border:0 !important;
  border-color: transparent !important;
  border-image:none !important;
  box-shadow:none !important;
}
html body #sheetRoot .profile-logout-sheet button.profile-confirm-logout::before,
html body #sheetRoot .profile-logout-sheet button.profile-confirm-logout::after { content:none !important; display:none !important; }
html body #sheetRoot .profile-logout-sheet button.profile-confirm-logout:focus-visible { outline:2px solid var(--text) !important; outline-offset:3px; }
html body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .primary,
  .secondary,
  .button-variant-1,
  .button-variant-2,
  [data-back],
  [data-scanner-back]:not(.button-variant-3),
  [data-close-calendar-search],
  [data-close-calendar-ai-preview],
  [data-close-calendar-event],
  [data-close-date-wheel],
  [data-close-case-category-picker],
  [data-close-task-editor],
  [data-close-notification-detail],
  [data-close-document-text],
  [data-close-document-viewer]:not(.button-variant-3),
  [data-close-pdf-preview],
  [data-close-profile-sheet],
  [data-close-sheet],
  [data-close-calendar-case-matches],
  [data-calendar-voice-cancel],
  [data-onboarding-back],
  [data-doc-edit-cancel],
  [data-cancel-storage-erase],
  [data-delete-filter-cancel],
  [data-cancel-stage-change],
  [data-cancel-document-delete],
  [data-cancel-calendar-event-discard],
  [data-cancel-calendar-event-delete],
  [data-cancel-case-delete],
  [data-cancel-home-card-delete],
  [data-split-cancel],
  [data-audio-cancel],
  [data-file-upload-cancel],
  [data-bulk-sheet-x],
  [data-collapse-upload-job],
  [data-duty-reset],
  [data-article395-reset],
  [data-confirm-calendar-event-discard],
  [data-timeline-revert],
  [aria-label="Закрыть"],
  [aria-label^="Закрыть "]:not(.button-variant-3),
  [aria-label="Назад"],
  [aria-label^="Вернуться"]
) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
/* Light-theme Button 2 is a translucent emerald gradient; its white label stays
   legible while danger actions and the scanner's yellow review action keep meaning. */
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .secondary:not(.danger):not(.scanner-recovery-delete),
  .button-variant-2:not(.danger),
  [data-back],
  [data-scanner-back]:not(.button-variant-3),
  [data-close-calendar-search],
  [data-close-calendar-ai-preview],
  [data-close-calendar-event],
  [data-close-date-wheel],
  [data-close-case-category-picker],
  [data-close-task-editor],
  [data-close-notification-detail],
  [data-close-document-text],
  [data-close-document-viewer]:not(.button-variant-3),
  [data-close-pdf-preview],
  [data-close-profile-sheet],
  [data-close-sheet],
  [data-close-calendar-case-matches],
  [data-calendar-voice-cancel],
  [data-onboarding-back],
  [data-doc-edit-cancel],
  [data-cancel-storage-erase],
  [data-delete-filter-cancel],
  [data-cancel-stage-change],
  [data-cancel-document-delete],
  [data-cancel-calendar-event-discard],
  [data-cancel-calendar-event-delete],
  [data-cancel-case-delete],
  [data-cancel-home-card-delete],
  [data-split-cancel],
  [data-audio-cancel],
  [data-file-upload-cancel],
  [data-bulk-sheet-x],
  [data-collapse-upload-job],
  [data-duty-reset],
  [data-article395-reset],
  [data-confirm-calendar-event-discard],
  [data-timeline-revert],
  [aria-label="Закрыть"],
  [aria-label^="Закрыть "]:not(.button-variant-3),
  [aria-label="Назад"],
  [aria-label^="Вернуться"]
) {
  background-color: transparent !important;
  background-image: var(--emerald-button-two) !important;
  border-color: rgb(6 77 60 / .28) !important;
  box-shadow: 0 6px 16px rgb(6 77 60 / .12) !important;
}
html body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .primary,
  .secondary,
  .button-variant-1,
  .button-variant-2,
  [data-back],
  [data-scanner-back]:not(.button-variant-3),
  [data-close-calendar-search],
  [data-close-calendar-ai-preview],
  [data-close-calendar-event],
  [data-close-date-wheel],
  [data-close-case-category-picker],
  [data-close-task-editor],
  [data-close-notification-detail],
  [data-close-document-text],
  [data-close-document-viewer]:not(.button-variant-3),
  [data-close-pdf-preview],
  [data-close-profile-sheet],
  [data-close-sheet],
  [data-close-calendar-case-matches],
  [data-calendar-voice-cancel],
  [data-onboarding-back],
  [data-doc-edit-cancel],
  [data-cancel-storage-erase],
  [data-delete-filter-cancel],
  [data-cancel-stage-change],
  [data-cancel-document-delete],
  [data-cancel-calendar-event-discard],
  [data-cancel-calendar-event-delete],
  [data-cancel-case-delete],
  [data-cancel-home-card-delete],
  [data-split-cancel],
  [data-audio-cancel],
  [data-file-upload-cancel],
  [data-bulk-sheet-x],
  [data-collapse-upload-job],
  [data-duty-reset],
  [data-article395-reset],
  [data-confirm-calendar-event-discard],
  [data-timeline-revert],
  [aria-label="Закрыть"],
  [aria-label^="Закрыть "]:not(.button-variant-3),
  [aria-label="Назад"],
  [aria-label^="Вернуться"]
) :is(span, strong, small, em, b, i) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* Case list spacing regression: the container owns each 12px interval. */
html body.cases-route #app #caseList {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px !important;
  margin-block: 0 !important;
}
html body.cases-route #app #caseList > .case-swipe-row,
html body.cases-route #app #caseList > .case-swipe-row > .case-card {
  margin-block: 0 !important;
}
html body.cases-route #app > :is(.page-head, .search, .chips) {
  margin-block: 0 12px !important;
}
html body.cases-route #app > .chips {
  padding-block-end: 0 !important;
}
html body #app .smart-notifications {
  gap: 12px !important;
}
html body #app .smart-notifications > .notification-swipe-row {
  margin-block: 0 !important;
}

/* One swipe contract across cases, documents, calendar events, tasks, plan,
   and notifications: the opaque card moves, uncovering a stationary menu. */
.case-swipe-row .case-card,
.task-swipe-row .task-row,
.plan-swipe-row .plan-task-row,
.calendar-event-swipe-row .calendar-event,
.document-swipe-row .document-row-surface,
.notification-swipe-row .smart-notification {
  backface-visibility: hidden;
  z-index: 2;
  opacity: 1;
}
.case-swipe-row.swiping .case-card,
.task-swipe-row.swiping .task-row,
.plan-swipe-row.swiping .plan-task-row,
.calendar-event-swipe-row.swiping .calendar-event,
.document-swipe-row.swiping .document-row-surface,
.notification-swipe-row.swiping .smart-notification {
  transition: none;
}
.case-swipe-row.swiping > .case-swipe-actions,
.task-swipe-row.swiping > .task-swipe-actions,
.plan-swipe-row.swiping > .plan-swipe-actions,
.calendar-event-swipe-row.swiping > .calendar-event-swipe-actions,
.document-swipe-row.swiping > .document-swipe-actions,
.notification-swipe-row.swiping > .notification-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: none;
}
.case-swipe-row.open > .case-swipe-actions,
.task-swipe-row.open > .task-swipe-actions,
.plan-swipe-row.open > .plan-swipe-actions,
.calendar-event-swipe-row.open > .calendar-event-swipe-actions,
.document-swipe-row.open > .document-swipe-actions,
.notification-swipe-row.open > .notification-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: none;
}
/* Keep the menu physically behind the card while it returns to its closed
   position; it must never fade independently of the card movement. */
.case-swipe-row > .case-swipe-actions,
.task-swipe-row > .task-swipe-actions,
.plan-swipe-row > .plan-swipe-actions,
.calendar-event-swipe-row > .calendar-event-swipe-actions,
.document-swipe-row > .document-swipe-actions,
.notification-swipe-row > .notification-swipe-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: none;
}
.case-swipe-actions,
.task-swipe-actions,
.plan-swipe-actions,
.calendar-event-swipe-actions,
.document-swipe-actions,
.notification-swipe-actions { z-index: 1; }
.case-swipe-row.open > .case-swipe-actions,
.task-swipe-row.open > .task-swipe-actions,
.plan-swipe-row.open > .plan-swipe-actions,
.calendar-event-swipe-row.open > .calendar-event-swipe-actions,
.document-swipe-row.open > .document-swipe-actions,
.notification-swipe-row.open > .notification-swipe-actions {
  pointer-events: auto;
}
.document-swipe-row .document-row-surface {
  background-color: var(--system-surface-color, var(--panel, #111c2e));
  opacity: 1;
}
html body #app .doc-library #docLibraryList .document-row-surface {
  background-color: var(--panel) !important;
}
@media (prefers-reduced-motion: reduce) {
  .case-swipe-row .case-card,
  .task-swipe-row .task-row,
  .plan-swipe-row .plan-task-row,
  .calendar-event-swipe-row .calendar-event,
  .document-swipe-row .document-row-surface,
  .notification-swipe-row .smart-notification,
  .case-swipe-actions,
  .task-swipe-actions,
  .plan-swipe-actions,
  .calendar-event-swipe-actions,
  .document-swipe-actions,
  .notification-swipe-actions { transition: none !important; }
}

/* Audited content boundaries: use one 12px gap across nested screen compositions. */
html body.case-route #app .case-tabs.case-tabs-top {
  margin-top: 12px !important;
  margin-bottom: 12px !important;
  padding-block: 0 !important;
  gap: 12px !important;
}
html body.case-route #app .case-overview-head {
  margin: 0 0 12px !important;
  padding: 0 !important;
}
html body.case-route #app .case-overview-head:not([hidden]) {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 12px !important;
}
html body #app #caseContent,
html body #app #caseDiscussionPreview {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 12px !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
}
html body #app #caseDiscussionPreview { padding-bottom: 0 !important; }
html body #app #caseContent > *,
html body #app #caseDiscussionPreview > *,
html body.case-route #app .case-overview-head > .card.summary {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
/* Section headings belong to the external rhythm, including profile/settings. */
html body #app.screen > .page-head { margin-bottom: 12px !important; }
html body #app.screen > .section-title,
html body #app.screen > .setting-group-title {
  margin-top: 12px !important;
  margin-bottom: 12px !important;
  padding-block: 0 !important;
}
html body #app.screen .profile-section-card,
html body #app.screen .preference-list,
html body #app.screen .notification-settings-card,
html body #app.screen .profile-choice-list,
html body #app.screen .storage-breakdown,
html body #app.screen .storage-summary,
html body #app.screen .theme-options,
html body #app.screen .text-size-options,
html body #app.screen .app-icon-options,
html body #app.screen .home-cards,
html body #app.screen .plan-list,
html body #app.screen .legal-news-list,
html body #app.screen .draft-list,
html body #app.screen .discussion-history,
html body #app.screen .doc-library,
html body #app.screen .deadline-list,
html body #app.screen .case-calendar-events,
html body #app.screen .case-proposal-list,
html body #app.screen .case-task-list,
html body #app.screen .case-timeline-list {
  gap: 12px !important;
}
html body #app.screen .profile-section-card > *,
html body #app.screen .preference-list > *,
html body #app.screen .notification-settings-card > *,
html body #app.screen .profile-choice-list > *,
html body #app.screen .storage-breakdown > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
/* Calendar chains are block flow; only one side owns the vertical margin. */
html body #app.screen > .calendar,
html body #app.screen > .calendar-add-event,
html body #app.screen > .calendar-events-title,
html body #app.screen > .calendar-event-swipe-row {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
html body #app.screen > .calendar-event-swipe-row > .calendar-event {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
html body #app.screen > .search {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
html body #app.screen > .storage-note,
html body #app.screen > .storage-erase,
html body #app.screen > .security-note,
html body #app.screen > p:not(.home-search-hint) {
  margin-top: 12px !important;
  margin-bottom: 12px !important;
}
html body #app.screen > .profile-logout {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
/* Filter strip padding used to add space on top of the intended margin. */
html body #app.screen .plan-filters,
html body #app.screen .doc-library-controls {
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
html body #app.screen .doc-library > .doc-library-controls {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
html body #app #docLibraryList {
  display: grid;
  align-content: start;
  gap: 12px !important;
}
html body #app #docLibraryList > .document-swipe-row,
html body #app #docLibraryList .document-row {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
html body #app.screen .doc-library-controls { gap: 12px !important; }
html body #app.screen .plan-add {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
html body #app.screen .plan-group {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
/* End audited content boundaries. */

/* Popup Button 2 cancellation rules used to restore the theme accent. Keep
   their white labels legible on a darker light-theme fill. */
html body #sheetRoot .sheet :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions,
  .plan-delete-actions
) button.secondary:not(.danger) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
html[data-theme="light"] body #sheetRoot .sheet :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions,
  .plan-delete-actions
) button.secondary:not(.danger) {
  background-color: transparent !important;
  background-image: var(--emerald-button-two) !important;
  border-color: rgb(6 77 60 / .28) !important;
  box-shadow: 0 6px 16px rgb(6 77 60 / .12) !important;
}
html body #sheetRoot .sheet :is(
  .profile-logout-actions,
  .case-delete-actions:has(button.danger),
  .home-card-delete-actions:has(button.danger),
  .filter-confirm-actions,
  .plan-delete-actions
) button.secondary:not(.danger) :is(span, strong, small, b, em, i) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* Back controls have a more specific violet SVG paint; Button 2 stays white. */
html:not([data-theme="light"]) body #app button.icon-btn[data-back][aria-label],
html[data-theme="light"] body #app button.icon-btn[data-back][aria-label],
html:not([data-theme="light"]) body #app .scanner-head button[data-scanner-back][aria-label],
html[data-theme="light"] body #app .scanner-head button[data-scanner-back][aria-label] {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
html[data-theme="light"] body #app button.icon-btn[data-back][aria-label],
html[data-theme="light"] body #app .scanner-head button[data-scanner-back][aria-label] {
  background-color: transparent !important;
  background-image: var(--emerald-button-two) !important;
  border-color: rgb(6 77 60 / .28) !important;
  box-shadow: 0 6px 16px rgb(6 77 60 / .12) !important;
}
html:not([data-theme="light"]) body #app button.icon-btn[data-back][aria-label] svg.ui-icon,
html[data-theme="light"] body #app button.icon-btn[data-back][aria-label] svg.ui-icon,
html:not([data-theme="light"]) body #app .scanner-head button[data-scanner-back][aria-label] svg.ui-icon,
html[data-theme="light"] body #app .scanner-head button[data-scanner-back][aria-label] svg.ui-icon {
  color: #fff !important;
  stroke: #fff !important;
  fill: none !important;
  -webkit-text-fill-color: #fff !important;
}

/* Button 1: keep its theme gradient, but use the clean edge of the calendar's
   “Добавить событие” action. Remove inherited pink rims/top glints without
   affecting danger or UI-kit semantic buttons. */
html body :is(#app, #sheetRoot) :is(
  button.primary:not(.danger):not(.ui-button):not(.article395-submit):not(.scanner-review .primary),
  button.case-edit-save:not(.danger)
) {
  box-sizing: border-box;
  border: 0 !important;
  border-color: transparent !important;
  border-image: none !important;
  background-origin: border-box !important;
  background-clip: border-box !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  box-shadow: var(--creation-button-shadow, 0 8px 20px rgba(24, 20, 45, .18)) !important;
  text-decoration: none !important;
}
html body :is(#app, #sheetRoot) :is(
  button.primary:not(.danger):not(.ui-button):not(.article395-submit):not(.scanner-review .primary),
  button.case-edit-save:not(.danger)
)::before,
html body :is(#app, #sheetRoot) :is(
  button.primary:not(.danger):not(.ui-button):not(.article395-submit):not(.scanner-review .primary),
  button.case-edit-save:not(.danger)
)::after {
  content: none !important;
  display: none !important;
}
html body :is(#app, #sheetRoot) :is(
  button.primary:not(.danger):not(.ui-button):not(.article395-submit):not(.scanner-review .primary),
  button.case-edit-save:not(.danger)
):focus-visible {
  outline: 2px solid var(--creation-button-focus, var(--accent)) !important;
  outline-offset: 2px !important;
}
html body :is(#app, #sheetRoot) :is(
  button.primary:not(.danger):not(.ui-button):not(.article395-submit):not(.scanner-review .primary),
  button.case-edit-save:not(.danger)
):disabled {
  box-shadow: none !important;
}

/* Case filter pills use the same clean edge as Button 1 while preserving the
   selected theme gradient, oval geometry, drag feedback, and keyboard focus. */
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging) {
  box-sizing: border-box;
  border: 0 !important;
  border-color: transparent !important;
  border-image: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging)::before,
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging)::after,
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging) > button[data-filter]::before,
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging) > button[data-filter]::after {
  content: none !important;
  display: none !important;
}
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging) > button[data-filter] {
  border: 0 !important;
  border-color: transparent !important;
  border-image: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}
html body #app .chips:has(> .filter-token > button[data-filter]) > .filter-token:not(.holding):not(.dragging) > button[data-filter]:focus-visible {
  outline: 2px solid var(--creation-button-focus, var(--accent)) !important;
  outline-offset: 2px !important;
}

/* All Button 1 surfaces in light mode share the same emerald gradient as the
   app's central plus. Button 2 uses a translucent emerald gradient above.
   Preserve danger controls, Button 3, and the scanner's yellow review action. */
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .button-variant-1:not(.danger),
  .case-edit-save:not(.danger)
) {
  background-color: transparent !important;
  background-image: var(--emerald-gradient) !important;
  border: 0 !important;
  border-image: none !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: var(--creation-button-shadow) !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .button-variant-1:not(.danger),
  .case-edit-save:not(.danger)
) :is(span, strong, small, em, b, i, svg) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .button-variant-1:not(.danger),
  .case-edit-save:not(.danger)
):disabled { box-shadow: none !important; }
html[data-theme="light"] body #app .document-scanner-screen .scanner-review .scanner-crop-actions .primary {
  background: #ffd65a !important;
  border: 1px solid #ffd65a !important;
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
  box-shadow: none !important;
}
html[data-theme="light"] body #app .document-scanner-screen .scanner-review .scanner-crop-actions .primary :is(span, strong, small, em, b, i) {
  color: #111 !important;
  -webkit-text-fill-color: #111 !important;
}

/* Final light-theme Button 1/2 paint wins over older per-component rules
   (back arrows, PDF controls, and confirmation-sheet cancel buttons). The
   sentinel :not() raises specificity without changing which controls match. */
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer, .tabbar) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .case-edit-save:not(.danger),
  .button-variant-1:not(.danger)
):not(#iq-theme-button-paint-override) {
  background-color: transparent !important;
  background-image: var(--emerald-gradient) !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  background-size: 100% 100% !important;
  border: 0 !important;
  border-image: none !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: var(--creation-button-shadow) !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer, .tabbar) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .case-edit-save:not(.danger),
  .button-variant-1:not(.danger)
):not(#iq-theme-button-paint-override) :is(span, strong, small, em, b, i, svg) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer, .tabbar) button:is(
  .primary:not(.danger):not(.scanner-review .primary),
  .case-edit-save:not(.danger),
  .button-variant-1:not(.danger)
):not(#iq-theme-button-paint-override):disabled { box-shadow: none !important; }

/* Delete actions follow the owner's screenshot reference across the app:
   translucent emerald Cancel, full emerald-gradient Delete, white labels.
   Unrelated danger states (logout, reset, upload cancellation) keep their role. */
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) :is(
  button.danger:is(
    [data-confirm-storage-erase], [data-confirm-filter-delete],
    [data-confirm-document-delete], [data-confirm-case-delete],
    [data-confirm-calendar-event-delete], [data-confirm-home-card-delete],
    [data-plan-action="confirm-delete"], [data-plan-action="delete"],
    [data-delete-upload], [data-draft-delete], [data-storage-erase]
  ),
  .notification-swipe-actions button[data-delete-notification],
  button.case-edit-delete,
  button.case-action.delete,
  button.task-delete-action,
  button.calendar-event-delete-action,
  button.document-delete-action,
  button.upload-history-delete,
  button.plan-swipe-delete,
  button.assistant-attachment-remove,
  button.scanner-recovery-delete
):not(#iq-theme-button-paint-override) {
  background-color: transparent !important;
  background-image: var(--emerald-gradient) !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  background-size: 100% 100% !important;
  border: 0 !important;
  border-image: none !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: var(--creation-button-shadow) !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer) :is(
  button.danger:is(
    [data-confirm-storage-erase], [data-confirm-filter-delete],
    [data-confirm-document-delete], [data-confirm-case-delete],
    [data-confirm-calendar-event-delete], [data-confirm-home-card-delete],
    [data-plan-action="confirm-delete"], [data-plan-action="delete"],
    [data-delete-upload], [data-draft-delete], [data-storage-erase]
  ),
  .notification-swipe-actions button[data-delete-notification],
  button.case-edit-delete,
  button.case-action.delete,
  button.task-delete-action,
  button.calendar-event-delete-action,
  button.document-delete-action,
  button.upload-history-delete,
  button.plan-swipe-delete,
  button.assistant-attachment-remove,
  button.scanner-recovery-delete
):not(#iq-theme-button-paint-override) :is(span, strong, small, em, b, i, svg) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  stroke: #fff !important;
}
/* Document upload: cancellation uses the picker's type and compact side padding.
   Do not resize audio or chat attachment controls that share this class. */
html body #app .volume-upload-zone .file-upload-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  align-self: center;
  width: max-content !important;
  min-width: 0 !important;
  max-width: 100%;
  min-height: 44px;
  padding: 0 var(--document-cancel-padding-right, 20px) 0 var(--document-cancel-padding-left, 20px) !important;
  font-family: inherit;
  font-size: calc(15px * var(--ui-font-scale, 1)) !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
}
html body #app .volume-upload-zone .document-upload-restart {
  justify-self: center;
  align-self: center;
  width: max-content !important;
  min-width: 0 !important;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 20px !important;
  font-size: calc(15px * var(--ui-font-scale, 1)) !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
}
html body #app .volume-upload-zone .upload-file-picker[hidden] {
  display: none !important;
}

html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer, .tabbar) button:is(
  .secondary:not(.danger):not(.scanner-recovery-delete):not(.button-variant-3),
  .button-variant-2:not(.danger):not(.scanner-recovery-delete):not(.button-variant-3),
  [data-back]:not(.danger):not(.button-variant-3),
  [data-scanner-back]:not(.danger):not(.button-variant-3),
  [data-close-calendar-search]:not(.danger),
  [data-close-calendar-ai-preview]:not(.danger),
  [data-close-calendar-event]:not(.danger),
  [data-close-date-wheel]:not(.danger),
  [data-close-case-category-picker]:not(.danger),
  [data-close-task-editor]:not(.danger),
  [data-close-notification-detail]:not(.danger),
  [data-close-document-text]:not(.danger),
  [data-close-document-viewer]:not(.danger):not(.button-variant-3),
  [data-close-pdf-preview]:not(.danger),
  [data-close-profile-sheet]:not(.danger),
  [data-close-sheet]:not(.danger),
  [data-close-calendar-case-matches]:not(.danger),
  [data-calendar-voice-cancel]:not(.danger),
  [data-onboarding-back]:not(.danger),
  [data-doc-edit-cancel]:not(.danger),
  [data-cancel-storage-erase]:not(.danger),
  [data-delete-filter-cancel]:not(.danger),
  [data-cancel-stage-change]:not(.danger),
  [data-cancel-document-delete]:not(.danger),
  [data-cancel-calendar-event-discard]:not(.danger),
  [data-cancel-calendar-event-delete]:not(.danger),
  [data-cancel-case-delete]:not(.danger),
  [data-cancel-home-card-delete]:not(.danger),
  [data-split-cancel]:not(.danger),
  [data-audio-cancel]:not(.danger),
  [data-file-upload-cancel]:not(.danger),
  [data-bulk-sheet-x]:not(.danger),
  [data-collapse-upload-job]:not(.danger),
  [data-duty-reset]:not(.danger),
  [data-article395-reset]:not(.danger),
  [data-confirm-calendar-event-discard]:not(.danger),
  [data-timeline-revert]:not(.danger),
  [aria-label="Закрыть"]:not(.danger):not(.button-variant-3),
  [aria-label^="Закрыть "]:not(.danger):not(.button-variant-3),
  [aria-label="Назад"]:not(.danger):not(.button-variant-3),
  [aria-label^="Вернуться"]:not(.danger):not(.button-variant-3)
):not(#iq-theme-button-paint-override) {
  background-color: transparent !important;
  background-image: var(--emerald-button-two) !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  border-color: rgb(6 77 60 / .38) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: 0 6px 16px rgb(6 77 60 / .12) !important;
}
html[data-theme="light"] body :is(#app, #sheetRoot, .document-viewer-layer, .document-text-layer, .tabbar) button:is(
  .secondary:not(.danger):not(.scanner-recovery-delete):not(.button-variant-3),
  .button-variant-2:not(.danger):not(.scanner-recovery-delete):not(.button-variant-3),
  [data-back]:not(.danger):not(.button-variant-3),
  [data-scanner-back]:not(.danger):not(.button-variant-3),
  [data-close-calendar-search]:not(.danger),
  [data-close-calendar-ai-preview]:not(.danger),
  [data-close-calendar-event]:not(.danger),
  [data-close-date-wheel]:not(.danger),
  [data-close-case-category-picker]:not(.danger),
  [data-close-task-editor]:not(.danger),
  [data-close-notification-detail]:not(.danger),
  [data-close-document-text]:not(.danger),
  [data-close-document-viewer]:not(.danger):not(.button-variant-3),
  [data-close-pdf-preview]:not(.danger),
  [data-close-profile-sheet]:not(.danger),
  [data-close-sheet]:not(.danger),
  [data-close-calendar-case-matches]:not(.danger),
  [data-calendar-voice-cancel]:not(.danger),
  [data-onboarding-back]:not(.danger),
  [data-doc-edit-cancel]:not(.danger),
  [data-cancel-storage-erase]:not(.danger),
  [data-delete-filter-cancel]:not(.danger),
  [data-cancel-stage-change]:not(.danger),
  [data-cancel-document-delete]:not(.danger),
  [data-cancel-calendar-event-discard]:not(.danger),
  [data-cancel-calendar-event-delete]:not(.danger),
  [data-cancel-case-delete]:not(.danger),
  [data-cancel-home-card-delete]:not(.danger),
  [data-split-cancel]:not(.danger),
  [data-audio-cancel]:not(.danger),
  [data-file-upload-cancel]:not(.danger),
  [data-bulk-sheet-x]:not(.danger),
  [data-collapse-upload-job]:not(.danger),
  [data-duty-reset]:not(.danger),
  [data-article395-reset]:not(.danger),
  [data-confirm-calendar-event-discard]:not(.danger),
  [data-timeline-revert]:not(.danger),
  [aria-label="Закрыть"]:not(.danger):not(.button-variant-3),
  [aria-label^="Закрыть "]:not(.danger):not(.button-variant-3),
  [aria-label="Назад"]:not(.danger):not(.button-variant-3),
  [aria-label^="Вернуться"]:not(.danger):not(.button-variant-3)
):not(#iq-theme-button-paint-override) :is(span, strong, small, em, b, i, svg) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  stroke: #fff !important;
}

/* Scanner history uses its own back actions. Keep the arrow readable on the
   light library surface even when popup normalization applies Button 3. */
html[data-theme="light"] body #app .scanner-library .scanner-head button[data-scanner-history-back]:not(#iq-theme-button-paint-override) svg.ui-icon {
  color: var(--accent) !important;
  stroke: currentColor !important;
  fill: none !important;
}

/* The scanner library Back control follows the case-card Back button. */
html[data-theme="dark"] body #app .scanner-library .scanner-head button.icon-btn[data-scanner-library-back][aria-label="Назад"] {
  background-color: color-mix(in srgb, var(--accent) 14%, transparent) !important;
  background-image: none !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body #app .scanner-library .scanner-head button.icon-btn[data-scanner-library-back][aria-label="Назад"] svg.ui-icon {
  color: #fff !important;
  stroke: #fff !important;
  fill: none !important;
}
html[data-theme="light"] body #app .scanner-library .scanner-head button.icon-btn[data-scanner-library-back][aria-label="Назад"] {
  background-color: transparent !important;
  background-image: var(--emerald-button-two) !important;
  border: 1px solid rgb(6 77 60 / .38) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: 0 6px 16px rgb(6 77 60 / .12) !important;
}
html[data-theme="light"] body #app .scanner-library .scanner-head button.icon-btn[data-scanner-library-back][aria-label="Назад"] svg.ui-icon {
  color: #fff !important;
  stroke: #fff !important;
  fill: none !important;
}

/* Keep the Exit label white in both scanner themes. */
html body #app .scanner-live .scanner-live-toolbar button.button-variant-3[data-scanner-back] {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

/* Case filter rows are layout only: pills rest directly on the page. */
html body.cases-route #app > .chips {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html body.cases-route #app > .chips::before,
html body.cases-route #app > .chips::after {
  content: none !important;
  display: none !important;
}

/* User message prose uses the same mint as the home Plan task count.
   Shared thread markup also covers the desktop assistant panel. */
.assistant-thread .message.user .assistant-message-body > p {
  color: #70d9b1;
  -webkit-text-fill-color: currentColor;
}

/* Deep emerald keeps user prose readable on the light message surface. */
html[data-theme="light"] .assistant-thread .message.user .assistant-message-body > p {
  color: #0b6a50;
}

/* Reply medallion: the vivid brain and ring follow the themed entry medallions.
   Retain the existing avatar footprint and animation hosts. */
html body :is(#app, #desktopAssistantPanel) .assistant-avatar.assistant-brain,
html body :is(#app, #desktopAssistantPanel) .message.ai:has(.assistant-wait) .assistant-avatar.assistant-brain {
  box-sizing: border-box;
  border: 1.5px solid #8a29fa;
  background: #17072f;
  box-shadow: 0 0 0 1.5px rgb(138 41 250 / .42), 0 0 12px rgb(138 41 250 / .38);
}
html body :is(#app, #desktopAssistantPanel) .assistant-avatar.assistant-brain > img,
html body :is(#app, #desktopAssistantPanel) .assistant-avatar.assistant-brain > .assistant-brain-live {
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border-radius: 50%;
}

/* One external violet ring: hide the video-baked inner circle with the shared
   silhouette mask above and keep the entire dark medallion interior black. */
html[data-theme="dark"] body :is(#app, #desktopAssistantPanel, nav.tabbar) :is(
  .assistant-intro-brain, .assistant-avatar.assistant-brain,
  .case-brain-fab-orb, .assistant-fab.case-brain-fab
) {
  background: #000 !important;
}
