:root {
  /* ORBBI — modern gradient / glass palette */
  --bg: #f5f6fb;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --surface-2: rgba(247, 248, 252, .82);
  --line: rgba(74, 82, 112, .10);
  --line-strong: rgba(74, 82, 112, .18);

  --text: #151721;
  --muted: #6f7382;
  --soft: #a3a7b4;

  --accent: #5661e9;
  --accent-hover: #4651d8;
  --accent-2: #eceeff;
  --on-accent: #ffffff;

  --cyan: #2fcbb0;
  --cyan-soft: #e6faf6;
  --violet: #735cf4;
  --violet-soft: #efecff;
  --coral: #ff7a68;
  --coral-soft: #fff0ed;
  --success: #2eb98d;
  --warning: #e6a735;
  --danger: #ee6658;

  --shadow: 0 18px 50px rgba(55, 61, 100, .08);
  --shadow-sm: 0 7px 22px rgba(55, 61, 100, .06);

  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: Manrope, system-ui, sans-serif;
  --top: 72px;
  --side: 230px;
  --feed: 410px;
  --insights: 290px;
  --radius: 20px;
  --mono: "DM Sans", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #10121a;
  --surface: rgba(25, 27, 39, .84);
  --surface-solid: #191b27;
  --surface-2: rgba(32, 35, 49, .82);
  --line: rgba(222, 225, 255, .09);
  --line-strong: rgba(222, 225, 255, .17);

  --text: #f4f5fb;
  --muted: #a3a7b7;
  --soft: #686d7e;

  --accent: #747df5;
  --accent-hover: #8790ff;
  --accent-2: #282d58;
  --on-accent: #ffffff;

  --cyan: #42d8bd;
  --cyan-soft: #173c38;
  --violet: #917cff;
  --violet-soft: #312a59;
  --coral: #ff8b79;
  --coral-soft: #452a2a;
  --success: #4acda2;
  --warning: #e8b854;
  --danger: #f17b6d;

  --shadow: 0 20px 54px rgba(0, 0, 0, .28);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, .20);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
a {
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--text);
  color: var(--surface);
}

/* Numeric consistency */
.price-line strong,
.price-line .old-price,
.stat-card strong,
.score-pill,
.hero-score,
.score-ring strong,
.price-block strong,
.drop-large,
.history-item strong,
.signal-head strong,
.side-count {
  font-variant-numeric: tabular-nums;
}

.app-shell {
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto 0;
  height: var(--top);
  display: grid;
  grid-template-columns: var(--side) minmax(260px, 620px) 1fr;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--font-display);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: .14em;
}

.brand-copy small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .16em;
  font-weight: 700;
}

.global-search {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.global-search:focus-within {
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}

.global-search svg {
  width: 18px;
  color: var(--muted);
  flex: 0 0 auto;
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.global-search input::placeholder {
  color: var(--soft);
}

kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 3px 6px;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.sync-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.sync-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
}

.user-button {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 11px;
  transition: background .15s;
}

.user-button:hover {
  background: var(--surface-2);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--text);
  font-weight: 700;
  font-family: var(--font-display);
}

.menu-btn {
  display: none;
}

/* ---------- Sidebar ---------- */
.sidebar,
.feed-panel,
.insights-panel,
.content-panel {
  position: fixed;
  top: var(--top);
  bottom: 0;
}

.sidebar {
  left: 0;
  width: var(--side);
  padding: 24px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 26px;
}

.side-label,
.eyebrow {
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 800;
  color: var(--soft);
  text-transform: uppercase;
}

.side-label {
  padding: 0 12px 9px;
}

.side-item {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: background .14s, color .14s;
}

.side-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-item.active {
  background: var(--accent-2);
  color: var(--text);
  font-weight: 700;
}

.side-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.side-count {
  margin-left: auto;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  text-align: center;
  font-size: 11px;
  font-family: var(--font-sans);
}

