/* admin_frontend_visual_patch_v3 */

@font-face {
    font-family: "IRANYekanX VF";
    src: url("../assets/fonts/iranyekanxVF/IRANYekanXVF.woff") format("woff-variations"), url("../font/iranyekanxVF/IRANYekanXVF.woff") format("woff"), url("../font/iranyekanxVF/IRANYekanXVF.woff2") format("woff2");
    font-display: fallback;
}

@font-face {
    font-family: IRANYekan;
    font-style: normal;
    font-weight: 300;
    src: url("../assets/fonts/iranyekanx/woff2/IRANYekanX-Light.woff2") format("woff2"), url("../font/iranyekanx/woff/IRANYekanX-Light.woff") format("woff");
}

@font-face {
    font-family: IRANYekan;
    font-style: normal;
    font-weight: 400;
    src: url("../assets/fonts/iranyekanx/woff2/IRANYekanX-Regular.woff2") format("woff2"), url("../font/iranyekanx/woff/IRANYekanX-Regular.woff") format("woff");
}

@font-face {
    font-family: IRANYekan;
    font-style: normal;
    font-weight: 500;
    src: url("../assets/fonts/iranyekanx/woff2/IRANYekanX-Medium.woff2") format("woff2"), url("../font/iranyekanx/woff/IRANYekanX-Medium.woff") format("woff");
}

@font-face {
    font-family: IRANYekan;
    font-style: normal;
    font-weight: 700;
    src: url("../assets/fonts/iranyekanx/woff2/IRANYekanX-Bold.woff2") format("woff2"), url("../font/iranyekanx/woff/IRANYekanX-Bold.woff") format("woff");
}

@font-face {
    font-family: IRANYekan;
    font-style: normal;
    font-weight: 900;
    src: url("../assets/fonts/iranyekanx/woff2/IRANYekanX-ExtraBold.woff2") format("woff2"), url("../font/iranyekanx/woff/IRANYekanX-ExtraBold.woff") format("woff");
}



:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d2433;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #9f1d26;
  --brand-dark: #801720;
  --brand-soft: #fff3f3;
  --success: #087443;
  --warning: #b54708;
  --danger: #b42318;
  --info: #175cd3;
  --radius: 14px;
  --header-height: 76px;
  --shadow: 0 20px 50px rgba(16, 24, 40, 0.10);
  font-family: IranYekan, "Iran Yekan", IRANYekan, "IRANYekanWeb", YekanBakhFaNum, Vazirmatn, IRANSans, Tahoma, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: IranYekan, "Iran Yekan", IRANYekan, "IRANYekanWeb", YekanBakhFaNum, Vazirmatn, IRANSans, Tahoma, "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.45rem; line-height: 1.8; }
