:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --bg-glow: rgba(11, 107, 95, 0.08);
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --panel-soft: #f8fbfa;
  --surface: #ffffff;
  --surface-muted: #f7faf9;
  --surface-hover: #fbfdfc;
  --sidebar: #10231f;
  --sidebar-end: #0b1917;
  --sidebar-text: #eef8f5;
  --sidebar-muted: #b9cbc6;
  --sidebar-hover: rgba(255, 255, 255, 0.1);
  --brand-mark-bg: #d8efe7;
  --brand-mark-text: #10231f;
  --text: #17212b;
  --text-strong: #101820;
  --text-soft: #344250;
  --muted: #66717d;
  --placeholder: #8b97a3;
  --border: #dce2e7;
  --border-strong: #bfddd6;
  --accent: #0b6b5f;
  --accent-hover: #084d44;
  --accent-contrast: #ffffff;
  --accent-soft: #eef6f4;
  --accent-soft-strong: #dff1ed;
  --link: #0b6b5f;
  --warn: #9a5b00;
  --warn-soft: #fff4dc;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --info: #356f9f;
  --info-soft: #eaf3fb;
  --purple: #6a5acd;
  --purple-soft: #f0eefd;
  --input-bg: #ffffff;
  --input-bg-soft: #fbfcfc;
  --input-disabled: #eef2f4;
  --table-head: #f8fafb;
  --row-hover: #fbfdfc;
  --visited: #f3fbf8;
  --toast-bg: rgba(255, 255, 255, 0.97);
  --shadow: 0 14px 34px rgba(23, 33, 43, 0.08);
  --shadow-soft: 0 10px 26px rgba(23, 33, 43, 0.06);
  --shadow-strong: 0 20px 55px rgba(23, 33, 43, 0.16);
  --focus: rgba(11, 107, 95, 0.24);
  --focus-ring: 0 0 0 4px rgba(11, 107, 95, 0.1);
  --price: #0a4039;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1114;
  --bg-glow: rgba(72, 208, 184, 0.11);
  --panel: #111a20;
  --panel-raised: #152028;
  --panel-soft: #101920;
  --surface: #152128;
  --surface-muted: #101820;
  --surface-hover: #1a2931;
  --sidebar: #071210;
  --sidebar-end: #050b0a;
  --sidebar-text: #eef9f6;
  --sidebar-muted: #93aca5;
  --sidebar-hover: rgba(72, 208, 184, 0.14);
  --brand-mark-bg: rgba(72, 208, 184, 0.2);
  --brand-mark-text: #eef9f6;
  --text: #e7edf0;
  --text-strong: #f7fbfc;
  --text-soft: #c6d3d8;
  --muted: #9fb0b8;
  --placeholder: #788b94;
  --border: #25353d;
  --border-strong: #35665f;
  --accent: #48d0b8;
  --accent-hover: #7ee2d1;
  --accent-contrast: #051411;
  --accent-soft: rgba(72, 208, 184, 0.13);
  --accent-soft-strong: rgba(72, 208, 184, 0.2);
  --link: #79ddcd;
  --warn: #f2bd62;
  --warn-soft: rgba(242, 189, 98, 0.16);
  --danger: #ff8f82;
  --danger-soft: rgba(255, 143, 130, 0.13);
  --info: #8fc5f2;
  --info-soft: rgba(143, 197, 242, 0.14);
  --purple: #b7adff;
  --purple-soft: rgba(183, 173, 255, 0.14);
  --input-bg: #0e171c;
  --input-bg-soft: #101a20;
  --input-disabled: #17232a;
  --table-head: #101920;
  --row-hover: #17242b;
  --visited: rgba(72, 208, 184, 0.11);
  --toast-bg: rgba(17, 26, 32, 0.98);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.24);
  --shadow-strong: 0 24px 65px rgba(0, 0, 0, 0.44);
  --focus: rgba(72, 208, 184, 0.3);
  --focus-ring: 0 0 0 4px rgba(72, 208, 184, 0.12);
  --price: #9bf0df;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 5%, var(--bg-glow), transparent 28%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  background: var(--input-disabled);
  color: var(--muted);
  opacity: 0.72;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

h1 {
  margin-bottom: 16px;
  color: var(--text-strong);
  font-size: 42px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  color: var(--text-strong);
  font-size: 28px;
}

h3 {
  margin-bottom: 6px;
  color: var(--text-strong);
  font-size: 18px;
}

