:root {
  /* ── Base backgrounds — medium periwinkle (TimeFrame) ── */
  --bg:             #9092c9;
  --bg-accent:      #7e80b8;
  --bg-soft:        #a8aad4;
  --sidebar-bg:     #8f91c8;

  /* ── Card / panel surfaces — white cards ── */
  --panel:          #ffffff;
  --panel-soft:     rgba(255, 255, 255, 0.92);
  --panel-strong:   #f0eeff;
  --panel-highlight:rgba(142, 144, 201, 0.12);

  /* ── Text — dark for white cards ── */
  --ink:            #1a1030;
  --muted:          #6b6585;

  /* ── Borders ── */
  --line:           rgba(110, 100, 160, 0.2);
  --line-strong:    rgba(80, 75, 140, 0.38);

  /* ── Primary accent — dark purple pill (like "Daily" button) ── */
  --periwinkle:     #1e1c3a;
  --periwinkle-lit: #5b58c0;
  --periwinkle-dim: #3e3c96;

  /* ── Aliases ── */
  --lavender:        #5b58c0;
  --lavender-strong: #3e3c96;
  --lavender-deep:   #2d2b78;
  --beige:           #1a1030;
  --beige-soft:      #6b6585;

  /* ── Status ── */
  --success:        #b0aee8;
  --accent-green:   #b0aee8;
  --warning:        #fbb4a0;

  /* ── Shadows ── */
  --shadow:         0 8px 32px rgba(30, 25, 80, 0.2);
  --shadow-card:    0 4px 20px rgba(30, 25, 80, 0.14);

  /* ── Radii ── */
  --radius-lg:      18px;
  --radius-md:      12px;
  --radius-sm:      8px;
  --radius-xs:      6px;

  font-family: "Segoe UI", "Inter", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  color-scheme: light;
}

@keyframes bgOrb1 {
  0%   { background-position: 0% 0%,   100% 100%, 0 0; }
  30%  { background-position: 55% 25%,  45%  70%, 0 0; }
  65%  { background-position: 80% 55%,  20%  40%, 0 0; }
  100% { background-position: 40% 90%,  70%  10%, 0 0; }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  transition: color 160ms ease;
  background:
    radial-gradient(ellipse 70% 55% at 30% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 55%),
    radial-gradient(ellipse 55% 50% at 70% 70%, rgba(44, 40, 120, 0.2) 0%, transparent 55%),
    #8f91c8;
  background-size: 220% 220%, 200% 200%, auto;
  background-attachment: fixed, fixed, fixed;
  animation: bgOrb1 34s ease-in-out infinite alternate;
}

button, input, select { font: inherit; }

a { color: inherit; }

/* ─── App layout shell ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: 64px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 0 24px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.22);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: visible;
  z-index: 10;
  transition: background 160ms ease, border-color 160ms ease;
}

.sidebar-brand {
  width: 100%;
  min-height: 51px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(30, 28, 58, 0.25);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.03em;
  border: 1px solid rgba(30, 28, 58, 0.3);
}

.sidebar-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.7);
  cursor: default;
  border: 1.5px solid transparent;
  transition: background 150ms, color 150ms, border-color 150ms;
}

/* Light mode: white outline for active */
body:not(.dark) .sidebar-icon.active {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.85);
  color: #fff;
}

/* Dark mode: dark fill for active */
body.dark .sidebar-icon.active {
  background: #1e1c3a;
  border-color: transparent;
  color: #fff;
}

/* Fallback (no class on body) */
body:not(.dark):not(.dark) .sidebar-icon.active {
  background: transparent;
}

.sidebar-icon:hover {
  background: rgba(30, 28, 58, 0.15);
  color: #fff;
}

/* ─── Content area (right of sidebar) ───────────────────────────── */
.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  flex-wrap: wrap;
  transition: background 160ms ease, border-color 160ms ease;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #e8e4ff;
}

.hero-note {
  margin: 0;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(30, 28, 58, 0.22);
  color: rgba(232, 228, 255, 0.85);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ─── Stats panel ────────────────────────────────────────────────── */

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(480px, 100%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 8px;
  backdrop-filter: blur(14px);
}

.stats-panel-compact {
  width: auto;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.stats-panel div {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
}

.stats-panel-compact div {
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(20, 18, 50, 0.22);
  border-color: rgba(20, 18, 50, 0.3);
}

.stats-panel strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  color: #fff;
}

.stats-panel-compact strong {
  font-size: 12px;
  color: #e8e4ff;
}

.stats-panel span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stats-panel-compact span {
  font-size: 8px;
  letter-spacing: 0.04em;
}

body:not(.dark) .stats-panel-compact div {
  background: rgba(20, 18, 50, 0.18);
  border-color: rgba(20, 18, 50, 0.25);
}

body:not(.dark) .stats-panel-compact strong {
  color: #e8e4ff;
}

body:not(.dark) .stats-panel-compact span {
  color: rgba(26, 16, 48, 0.65);
}

/* ─── Shell / main content ───────────────────────────────────────── */
.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(50, 45, 110, 0.1), 0 10px 36px rgba(50, 45, 110, 0.18);
  transition: background 160ms ease, box-shadow 160ms ease;
}

