/* Final light-mode audit.
   This layer intentionally loads after every feature stylesheet so dark legacy values cannot
   leak into the light theme. It only changes presentation; feature ownership stays in JS. */

html[data-rift-effective-theme='light'] {
  --rift-light-canvas:#f4f5f7;
  --rift-light-panel:#eceff2;
  --rift-light-panel-strong:#e3e7eb;
  --rift-light-surface:#ffffff;
  --rift-light-surface-hover:#e8ebef;
  --rift-light-surface-active:#dde2e7;
  --rift-light-border:#cbd1d8;
  --rift-light-border-soft:#d9dee4;
  --rift-light-text:#161a20;
  --rift-light-text-2:#343a43;
  --rift-light-muted:#5f6874;
  --rift-light-muted-2:#7d8692;
  --rift-light-shadow:0 14px 38px rgba(26,31,38,.16);
}

/* Stronger contrast for ordinary text/icons throughout the light shell. */
html[data-rift-effective-theme='light'] :is(
  .channel-name,.member-copy strong,.dm-item-copy strong,.social-copy strong,.message-author,
  .current-user-copy strong,.content-header strong,.home-section-title strong,.channel-intro h2,
  .r021-home-title,.r021-friend-count,.r021-active-user strong,.member-panel-heading strong,
  .voice-member-row span:nth-child(2),.r021-server-utility span
) { color:var(--rift-light-text) !important; }

html[data-rift-effective-theme='light'] :is(
  .channel-category-title,.r021-category-label,.member-group-title,.member-copy>span,.dm-item-copy span,
  .social-copy span,.message-time,.typing-bar,.channel-intro p,.home-section-title span,.r021-active-user span,
  .content-header #channel-topic,.server-header-kicker,.r021-server-utility small,.empty-dm
) { color:var(--rift-light-muted) !important; }