a {
  color: var(--link);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.panel-header p,
.search-hero p {
  color: var(--muted);
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 12%, var(--bg-glow), transparent 32%),
    linear-gradient(135deg, var(--bg) 0%, var(--panel-soft) 100%);
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 48px;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

textarea {
  min-height: 96px;
  padding-block: 10px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

select option {
  background: var(--panel);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--focus);
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.primary,
.secondary,
.ghost,
.status-btn,
.followup-add-btn,
.theme-toggle {
  min-height: 40px;
  border-radius: 6px;
  font-weight: 850;
}

.primary {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0 14px;
}

.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 28%, transparent);
  transform: translateY(-1px);
}

.secondary {
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  padding: 0 12px;
}

.secondary:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.ghost {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--sidebar-text) 26%, transparent);
  background: transparent;
  color: var(--sidebar-text);
  padding: 0 14px;
}

.ghost:hover {
  border-color: color-mix(in srgb, var(--sidebar-text) 52%, transparent);
  background: var(--sidebar-hover);
}

.error {
  margin-bottom: 0;
  color: var(--danger);
  font-weight: 750;
}

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

.sidebar {
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 22px;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-end) 100%);
  color: var(--sidebar-text);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand-mark-bg);
  color: var(--brand-mark-text);
  font-weight: 900;
}

.brand div {
  display: grid;
  gap: 2px;
}

.brand span:last-child {
  color: var(--sidebar-muted);
  font-size: 13px;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

.tab {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: var(--sidebar-muted);
  font-weight: 850;
  text-align: left;
}

.tab.active,
.tab:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.tab:hover {
  transform: translateX(2px);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel-raised);
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  padding: 0 12px;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.sidebar-theme-toggle {
  width: 100%;
  border-color: color-mix(in srgb, var(--sidebar-text) 24%, transparent);
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text);
}

.sidebar-theme-toggle:hover {
  border-color: color-mix(in srgb, var(--sidebar-text) 48%, transparent);
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.theme-toggle-track {
  width: 42px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
}

.theme-toggle-thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 42%, transparent);
  transform: translateX(0);
  transition: transform 180ms ease, background 180ms ease;
}

:root[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(18px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric {
  position: relative;
  min-height: 112px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-raised) 0%, var(--panel-soft) 100%);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.metric:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.metric:nth-child(2)::before {
  background: var(--info);
}

.metric:nth-child(3)::before {
  background: var(--warn);
}

.metric:nth-child(4)::before {
  background: var(--purple);
}

.metric:nth-child(6)::before {
  background: var(--muted);
}

.metric strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text-strong);
  font-size: 34px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.tab-panel {
  margin-top: 0;
}

.panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.filters {
  min-width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.filters input {
  grid-column: 1 / -1;
}

.filters input[type="email"] {
  grid-column: auto;
}

.followup-filter-bar {
  display: grid;
  grid-template-columns: minmax(170px, 1.25fr) repeat(5, minmax(130px, 0.85fr)) minmax(180px, 1fr) minmax(220px, 1.4fr);
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-soft), var(--panel));
}

.followup-filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.followup-filter-bar input,
.followup-filter-bar select {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.followup-filter-wide {
  min-width: 0;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
}

.search-pagination {
  display: flex;
  justify-content: flex-end;
  padding: 0 18px 14px;
  background: var(--panel);
}

.pagination {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.pagination strong {
  color: var(--text-strong);
  font-size: 12px;
}

.pagination button {
  min-height: 32px;
  padding: 7px 11px;
  font-size: 12px;
}

table {
  width: 100%;
  min-width: 1560px;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

thead th:last-child,
tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 94px;
  max-width: 112px;
  background: var(--panel);
  box-shadow: -8px 0 14px rgba(15, 23, 42, 0.08);
}

thead th:last-child {
  z-index: 3;
  background: var(--table-head);
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 9px;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  background: var(--panel);
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

tbody tr:hover {
  background: var(--row-hover);
}

tr.last-visited,
.followup-item.last-visited {
  background: var(--visited);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow-soft);
  animation: visitedPulse 520ms ease;
}

@keyframes visitedPulse {
  0% {
    outline: 0 solid transparent;
  }
  45% {
    outline: 5px solid var(--focus);
  }
  100% {
    outline: 0 solid transparent;
  }
}

td strong {
  display: block;
  max-width: 360px;
  margin-bottom: 4px;
  color: var(--text-strong);
}

.property-title {
  display: -webkit-box;
  max-width: 250px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.address-cell {
  max-width: 190px;
  color: var(--text-soft);
  line-height: 1.35;
}

.description-cell {
  display: -webkit-box;
  min-width: 220px;
  max-width: 300px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.id-cell {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.property-thumb {
  position: relative;
  width: 74px;
  height: 56px;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.property-thumb > img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 7px;
  object-fit: cover;
}

.property-thumb.is-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--surface-muted), var(--panel-soft));
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.property-thumb-preview {
  position: absolute;
  left: 88px;
  top: 0;
  z-index: 15;
  width: 220px;
  height: 160px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition: opacity 150ms ease, transform 150ms ease;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel-raised);
  box-shadow: var(--shadow-strong);
  padding: 6px;
}

.property-thumb-preview img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.property-thumb:hover .property-thumb-preview {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.feature-cell {
  min-width: 58px;
  color: var(--text-strong);
  font-weight: 850;
  white-space: nowrap;
}

.price,
.price-line {
  color: var(--price);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.15;
}

.price-equivalent {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.price-line {
  margin: 6px 0;
}

.currency-badge,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 850;
}

.currency-badge {
  min-height: 20px;
  margin-top: 5px;
  padding: 0 7px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
}

.pill {
  min-height: 24px;
  padding: 0 9px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 12px;
}

.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

.followup-list {
  display: grid;
  background: var(--panel);
}

.followup-item {
  position: relative;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) minmax(230px, 0.5fr) 128px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 16px 18px;
}

.followup-media .property-thumb {
  width: 86px;
  height: 66px;
}

.followup-media .property-thumb-preview {
  left: 100px;
}

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

.followup-item.is-contacted {
  padding-left: 46px;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--panel) 42%);
}