.side-item.active .side-count {
  background: var(--surface);
  color: var(--text);
}

/* Pipeline dots: monochrome progression from qualified (solid) to offer (faint) */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.dot.green {
  opacity: 1;
}

.dot.blue {
  opacity: .72;
}

.dot.amber {
  opacity: .48;
}

.dot.purple {
  opacity: .26;
}

[data-theme="dark"] .dot {
  background: var(--text);
}

.side-section.side-bottom {
  margin-top: auto;
  margin-bottom: 0;
}

.my-filters-section {
  margin-bottom: 18px;
}

.my-filters-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 0;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: background .14s, color .14s;
}

.my-filters-toggle:hover {
  background: var(--surface);
  color: var(--text);
}

.my-filters-toggle.active {
  background: var(--accent-2);
  color: var(--text);
  font-weight: 700;
}

.my-filters-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

#myFiltersPanel {
  display: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
}

#myFiltersPanel.open {
  display: block;
  max-height: 340px;
  overflow-y: auto;
  margin: 0 0 18px;
  padding: 0 12px;
}

.my-filter-row {
  padding: 11px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  margin-bottom: 7px;
  border: 1px solid transparent;
  transition: background .14s, border-color .14s;
}

.my-filter-row:hover {
  background: var(--surface);
  border-color: var(--line);
}

.my-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.my-filter-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.my-filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
}

.my-filter-check input {
  accent-color: var(--text);
}

#myScopeSelect {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  outline: 0;
  cursor: pointer;
}

#myScopeSelect:focus {
  border-color: var(--line-strong);
}

.my-filter-criteria {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.my-filter-criteria div {
  margin-bottom: 2px;
}

.empty-filters {
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}

/* Settings panel */
.settings-panel {
  width: 100%;
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 920px;
  margin: 0 auto 26px;
}

.settings-head h2 {
  margin: 7px 0 0;
  font: 800 28px/1.15 var(--font-display);
  letter-spacing: -.03em;
}

.settings-head .btn {
  margin-left: auto;
}

.settings-body {
  max-width: 920px;
  margin: 0 auto;
}

.settings-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
}

.settings-loading svg {
  width: 18px;
  color: var(--soft);
}

.settings-error {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  margin: 0 0 8px;
  font: 800 18px var(--font-display);
  letter-spacing: -.02em;
}

.settings-section p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  transition: border-color .16s ease, opacity .16s ease;
}

.rule-row.is-disabled {
  opacity: .68;
}

.rule-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.rule-name {
  font-weight: 700;
  font-size: 14px;
}

.rule-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}

.rule-check input {
  accent-color: var(--text);
}

.rule-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.rule-meta div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 2px;
}

.rule-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.rule-form {
  margin-top: 14px;
}

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

#ruleFormEl .form-title,
#ruleFormEl .form-actions,
#ruleFormEl .field:first-of-type {
  grid-column: 1 / -1;
}

.add-rule-btn {
  width: 100%;
  justify-content: center;
}

.form-title {
  margin: 0 0 14px;
  font: 800 16px var(--font-display);
}

#ruleFormEl .field {
  margin-bottom: 0;
}

#ruleFormEl label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

#ruleFormEl .field-input,
#ruleFormEl select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

#ruleFormEl .field-input:focus,
#ruleFormEl select:focus {
  border-color: var(--line-strong);
  outline: none;
}

#ruleFormEl .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

#ruleFormEl .check-row input {
  accent-color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.form-actions .btn {
  flex: 1;
}

.empty-rules {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px dashed var(--line);
}

.scope-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.scope-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scope-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.scope-form .field-input,
.scope-form select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  width: 100%;
}

.scope-form .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.scope-form .check-row input {
  accent-color: var(--text);
}

.multi-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.multi-select .check-row input {
  accent-color: var(--text);
}

.req {
  color: #b91c1c;
}

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

