/* Home Base sections + Home Team (Guesty) section */

.sections { position: fixed; top: 16px; left: calc(var(--panel-w) + 20px); z-index: 960; display: flex; background: rgba(17,20,22,.92); border: 1px solid var(--line); backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.sections button { background: none; border: 0; color: var(--muted); font: 600 12px/1 Montserrat, sans-serif; letter-spacing: .08em; text-transform: uppercase; padding: 12px 18px; cursor: pointer; }
.sections button + button { border-left: 1px solid var(--line); }
.sections button.is-on { color: #031312; background: var(--teal); }
.sections button:not(.is-on):hover { color: var(--text); }

/* Hide the Team UI whenever another section (or the hub screen) is open */
body:not([data-sec="team"]) :is(#panel, #trips-fab, #leaderboard, #card, #toasts, #editor, #trips-drawer, #event-editor, #tour, #palette) { display: none !important; }

/* Panel */
.ht-panel { position: fixed; top: 0; left: 0; bottom: 0; width: var(--panel-w); background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 900; }
.ht-tabs { grid-template-columns: repeat(3, 1fr) !important; }
.ht-input, .ht-panel select, .ht-ask-form textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 0; padding: 9px 11px; outline: none; font: 14px Montserrat, sans-serif; color: var(--text); }
.ht-input:focus, .ht-panel select:focus, .ht-ask-form textarea:focus { border-color: var(--teal); }
.ht-panel select { padding: 8px 6px; font-size: 13px; color-scheme: dark; cursor: pointer; }
.ht-filters { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.ht-colorby { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 12px; }
.ht-colorby label { margin: 0; font-size: 10px; }
.ht-legend { margin-top: 8px; }
.ht-ramp { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; height: 8px; }
.ht-ramp i { border-radius: 1px; }
.ht-ramp-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.ht-ramp-l .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.ht-count-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; font-size: 12px; color: var(--muted); }
.stats .err, .err { color: var(--danger); }
.muted { color: var(--muted); font-size: 13px; }

.ht-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 9px 22px; border-bottom: 1px solid #1a1e21; cursor: pointer; }
.ht-row:hover, .ht-row.is-on { background: var(--panel-2); }
.ht-row.is-on { box-shadow: inset 3px 0 0 var(--teal); }
.ht-thumb { width: 44px; height: 34px; background: #20262a center/cover; display: block; flex: none; }
.ht-row-main { min-width: 0; }
.ht-row-main b, .ht-mini b, .ht-watch b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-row-main small, .ht-mini small, .ht-watch small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-row-v { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Map tooltip */
.leaflet-tooltip.ht-tip { background: var(--panel); border: 1px solid var(--line); border-radius: 0; color: var(--text); padding: 0; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.leaflet-tooltip.ht-tip::before { border-top-color: var(--line); }
.ht-tip-in { display: flex; gap: 10px; padding: 8px; max-width: 360px; }
.ht-tip-in img { width: 84px; height: 64px; object-fit: cover; flex: none; }
.leaflet-tooltip.ht-tip { white-space: normal; }
.ht-tip-in div { min-width: 210px; display: flex; flex-direction: column; gap: 2px; font-size: 12px; white-space: normal; }
.ht-tip-in b { font-size: 13px; }
.ht-tip-in span { color: var(--muted); }
.ht-tip-in .ht-tip-k { color: var(--text); font-variant-numeric: tabular-nums; }
.ht-tip-in small { color: var(--muted); }
.ht-tip-in em { color: var(--teal); font-style: normal; font-size: 11px; margin-top: 2px; }

/* Property card */
.ht-card { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; background: var(--panel); border-left: 1px solid var(--line); z-index: 950; overflow-y: auto; box-shadow: -20px 0 50px rgba(0,0,0,.35); animation: ht-in .25s ease; }
@keyframes ht-in { from { transform: translateX(30px); opacity: 0; } }
.ht-card-x { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(11,13,14,.7); color: #fff; }
.ht-hero { height: 220px; background: #1b2023 center/cover; position: relative; }
.ht-badge { position: absolute; left: 14px; bottom: 14px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 9px; background: rgba(11,13,14,.85); }
.ht-badge.on { color: var(--teal); }
.ht-badge.off { color: var(--muted); }
.ht-card-body { padding: 18px 22px 30px; }
.ht-card h2 { font: 400 26px/1.1 Aboreto, serif; margin: 0 0 6px; word-break: break-word; }
.ht-title { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.ht-addr { margin: 0; font-size: 13px; color: var(--muted); }
.ht-links { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; }
.ht-links a { color: var(--teal); }
.ht-owners { margin-top: 14px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); }
.ht-owners b { display: block; font-size: 15px; margin-top: 2px; }
.ht-k { display: block; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ht-h { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 24px 0 10px; }
.ht-h small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); margin-left: 6px; }
.ht-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.ht-grid > div { background: var(--panel); padding: 11px 12px; }
.ht-grid b { display: block; font-size: 18px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.ht-grid small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ht-books { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); }
.ht-books b { font-size: 14px; }
.ht-delta { display: inline-block; font-size: 11px; font-weight: 700; margin-top: 3px; white-space: nowrap; }
.ht-delta.up { color: #5fd6a0; }
.ht-delta.down { color: #ff8a7a; }
.ht-delta small { font-weight: 400; color: var(--muted); margin-left: 2px; }
.ht-facts { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.ht-facts dt { color: var(--muted); }
.ht-facts dd { margin: 0; font-weight: 600; }
.ht-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; }
.ht-tags span { font-size: 11px; padding: 3px 7px; border: 1px solid var(--line); color: var(--muted); }
.ht-review { padding: 10px 0; border-bottom: 1px solid #1f2427; }
.ht-review-h { display: flex; justify-content: space-between; align-items: center; }
.ht-review-h small { color: var(--muted); font-size: 11px; }
.ht-review p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: #cfd6d9; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ht-stars { color: #f2c14e; letter-spacing: 1px; font-size: 13px; }
.ht-stars i { color: #39403f; font-style: normal; }
.ht-fine { font-size: 11px; color: #5f686d; margin-top: 22px; line-height: 1.5; }
.ht-skel { height: 60px; background: linear-gradient(90deg, #15191b, #1d2225, #15191b); background-size: 200% 100%; animation: ht-sk 1.2s linear infinite; }
@keyframes ht-sk { to { background-position: -200% 0; } }

/* Charts */
.ht-chart { width: 100%; }
.ht-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ht-grid-l { stroke: #23292c; stroke-width: 1; }
.ht-ax { fill: #6f797e; font: 10px Montserrat, sans-serif; }
.ht-bar path { fill: var(--teal); }
.ht-bar.fut path { fill: rgba(26,175,169,.38); }
.ht-bar .ht-hit { fill: transparent; }
.ht-bar.hov .ht-hit { fill: rgba(255,255,255,.04); }
.ht-bar.hov path { fill: #5fd6cf; }
.ht-tooltip { position: fixed; z-index: 2000; pointer-events: none; background: #0b0d0e; border: 1px solid var(--line); padding: 8px 10px; font-size: 12px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 260px; }
.ht-hbars { display: flex; flex-direction: column; gap: 4px; }
.ht-hbar { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 10px; font-size: 12px; background: none; border: 0; color: inherit; padding: 4px 0; text-align: left; font-family: inherit; }
button.ht-hbar { cursor: pointer; }
.ht-hbar.hov, button.ht-hbar:hover { background: rgba(255,255,255,.03); }
.ht-hbar-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ht-hbar-l small { color: var(--muted); margin-left: 4px; }
.ht-hbar-t { height: 10px; background: #1a1f22; }
.ht-hbar-t i { display: block; height: 100%; background: var(--teal); border-radius: 0 3px 3px 0; }
.ht-hbar-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Full pages (analytics, ask) */
.ht-page { position: fixed; top: 0; right: 0; bottom: 0; left: var(--panel-w); background: var(--ink); z-index: 920; overflow-y: auto; padding: 0 32px 40px; border-top: 66px solid var(--ink); }
.ht-page::before { content: ""; position: fixed; top: 65px; left: var(--panel-w); right: 0; height: 1px; background: var(--line); z-index: 1; }
.ht-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; padding-top: 22px; }
.ht-page-head .link { white-space: nowrap; }
.ht-page-head h2 { font: 400 34px/1 Aboreto, serif; margin: 0 0 8px; }
.ht-page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.ht-kpis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 18px; }
.ht-kpi { background: var(--panel); padding: 16px; }
.ht-kpi b { display: block; font-size: 26px; font-weight: 600; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.ht-kpi small { font-size: 11px; color: var(--muted); line-height: 1.6; }
.ht-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.ht-two > .ht-panel-c { margin-bottom: 0; }
.ht-panel-c { background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.ht-panel-c h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ht-panel-c h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.ht-panel-c h3 .btn { margin-left: auto; }
.ht-flag { font-size: 11px; padding: 3px 7px; letter-spacing: .04em; }
.ht-flag.good { color: #5fd6a0; border: 1px solid rgba(95,214,160,.4); }
.ht-flag.bad { color: #ff8a7a; border: 1px solid rgba(255,138,122,.4); }
.ht-tablewrap { overflow-x: auto; }
.ht-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ht-table th { text-align: left; font-weight: 600; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 0 8px 8px; white-space: nowrap; }
.ht-table th button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; letter-spacing: .04em; text-transform: uppercase; }
.ht-table th button.on { color: var(--teal); }
.ht-table th button.on.desc::after { content: " ↓"; }
.ht-table th button.on.asc::after { content: " ↑"; }
.ht-table td { padding: 8px; border-bottom: 1px solid #1c2124; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ht-table tbody tr[data-id], .ht-table tbody tr[data-state] { cursor: pointer; }
.ht-table tbody tr:hover { background: var(--panel-2); }
.ht-table .n { text-align: right; }
.ht-table th.n button { text-align: right; }
.ht-table .ht-ow { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ht-table .ht-delta { margin: 0; }
.ht-table .ht-delta small { display: none; }
.ht-table td.w { min-width: 170px; }
.ht-inbar { display: inline-block; width: 70px; height: 8px; background: #1a1f22; margin-right: 10px; vertical-align: middle; }
.ht-inbar i { display: block; height: 100%; background: var(--teal); border-radius: 0 3px 3px 0; }
.ht-mini, .ht-watch { list-style: none; margin: 0; padding: 0; }
.ht-mini li, .ht-watch li { display: grid; grid-template-columns: 22px 44px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid #1c2124; cursor: pointer; min-width: 0; }
.ht-watch li { grid-template-columns: 44px minmax(0, 1fr) auto; }
.ht-mini li > span:nth-child(3), .ht-watch li > span:nth-child(2) { min-width: 0; }
.ht-mini li:hover, .ht-watch li:hover { background: var(--panel-2); }
.ht-rank { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ht-why { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.ht-why em { font-style: normal; font-size: 11px; padding: 3px 7px; color: #ffb3a8; border: 1px solid rgba(255,138,122,.35); white-space: nowrap; }
.ht-pager { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.ht-pager .link:disabled { opacity: .3; cursor: default; }

/* Ask AI */
.ht-ask-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100%; }
.ht-log { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.ht-msg { padding: 14px 16px; font-size: 14px; line-height: 1.55; }
.ht-msg.me { align-self: flex-end; background: var(--teal-dim); border: 1px solid rgba(26,175,169,.35); max-width: 80%; white-space: pre-wrap; }
.ht-msg.ai { background: var(--panel); border: 1px solid var(--line); margin-top: 10px; }
.ht-msg.ai p { margin: 0 0 10px; }
.ht-msg.ai p:last-child { margin-bottom: 0; }
.ht-msg.ai ul, .ht-msg.ai ol { margin: 0 0 10px; padding-left: 20px; }
.ht-msg.ai h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.ht-msg.ai .ht-tablewrap { margin: 6px 0 12px; }
.ht-msg.ai code { background: #1a1f22; padding: 1px 5px; font-size: 12px; }
.ht-think { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.ht-think i { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); animation: ht-dot 1s infinite ease-in-out; }
.ht-think i:nth-child(2) { animation-delay: .15s; }
.ht-think i:nth-child(3) { animation-delay: .3s; margin-right: 8px; }
@keyframes ht-dot { 50% { opacity: .2; transform: translateY(-3px); } }
.ht-mapbtn { margin-top: 6px; }
.ht-sql { margin-top: 12px; font-size: 12px; color: var(--muted); }
.ht-sql summary { cursor: pointer; }
.ht-sql pre { white-space: pre-wrap; background: #0d1011; border: 1px solid var(--line); padding: 8px; margin: 8px 0 2px; font-size: 11px; color: #b9c3c7; }
.ht-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.ht-chip { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 9px 12px; font: 13px Montserrat, sans-serif; cursor: pointer; text-align: left; }
.ht-chip:hover { border-color: var(--teal); }
.ht-ask-form { position: sticky; bottom: -40px; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px 0 40px; background: var(--ink); margin-top: 18px; }
.ht-ask-form textarea { resize: none; font-size: 15px; padding: 12px; }
.ht-ask-form .btn { margin: 0; width: auto; padding: 0 26px; }

body.ht-overlay .leaflet-control-zoom { display: none; }

@media (max-width: 1500px) { .ht-kpis { grid-template-columns: repeat(4, 1fr); } .ht-kpis .ht-kpi:last-child { grid-column: span 2; } }
@media (max-width: 1100px) {
  .ht-two { grid-template-columns: 1fr; }
  .ht-card { width: 400px; }
}
@media (max-width: 760px) {
  .sections { left: 50%; transform: translateX(-50%); top: 10px; }
  .sections button { padding: 10px 14px; }
  .ht-panel { top: auto; width: 100%; height: 46vh; border-right: 0; border-top: 1px solid var(--line); }
  .ht-panel .title { display: none; }
  .ht-panel .panel-head { padding: 12px 16px; }
  .ht-panel .brand-row { display: none; }
  .ht-row { padding: 9px 16px; }
  .ht-card { width: 100%; top: auto; height: 62vh; border-left: 0; border-top: 1px solid var(--line); }
  .ht-hero { height: 150px; }
  .ht-page { left: 0; bottom: 46vh; padding: 0 16px 24px; border-top-width: 56px; }
  .ht-page::before { left: 0; top: 55px; }
  .ht-page-head h2 { font-size: 26px; }
  .ht-hbar { grid-template-columns: 110px 1fr 60px; }
  .ht-kpis { grid-template-columns: 1fr 1fr; }
  .ht-kpis .ht-kpi:last-child { grid-column: span 2; }
  .ht-kpi b { font-size: 20px; }
  .ht-ask-form { bottom: -24px; padding-bottom: 24px; }
  body.ht-overlay .ht-panel { height: auto; }
  body.ht-overlay .ht-panel :is(#ht-list, #ht-q-filter, .ht-filters, .ht-colorby, .ht-legend, .ht-count-row) { display: none; }
  body.ht-overlay .ht-panel .tabs { margin-bottom: 0; }
  body.ht-overlay .ht-page { bottom: 96px; }
}