.followup-item.is-contacted::before {
  content: "OK";
  position: absolute;
  top: 16px;
  left: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 10px;
  font-weight: 900;
}

.contact-lines {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.followup-description {
  display: -webkit-box;
  max-width: 620px;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.platform-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0 8px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.platform-link:hover {
  background: var(--accent-soft-strong);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent);
  text-decoration: none;
  transform: translateY(-1px);
}

.status-btn {
  align-self: start;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  padding: 0 14px;
}

.status-btn.contactado {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.followup-add-btn {
  min-height: 34px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0 12px;
}

.followup-add-btn:hover,
.status-btn:hover,
.secondary:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.followup-add-btn.added {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.empty {
  padding: 28px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-soft) 100%);
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.compact-empty {
  padding: 18px;
}

.notes-open-btn {
  min-height: 34px;
  padding: 0 10px;
}

.followup-actions {
  display: grid;
  align-content: start;
  gap: 8px;
}

.followup-actions button {
  width: 100%;
  min-height: 34px;
}

.flyer-btn:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.load-more-cell {
  text-align: center;
  background: var(--panel-soft);
}

.load-more-cell .secondary {
  min-width: 230px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px;
  background: var(--panel);
}

.notes-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-raised) 0%, var(--panel-soft) 100%);
  padding: 16px;
}

.notes-card-header,
.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.notes-card h4 {
  margin: 0;
  color: var(--text-strong);
  font-size: 16px;
}

.note-form {
  display: grid;
  gap: 10px;
}

.note-form textarea {
  min-height: 118px;
}

.form-actions,
.note-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notes-list {
  display: grid;
  gap: 10px;
}

.note-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px;
}

.note-copy {
  min-width: 0;
}

.note-copy strong {
  max-width: none;
  color: var(--text-strong);
}

.note-copy p {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.note-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.danger-action {
  color: var(--danger);
}

.notes-dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  overflow: auto;
  padding: 20px;
}

.notes-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.scraper-status {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
}

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

.scraper-card,
.scraper-run {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-raised) 0%, var(--panel-soft) 100%);
  padding: 14px;
}

.scraper-card span,
.scraper-run span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scraper-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text-strong);
  font-size: 20px;
}

.status-text.success {
  color: var(--accent-hover);
}

.status-text.warn {
  color: var(--warn);
}

.status-text.danger {
  color: var(--danger);
}

.scraper-next {
  margin: 0;
}

.scraper-runs {
  display: grid;
  gap: 10px;
}

.scraper-run {
  display: grid;
  gap: 10px;
}

.scraper-run strong {
  color: var(--text-strong);
}

.scraper-run p {
  margin: 0;
  color: var(--text-soft);
}

.scraper-run-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scraper-run-numbers span,
.scraper-log-lines span {
  border-radius: 999px;
  background: var(--surface-muted);
  padding: 5px 8px;
}

.scraper-log-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-panel-large h3 {
  font-size: 24px;
}

.search-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 18px;
  align-items: center;
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--panel) 0%, var(--accent-soft) 100%);
}

.search-hero p {
  max-width: 760px;
  margin-bottom: 0;
}

.search-summary {
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--panel-raised) 100%);
}

.search-summary strong {
  color: var(--accent-hover);
  font-size: 46px;
  line-height: 1;
}

.search-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.search-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.search-controls {
  display: grid;
  gap: 10px;
}

