:root {
  --yellow: #ffba00;
  --yellow-dark: #e6a700;
  --brown: #5a4a42;
  --brown-dark: #463933;
  --text: #333;
  --muted: #8a7d77;
  --line: #e6e4e3;
  --bg: #f7f7f7;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brown); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* top strip */
.topbar { background: var(--brown-dark); color: #dedbd9; font-size: 12px; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 30px; }
.debug-toggle { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 5px; }

/* header + search */
.header { background: #fff; border-bottom: 3px solid var(--yellow); }
.header-inner { display: flex; align-items: flex-start; gap: 28px; padding: 16px; }
.logo { line-height: 44px; font-size: 30px; font-weight: 700; color: var(--brown); letter-spacing: -1px; white-space: nowrap; }
.logo span { color: var(--yellow); }
.logo:hover { text-decoration: none; }

.search-form { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; align-items: flex-start; }
.search #q, .search #limit {
  height: 44px;
  font: inherit; font-size: 16px;
  border: 2px solid var(--yellow); border-right: 0;
  outline: none;
}
/* grows with the text (app.js) up to a cap; drag the corner for more */
.search #q {
  flex: 1; min-width: 0;
  min-height: 44px; max-height: 70vh;
  padding: 9px 14px; line-height: 22px;
  border-right: 2px solid var(--yellow); /* full-height divider when stretched taller than #limit */
  border-radius: 4px 0 0 4px;
  resize: vertical;
}
.search #limit {
  flex: 0 0 72px; width: 72px;
  padding: 0 8px; text-align: center;
  border-left: 0; border-radius: 0;
}
.search #limit::placeholder { color: #aaa; }
.search button {
  height: 44px; padding: 0 26px;
  font: inherit; font-size: 16px; font-weight: 700;
  color: var(--brown-dark); background: var(--yellow);
  border: 0; border-radius: 0 4px 4px 0;
  cursor: pointer;
}
.search button:hover { background: var(--yellow-dark); }
.real-search {
  height: 44px; padding: 0 16px; margin-left: 8px;
  display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 700; white-space: nowrap;
  color: var(--brown); background: #fff;
  border: 2px solid var(--brown); border-radius: 4px;
}
.real-search:hover { background: var(--brown); color: #fff; text-decoration: none; }

/* filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.filter { display: flex; align-items: center; gap: 6px; }
.filter input {
  height: 32px; width: 90px; padding: 0 8px;
  font: inherit; color: var(--text);
  border: 1px solid #d9d9d9; border-radius: 4px;
  outline: none;
}
.filter input:focus { border-color: var(--yellow); }
.filter-city input { width: 210px; }
.filter-boost input { width: 120px; height: auto; padding: 0; border: 0; accent-color: var(--yellow); }
.filter-boost output { min-width: 36px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.filter-boost.off { opacity: .5; }
.filter input.invalid { border-color: #c62828; background: #fdf3f3; }
.clear-filters {
  height: 32px; padding: 0 10px;
  font: inherit; color: var(--muted); background: none;
  border: 0; cursor: pointer; text-decoration: underline;
}
.clear-filters:hover { color: var(--brown); }

/* page chrome */
.crumbs { margin: 14px 0 6px; font-size: 12px; color: var(--muted); }
.crumbs span { margin: 0 4px; }
.summary { margin: 0 0 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.summary b { color: var(--text); }
.debug-only { display: none; }
body.debug .debug-only { display: inline; }

/* result rows */
.results { background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.results:empty { display: none; }

.item {
  display: flex; gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: inherit;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: #fffaf0; text-decoration: none; }
.item:hover .item-title { text-decoration: underline; }

.thumb {
  position: relative; flex: 0 0 160px; height: 120px;
  background: #eee; border-radius: 4px; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 12px; }
.thumb .count {
  position: absolute; right: 4px; bottom: 4px;
  background: rgba(0, 0, 0, .6); color: #fff;
  font-size: 11px; padding: 1px 5px; border-radius: 2px;
}

.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-title { color: var(--brown); font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.item-desc {
  color: #555; font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}

.services { list-style: none; margin: 0; padding: 0; font-size: 13px; max-width: 460px; }
.services li { display: flex; gap: 8px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.services li:last-child { border-bottom: 0; }
.svc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-price { font-weight: 700; white-space: nowrap; }
.services .more { color: var(--muted); font-size: 12px; }

.item-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.item-tags:not(:has(.tag:not(.dbg-tag))) { display: none; }
body.debug .item-tags { display: flex; }
.tag { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: #f0eeed; color: var(--brown); }
.tag.remote { background: #e6eef8; color: #1a5aa6; }
.tag.reviews { background: #fff3cc; color: #7a5a00; }
.tag.dbg-tag { display: none; font-family: Consolas, monospace; }
body.debug .tag.dbg-tag { display: inline-block; }
.tag.dbg-tag.active { background: #e5f4e3; color: #2e7d32; }
.tag.dbg-tag.inactive { background: #fde8e8; color: #c62828; }
.item-meta { margin-top: auto; font-size: 12px; color: var(--muted); }

.item-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; }
.dbg {
  display: none;
  font: 11px/1.4 Consolas, monospace;
  background: #fff4d6; color: #7a5200; border: 1px solid #f0d58a;
  padding: 2px 6px; border-radius: 2px; white-space: nowrap;
}
body.debug .dbg { display: inline-block; }

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

/* pagination */
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 18px 0 30px; }
.pager a, .pager span {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; border-radius: 3px;
}
.pager a:hover { border-color: var(--yellow); text-decoration: none; }
.pager .current { background: var(--yellow); border-color: var(--yellow); color: var(--brown-dark); font-weight: 700; }

.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; padding: 16px 0; }

@media (max-width: 640px) {
  .header-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .logo { font-size: 26px; }
  .search { flex-wrap: wrap; }
  .search #q { flex-basis: 0; }
  .search button { padding: 0 14px; }
  .real-search { flex-basis: 100%; justify-content: center; margin: 8px 0 0; }
  .filter-city { flex-basis: 100%; }
  .filter-city input { flex: 1; min-width: 0; }
  .item { flex-wrap: wrap; }
  .thumb { flex-basis: 110px; height: 85px; }
  .item-body { flex-basis: calc(100% - 124px); }
  .item-side { flex-basis: 100%; flex-direction: row; }
}
