:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #ccfbf1;
  --ink: #0f172a;
  --slate: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --amber: #b45309;
  --red: #b91c1c;
  --radius: 10px;
  --tabs-h: 58px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.4rem; margin: .2rem 0 .8rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); font-size: .9rem; }
.center { text-align: center; }
.link { font-size: .9rem; font-weight: 600; }

/* top bar */
.top { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; max-width: 980px; margin: 0 auto; }
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; letter-spacing: .2px; margin-inline-end: auto; }
.brand b { color: #5eead4; }
.brand:hover { text-decoration: none; }
.country-btn {
  display: flex; align-items: center; gap: .4rem; background: var(--teal); color: #fff;
  border-radius: 999px; padding: .35rem .8rem; font-size: .9rem; font-weight: 600; max-width: 52vw;
}
.country-btn:hover { background: var(--teal-dark); text-decoration: none; }
.cname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { font-size: .7rem; opacity: .8; }
.flag { font-size: 1.15rem; line-height: 1; }
.flag.big { font-size: 2.2rem; }
.lang-select {
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px;
  padding: .35rem .4rem; font-size: .8rem; max-width: 7.5rem;
}
.tabs-top { display: none; max-width: 980px; margin: 0 auto; padding: 0 .9rem; gap: 1.2rem; }
.tabs-top a { color: #cbd5e1; padding: .5rem 0; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs-top a.on { color: #fff; border-color: #5eead4; }
.tabs-top a:hover { text-decoration: none; color: #fff; }
.announce { background: #fef3c7; color: #78350f; text-align: center; padding: .45rem .8rem; font-size: .9rem; }

.wrap { max-width: 980px; margin: 0 auto; padding: .9rem; }
.foot { max-width: 980px; margin: 0 auto; padding: .5rem .9rem 1.2rem; display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); font-size: .85rem; }

/* bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: var(--tabs-h); color: var(--muted); font-size: .72rem; font-weight: 600; gap: 2px;
}
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--teal); }
.tabs a:hover { text-decoration: none; }
.dot {
  font-style: normal; background: #dc2626; color: #fff; border-radius: 999px; font-size: .68rem;
  min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; display: inline-block;
}
.tabs .dot { position: absolute; top: 6px; left: calc(50% + 8px); }

/* hero */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1.2rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.country-card {
  display: flex; align-items: center; gap: .8rem; background: var(--teal-soft); color: var(--ink);
  border: 1px solid #99f6e4; border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .8rem;
}
.country-card strong { flex: 1; font-size: 1.15rem; }
.country-card:hover { text-decoration: none; border-color: var(--teal); }
.searchbar { display: flex; flex-wrap: wrap; gap: .5rem; }
.searchbar input { flex: 1 1 100%; }

/* forms */
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cbd5e1; border-radius: 8px; padding: .55rem .7rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
input:disabled { background: #f1f5f9; color: var(--muted); }
.field { display: block; margin-bottom: .8rem; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--slate); margin-bottom: .25rem; }
.check { display: flex; gap: .5rem; align-items: flex-start; margin: .4rem 0 .8rem; font-size: .9rem; }
.check input { width: auto; margin-top: .25rem; }
.err { display: block; color: var(--red); font-size: .82rem; margin-top: .2rem; }
.search-big { padding: .8rem 1rem; font-size: 1.05rem; margin-bottom: .8rem; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: 1rem; }
.filters input[type=search] { grid-column: 1 / -1; }

.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px; padding: .55rem 1rem;
  font: inherit; font-weight: 600; cursor: pointer; text-align: center; line-height: 1.3;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--slate); border-color: #cbd5e1; }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn.block { display: block; width: 100%; margin-top: .5rem; }
.danger-link { color: var(--red); font-size: .9rem; }

/* panels and cards */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.panel.narrow { max-width: 440px; margin-inline: auto; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin: 1rem 0 .6rem; flex-wrap: wrap; }
.row-head h1, .row-head h2 { margin: 0; }
.list { display: grid; gap: .6rem; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; color: var(--ink); }
.card:hover { border-color: #94a3b8; text-decoration: none; }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .45rem; }
.badge { background: var(--ink); color: #fff; border-radius: 6px; padding: .1rem .5rem; font-size: .75rem; font-weight: 600; }
.badge-soft { background: #e2e8f0; color: var(--slate); }
.badge-money { background: var(--teal-soft); color: var(--teal-dark); }
.ago { margin-inline-start: auto; color: var(--muted); font-size: .78rem; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed #cbd5e1; border-radius: var(--radius); padding: 1.2rem; text-align: center; }
.pcard { padding: 0; overflow: hidden; }
.thumb { aspect-ratio: 4 / 3; background: #e2e8f0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.pbody { padding: .6rem .7rem .7rem; }
.price { color: var(--teal-dark); font-weight: 700; }
.price.lg { font-size: 1.35rem; margin: .1rem 0 .4rem; }
.flash { border-radius: 8px; padding: .6rem .9rem; margin-bottom: .8rem; font-size: .92rem; }
.flash-ok { background: #ccfbf1; color: #134e4a; }
.flash-err { background: #fee2e2; color: #7f1d1d; }
.flash-warn { background: #fef3c7; color: #78350f; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 1rem 0; }
.crumb { margin: 0 0 .5rem; font-size: .9rem; }

/* detail */
.detail { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.gallery { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: .5rem; overflow-x: auto; margin-bottom: .8rem; scroll-snap-type: x mandatory; }
.gallery a { scroll-snap-align: start; }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #e2e8f0; }
.desc { margin: .8rem 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.report { margin-top: 1rem; font-size: .9rem; }
.report summary { cursor: pointer; color: var(--muted); }
.keep { display: inline-block; position: relative; margin: 0 .4rem .6rem 0; }
.keep img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.keep input { position: absolute; top: 4px; left: 4px; width: auto; }

/* countries */
.clist { display: grid; grid-template-columns: 1fr; gap: .35rem; }
.citem { display: flex; align-items: center; gap: .6rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem; color: var(--ink); }
.citem:hover { border-color: var(--teal); text-decoration: none; }
.citem.on { background: var(--teal-soft); border-color: var(--teal); font-weight: 600; }
.citem[hidden] { display: none; }

/* chat */
.conv-top, .conv-last { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.conv-last span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate); font-size: .9rem; }
.chat-head { display: flex; flex-direction: column; margin-bottom: .6rem; }
.chat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; }
.msgs { padding: .8rem; height: 52vh; min-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; }
.msg { max-width: 82%; padding: .45rem .7rem; border-radius: 12px; overflow-wrap: anywhere; font-size: .95rem; }
.msg time { display: block; font-size: .68rem; opacity: .65; margin-top: 2px; }
.msg.mine { align-self: flex-end; background: var(--teal); color: #fff; border-end-end-radius: 3px; }
.msg.theirs { align-self: flex-start; background: #e2e8f0; border-end-start-radius: 3px; }
.chat-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); }

.doc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.doc h2 { margin-top: 1.2rem; }
.doc li { margin-bottom: .3rem; }

@media (min-width: 720px) {
  body { padding-bottom: 0; }
  .tabs { display: none; }
  .tabs-top { display: flex; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .filters input[type=search] { grid-column: auto; flex: 2; }
  .clist { grid-template-columns: repeat(3, 1fr); }
  .searchbar input { flex: 1 1 0; }
  .gallery { grid-auto-columns: 38%; }
}
@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}
