/* Continuous light around the existing surfaces; palette and geometry stay intact. */
:root {
  --rim: linear-gradient(125deg,#ffffff8c 0%,#ece5f54d 25%,#b5a3c31f 52%,#e7dff03d 78%,#ffffff66 100%);
  --rim-inner-light: #ffffff52;
  --rim-inner-shade: #7b688b0a;
  --select-fill: linear-gradient(135deg,#f3f0f8 0%,#eceef6 55%,#e8ebf3 100%);
  --select-rim: linear-gradient(125deg,#b6a7c7b3 0%,#c9bfd775 28%,#a7afc280 58%,#bdb1cfa6 100%);
  --select-shadow: inset 0 1px 3px #ffffff99,0 2px 6px #3836530a;
}
body.dark {
  --rim: linear-gradient(125deg,#f5edff59 0%,#c9bddc33 25%,#a192b814 52%,#d4c3e538 78%,#f0e5ff47 100%);
  --rim-inner-light: #eee5ff14;
  --rim-inner-shade: #00000014;
  --select-fill: linear-gradient(135deg,#2c2d3e 0%,#252937 55%,#272939 100%);
  --select-rim: linear-gradient(125deg,#bfb0d373 0%,#8d8ca147 28%,#7d89965c 58%,#b0a1c16b 100%);
  --select-shadow: inset 0 1px 3px #eee5ff0f,0 2px 6px #00000014;
}
@supports (mask-composite:exclude) or (-webkit-mask-composite:xor) {
  body:not(.reduce) :is(.primary,.secondary,.icon-btn,.avatar,.back,.composer,.receipt,.message,.filters,.week-options,.suggestions button,.filters button.active,.week-presets [aria-pressed="true"],.week-options input:checked+span) {
    position:relative;
  }
  body:not(.reduce) :is(.glass,.card,.hero,.primary,.secondary,.icon-btn,.avatar,.back,.composer,.receipt,.message,.suggestions button,.filters button.active,.week-presets [aria-pressed="true"],.week-options input:checked+span) {
    border-color:transparent;
  }
  body:not(.reduce) :is(.glass,.card,.hero,.primary,.secondary,.icon-btn,.avatar,.back,.composer,.receipt,.message,.suggestions button,.filters button.active,.week-presets [aria-pressed="true"],.week-options input:checked+span)::after {
    content:''; position:absolute; inset:-1px; width:auto; height:auto;
    box-sizing:border-box; padding:1px; border:0; border-radius:inherit;
    background:var(--rim); box-shadow:none; filter:blur(.55px); pointer-events:none; z-index:2;
    -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
    -webkit-mask-composite:xor; mask-composite:exclude;
  }
}
/* The moving navigation highlight already uses ::before, so give it layered edges. */
body:not(.reduce) .bottom-nav::before {
  border-color:transparent;
  background:var(--selected-fill) padding-box,var(--rim) border-box;
}
/* Native controls cannot host a reliable pseudo-element; preserve their fill and arrows. */
body:not(.reduce) :is(#main,.demo-controls) :where(input:not([type=checkbox],[type=radio],[type=file],[type=range],[type=button],[type=submit]),textarea,select) {
  border-color:transparent;
  background:linear-gradient(var(--surface),var(--surface)) padding-box,var(--rim) border-box;
  box-shadow:inset 0 1px 5px var(--rim-inner-light),inset 0 -1px 5px var(--rim-inner-shade);
}
body:not(.reduce) #main select {
  --rim-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23606776' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-image:var(--rim-arrow),var(--select-fill),var(--select-rim);
  box-shadow:var(--select-shadow);
  background-origin:padding-box,padding-box,border-box;
  background-clip:padding-box,padding-box,border-box;
  background-position:right 14px center,0 0,0 0;
  background-size:12px 12px,auto,auto;
  background-repeat:no-repeat;
}
body.dark:not(.reduce) #main select {
  --rim-arrow:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m2 4 4 4 4-4' fill='none' stroke='%23b6bccd' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-reduced-transparency:reduce) {
  body:not(.reduce) :is(.glass,.card,.hero,.primary,.secondary,.icon-btn,.avatar,.back,.composer,.receipt,.message,.suggestions button,.filters button.active,.week-presets [aria-pressed="true"],.week-options input:checked+span)::after { display:none; }
  body:not(.reduce) :is(.glass,.card,.hero,.primary,.secondary,.icon-btn,.avatar,.back,.composer,.receipt,.message,.suggestions button,.filters button.active,.week-presets [aria-pressed="true"],.week-options input:checked+span) { border-color:var(--line); }
  body:not(.reduce) .bottom-nav::before { background:var(--selected-solid); border-color:var(--selected-edge); }
  body:not(.reduce) :is(#main,.demo-controls) :where(input:not([type=checkbox],[type=radio],[type=file],[type=range],[type=button],[type=submit]),textarea,select) { border-color:var(--line); box-shadow:none; }
}