.user-scope-box {
  padding: 11px 10px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  font-size: 10px;
  color: var(--muted);
}

.user-scope-box strong {
  display: block;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--text);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.source-note {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.source-note svg {
  width: 17px;
  flex: 0 0 auto;
  color: var(--muted);
}

.source-note p {
  margin: 0;
}

.source-note strong,
.source-note small {
  display: block;
}

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

.source-note small {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.mobile-sidebar-head {
  display: none;
}

/* ---------- Feed ---------- */
.feed-panel {
  left: var(--side);
  width: var(--feed);
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 22px 16px;
}

.panel-title h1 {
  margin: 6px 0 0;
  font: 800 24px/1.1 var(--font-display);
  letter-spacing: -.02em;
}

.quick-filters {
  display: flex;
  gap: 7px;
  overflow: auto;
  padding: 0 22px 14px;
  scrollbar-width: none;
}

.quick-filters::-webkit-scrollbar {
  display: none;
}

.chip {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.chip.active {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
  font-weight: 700;
}

.feed-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 0 22px 13px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.feed-toolbar select {
  max-width: 150px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 8px;
  background: var(--surface-2);
  color: var(--text);
  outline: 0;
  cursor: pointer;
  font-size: 12px;
}

.feed-list {
  overflow: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.feed-list::-webkit-scrollbar {
  width: 8px;
}

.feed-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}

.property-row {
  width: 100%;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 13px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: background .14s;
}

.property-row:hover,
.property-row.active {
  background: var(--surface-2);
}

.property-row.active {
  box-shadow: inset 3px 0 0 var(--text);
}

.property-thumb {
  width: 84px;
  height: 78px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e4e6e9, #c3c7cd);
  object-fit: cover;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: #8b8f96;
}

.thumb-placeholder svg {
  width: 27px;
}

.property-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.row-top>span:first-child {
  min-width: 0;
}

.row-address {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-place {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* Score pill: fixed, non-collapsible, tabular */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: flex-start;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--accent-2);
  color: var(--text);
  font: 800 13px/1 var(--font-display);
  letter-spacing: -.01em;
}

.property-row:hover .score-pill,
.property-row.active .score-pill {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.price-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.price-line strong {
  font: 800 17px var(--font-display);
  letter-spacing: -.01em;
}

.old-price {
  text-decoration: line-through;
  color: var(--soft);
  font-size: 11px;
  text-decoration-thickness: 1.5px;
}

.row-metrics {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.metric {
  border-radius: 7px;
  padding: 4px 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}

.property-row:hover .metric,
.property-row.active .metric {
  background: var(--surface);
}

.metric.drop {
  background: var(--text);
  color: var(--surface);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.loading-card {
  height: 111px;
  margin: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2));
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

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

.empty-feed strong {
  display: block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
}

.empty-feed p {
  margin: 7px 0 0;
  font-size: 12px;
}

/* ---------- Content ---------- */
.content-panel {
  left: calc(var(--side) + var(--feed));
  right: var(--insights);
  padding: 30px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.content-panel::-webkit-scrollbar {
  width: 10px;
}

.content-panel::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.dashboard {
  max-width: 920px;
  margin: 0 auto;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.dashboard-head h2 {
  margin: 7px 0 5px;
  font: 800 28px/1.15 var(--font-display);
  letter-spacing: -.03em;
}

.dashboard-head p {
  margin: 0;
  color: var(--muted);
}

.updated {
  font-size: 11px;
  color: var(--soft);
  white-space: nowrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin: 26px 0;
}

.stat-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  transition: border-color .15s, transform .15s;
}

.stat-card:hover {
  border-color: var(--line-strong);
}

.stat-card.accent {
  border-color: transparent;
  background: var(--text);
  color: var(--surface);
}

.stat-card span,
.stat-card small {
  display: block;
}

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

.stat-card.accent span,
.stat-card.accent small {
  color: color-mix(in srgb, var(--surface) 62%, transparent);
}

.stat-card strong {
  display: block;
  margin: 9px 0 5px;
  font: 800 28px/1 var(--font-display);
  letter-spacing: -.02em;
}

.stat-card small {
  font-size: 10px;
  color: var(--soft);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
}

.dash-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-head h3,
.methodology h3 {
  margin: 6px 0 0;
  font: 700 17px var(--font-display);
  letter-spacing: -.01em;
}

.card-head svg,
.methodology>svg {
  width: 21px;
  color: var(--muted);
}

.score-legend {
  margin-top: 20px;
}

.score-legend>div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px;
  margin: 13px 0;
  align-items: center;
}

.score-legend span,
.score-legend strong {
  font-size: 11px;
}

.score-legend span {
  color: var(--muted);
}

.score-legend strong {
  font-family: var(--font-display);
}

.score-legend i {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--text) calc(var(--v) * 1%), var(--surface-2) 0);
  order: 3;
}

.methodology {
  background: var(--accent-2);
  border-color: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.methodology p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 8px 0 0;
}

/* ---------- Property detail ---------- */
.property-detail {
  max-width: 920px;
  margin: 0 auto;
}

.detail-back {
  display: none;
}

.detail-hero {
  position: relative;
  min-height: 250px;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, #e7e9ec, #b9bdc4);
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  isolation: isolate;
}

.detail-hero>img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

.detail-hero:after {
  content: "";
  position: absolute;
  inset: 25% 0 0;
  background: linear-gradient(transparent, rgba(10, 11, 14, .85));
  z-index: -1;
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding: 24px;
  color: #fff;
}

.hero-copy .eyebrow {
  color: rgba(255, 255, 255, .72);
}

.hero-copy h1 {
  margin: 7px 0 5px;
  font: 800 27px/1.18 var(--font-display);
  letter-spacing: -.02em;
}

.hero-copy p {
  margin: 0;
  color: rgba(255, 255, 255, .8);
}

.hero-score {
  position: absolute;
  z-index: 2;
  right: 18px;
  top: 18px;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text);
  font: 800 20px var(--font-display);
  letter-spacing: -.01em;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.detail-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 9px 15px;
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  transition: background .14s, border-color .14s, transform .1s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 17px;
}

.btn.primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--text) 85%, var(--surface));
  border-color: transparent;
}

