/*
 * НајдиЛек — the public search (templates/public/search.html). Porcelain surfaces on a cool page,
 * bottle-glass green for actions and selection, amber for the last piece and prescriptions; one
 * family, Onest, drawn for Cyrillic. Light only. Below 960 px the product is a bottom sheet moved by
 * public-search.js; from 960 px it is the right column. Content never grows past 1360 px.
 */

:root {
    --page: #EEF2F1; --surface: #FFFFFF; --sunk: #F5F8F7;
    --ink: #0E2622; --ink-2: #4C625D; --ink-3: #5F716D; --hair: #DCE4E2;
    --glass: #0A6E62; --glass-ink: #FFFFFF; --glass-wash: #E4F1EE; --glass-deep: #075248;
    --leaf: #177A47; --amber: #9A5208; --amber-wash: #FBF0E3;
    --scrim: rgba(8, 30, 26, .32);
    --shadow: 0 1px 2px rgba(8, 30, 26, .05), 0 12px 32px -18px rgba(8, 30, 26, .28);
    --shadow-lg: 0 -12px 40px rgba(8, 30, 26, .2);
    --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
    --header-h: 64px;
    --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
    color-scheme: light;
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body.pub {
    margin: 0; min-height: 100dvh; background: var(--page); color: var(--ink);
    font: 400 1rem/1.5 var(--font); letter-spacing: -.006em;
    -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
.pub svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
:where(.pub) button, :where(.pub) select { font: inherit; color: inherit; }
/* No specificity: every link class below sets its own colour. */
:where(.pub) a { color: inherit; text-decoration: none; }
.pub-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pub :focus-visible { outline: 3px solid var(--glass); outline-offset: 2px; border-radius: 10px; }
.pub [hidden] { display: none !important; }
.pub-num { font-variant-numeric: tabular-nums; }

/* ---------- logo ---------- */

.pub-logo { display: inline-flex; align-items: center; gap: 5px; color: var(--glass); min-height: 44px; }
.pub .pub-mark { width: 27px; height: 27px; flex: none; }
.pub-mark-lens { fill: none; stroke: currentColor; stroke-width: 3.2; }
.pub-mark-caps { fill: none; stroke: currentColor; stroke-width: 2.4; }
.pub-mark-fill { fill: currentColor; stroke: none; }
.pub-word { font-size: 22px; line-height: 1; letter-spacing: -.04em; white-space: nowrap; }
.pub-word span { font-weight: 500; }
.pub-word b { font-weight: 700; letter-spacing: -.035em; }

/* ---------- header and start screen ---------- */

.pub-header {
    position: relative; z-index: 30; max-width: 1360px; margin: 0 auto;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 56px;
    grid-template-areas: "logo login" "hero hero" "search search" "suggest suggest";
    align-content: center; align-items: start; min-height: 86dvh;
    padding: calc(14px + var(--safe-t)) calc(32px + var(--safe-r)) 40px calc(32px + var(--safe-l));
}
.pub-logo { grid-area: logo; align-self: start; }
.pub-login {
    grid-area: login; justify-self: end; align-self: start;
    display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px;
    font-size: .9rem; font-weight: 600; color: var(--ink); border: 1.5px solid var(--hair); border-radius: 11px; background: var(--surface);
}
.pub-login:hover { border-color: var(--glass); }
.pub-hero-text { grid-area: hero; margin-top: 14vh; justify-self: center; text-align: center; }
.pub-hero-text h1 { margin: 0 auto; font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.02; letter-spacing: -.045em; font-weight: 750; max-width: 12ch; text-wrap: balance; }
.pub-hero-text p { margin: 18px auto 28px; max-width: 42ch; font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--ink-2); }

.pub-search {
    grid-area: search; justify-self: center; position: relative; width: 100%; max-width: 580px;
    display: flex; align-items: center; gap: 11px; height: 58px; padding: 0 16px;
    background: var(--surface); border: 1.5px solid var(--hair); border-radius: 14px;
    box-shadow: var(--shadow); will-change: transform;
}
.pub-search:focus-within { border-color: var(--glass); box-shadow: 0 0 0 4px var(--glass-wash); }
.pub-search-icon { flex: none; font-size: 19px; color: var(--ink-3); }
.pub-search input {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
    font: 400 17px/1 var(--font); color: var(--ink); letter-spacing: -.01em; text-overflow: ellipsis;
}
.pub-search input:focus-visible { outline: none; }
.pub-search input::placeholder { color: var(--ink-3); }
.pub-kbd { display: none; font: 600 12px var(--font); color: var(--ink-3); border: 1px solid var(--hair); border-radius: 6px; padding: 1px 7px; }

.pub-suggest { grid-area: suggest; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.pub-suggest-label { font-size: .9rem; color: var(--ink-2); margin-right: 2px; }
.pub-chip {
    min-height: 40px; padding: 0 13px; border-radius: 10px; cursor: pointer;
    font-size: .9rem; font-weight: 600; background: var(--surface); border: 1px solid var(--hair);
}
.pub-chip:hover { border-color: var(--glass); }
.pub-chip:active { transform: scale(.97); }


.pub-footer { max-width: 1360px; margin: 0 auto; padding: 18px calc(32px + var(--safe-r)) calc(26px + var(--safe-b)) calc(32px + var(--safe-l)); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 32px; border-top: 1px solid var(--hair); }
.pub-footer-note { margin: 0; max-width: 80ch; font-size: .84rem; color: var(--ink-3); }
.pub-credit {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border-radius: 999px;
    border: 1px solid var(--hair); background: var(--surface); font-size: .82rem; color: var(--ink-2); white-space: nowrap;
    transition: border-color .2s, box-shadow .2s;
}
.pub-credit img { width: 22px; height: 22px; }
.pub-credit b { font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.pub-credit:hover { border-color: #F37021; box-shadow: 0 0 0 3px rgba(243, 112, 33, .12); }

/* ---------- header while searching ---------- */

.pub-searching .pub-header {
    position: sticky; top: 0; max-width: none; min-height: 0; margin: 0;
    grid-template-columns: auto 1fr auto; grid-template-areas: "logo . login" "search search search";
    row-gap: 10px; column-gap: 14px; align-content: center;
    padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 10px calc(14px + var(--safe-l));
    background: var(--surface); border-bottom: 1px solid var(--hair);
}
.pub-searching .pub-word { font-size: 19px; }
.pub-searching .pub-mark { width: 23px; height: 23px; }
.pub-searching .pub-login { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.pub-searching .pub-search { max-width: none; height: 46px; border-radius: 12px; background: var(--sunk); border-color: transparent; box-shadow: none; }
.pub-searching .pub-search:focus-within { background: var(--surface); border-color: var(--glass); }
.pub-searching .pub-hero-text, .pub-searching .pub-suggest { display: none; }
.pub:not(.pub-searching) .pub-main { display: none; }

/* ---------- results ---------- */

.pub-main { padding: 12px calc(12px + var(--safe-r)) calc(24px + var(--safe-b)) calc(12px + var(--safe-l)); }
.pub-count { margin: 2px 6px 10px; font-size: .85rem; color: var(--ink-2); }
.pub-count span:first-child { color: var(--ink); font-weight: 600; }
.pub-message { margin: 18px 6px; color: var(--ink-2); }
.pub-message p { margin: 0 0 10px; }
.pub-message-warn { color: var(--amber); }

.pub-page { background: var(--surface); border-radius: 16px; padding: 6px; }
.pub-page + .pub-page, .pub-more + .pub-page { margin-top: 6px; }
.pub-row {
    display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    padding: 11px 12px; border-radius: 11px; cursor: pointer; touch-action: manipulation;
}
.pub-row + .pub-row { margin-top: 2px; }
.pub-row:hover { background: var(--sunk); }
.pub-row:active { transform: scale(.992); }
.pub-row[aria-current="true"] { background: var(--glass-wash); box-shadow: inset 3px 0 0 var(--glass); }
.pub-thumb { width: 46px; height: 46px; border-radius: 9px; background: var(--sunk); display: grid; place-items: center; overflow: hidden; flex: none; }
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; }
/* Photos come on white: in light mode the white melts into the tile, in dark mode they sit on a light tile. */
.pub-thumb.has-img img { mix-blend-mode: multiply; }
.pub .pub-noimg { width: 50%; height: 50%; color: var(--ink-3); opacity: .55; stroke-width: 1.5; }
.pub-row-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pub-row-name { font-weight: 600; font-size: .92rem; line-height: 1.28; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.pub-row-name > span { min-width: 0; }
.pub-row-sub { font-size: .84rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-rx { font-size: .75rem; font-weight: 700; letter-spacing: .02em; color: var(--amber); background: var(--amber-wash); border-radius: 5px; padding: 1px 6px; text-decoration: none; white-space: nowrap; }
.pub-row-end { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.pub-price { font-weight: 700; font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pub-stock { font-size: .82rem; font-weight: 500; white-space: nowrap; }
.pub-stock-many, .pub-stock-some { color: var(--leaf); }
.pub-stock-few, .pub-stock-last { color: var(--amber); }
.pub-stock-none, .pub-stock-unknown { color: var(--ink-3); }

.pub-more { padding: 6px 0 16px; }
.pub-skeleton-row, .pub-skeleton span {
    display: block; height: 68px; border-radius: 14px;
    background: linear-gradient(90deg, var(--sunk) 0%, var(--surface) 50%, var(--sunk) 100%);
    background-size: 200% 100%; animation: pub-shimmer 1.4s ease-in-out infinite;
}
.pub-skeleton { display: grid; gap: 12px; padding: 22px; }
.pub-skeleton span { height: 110px; }
.pub-skeleton span:first-child { height: 64px; width: 60%; }
@keyframes pub-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.pub-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--hair); border-top-color: var(--glass); border-radius: 50%; animation: pub-spin .8s linear infinite; vertical-align: -2px; }
@keyframes pub-spin { to { transform: rotate(360deg); } }

/* ---------- product ---------- */

.pub-panel-content { position: relative; }
.pub-panel-content.is-entering > * { animation: pub-enter .22s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pub-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pub-panel-content.is-loading > :not(.pub-skeleton) { opacity: .35; transition: opacity .15s; }
.pub-panel-empty { min-height: 50vh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 40px; text-align: center; color: var(--ink-2); }
.pub-panel-empty svg { font-size: 44px; color: var(--glass); opacity: .6; }
.pub-grab { display: none; }

.pub-detail { background: var(--surface); border-radius: 20px; padding: 24px 26px 26px; }
.pub-detail-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 20px; align-items: start; }
.pub-detail-head > .pub-close { grid-column: -2; grid-row: 1; }
.pub-thumb-lg { width: 96px; height: 96px; border-radius: 14px; }
.pub-detail-title { min-width: 0; }
.pub-detail h2:focus { outline: none; }
.pub-detail-title h2, .pub-detail-head > h2 { margin: 2px 0 4px; font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.15; letter-spacing: -.025em; font-weight: 700; }
.pub-maker { margin: 0; font-size: .95rem; color: var(--ink-2); }
.pub-maker b { color: var(--ink); font-weight: 650; }
.pub-maker .pub-rx { margin-left: 10px; vertical-align: 1px; }
.pub-close { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--hair); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); cursor: pointer; font-size: 16px; position: relative; }
.pub-close::after { content: ""; position: absolute; inset: -6px; }
.pub-close:hover { border-color: var(--glass); color: var(--ink); }

.pub-statement { margin: 24px 0 0; }
.pub-big { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.pub-big em { font-style: normal; color: var(--glass); font-variant-numeric: tabular-nums; }
.pub-big-none { font-size: clamp(1.25rem, 2.4vw, 1.6rem); color: var(--ink-2); }
.pub-statement-sub { margin: 8px 0 0; color: var(--ink-2); font-size: .95rem; }
.pub-in-city b { color: var(--ink); font-weight: 650; }

.pub-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 22px 0 6px; }
.pub-mapbtn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; margin-left: auto; border-radius: 11px; border: 1.5px solid var(--hair); background: var(--surface); color: var(--glass-deep); font-size: .92rem; font-weight: 650; cursor: pointer; }
.pub-mapbtn:hover { border-color: var(--glass); }
.pub-mapbtn svg { font-size: 17px; }
.pub-mapbtn.is-on { background: var(--glass); border-color: var(--glass); color: var(--glass-ink); }
.pub-select { position: relative; display: inline-flex; }
.pub-select select {
    appearance: none; -webkit-appearance: none; height: 44px; padding: 0 38px 0 14px; border-radius: 11px;
    border: 1.5px solid transparent; background: var(--sunk); font-weight: 600; font-size: .9rem; cursor: pointer;
}
.pub-select select:hover { border-color: var(--hair); }
.pub-select::after { content: ""; position: absolute; right: 15px; top: 17px; width: 7px; height: 7px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.pub-seg-group { display: inline-flex; background: var(--sunk); border-radius: 11px; padding: 3px; gap: 2px; }
.pub-sort .pub-seg { padding: 0 16px; font-size: .92rem; }
.pub-seg { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.pub-seg:hover { color: var(--ink); }
.pub-seg.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(8, 30, 26, .12), 0 0 0 1px var(--hair); }
.pub-seg.is-on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--glass); }
.pub-seg.is-busy { opacity: .6; cursor: progress; }
.pub-near-note { flex-basis: 100%; margin: 0; font-size: .82rem; color: var(--amber); }

.pub-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .92rem; }
.pub-table th { text-align: left; font-size: .84rem; font-weight: 600; color: var(--ink-3); padding: 10px 12px; border-bottom: 1.5px solid var(--hair); }
.pub-table td { padding: 13px 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.pub-table .pub-num { text-align: right; white-space: nowrap; }
.pub-ph:hover td { background: var(--sunk); }
.pub-ph-name b { display: block; font-weight: 650; }
.pub-ph-name small { display: block; color: var(--ink-3); font-size: .84rem; }
.pub-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.pub-tags:not(:empty) { margin-top: 5px; }
.pub-tag { font-size: .8rem; font-weight: 650; line-height: 1; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.pub-tag-near { color: var(--glass-ink); background: var(--glass); }
.pub-tag-cheap { color: var(--glass-deep); background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--glass) 45%, transparent); }
.pub-tag-last { color: var(--amber); background: var(--amber-wash); }
.pub-ph.is-nearest td { background: var(--glass-wash); }
.pub-ph.is-nearest td:first-child { box-shadow: inset 3px 0 0 var(--glass); }
.pub-ph-hours { display: block; font-size: .82rem; color: var(--ink-3); }
.pub-ph-price b { font-size: .95rem; }
.pub-ph-price small { display: block; color: var(--ink-3); font-size: .82rem; font-weight: 400; }
.pub-ph-dist { font-weight: 650; color: var(--glass); }
.pub-ph-acts { text-align: right; white-space: nowrap; }
.pub-act { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 11px; border-radius: 9px; border: 1.5px solid var(--hair); color: var(--glass); font-size: .85rem; font-weight: 600; position: relative; }
.pub-act + .pub-act { margin-left: 6px; }
.pub-act:hover { border-color: var(--glass); }
.pub-act svg { font-size: 15px; }
.pub-act::after { content: ""; position: absolute; inset: -5px; }
.pub-col-dist:empty, .pub-table:not(.has-distance) .pub-col-dist { display: none; }

.pub-mapwrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 460px; margin-top: 12px; border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; }
.pub-map { height: 100%; background: var(--sunk); }
.pub-maplist { list-style: none; margin: 0; padding: 0; overflow: auto; background: var(--surface); border-left: 1px solid var(--hair); }
.pub-maplist li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 2px 10px; padding: 11px 14px; border-bottom: 1px solid var(--hair); cursor: pointer; font-size: .9rem; }
.pub-maplist li:hover { background: var(--sunk); }
.pub-maplist li:focus-visible { outline-offset: -3px; }
.pub-maplist li.is-on { background: var(--glass-wash); }
.pub-maplist i { font-style: normal; width: 24px; height: 24px; border-radius: 7px; background: var(--sunk); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--ink-2); grid-row: span 2; }
.pub-maplist li.is-on i { background: var(--glass); color: var(--glass-ink); }
.pub-maplist small { color: var(--ink-3); font-size: .84rem; grid-column: 2; }
.pub-maplist .pub-ml-r { text-align: right; font-weight: 650; }
.pub-maplist .pub-ml-d { text-align: right; color: var(--glass); font-weight: 650; font-size: .8rem; }
.pub-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: #0A6E62; border: 2.5px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); display: grid; place-items: center; }
.pub-pin span { transform: rotate(45deg); color: #fff; font: 800 12px var(--font); }
.pub-pin.is-on { background: #075248; width: 36px; height: 36px; }
.pub-pin.is-last { background: #9A5208; }
.pub-me { width: 16px; height: 16px; border-radius: 50%; background: #1A73E8; border: 3px solid #fff; box-shadow: 0 0 0 7px rgba(26, 115, 232, .18); }

.pub-btn { min-height: 44px; padding: 0 16px; border: 0; border-radius: 11px; background: var(--glass); color: var(--glass-ink); font-weight: 600; cursor: pointer; }

.pub-alt { margin-top: 18px; background: var(--glass-wash); border-radius: 20px; padding: 22px 24px; }
.pub-alt-head { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 14px; }
.pub .pub-alt-icon { width: 46px; height: 46px; padding: 9px; border-radius: 13px; background: var(--surface); color: var(--glass); stroke-width: 2.2; }
.pub-alt-head h3 { margin: 2px 0 4px; font-size: 1.2rem; letter-spacing: -.02em; }
.pub-alt-head p { margin: 0; color: var(--ink-2); font-size: .9rem; max-width: 70ch; }
.pub-alt-head p b { color: var(--ink); font-weight: 600; }
.pub-alt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pub-alt-item { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid transparent; cursor: pointer; }
.pub-alt-item:hover { border-color: var(--glass); }
.pub-alt-name { font-weight: 650; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.pub-alt-sub { font-size: .84rem; color: var(--ink-3); }
.pub-alt-foot { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin-top: 4px; }
.pub-alt-price { font-size: 1rem; font-variant-numeric: tabular-nums; }
.pub-alt-save { font-size: .84rem; font-weight: 650; color: var(--leaf); }

/* ---------- loading: a progress line, the mark tracing its outline, the shape of what comes ---------- */

.pub-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; opacity: 0; transition: opacity .2s; pointer-events: none; }
.pub-progress::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--glass) 30%, var(--glass) 70%, transparent); animation: pub-progress 1.15s cubic-bezier(.45, .05, .35, 1) infinite; }
.pub-busy .pub-progress { opacity: 1; }
@keyframes pub-progress { 0% { left: -40%; } 100% { left: 100%; } }
#pub-results { transition: opacity .2s; }
.pub-count-loading { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.pub .pub-count-loading .pub-loading-mark { width: 18px; height: 18px; }
.pub-ghost-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 64px; gap: 12px; align-items: center; padding: 11px 12px; }
.pub-ghost-row i { display: block; height: 11px; border-radius: 6px; background: linear-gradient(90deg, var(--sunk) 0%, var(--page) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: pub-shimmer 1.6s ease-in-out infinite; }
.pub-ghost-row .g-thumb { width: 46px; height: 46px; border-radius: 9px; }
.pub-ghost-row .g-text, .pub-ghost-row .g-end { display: grid; gap: 8px; }
.pub-ghost-row .g-text i:first-child { height: 13px; width: 78%; }
.pub-ghost-row .g-text i:last-child { width: 42%; }
.pub-ghost-row .g-end { justify-items: end; }
.pub-ghost-row .g-end i:first-child { width: 100%; }
.pub-ghost-row .g-end i:last-child { width: 70%; }
.pub-ghost-row:nth-child(2n) .g-text i:first-child { width: 62%; }
.pub-ghost-row:nth-child(3n) .g-text i:first-child { width: 88%; }
.pub-ghost-row:nth-child(3n) .g-text i:last-child { width: 30%; }
.pub-busy-results #pub-results { opacity: .55; }

.pub-loading { display: grid; justify-items: center; gap: 22px; padding: 34px 26px 30px; background: var(--surface); border-radius: 20px; }
.pub .pub-loading-mark { width: 46px; height: 46px; color: var(--glass); }
.pub-loading-base { fill: none; stroke: var(--glass-wash); stroke-width: 3.2; stroke-linejoin: round; }
.pub-loading-run { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26 74; animation: pub-trace 1.4s cubic-bezier(.5, .1, .4, .9) infinite; }
@keyframes pub-trace { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -100; } }
.pub-loading-ghost { width: 100%; display: grid; gap: 12px; }
.pub-loading-ghost i { display: block; height: 14px; border-radius: 8px; background: linear-gradient(90deg, var(--sunk) 0%, var(--page) 50%, var(--sunk) 100%); background-size: 200% 100%; animation: pub-shimmer 1.6s ease-in-out infinite; }
.pub-loading-ghost .g-title { height: 26px; width: 62%; }
.pub-loading-ghost .g-line { width: 38%; }
.pub-loading-ghost .g-big { height: 34px; width: 48%; margin-top: 10px; }
.pub-loading-ghost .g-box { height: 64px; margin: 4px 0 6px; border-radius: 14px; }
.pub-loading-ghost .g-row { height: 40px; }
.pub-loading-inline { background: none; padding: 26px 0 10px; }
@media (prefers-reduced-motion: reduce) {
    .pub-loading-run { animation: none; stroke-dasharray: none; }
    .pub-progress::before { animation: none; left: 0; width: 100%; opacity: .5; }
}

/* ---------- pharmacies as cards: phones, and panels too narrow for six columns ---------- */

@media (max-width: 1180px) {
    .pub-table thead { display: none; }
    .pub-table, .pub-table tbody { display: block; }
    .pub-table tr.pub-ph { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name price" "addr dist" "acts acts"; gap: 1px 12px; padding: 12px 4px; border-bottom: 1px solid var(--hair); }
    .pub-table td { display: block; padding: 0; border: 0; }
    .pub-ph:hover td { background: none; }
    .pub-table tr.pub-ph.is-nearest { background: var(--glass-wash); box-shadow: inset 3px 0 0 var(--glass); border-radius: 10px; padding: 12px 10px 12px 14px; }
    .pub-ph.is-nearest td, .pub-ph.is-nearest td:first-child { background: none; box-shadow: none; }
    .pub-ph-name { grid-area: name; } .pub-ph-name small { display: none; }
    .pub-ph-addr { grid-area: addr; font-size: .86rem; color: var(--ink-3); }
    .pub-ph-price { grid-area: price; }
    .pub-table td.pub-col-dist { grid-area: dist; display: block; }
    .pub-ph-acts { grid-area: acts; margin-top: 6px; }
}

/* ---------- phone and tablet: bottom sheet ---------- */

@media (max-width: 959px) {
    .pub-header { grid-template-columns: 1fr auto; grid-template-areas: "logo login" "hero hero" "search search" "suggest suggest"; min-height: 0; padding-left: calc(18px + var(--safe-l)); padding-right: calc(18px + var(--safe-r)); }
    .pub-hero-text { margin-top: 9vh; }
    .pub-footer { padding-left: calc(18px + var(--safe-l)); padding-right: calc(18px + var(--safe-r)); }
    .pub-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
        top: calc(var(--safe-t) + 12px); max-width: 640px; margin: 0 auto;
        background: var(--page); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg);
        transform: translate3d(0, 110%, 0); visibility: hidden;
        display: flex; flex-direction: column; will-change: transform;
    }
    .pub-sheet-open .pub-panel { visibility: visible; }
    .pub-grab { display: block; flex: none; padding: 8px 0 4px; touch-action: none; cursor: grab; }
    .pub-grab span { display: block; width: 38px; height: 5px; border-radius: 3px; margin: 0 auto; background: var(--ink-3); opacity: .45; }
    .pub-panel-content { flex: 1; min-height: 0; overflow: hidden; overscroll-behavior: contain; padding: 0 10px calc(14px + var(--safe-b)); }
    /* Until the sheet is at full height, a finger on its content moves the sheet, not a scroll. */
    .pub-panel-content:not(.is-scrollable) { touch-action: none; }
    .pub-panel-content.is-scrollable { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .pub-detail { padding: 18px 16px 18px; border-radius: 18px; }
    .pub-detail-head { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; touch-action: none; -webkit-user-select: none; user-select: none; }
    .pub-detail-head .pub-thumb-lg { display: none; }
    .pub-grab { -webkit-user-select: none; user-select: none; }
    .pub-panel img { -webkit-user-drag: none; }
    .pub-scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); opacity: 0; touch-action: none; }
    .pub-sheet-open { overflow: hidden; }
    .pub-panel-empty { display: none; }


    .pub-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
    .pub-select { grid-column: 1 / -1; }
    .pub-select, .pub-select select { width: 100%; }
    .pub-sort { width: 100%; }
    .pub-sort .pub-seg { flex: 1; justify-content: center; padding: 0 6px; height: 42px; }
    .pub-mapbtn { grid-column: 1 / -1; justify-content: center; margin-left: 0; height: 48px; }
    .pub-sort + .pub-mapbtn { grid-column: auto; }

    .pub-act { min-height: 40px; padding: 0 12px; font-size: .86rem; }

    .pub-mapwrap { grid-template-columns: 1fr; height: auto; }
    .pub-map { height: 52vh; }
    .pub-maplist { border-left: 0; border-top: 1px solid var(--hair); max-height: none; }
    .pub-alt { padding: 16px; border-radius: 18px; }
    .pub-alt-head { grid-template-columns: 1fr; }
    .pub .pub-alt-icon { display: none; }
}