h2, h3 {
  letter-spacing: -0.02em;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1.5px solid rgba(91, 88, 192, 0.15);
  padding-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.section-title p,
#status {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button.primary {
  background: #1e1c3a;
  color: #fff;
  box-shadow: 0 6px 18px rgba(30, 28, 58, 0.28);
}

.action-button.secondary {
  background: #fff;
  border-color: rgba(91, 88, 192, 0.3);
  color: #3e3c96;
}

.action-button.new-data {
  background: #1a6b3a;
  color: #fff;
  box-shadow: 0 6px 18px rgba(26, 107, 58, 0.35);
  animation: pulse-green 1.6s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 6px 18px rgba(26, 107, 58, 0.35); }
  50% { box-shadow: 0 6px 24px rgba(26, 107, 58, 0.65); }
}

body.dark .action-button.new-data {
  background: #1f8048;
  box-shadow: 0 6px 18px rgba(31, 128, 72, 0.4);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: #1e1c3a;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.filter-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group-end {
  margin-left: auto;
  justify-content: flex-end;
}

.filter-group-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid rgba(91, 88, 192, 0.25);
  background: transparent;
  color: var(--muted);
  transition: background 100ms, border-color 100ms, color 100ms;
  user-select: none;
}

.chip input[type="checkbox"] {
  display: none;
}

/* Quality chips: active = lavender fill */
.q-chip:has(input:checked) {
  background: rgba(30, 28, 58, 0.1);
  border-color: #5b58c0;
  color: #3e3c96;
}

/* Enchant E0: active = muted lavender */
.e0-chip:has(input:checked) {
  background: rgba(30, 28, 58, 0.1);
  border-color: #5b58c0;
  color: #3e3c96;
}

/* Enchant E1-E4: active = lavender (same as quality) */
.e-chip:has(input:checked) {
  background: rgba(30, 28, 58, 0.1);
  border-color: #5b58c0;
  color: #3e3c96;
}

/* City chips: active = lavender fill */
.city-chip:has(input:checked) {
  background: rgba(30, 28, 58, 0.1);
  border-color: #5b58c0;
  color: #3e3c96;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.compact {
  gap: 10px;
}

label {
  color: #3a3560;
  font-weight: 800;
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(110, 100, 160, 0.25);
  background: #f0eeff;
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms, background 160ms ease, color 160ms ease;
}

input[readonly] {
  color: #5a5580;
  background: #e8e4f8;
}

input::placeholder {
  color: #9a96b8;
}

input:focus,
select:focus {
  border-color: #5b58c0;
  box-shadow: 0 0 0 3px rgba(91, 88, 192, 0.14);
}

small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: span 4;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.notice {
  padding: 20px 24px;
  color: #5a5580;
  background: #ffffff;
  font-size: 14px;
}

.notice-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #3e3c96;
  margin-bottom: 12px;
}

.notice-list {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #5a5580;
  line-height: 1.5;
}

.notice-list li strong {
  color: #3e3c96;
}

.notice-list em {
  font-style: normal;
  color: #5b58c0;
}

.notice strong,
.profit {
  color: #3e3c96;
}

.coverage {
  padding: 0 0 18px;
}

.coverage-head {
  padding-bottom: 0;
}

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 22px;
}

