/* Paint-only surface depth. Light surfaces share Calendar's white/emerald
   finish; module geometry, motion and functional states remain untouched. */
:root {
  --depth-edge: rgba(255,255,255,.22);
  --depth-side: rgba(255,255,255,.055);
  --depth-bottom: rgba(0,0,0,.20);
  --depth-shadow: rgba(0,0,0,.25);
  --depth-lip: rgba(0,0,0,.14);
  --depth-card: inset 0 1px 0 var(--depth-edge), inset 1px 0 0 var(--depth-side), inset 0 -2px 2px var(--depth-bottom), 0 4px 0 var(--depth-lip), 0 9px 18px -8px var(--depth-shadow);
  --depth-panel: var(--depth-card);
  --depth-dialog: var(--depth-card);
}
html[data-theme="light"] {
  --depth-edge: rgba(255,255,255,.96);
  --depth-side: rgba(255,255,255,.70);
  --depth-bottom: rgba(8,96,66,.16);
  --depth-shadow: rgba(8,96,66,.25);
  --depth-lip: rgba(8,96,66,.12);
  --depth-light-finish: radial-gradient(ellipse at 12% 0%, rgba(255,255,255,.96), transparent 62%),
    linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--green) 5%, #fff) 44%, color-mix(in srgb, var(--green) 24%, #fff) 100%);
}

/* Individual cards, result blocks and bubbles. Never style swipe wrappers,
   art, progress fills, scrims, camera preview or PDF content as a card. */
html body :is(#app,#sheetRoot,.app-shell) :is(
  .card,.case-card,.profile-card,.profile-section-card,.rec-card,.legal-news-card,.plan-empty,.plan-task-row,.plan-case-option,
  .history-item,.event,.calendar-event,.task-row,.task-summary > div,.case-calendar-events > button,.storage-row,.document-row-surface,.smart-notification,
  .notification-detail-card,.result-card,.settings-card,.profile-copy,.about-app-card,
  .profile-info-panel,.profile-account-readonly,.profile-photo-editor,.case-discussion-preview,
  .case-discussion-state,.case-recommendation-preview,.case-sections-editor,.case-attention-setting,
  .case-timeline-item,.timeline-hidden-item,
  .notice,.security-note,.system-notification-card,.storage-note,.storage-summary > div,.upload-zone,
  .upload-center-summary,.file-upload-progress-card,.material-job-card,.audio-material,
  .state-duty-result-group,.state-duty-price,.document-builder-intro,.draft-sources-card,
  .draft-list-row,.draft-checks,.draft-progress,.draft-error,.audit-summary,.audit-segment,.bulk-summary,
  .discussion-summary,.urgent-panel,.urgent-summary,.rich-empty,.calendar-empty,
  .deadline-empty-state,.assistant-empty,.message,.scanner-result-card,.scanner-page-row,
  .scanner-pages-summary,.scanner-live-summary,.app-icon-option,.theme-option,.case-type-option,
  .document-case-option,.jurisdiction-options button,
  .text-size-options button,.calendar-title-field,.calendar-schedule-card,
  .calendar-reminders-card,.calendar-case-row,.calendar-tag-row,.calendar-note-field
):not([data-home-card],.profile-section-card,.notification-settings-card):not(:focus-visible,[aria-pressed="true"],.active,.selected,.error,.failed,.swiping,.is-swiping,.dragging,.home-card-pressing,.home-card-dragging) {
  box-shadow: var(--depth-card);
}

/* Only semantic panels receive panel depth. Layout-only forms and list grids
   deliberately stay transparent so standalone controls sit on the page. */
html body :is(#app,#sheetRoot,.app-shell) :is(
  .case-data-empty,.calendar-search-empty,.timeline-intro,.timeline-switch,.split-suggestion
):not(:focus-visible,.active,.selected,.error,.failed) { box-shadow: var(--depth-panel); }

/* Standalone overlays may be mounted directly under body by their module.
   Do not change translucency, native wheels, backdrops, focus traps or z-index. */