@media (max-width: 480px) {
    .pub-row { grid-template-columns: 46px minmax(0, 1fr) minmax(0, max-content); }
    .pub-price { white-space: normal; max-width: 8.5em; line-height: 1.25; }
}

/* ---------- PC: two columns ---------- */

@media (min-width: 960px) {
    :root { --header-h: 72px; }
    .pub-searching .pub-header { height: var(--header-h); grid-template-columns: auto minmax(0, 600px) 1fr auto; grid-template-areas: "logo search . login"; row-gap: 0; column-gap: 28px; padding-left: max(28px, calc((100vw - 1360px) / 2 + 32px)); padding-right: max(28px, calc((100vw - 1360px) / 2 + 32px)); }
    .pub-searching .pub-search { height: 46px; }
    .pub-kbd { display: inline-block; }
    .pub-searching .pub-main {
        display: grid; grid-template-columns: 368px minmax(0, 1fr); gap: 24px; align-items: start;
        max-width: 1360px; margin: 0 auto; padding: 22px 32px 32px;
    }
    .pub-list-col { position: sticky; top: calc(var(--header-h) + 22px); max-height: calc(100dvh - var(--header-h) - 44px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
    .pub-panel { min-width: 0; }
    .pub-scrim { display: none !important; }
    .pub-panel-empty { background: var(--surface); border-radius: 20px; }
}

/* ---------- user preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
    .pub-panel-content.is-entering > * { animation: pub-fade .2s ease both !important; }
    @keyframes pub-fade { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-contrast: more) {
    :root { --hair: rgba(14, 38, 34, .35); --ink-2: #33433F; --ink-3: #4C625D; }
}
