/* Dently calm design system. One accent, neutral surfaces, semantic alerts. */
:root[data-dently-theme] {
  --ui-bg: #f3f5f7;
  --ui-card: #fff;
  --ui-raised: #f8fafb;
  --ui-inset: #ecf1f4;
  --ui-border: #dbe3e9;
  --ui-text: #142b3d;
  --ui-muted: #526879;
  --ui-accent: #087f73;
  --ui-accent-text: #086d62;
  --ui-accent-soft: #e6f3f0;
  --ui-on-accent: #fff;
  --ui-danger: #923f54;
  --ui-danger-soft: #faedf0;
  --ui-focus: #0b887c;
  --ui-shadow: 0 2px 7px #142b3d05;
  --ui-overlay: #10233366;
}
:root[data-dently-theme="dark"] {
  --ui-bg: #0f1724;
  --ui-card: #172333;
  --ui-raised: #1a293b;
  --ui-inset: #1d2d40;
  --ui-border: #304256;
  --ui-text: #e6eef5;
  --ui-muted: #a7b7c8;
  --ui-accent: #35c8b4;
  --ui-accent-text: #72dfce;
  --ui-accent-soft: #173d3d;
  --ui-on-accent: #092a29;
  --ui-danger: #f0a6b7;
  --ui-danger-soft: #3d2735;
  --ui-focus: #58d6c3;
  --ui-shadow: none;
  --ui-overlay: #020914b3;
}
html[data-dently-theme] body:has(.dashboard) {
  background: var(--ui-bg);
  color: var(--ui-text);
  color-scheme: light;
}
html[data-dently-theme="dark"] body:has(.dashboard) {
  color-scheme: dark;
}
.landing-v2 {
  color-scheme: light;
}
html[data-dently-theme] .dashboard {
  --navy: var(--ui-text);
  --text: var(--ui-text);
  --muted: var(--ui-muted);
  --line: var(--ui-border);
  --border: var(--ui-border);
  --teal-text: var(--ui-accent-text);
  --card-shadow: var(--ui-shadow);
  color: var(--ui-text);
}
html[data-dently-theme] .dashboard :is(.main, .dash-content) {
  background: var(--ui-bg) !important;
}
html[data-dently-theme] .dashboard :is(.sidebar, .topbar) {
  background: var(--ui-raised) !important;
  border-color: var(--ui-border) !important;
  backdrop-filter: none;
}
html[data-dently-theme]
  .dashboard
  :is(h1, h2, h3, h4, b, strong, .logo, .cell-primary, .patient-name-link) {
  color: var(--ui-text) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    p,
    small,
    label,
    dt,
    dd,
    time,
    .muted,
    .record-id,
    .cell-secondary,
    .cell-note,
    .stat-top,
    .stat-foot,
    .nav-label,
    .breadcrumb,
    .date-label,
    .patient-phone,
    .metric-caption,
    .agenda-doctor,
    .agenda-plan,
    .event-time,
    .event-foot,
    .chart-amount-label,
    .cash-chart-note,
    .queue-doctor,
    .queue-plan,
    .queue-timing,
    .queue-empty,
    .reception-count,
    .timeline-included,
    .report-toolbar,
    .footer-links,
    .demo-label
  ) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .dashboard a {
  color: var(--ui-accent-text);
}
html[data-dently-theme]
  .dashboard
  :is(
    .panel,
    .stat,
    .insight-stat,
    .account-metric,
    .patient-card,
    .treatment-plan-card,
    .calendar-board,
    .calendar-agenda,
    .plans-empty-state,
    .workspace-status-card,
    .plan-reminder-card,
    .profile-plan-prompt,
    .section-visual-header,
    .records-toolbar,
    .clinic-hero,
    .reception-entry,
    .queue-column,
    .followup-card,
    .timeline-event > div,
    .team-card,
    .audit-list article,
    .platform-clinics article
  ) {
  background: var(--ui-card) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 14px;
  box-shadow: var(--ui-shadow) !important;
  color: var(--ui-text);
}
html[data-dently-theme]
  .dashboard
  :is(
    .stat-decoration,
    .stat-sparkline,
    .section-visual-header:after,
    .records-toolbar:after,
    .patient-card:before,
    .account-metric:before,
    .account-metric:after,
    .clinical-orbit,
    .hero-visual-grid
  ) {
  display: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .workspace,
    .help-card,
    .settings-readonly,
    .clinical-note,
    .patient-information dl > div,
    .plan-budget,
    .plan-payment-split,
    .patient-card-account,
    .chart-top,
    .appointment-filters,
    .finance-note,
    .operation-hint,
    .contact-note,
    .trial-info,
    .reception-filters,
    .calendar-filterbar,
    .agenda-tip,
    .restore-section #restore-preview,
    .import-preview,
    .permission-guide,
    .leave-row,
    .receipt-net,
    .queue-timing,
    .activity-item,
    .collection-item,
    .home-visit,
    .agenda-item,
    .followup-actions button,
    .followup-actions a
  ) {
  background: var(--ui-raised) !important;
  border-color: var(--ui-border) !important;
  box-shadow: none !important;
  color: var(--ui-text);
}
html[data-dently-theme]
  .dashboard
  :is(
    .iconbox,
    .large-section-icon,
    .plan-symbol,
    .collection-icon,
    .timeline-icon,
    .workspace-status-icon,
    .queue-symbol,
    .plans-empty-icon,
    .reception-entry > span,
    .summary-icon,
    .summary-icon svg
  ) {
  background: var(--ui-inset) !important;
  color: var(--ui-accent-text) !important;
  border-color: var(--ui-border) !important;
  box-shadow: none !important;
  transform: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .large-section-icon svg,
    .clinic-settings-panel .panel-title > svg,
    .backup-panel .panel-title > svg
  ) {
  stroke: var(--ui-accent-text) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .panel-title,
    .stat-foot,
    .patient-card-counts,
    .patient-information dl > div,
    .collection-item,
    .receipt-details > div,
    .restore-section,
    .followup-actions,
    .plan-installments
  ) {
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard .panel-title h2 > svg {
  background: transparent !important;
  border-radius: 0;
  padding: 0 !important;
  width: 19px !important;
  height: 19px !important;
  stroke: var(--ui-accent-text) !important;
  box-sizing: border-box;
}
html[data-dently-theme]
  .dashboard
  :is(
    .btn,
    .row-menu,
    .text-action,
    .panel-title button,
    .panel-title select,
    .table-tools button,
    .queue-actions button,
    .queue-actions a,
    .plan-card-actions button,
    .patient-open,
    .backup-download,
    .restore-file-label,
    .workflow-shortcuts > button,
    .workflow-shortcuts > a
  ) {
  background: var(--ui-card) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: none !important;
  border-radius: 9px;
}
html[data-dently-theme]
  .dashboard
  :is(.btn.primary, .primary, .queue-actions button:first-child) {
  background: var(--ui-accent) !important;
  color: var(--ui-on-accent) !important;
  border-color: transparent !important;
}
html[data-dently-theme]
  .dashboard
  :is(.btn.primary, .primary)
  :is(span, small, b, strong, svg) {
  color: inherit !important;
  stroke: currentColor;
}
html[data-dently-theme] .dashboard :is(button, a.btn):hover {
  filter: none;
  box-shadow: none;
}
html[data-dently-theme]
  .dashboard
  :is(.btn.outline, .row-menu, .panel-title button, .patient-open):hover {
  background: var(--ui-inset) !important;
}
html[data-dently-theme] .dashboard .side-nav button {
  color: var(--ui-muted) !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
  min-height: 44px;
  border-radius: 9px;
}
html[data-dently-theme] .dashboard .side-nav button.active {
  color: var(--ui-accent-text) !important;
  background: var(--ui-accent-soft) !important;
  border-color: transparent !important;
}
html[data-dently-theme] .dashboard .side-nav button.active svg {
  stroke: var(--ui-accent-text) !important;
}
html[data-dently-theme] .dashboard .side-nav button:hover {
  background: var(--ui-inset) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.count, .number-pill, .queue-column > header > b) {
  background: var(--ui-inset) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard :is(input, select, textarea) {
  background: var(--ui-raised) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
  box-shadow: none;
}
html[data-dently-theme] .dashboard :is(input, textarea)::placeholder {
  color: var(--ui-muted) !important;
  opacity: 1;
}
html[data-dently-theme] .dashboard .searchbox {
  background: var(--ui-inset) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard .searchbox input {
  background: transparent !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .icon-button,
    .mobile-menu,
    .sidebar-dismiss,
    .queue-open,
    .calendar-navigation button,
    .calendar-today
  ) {
  background: var(--ui-raised) !important;
  color: var(--ui-muted) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard :is(.avatar, .profile-avatar) {
  background: var(--ui-accent-soft) !important;
  color: var(--ui-accent-text) !important;
  border-color: var(--ui-border) !important;
  box-shadow: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(.profile-tabs, .today-tabs, .cloud-settings-tabs, .calendar-view-switch) {
  background: var(--ui-inset) !important;
  border-color: var(--ui-border) !important;
  box-shadow: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .profile-tabs button,
    .today-tabs a,
    .cloud-settings-tabs button,
    .calendar-view-switch button,
    .timeline-filters button,
    .action-report-tabs button
  ) {
  background: transparent !important;
  color: var(--ui-muted) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .profile-tabs button.active,
    .today-tabs a.active,
    .cloud-settings-tabs button.active,
    .calendar-view-switch button.active,
    .timeline-filters button.active,
    .action-report-tabs button.active
  ) {
  background: var(--ui-card) !important;
  color: var(--ui-accent-text) !important;
  border-color: var(--ui-border) !important;
  box-shadow: var(--ui-shadow) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .profile-tabs button.active,
    .today-tabs a.active,
    .cloud-settings-tabs button.active,
    .action-report-tabs button.active
  )
  :is(svg, span, b) {
  color: var(--ui-accent-text) !important;
  stroke: currentColor !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .status,
    .status.wait,
    .status.done,
    .workflow-status,
    .included-label,
    .linked-plan,
    .fixed-price-label,
    .receipt-stamp
  ) {
  background: var(--ui-inset) !important;
  color: var(--ui-muted) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 20px;
}
html[data-dently-theme]
  .dashboard
  :is(.status.completed, .status.done, .status.arrived) {
  background: var(--ui-accent-soft) !important;
  color: var(--ui-accent-text) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.status.absent, .status.cancelled, .refund-action, .negative-money) {
  background: var(--ui-danger-soft) !important;
  color: var(--ui-danger) !important;
  border-color: transparent !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .paid-money,
    .due-money,
    .money-cell,
    .stat-value,
    .patient-card-account strong,
    .patient-card-account small,
    .timeline-amount
  ) {
  color: var(--ui-text) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .patient-card-counts > span,
    .workflow-shortcuts > button > span,
    .workflow-shortcuts > a > span
  ) {
  background: var(--ui-inset) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .dashboard .workflow-shortcuts > :hover,
html[data-dently-theme] .dashboard .patient-card:hover {
  transform: none !important;
  background: var(--ui-raised) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .queue-column > header,
    .calendar-toolbar,
    .week-heading,
    .month-daynames
  ) {
  background: var(--ui-raised) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .queue-card,
    .month-cell,
    .week-day-column,
    .week-day-column.today-column,
    .home-visit,
    .notification-item,
    .search-result,
    .global-search-results
  ) {
  background: var(--ui-card) !important;
  border-color: var(--ui-border) !important;
  box-shadow: none !important;
}
html[data-dently-theme] .dashboard :is(.queue-empty, .queue-empty span) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.queue-empty svg, .time-gutter, .time-gutter > span, .outside-month) {
  background: var(--ui-inset) !important;
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.week-day-title, .time-slot, .month-cell, .week-day-column) {
  border-color: var(--ui-border) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .week-day-title > span,
    .week-day-title small,
    .week-day-title > button,
    .event-time,
    .event-foot,
    .timezone-label
  ) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .dashboard :is(.today-heading, .month-cell.is-today) {
  background: var(--ui-accent-soft) !important;
}
html[data-dently-theme] .dashboard .today-heading > button {
  background: var(--ui-accent) !important;
  color: var(--ui-on-accent) !important;
}
html[data-dently-theme] .dashboard .calendar-event {
  background: var(--ui-accent-soft) !important;
  border-color: var(--ui-border) !important;
  border-right-color: var(--ui-accent) !important;
  box-shadow: none !important;
}
html[data-dently-theme]
  .dashboard
  .calendar-event
  :is(strong, small, .event-time, .event-foot) {
  color: var(--ui-accent-text) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.calendar-event.is-complete, .calendar-event.is-moved) {
  background: var(--ui-inset) !important;
  border-right-color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.calendar-event.is-complete, .calendar-event.is-moved)
  :is(strong, small, .event-time, .event-foot) {
  color: var(--ui-text) !important;
}
html[data-dently-theme] .dashboard table {
  background: var(--ui-card) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
}
html[data-dently-theme] .dashboard :is(table thead, table th) {
  background: var(--ui-inset) !important;
  color: var(--ui-muted) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard table tbody tr {
  background: var(--ui-card) !important;
}
html[data-dently-theme] .dashboard table tbody tr:nth-child(even) {
  background: var(--ui-raised) !important;
}
html[data-dently-theme] .dashboard table tbody tr:hover {
  background: var(--ui-inset) !important;
}
html[data-dently-theme] .dashboard table td {
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard :is(.cash-positive, .chart-bars) {
  border-color: var(--ui-border) !important;
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 34px,
    var(--ui-border) 35px
  ) !important;
}
html[data-dently-theme] .dashboard .cash-positive i {
  background: var(--ui-accent) !important;
}
html[data-dently-theme] .dashboard .cash-positive i:nth-child(2) {
  background: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard .cash-negative i {
  background: var(--ui-danger) !important;
}
html[data-dently-theme] .dashboard .cash-day > span {
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.completion-ring > div, .completion-ring:before) {
  background: var(--ui-card) !important;
}
html[data-dently-theme] .dashboard .section-visual-header {
  min-height: 100px;
  padding: 20px 24px;
}
html[data-dently-theme] .dashboard .section-visual-header h2 {
  font-size: 23px;
}
html[data-dently-theme] .dashboard .large-section-icon {
  height: 44px;
  width: 44px;
  border-radius: 11px;
}
html[data-dently-theme] .dashboard .large-section-icon svg {
  height: 24px;
  width: 24px;
}
/* Patient profile: clear identity, clinical context, one financial overview. */
html[data-dently-theme] .calm-patient .profile-header {
  padding: 24px;
  margin-bottom: 12px;
  min-height: 0;
}
html[data-dently-theme] .calm-patient .profile-identity h2 {
  font-size: 26px;
  line-height: 1.6;
}
html[data-dently-theme] .calm-patient .profile-avatar {
  height: 58px;
  width: 58px;
  border-radius: 16px;
  border-width: 1px;
  font-size: 26px;
}
html[data-dently-theme] .calm-patient .profile-back {
  font-size: 14px;
  margin-bottom: 15px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
html[data-dently-theme] .calm-patient .patient-summary {
  position: static;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--ui-raised) !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: none !important;
  border-radius: 11px;
  gap: 0;
  margin: 0 0 22px;
  overflow: hidden;
}
html[data-dently-theme] .calm-patient .patient-summary > div {
  background: transparent !important;
  min-width: 0;
  max-width: none;
  flex-shrink: 1;
  border-left: 1px solid var(--ui-border);
  padding: 15px 18px;
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .calm-patient .patient-summary > div:last-child {
  border-left: 0;
}
html[data-dently-theme] .calm-patient .patient-summary strong {
  font-size: 14px;
  color: var(--ui-text) !important;
  max-height: none;
  overflow: visible;
  margin-top: 5px;
  font-weight: 500;
}
html[data-dently-theme] .calm-patient .patient-summary .has-clinical-alert {
  background: var(--ui-danger-soft) !important;
}
html[data-dently-theme]
  .calm-patient
  .patient-summary
  .has-clinical-alert
  :is(strong, svg) {
  color: var(--ui-danger) !important;
}
html[data-dently-theme] .calm-patient .calm-financial-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  background: var(--ui-card);
  border: 1px solid var(--ui-border);
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 23px;
}
html[data-dently-theme] .calm-patient .calm-financial-summary .account-metric {
  background: transparent !important;
  border: 0 !important;
  border-left: 1px solid var(--ui-border) !important;
  border-radius: 0;
  box-shadow: none !important;
  padding: 22px;
  gap: 14px;
}
html[data-dently-theme]
  .calm-patient
  .calm-financial-summary
  .account-metric:last-child {
  border-left: 0 !important;
}
html[data-dently-theme] .calm-patient .account-metric .metric-caption {
  display: none;
}
html[data-dently-theme] .calm-patient .account-metric strong {
  font-size: 26px;
  letter-spacing: 0;
}
html[data-dently-theme] .calm-patient .account-metric .iconbox {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: transparent !important;
  border: 0 !important;
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .calm-patient .profile-tabs {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ui-border) !important;
  border-radius: 0;
  padding: 0 0 10px;
  gap: 5px;
}
html[data-dently-theme] .calm-patient .profile-tabs button {
  padding: 10px 13px;
  border-radius: 8px;
  font-size: 14px;
}
html[data-dently-theme] .calm-patient .profile-tabs button.active {
  background: var(--ui-accent-soft) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
html[data-dently-theme] .calm-patient .profile-plan-prompt {
  padding: 18px 20px;
  border-style: solid;
  margin-bottom: 23px;
  background: var(--ui-raised) !important;
}
html[data-dently-theme] .calm-patient .profile-plan-prompt > svg {
  color: var(--ui-muted);
  stroke: currentColor;
}
/* Menus and dialogs share the same surfaces, including their native controls. */
html[data-dently-theme] .appearance-control {
  position: relative;
  flex-shrink: 0;
}
html[data-dently-theme] #appearance-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--ui-card);
  color: var(--ui-muted);
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  font:
    500 13px "IBM Plex Sans Arabic",
    sans-serif;
  white-space: nowrap;
}
#appearance-switch svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
html[data-dently-theme] #appearance-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 100;
  width: 215px;
  padding: 12px;
  background: var(--ui-card);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  border-radius: 13px;
  box-shadow: 0 12px 35px #0002;
}
html[data-dently-theme] #appearance-menu > strong {
  font-size: 14px;
  display: block;
  padding: 4px 8px 11px;
}
html[data-dently-theme] #appearance-menu [data-appearance] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 11px;
  min-height: 43px;
  font:
    500 14px "IBM Plex Sans Arabic",
    sans-serif;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ui-muted);
}
#appearance-menu [data-appearance] > span {
  visibility: hidden;
}
html[data-dently-theme] #appearance-menu [aria-pressed="true"] {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}
#appearance-menu [aria-pressed="true"] > span {
  visibility: visible;
}
html[data-dently-theme] #appearance-menu p {
  font-size: 12px;
  line-height: 1.8;
  border-top: 1px solid var(--ui-border);
  padding: 10px 8px 0;
  margin: 10px 0 2px;
  color: var(--ui-muted);
}
html[data-dently-theme] body:has(.dashboard) dialog {
  background: var(--ui-card) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: 0 24px 80px #0003;
  color-scheme: inherit;
}
html[data-dently-theme] body:has(.dashboard) dialog::backdrop {
  background: var(--ui-overlay);
  backdrop-filter: blur(3px);
}
html[data-dently-theme] body:has(.dashboard) dialog :is(h2, h3, b, strong) {
  color: var(--ui-text) !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(p, small, label, dt, dd, span, .eyebrow) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(input, select, textarea) {
  background: var(--ui-raised) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
  font-size: 16px;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(input, textarea)::placeholder {
  color: var(--ui-muted) !important;
  opacity: 1;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(
    .appointment-contract,
    .appointment-contract.neutral,
    .appointment-person,
    .appointment-history,
    .visit-account-mini > div,
    .finish-financial,
    .finish-balance,
    .visit-completion-result,
    .form-balance,
    .booking-plan-note,
    .operation-hint,
    .next-session-block,
    .adjustment-history article,
    .receipt-sheet,
    .receipt-amount,
    .receipt-net,
    .installment-edit-row
  ) {
  background: var(--ui-raised) !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text) !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(.btn, .text-action, .close, .followup-presets > button, .receipt-stamp) {
  background: var(--ui-inset) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] body:has(.dashboard) dialog .btn.primary {
  background: var(--ui-accent) !important;
  color: var(--ui-on-accent) !important;
  border-color: transparent !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  .btn.primary
  :is(span, small, svg) {
  color: inherit !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  :is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--ui-focus) !important;
  outline-offset: 3px;
}
html[data-dently-theme] .dashboard :is(.dental-chart, .tooth-row) {
  background: var(--ui-raised) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard .tooth-item > span {
  color: var(--ui-text) !important;
}
html[data-dently-theme="dark"] .dashboard .tooth-item {
  background: var(--ui-inset);
  border-color: var(--ui-border);
}
html[data-dently-theme] .dashboard :is(.jaw-label, .tooth-legend span) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .dashboard .tooth-item:hover {
  transform: translateY(-2px);
}
html[data-dently-theme] .dashboard .patient-timeline:before {
  background: var(--ui-border);
}
html[data-dently-theme]
  .dashboard
  :is(
    .legend,
    .calendar-quick-summary,
    .calendar-key,
    .timeline-event header,
    .completion-counts,
    .plan-installments,
    .leave-row,
    .settings-readonly > span,
    .settings-readonly b
  ) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme] .dashboard .subscription-warning {
  background: var(--ui-danger-soft) !important;
  color: var(--ui-danger) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard :is(.trial-info, .cloud-sync) {
  background: var(--ui-accent-soft) !important;
  color: var(--ui-accent-text) !important;
  border-color: var(--ui-border) !important;
}
@media (max-width: 1100px) {
  html[data-dently-theme] .calm-patient .account-metric strong {
    font-size: 23px;
  }
  html[data-dently-theme]
    .calm-patient
    .calm-financial-summary
    .account-metric {
    padding: 18px 15px;
    gap: 8px;
  }
}
@media (max-width: 760px) {
  #appearance-switch > span {
    display: none;
  }
  html[data-dently-theme] #appearance-switch {
    height: 38px;
    min-width: 36px;
    padding: 7px;
  }
  html[data-dently-theme] .dashboard .top-actions {
    gap: 7px;
    min-width: 0;
  }
  html[data-dently-theme] .dashboard .searchbox {
    flex: 1;
    min-width: 0;
  }
  html[data-dently-theme] .dashboard .searchbox input {
    width: 100%;
    min-width: 0;
  }
  html[data-dently-theme] #appearance-menu {
    position: fixed;
    top: 65px;
    left: 14px;
    right: 14px;
    width: auto;
    max-width: 340px;
    margin-left: auto;
  }
  html[data-dently-theme] .calm-patient .profile-header {
    padding: 19px;
    margin-bottom: 12px;
    gap: 18px;
  }
  html[data-dently-theme] .calm-patient .profile-identity h2 {
    font-size: 23px;
  }
  html[data-dently-theme] .calm-patient .profile-avatar {
    height: 47px;
    width: 47px;
    font-size: 23px;
    border-radius: 13px;
  }
  html[data-dently-theme] .calm-patient .profile-actions {
    gap: 7px;
    flex-wrap: wrap;
    width: 100%;
  }
  html[data-dently-theme] .calm-patient .profile-actions .btn {
    font-size: 13px;
    min-height: 41px;
    padding: 9px 10px;
    flex: 1;
  }
  html[data-dently-theme] .calm-patient .patient-summary {
    grid-template-columns: 1fr;
    gap: 0;
  }
  html[data-dently-theme] .calm-patient .patient-summary > div {
    padding: 12px 15px;
    border-left: 0;
    border-bottom: 1px solid var(--ui-border);
    align-items: center;
    gap: 12px;
  }
  html[data-dently-theme] .calm-patient .patient-summary > div:last-child {
    border-bottom: 0;
  }
  html[data-dently-theme] .calm-patient .patient-summary > div > span {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    flex: 1;
    font-size: 12px;
  }
  html[data-dently-theme] .calm-patient .patient-summary strong {
    margin: 0;
    font-size: 13px;
  }
  html[data-dently-theme] .calm-patient .patient-summary svg {
    height: 18px;
    width: 18px;
  }
  html[data-dently-theme] .calm-patient .calm-financial-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  html[data-dently-theme]
    .calm-patient
    .calm-financial-summary
    .account-metric {
    padding: 16px 10px;
    display: block;
    text-align: center;
    min-width: 0;
  }
  html[data-dently-theme] .calm-patient .account-metric .iconbox {
    display: none;
  }
  html[data-dently-theme] .calm-patient .account-metric > div > span {
    font-size: 12px;
    min-height: 42px;
    line-height: 1.8;
    margin-bottom: 8px;
  }
  html[data-dently-theme] .calm-patient .account-metric strong {
    font-size: 18px;
    white-space: normal;
    overflow-wrap: anywhere;
    display: block;
  }
  html[data-dently-theme] .calm-patient .account-metric strong small {
    font-size: 12px;
    display: block;
    margin-top: 3px;
  }
  html[data-dently-theme] .calm-patient .profile-tabs {
    gap: 3px;
    margin-bottom: 20px;
  }
  html[data-dently-theme] .calm-patient .profile-tabs button {
    font-size: 13px;
    padding: 9px 11px;
    min-height: 42px;
  }
  html[data-dently-theme] .calm-patient .profile-plan-prompt {
    padding: 16px;
    gap: 12px;
  }
  html[data-dently-theme] .dashboard .section-visual-header {
    padding: 18px;
    min-height: 92px;
  }
  html[data-dently-theme] .dashboard .section-visual-header h2 {
    font-size: 21px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .dashboard :is(button, a.btn, input, select, textarea) {
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease,
      color 0.15s ease;
  }
  .appearance-control #appearance-menu {
    animation: appearance-in 0.12s ease-out;
  }
  @keyframes appearance-in {
    from {
      opacity: 0;
      transform: translateY(-3px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
/* Explicit selectors keep legacy decorative pseudo-elements out of work surfaces. */
html[data-dently-theme] .dashboard .account-metric::before,
html[data-dently-theme] .dashboard .account-metric::after,
html[data-dently-theme] .dashboard .treatment-plan-card::before,
html[data-dently-theme] .dashboard .treatment-plan-card::after,
html[data-dently-theme] .dashboard .help-card::before,
html[data-dently-theme] .dashboard .help-card::after {
  display: none !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .clinic-hero h2 span,
    .hero-ghost-button,
    .patient-card-account > span,
    .workspace-status-card span,
    .completion-ring span,
    .plan-money span,
    .plan-progress span,
    .plan-progress-label span,
    .time-gutter span,
    .agenda-time span,
    .day-agenda h3,
    .calendar-day-heading
  ) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(.treatment-plan-card span, .day-agenda h3, .time-slot span) {
  color: var(--ui-muted) !important;
}
html[data-dently-theme]
  .dashboard
  :is(
    .help-card button,
    .date-label,
    .activity-item strong,
    .action-report-tabs b
  ) {
  background: var(--ui-inset) !important;
  color: var(--ui-text) !important;
  border-color: var(--ui-border) !important;
}
html[data-dently-theme] .dashboard .action-report-tabs .active b {
  background: var(--ui-accent-soft) !important;
  color: var(--ui-accent-text) !important;
}
html[data-dently-theme]
  body:has(.dashboard)
  dialog
  :is(.receipt-notes, .receipt-footer) {
  background: var(--ui-raised) !important;
  color: var(--ui-muted) !important;
}
html[data-dently-theme] body:has(.dashboard) dialog .form-error {
  background: var(--ui-danger-soft) !important;
  color: var(--ui-danger) !important;
}
html[data-dently-theme] .dashboard .sidebar {
  min-height: 100vh;
}
html[data-dently-theme]
  .dashboard
  :is(.agenda-title span, .agenda-item-head span, .report-toolbar h3 span) {
  color: var(--ui-muted) !important;
}
@media (max-width: 760px) {
  html[data-dently-theme] .dashboard .sidebar:not(.open) {
    visibility: hidden;
    box-shadow: none !important;
  }
  html[data-dently-theme] .dashboard .sidebar.open {
    visibility: visible;
  }
}
@media print {
  html[data-dently-theme] body:has(.receipt-dialog[open]) dialog,
  html[data-dently-theme] body:has(.receipt-dialog[open]) .receipt-sheet {
    background: #fff !important;
    color: #142b3d !important;
  }
  html[data-dently-theme]
    body:has(.receipt-dialog[open])
    dialog
    :is(h2, h3, b, strong, p, span, small, dt, dd) {
    color: #142b3d !important;
  }
}
