/* XD.cz — statistiky prodeje. Apple-like: SF typografie, velké číslice, měkké karty, průsvitná navigace. */
:root {
    --bg: #fbfbfd;
    --bg-alt: #f5f5f7;
    --card: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --line: #d2d2d7;
    --accent: #0071e3;
    --sold: #0071e3;
    --reserved: #ff9f0a;
    --avail: #34c759;
    --warn-bg: #fff8e6;
    --warn-line: #ffd479;
    --info-bg: #eef5ff;
    --info-line: #b9d6ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .05);
    --radius: 20px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
}

html[data-theme="dark"] {
    --bg: #000000;
    --bg-alt: #0b0b0d;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: #38383a;
    --accent: #2997ff;
    --sold: #2997ff;
    --reserved: #ff9f0a;
    --avail: #30d158;
    --warn-bg: #2b2412;
    --warn-line: #5c4a14;
    --info-bg: #0f2033;
    --info-line: #1d4470;
    --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.47;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
small { color: var(--muted); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.wrap--narrow { max-width: 780px; }

/* Navigace */
.nav {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.nav__inner { max-width: 1080px; margin: 0 auto; padding: 0 22px; height: 48px; display: flex; align-items: center; justify-content: space-between; }
.nav__brand { font-weight: 700; font-size: 19px; letter-spacing: -.03em; color: var(--text); }
.nav__brand span { color: var(--muted); font-weight: 500; }
.nav__brand:hover { text-decoration: none; }
.nav__links { display: flex; gap: 22px; }
.nav__links a { color: var(--muted); font-size: 13px; }
.nav__links a:hover { color: var(--text); text-decoration: none; }

/* Hero */
.hero { padding: 88px 0 56px; text-align: center; }
.hero--project { text-align: left; padding: 56px 0 24px; }
.eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.hero h1 { font-size: clamp(38px, 7vw, 72px); line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }
.hero--project h1 { font-size: clamp(34px, 5.5vw, 56px); }
.lead { margin: 18px auto 0; max-width: 640px; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.3; color: var(--muted); font-weight: 500; letter-spacing: -.01em; }
.hero--project .lead { margin-left: 0; }
.asof { margin: 28px 0 0; color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 48px; }
.hero--project .stats { margin-top: 32px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 24px 16px; box-shadow: var(--shadow); }
.stat__num { display: block; font-size: clamp(30px, 4.6vw, 48px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat__num--sold { color: var(--sold); }
.stat__num--reserved { color: var(--reserved); }
.stat__num--avail { color: var(--avail); }
.stat__label { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }

/* Sekce */
.section { padding: 72px 0; }
.section--alt { background: var(--bg-alt); }
.section h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -.03em; }
.h2--spaced { margin-top: 56px; }
.h3 { margin: 28px 0 8px; font-size: 21px; font-weight: 600; }
.section__sub { margin: 8px 0 24px; color: var(--muted); max-width: 720px; }
.section h2 + .chips, .section h2 + .cards, .section h2 + .card, .section h2 + .notice { margin-top: 24px; }

.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.chart-card { padding: 20px 20px 12px; }

/* Upozornění */
.notice { border-radius: 16px; padding: 16px 20px; margin: 0 0 24px; font-size: 15px; line-height: 1.5; border: 1px solid; }
.notice--warn { background: var(--warn-bg); border-color: var(--warn-line); }
.notice--info { background: var(--info-bg); border-color: var(--info-line); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--text); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; vertical-align: middle; }
.badge--lg { font-size: 13px; padding: 2px 10px; letter-spacing: 0; }

/* Žebříček */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank a { display: grid; grid-template-columns: 32px minmax(160px, 1.3fr) 1fr minmax(150px, auto); gap: 16px; align-items: center; padding: 14px 20px; background: var(--card); border-radius: 16px; color: var(--text); box-shadow: var(--shadow); }
.rank a:hover { text-decoration: none; transform: translateY(-1px); }
.rank__pos { font-size: 22px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank__name strong { display: block; font-weight: 600; }
.rank__name small { display: inline; font-size: 13px; margin-right: 6px; }
.rank__bar { height: 8px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.rank__bar span { display: block; height: 100%; background: var(--sold); border-radius: 999px; }
.rank__val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank__val small { display: block; font-weight: 400; font-size: 13px; }

/* Města */
.city h3 { font-size: 20px; font-weight: 600; }
.city__big { margin: 8px 0 12px; font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.city__big span { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 16px 0 0; }
.kv div { display: flex; flex-direction: column; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv--rows { grid-template-columns: 1fr; gap: 0; margin: 0; }
.kv--rows div { flex-direction: row; justify-content: space-between; gap: 24px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.kv--rows div:last-child { border-bottom: 0; }
.kv--rows dd { text-align: right; }

/* Tabulka */
.table-card { padding: 8px 8px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable:hover { color: var(--text); }
.table th.sortable .sort-ic { display: inline-block; width: 10px; margin-left: 2px; opacity: .35; }
.table th.sortable .sort-ic::before { content: '↕'; }
.table th.sortable.is-sorted-asc .sort-ic, .table th.sortable.is-sorted-desc .sort-ic { opacity: 1; color: var(--accent); }
.table th.sortable.is-sorted-asc .sort-ic::before { content: '↑'; }
.table th.sortable.is-sorted-desc .sort-ic::before { content: '↓'; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Seznam projektů */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { font: inherit; font-size: 14px; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 4px 0 14px; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot--sold { background: var(--sold); } .dot--reserved { background: var(--reserved); } .dot--avail { background: var(--avail); }
.plist { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(120px, 1.2fr) 64px 110px 64px 100px 32px; gap: 16px; align-items: center; padding: 14px 20px; background: var(--card); border-radius: 16px; color: var(--text); box-shadow: var(--shadow); }
.prow:hover { transform: translateY(-1px); }
.prow[hidden] { display: none; }
.prow__link { display: contents; color: inherit; text-decoration: none; }
.prow__watch-cell { margin: 0; }
.prow__watch { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; text-decoration: none; }
.prow__watch:hover { background: var(--bg-alt); color: var(--accent); border-color: var(--accent); }
.prow__name strong { font-weight: 600; margin-right: 6px; }
.prow__meta { display: block; color: var(--muted); font-size: 13px; }
.prow__bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg-alt); }
.seg { display: block; height: 100%; }
.seg--sold { background: var(--sold); } .seg--reserved { background: var(--reserved); } .seg--avail { background: var(--avail); }
.prow__num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; }
.prow__num small { font-weight: 400; }
.prow__num .k { display: none; }

/* Grafy */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; opacity: .7; }
.chart .bar { transition: opacity .12s; }
.chart .col:hover .bar { opacity: .82; }
.chart .hit { fill: transparent; }
.chart__empty { padding: 48px 12px; text-align: center; color: var(--muted); font-size: 15px; }
.chart__tip { position: absolute; pointer-events: none; z-index: 2; background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.4; padding: 8px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; }
.chart__tip.is-on { opacity: 1; }

.plain { padding-left: 20px; color: var(--muted); }
.plain li { margin: 8px 0; }
.plain strong { color: var(--text); }

.footer { padding: 40px 0 56px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.footer p { margin: 6px 0; max-width: 780px; }

@media (max-width: 860px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .nav__links { gap: 14px; }
    .rank a { grid-template-columns: 26px 1fr auto; }
    .rank__bar { display: none; }
    .prow { grid-template-columns: 1fr 1fr; gap: 10px 16px; position: relative; padding-right: 52px; }
    .prow__name { grid-column: 1 / -1; }
    .prow__bar { grid-column: 1 / -1; }
    .prow__num { text-align: left; }
    .prow__watch-cell { position: absolute; top: 14px; right: 20px; }
    .prow__num .k { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
    .hero { padding: 56px 0 32px; }
    .section { padding: 48px 0; }
}
@media (max-width: 480px) {
    .nav__links a:nth-child(-n+2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}

/* Navigace: hledání */
.nav__search { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-right: -8px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.nav__search:hover, .nav__search[aria-expanded="true"] { color: var(--text); background: var(--bg-alt); }
.nav__links { align-items: center; }
.searchpanel { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); background: var(--bg); }
.searchpanel__inner { max-width: 720px; margin: 0 auto; padding: 16px 22px 20px; }
.searchpanel input, .searchform input { width: 100%; font: inherit; font-size: 19px; padding: 12px 16px; color: var(--text); background: var(--bg-alt); border: 1px solid transparent; border-radius: 14px; outline: none; }
.searchpanel input:focus, .searchform input:focus { border-color: var(--accent); background: var(--card); }
.searchpanel__results { display: grid; gap: 2px; margin-top: 10px; max-height: 60vh; overflow-y: auto; }
.sres { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.sres:hover, .sres:focus { background: var(--bg-alt); text-decoration: none; outline: none; }
.sres small { text-align: right; }
.sres__kind { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px 2px; }
.searchpanel__empty { padding: 12px; color: var(--muted); font-size: 15px; }
.searchform { display: flex; gap: 10px; margin-top: 24px; max-width: 640px; }
.searchform button { font: inherit; padding: 0 22px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Drobečky, odkazy v tabulkách, karty měst */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs span { color: var(--line); }
.rowlink { color: var(--text); }
.rowlink:hover { color: var(--accent); text-decoration: none; }
.table tbody tr:hover td { background: var(--bg-alt); }
.city--link { display: block; color: var(--text); transition: transform .15s; }
.city--link:hover { text-decoration: none; transform: translateY(-2px); }
.city__go { color: var(--muted); font-weight: 400; margin-left: 4px; }
.chip--link { display: inline-block; color: var(--text); }
.chip--link:hover { text-decoration: none; border-color: var(--accent); }
.prow__meta--dates { margin-top: 1px; }

/* Karty projektů na stránce developera */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-top: 24px; }
.pcard { display: flex; flex-direction: column; gap: 14px; }
.pcard h3 { font-size: 21px; font-weight: 600; }
.pcard h3 a { color: var(--text); }
.pcard__loc { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.pcard .kv { margin: 0; grid-template-columns: 1fr 1fr; }
.pcard__fin { margin: 0; font-size: 14px; }
.pcard__fin span { display: block; color: var(--muted); font-size: 13px; }
.pcard__links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; margin-top: auto; font-size: 14px; }

/* Formulář hlášení */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field--row { grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: 14px; font-weight: 600; }
.field label small { font-weight: 400; }
.field input, .field select, .field textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn { justify-self: start; font: inherit; font-weight: 600; padding: 12px 26px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn--ghost:hover { filter: none; background: var(--bg-alt); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 560px) { .field--row { grid-template-columns: 1fr; } }

/* Rozostřený náhled bytů pro nepřihlášené — vidí strukturu (řádky/sloupce), ne konkrétní čísla. */
.flats-wrap--locked { position: relative; }
.flats-wrap--locked .table-card { max-height: 360px; overflow: hidden; filter: blur(5px); user-select: none; pointer-events: none; }
.flats-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(to bottom, transparent, var(--bg) 65%); }
.flats-lock__card { max-width: 420px; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow); }
.flats-lock__card strong { display: block; font-size: 17px; margin-bottom: 8px; }
.flats-lock__card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.flats-lock__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.flats-lock__actions .btn { justify-self: unset; }

/* Přihlášení / registrace */
.wrap--auth { max-width: 420px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; font: inherit; font-weight: 600; font-size: 15px; padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; box-sizing: border-box; }
.btn-google:hover { background: var(--bg-alt); }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--muted); font-size: 13px; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-switch { margin: 20px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* Moje projekty / moje byty — jednoduchý seznam sledovaných položek */
.watchlist { display: grid; gap: 10px; }
.watchrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 20px; box-shadow: var(--shadow); }
.watchrow__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