.btn.saved {
  background: var(--accent-2);
  border-color: transparent;
  color: var(--text);
}

.btn.outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn.outline:hover {
  background: var(--surface-2);
}

.btn.small {
  min-height: 32px;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 9px;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.stage-select {
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
  align-items: start;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px;
  background: var(--surface);
  margin-bottom: 14px;
}

.detail-card h3 {
  margin: 0 0 16px;
  font: 700 16px var(--font-display);
  letter-spacing: -.01em;
}

.price-block {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.price-block p {
  margin: 0;
}

.price-block strong {
  font: 800 30px/1 var(--font-display);
  letter-spacing: -.02em;
  display: block;
}

.price-block small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.drop-large {
  color: var(--text);
  font-weight: 800;
  font-size: 15px;
  padding: 10px 13px;
  border-radius: 11px;
  background: var(--surface-2);
  display: inline-block;
}

.drop-large small {
  color: var(--muted);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.spec {
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-2);
  min-width: 0;
}

.spec strong,
.spec small {
  display: block;
}

.spec strong {
  font: 700 14px var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spec small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.history-list {
  position: relative;
  margin-left: 6px;
}

.history-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

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

.history-item i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.history-item.reduction i {
  background: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 10%, transparent);
}

.history-item span small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.history-item strong {
  font-family: var(--font-display);
  font-size: 12px;
  white-space: nowrap;
}

.notes-field {
  width: 100%;
  min-height: 105px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
  padding: 11px;
  outline: 0;
  transition: border-color .15s, background .15s;
}

.notes-field:focus {
  border-color: var(--line-strong);
  background: var(--surface);
}

.notes-actions {
  text-align: right;
  margin-top: 9px;
}

.agent-line {
  display: flex;
  gap: 11px;
  align-items: center;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--surface);
  font-weight: 800;
  font-family: var(--font-display);
  flex: 0 0 auto;
}

.agent-line p {
  margin: 0;
}

.agent-line strong {
  display: block;
  font-size: 13px;
}

.agent-line small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 11px;
}

