:root {
  color-scheme: light;
  --bg: #EEEFF2;
  --panel: #fff;
  --line: #e5e5e5;
  --text: #222;
  --muted: #606060;
  --accent: #1641d5;
  --selection-blue: #1641d5;
  --selection-text: #1641d5;
  --selection-bg: #eef2ff;
  --selection-border: #acbdf3;
}

.top {
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 2px 8px #0000000d;
}
.logo { color: #fff; background: #262626; }
.accent { color: inherit; }
.icon-btn, .sort, .chip { background: #f6f6f6; color: var(--muted); }
.back-to-top { background: #fff; color: var(--text); box-shadow: 0 2px 8px #00000012; }
.icon-btn:hover { border-color: #a3a3a3; }
.nav-button[aria-current="page"],
.nav-button:is(:hover, :focus-visible) {
  color: var(--selection-text);
}
.brand:hover { color: var(--selection-text); }
.chip[aria-pressed=true],
.pagination .chip[aria-current="page"],
.chip:not(:disabled):is(:hover, :focus-visible) {
  color: var(--selection-text);
  background: var(--selection-bg);
  border-color: var(--selection-border);
}

.primary { background: var(--accent); color: #fff; }
.primary:hover { background: #1034b2; }
.sort select { color: var(--text); }
.sort option { background: #fff; }
.row { border-color: var(--line); }
.row:hover { background: #f7f9ff; }
.entry-meta, .metric, .save { color: #626262; }
.post-time { color: #808080; }
.entry.is-opened .entry-title, .entry.is-opened .entry-title-text, .entry.is-opened .comment-count { color: #c4c4c4; }
.community, .youtube, .x { color: #4a4a4a; background: #eee; }
.feed-source-icon {
  display: inline-grid;
  place-items: center;
  justify-self: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 5px;
}
.feed-source-icon svg { width: 15px; height: 15px; }
.feed-source-icon.community { color: #603c99; background: #efe7fa; }
.feed-source-icon.has-logo { background: transparent; }
.feed-source-icon img { display: block; object-fit: contain; }
.feed-source-icon.youtube img { width: 24px; height: auto; }
.feed-source-icon.x.has-logo {
  width: 22px;
  height: 22px;
  background: #000;
}
.feed-source-icon.x img { width: 14px; height: 14px; }
footer { color: var(--muted); }
footer a { color: #414141; }
footer a:is(:hover, :focus-visible) { text-decoration: underline; }
dialog { background: #fff; border-color: #d6d6d6; box-shadow: 0 18px 60px #33333336; }
dialog::backdrop { background: #22222276; }
dialog p { color: #555; }
.toast { color: #333; background: #f2f2f2; border-color: #c2c2c2; }

@media (prefers-reduced-motion: no-preference) {
  .nav-button, .chip, .primary, .icon-btn, .save {
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
  }
  .row { transition: background-color 180ms ease; }
  .brand, .entry-title { transition: color 180ms ease; }
  .entry-title-text { transition: text-decoration-color 180ms ease; }
}

/* Live feed metadata */
a.entry {text-decoration:none;color:inherit;display:flex;align-items:flex-start;min-width:0;}
a.entry.is-opened {color:#c4c4c4;}
a.entry:hover .entry-title-text {text-decoration:underline;}
.feed-status {font-size:12px;color:#777;margin:0 0 12px;}
.feed-status summary {cursor:pointer;}
.feed-status p {margin:8px 0;}
.feed-status ul {padding-left:18px;line-height:1.8;}
.source-initial {font-size:10px;font-weight:600;white-space:nowrap;}

.feed-toolbar {display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:13px;}
.feed-toolbar .filters {margin:0;flex-wrap:nowrap;}
.time-controls {display:flex;align-items:center;gap:8px;}
.feed-dropdown { position: relative; display: inline-flex; }
.feed-dropdown > span {
  position: absolute;
  inset-inline-start: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  pointer-events: none;
}
.feed-dropdown::after {
  content: "";
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  width: 5px;
  height: 5px;
  border: solid var(--muted);
  border-width: 0 1px 1px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.feed-dropdown:has(select:open)::after { transform: translateY(-30%) rotate(225deg); }
.feed-dropdown select {
  appearance: none;
  align-items: center;
  min-inline-size: 120px;
  min-block-size: 34px;
  padding: 0 26px 0 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 70%, var(--panel));
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 16px;
}
.feed-dropdown select:is(:hover, :open) { border-color: var(--line); }
@supports (appearance: base-select) {
  .feed-dropdown select, .feed-dropdown select::picker(select) { appearance: base-select; }
  .feed-dropdown select::picker(select) {
    min-inline-size: 120px;
    margin-block-start: 5px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 5px 16px #0002;
  }
  .feed-dropdown select::picker-icon { display: none; }
  .feed-dropdown option { min-block-size: 32px; padding: 6px 10px; border-radius: 5px; font-size: 12px; }
  .feed-dropdown option:checked { background: color-mix(in srgb, var(--bg) 70%, var(--panel)); font-weight: 650; }
  .feed-dropdown option:is(:hover, :focus-visible) { background: var(--selection-bg); color: var(--selection-text); }
  .feed-dropdown option::checkmark { display: none; }
}
.status-wrap {position:relative;}
.status-toggle {display:grid;place-items:center;width:28px;height:30px;padding:0;border:0;background:transparent;color:#888;font-size:19px;}
.status-toggle:hover,.status-toggle:focus-visible {color:#2563eb;}
.status-wrap .feed-status {visibility:hidden;opacity:0;position:absolute;top:100%;left:0;width:350px;max-width:calc(100vw - 32px);max-height:60vh;overflow:auto;z-index:10;padding:14px;background:#fff;border:1px solid #ddd;box-shadow:0 5px 20px #0002;line-height:1.6;margin:0;transition:opacity .15s;}
.status-wrap:hover .feed-status,.status-wrap:focus-within .feed-status,.status-wrap.is-open .feed-status {visibility:visible;opacity:1;}
@media(max-width:670px) {
 .feed-toolbar {gap:5px;}
 .feed-toolbar .filters {gap:3px;}
 .feed-toolbar .chip {padding:6px 2px;font-size:11px;}
 .time-controls {gap:2px;}
 .status-toggle {width:21px;}
 .status-wrap .feed-status {left:-145px;width:300px;}
}

.community-tab-icon {display:block;width:18px;height:18px;object-fit:contain;flex-shrink:0;}

.row:has(.entry.is-opened) .row-stats .metric, .row:has(.entry.is-opened) .row-stats .post-time {color:#c4c4c4;}

@media(max-width:430px){.feed-toolbar .chip{font-size:10px;padding:6px 1px;}.feed-toolbar .filters{gap:2px;}.feed-toolbar{gap:3px;}}

.community-controls {--community-controls-gap:12px;display:flex;align-items:flex-start;gap:var(--community-controls-gap);margin-bottom:13px;}
.community-controls > .filters {flex:1;min-width:0;margin:0;}
.community-controls > :is(.feed-refresh,.order-settings,#deal-search-toggle) {align-self:flex-start;}
.order-settings {flex-shrink:0;margin-left:auto;}
.feed-panel > .feed-toolbar {margin:0;padding:12px 14px;background:#fafafa;border-bottom:1px solid var(--line);}
#feed-list > .row:first-child {border-top:0;}
#community-order {color:#222;width:min(440px,calc(100vw - 28px));max-height:85vh;border-radius:0;}
.order-dialog-head {display:flex;align-items:center;justify-content:space-between;gap:12px;}
#community-order h2 {font-size:20px;margin:0;font-weight:600;}
#community-order p {font-size:13px;line-height:1.6;}
#order-list {list-style:none;padding:0;margin:16px 0;max-height:48vh;overflow:auto;}
#order-list li {display:flex;align-items:center;gap:6px;padding:6px 0;border-bottom:1px solid #eee;}
.order-name {display:flex;align-items:center;gap:8px;flex:1;font-size:14px;}
.order-name img {object-fit:contain;}
#order-list button:disabled {opacity:.3;cursor:default;}
.order-actions {display:flex;justify-content:flex-end;gap:8px;}
.order-actions button:first-child {margin-right:auto;}
@media(max-width:670px){.community-controls{--community-controls-gap:6px;}.order-settings{font-size:11px;padding:7px 6px;}.feed-panel>.feed-toolbar{padding:10px 5px;}}
@media(max-width:430px){.feed-panel>.feed-toolbar{padding-inline:2px;}}
.feed-panel {border-radius:0;}

#order-list li[draggable] {cursor:grab;position:relative;user-select:none;}
#order-list li[draggable]:active {cursor:grabbing;}
.order-grip {font-size:22px;line-height:1;color:#aaa;padding:0 6px;}
#order-list li.is-dragging {opacity:.4;background:#f2f5fa;}
#order-list li.drop-before {box-shadow:inset 0 2px #2563eb;}
#order-list li.drop-after {box-shadow:inset 0 -2px #2563eb;}
#order-list li:focus-visible {outline:2px solid #9bbcf7;outline-offset:-2px;}

.feed-heading {position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
main {padding-top:18px;}
@media(max-width:670px){main{padding-top:0;}}
main:has(:is(#feed-section, #subscriptions-section, #finance-section):not([hidden])) {padding-top:40px;}
.order-settings {width:34px;height:34px;padding:0;display:grid;place-items:center;}
.order-settings svg {width:18px;height:18px;}
.feed-refresh { display: grid; flex: none; place-items: center; width: 34px; height: 34px; padding: 0; }
.feed-refresh svg { width: 18px; height: 18px; }
.feed-refresh:disabled { opacity: .6; cursor: progress; }
@media (prefers-reduced-motion: no-preference) {
  .feed-refresh:disabled svg { animation: finance-refresh-spin .85s linear infinite; }
}

.deal-row {grid-template-columns:44px minmax(0,1fr) 156px 32px;}
.deal-row .feed-source-icon {position:relative;width:44px;height:44px;display:grid;place-items:center;}
.deal-row .feed-source-icon .deal-thumbnail {position:absolute;inset:0;width:44px;height:44px;object-fit:contain;background:#fff;}
@media(max-width:670px){.deal-row{grid-template-columns:44px minmax(0,1fr) 61px 28px;}}

.deal-search{display:flex;align-items:center;gap:7px;width:220px;height:34px;padding:0 10px;margin-left:auto;background:#fff;border:1px solid var(--line);color:#888;border-radius:6px;flex-shrink:0;}
.deal-search:focus-within{border-color:#8daaff;box-shadow:0 0 0 2px #3565ff12;}
.deal-search input{width:100%;min-width:0;border:0;outline:none;background:transparent;color:var(--text);font-size:13px;}
@media(max-width:670px){.deal-search{width:100%;}}

.feed-toolbar .chip[aria-pressed='false'] {font-weight:400;}

#feed-list.deal-grid {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;padding:14px;}
.feed-panel:has(> .deal-grid) {border:0;background:transparent;}
.feed-panel:has(> .deal-grid) > .feed-toolbar {border:1px solid var(--line);}
#feed-list.deal-grid {padding:14px 0 0;}
.deal-grid .deal-row {display:flex;flex-direction:column;align-items:stretch;gap:0;min-width:0;min-height:0;padding:0;border:1px solid var(--line);background:var(--panel);}
#feed-list.deal-grid > .row:first-child {border-top:1px solid var(--line);}
.deal-grid .deal-picture {display:grid;position:relative;place-items:center;aspect-ratio:1;background:#fafafa;overflow:hidden;}
.deal-grid .deal-placeholder {color:var(--muted);font-size:13px;}
.deal-grid .deal-picture .deal-thumbnail {position:absolute;width:100%;height:100%;object-fit:contain;background:#fff;}
.deal-grid .deal-source {display:flex;align-items:center;gap:5px;padding:10px 12px 0;color:var(--muted);font-size:11px;}
.deal-grid .deal-source img {width:14px;height:14px;object-fit:contain;}
.deal-grid .entry {padding:7px 12px;flex:1;}
.deal-grid .entry-title {font-size:14px;line-height:22px;word-break:normal;}
.deal-grid .deal-price {display:flex;flex-direction:column;gap:3px;padding:4px 12px 6px;}
.deal-grid .deal-price strong {font-size:18px;font-weight:700;line-height:1.4;}
.deal-grid .deal-price span {font-size:11px;color:var(--muted);}
.deal-grid .row-stats {display:flex;justify-content:space-between;padding:8px 12px 0;}
.deal-grid .save {align-self:flex-end;margin:0 6px 6px;}
.deal-grid > .pagination,.deal-grid > .empty {grid-column:1/-1;}
@media(max-width:670px){#feed-list.deal-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px;}.deal-grid .entry{padding-inline:9px;}.deal-grid .deal-source,.deal-grid .row-stats{padding-inline:9px;}}
@media(max-width:670px){#feed-list.deal-grid{padding:8px 0 0;}}


/* TOFEED brand palette, sampled from the supplied wordmark. */
.brand-wordmark {display:block;width:95px;height:auto;object-fit:contain;}
@media(min-width:671px){.top-inner{gap:32px;}}
@media(min-width:671px){.top-inner > .top-nav{margin-inline-start:5px;}}
@media(max-width:670px){.top-inner > .top-nav{margin-block-start:5px;}}
.brand {flex-shrink:0;}
.brand:hover {opacity:.85;}
.back-to-top:hover,.icon-btn:hover {color:var(--accent);border-color:var(--selection-border);background:var(--selection-bg);}
.status-toggle:hover,.status-toggle:focus-visible {color:var(--accent);}
footer a:hover {color:var(--accent);}
.toast {color:#1641d5;background:#eef2ff;border-color:#acbdf3;}
input:focus,select:focus {outline-color:var(--accent);}

.community-columns {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;background:var(--bg);}
.community-columns > div {min-width:0;background:var(--panel);}
.community-columns > div:first-child {border-right:1px solid var(--line);}
.community-columns > div + div {border-left:1px solid var(--line);}
.community-columns .row {height:53px;min-height:53px;grid-template-columns:24px minmax(0,1fr) 66px 28px;gap:6px;padding-inline:10px;}
.community-columns .row:first-child {border-top:0;}
.community-columns .row-stats {display:flex;flex-direction:column;align-items:flex-end;gap:3px;}
.community-columns .entry-title {display:flex;align-items:center;gap:5px;width:100%;min-width:0;line-height:22px;white-space:nowrap;}
.community-columns .entry-title-text {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.community-columns .comment-count {flex-shrink:0;}
@media(max-width:760px) {
  .community-columns {grid-template-columns:1fr;gap:0;}
  .community-columns > div:first-child {border-right:0;}
  .community-columns > div + div {border-left:0;}
  .community-columns > div + div:not(:empty) {border-top:1px solid var(--line);}
}

#community-filter-group {border:1px solid var(--line);background:var(--panel);padding:14px;margin-bottom:10px;}
#community-filter-group .community-controls {margin-bottom:12px;}
#community-filter-group .feed-toolbar {margin:0;padding-top:12px;border-top:1px solid var(--line);flex-wrap:wrap;}
.community-panel {border:0;background:transparent;}
.community-panel .community-columns > div {border:1px solid var(--line);}
.community-panel .community-columns > div:empty {border:0;background:transparent;}
.community-panel .pagination {margin-top:24px;border:0;background:transparent;}
@media(max-width:760px) {
  #community-filter-group {padding:10px;}
  .community-panel .community-columns > div + div:not(:empty) {border-top:0;}
}



footer { align-items:center; }
#admin-button {margin-inline-start:auto;flex:none;display:grid;place-items:center;width:34px;height:34px;padding:0;}
@media(max-width:1140px) {
  footer:has(#admin-button:not([hidden])) { padding-block-end:max(70px, calc(env(safe-area-inset-bottom) + 54px)); }
}
#admin-dialog form[data-admin] {display:grid;gap:10px;margin-bottom:12px;}
#admin-dialog label {display:grid;gap:4px;}
#admin-dialog input {width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:6px;background:var(--panel);color:var(--text);}
#admin-dialog form[data-admin] button {justify-self:start;}