html body :is(#sheetRoot,.app-shell) :is(.sheet,.auth-card),
html body :is(.attachment-sheet,.calendar-event-form,.calendar-event-discard-sheet,
  .calendar-case-match-dialog,.ios-date-wheel,.filter-sheet,
  .bulk-sheet,.timeline-sheet,.doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,
  .home-library-sheet,.document-opening-toast,.toast,.undo-toast) {
  box-shadow: var(--depth-dialog);
}

/* All card/panel surfaces share Calendar's finish, including stateful cards.
   Borders, text, focus rings and swipe/drag behavior retain their meaning.
   Transparent grouping containers, actions, media and backdrops are not cards. */
html[data-theme="light"] body :is(#app,#sheetRoot,.app-shell) :is(
  .card,.case-card,.profile-card,.profile-hero-card,.rec-card,.legal-news-card,.history-item,
  .home-library-item,.first-case-steps,
  .calendar-title-field,.calendar-schedule-card,.calendar-reminders-card,.calendar-case-row,.calendar-tag-row,.calendar-note-field,
  .event,.calendar-event,.calendar-search-result,.task-row,.task-summary > div,.case-calendar-events > button,.storage-row,.plan-task-row,
  .plan-case-option,.split-confirmed,.document-part,.bulk-list,.scanner-recovery,
  .scanner-case-list > button,
  .document-row-surface,.smart-notification,.notification-detail-card,
  .result-card,.settings-card,.profile-copy,.about-app-card,.profile-info-panel,
  .profile-account-readonly,.profile-photo-editor,.case-discussion-preview,
  .case-discussion-state,.case-recommendation-preview,.case-sections-editor,
  .case-attention-setting,.summary-field,.case-timeline-item,.timeline-hidden-item,.case-insight-progress,
  .system-notification-card,.storage-summary > div,.upload-zone,
  .upload-center-summary,.file-upload-progress-card,.material-job-card,.audio-material,
  .state-duty-result-group,.state-duty-price,.document-builder-intro,
  .draft-sources-card,.draft-list-row,.draft-checks,.draft-progress,.audit-summary,
  .audit-segment,.bulk-summary,.discussion-summary,.urgent-panel,.urgent-summary,
  .rich-empty,.calendar-empty,.deadline-empty-state,.assistant-empty,.message,
  .notice,.security-note,.storage-note,.draft-error,.split-suggestion,
  .scanner-result-card,.scanner-page-row,.scanner-pages-summary,
  .case-data-empty,.calendar-search-empty,.timeline-intro,.timeline-switch,
  .profile-section-card > .menu-row,.profile-section-card > .toggle-row,
  .notification-settings-card > .notification-setting-row,.preference-list > .preference-row,
  .profile-choice-list > button,.app-icon-option,.theme-option,.case-type-option,
  .document-case-option,.jurisdiction-options button,.text-size-options button,
  .sheet,.auth-card,.attachment-sheet,.calendar-event-form,.filter-sheet,
  .bulk-sheet,.timeline-sheet,.doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,.home-library-sheet,
  .calendar-event-discard-sheet,.calendar-case-match-dialog,.ios-date-wheel,
  .document-opening-toast,.toast,.undo-toast
):not([data-home-card],.profile-section-card,.notification-settings-card),
html[data-theme="light"] body #app .auth-cinematic .auth-card:not([hidden]),
html[data-theme="light"] body :is(
  .attachment-sheet,.calendar-event-form,.calendar-event-discard-sheet,
  .calendar-case-match-dialog,.ios-date-wheel,.filter-sheet,.bulk-sheet,.timeline-sheet,
  .doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,.home-library-sheet,
  .document-opening-toast,.toast,.undo-toast
) {
  background-image: var(--depth-light-finish);
}

/* User bubbles previously had white text on a solid accent. */
html[data-theme="light"] body #app .message.user { color: var(--text); }

/* Dark cards share Home's exact highlight, diagonal shade and raised edge.
   Paint only: nested group wrappers, controls, artwork and progress fills
   retain their own role. Selection/focus borders and text stay intact. */
html:not([data-theme="light"]) {
  --depth-dark-finish: radial-gradient(ellipse at 12% 0%, rgba(255,255,255,.10), transparent 62%),
    linear-gradient(165deg, rgba(255,255,255,.045), transparent 44%, rgba(0,0,0,.20));
}
html:not([data-theme="light"]) body :is(#app,#sheetRoot,.app-shell) :is(
  .auth-card,.card,.case-card,.profile-card,.profile-hero-card,.rec-card,.legal-news-card,.history-item,
  .home-library-item,.first-case-steps,.note-selected-case,.note-case-hint,
  .document-builder-ready,.notification-detail-case,.document-upload-settings > div,
  .case-material-context,.assistant-attachment,.calendar-ai-case-choices button,
  .case-type-current,.upload-case-current,.calendar-reminders-card,
  .calendar-title-field,.calendar-schedule-card,.calendar-case-row,.calendar-tag-row,.calendar-note-field,
  .article395-principal,.article395-dates label,.article395-empty,.article395-result,
  .case-category-empty,.case-category-picker-empty,
  .event,.calendar-event,.calendar-search-result,.task-row,.task-summary > div,.case-calendar-events > button,.storage-row,.plan-task-row,
  .plan-case-option,.split-confirmed,.document-part,.bulk-list,.scanner-recovery,
  .scanner-case-list > button,
  .document-row-surface,.smart-notification,.notification-detail-card,
  .result-card,.settings-card,.profile-copy,.about-app-card,.profile-info-panel,.profile-caution,
  .profile-account-readonly,.profile-photo-editor,.case-discussion-preview,
  .case-discussion-state,.case-recommendation-preview,.case-sections-editor,
  .case-attention-setting,.summary-field,.case-timeline-item,.timeline-hidden-item,.case-insight-progress,
  .system-notification-card,.storage-summary > div,.upload-zone,
  .upload-center-summary,.file-upload-progress-card,.material-job-card,.audio-material,
  .state-duty-result-group,.state-duty-price,.document-builder-intro,
  .draft-sources-card,.draft-list-row,.draft-checks,.draft-progress,.audit-summary,
  .audit-segment,.draft-error,.notice,.security-note,.storage-note,.split-suggestion,.bulk-summary,.discussion-summary,.urgent-panel,.urgent-summary,
  .rich-empty,.calendar-empty,.deadline-empty-state,.assistant-empty,.message,
  .scanner-result-card,.scanner-page-row,.scanner-pages-summary,
  .case-data-empty,.calendar-search-empty,.timeline-intro,.timeline-switch,
  .profile-section-card > .menu-row,.profile-section-card > .toggle-row,
  .notification-settings-card > .notification-setting-row,.preference-list > .preference-row,
  .profile-choice-list > button,.app-icon-option,.theme-option,.case-type-option,
  .document-case-option,.jurisdiction-options button,
  .sheet,.attachment-sheet,.calendar-event-form,.calendar-event-discard-sheet,.calendar-case-match-dialog,.ios-date-wheel,.filter-sheet,
  .bulk-sheet,.timeline-sheet,.doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,.home-library-sheet
):not([data-home-card]):not(.profile-section-card,.notification-settings-card):not(.swiping,.is-swiping,.dragging,.home-card-pressing,.home-card-dragging) {
  background-color: var(--panel) !important;
  background-image: var(--depth-dark-finish) !important;
  background-repeat: no-repeat;
}

html:not([data-theme="light"]) body :is(#app,#sheetRoot,.app-shell) :is(
  .auth-card,.card,.case-card,.profile-card,.profile-hero-card,.rec-card,.legal-news-card,.history-item,
  .home-library-item,.first-case-steps,.note-selected-case,.note-case-hint,
  .document-builder-ready,.notification-detail-case,.document-upload-settings > div,
  .case-material-context,.assistant-attachment,.calendar-ai-case-choices button,
  .case-type-current,.upload-case-current,.calendar-reminders-card,
  .calendar-title-field,.calendar-schedule-card,.calendar-case-row,.calendar-tag-row,.calendar-note-field,
  .article395-principal,.article395-dates label,.article395-empty,.article395-result,
  .case-category-empty,.case-category-picker-empty,
  .event,.calendar-event,.calendar-search-result,.task-row,.task-summary > div,.case-calendar-events > button,.storage-row,.plan-task-row,
  .plan-case-option,.split-confirmed,.document-part,.bulk-list,.scanner-recovery,
  .scanner-case-list > button,
  .document-row-surface,.smart-notification,.notification-detail-card,
  .result-card,.settings-card,.profile-copy,.about-app-card,.profile-info-panel,.profile-caution,
  .profile-account-readonly,.profile-photo-editor,.case-discussion-preview,
  .case-discussion-state,.case-recommendation-preview,.case-sections-editor,
  .case-attention-setting,.summary-field,.case-timeline-item,.timeline-hidden-item,.case-insight-progress,
  .system-notification-card,.storage-summary > div,.upload-zone,
  .upload-center-summary,.file-upload-progress-card,.material-job-card,.audio-material,
  .state-duty-result-group,.state-duty-price,.document-builder-intro,
  .draft-sources-card,.draft-list-row,.draft-checks,.draft-progress,.audit-summary,
  .audit-segment,.draft-error,.notice,.security-note,.storage-note,.split-suggestion,.bulk-summary,.discussion-summary,.urgent-panel,.urgent-summary,
  .rich-empty,.calendar-empty,.deadline-empty-state,.assistant-empty,.message,
  .scanner-result-card,.scanner-page-row,.scanner-pages-summary,
  .case-data-empty,.calendar-search-empty,.timeline-intro,.timeline-switch,
  .profile-section-card > .menu-row,.profile-section-card > .toggle-row,
  .notification-settings-card > .notification-setting-row,.preference-list > .preference-row,
  .profile-choice-list > button,.app-icon-option,.theme-option,.case-type-option,
  .document-case-option,.jurisdiction-options button,
  .sheet,.attachment-sheet,.calendar-event-form,.calendar-event-discard-sheet,.calendar-case-match-dialog,.ios-date-wheel,.filter-sheet,
  .bulk-sheet,.timeline-sheet,.doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,.home-library-sheet
):not([data-home-card]):not(.profile-section-card,.notification-settings-card):not(.swiping,.is-swiping,.dragging,.home-card-pressing,.home-card-dragging):not(:focus-visible,:active,.active,.selected,.error,.failed) { box-shadow: var(--depth-card); }

/* These panels are mounted directly under body by their modules. */
html:not([data-theme="light"]) body :is(
  .attachment-sheet,.calendar-event-form,.calendar-event-discard-sheet,
  .calendar-case-match-dialog,.ios-date-wheel,.filter-sheet,.bulk-sheet,
  .timeline-sheet,.doc-edit-sheet,.pdf-preview-sheet,.scan-quality-sheet,
  .home-library-sheet,.document-opening-toast,.toast,.undo-toast
) {
  background-color: var(--panel) !important;
  background-image: var(--depth-dark-finish) !important;
  background-repeat: no-repeat;
  box-shadow: var(--depth-dialog);
}

/* Document depth belongs to the translated surface, never the stationary
   swipe wrapper: actions must not share a visible card behind them. */
