:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #f0f5ed;
  --ink: #18201d;
  --muted: #667169;
  --line: #dce3dd;
  --accent: #24785f;
  --accent-dark: #155a46;
  --accent-soft: #dff0e9;
  --blue: #315f9d;
  --amber: #b7642a;
  --shadow: 0 18px 50px rgba(24, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.section-heading p,
.metric span {
  color: var(--muted);
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.nav-item.active,
.nav-item:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-weight: 700;
}

.source-status {
  display: grid;
  gap: 10px;
}

.language-switcher {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.lang-btn {
  background: none;
  border: 1px solid transparent;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: var(--accent-soft);
}

.lang-btn.active {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.source-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.source-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.source-chip strong {
  color: var(--ink);
}

.source-open {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--accent-dark);
  font-weight: 800;
}

.workspace {
  width: min(1400px, 100%);
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:hover {
  background: var(--accent-dark);
}

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

.danger-button {
  background: #fff4ef;
  color: #a33f24;
}

.wide {
  width: 100%;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric strong {
  font-size: 1.55rem;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-panel {
  display: grid;
  gap: 14px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.option-box {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-box.full-row {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.property-type-box {
  background: #fbfcfb;
}

legend {
  padding: 0 7px;
  color: var(--muted);
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.check-label:hover {
  border-color: #b9c8bd;
  background: var(--surface-strong);
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfb;
  color: var(--ink);
  outline: none;
}

input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-actions-row {
  display: flex;
  gap: 12px;
}

.form-actions-row .primary-button {
  flex: 2;
}

.form-actions-row .ghost-button {
  flex: 1;
}

@media (max-width: 640px) {
  .form-actions-row {
    flex-direction: column;
  }
}

.full-row {
  grid-column: 1 / -1;
}

.watchdog-list,
.offer-list {
  display: grid;
  gap: 12px;
}

.watchdog-card,
.offer-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.card-top h3 {
  margin: 0 0 5px;
  font-size: 1rem;
}

.meta-line,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #405047;
  font-size: 0.82rem;
  font-weight: 700;
}

.pill.blue {
  background: #e5eef9;
  color: var(--blue);
}

.pill.amber {
  background: #fff0df;
  color: var(--amber);
}

.source-pill {
  text-decoration: none;
}

.source-pill:hover {
  outline: 2px solid rgba(183, 100, 42, 0.2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.offer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 8px 0;
}

.filter-group {
  display: flex;
  align-items: center;
}

.filter-select {
  width: auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 36px 0 16px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23667169' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  transition: all 160ms ease;
}

.filter-select:hover {
  border-color: var(--accent);
  background-color: var(--surface-strong);
}

.price-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-input {
  width: 110px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 12px;
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 160ms ease;
}

.filter-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-separator {
  color: var(--muted);
  font-weight: 400;
}

.chip-group {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--surface-strong);
  border-radius: 24px;
  border: 1px solid var(--line);
}

.chip {
  border: 0;
  border-radius: 20px;
  padding: 6px 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.chip:hover {
  color: var(--ink);
}

.chip.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tab-group {
  display: flex;
  gap: 12px;
  border-bottom: 2px solid var(--line);
  padding: 0 4px;
  margin-top: 8px;
  width: 100%;
}

.tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--accent);
}

.tab.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 160ms ease;
}

.ghost-button:hover {
  background: #fff4ef;
  border-color: #f5dcd5;
  color: #a33f24;
}

.ghost-button .icon {
  font-size: 1.1rem;
}

@media (max-width: 640px) {
  .offer-toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .filter-select, 
  .price-filters,
  .chip-group {
    width: 100%;
    justify-content: center;
  }

  .filter-input {
    flex: 1;
    width: auto;
  }

  .chip {
    flex: 1;
    text-align: center;
  }
}


.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #cbd5cc;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 160ms ease;
}

.switch.on {
  background: var(--accent);
}

.switch.on::after {
  transform: translateX(20px);
}

.offers-panel {
  margin-top: 18px;
}

.offer-card {
  grid-template-columns: 132px minmax(0, 1fr) auto;
  align-items: center;
}

.offer-source-group {
  display: grid;
  gap: 12px;
}

.offer-source-group h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 0;
  padding: 10px 0 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
}

.offer-source-group h3 span {
  color: var(--muted);
  font-size: 0.9rem;
}

.offer-card a {
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.offer-image-link {
  display: block;
  width: 132px;
  height: 94px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-strong);
}

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

.offer-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-weight: 850;
}

.price {
  font-size: 1.1rem;
  font-weight: 850;
  white-space: nowrap;
}

.duplicate-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  border: 1px solid #fde68a;
  vertical-align: middle;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  padding: 16px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast strong {
  display: block;
  margin-bottom: 3px;
}

.location-label {
  position: relative;
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.meta-line.metrics {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.meta-line.metrics span {
  background: var(--surface-strong);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .source-status {
    margin-top: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-grid,
  .metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .section-heading.row,
  .card-top,
  .offer-card {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .offer-toolbar,
  .chip-group {
    width: 100%;
  }

  .chip {
    flex: 1;
  }

  .offer-image-link {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .field-row,
  fieldset,
  .option-box.full-row,
  .nav-list,
  .source-status {
    grid-template-columns: 1fr;
  }
}
