/* Skupo Mini App — see docs/MINI_APP_GUIDELINE.md */

:root, [data-theme="light"] {
  --brand: #FF5A12;
  --brand-deep: #E84500;
  --brand-hot: #FF3D00;
  --brand-amber: #FF9A3C;
  --brand-soft: #FFE3D4;
  --brand-ink: #2A140A;
  --on-brand: #FFFFFF;
  --brand-gradient: linear-gradient(135deg, #FF3D00 0%, #FF5A12 45%, #FF9A3C 100%);

  --bg: #F3F1EF;
  --bg2: #E9E4DF;
  --fg: #1C1410;
  --muted: #6E625A;
  --card: #FFFFFF;
  --line: #E0D8D1;
  --accent: var(--brand);
  --btn: var(--brand);
  --accent-soft: var(--brand-soft);
  --price: #D94600;
  --danger: #C2352A;
  --shadow: 0 8px 28px rgba(42, 20, 10, 0.08);
  --tab-icon-size: 32px;
  --tab-label-h: 11px;
  --tab-gap: 2px;
  --tab-pad-top: 10px;
  --tab-pad-bottom: 10px;
  --tab-h: calc(
    var(--tab-pad-top) + var(--tab-icon-size) + var(--tab-gap) + var(--tab-label-h) + var(--tab-pad-bottom) +
      env(safe-area-inset-bottom, 0px)
  );
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --font-ui: "Onest", "Segoe UI", "PT Root UI", system-ui, sans-serif;
  --font-brand: "Unbounded", "Onest", system-ui, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --brand: #FF7A3D;
  --brand-deep: #FF5A12;
  --brand-hot: #FF4D1A;
  --brand-amber: #FFB06A;
  --brand-soft: #3A2218;
  --brand-ink: #2A140A;
  --on-brand: #FFFFFF;
  --brand-gradient: linear-gradient(135deg, #FF4D1A 0%, #FF7A3D 50%, #FFB06A 100%);

  --bg: #14110F;
  --bg2: #1E1916;
  --fg: #F7F1EA;
  --muted: #A89A90;
  --card: #221C18;
  --line: #342C26;
  --accent: var(--brand);
  --btn: #FF5A12;
  --accent-soft: #3A2218;
  --price: #FF9A5C;
  --danger: #FF8B7A;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #FF7A3D;
    --brand-deep: #FF5A12;
    --brand-hot: #FF4D1A;
    --brand-amber: #FFB06A;
    --brand-soft: #3A2218;
    --brand-ink: #2A140A;
    --on-brand: #FFFFFF;
    --brand-gradient: linear-gradient(135deg, #FF4D1A 0%, #FF7A3D 50%, #FFB06A 100%);

    --bg: #14110F;
    --bg2: #1E1916;
    --fg: #F7F1EA;
    --muted: #A89A90;
    --card: #221C18;
    --line: #342C26;
    --accent: var(--brand);
    --btn: #FF5A12;
    --accent-soft: #3A2218;
    --price: #FF9A5C;
    --danger: #FF8B7A;
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }

.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  background:
    radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--brand-hot) 16%, transparent), transparent 55%),
    radial-gradient(90% 50% at 0% 100%, color-mix(in srgb, var(--brand-amber) 10%, transparent), transparent 50%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px) saturate(1.1);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 12px;
  display: grid;
  gap: 10px;
}
.topbar-row, .search-row { display: flex; align-items: center; gap: 8px; }
.brand-block { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: 0 0 auto;
  background: var(--brand-gradient);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 35%, transparent);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-text { min-width: 0; display: grid; gap: 1px; }
