:root {
  color-scheme: light;
  --sale-ink: #075980;
  --sale-tint: #e1f4ff;
  --sale-border: #97cde9;
  --auction-ink: #783497;
  --auction-tint: #f5e7ff;
  --auction-border: #d7a6ea;
  --closing-ink: #7d4105;
  --closing-tint: #fff0cf;
  --action-ink: #fff;
  --action-fill: #4056c4;
  --action-hover: #3146b2;
  --selection-bar: #526cec;
  --feed-surface: #fff;
  --photo-field: #f3f6fb;
  --photo-line: #dce4ef;
}

.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.theme-toggle .ic { width: 18px; height: 18px; }
.theme-sun, [data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }

.login-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 23px;
  border-bottom: 1px solid var(--line);
}
.login-head .brand { background: transparent; color: var(--ink); }

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #11151d;
  --surface: #1b212c;
  --inset: #151b25;
  --raised: #283242;
  --hover: #242d3b;
  --line: #343f50;
  --ink: #eff2f8;
  --muted: #a9b5c8;
  --soft: var(--muted);
  --accent: #acbfff;
  --accent-surface: #263553;
  --accent-border: #43587c;
  --purple: #d2b7fa;
  --purple-surface: #382d47;
  --warm: #f1c296;
  --warm-surface: #3c3028;
  --sale-ink: #9cddff;
  --sale-tint: #123953;
  --sale-border: #306984;
  --auction-ink: #edc1ff;
  --auction-tint: #452a57;
  --auction-border: #7b508f;
  --closing-ink: #ffcd85;
  --closing-tint: #482f17;
  --action-ink: #fff;
  --action-fill: #435bbd;
  --action-hover: #5067cb;
  --selection-bar: #94a9ff;
  --feed-surface: var(--surface);
  --photo-field: #182231;
  --photo-line: #263346;
  color: var(--ink);
  background: var(--paper);
}

/* Navigation, panels and dialogs */
[data-theme="dark"] :is(.side, .topbar, .panel, .stat, .graph, .logincard, .skip, dialog),
[data-theme="dark"] #post-reader {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] :is(.brand, .crumb strong, .mini-name, .empty strong, .prod-btn strong, .field) { color: var(--ink); }
[data-theme="dark"] :is(.crumb, .slash, .nav-title, .nav-item, .ico-btn, .quicksearch, .pagehead p, .panel-head p,
  .stat-top, .stat-note, .mini-meta, .mini-value small, .empty, .sub, .muted, .table-group, th, .padded p,
  .metrics span, .detail-info dt, .note, .post-group, .photo-placeholder, .rule-body p, .variant-fields summary) { color: var(--muted); }
[data-theme="dark"] :is(.nav-item:hover, .ico-btn:hover, .account .ico-btn:hover, .offer-row:hover, .post-card>.post-trigger:hover) {
  color: var(--ink);
  background: var(--hover);
}
[data-theme="dark"] :is(.nav-item.active, .avatar, .rule-symbol, .stat-icon.green, .stat-icon.blue, .delta, .tone-sk, .tone-cz,
  .focus-icon, .status-chip.live) { color: var(--accent); background: var(--accent-surface); border-color: var(--accent-border); }