.compact-filters {
  grid-template-columns: minmax(280px, 1.15fr) minmax(420px, 1.4fr);
  align-items: stretch;
}

.filter-group {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(var(--filter-cols, 2), minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-raised) 0%, var(--panel-soft) 100%);
  padding: 24px 10px 10px;
  position: relative;
}

.filter-group legend {
  position: absolute;
  top: 8px;
  left: 10px;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.filter-group label {
  min-width: 0;
  gap: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
}

.filter-group input,
.filter-group select {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 9px;
  background: linear-gradient(180deg, var(--input-bg) 0%, var(--input-bg-soft) 100%);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.filter-group input::placeholder {
  color: var(--placeholder);
  font-weight: 700;
}

.filter-group select {
  padding-right: 26px;
}

.filter-group-location {
  --filter-cols: 2;
}

.filter-group-operation {
  --filter-cols: 3;
}

.filter-group-price {
  --filter-cols: 3;
}

.filter-group-features {
  --filter-cols: 4;
}

.filter-group-preferences {
  --filter-cols: 2;
}

.filter-group-features input {
  text-align: center;
}

.check-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  align-self: end;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-raised);
  padding: 0 9px;
  color: var(--text);
  white-space: nowrap;
}

.check-row input {
  width: 15px;
  min-height: 15px;
  accent-color: var(--accent);
}

.zone-manager {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}

.zone-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: end;
  padding: 22px 24px;
}

.zone-rows {
  max-height: 310px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

.zone-rows.expanded {
  max-height: none;
}

.zone-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 14px 24px;
}

.zone-row:hover {
  background: var(--row-hover);
}

.zone-row strong,
.zone-row span {
  display: block;
}

.zone-row span {
  color: var(--muted);
  font-size: 12px;
}

.switch {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--text);
  font-weight: 850;
}

.switch input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.commission-select {
  max-width: 210px;
}

.search-commission-select {
  min-width: 190px;
}

.single-filter {
  grid-template-columns: minmax(220px, 1fr);
}

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

.toast {
  transform: translateY(8px);
  opacity: 0;
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--toast-bg);
  box-shadow: var(--shadow-strong);
  color: var(--text);
  padding: 13px 14px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

.toast strong {
  margin-bottom: 4px;
  color: var(--text-strong);
}

.toast span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 42%, var(--border));
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 28%, var(--toast-bg));
}

dialog,
.modal,
.dropdown,
[role="menu"],
[role="listbox"],
[role="tooltip"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-raised);
  color: var(--text);
  box-shadow: var(--shadow-strong);
}

.loader,
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--panel-soft), var(--surface-hover), var(--panel-soft));
}

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

  .sidebar {
    min-height: auto;
    height: auto;
    position: static;
    grid-template-columns: 1fr;
  }

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

  .notes-grid,
  .scraper-summary-grid {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .topbar,
  .followup-item {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .filters {
    min-width: 0;
    grid-template-columns: 1fr;
  }

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

  .search-layout,
  .search-hero,
  .zone-header,
  .zone-row {
    grid-template-columns: 1fr;
  }

  .compact-filters {
    grid-template-columns: 1fr;
  }

  .followup-filter-wide {
    grid-column: 1 / -1;
  }

  .switch {
    justify-content: flex-start;
  }

  .note-item,
  .dialog-header {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 720px) {
  .login-shell {
    align-content: start;
    padding: 18px;
  }

  .login-panel {
    grid-template-columns: 1fr;
    padding: 28px;
  }

  h1 {
    font-size: 34px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .theme-toggle,
  .user-badge {
    width: 100%;
  }

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

  .search-layout {
    padding: 14px;
  }

  .search-pagination {
    justify-content: stretch;
    padding: 0 14px 12px;
  }

  .pagination {
    width: 100%;
    justify-content: space-between;
  }

  .pagination span,
  .pagination strong {
    flex: 1 0 100%;
  }

  .filter-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 24px 9px 9px;
  }

  .filter-group-location label:last-child,
  .filter-group-operation label:first-child,
  .filter-group-operation label:nth-child(3),
  .filter-group-price label:last-child,
  .filter-group-preferences label:first-child {
    grid-column: 1 / -1;
  }

  .filter-group input,
  .filter-group select,
  .check-row {
    min-height: 40px;
  }

  .followup-filter-bar {
    grid-template-columns: 1fr;
    padding: 12px 14px;
  }

  .followup-filter-wide {
    grid-column: auto;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
    background: transparent;
  }

  tbody tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
  }

  td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td:last-child {
    border-bottom: 0;
  }

  .property-title,
  .address-cell {
    max-width: none;
  }

  .property-thumb-preview {
    display: none;
  }

  .search-summary strong {
    font-size: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