.coverage-card {
  border: 1.5px solid rgba(144, 146, 201, 0.35);
  background: rgba(144, 146, 201, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.coverage-city,
.item {
  font-weight: 900;
}

.coverage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.coverage-empty {
  padding: 0 22px;
}

.table-card {
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 10px;
}

h3 {
  margin: 0;
  font-size: 22px;
}

.table-wrap {
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) { width: 24%; }

th:nth-child(2),
td:nth-child(2) { width: 9%; }

th:nth-child(3),
td:nth-child(3) { width: 8%; }

th:nth-child(4),
td:nth-child(4) { width: 9%; }

th:nth-child(5),
td:nth-child(5) { width: 10%; }

th:nth-child(6),
td:nth-child(6) { width: 8%; }

th:nth-child(7),
td:nth-child(7) { width: 9%; }

th:nth-child(8),
td:nth-child(8) { width: 8%; }

th:nth-child(9),
td:nth-child(9) { width: 8%; }

th:nth-child(10),
td:nth-child(10) { width: 7%; }

th {
  text-align: left;
  color: #46488a;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.15;
  background: rgba(144, 146, 201, 0.1);
}

th,
td {
  padding: 10px 10px;
  border-top: 1px solid rgba(144, 146, 201, 0.15);
  vertical-align: top;
  overflow-wrap: anywhere;
}

td {
  font-size: 13px;
  color: var(--ink);
}

tbody tr:hover {
  background: rgba(144, 146, 201, 0.07);
}

tr.suspicious td {
  opacity: 0.52;
  color: rgba(30, 28, 58, 0.72);
}

tr.suspicious {
  background: rgba(55, 53, 79, 0.14);
}

tr.suspicious td:first-child {
  box-shadow: inset 4px 0 0 rgba(160, 98, 24, 0.8);
}

.item-suspicious {
  background: rgba(180, 80, 0, 0.18);
  color: #8d4100;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

body.dark tr.suspicious {
  background: rgba(0, 0, 0, 0.36);
}

body.dark tr.suspicious td {
  color: rgba(236, 236, 246, 0.68);
}

body.dark .item-suspicious {
  background: rgba(255, 130, 0, 0.22);
  color: #f2a14b;
}

.item-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: var(--radius-sm);
  background: rgba(144, 146, 201, 0.12);
  border: 1px solid rgba(144, 146, 201, 0.25);
}

.item-meta,
.price-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.item {
  display: block;
  font-size: 14px;
  line-height: 1.15;
  word-break: break-word;
}

.item-quality,
.item-enchant,
.pill {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(144, 146, 201, 0.15);
  border: 1px solid rgba(91, 88, 192, 0.22);
  white-space: normal;
  color: #3e3c96;
}

.item-enchant {
  background: rgba(144, 146, 201, 0.15);
  border-color: rgba(91, 88, 192, 0.22);
  color: var(--muted);
  font-weight: 600;
}

.item-enchant.e1,
.item-enchant.e2,
.item-enchant.e3,
.item-enchant.e4 {
  background: rgba(255, 185, 0, 0.13);
  border-color: rgba(200, 140, 0, 0.35);
  color: #8a5c00;
  font-weight: 700;
}

.cache-note {
  color: #5b58c0;
  font-weight: 600;
}

.cache-note.warning {
  color: #b84a00;
  font-weight: 600;
}

.price-mode {
  color: var(--muted);
}

.icon {
  width: 34px;
  height: 34px;
  display: block;
  border-radius: 8px;
}

.profit {
  font-weight: 900;
}

.pill {
  font-weight: 800;
  font-size: 12px;
}

.pill.good,
.pill.excellent {
  background: #1e1c3a;
  border-color: #1e1c3a;
  color: #ffffff;
}

.pill.warning {
  background: #ffe4d0;
  border-color: #f5b88a;
  color: #7a3000;
}

.pill.stale {
  background: rgba(144, 146, 201, 0.2);
  border-color: rgba(91, 88, 192, 0.3);
  color: #3e3c96;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px;
}

/* ─── Dark / Light mode toggle ─────────────────────────────────────────── */
.mode-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(20, 18, 50, 0.25);
  border-radius: 999px;
  padding: 3px;
  margin-left: auto;
  margin-right: 8px;
  cursor: pointer;
  user-select: none;
  min-width: 120px;
}

/* Sliding indicator */
.mode-toggle::before {
  content: '';
  position: absolute;
  inset: 3px;
  width: calc(50% - 3px);
  background: #1e1c3a;
  border-radius: 999px;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

body:not(.dark) .mode-toggle::before {
  transform: translateX(100%);
}

.seg {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.45);
  transition: color 200ms ease;
  white-space: nowrap;
}

body.dark .dark-seg     { color: #ffffff; }
body:not(.dark) .light-seg { color: #ffffff; }

/* ─── Dark mode ──────────────────────────────────────────────────── */
body.dark {
  --ink:   #dddaf5;
  --muted: #9490b8;
  --line:           rgba(91, 88, 192, 0.2);
  --line-strong:    rgba(91, 88, 192, 0.38);
  --shadow:         0 8px 32px rgba(0, 0, 0, 0.55);
  --shadow-card:    0 4px 20px rgba(0, 0, 0, 0.45);

  background-image:
    radial-gradient(ellipse 70% 55% at 30% 30%, rgba(91, 88, 192, 0.18) 0%, transparent 55%),
    radial-gradient(ellipse 55% 50% at 70% 70%, rgba(0, 0, 20, 0.35) 0%, transparent 55%);
  background-color: #0f0e22;
  background-size: 220% 220%, 200% 200%;
  background-attachment: fixed, fixed;
}

/* Cards */
body.dark .card {
  background: #1a1830;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), 0 10px 36px rgba(0,0,0,0.5);
}

/* Topbar */
body.dark .topbar {
  background: rgba(0, 0, 0, 0.2);
  border-bottom-color: rgba(91, 88, 192, 0.3);
}

/* Sidebar */
body.dark .sidebar {
  background: #0f0e22;
  border-right-color: rgba(91, 88, 192, 0.25);
}

body.dark .logo-mark {
  background: rgba(91, 88, 192, 0.22);
  border-color: rgba(91, 88, 192, 0.38);
}

body.dark .sidebar-icon:hover {
  background: rgba(91, 88, 192, 0.18);
}

/* Mode pill active state in dark */
body.dark .mode-pill {
  background: #5b58c0;
}

/* Inputs */
body.dark input,
body.dark select {
  background: #222044;
  border-color: rgba(91, 88, 192, 0.3);
  color: #dddaf5;
}

body.dark input[readonly] {
  background: #1a1830;
  color: #9490b8;
}

body.dark input::placeholder {
  color: #6b6898;
}

body.dark label {
  color: #b0aee8;
}

body.dark .section-title {
  border-bottom-color: rgba(91, 88, 192, 0.18);
}

body.dark .notice {
  background: #1a1830;
  color: #9490b8;
}

body.dark .notice-title {
  color: #b0aee8;
}

body.dark .notice-list li strong {
  color: #b0aee8;
}

body.dark .notice-list em {
  color: #9490b8;
}

body.dark .notice strong,
body.dark .profit {
  color: #b0aee8;
}

body.dark .coverage-card {
  background: rgba(91, 88, 192, 0.1);
  border-color: rgba(91, 88, 192, 0.25);
}

body.dark th {
  background: rgba(91, 88, 192, 0.12);
  color: #b0aee8;
}

body.dark th,
body.dark td {
  border-top-color: rgba(91, 88, 192, 0.12);
}

body.dark tbody tr:hover {
  background: rgba(91, 88, 192, 0.1);
}

body.dark .action-button.secondary {
  background: #222044;
  color: #b0aee8;
  border-color: rgba(91, 88, 192, 0.35);
}

body.dark .stats-panel-compact div {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(91, 88, 192, 0.3);
}

body.dark .chip {
  border-color: rgba(91, 88, 192, 0.22);
  color: #9490b8;
}

body.dark .q-chip:has(input:checked) {
  background: rgba(91, 88, 192, 0.2);
  border-color: #5b58c0;
  color: #b0aee8;
}

body.dark .e0-chip:has(input:checked) {
  background: rgba(91, 88, 192, 0.2);
  border-color: #5b58c0;
  color: #b0aee8;
}

body.dark .e-chip:has(input:checked) {
  background: rgba(91, 88, 192, 0.2);
  border-color: #5b58c0;
  color: #b0aee8;
}

body.dark .city-chip:has(input:checked) {
  background: rgba(91, 88, 192, 0.2);
  border-color: #5b58c0;
  color: #b0aee8;
}

body.dark .filter-group-label {
  color: #9490b8;
}

body.dark .cache-note {
  color: #b0aee8;
}

body.dark .pill.stale {
  background: rgba(91, 88, 192, 0.2);
  border-color: rgba(91, 88, 192, 0.4);
  color: #b0aee8;
}

body.dark .item-enchant {
  background: rgba(91, 88, 192, 0.15);
  border-color: rgba(91, 88, 192, 0.3);
  color: #9490b8;
}

body.dark .item-enchant.e1,
body.dark .item-enchant.e2,
body.dark .item-enchant.e3,
body.dark .item-enchant.e4 {
  background: rgba(255, 185, 0, 0.1);
  border-color: rgba(200, 140, 0, 0.3);
  color: #d4a800;
}

@media (max-width: 900px) {
  .sidebar {
    width: 52px;
  }

  .stats-panel {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-panel-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: var(--radius-md);
  }

  .stats-panel-compact div {
    min-width: 0;
    border-radius: var(--radius-xs);
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coverage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-2 {
    grid-column: span 2;
  }

  .span-4 {
    grid-column: span 2;
  }

  th,
  td {
    padding: 9px 7px;
  }

  th {
    font-size: 8px;
    letter-spacing: 0.05em;
  }

  td {
    font-size: 12px;
  }

  .item-cell {
    gap: 10px;
  }

  .icon-frame {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .icon {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 560px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 10px 16px;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }

  .sidebar-brand {
    margin-bottom: 0;
    margin-right: auto;
  }

  .shell {
    width: min(100% - 18px, 1200px);
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-panel-compact {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar-actions {
    width: 100%;
  }

  .action-button {
    flex: 1 1 0;
  }

  .filter-grid,
  .coverage-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
