.portal-home .ph-lawyer-ranking {
  --rank-ink: #122f45;
  --rank-muted: #4c6676;
  --rank-teal: #08756e;
  --rank-line: #d6e6e4;
  --rank-card-height: 150px;
  --rank-card-gap: 12px;
  --rank-list-height: calc(3 * var(--rank-card-height) + 2 * var(--rank-card-gap) + 8px);
  width: calc(100% - 48px);
  max-width: 1320px;
  margin-inline: auto;
  padding: 22px clamp(18px, 2.8vw, 38px) 26px;
  box-sizing: border-box;
  border: 1px solid var(--rank-line);
  border-radius: 30px;
  background: radial-gradient(ellipse at top left, #e8f4ef, transparent 60%), #f5f9f9;
  color: var(--rank-ink);
  scroll-margin-top: 100px;
}
.ph-lawyer-ranking [hidden] { display: none !important; }
.ph-rank-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ph-rank-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ph-lawyer-ranking p { margin: 0; }
.ph-lawyer-ranking #ph-online-title { margin: 0 0 6px; color: var(--rank-ink); font-size: clamp(30px, 4vw, 47px); line-height: 1.07; letter-spacing: -.04em; scroll-margin-top: 109px; }
.ph-rank-intro { color: var(--rank-muted); font-size: 15px; }
.ph-rank-catalog, .ph-rank-action, .ph-rank-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 13px;
  border: 1px solid var(--rank-line);
  border-radius: 10px;
  color: var(--rank-teal);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.ph-rank-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 18px; }