/* ---------- Insights ---------- */
.insights-panel {
  right: 0;
  width: var(--insights);
  padding: 25px 20px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.insights-head h2 {
  margin: 6px 0 20px;
  font: 800 20px var(--font-display);
  letter-spacing: -.02em;
}

.empty-insight {
  padding: 36px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.empty-insight svg {
  width: 30px;
  color: var(--soft);
  margin-bottom: 6px;
}

.empty-insight p {
  margin: 0;
}

.insight-score {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-2);
}

.score-ring {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--text) calc(var(--score) * 1%), var(--line) 0);
  position: relative;
  flex: 0 0 auto;
}

.score-ring:before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}

.score-ring strong {
  position: relative;
  font: 800 19px var(--font-display);
  letter-spacing: -.01em;
}

.insight-score p {
  margin: 0;
}

.insight-score p strong {
  display: block;
  font-size: 14px;
  font-family: var(--font-display);
}

.insight-score span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.signal-list {
  margin-top: 18px;
}

.signal {
  margin: 15px 0;
}

.signal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
}

.signal-head span {
  color: var(--muted);
}

.signal-head strong {
  font-family: var(--font-display);
  font-size: 12px;
}

.signal-bar {
  height: 5px;
  margin-top: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.signal-bar i {
  display: block;
  height: 100%;
  width: calc(var(--weight) * 1%);
  background: var(--text);
  border-radius: 99px;
}

.rule-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
}

.rule-box span,
.rule-box strong {
  display: block;
}

.rule-box span {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 800;
}

.rule-box strong {
  margin-top: 6px;
  font-size: 13px;
  font-family: var(--font-display);
}

.caveat {
  margin-top: 18px;
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

/* ---------- Mobile nav / toast ---------- */
.mobile-tabs {
  display: none;
}

.overlay {
  display: none;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  box-shadow: var(--shadow);
  max-width: min(90vw, 420px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 12% -6%, rgba(23, 24, 29, .055), transparent 60%),
    radial-gradient(700px 420px at 108% 112%, rgba(23, 24, 29, .045), transparent 55%),
    var(--bg);
}

[data-theme="dark"] .login-page {
  background:
    radial-gradient(900px 480px at 12% -6%, rgba(241, 242, 244, .06), transparent 60%),
    radial-gradient(700px 420px at 108% 112%, rgba(241, 242, 244, .05), transparent 55%),
    var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 430px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 34px;
  font-weight: 800;
  font-family: var(--font-display);
}

.auth-brand .brand-mark {
  margin-right: 2px;
}

.auth-card h1 {
  margin: 8px 0 8px;
  font: 800 28px/1.15 var(--font-display);
  letter-spacing: -.02em;
}

.auth-card>p {
  color: var(--muted);
  margin: 0 0 26px;
  font-size: 13px;
  line-height: 1.55;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}

.auth-card input[type="email"]:focus,
.auth-card input[type="password"]:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}

.auth-card .check {
  flex-direction: row;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  color: var(--muted);
}

.auth-card .check input {
  accent-color: var(--text);
}

.auth-card .btn {
  width: 100%;
}

