:root {
  --bg: #f6f7f5; --card: #fff; --ink: #1c2321; --muted: #66706c; --line: #e3e7e4;
  --brand: #0f766e; --brand-d: #0b5a54; --brand-l: #e6f4f2; --accent: #f59e0b; --danger: #c2410c;
  --radius: 12px; --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* topbar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 19px; color: var(--ink); font-weight: 500; }
.logo b { color: var(--brand); }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar nav .nav-find { color: var(--ink); font-weight: 500; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { border-color: #c9d0cc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-l); border-color: var(--brand); }
textarea { resize: vertical; min-height: 140px; }
label { display: block; font-weight: 500; font-size: 14px; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; }
.star { color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.hint.bad { color: #c0392b; font-weight: 500; }

/* hero search */
.hero { background: linear-gradient(135deg, #0f766e, #115e59 60%, #134e4a); color: #fff; padding: 36px 0 28px; }
.hero h1 { font-size: clamp(24px, 4.2vw, 36px); margin-bottom: 4px; }
.hero p { margin: 0 0 20px; opacity: .85; }
.searchbar { display: grid; grid-template-columns: 1fr; gap: 8px; background: #fff; padding: 8px; border-radius: 14px; box-shadow: 0 8px 30px rgb(0 0 0 / .18); }
.searchbar input, .searchbar select { border: 0; background: var(--bg); color: var(--ink); }
@media (min-width: 760px) { .searchbar { grid-template-columns: 2fr 1fr 1fr auto; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { border: 1px solid rgb(255 255 255 / .35); color: #fff; background: transparent; padding: 5px 12px; border-radius: 99px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on, .chip:hover { background: #fff; color: var(--brand-d); }

/* results layout */
.results { display: grid; gap: 20px; padding-top: 20px; padding-bottom: 40px; }
@media (min-width: 960px) { .results { grid-template-columns: 260px 1fr; align-items: start; } }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 14px; }
@media (min-width: 960px) { .filters { position: sticky; top: 76px; } }
@media (max-width: 959px) { .filters { display: none; } .filters.open { display: grid; } }
.filters h3 { font-size: 15px; margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); padding: 5px 10px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.checks input { width: auto; margin: 0; accent-color: var(--brand); }
.checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.toolbar select { width: auto; }
.toolbar .count { font-weight: 600; }
.filter-toggle { display: inline-flex; }
@media (min-width: 960px) { .filter-toggle { display: none; } }

/* cards */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: inherit; display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.thumb { aspect-ratio: 4 / 3; position: relative; background: var(--brand-l); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; left: 10px; top: 10px; }
.thumb .nphoto { position: absolute; right: 10px; bottom: 10px; background: rgb(0 0 0 / .55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--brand); background: var(--brand-l); }
.ph svg { width: 34%; height: auto; opacity: .55; }
.ph.t-room { background: #fef3c7; color: #b45309; } .ph.t-house { background: #e0e7ff; color: #4338ca; }
.ph.t-studio { background: #fce7f3; color: #be185d; } .ph.t-shop { background: #ffedd5; color: #c2410c; } .ph.t-office { background: #e0f2fe; color: #0369a1; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #fff; color: var(--ink); }
.badge.rented { background: #475569; color: #fff; }
.badge.hidden-b { background: #fde68a; }
.card-body { padding: 12px 14px 14px; display: grid; gap: 6px; }
.card .price { color: var(--danger); font-weight: 700; font-size: 17px; }
.card .price small { font-weight: 500; color: var(--muted); font-size: 13px; }
.card h3 { font-size: 15px; font-weight: 600; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.specs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.loc { font-size: 13px; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pager button { min-width: 40px; }
.pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; padding: 50px 20px; background: var(--card); border-radius: var(--radius); }

/* detail */
.crumbs { font-size: 13px; color: var(--muted); padding: 16px 0 8px; }
.crumbs a { color: var(--muted); }
.detail { display: grid; gap: 20px; padding-bottom: 40px; }
@media (min-width: 960px) { .detail { grid-template-columns: 1fr 340px; align-items: start; } }
.gallery { border-radius: var(--radius); overflow: hidden; background: #000; position: relative; }
.gallery .main { aspect-ratio: 16 / 10; display: grid; place-items: center; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.gallery .ph { aspect-ratio: 16 / 10; }
.gallery .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgb(255 255 255 / .9); border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.gallery .prev { left: 10px; } .gallery .next { right: 10px; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.thumbs img { width: 76px; height: 56px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .6; flex: none; }
.thumbs img.on { opacity: 1; outline: 2px solid var(--brand); }
.panel { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.d-title { font-size: clamp(20px, 3vw, 26px); }
.d-price { font-size: 26px; font-weight: 700; color: var(--danger); }
.d-price small { font-size: 15px; color: var(--muted); font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 16px 0 0; }
.fact { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.fact span { display: block; font-size: 12px; color: var(--muted); }
.fact b { font-weight: 600; }
.amen { display: flex; flex-wrap: wrap; gap: 8px; }
.amen span { background: var(--brand-l); color: var(--brand-d); padding: 5px 12px; border-radius: 99px; font-size: 13px; }
.desc { white-space: pre-line; }
.contact { display: grid; gap: 10px; }
@media (min-width: 960px) { .contact-col { position: sticky; top: 76px; } }
.owner { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.phone-big { font-size: 20px; letter-spacing: .5px; }
.warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 13px; }
.mobile-cta { display: none; }
@media (max-width: 959px) {
  .mobile-cta { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 15; }
  .mobile-cta .btn { flex: 1; }
  body.has-cta { padding-bottom: 72px; }
}

/* form */
.form-page { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
.form-page > h1 { font-size: 26px; }
.fs { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; display: grid; gap: 14px; }
.fs h2 { font-size: 17px; margin: 0; }
.cols { display: grid; gap: 14px; }
@media (min-width: 640px) { .cols { grid-template-columns: 1fr 1fr; } .cols.c3 { grid-template-columns: 1fr 1fr 1fr; } }
.typepick { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; }
.typepick label { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.typepick input { width: auto; margin: 0; accent-color: var(--brand); }
.typepick label:has(input:checked) { border-color: var(--brand); background: var(--brand-l); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo .cover { position: absolute; left: 6px; top: 6px; background: var(--brand); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; }
.photo .acts { position: absolute; right: 4px; top: 4px; display: flex; gap: 4px; }
.photo .acts button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.addphoto { aspect-ratio: 1; border: 2px dashed #c9d0cc; border-radius: 10px; display: grid; place-items: center; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; padding: 8px; }
.addphoto:hover { border-color: var(--brand); color: var(--brand); }
.hp { position: absolute; left: -9999px; }
.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 10px; }
.success { text-align: center; }
.success .big { font-size: 44px; }
.manage-link { display: flex; gap: 8px; margin: 14px 0; }
.manage-link input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.status-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mine { display: grid; gap: 8px; }
.mine a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px; color: var(--ink); }

.foot { border-top: 1px solid var(--line); background: #fff; padding: 22px 0; font-size: 14px; }
.foot p { margin: 4px 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #1c2321; color: #fff; padding: 10px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* modal */
.modal { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal-head { position: sticky; top: 0; background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); z-index: 1; }
#modal-body { padding: 16px; }
.sm { font-size: 13px; }

/* hợp đồng */
.contract { font-family: "Times New Roman", Times, serif; font-size: 16px; line-height: 1.6; color: #111; }
.contract p { margin: 0 0 4px; white-space: pre-wrap; }
@media (min-width: 700px) { .contract p { text-align: justify; } }
.contract .nation { text-align: center; font-weight: 700; margin: 0; }
.contract h2 { text-align: center; font-size: 21px; margin: 18px 0 10px; }
.contract h3 { font-size: 16px; margin: 14px 0 4px; }
.contract .gap { height: 8px; }
.contract-page { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.paper { background: #fff; padding: clamp(20px, 5vw, 56px); border-radius: 4px; box-shadow: var(--shadow); }
.contract-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.contract-box > div { flex: 1 1 260px; }
@media print {
  .topbar, .foot, .no-print, .mobile-cta, #toast { display: none !important; }
  body { background: #fff; }
  .paper { box-shadow: none; padding: 0; }
  .contract-page { padding: 0; max-width: none; }
}

/* chọn cách liên hệ / mẫu hợp đồng trong form */
.modepick, .contract-pick { display: grid; gap: 8px; }
@media (min-width: 640px) { .modepick { grid-template-columns: 1fr 1fr; } }
.modepick label, .contract-pick label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; font-weight: 400; }
.modepick input, .contract-pick input { width: auto; margin: 3px 0 0; accent-color: var(--brand); }
.modepick label:has(input:checked), .contract-pick label:has(input:checked) { border-color: var(--brand); background: var(--brand-l); }
.modepick span, .contract-pick span { display: grid; gap: 2px; }
.modepick small, .contract-pick small { color: var(--muted); font-size: 13px; }
.contract-pick .linkbtn { justify-self: start; color: var(--brand); }

/* người thuê gửi yêu cầu */
.inq { display: grid; gap: 10px; }
.inq-note { margin: 0; font-size: 13px; background: var(--brand-l); color: var(--brand-d); padding: 8px 10px; border-radius: 8px; }
.inq .checks label { font-size: 12.5px; }
.inq-done { text-align: center; padding: 10px 0; }
.inq-list { display: grid; gap: 12px; }
.inq-item { gap: 10px; border-left: 4px solid var(--accent); }
.inq-item[data-status="contacted"] { border-left-color: var(--brand); }
.inq-item[data-status="closed"] { border-left-color: var(--line); opacity: .75; }
.inq-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.inq-top select { width: auto; }
.inq-item .phone-big { font-size: 18px; }

/* admin */
.admin-main { padding-top: 20px; padding-bottom: 40px; }
.topbar nav a.on { color: var(--brand); font-weight: 600; }
.login { max-width: 380px; margin: 40px auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stats div { background: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.stats b { display: block; font-size: 22px; }
.stats span { font-size: 13px; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
label.inline input { width: auto; margin: 0; accent-color: var(--brand); }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; background: #fafbfa; }
.tbl select { width: auto; padding: 5px 8px; font-size: 13px; }
.danger-t { color: var(--danger); }
.clist { display: grid; gap: 10px; }
.crow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 0; }
.chip-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; min-height: 400px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
@media (max-width: 700px) { .admin .topbar nav { gap: 10px; font-size: 13px; } .admin .logo span { display: none; } }
.tbl td:nth-child(2) { min-width: 260px; }

/* khu vực chủ nhà */
.owner-page { max-width: 920px; margin: 0 auto; padding: 0 16px 48px; }
.subnav { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px; background: #fff; }
.subnav a { padding: 12px 12px; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.subnav a.on { color: var(--brand); border-bottom-color: var(--brand); }
.owner-page .toolbar { margin: 18px 0 14px; }
.auth { max-width: 440px; margin: 0 auto; padding: 28px 16px 48px; }
.auth-intro h1 { font-size: 24px; }
.auth-intro p { color: var(--muted); margin-top: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 10px; padding: 4px; }
.tabs button { border: 0; background: none; padding: 9px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.grid-form { display: grid; gap: 12px; }
.narrow { max-width: 520px; }
.otp { font-size: 24px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.pill.on { background: #dcfce7; color: #15803d; }
.pill.off { background: #f1f5f9; color: #475569; }
.pill.hidden-p { background: #fde68a; color: #92400e; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.switch input:checked + span { background: #16a34a; }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.olist { display: grid; gap: 12px; }
.ocard { display: grid; grid-template-columns: 120px 1fr; gap: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
@media (min-width: 640px) { .ocard { grid-template-columns: 180px 1fr; } }
.othumb { aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--brand-l); align-self: start; }
.othumb img { width: 100%; height: 100%; object-fit: cover; }
.obody { display: grid; gap: 6px; min-width: 0; }
.otop { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.otitle { color: var(--ink); font-weight: 600; }
.due { font-size: 13px; background: #fff7ed; color: #9a3412; padding: 6px 10px; border-radius: 8px; }
.block-link { display: block; margin-bottom: 14px; color: #9a3412; }
.danger-zone { margin-top: 24px; border: 1px solid #fecaca; box-shadow: none; }
.pick-group { font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 6px; }
.verified { color: #15803d; font-weight: 600; }
.owner-page .crumbs { padding-top: 14px; }

/* chat */
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font: 600 11px/18px system-ui, sans-serif; text-align: center; font-style: normal; vertical-align: 1px; }
.chat-page { max-width: 760px; padding-bottom: 32px; }
.chat { display: flex; flex-direction: column; height: min(72vh, 680px); min-height: 420px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-listing { display: flex; gap: 10px; align-items: center; color: var(--ink); min-width: 0; flex: 1; }
.chat-listing img, .chat-listing .ph, .citem img, .citem .ph { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; }
.chat-listing .ph svg, .citem .ph svg { width: 28px; height: 28px; }
.chat-listing span, .citem > span { display: flex; flex-direction: column; min-width: 0; }
.chat-listing small, .citem small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.chat-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1px 10px; margin: 8px 0 2px; }
.chat-empty { align-self: center; margin: auto; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.them { align-self: flex-start; }
.bubble { padding: 8px 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--brand); border-color: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .bubble { border-bottom-left-radius: 4px; }
.msg time { font-size: 11px; color: var(--muted); margin: 1px 6px 0; }
.chat-send { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-send textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 20px; font: inherit; }
.chat-send .btn { border-radius: 20px; }
.chat-closed { margin: 0; padding: 12px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
.clist { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.citem { display: flex; gap: 12px; padding: 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.citem:last-child { border-bottom: 0; }
.citem:hover { background: var(--brand-l); }
.citem.unread b { color: var(--brand-d); }
@media (max-width: 700px) { .chat { height: calc(100dvh - 190px); min-height: 360px; } .msg { max-width: 88%; } }
.topbar nav a { white-space: nowrap; }
@media (max-width: 480px) { .topbar nav { gap: 10px; } .topbar nav a.nav-find[href="/"] { display: none; } }
.citem .ctop, .chat-listing .ctop { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