.brand {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.1;
}
.scope { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search:focus {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 18px;
  transition: transform .15s ease, border-color .15s ease;
}
.icon-btn:active { transform: scale(0.96); }
.filter-btn { position: relative; }
.filter-btn.has-active::after {
  content: ""; position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 2px var(--card);
}
.subchips {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.subchips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: var(--radius-pill);
  padding: 8px 12px;
  font-size: 13px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip.active {
  background: var(--btn);
  color: var(--on-brand);
  border-color: transparent;
  font-weight: 700;
}
.chip .count { opacity: 0.75; margin-left: 4px; font-size: 11px; }

.view {
  flex: 1;
  padding: 12px 14px calc(10px + var(--tab-h));
}

.section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 4px 0 12px;
}
.section-title h1, .section-title h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.muted { color: var(--muted); font-size: 13px; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  transition: transform .15s ease;
}
.cat-card:active { transform: scale(0.98); }
.cat-card .icon {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--brand-deep); font-size: 18px;
}
[data-theme="dark"] .cat-card .icon { color: var(--brand); }
.cat-card .title { font-weight: 700; font-size: 15px; }
.cat-card .meta { color: var(--muted); font-size: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  min-height: 100%;
  cursor: pointer;
  transition: transform .15s ease;
}
.card:active { transform: scale(0.98); }
.card .media {
  /* Жёсткий кадр 4:5: padding-hack + aspect-ratio (MAX WebView / кэш) */
  --media-ratio: 125%; /* 5/4 * 100% для 4:5 */
  position: relative;
  width: 100%;
  flex: 0 0 auto;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--brand) 22%, var(--bg2)), var(--bg2));
  color: var(--muted);
  font-size: 13px;
  aspect-ratio: 4 / 5;
  height: auto;
  max-height: none;
}
.card .media::before {
  content: "";
  display: block;
  width: 100%;
  padding-bottom: var(--media-ratio);
  /* если aspect-ratio поддержан — не даём padding раздувать дважды */
  pointer-events: none;
}
@supports (aspect-ratio: 4 / 5) {
  .card .media::before {
    content: none;
    display: none;
    padding-bottom: 0;
  }
}
.card .media.has-photo {
  background: var(--bg2);
}
.card .loc {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  background: rgba(28, 20, 16, .5); color: #fff;
  font-size: 11px; padding: 4px 8px; border-radius: var(--radius-pill);
  backdrop-filter: blur(4px);
}
.card .fav {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.94); color: #3A2A22;
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
  box-shadow: 0 2px 8px rgba(42, 20, 10, .16);
  padding: 0;
  border: 0;
}
.card .fav.on { color: var(--brand-deep); }
[data-theme="dark"] .card .fav { background: rgba(34, 28, 24, .92); color: var(--fg); }
[data-theme="dark"] .card .fav.on { color: var(--brand); }
.card .media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  z-index: 1;
  border: 0;
}
.card .media .ph-empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
  pointer-events: none;
}
.card .media:not(.has-photo) {
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 14%, var(--bg2)), var(--bg2));
}
.card .img-count {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(28, 20, 16, .55); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: var(--radius-pill);
}
.card .body { padding: 10px 10px 12px; display: grid; gap: 4px; }
.card .price { font-weight: 800; color: var(--price); font-size: 15px; }
.card .title {
  font-size: 13px; line-height: 1.3; font-weight: 650;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { font-size: 11px; color: var(--muted); }

.empty, .loading {
  text-align: center; color: var(--muted); padding: 48px 16px;
}
.empty-mark {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--brand-gradient);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand) 30%, transparent);
  overflow: hidden;
}
.empty-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail { display: grid; gap: 14px; }
.detail-hero { position: relative; }
.detail-chrome {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px;
  pointer-events: none;
}
.detail-chrome .chrome-spacer { flex: 1; }
.chrome-btn {
  pointer-events: auto;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #1C1410;
  display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.chrome-btn svg { width: 20px; height: 20px; }
.chrome-btn.on { color: var(--brand-deep); }
body.route-listing .topbar { display: none; }
body.route-listing .view { padding: 0 0 calc(12px + var(--tab-h)); }
body.route-listing .detail { gap: 0; }
body.route-listing .detail-hero .gallery {
  border-radius: 0; border: 0; min-height: 52vh;
}
.detail-body { display: grid; gap: 12px; padding: 14px 14px 8px; }
.gallery {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
  /* Вертикальный кадр: фото целиком, без обрезки; минимум полэкрана по высоте */
  aspect-ratio: 3 / 4;
  min-height: 50vh;
  max-height: 78vh;
  width: 100%;
  touch-action: pan-y;
}
.gallery-track {
  display: flex;
  height: 100%;
  transition: transform .25s ease;
  will-change: transform;
}
.gallery-slide {
  position: relative;
  min-width: 100%; height: 100%;
  display: grid; place-items: center;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--brand) 10%, var(--bg2)), #1a1410);
  overflow: hidden;
}
.gallery-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  cursor: zoom-in;
}
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.92); color: #1C1410;
  display: grid; place-items: center; font-size: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }
.gallery-dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 6px;
}
.gallery-dots i {
  width: 6px; height: 6px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.45);
}
.gallery-dots i.on { background: #fff; width: 16px; }
.gallery-counter {
  position: absolute; top: 10px; right: 10px;
  background: rgba(28, 20, 16, .55); color: #fff;
  font-size: 12px; padding: 4px 8px; border-radius: var(--radius-pill);
}
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(12, 8, 6, .94);
  display: grid; grid-template-rows: auto 1fr auto;
}
.lightbox[hidden] { display: none !important; }
.lightbox-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; color: #fff;
}
.lightbox-stage {
  display: grid; place-items: center; overflow: hidden;
  touch-action: pan-y;
}
.lightbox-stage img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.lightbox-foot {
  display: flex; justify-content: center; gap: 16px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}
