:root {
  color-scheme: light;
  --bg: #eef3ed;
  --ink: #121712;
  --muted: #687168;
  --soft: #f5f7f4;
  --surface: #ffffff;
  --line: #dde5db;
  --line-strong: #c9d5c6;
  --accent: #0ca64b;
  --accent-dark: #087838;
  --accent-soft: #e4f7eb;
  --warn: #f4b63f;
  --danger: #d73b3b;
  --shadow: 0 18px 42px rgba(28, 42, 30, 0.1);
  --shadow-soft: 0 8px 24px rgba(28, 42, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -4%, rgba(12, 166, 75, 0.16), transparent 28%),
    linear-gradient(180deg, #f7faf5 0%, var(--bg) 42%, #e8eee6 100%);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

button {
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0 104px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  background: rgba(247, 250, 245, 0.88);
  border-bottom: 1px solid rgba(212, 222, 208, 0.78);
  backdrop-filter: blur(18px);
}

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

.brandMark {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #101610;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-soft);
}

.brandMark::before,
.brandMark::after,
.brandMark span {
  content: "";
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.brandMark::before {
  width: 26px;
  height: 26px;
  opacity: 0.35;
}

.brandMark::after {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.brandMark span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(12, 166, 75, 0.85);
}

h1 {
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

.topbar p,
.screenHead p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.ghostButton {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border-color: rgba(12, 166, 75, 0.26);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-dark);
  font-weight: 850;
}

.heroPanel {
  margin: 10px 12px 0;
  padding: 12px;
  border: 1px solid rgba(196, 211, 192, 0.72);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 247, 239, 0.96)),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.heroStatus {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.heroStatus div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.heroStatus strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(12, 166, 75, 0.12);
}

.dot.paused {
  background: #9ba49a;
  box-shadow: 0 0 0 5px rgba(100, 110, 99, 0.1);
}

.metricsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.metric {
  min-width: 0;
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(218, 228, 214, 0.85);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.metric span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 12px 12px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  max-width: 260px;
  padding: 0 12px;
  border-radius: 12px;
  color: #4f5a50;
  font-size: 13px;
  font-weight: 780;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(18, 23, 18, 0.04);
}

.chipLabel {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip.active {
  border-color: rgba(12, 166, 75, 0.25);
  background: #102017;
  color: #fff;
}

.chipCount {
  display: inline-grid;
  place-items: center;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(12, 166, 75, 0.12);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
}

.chip.active .chipCount {
  background: rgba(255, 255, 255, 0.15);
  color: #dff9e8;
}

.screen {
  padding: 0 12px;
}

.screenHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  gap: 12px;
  margin-bottom: 8px;
}

.screenHead > div:first-child {
  min-width: 0;
}

.headActions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sortSelect {
  width: 86px;
  height: 42px;
  padding: 0 8px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.iconButton {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 20px;
  font-weight: 850;
  box-shadow: 0 1px 0 rgba(18, 23, 18, 0.04);
}

.wideIcon {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.dangerIcon {
  border-color: rgba(215, 59, 59, 0.18);
  background: #fff1f1;
  color: var(--danger);
}

.listings,
.queries {
  display: grid;
  gap: 10px;
}

.listing {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 11px;
  min-height: 142px;
  padding: 10px;
  border: 1px solid rgba(211, 223, 207, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.thumbWrap {
  position: relative;
  overflow: hidden;
  width: 118px;
  height: 122px;
  border-radius: 13px;
  background: linear-gradient(135deg, #dfe7dd, #f8faf6);
}

.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbFallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #66705f;
  font-size: 12px;
  font-weight: 900;
}

.listingBadge {
  position: absolute;
  top: 8px;
  left: 8px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(16, 32, 23, 0.84);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  line-height: 24px;
  backdrop-filter: blur(10px);
}

.listingBody {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 24px;
}

.deleteListingButton {
  position: absolute;
  top: -1px;
  right: -2px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(215, 59, 59, 0.16);
  border-radius: 10px;
  background: #fff5f5;
  color: var(--danger);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.listing h3 {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.24;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.price {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.05;
  font-weight: 950;
}

.listingMeta {
  overflow: hidden;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: #556052;
  font-size: 11px;
  font-weight: 800;
}

.tag.accent {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.listingFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.seenAt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.openLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(12, 166, 75, 0.18);
}

.query {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid rgba(211, 223, 207, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.queryTop {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.query strong {
  font-size: 14px;
  line-height: 1.25;
}

.query span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.danger {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border-color: rgba(215, 59, 59, 0.18);
  background: #fff1f1;
  color: var(--danger);
  font-size: 12px;
  font-weight: 850;
}

.queryForm {
  display: grid;
  gap: 9px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(211, 223, 207, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-soft);
}

.queryForm input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfa;
  color: var(--ink);
}

.primary {
  min-height: 44px;
  border-radius: 12px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
}

.bottomNav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) 96px;
  gap: 5px;
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  border: 1px solid rgba(211, 223, 207, 0.95);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -12px 34px rgba(28, 42, 30, 0.12);
  backdrop-filter: blur(18px);
}

.navItem,
.intervalControl {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 54px;
  padding: 4px 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #4d584e;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
}

.navItem span,
.intervalControl span {
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1;
}

.navItem.active {
  background: #102017;
  color: #fff;
}

.navItem.active span {
  color: #b9f4cd;
}

.intervalControl select {
  width: 100%;
  min-height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

@media (min-width: 780px) {
  .app {
    margin-top: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(211, 223, 207, 0.8);
    border-radius: 28px;
    background: rgba(250, 252, 248, 0.5);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
}

@media (max-width: 374px) {
  .listing {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .thumbWrap {
    width: 104px;
  }

  .price {
    font-size: 17px;
  }

  .bottomNav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 86px;
  }
}