[data-theme="dark"] :is(.stat-icon.purple, .tone-eu, .tone-pl) { color: var(--purple); background: var(--purple-surface); }
[data-theme="dark"] :is(.stat-icon.gold, .tone-de, .delta.down) { color: var(--warm); background: var(--warm-surface); }
[data-theme="dark"] .loginwrap { background: var(--paper); }
[data-theme="dark"] :is(dialog, #post-reader)::backdrop { background: #06090ec7; }
[data-theme="dark"] #toast { background: var(--raised); color: var(--ink); border: 1px solid var(--line); }

/* Filters, search, segmented controls and forms */
[data-theme="dark"] :is(.btn, .sel, .input-search, .row-action, .alert-button, .theme-toggle, .field input, .field select, .field textarea) {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] :is(.btn:hover, .sel:hover, .row-action:hover, .alert-button:hover, .theme-toggle:hover) {
  background: var(--raised);
  color: var(--ink);
  border-color: var(--accent-border);
}
[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #14203d; }
[data-theme="dark"] .btn.primary:hover { background: #c4d1ff; border-color: #c4d1ff; }
[data-theme="dark"] :is(.btn.danger, .error) { color: #ffa69b; }
[data-theme="dark"] :is(.text-btn, .catalog-link, .mini-item:hover .mini-name, .bookmark.saved) { color: var(--accent); }
[data-theme="dark"] :is(.layout-switch, .seg, .graph-toggle, .quicksearch kbd, .endpoint, .task-item, .check-option,
  .filter-form, .variant-filter, .post-detail, .reader-prices, thead) { background: var(--inset); border-color: var(--line); }
[data-theme="dark"] :is(.graph-toggle button, .seg button, .layout-switch button, .input-search input::placeholder) { color: var(--muted); }
[data-theme="dark"] input::placeholder, [data-theme="dark"] textarea::placeholder { color: var(--muted); opacity: 1; }
[data-theme="dark"] .input-search input { color: var(--ink); }
[data-theme="dark"] .input-search:focus-within { border-color: var(--accent); }
[data-theme="dark"] :is(.graph-toggle button.on, .seg button.on, .layout-switch button[aria-pressed="true"]) {
  color: var(--accent);
  background: var(--raised);
  border-color: var(--line);
  box-shadow: none;
}
[data-theme="dark"] :focus-visible { outline-color: var(--accent); }
[data-theme="dark"] :is(.mini-item, td, .table-foot, .library-tabs) { border-color: var(--line); }
[data-theme="dark"] .plot text { fill: var(--muted); }
[data-theme="dark"] .plot-tip { color: var(--ink); background: var(--raised); border-color: var(--line); }

/* Listings, auctions and photographs */
[data-theme="dark"] .listing-results.tiles { background: var(--paper); }
[data-theme="dark"] .tiles .listing { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .tiles .listing:focus-within { border-color: var(--accent-border); }
[data-theme="dark"] :is(.listing-photo, .listing-photo.missing, .listing-photo.unavailable, .gallery-open, .thumb, .detail-photo,
  .photo-gallery img, .post-detail .scroll-table) { background: var(--inset); border-color: var(--line); }
[data-theme="dark"] .post-tile {
  color: var(--accent);
  background: var(--accent-surface);
  border-color: var(--accent-border);
}
[data-theme="dark"] .post-tile.sealed {
  color: var(--purple);
  background: var(--purple-surface);
  border-color: #58436d;
}
[data-theme="dark"] :is(.post-tile.lot, .small-tag, .count-tag, .status-chip, .demo-tag) {
  color: var(--muted);
  background: var(--raised);
  border-color: var(--line);
}
[data-theme="dark"] :is(.post-name .sub, .post-amount small, .original, .post-chevron .ic) { color: var(--muted); }
[data-theme="dark"] :is(.rows .post-amount .price-value, .reader-prices .price-value) { color: #f3f6ff; }
[data-theme="dark"] :is(.post-amount .price-note, .reader-prices .price-note) { color: var(--muted); }
[data-theme="dark"] .service-note { color: var(--warm); }
[data-theme="dark"] .tile-media .book { background: var(--surface); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] :is(.tile-media .book:hover, .book.chosen, .tile-media .book.chosen, .watch-invite) {
  color: var(--accent);
  background: var(--accent-surface);
  border-color: var(--accent-border);
}
[data-theme="dark"] .book.chosen .ic { fill: var(--accent); }

/* Listing types retain the same visual meaning across filters, cards and details. */
:root .type-pill:not(.auction), :root .kind-switch [data-post-kind="sale"].on {
  color: var(--sale-ink);
  background: var(--sale-tint);
  border-color: var(--sale-border);
}
:root .type-pill.auction, :root .kind-switch [data-post-kind="auction"].on {
  color: var(--auction-ink);
  background: var(--auction-tint);
  border-color: var(--auction-border);
}
.kind-switch [data-post-kind="sale"] .ic { color: var(--sale-ink); }
.kind-switch [data-post-kind="auction"] .ic { color: var(--auction-ink); }
:root .nav-item.active { box-shadow: inset 3px 0 var(--selection-bar); }
:root .row-action.source-link, :root .btn.source-link {
  background: var(--action-fill);
  border-color: var(--action-fill);
  color: var(--action-ink);
}
:root .row-action.source-link:hover, :root .btn.source-link:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
  color: var(--action-ink);
}
.deadline { color: var(--muted); }
.deadline.closing-soon { color: var(--closing-ink); background: var(--closing-tint); }
:root .tiles .listing-photo:is(.missing, .unavailable) {
  background-color: var(--photo-field);
  background-image: repeating-linear-gradient(135deg, transparent 0 13px, var(--photo-line) 13px 14px);
}
