/* R-ONE Market — personal realtor page (/m/agent/:slug). Built on the shared
 * --m-* tokens and .m-sheet components; the realtor can only pick an accent
 * from the CRM branding presets (--agent-accent), never their own CSS. */

.m-agent { --agent-accent: var(--m-accent); padding-top: 22px; padding-bottom: 72px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.m-agent-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "cover cover" "card side";
  gap: 0 20px; margin-bottom: 28px;
}
.m-agent-cover {
  grid-area: cover; height: 200px; border-radius: 22px 22px 0 0; overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--agent-accent) 55%, transparent), transparent 60%),
    linear-gradient(135deg, #0e2038, color-mix(in srgb, var(--agent-accent) 70%, #0e2038));
}
.m-agent-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.m-agent-card {
  grid-area: card; position: relative; margin-top: 0; padding: 0 24px 22px; border-radius: 0 0 0 22px;
  display: grid; gap: 14px;
}
.m-agent-identity { display: flex; align-items: flex-start; gap: 18px; }
.m-agent-avatar {
  flex: 0 0 112px; width: 112px; height: 112px; margin-top: -56px; border-radius: 28px; object-fit: cover;
  border: 4px solid var(--m-bg); background: var(--m-surface); box-shadow: 0 14px 30px -18px rgba(5, 20, 40, .6);
}
.m-agent-avatar--initials {
  display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--agent-accent), #0e2038);
}
.m-agent-titles { min-width: 0; padding-top: 14px; }
.m-agent-trust { margin: 0 0 2px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; color: var(--m-muted); }
.m-agent-trust span { color: var(--agent-accent); }
.m-agent-titles h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1.1; letter-spacing: -.02em; overflow-wrap: anywhere; }
.m-agent-org { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; color: var(--m-muted); font-weight: 600; }
.m-agent-org img { width: 20px; height: 20px; border-radius: 5px; object-fit: contain; background: #fff; }
.m-agent-bio { margin: 0; max-width: 720px; color: var(--m-text); line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.m-agent-chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin: 0; padding: 0; list-style: none; }
.m-agent-chips li {
  display: inline-flex; align-items: center; height: auto; min-height: 0; margin: 0; line-height: 1.2;
  padding: 6px 11px; border-radius: 999px; font-size: .86rem; font-weight: 700;
  background: color-mix(in srgb, var(--agent-accent) 12%, transparent); color: var(--m-text);
  border: 1px solid color-mix(in srgb, var(--agent-accent) 30%, transparent);
}
.m-agent-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.m-agent-actions .m-sheet-primary { background: linear-gradient(135deg, var(--agent-accent), color-mix(in srgb, var(--agent-accent) 55%, #22d3ee)); color: #fff; }
.m-agent-share-status { font-size: .86rem; font-weight: 700; color: #16a34a; }

.m-agent-side { grid-area: side; display: grid; gap: 12px; align-content: start; padding-top: 18px; }
.m-agent-stats, .m-agent-contacts {
  margin: 0; padding: 16px; border-radius: 16px; border: 1px solid var(--m-border); background: var(--m-surface);
}
.m-agent-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px 16px; }
.m-agent-stats div { display: grid; gap: 2px; }
.m-agent-stats dt { font-size: .78rem; color: var(--m-muted); font-weight: 600; }
.m-agent-stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; }
.m-agent-contacts { list-style: none; display: grid; gap: 10px; }
.m-agent-contacts li { display: grid; gap: 1px; }
.m-agent-contacts span { font-size: .78rem; color: var(--m-muted); font-weight: 600; }
.m-agent-contacts a { color: var(--m-text); font-weight: 700; text-decoration: none; overflow-wrap: anywhere; min-height: 28px; display: inline-flex; align-items: center; }
.m-agent-contacts a:hover { color: var(--agent-accent); }

.m-agent-listings-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.m-agent-listings-head h2 { margin: 0; font-size: 1.35rem; }
.m-agent-count { color: var(--m-muted); font-weight: 600; font-size: .9rem; }
.m-agent-search { display: flex; gap: 8px; margin-bottom: 12px; }
.m-agent-search input {
  flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 16px;
  border: 1px solid var(--m-border); background: var(--m-surface); color: var(--m-text);
}
.m-agent-search input:focus { outline: 0; border-color: var(--agent-accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .22); }
.m-agent-filter-open { display: none; }

/* Desktop: the filter dialog is shown inline as a filter bar (it is the same
   form); on phones it is a bottom sheet opened by «Фільтри». */
@media (min-width: 768px) {
  .m-agent-filters:not([open]) { display: block; position: static; width: auto; max-width: none; margin: 0 0 18px; }
  .m-agent-filters:not([open]) .m-sheet-card { border-radius: 16px; box-shadow: none; }
  .m-agent-filters:not([open]) .m-sheet-head, .m-agent-filters:not([open]) .m-sheet-handle { display: none; }
  .m-agent-filters:not([open]) .m-agent-filter-grid {
    display: grid; grid-template-columns: minmax(220px, 1.2fr) repeat(3, minmax(130px, 1fr)) minmax(200px, 1.2fr); gap: 12px; align-items: end; padding: 14px 16px 0;
  }
  .m-agent-filters:not([open]) .m-sheet-field { margin-bottom: 14px; }
  .m-agent-filters:not([open]) .m-sheet-actions { border-top: 0; padding-top: 0; }
}
.m-agent-deal { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m-agent-price > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.m-agent-grid { margin-top: 4px; }
.m-agent-pages { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.m-agent-pages a {
  display: grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 12px;
  border: 1px solid var(--m-border); color: var(--m-text); text-decoration: none; font-weight: 700;
}
.m-agent-pages a[aria-current="page"] { border-color: var(--agent-accent); color: var(--agent-accent); }
.m-agent-empty {
  display: grid; justify-items: center; gap: 12px; padding: 40px 20px; text-align: center;
  border: 1px dashed var(--m-border); border-radius: 18px; background: var(--m-surface);
}
.m-agent-empty h3 { margin: 0; font-size: 1.1rem; }
.m-agent-mobile-bar { display: none; }

@media (max-width: 900px) {
  .m-agent-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cover" "card" "side"; }
  .m-agent-card { border-radius: 0; }
}
@media (max-width: 767px) {
  .m-agent { padding-top: 0; padding-bottom: 110px; }
  .m-agent-cover { height: 120px; margin: 0 -16px; border-radius: 0; }
  .m-agent-card { margin-top: 0; padding: 0 0 14px; }
  .m-agent-identity { flex-direction: column; align-items: flex-start; gap: 10px; }
  .m-agent-titles { padding-top: 0; }
  .m-agent-avatar { flex-basis: 84px; width: 84px; height: 84px; margin-top: -44px; border-radius: 22px; }
  .m-agent-avatar--initials { font-size: 1.6rem; }
  .m-agent-actions > * { flex: 1 1 auto; }
  .m-agent-actions .m-sheet-primary, .m-agent-actions .m-sheet-secondary { min-height: 44px; padding: 0 14px; font-size: .95rem; }
  .m-agent-side { padding-top: 0; }
  .m-agent-filter-open { display: inline-flex; min-height: 48px; padding: 0 14px; }
  .m-agent-search .m-sheet-primary { display: none; }
  .m-agent-mobile-bar {
    position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; display: flex; gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--m-border);
    background: color-mix(in srgb, var(--m-bg) 92%, transparent); backdrop-filter: blur(14px);
  }
  .m-agent-mobile-bar > * { flex: 1 1 0; min-height: 48px; }
  .m-agent-body .m-bottom-nav { display: none; }
}
