.theme-setting {display:flex;align-items:center;gap:10px;flex:none;align-self:center;padding:4px 0 4px 6px;}
.theme-options {display:flex;border:1px solid var(--line);border-radius:9px;background:var(--panel);}
.theme-options button {display:grid;place-items:center;width:32px;height:30px;padding:6px;border:0;background:transparent;color:#9a9a9a;border-radius:8px;}
.theme-options button + button {border-left:1px solid var(--line);border-top-left-radius:0;border-bottom-left-radius:0;}
.theme-options button:first-child {border-top-right-radius:0;border-bottom-right-radius:0;}
.theme-options button[aria-pressed="true"] {background:var(--selection-bg);}
.theme-options button[data-theme-choice="light"][aria-pressed="true"] {color:#ffab00;}
.theme-options button[data-theme-choice="dark"][aria-pressed="true"] {color:var(--accent);}
.theme-options button:hover {background:var(--selection-bg);}
.theme-options button:focus-visible {outline-offset:-3px;}
.theme-options svg {width:18px;height:18px;}
@media(pointer:coarse){.theme-options button{width:44px;height:44px;}}
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#14171c;
  --panel:#1e2229;
  --line:#343a45;
  --text:#e8ebf0;
  --muted:#a6aebb;
  --accent:#8daaff;
  --selection-blue:#8daaff;
  --selection-text:#a6bcff;
  --selection-bg:#293752;
  --selection-border:#526b9f;
}
[data-theme="dark"] .top {background:var(--panel);border-color:var(--line);}
[data-theme="dark"] .brand-wordmark {filter:brightness(0) invert(1);}
[data-theme="dark"] :is(.chip,.icon-btn,.sort,.finance-kind) {background:#252a33;color:var(--muted);}
[data-theme="dark"] :is(.chip[aria-pressed="true"],.chip:hover,.chip[aria-current],.icon-btn:hover) {background:var(--selection-bg);color:var(--selection-text);border-color:var(--selection-border);}
[data-theme="dark"] :is(.feed-panel > .feed-toolbar,.subscription-blog-toolbar) {background:#232830;}
[data-theme="dark"] .row:hover {background:#252d3a;}
[data-theme="dark"] :is(.metric,.post-time,.entry-meta,.save,.feed-status,.status-toggle) {color:var(--muted);}
[data-theme="dark"] :is(.status-wrap .feed-status,dialog,.deal-search,.market-card,.back-to-top) {background:var(--panel);color:var(--text);border-color:var(--line);}
[data-theme="dark"] #community-order {color:var(--text);}
[data-theme="dark"] :is(dialog p,.market-breakdown,.us-market-grid p) {color:var(--muted);}
[data-theme="dark"] #order-list li {border-color:var(--line);}
[data-theme="dark"] #order-list li.is-dragging {background:var(--selection-bg);}
[data-theme="dark"] .primary {background:#4266df;color:#fff;}
[data-theme="dark"] .primary:hover {background:#3455c4;}
[data-theme="dark"] .sort select {color:var(--text);}
[data-theme="dark"] .sort option {background:var(--panel);}
[data-theme="dark"] .deal-grid .deal-picture {background:var(--panel);}
[data-theme="dark"] .toast {background:var(--selection-bg);border-color:var(--selection-border);color:var(--selection-text);}
[data-theme="dark"] :is(.entry.is-opened .entry-title,.entry.is-opened .entry-title-text,.entry.is-opened .comment-count,.row:has(.entry.is-opened) .row-stats .metric,.row:has(.entry.is-opened) .row-stats .post-time) {color:#7e8795;}
[data-theme="dark"] .market-up {color:#ff7373;}
[data-theme="dark"] .market-down {color:#69b0ff;}
/* Shared 10px corners across panels and controls. Keep tooltip containers unclipped. */
:root {--radius:10px;}
.panel,.feed-panel,#subscriptions-section .panel,.market-card,
#community-filter-group,#subscription-filter-group,#community-order,dialog,
.community-columns > div,.chip,.icon-btn,.primary,.sort,.save,
.deal-search,#admin-dialog input,.theme-options,.toast,
.status-wrap .feed-status,.back-to-top {border-radius:10px;}
input:not([type=checkbox]):not([type=radio]),select {border-radius:10px;}
.community-columns > div > .row:first-child {border-radius:9px 9px 0 0;}
.community-columns > div > .row:last-child {border-radius:0 0 9px 9px;}
.deal-grid .deal-row {border-radius:10px;overflow:hidden;transition:border-color 180ms ease,box-shadow 180ms ease,transform 180ms ease;}
.deal-grid .deal-picture {border-radius:9px 9px 0 0;}
.deal-grid .deal-thumbnail {transition:transform 220ms ease;}
.deal-grid .deal-row:focus-within {border-color:var(--selection-border);box-shadow:0 4px 14px rgb(22 65 213 / 12%);}
@media(hover:hover) and (pointer:fine){
 .deal-grid .deal-row:hover {border-color:var(--selection-border);box-shadow:0 6px 18px rgb(22 65 213 / 12%);transform:translateY(-2px);}
 .deal-grid .deal-row:hover .deal-thumbnail {transform:scale(1.025);}
 .deal-grid .deal-row:hover .entry:not(.is-opened) .entry-title {color:var(--accent);}
}
@media(prefers-reduced-motion:reduce){
 .deal-grid .deal-row,.deal-grid .deal-thumbnail {transition:none;transform:none!important;}
}

#deal-source-filters {display:flex;flex-wrap:wrap;gap:7px;margin:0 0 12px;padding-bottom:12px;border-bottom:1px solid var(--line);}

/* Two vertical deal columns, 50 entries per column, double-height rows. */
#feed-list.deal-grid {display:block;padding:0;}
.deal-columns {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.deal-columns > div {min-width:0;display:flex;flex-direction:column;gap:6px;}
.deal-grid .deal-columns .deal-row {display:grid;grid-template-columns:94px minmax(0,1fr) 26px;grid-template-rows:16px 42px 20px 14px;gap:2px 10px;height:116px;min-height:116px;padding:8px;align-items:center;}
.deal-grid .deal-columns .deal-picture {grid-column:1;grid-row:1/5;width:94px;height:94px;aspect-ratio:1;border-radius:6px;}
.deal-grid .deal-columns .deal-source {grid-column:2;grid-row:1;padding:0;min-width:0;overflow:hidden;white-space:nowrap;font-size:10px;}
.deal-grid .deal-columns .entry {grid-column:2/4;grid-row:2;padding:0;min-width:0;}
.deal-grid .deal-columns .entry-title {font-size:14px;line-height:21px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.deal-grid .deal-columns .deal-price {grid-column:2/4;grid-row:3;padding:0;flex-direction:row;align-items:center;gap:6px;min-width:0;white-space:nowrap;overflow:hidden;}
.deal-grid .deal-columns .deal-price strong {font-size:14px;}
.deal-grid .deal-columns .deal-price span {font-size:10px;overflow:hidden;text-overflow:ellipsis;}
.deal-grid .deal-columns .row-stats {grid-column:2/4;grid-row:4;padding:0;gap:6px;font-size:10px;}
.deal-grid .deal-columns .save {grid-column:3;grid-row:1;margin:0;width:26px;height:24px;align-self:center;}
.deal-grid > .pagination {margin-top:24px;}
@media(max-width:760px){.deal-columns{grid-template-columns:1fr;gap:6px;}}

.deal-grid .deal-columns .entry {grid-row:1/3;grid-column:2;padding:0;}
.deal-source-text {color:var(--muted);font-size:11px;font-weight:400;}
/* Softer deal metadata and a clearer price. */
.deal-grid .deal-columns .row-stats :is(.metric,.post-time,.deal-source-text) {color:#a4a8b0;}
[data-theme="dark"] .deal-grid .deal-columns .row-stats :is(.metric,.post-time,.deal-source-text) {color:#929aa7;}
.deal-grid .deal-columns .deal-price strong {font-size:16px;line-height:20px;}

#deal-search-toggle {flex:none;margin-left:auto;}
#sort-buttons {margin-left:auto;}
#sort-buttons #hide-read-toggle {margin-left:0;}
#subscription-hide-read {margin-left:auto;}
#subscription-hide-read + #subscription-settings-link {margin-left:0;}

/* Compact filter tags, read-state icon, and an inline expanding search. */
.chip {border-radius:5px;}
.hide-read-icon {width:32px;height:32px;padding:6px!important;justify-content:center;flex:none;}
.chip.hide-read-icon[aria-pressed="true"] {color:var(--panel);background:var(--selection-blue);border-color:var(--selection-blue);}
.save:is(:hover,[aria-pressed="true"]) {color:var(--selection-text);background:transparent;}
.save[aria-pressed="true"] svg {fill:currentColor;}
@media (prefers-reduced-motion:no-preference) {
  .save:active svg {transform:scale(.75);}
}
.hide-read-icon svg {width:18px;height:18px;}
.deal-compact-controls {--deal-search-offset:calc(68px + var(--community-controls-gap) * 2);position:relative;flex-wrap:nowrap;}
#deal-search-toggle {width:34px;height:34px;justify-content:center;padding:7px;z-index:2;}
.deal-compact-controls #deal-search-wrap {position:absolute;inset-inline-end:var(--deal-search-offset);top:0;width:min(280px,calc(100% - var(--deal-search-offset)));height:34px;margin:0;z-index:2;box-shadow:0 2px 8px #0001;transform-origin:right center;animation:search-open 180ms ease-out;}
@keyframes search-open {from{clip-path:inset(0 0 0 100%);opacity:0;}to{clip-path:inset(0);opacity:1;}}
@media(prefers-reduced-motion:reduce){.deal-compact-controls #deal-search-wrap{animation:none;}}

.subscription-controls #subscription-settings-link {height:34px;padding:0 8px;display:inline-flex;align-items:center;flex:none;border-radius:5px;}
#subscription-settings-link svg {width:18px;height:18px;}

.subscription-search-control {position:relative;margin-left:auto;flex:none;}
#subscription-search-toggle {width:34px;height:34px;padding:7px;justify-content:center;}
#subscription-search-wrap {
  position:absolute;
  inset-inline-end:100%;
  inset-block-start:0;
  width:min(280px,var(--subscription-search-space,280px));
  height:34px;
  margin:0;
  z-index:3;
  border-inline-end:0;
  border-start-end-radius:0;
  border-end-end-radius:0;
  animation:search-open 180ms ease-out;
}
#subscription-search-toggle[aria-expanded="true"] {border-start-start-radius:0;border-end-start-radius:0;}
.subscription-search-control:focus-within #subscription-search-toggle[aria-expanded="true"],
#subscription-search-wrap:focus-within {border-color:var(--selection-border);box-shadow:none;}
.subscription-search-control + #subscription-hide-read {margin-left:0;}
.deal-grid .deal-row {position:relative;cursor:pointer;}
.deal-grid .deal-row > .entry::after {content:"";position:absolute;inset:0;z-index:1;border-radius:inherit;}
.deal-grid .deal-row > .save {position:relative;z-index:2;}
@media(prefers-reduced-motion:reduce){#subscription-search-wrap{animation:none;}}