.forgot {
  display: block;
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.forgot:hover {
  color: var(--text);
  text-decoration: underline;
}

.auth-alert {
  margin-bottom: 16px;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--accent-2);
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.auth-alert.error {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  font-weight: 600;
}

.auth-legal {
  position: fixed;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  :root {
    --side: 210px;
    --feed: 375px;
    --insights: 260px;
  }

  .content-panel {
    padding: 24px;
  }

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

@media (max-width: 1024px) {
  :root {
    --side: 210px;
    --feed: 390px;
  }

  .insights-panel {
    display: none;
  }

  .content-panel {
    right: 0;
  }

  .topbar {
    grid-template-columns: var(--side) minmax(260px, 1fr) auto;
  }

  .sync-chip {
    display: none;
  }

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

@media (max-width: 760px) {
  :root {
    --top: 64px;
  }

  .topbar {
    grid-template-columns: 40px 1fr auto;
    gap: 9px;
    padding: 0 12px;
  }

  .menu-btn {
    display: grid;
  }

  .brand-copy small {
    display: none;
  }

  .global-search {
    position: fixed;
    top: var(--top);
    left: 0;
    right: 0;
    height: 50px;
    border-width: 0 0 1px;
    border-radius: 0;
    padding: 0 16px;
    background: var(--surface);
    z-index: 20;
  }

  .global-search kbd,
  .user-button>span:not(.avatar),
  #themeBtn {
    display: none;
  }

  .sidebar {
    top: 0;
    bottom: 0;
    width: min(86vw, 310px);
    transform: translateX(-105%);
    transition: transform .22s ease;
    z-index: 80;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-sidebar-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
  }

  .mobile-sidebar-head strong {
    font-family: var(--font-display);
  }

  .overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(10, 11, 14, .42);
  }

  .overlay.show {
    display: block;
  }

  .feed-panel {
    top: calc(var(--top) + 50px);
    left: 0;
    bottom: 66px;
    width: 100%;
    border: 0;
  }

  .content-panel {
    display: none;
    inset: calc(var(--top) + 50px) 0 66px;
    padding: 16px;
    background: var(--bg);
    z-index: 25;
  }

  .content-panel.mobile-open {
    display: block;
  }

  .settings-panel {
    padding-bottom: 24px;
  }

  .settings-head {
    margin-bottom: 20px;
  }

  .settings-head h2 {
    font-size: 23px;
  }

  .settings-card {
    padding: 16px;
  }

  #ruleFormEl,
  .scope-form {
    grid-template-columns: 1fr;
  }

  #ruleFormEl .field:first-of-type {
    grid-column: auto;
  }

  .rule-meta div {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .panel-title {
    padding: 20px 18px 13px;
  }

  .quick-filters {
    padding-left: 18px;
  }

  .feed-toolbar {
    padding-left: 18px;
  }

  .property-row {
    grid-template-columns: 92px 1fr;
  }

  .property-thumb {
    width: 92px;
    height: 84px;
  }

  .mobile-tabs {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 60;
    bottom: 0;
    left: 0;
    right: 0;
    height: 66px;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-tabs button,
  .mobile-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    text-decoration: none;
    color: var(--muted);
  }

  .mobile-tabs svg {
    width: 19px;
  }

  .mobile-tabs small {
    font-size: 9px;
  }

  .mobile-tabs .active {
    color: var(--text);
    font-weight: 700;
  }

  .detail-back {
    display: inline-flex;
    margin-bottom: 10px;
  }

  .detail-hero {
    min-height: 210px;
  }

  .hero-copy {
    padding: 18px;
  }

  .hero-copy h1 {
    font-size: 21px;
  }

  .hero-score {
    width: 54px;
    height: 54px;
    font-size: 17px;
  }

  .detail-actions {
    overflow: auto;
  }

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

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }

  .dashboard-head {
    display: block;
  }

  .updated {
    display: block;
    margin-top: 8px;
  }

  .dashboard-head h2 {
    font-size: 23px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .spec-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 390px) {
  .property-row {
    grid-template-columns: 76px 1fr;
    padding: 14px;
  }

  .property-thumb {
    width: 76px;
    height: 76px;
  }

  .row-metrics {
    gap: 4px;
  }

  .metric {
    padding: 3px 5px;
  }

  .auth-card {
    padding: 28px 22px;
  }

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

/* Settings — resumo e chips de critérios */
.settings-summary {
  background: var(--surface-2, #f0f2f5);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--text-2, #555);
}

.settings-summary .summary-empty {
  margin: 0;
  color: var(--text-2, #777);
}

.settings-summary p {
  margin: 0;
}

.rule-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.criteria-chip {
  display: inline-block;
  background: var(--surface-2, #eef0f4);
  color: var(--text-1, #333);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.criteria-empty {
  font-size: 0.8rem;
  color: var(--text-3, #aaa);
  font-style: italic;
}

/* Validação inline do formulário de regra */
.field-error {
  border-color: #e03b3b !important;
  outline: none;
  box-shadow: 0 0 0 2px rgba(224, 59, 59, 0.18);
}

.field-error-msg {
  display: block;
  color: #e03b3b;
  font-size: 0.78rem;
  margin-top: 4px;
}

/* ── Insight Notes ─────────────────────────────────── */
.insight-notes-section {
  margin-top: 1.5rem;
}

.insight-notes-section h4 {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 .75rem;
}

.insight-notes-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.insight-note {
  background: var(--card-bg, var(--surface));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem 1rem;
}

.insight-note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}

.insight-note-meta span {
  font-size: .7rem;
  color: var(--muted);
}

.insight-note-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 .5rem;
  transition: color .15s;
}

.insight-note-del:hover {
  color: #e53e3e;
}

.insight-note p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.insight-notes-empty {
  font-size: .82rem;
  color: var(--muted);
  margin: 0;
}

/* ── Active Rule Card ──────────────────────────────── */
.active-rule-card {
  border: 2px solid var(--text);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
}

.active-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.active-rule-name {
  font: 700 16px var(--font-display);
  letter-spacing: -.01em;
}

.active-rule-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.active-rule-criteria {
  margin-top: 4px;
}

.no-active-rule {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

.no-active-rule p {
  margin: 0 0 12px;
  font-size: 13px;
}

.rule-status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-active {
  background: var(--text);
  color: var(--surface);
}

.badge-paused {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.rule-row.is-active {
  border-color: var(--line-strong);
  background: var(--surface);
}

.rule-form-inline {
  margin-top: 16px;
}

.rule-form-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
}

.rule-form-box .form-title {
  margin: 0 0 16px;
}

/* ==========================================================
   PROFILE AVATAR EDITOR
   ========================================================== */

.profile-avatar-editor {
  position: relative;
  flex: 0 0 auto;
}

.profile-photo-editable {
  position: relative;
  display: block;
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
}

.profile-avatar-content {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-avatar-content img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-avatar-initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* Ícone sutil de edição */

.profile-avatar-edit {
  position: absolute;
  right: 4px;
  bottom: 4px;

  width: 26px;
  height: 26px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: rgba(15, 23, 42, .72);
  color: #fff;

  backdrop-filter: blur(8px);

  opacity: .82;

  transition:
    opacity .18s ease,
    transform .18s ease,
    background .18s ease;

  z-index: 3;
}

.profile-avatar-edit svg {
  width: 13px;
  height: 13px;
}

.profile-photo-editable:hover .profile-avatar-edit {
  opacity: 1;
  transform: scale(1.06);
}


/* Loader */

.profile-avatar-loader {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(15, 23, 42, .46);
  backdrop-filter: blur(2px);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity .18s ease,
    visibility .18s ease;

  z-index: 5;
}

.profile-avatar-editor.is-uploading .profile-avatar-loader {
  opacity: 1;
  visibility: visible;
}

.profile-avatar-editor.is-uploading .profile-avatar-edit {
  opacity: 0;
}


/* Spinner */

.profile-avatar-spinner {
  width: 24px;
  height: 24px;

  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;

  border-radius: 50%;

  animation:
    orbbiAvatarSpin .7s linear infinite;
}

@keyframes orbbiAvatarSpin {
  to {
    transform: rotate(360deg);
  }
}


/* Sucesso */

.profile-avatar-success {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 24px;
  font-weight: 700;

  color: #fff;

  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity .18s ease,
    visibility .18s ease;

  z-index: 6;
}

.profile-avatar-editor.is-success .profile-avatar-success {
  opacity: 1;
  visibility: visible;
}


/* Erro */

.profile-avatar-editor.is-error .profile-photo-editable {
  animation: orbbiAvatarError .28s ease;
}

@keyframes orbbiAvatarError {

  25% {
    transform: translateX(-2px);
  }

  75% {
    transform: translateX(2px);
  }

}


/* Texto auxiliar */

.profile-photo-hint {
  opacity: .65;
}

.profile-photo-status {
  min-height: 18px;
  opacity: .75;
}

/* ==========================================================
   FEED — CONSOLIDATED LAYOUT
   Single source of truth for header, ad, filters, sort and count
   ========================================================== */

.feed-panel {
  --feed-gutter: 22px;
}

/* Header */
.feed-panel .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px var(--feed-gutter) 16px;
}

.feed-panel .panel-title > div:first-child {
  min-width: 0;
}

.feed-panel .panel-title h1 {
  margin: 6px 0 0;
}

.feed-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.feed-refresh-status {
  position: static;
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--soft);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

/* Advertisement: use the same horizontal grid as the feed */
.feed-panel > .orbbi-ad {
  display: block;
  width: auto;
  margin: 4px var(--feed-gutter) 14px;
  border-radius: 4px;
  overflow: hidden;
  line-height: 0;
}

.feed-panel > .orbbi-ad img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 350 / 60;
  object-fit: cover;
}

/* New-items notification also respects the grid */
.feed-panel > .feed-new-pill {
  margin-left: var(--feed-gutter);
  margin-right: var(--feed-gutter);
}

/* Filters + sort are one toolbar */
.feed-controls {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 0;
  padding: 12px var(--feed-gutter) 10px;
}

.feed-controls .quick-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.feed-controls .quick-filters::-webkit-scrollbar {
  display: none;
}

.feed-controls .chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  font-size: 11.5px;
}

/* Sort */
.feed-sort {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.feed-sort-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
}

.feed-sort-btn svg {
  display: block;
  width: 17px;
  height: 17px;
}

.feed-sort-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}

.feed-sort-menu[hidden] {
  display: none;
}

.feed-sort-menu-head {
  padding: 8px 10px 7px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.feed-sort-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.feed-sort-option:hover {
  background: var(--surface-2);
}

.feed-sort-option.active {
  font-weight: 700;
}

.feed-sort-check {
  opacity: 0;
  font-size: 12px;
}

.feed-sort-option.active .feed-sort-check {
  opacity: 1;
}

/* Result count: same left edge as title, ad, chips and rows */
.feed-panel .feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  min-height: 36px;
  margin: 0;
  padding: 6px var(--feed-gutter) 12px;
  border: 0;
  color: var(--soft);
  font-size: 11px;
}

.feed-panel #resultCount {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--soft);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
}

/* Property rows use the same visual gutter */
.feed-panel .property-row {
  padding-left: var(--feed-gutter);
  padding-right: var(--feed-gutter);
}

@media (max-width: 760px) {
  .feed-panel {
    --feed-gutter: 18px;
  }

  .feed-panel .panel-title {
    padding-top: 20px;
    padding-bottom: 13px;
  }

  .feed-refresh-status {
    font-size: 9px;
  }

  .feed-controls {
    gap: 8px;
  }

  .feed-controls .chip {
    padding-inline: 10px;
  }
}

@media (max-width: 420px) {
  .feed-panel {
    --feed-gutter: 16px;
  }

  .feed-refresh-status {
    display: none;
  }
}