.lightbox-foot button {
  width: 48px; height: 48px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,.14); color: #fff; font-size: 22px;
}
.detail h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail .price { font-size: 22px; font-weight: 800; color: var(--price); }
.detail .text { white-space: pre-wrap; color: var(--muted); line-height: 1.45; }
.seller-card {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.seller-ava {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); color: var(--brand-deep);
  display: grid; place-items: center; font-weight: 800; flex: 0 0 auto;
}
.seller-ava img { width: 100%; height: 100%; object-fit: cover; }
.seller-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.seller-online {
  font-size: 12px; font-weight: 650; color: #1a9f4b;
}
.seller-online::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #1a9f4b; margin-right: 4px;
}
.seller-rating { font-size: 13px; font-weight: 650; }
.listing-cta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  position: sticky; bottom: calc(8px + var(--tab-h));
  z-index: 5;
}
.listing-cta .btn:only-child { grid-column: 1 / -1; }
.delivery-row { padding: 4px 0; }
.spec-list { display: grid; gap: 8px; }
.spec-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 14px;
}
.spec-row span { color: var(--muted); }
.spec-row strong { font-weight: 650; text-align: right; }
.listing-stats { display: grid; gap: 4px; font-size: 12px; padding: 4px 2px 12px; }
.similar-wrap h2 { margin: 8px 0; font-size: 16px; }
.actions { display: grid; gap: 8px; }
.btn {
  border-radius: 14px; padding: 14px 16px; font-weight: 700;
  border: 1px solid var(--line); background: var(--card);
  transition: transform .15s ease, filter .15s ease;
}
.btn:active { transform: scale(0.99); }
.btn.primary {
  background: var(--btn);
  color: var(--on-brand);
  border-color: transparent;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 28%, transparent);
}
.btn.primary:active { filter: brightness(0.96); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

.profile, .stack { display: grid; gap: 12px; }
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; display: grid; gap: 10px;
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--bg2); padding: 4px; border-radius: 12px;
}
.seg button {
  padding: 10px 8px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 650; font-size: 13px;
}
.seg button.active {
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.chat-list { display: grid; gap: 8px; }
.chat-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; text-align: left; display: grid; gap: 4px;
  transition: transform .15s ease;
}
.chat-item:active { transform: scale(0.99); }
.chat-item .title { font-weight: 700; }
.thread {
  display: flex; flex-direction: column; gap: 8px; min-height: 50vh;
}
.bubble {
  max-width: 85%; padding: 10px 12px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); font-size: 14px;
}
.bubble.me {
  align-self: flex-end;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--fg);
}
.composer {
  position: sticky; bottom: calc(var(--tab-h) + 8px);
  display: flex; gap: 8px; background: var(--bg); padding-top: 8px;
}
.composer input {
  flex: 1; border: 1px solid var(--line); background: var(--card);
  border-radius: 14px; padding: 12px 14px;
}

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(560px, 100%);
  height: auto;
  min-height: var(--tab-h);
  padding: var(--tab-pad-top) 4px calc(var(--tab-pad-bottom) + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.1);
  z-index: 30;
  box-sizing: border-box;
}
html.miniapp-max {
  --tab-pad-bottom: 8px;
  --tab-h: calc(
    var(--tab-pad-top) + var(--tab-icon-size) + var(--tab-gap) + var(--tab-label-h) + var(--tab-pad-bottom)
  );
}
html.miniapp-max .tabbar {
  padding: var(--tab-pad-top) 0 var(--tab-pad-bottom);
}
.tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--tab-gap);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon {
  width: var(--tab-icon-size);
  height: var(--tab-icon-size);
  min-width: var(--tab-icon-size);
  min-height: var(--tab-icon-size);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.tab-label {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 11px;
  line-height: 11px;
  height: 11px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.tab.active {
  color: var(--brand-deep);
}
[data-theme="dark"] .tab.active { color: var(--brand); }

.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 8, .48); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 85vh; overflow: auto;
  background: var(--bg); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 12px;
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 18px;
  letter-spacing: -0.02em;
}
.text-btn { color: var(--brand-deep); font-weight: 700; }
[data-theme="dark"] .text-btn { color: var(--brand); }
.sheet-body { display: grid; gap: 14px; }
.filter-block h3 {
  margin: 0 0 8px; font-size: 13px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-row input {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 12px; padding: 10px 12px;
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--brand-deep);
  border-radius: var(--radius-pill); padding: 4px 10px; font-size: 12px; font-weight: 700;
}
[data-theme="dark"] .badge { color: var(--brand); }

.detail-block {
  display: grid; gap: 8px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.detail-block h2 { margin: 0; font-size: 15px; }
.contact-list, .source-list { display: grid; gap: 6px; }
.contact-link, .source-link {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  min-height: 40px; padding: 8px 10px; border-radius: 10px;
  color: var(--brand-deep); background: var(--accent-soft);
  overflow-wrap: anywhere;
}
.contact-link strong { text-align: right; }
[data-theme="dark"] .contact-link, [data-theme="dark"] .source-link { color: var(--brand); }

/* Custom modals (never use native alert/confirm/prompt) */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: end center;
}
.modal[hidden] { display: none !important; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(16, 10, 6, 0.55);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 12px;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}
@media (min-width: 520px) {
  .modal { place-items: center; }
  .modal-panel { border-radius: var(--radius-lg); }
}
.modal-panel h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-panel p {
  margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45;
  white-space: pre-wrap;
}
.modal-actions {
  display: grid; gap: 8px; margin-top: 4px;
}
.modal-actions.row {
  grid-template-columns: 1fr 1fr;
}
.modal textarea, .modal input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 14px;
  resize: vertical;
  min-height: 88px;
}