html[data-rift-effective-theme='light'] :is(
  .channel-symbol-small,.channel-manage,.r021-header-tool,.content-header .icon-button,.composer-action,
  .ui0212-composer-tools button,.quick-user-controls button,#ui0212-user-controls button,#settings-button,
  .voice-member-row i,.r021-server-utility svg,.section-heading button
) { color:#48515c !important; }

html[data-rift-effective-theme='light'] :is(
  .channel-manage:hover,.r021-header-tool:hover:not(:disabled),.content-header .icon-button:hover,
  .composer-action:hover,.ui0212-composer-tools button:hover:not(:disabled),.section-heading button:hover
) { color:var(--rift-light-text) !important; background:var(--rift-light-surface-active) !important; }

/* Message rows and the floating message toolbar were still using dark-mode literals. */
html[data-rift-effective-theme='light'] .message:hover,
html[data-rift-effective-theme='light'] .message:focus-within,
html[data-rift-effective-theme='light'] .message.r021-hover,
html[data-rift-effective-theme='light'] .message.ui0213-hover {
  background:#e6e9ed !important;
}
html[data-rift-effective-theme='light'] :is(.message-actions,.ui0213-message-toolbar,.ui0213-message-menu) {
  background:var(--rift-light-surface) !important;
  color:var(--rift-light-text-2) !important;
  border:1px solid var(--rift-light-border) !important;
  box-shadow:var(--rift-light-shadow) !important;
}
html[data-rift-effective-theme='light'] :is(.message-actions,.ui0213-message-toolbar) button,
html[data-rift-effective-theme='light'] .ui0213-message-menu .quick button {
  background:transparent !important;
  color:#424b56 !important;
  border-color:transparent !important;
}
html[data-rift-effective-theme='light'] :is(.message-actions,.ui0213-message-toolbar) button:hover,
html[data-rift-effective-theme='light'] .ui0213-message-menu .quick button:hover {
  background:var(--rift-light-surface-hover) !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] .ui0213-message-menu .divider {
  background:var(--rift-light-border-soft) !important;
}

/* Tooltips are theme-aware too. Native server-name tooltips are disabled by tooltip-guard.js. */
html[data-rift-effective-theme='light'] .ui0212-tip {
  background:#ffffff !important;
  color:#171b21 !important;
  border:1px solid #cbd1d8 !important;
  box-shadow:0 7px 22px rgba(25,30,37,.18) !important;
}

/* Composer and all icon affordances. */
html[data-rift-effective-theme='light'] .composer {
  background:#ffffff !important;
  border-color:#ccd2d9 !important;
  box-shadow:0 1px 0 rgba(255,255,255,.7),0 2px 8px rgba(31,36,43,.05) !important;
}
html[data-rift-effective-theme='light'] .composer textarea {
  background:transparent !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] .composer textarea::placeholder { color:#7a838e !important; }
html[data-rift-effective-theme='light'] .ui0212-composer-tools,
html[data-rift-effective-theme='light'] .ui0212-composer-tools button,
html[data-rift-effective-theme='light'] .composer-action {
  background:transparent !important;
}
html[data-rift-effective-theme='light'] .send-button {
  color:#ffffff !important;
}

/* One canonical compact server profile: #r021-ref-profile. The older #r021-profile is retired. */
html body #r021-profile.profile-popout { display:none !important; }
#r021-ref-profile.r021-profile-card .r021-profile-avatar { cursor:default !important; }
#r021-ref-profile.r021-profile-card .r021-profile-avatar,
#r021-ref-profile.r021-profile-card .r021-profile-avatar * { pointer-events:none !important; }

html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#c8ced6 !important;
  box-shadow:0 18px 46px rgba(28,33,40,.18) !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-body {
  background:#ffffff !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-avatar {
  border-color:#ffffff !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-avatar>.r021-profile-presence,
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-avatar>.rift-server-profile-presence {
  --rift-presence-cutout:#ffffff !important;
  border-color:#ffffff !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-name {
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-user,
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-section h4 {
  color:#57616d !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-section p,
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-custom {
  color:#2d343d !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-custom {
  background:#f1f3f5 !important;
  border-color:#d2d7dd !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-role {
  background:#e7eaee !important;
  color:#303741 !important;
  border:1px solid #d0d6dd !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-actions button,
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-actions button.secondary {
  background:#ffffff !important;
  color:#252b33 !important;
  border:1px solid #c7cdd5 !important;
  box-shadow:0 2px 7px rgba(24,29,36,.12) !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-actions button:hover:not(:disabled) {
  background:#e7eaee !important;
  color:#15191e !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-menu {
  background:#f1f3f5 !important;
  border-color:#d1d7de !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-menu button {
  color:#303741 !important;
}
html[data-rift-effective-theme='light'] #r021-ref-profile.r021-profile-card .r021-profile-menu button:hover:not(:disabled) {
  background:#e2e6ea !important;
  color:#171b21 !important;
}

/* Full profile remains available from the DM profile only and must obey the selected theme. */
html[data-rift-effective-theme='light'] .rift-full-profile-backdrop {
  background:rgba(45,51,60,.28) !important;
}
html[data-rift-effective-theme='light'] .rift-full-profile,
html[data-rift-effective-theme='light'] .rift-full-profile-summary,
html[data-rift-effective-theme='light'] .rift-full-profile-detail,
html[data-rift-effective-theme='light'] .rift-full-profile-summary-body {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#d1d7de !important;
}
html[data-rift-effective-theme='light'] .rift-full-profile-avatar { border-color:#ffffff !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-presence { --rift-presence-cutout:#ffffff !important; border-color:#ffffff !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-username,
html[data-rift-effective-theme='light'] .rift-full-profile section h4,
html[data-rift-effective-theme='light'] .rift-full-profile-empty span { color:#606a76 !important; }
html[data-rift-effective-theme='light'] .rift-full-profile section p,
html[data-rift-effective-theme='light'] .rift-full-profile-empty strong { color:#2a313a !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-tabs { border-color:#d5dae0 !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-tabs button { color:#59636f !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-tabs button.active { color:var(--rift-light-text) !important; }
html[data-rift-effective-theme='light'] .rift-full-profile-note button,
html[data-rift-effective-theme='light'] .rift-full-profile-roles span {
  background:#e9edf0 !important;
  color:#303741 !important;
  border-color:#d0d6dd !important;
}

/* DM profile panel and the View Full Profile action. */
html[data-rift-effective-theme='light'] :is(.ui0212-dm-profile,.parity-dm-side) {
  background:#eef0f3 !important;
  color:var(--rift-light-text) !important;
  border-color:#d2d7dd !important;
}
html[data-rift-effective-theme='light'] :is(.ui0212-dm-body,.parity-dm-side-body) h2 { color:var(--rift-light-text) !important; }
html[data-rift-effective-theme='light'] :is(.ui0212-dm-username,.parity-dm-side-body>span) { color:#59636f !important; }
html[data-rift-effective-theme='light'] .rift-dm-view-full,
html[data-rift-effective-theme='light'] .ui0212-dm-message {
  background:#ffffff !important;
  color:#20262d !important;
  border:1px solid #c9cfd7 !important;
  box-shadow:none !important;
}
html[data-rift-effective-theme='light'] .rift-dm-view-full:hover,
html[data-rift-effective-theme='light'] .ui0212-dm-message:hover {
  background:#e2e6ea !important;
  color:#11151a !important;
}
html[data-rift-effective-theme='light'] .rift-dm-profile-top-actions button {
  background:#ffffff !important;
  color:#2d343d !important;
  border:1px solid #c9cfd7 !important;
  box-shadow:0 2px 7px rgba(24,29,36,.11) !important;
}
html[data-rift-effective-theme='light'] .rift-dm-profile-top-actions button:hover:not(:disabled) {
  background:#e4e8ec !important;
  color:#15191e !important;
}

/* User/self cards and presence menus. */
html[data-rift-effective-theme='light'] :is(.ui0212-self-card,.ui0211-self-card,.parity-self-card,.status-popout,.r021-status-menu,.ui0212-status-menu,.parity-status-menu) {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#cbd1d8 !important;
  box-shadow:var(--rift-light-shadow) !important;
}
html[data-rift-effective-theme='light'] :is(.ui0212-self-body,.ui0211-self-body,.parity-self-body) { background:#ffffff !important; }
html[data-rift-effective-theme='light'] :is(.ui0212-self-avatar,.ui0211-self-avatar,.parity-self-avatar) { border-color:#ffffff !important; }
html[data-rift-effective-theme='light'] :is(.ui0212-self-user,.ui0211-self-user,.parity-self-user,.status-profile-row small,.r021-status-option small,.ui0212-status-menu small,.parity-status-item small) { color:#65707c !important; }
html[data-rift-effective-theme='light'] :is(.ui0212-self-card button,.ui0211-self-card button,.parity-self-card button,.status-option,.status-custom-action,.r021-status-option,.ui0212-status-menu button,.parity-status-item) {
  color:#333b45 !important;
  border-color:#d3d8de !important;
}
html[data-rift-effective-theme='light'] :is(.ui0212-self-card button,.ui0211-self-card button,.parity-self-card button) { background:#eef1f4 !important; }
html[data-rift-effective-theme='light'] :is(.ui0212-self-card button,.ui0211-self-card button,.parity-self-card button,.status-option,.status-custom-action,.r021-status-option,.ui0212-status-menu button,.parity-status-item):hover:not(:disabled) {
  background:#e1e5e9 !important;
  color:#15191e !important;
}

/* Friends, member list and server/channel navigation hover states. */
html[data-rift-effective-theme='light'] :is(.member-item:hover,.voice-member-row:hover,.social-row:hover,.dm-item:hover,.channel-item:hover,.home-nav-item:hover) {
  background:#e2e6ea !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] :is(.member-item,.voice-member-row,.social-row,.dm-item,.channel-item,.home-nav-item) {
  border-color:#d7dce2 !important;
}
html[data-rift-effective-theme='light'] .member-item.offline { opacity:.6 !important; }
html[data-rift-effective-theme='light'] .member-item.offline:hover { opacity:.82 !important; }
html[data-rift-effective-theme='light'] .member-avatar-wrap>.presence-dot,
html[data-rift-effective-theme='light'] .dm-avatar-wrap>.dm-presence-dot,
html[data-rift-effective-theme='light'] .ui0213-head-presence {
  --status-cutout:#eef0f3 !important;
  border-color:#eef0f3 !important;
}

/* Context menus and popovers. */
html[data-rift-effective-theme='light'] :is(.parity-context,.ui0212-context,.rift-friend-safe-menu,.rift-server-space-menu,.ui0213-message-menu) {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#c9cfd7 !important;
  box-shadow:var(--rift-light-shadow) !important;
}
html[data-rift-effective-theme='light'] :is(.parity-menu-item,.ui0212-context button,.rift-friend-safe-menu button,.rift-server-space-menu button,.ui0213-message-menu>button) {
  color:#343c46 !important;
}
html[data-rift-effective-theme='light'] :is(.parity-menu-item,.ui0212-context button,.rift-friend-safe-menu button,.rift-server-space-menu button,.ui0213-message-menu>button):hover:not(:disabled) {
  background:#e3e7eb !important;
  color:#15191e !important;
}
html[data-rift-effective-theme='light'] :is(.parity-menu-divider,.rift-friend-safe-divider,.ui0213-message-menu .divider) { background:#d8dde3 !important; }

/* Server/channel settings and moderation surfaces. */
html[data-rift-effective-theme='light'] :is(.parity-settings,.ui0212-channel-settings) {
  background:var(--rift-light-canvas) !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] :is(.parity-settings-content,.ui0212-channel-settings main) {
  background:#f7f8fa !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] :is(.parity-settings-nav,.ui0212-channel-settings aside) {
  background:#eceff2 !important;
  border-color:#d0d6dd !important;
}
html[data-rift-effective-theme='light'] :is(.parity-settings-content h1,.parity-settings-content h2,.parity-form-section label,.v024-page,.v024-page h1,.v024-page h2,.v024-card>label,.v024-role-copy>strong,.v024-member-copy>strong,.v024-audit-row strong) {
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] :is(.parity-lead,.parity-settings-list small,.parity-disabled-page p,.v024-muted,.v024-role-copy>small,.v024-member-copy>small,.v024-audit-row span,.v024-permission-toggle small,.v024-channel-copy) {
  color:#626d79 !important;
}
html[data-rift-effective-theme='light'] :is(.parity-disabled-page,.parity-danger-box,.v024-card,.v024-loading,.v024-empty,.v024-role-card,.v024-member-card,.v024-audit-row,.v024-stat-grid article,.v024-permission-summary article,.v024-channel-role) {
  background:#ffffff !important;
  color:var(--rift-light-text-2) !important;
  border-color:#cfd5dc !important;
}
html[data-rift-effective-theme='light'] :is(.parity-form-section input,.parity-form-section textarea,.parity-form-section select,.v024-card input,.v024-card textarea,.v024-role-form input,.v024-role-form select,.v024-channel-role select) {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#c5ccd4 !important;
}
html[data-rift-effective-theme='light'] :is(.v024-permission-pills span,.v024-role-chip) {
  background:#e5e9ed !important;
  color:#333b45 !important;
  border:1px solid #ccd2d9 !important;
}

/* Voice UI is themed rather than left as a black call canvas. */
html[data-rift-effective-theme='light'] :is(.voice-view,.r021-voice-screen,.ui0212-voice-page) {
  background:#eef0f3 !important;
  color:var(--rift-light-text) !important;
}
html[data-rift-effective-theme='light'] :is(.r021-voice-topbar,.ui0212-voice-top) { color:#363e48 !important; }
html[data-rift-effective-theme='light'] :is(.r021-video-tile,.ui0212-voice-tile) {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#cbd1d8 !important;
}
html[data-rift-effective-theme='light'] :is(.r021-voice-controls-floating,.ui0212-callbar) {
  background:#ffffff !important;
  border-color:#c8ced6 !important;
  box-shadow:var(--rift-light-shadow) !important;
}
html[data-rift-effective-theme='light'] :is(.r021-call-group,.ui0212-call-group) { border-color:#ccd2d9 !important; }
html[data-rift-effective-theme='light'] :is(.r021-call-group button,.r021-call-button,.ui0212-call-btn) {
  background:#eef1f4 !important;
  color:#343c46 !important;
  border-color:#d0d6dd !important;
}
html[data-rift-effective-theme='light'] :is(.r021-call-group button,.r021-call-button,.ui0212-call-btn):hover:not(:disabled) {
  background:#dfe4e8 !important;
  color:#161a20 !important;
}

/* Modals, server creation and invite surfaces. */
html[data-rift-effective-theme='light'] :is(.modal,.modal.rift-invite-modal,.ui0211-create-server,.ui0211-join-server,.ui0211-server-name-step,.ui0211-create-channel) {
  background:#ffffff !important;
  color:var(--rift-light-text) !important;
  border-color:#cbd1d8 !important;
}
html[data-rift-effective-theme='light'] :is(.modal h2,.modal h3,.modal h4,.ui0211-create-server h2,.ui0211-join-server h2,.ui0211-server-name-step h2) { color:var(--rift-light-text) !important; }
html[data-rift-effective-theme='light'] :is(.modal p,.ui0211-create-server p,.ui0211-join-server p,.ui0211-server-name-step p) { color:#626c78 !important; }
html[data-rift-effective-theme='light'] :is(.modal input,.modal textarea,.modal select,.invite-search,.ui0211-channel-name-field) {
  background:#f8f9fa !important;
  color:var(--rift-light-text) !important;
  border-color:#c6cdd5 !important;
}
html[data-rift-effective-theme='light'] .invite-recipient:hover { background:#e7ebef !important; }

/* Reactions, attachments and reply surfaces. */
html[data-rift-effective-theme='light'] :is(.reaction-chip,.reaction-choice,.pending-file,.file-attachment,.reply-preview,#v2-reply-bar,.reply-bar) {
  background:#ffffff !important;
  color:#303842 !important;
  border-color:#ccd2d9 !important;
}
html[data-rift-effective-theme='light'] .reaction-chip:hover,
html[data-rift-effective-theme='light'] .reaction-chip.mine { background:#e4e8ec !important; color:#171b21 !important; }

/* Scrollbars remain visible without becoming a dark stripe. */
html[data-rift-effective-theme='light'] :is(.message-list,.channel-navigation,.member-list,.r021-settings-main,.parity-settings-content,.ui0212-dm-profile) {
  scrollbar-color:#aeb6c0 transparent !important;
}

/* The legacy dark route curtain must never flash over a light session. */
html[data-rift-effective-theme='light'] :is(.parity-route-curtain,#ui0211-route-curtain,#ui0212-route-mask) {
  background:var(--rift-light-canvas) !important;
}