h2 { font-size: 1.05rem; line-height: 1.8; }
h3 { font-size: .98rem; line-height: 1.8; }
small, .hint { color: var(--muted); font-size: .78rem; line-height: 1.7; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(260px, auto) 1fr minmax(360px, auto);
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #cf3636);
  font-weight: 900;
}
.brand strong { display: block; color: var(--brand); }
.brand small { display: block; }
.tabs { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.tab-button, .ghost-button, .solid-button, .icon-button {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
  font-weight: 800;
}
.tab-button.active, .solid-button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.solid-button:hover { background: var(--brand-dark); }
.ghost-button:hover, .tab-button:hover { border-color: #d8a1a5; background: var(--brand-soft); }
.danger-outline { color: var(--danger); border-color: #f3b4ae; }
.icon-button { width: 40px; padding: 0; font-size: 1.25rem; }
.connection-panel { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto; gap: 8px; align-items: end; }

label { display: grid; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}
textarea { resize: vertical; line-height: 1.9; }
input:focus, select:focus, textarea:focus { border-color: #c18a8f; box-shadow: 0 0 0 3px rgba(159,29,38,.09); }
.money-input { direction: ltr; text-align: left; }

.login-strip {
  display: grid;
  grid-template-columns: auto 180px 180px auto 1fr;
  align-items: end;
  gap: 10px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.status-pill, .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 900;
  background: #f2f4f7;
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.status-pill.ok, .tag.ok { background: #ecfdf3; border-color: #abefc6; color: var(--success); }
.status-pill.error, .tag.danger { background: #fef3f2; border-color: #fecdca; color: var(--danger); }
.status-pill.warn, .tag.warn { background: #fffaeb; border-color: #fedf89; color: var(--warning); }
.tag.source { background: #eff8ff; border-color: #b2ddff; color: var(--info); }
.inline-message { color: var(--muted); font-size: .82rem; line-height: 1.8; }
.inline-message.error { color: var(--danger); }
.inline-message.success { color: var(--success); }

.page-shell { max-width: 1600px; margin: 0 auto; padding: 22px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head.compact { align-items: center; }
.panel-head p { color: var(--muted); line-height: 1.8; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card, .card, .filters-card, .quality-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.metric-card { display: grid; gap: 8px; padding: 14px; min-height: 116px; }
.metric-card span { color: var(--muted); font-size: .78rem; font-weight: 800; }
.metric-card strong { font-size: 1.55rem; line-height: 1.2; }
.metric-card small { display: block; }
.metric-card.warning { border-color: #fedf89; background: #fffcf5; }
.metric-card.danger { border-color: #fecdca; background: #fff8f7; }
.metric-card.success { border-color: #abefc6; background: #f6fef9; }
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { padding: 16px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.breakdown-list, .alert-list, .runs-list { display: grid; gap: 9px; }
.breakdown-item, .alert-item, .run-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.alert-item button { justify-self: end; }

.demand-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.demand-list {
  display: grid;
  gap: 12px;
}

.demand-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}

.demand-card-main,
.demand-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.demand-card-main {
  align-items: center;
}

.demand-card h2 {
  font-size: 1rem;
}

.demand-card p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.9;
}

/* An expired demand stays in the list — it just reads as inactive. */
.demand-card-expired {
  background: var(--surface-2);
  border-style: dashed;
}

.demand-card-expired .demand-criteria,
.demand-card-expired .demand-stats {
  opacity: .72;
}

/* Only the filled-in criteria, as inline chips — a blank field isn't a filter,
   so it takes no space. */
.demand-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.demand-criterion {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .8rem;
  max-width: 100%;
}

.demand-criterion-label {
  color: var(--muted);
  font-size: .72rem;
  flex-shrink: 0;
}

.demand-criterion-value {
  color: var(--text);
  overflow-wrap: anywhere;
}

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

.demand-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demand-stats span.demand-stat-new {
  border-color: #fedf89;
  background: #fffaeb;
}

.demand-stats span.demand-stat-new strong {
  color: var(--warning);
}

.demand-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.demand-stats span {
  display: grid;
  gap: 2px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
}

.demand-stats strong {
  color: var(--text);
  font-size: 1.1rem;
}

/* Whether the applicant was actually reached, on the demand itself. */
.demand-messenger {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: .78rem;
  color: var(--muted);
}

.demand-messenger.has-stuck {
  border-color: #fedf89;
  background: #fffcf5;
}

.demand-messenger-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.demand-messenger-label { color: var(--muted); }
.demand-messenger strong { color: var(--text); }

/* Failover history sits under the current set — present, but not competing
   with the one set the demand is actually assigned to. */
.demand-messenger-muted { opacity: 0.65; font-size: 0.92em; }
.demand-messenger-muted strong { color: var(--muted); }

.demand-messenger-stuck {
  margin-top: 6px;
  color: var(--warning);
}

.demand-card-footer {
  align-items: center;
  padding-top: 4px;
}

/* Must stay after the .demand-stats / .demand-card-footer base rules above —
   same specificity, so source order decides. */
@media (max-width: 640px) {
  .demand-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demand-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Agent task overview — how much went out, sliced by channel, kind and set. */
.task-overview:empty { display: none; }

.overview-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.overview-filters label {
  display: grid;
  gap: 4px;
  font-size: .78rem;
  color: var(--muted);
}

.overview-filters select,
.overview-filters input {
  min-width: 140px;
}

.overview-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.overview-card h2 { font-size: .95rem; }

.overview-card h3 {
  margin-top: 4px;
  font-size: .8rem;
  color: var(--muted);
}

.count-row {
  display: grid;
  /* --cols is set inline per row: the range, live-queue and breakdown rows each
     carry a different number of buckets. */
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  gap: 6px;
}

.count-cell {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.count-cell small { color: var(--muted); font-size: .68rem; }
.count-cell strong { font-size: .95rem; }

.total-row .count-cell { padding: 12px 8px; }
.total-row .count-cell strong { font-size: 1.3rem; }

.count-cell.done strong { color: var(--success); }
.count-cell.failed strong { color: var(--danger); }
.count-cell.active strong { color: var(--info, #175cd3); }
.count-cell.expired strong { color: var(--muted); }

/* Nobody is going to run these — louder than a plain count. */
.count-cell.no_agent { border-color: #fedf89; background: #fffcf5; }
.count-cell.no_agent strong { color: var(--warning); }

.task-groups {
  display: grid;
  gap: 8px;
}

.task-group {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.task-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.task-group-head small { color: var(--muted); }

.task-group-detail { color: var(--muted); }
.task-group-detail.warn { color: var(--warning); }

@media (max-width: 640px) {
  .count-row,
  .total-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-filters label { flex: 1 1 100%; }
}

/* Agent task diagnostics — what didn't go out, and why. */
.task-diagnostics:empty { display: none; }

.diagnostics-ok {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #abefc6;
  border-radius: var(--radius);
  background: #ecfdf3;
  color: var(--success);
  font-size: .82rem;
}

.diagnostics-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #fedf89;
  border-radius: var(--radius);
  background: #fffcf5;
}

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

.diagnostics-card h2 { font-size: .95rem; }
.diagnostics-card h3 { font-size: .82rem; color: var(--muted); }

.diagnostics-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diagnostics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.diagnostics-row small {
  display: block;
  color: var(--muted);
}

.diagnostics-reason {
  display: grid;
  gap: 3px;
  justify-items: end;
  text-align: left;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .diagnostics-row {
    flex-direction: column;
    align-items: stretch;
  }

  .diagnostics-reason {
    justify-items: start;
  }
}

.filters-card { padding: 14px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 10px; align-items: end; }
.wide-field { grid-column: span 2; }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.check-grid.inline { margin-top: 8px; }
.check-row { display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; color: var(--text); font-size: .82rem; }
.check-row input { width: auto; min-height: 0; accent-color: var(--brand); }

.state-block { margin: 12px 0; padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); }
.state-block.error { border-color: #fecdca; background: #fff8f7; color: var(--danger); }
.hidden { display: none !important; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.data-table { width: 100%; min-width: 1320px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: right; }
.data-table th { position: sticky; top: 0; z-index: 1; background: #f9fafb; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.data-table td { font-size: .84rem; line-height: 1.8; }
.data-table tr:hover td { background: #fcfcfd; }
.title-cell { min-width: 240px; font-weight: 900; }
.muted { color: var(--muted); }
.ltr { direction: ltr; text-align: left; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions button, .row-actions a { min-height: 30px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 800; }
.row-actions a { display: inline-flex; align-items: center; }

.pager { display: flex; align-items: center; gap: 8px; }
.pager span { min-width: 82px; color: var(--muted); text-align: center; }

.quality-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.quality-card { padding: 14px; }
.quality-card h2 { margin-bottom: 8px; }
.issue-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.issue-item { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.action-group { display: flex; flex-wrap: wrap; gap: 8px; }

.scraper-layout { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 14px; align-items: start; }
.form-card { display: grid; gap: 12px; }
.manual-property-form {
  max-width: 980px;
}
.manual-property-form h2 {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.manual-property-form h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.manual-field-hidden {
  display: none !important;
}
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.run-item { grid-template-columns: 1.2fr 2fr; align-items: start; }
.run-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.log-block { direction: ltr; text-align: left; white-space: pre-wrap; max-height: 120px; overflow: auto; padding: 8px; background: #111827; color: #d1d5db; border-radius: 8px; font-size: .75rem; }

.api-spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.endpoint-card { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.endpoint-card code { display: block; direction: ltr; text-align: left; margin: 8px 0; padding: 8px; border-radius: 8px; background: #101828; color: #f2f4f7; overflow: auto; }
.endpoint-card ul { margin: 8px 0 0; padding: 0 20px 0 0; color: var(--muted); line-height: 1.9; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(16,24,40,.42); }
.detail-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 60;
  width: min(760px, 100vw);
  overflow: auto;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.drawer-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--muted); font-size: .78rem; font-weight: 900; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.image-strip { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; }
.image-strip img, .image-placeholder { width: 132px; height: 104px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.image-placeholder { display: grid; place-items: center; color: var(--muted); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sticky-actions { position: sticky; top: 0; z-index: 5; padding: 10px 0; background: rgba(255,255,255,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.detail-form { display: grid; gap: 12px; }
.field-stack { display: grid; gap: 10px; }
.facts { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.facts dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 10px 0 0; }
.facts dt { color: var(--muted); font-weight: 800; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.raw-box { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.raw-box summary { padding: 12px; cursor: pointer; font-weight: 900; }
.raw-box pre, .history-block { margin: 0; padding: 12px; direction: ltr; text-align: left; white-space: pre-wrap; overflow: auto; max-height: 420px; border-top: 1px solid var(--line); }
.history-block { direction: rtl; text-align: right; color: var(--muted); }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 1fr; }
  .connection-panel { grid-template-columns: 1fr 1fr auto; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .quality-grid, .api-spec, .dashboard-columns, .scraper-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-shell, .topbar { padding: 14px; }
  .login-strip { grid-template-columns: 1fr; }
  .connection-panel, .filter-grid, .metric-grid, .two-col { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .panel-head, .panel-head.compact { display: grid; }
  .detail-drawer { width: 100vw; }
}

/* v2: Divar-like classified listing inside the نمایش املاک tab */
.classifieds-layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.classifieds-filters {
  position: sticky;
  top: 116px;
  display: grid;
  align-content: start;
  gap: 14px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 2px 0 24px 10px;
}

.filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.filter-status strong { font-size: 1rem; }
.filter-status span { color: var(--muted); font-size: .78rem; }

.category-tree {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.category-tree h2 { margin-bottom: 8px; color: var(--text); font-size: .95rem; }
.category-link {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  text-align: right;
}
.category-link:hover { background: var(--surface); color: var(--text); }
.category-link.root { color: var(--text); }
.category-link.active { color: var(--brand); font-weight: 900; }
.category-children { display: grid; gap: 2px; padding-right: 14px; }

.filter-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.filter-section:last-of-type { border-bottom: 1px solid var(--line); }
.filter-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}
.filter-section summary::-webkit-details-marker { display: none; }
.filter-section summary::after {
  content: "›";
  color: var(--muted);
  font-size: 1.25rem;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}
.filter-section[open] summary::after { transform: rotate(-90deg); }
.filter-section summary small {
  margin-right: auto;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
}
.filter-section input,
.filter-section select { margin-top: 12px; }
.range-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
}
.switch-row input {
  appearance: none;
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 22px;
  min-height: 22px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #d8d8d8;
  padding: 0;
  transition: background 120ms ease;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 120ms ease;
}
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { transform: translateX(-16px); }

.classifieds-results { min-width: 0; }
.classifieds-head { margin-bottom: 12px; }
.results-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.sort-control { min-width: 220px; }
.search-row-in-tab {
  display: grid;
  grid-template-columns: minmax(240px, 620px);
  justify-content: center;
  margin-bottom: 14px;
}

.classified-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.property-card.classified-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 144px;
  gap: 14px;
  min-height: 176px;
  padding: 16px 0 16px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
  text-align: right;
  transition: background 120ms ease;
  padding: 15px !important;
}
.property-card.classified-card:hover { background: #fbfbfb; }
.property-card.classified-card.selected { background: #fff8f8; }
.card-body { display: grid; align-content: space-between; min-width: 0; }
.card-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.price-line { margin-top: 8px; color: var(--text); font-weight: 900; }
.subline,
.meta { display: block; margin-top: 4px; color: var(--muted); font-size: .86rem; line-height: 1.7; }
.meta {display: none !important;}
.card-media {
  position: relative;
  overflow: hidden;
  width: 144px;
  height: 144px;
  border-radius: 12px;
  background: #f0f0f0;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.no-image { display: grid; width: 100%; height: 100%; place-items: center; color: var(--muted); font-size: .82rem; }
.admin-table-disclosure { margin-top: 18px; }
.admin-table-disclosure > summary {
  cursor: pointer;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 900;
}
.admin-table-disclosure[open] > summary { border-bottom-right-radius: 0; border-bottom-left-radius: 0; }
.admin-table-disclosure .table-wrap { border-top: 0; border-top-right-radius: 0; border-top-left-radius: 0; }

@media (max-width: 1180px) {
  .classifieds-layout { grid-template-columns: 1fr; }
  .classifieds-filters { position: static; max-height: none; padding-left: 0; }
}

@media (max-width: 720px) {
  .results-controls,
  .classifieds-head { display: grid; justify-content: stretch; }
  .search-row-in-tab,
  .classified-card-list { grid-template-columns: 1fr; }
  .property-card.classified-card { grid-template-columns: minmax(0, 1fr) 112px; min-height: 144px; }
  .card-media { width: 112px; height: 112px; }
}

.patch-version {
  display: inline-block;
  margin-top: 4px;
  color: var(--success);
  font-weight: 800;
}

.view-mode-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf7f0;
  color: var(--success);
  font-size: 0.76rem;
  vertical-align: middle;
}


/* visual-auth-menu patch */
.visual-topbar {
  grid-template-columns: 64px minmax(160px, 1fr) 64px;
  justify-items: center;
  min-height: var(--header-height);
  padding: 10px 24px;
}
.visual-topbar .topbar-left { justify-self: start; }
.visual-topbar .topbar-right { justify-self: end; }
.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  max-width: min(380px, 54vw);
}
.brand-logo img {
  display: block;
  max-height: 54px;
  max-width: 100%;
  object-fit: contain;
}
.hamburger-button {
  display: inline-grid;
  gap: 5px;
  width: 46px;
  height: 46px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.hamburger-button span {
  display: block;
  width: 21px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, .32);
  backdrop-filter: blur(2px);
}
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(360px, 92vw);
  height: 100vh;
  overflow: auto;
  padding: 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  direction: rtl;
}
.side-menu.hidden,
.menu-backdrop.hidden { display: none; }
.side-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.side-menu-head img { max-width: 180px; max-height: 42px; object-fit: contain; }
.menu-login-card,
.side-menu-nav {
  display: grid;
  gap: 10px;
}
.menu-login-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.user-summary { color: var(--muted); line-height: 1.9; font-size: .88rem; }
.full-width { width: 100%; }
.advanced-login-fields { margin-top: 4px; }
.advanced-login-fields summary { cursor: pointer; color: var(--muted); font-size: .82rem; font-weight: 800; }
.advanced-login-fields label { margin-top: 10px; }
.side-menu-nav .tab-button {
  width: 100%;
  justify-content: flex-start;
  text-align: right;
  min-height: 44px;
  border-radius: 12px;
}
.side-menu-nav .tab-button.active { background: var(--brand); color: #fff; }
.placeholder-panel { padding: 26px; }
.placeholder-panel p { color: var(--muted); margin-top: 8px; line-height: 1.9; }
.auth-required {
  border-color: #fedf89;
  background: #fffaeb;
  color: var(--warning);
  font-weight: 900;
}
.is-guest .classified-card-list,
.is-guest .admin-table-disclosure,
.is-guest .bottom-pager { display: none; }
.bottom-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 22px 0 6px;
}
.bottom-pager button,
.pager button {
  min-width: 92px;
}
.filter-section.hidden { display: none; }
.classifieds-head .results-controls { justify-content: end; }
@media (max-width: 720px) {
  .visual-topbar { grid-template-columns: 54px minmax(120px, 1fr) 54px; padding-inline: 12px; }
  .brand-logo { max-width: 58vw; }
  .brand-logo img { max-height: 44px; }
  .side-menu { width: min(330px, 96vw); }
}


/* visual patch v3 refinements */
.visual-topbar {
  position: sticky;
  min-height: 76px;
  padding: 12px 24px;
}
.visual-topbar .brand-logo {
  position: absolute;
  right: 24px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}
.visual-topbar .topbar-left {
  position: absolute;
  left: 24px;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
}
.visual-topbar .topbar-right { display: none; }
.brand-logo { height: 56px; max-width: 280px; }
.brand-logo img { max-height: 56px; width: auto; }
.hamburger-button { width: 48px; height: 48px; border-radius: 16px; }
.page-shell { max-width: 1480px; padding: 28px 28px 36px; }
.classifieds-layout { grid-template-columns: 304px minmax(0, 1fr); gap: 28px; }
.classifieds-filters { top: 100px; padding-left: 12px; gap: 16px; }
.classifieds-results { min-width: 0; }
.classifieds-head { margin-bottom: 16px; }
.search-row-in-tab { margin-bottom: 18px; }
.filter-section { padding: 14px 0; }
.filter-section input,
.filter-section select { margin-top: 10px; }
.range-fields { gap: 10px; }
.bottom-pager { margin: 28px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
#pageLabel { min-width: 150px; text-align: center; font-weight: 900; color: var(--text); }
@media (max-width: 720px) {
  .visual-topbar { min-height: 66px; padding: 10px 16px; }
  .visual-topbar .brand-logo { right: 16px; }
  .visual-topbar .topbar-left { left: 16px; }
  .brand-logo img { max-height: 44px; }
  .hamburger-button { width: 44px; height: 44px; }
  .page-shell { padding: 18px 14px 28px; }
  .classifieds-layout { gap: 18px; }
}

/* FORCE FONT FIX */
@font-face {
  font-family: 'IranYekanForce';
  src: url('/admin/assets/fonts/iranyekan/IRANYekanWebRegular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IranYekanForce';
  src: url('/admin/assets/fonts/iranyekan/IRANYekanWebBold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
html, body, button, input, select, textarea, option, a, span, div, p, h1, h2, h3, h4, h5, h6, label {
  font-family: 'IranYekanForce', Tahoma, Arial, sans-serif !important;
}

/* FORCE FONT FAMILY - SAFE UTF8 */
html, body, body *, button, input, select, textarea, option {
  font-family: IranYekan, "Iran Yekan", "Yekan Bakh FaNum", Tahoma, Arial, sans-serif !important;
}
/* FINAL FONT FIX - YEKAN BAKH FANUM DIRECT */
@font-face {
  font-family: 'NeshaniAdminFont';
  src:
    url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Regular.woff2') format('woff2'),
    url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NeshaniAdminFont';
  src:
    url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Bold.woff2') format('woff2'),
    url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
html, body, body *, button, input, select, textarea, option {
  font-family: 'NeshaniAdminFont', Tahoma, Arial, sans-serif !important;
}

/* FINAL TRUE TYPE FONT FIX */
@font-face {
  font-family: 'NeshaniAdminFixed';
  src: url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Regular.woff2') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NeshaniAdminFixed';
  src: url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-Bold.woff2') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'NeshaniAdminFixed';
  src: url('/admin/assets/fonts/yekan-bakh-fanum/YekanBakhFaNum-ExtraBlack.woff2') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
html, body, body *, button, input, select, textarea, option {
  font-family: 'NeshaniAdminFixed', Tahoma, Arial, sans-serif !important;
}