.ph-rank-layout:has(.ph-rank-topics:not([hidden])) { grid-template-columns: 198px minmax(0, 1fr); }
.ph-rank-topics { min-width: 0; display: flex; flex-direction: column; gap: 9px; padding: 10px; background: #fff; border: 1px solid var(--rank-line); border-radius: 18px; }
.ph-rank-results { min-width: 0; }
.ph-rank-mobile-filter { display: none; }
.ph-rank-topics-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 4px 7px 9px; border-bottom: 1px solid var(--rank-line); color: var(--rank-ink); font-size: 13px; font-weight: 750; }
.ph-rank-topics-title span:last-child { padding: 1px 7px; border-radius: 20px; background: #edf4f3; color: var(--rank-muted); font-size: 11px; }
.ph-rank-topic-list { display: grid; gap: 3px; min-height: 0; overflow-y: auto; padding: 2px 3px; scrollbar-width: thin; scrollbar-color: #a9c5c1 transparent; }
.ph-rank-topics button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 36px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rank-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.ph-rank-topics button[aria-pressed="true"] { background: #dff3ec; color: #0a645c; font-weight: 750; }
.ph-rank-topic-check { visibility: hidden; }
.ph-rank-topics button[aria-pressed="true"] .ph-rank-topic-check { visibility: visible; }
.ph-rank-topics button:hover:not([aria-pressed="true"]), .ph-rank-catalog:hover, .ph-rank-footer button:hover { background: #eff7f5; }
.ph-rank-city-search { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin: 0 0 10px; color: var(--rank-ink); font-size: 13px; font-weight: 700; }
.ph-rank-location-controls { position: relative; display: flex; flex: 0 1 410px; min-width: 0; gap: 6px; }
.ph-rank-city-search input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 38px; padding: 6px 10px; border: 1px solid var(--rank-line); border-radius: 9px; background: #fff; color: var(--rank-ink); font: inherit; font-weight: 500; }
.ph-rank-regions { flex: none; margin: 0; padding: 0; border: 0; background: transparent; }
.ph-rank-regions > summary { box-sizing: border-box; display: flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 9px; border: 1px solid var(--rank-line); border-radius: 9px; background: #fff; color: var(--rank-teal); list-style: none; white-space: nowrap; cursor: pointer; }
.ph-rank-regions > summary::-webkit-details-marker { display: none; }
.ph-rank-regions > summary::marker { content: ""; }
.ph-rank-regions > summary:hover, .ph-rank-regions[open] > summary { background: #e9f5f1; }
.ph-rank-regions > summary span { padding: 1px 5px; border-radius: 6px; background: #e1f0ec; font-size: 11px; }
.ph-rank-region-menu { position: absolute; z-index: 5; inset: calc(100% + 5px) 0 auto; max-height: min(300px, 42vh); padding: 5px; overflow-y: auto; border: 1px solid var(--rank-line); border-radius: 12px; background: #fff; box-shadow: 0 8px 22px #183c4826; }
.ph-rank-region-menu button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--rank-ink); font: inherit; text-align: left; cursor: pointer; }
.ph-rank-region-menu button:hover, .ph-rank-region-menu button:focus-visible { background: #edf6f3; }
.ph-rank-region-menu small { color: var(--rank-muted); font-weight: 500; }
.ph-lawyer-ranking .ph-rank-empty { padding: 20px; border: 1px solid var(--rank-line); border-radius: 14px; background: #fff; color: var(--rank-muted); font-size: 14px; }
#ph-ranked-lawyers { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--rank-card-gap); }
.ph-rank-row { position: relative; min-width: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: 1fr auto; align-items: start; gap: 6px 14px; padding: 12px; border: 1px solid var(--rank-line); border-radius: 17px; background: #fff; box-shadow: 0 3px 12px #183c4810; }
.ph-rank-row:hover { border-color: #8abdb2; }
.ph-rank-row-accepting { border-color: #abd5cb; background: linear-gradient(135deg, #f1faf6, #fff 72%); }
.ph-rank-avatar { position: relative; grid-row: 1 / span 2; align-self: stretch; display: grid; place-items: center; min-height: 108px; overflow: hidden; background: #e6f2ef; color: var(--rank-teal); border-radius: 12px; font-weight: 800; text-decoration: none; }
.ph-rank-avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.ph-rank-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 7px; margin-bottom: 2px; }
.ph-rank-person h3 { margin: 0; color: var(--rank-ink); font-size: 17px; line-height: 1.22; overflow-wrap: anywhere; }
.ph-rank-presence { position: relative; z-index: 1; display: inline-block; width: 9px; height: 9px; margin-inline-start: 5px; border-radius: 50%; vertical-align: .09em; }
.ph-rank-presence-online { background: #13865c; box-shadow: 0 0 0 3px #dff4e8; }
.ph-rank-presence-recent { background: #c1800b; box-shadow: 0 0 0 3px #fff1cc; }
.ph-rank-presence-offline { background: #c85050; box-shadow: 0 0 0 3px #fbe5e5; }
.ph-rank-person h3 a { color: inherit; text-decoration: none; }
.ph-rank-row:hover .ph-rank-profile-link { color: var(--rank-teal); }
.ph-rank-profile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ph-rank-profile-link:focus-visible::after { outline: 2px solid #0c827a; outline-offset: -2px; border-radius: 17px; }
.ph-rank-specialty { color: var(--rank-teal); font-size: 13px; font-weight: 700; line-height: 1.35; }
.ph-lawyer-ranking .ph-rank-facts { display: flex; flex-wrap: wrap; gap: 2px 9px; margin-top: 4px; color: var(--rank-muted); font-size: 12px; line-height: 1.4; }
.ph-rank-score { color: #805b19; font-weight: 750; white-space: nowrap; }
.ph-rank-contact { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; min-height: 35px; padding-top: 5px; border-top: 1px solid #eaf0ef; }
.ph-rank-contact-mode { color: var(--rank-muted); font-size: 12px; line-height: 1.3; }
.ph-rank-count { color: var(--rank-ink); font-size: 12px; font-weight: 750; white-space: nowrap; }
.ph-rank-action { position: relative; z-index: 1; min-height: 35px; background: var(--rank-teal); border-color: var(--rank-teal); color: #fff; }
.ph-rank-action:hover { background: #075e59; }
.ph-rank-action-platform { border-color: var(--rank-line); background: #f0f8f5; color: var(--rank-teal); }
.ph-rank-action-platform:hover { background: #e0f3ec; }
.ph-rank-footer { display: flex; justify-content: center; margin-top: 14px; }
.ph-rank-footer button { cursor: pointer; }
.ph-lawyer-ranking :focus-visible { outline: 2px solid #0c827a; outline-offset: 2px; }
@media (min-width: 721px) {
  .ph-rank-topics { box-sizing: border-box; max-height: var(--rank-list-height); }
  #ph-ranked-lawyers[tabindex] { box-sizing: border-box; grid-auto-rows: var(--rank-card-height); max-height: var(--rank-list-height); overflow-y: auto; padding: 2px 8px 6px 2px; scrollbar-width: thin; scrollbar-color: #8aafaa #e7f0ee; scrollbar-gutter: stable; scroll-snap-type: y proximity; scroll-padding-block-start: 2px; }
  .ph-rank-row { scroll-snap-align: start; }
}
@media (min-width: 721px) and (max-height: 640px) {
  .portal-home .ph-lawyer-ranking { --rank-list-height: calc(2 * var(--rank-card-height) + var(--rank-card-gap) + 8px); }
}
@media (min-width: 1100px) {
  #ph-ranked-lawyers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 760px) and (min-width: 721px) {
  .portal-home .ph-lawyer-ranking { padding-block: 20px; }
  .ph-rank-header { margin-bottom: 14px; }
  .ph-rank-row { padding-block: 10px; }
}
@media (max-width: 720px) {
  .portal-home .ph-lawyer-ranking { width: calc(100% - 20px); padding: 14px; border-radius: 19px; }
  .ph-rank-layout:has(.ph-rank-topics:not([hidden])) { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .ph-rank-header { align-items: start; margin-bottom: 12px; }
  .ph-rank-header-actions { row-gap: 4px; }
  .ph-rank-intro { font-size: 13px; }
  .ph-lawyer-ranking #ph-online-title { scroll-margin-top: 122px; }
  .ph-rank-topics { padding: 7px 9px; }
  .ph-rank-topics > :not(.ph-rank-mobile-filter) { display: none; }
  .ph-rank-mobile-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; color: var(--rank-muted); font-size: 12px; font-weight: 700; }
  .ph-rank-mobile-filter select { width: 100%; min-height: 44px; padding-inline: 8px; border: 1px solid var(--rank-line); border-radius: 8px; color: var(--rank-ink); background: #f4f9f8; font: inherit; }
}
@media (max-width: 560px) {
  .ph-rank-header { flex-wrap: wrap; gap: 4px; }
  .ph-rank-catalog { min-height: 44px; }
  .ph-rank-row { grid-template-columns: 72px minmax(0, 1fr); gap: 6px 10px; padding: 10px; }
  .ph-rank-avatar { min-height: 96px; }
  .ph-rank-person h3 { font-size: 15px; }
  .ph-rank-action { min-height: 44px; padding-inline: 8px; font-size: 12px; }
}
