:root {
  --bg: #faf9f6;
  --surface: #f1efea;
  --text: #1c1c1a;
  --muted: #6f6d67;
  --line: #e6e3dc;
  --accent: #2f5d46;
  --danger: #a33a2c;
  --serif: "Fraunces", Georgia, "Times New Roman", "Noto Sans Malayalam", serif;
  --sans: "Inter", "Noto Sans Malayalam", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0.3em 0 0.4em; }
small { font-weight: 400; color: var(--muted); font-size: 0.85em; }
.muted { color: var(--muted); font-size: 0.9rem; }
[hidden] { display: none !important; }

/* Header and footer */
.demo-banner {
  text-align: center; padding: 8px 16px; font-size: 0.8rem; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1100px; margin: 0 auto; padding: 22px 20px;
}
.logo { font-family: var(--serif); font-size: 1.3rem; text-decoration: none; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
nav { display: flex; align-items: center; gap: 22px; font-size: 0.9rem; }
nav a { white-space: nowrap; }
nav a:not(.btn) { text-decoration: none; color: var(--muted); }
nav a:not(.btn):hover { color: var(--text); }
@media (max-width: 480px) {
  .site-header { padding: 16px; }
  .logo { font-size: 1.05rem; }
  nav { gap: 14px; font-size: 0.85rem; }
  .wide-only { display: none; }
}
main { max-width: 1100px; margin: 0 auto; padding: 8px 20px 48px; min-height: 70vh; }
@media (max-width: 480px) { main { padding: 8px 16px 40px; } }
.site-footer {
  max-width: 1100px; margin: 0 auto; padding: 28px 20px 40px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8rem;
}

/* Buttons */
.btn {
  display: inline-block; border: 1px solid var(--text); border-radius: 999px; padding: 11px 22px;
  background: var(--text); color: var(--bg); font: inherit; font-size: 0.9rem; font-weight: 500;
  text-decoration: none; cursor: pointer; text-align: center; transition: opacity 0.15s, background 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn-small { padding: 7px 16px; font-size: 0.85rem; }
.btn-outline { background: transparent; color: var(--text); }
.btn-outline:hover { background: var(--surface); opacity: 1; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #f7ebe8; opacity: 1; }

/* Home */
.hero { padding: 36px 0 28px; max-width: 640px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.08; margin: 0 0 14px; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 32px;
  padding-bottom: 28px; border-bottom: 1px solid var(--line);
}
.filters input[type=search] { grid-column: 1 / -1; }
.filters .btn { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
  .filters input[type=search], .filters .btn { grid-column: auto; }
}

input, select, textarea {
  width: 100%; font: inherit; font-size: 0.95rem; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--text); appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236f6d67' stroke-width='1.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); }
input[type=radio] { appearance: auto; width: auto; accent-color: var(--text); }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 16px; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 40px 24px; } }
.card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.card-photo { position: relative; aspect-ratio: 1 / 1; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.card:hover .card-photo img { transform: scale(1.03); }
.card-body { padding: 12px 2px 0; }
.card-title {
  font-family: var(--serif); font-size: 1.08rem; line-height: 1.3; margin: 4px 0 6px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card:hover .card-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.eyebrow { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.price { font-size: 0.95rem; }
.price.big { font-family: var(--serif); font-size: 1.6rem; margin-bottom: 4px; }
.no-photo {
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 2.6rem; filter: grayscale(1); opacity: 0.35;
}
.no-photo.big { aspect-ratio: 4 / 3; font-size: 4rem; background: var(--surface); border-radius: var(--radius); }
.sold-label {
  position: absolute; top: 10px; left: 10px; background: var(--bg); color: var(--text);
  font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
}
.tags { display: flex; gap: 14px; flex-wrap: wrap; }
.sold-text { color: var(--danger); }

.empty { grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty a { color: var(--text); }
.error { color: var(--danger); }
.notice { background: var(--surface); color: var(--text); padding: 12px 14px; border-radius: var(--radius); font-size: 0.9rem; }

/* Listing detail */
.back { display: inline-block; margin: 4px 0 20px; text-decoration: none; color: var(--muted); font-size: 0.9rem; }
.back:hover { color: var(--text); }
.detail { display: grid; gap: 28px; }
@media (min-width: 760px) { .detail { grid-template-columns: 1.3fr 1fr; gap: 56px; } }
.gallery #main-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--surface); display: block; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; }
.thumbs img { width: 68px; height: 68px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.75; }
.thumbs img:hover { opacity: 1; }
.detail-info h1 { margin-top: 10px; }
.description { white-space: pre-line; margin: 20px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 20px; }
.actions .btn { flex: 1 1 200px; }
.safety { font-size: 0.82rem; color: var(--muted); padding-top: 16px; border-top: 1px solid var(--line); }
.owner-actions { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.owner-actions h3 { width: 100%; margin: 4px 0 6px; font-size: 1.1rem; }

/* Forms */
.form { display: grid; gap: 18px; max-width: 620px; }
.form label { display: grid; gap: 6px; font-weight: 500; font-size: 0.88rem; }
.form label .muted { font-weight: 400; font-size: 0.82rem; }
.row { display: grid; gap: 18px; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }
.kind-choice { border: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.kind-choice label {
  display: flex; align-items: center; gap: 10px; font-weight: 400; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 16px; cursor: pointer;
}
.kind-choice label:has(input:checked) { border-color: var(--text); }
.previews { display: flex; flex-wrap: wrap; gap: 10px; }
.preview { position: relative; }
.preview img { width: 88px; height: 88px; object-fit: cover; border-radius: 4px; display: block; }
.preview button {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; font-size: 0.7rem;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth { max-width: 400px; margin: 24px auto; }
.auth a { color: var(--text); }

/* Deals */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; margin-bottom: 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.85rem; text-decoration: none; color: var(--muted); background: #fff; white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 8px 0 18px; }
.section-head h2 { font-size: 1.5rem; margin: 0; }
.section-head a { font-size: 0.88rem; color: var(--muted); }
#deals-section { margin-bottom: 48px; }
.deal-label {
  position: absolute; top: 10px; right: 10px; background: var(--accent); color: #fff;
  font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
}
.deal-label.inline { position: static; margin-right: 8px; }
.was { color: var(--muted); font-size: 0.85em; margin-left: 4px; }
.ends { font-size: 0.8rem; color: var(--accent); margin-top: 2px; }
.deal-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--accent); font-size: 0.92rem; margin: 6px 0 10px; }
.deal-fields { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fff; }
.deal-fields summary { cursor: pointer; font-weight: 500; font-size: 0.9rem; }
.deal-fields[open] summary { margin-bottom: 14px; }

/* Header extras */
.header-right { display: flex; align-items: center; gap: 22px; min-width: 0; }
.lang-toggle {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 0.8rem; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.lang-toggle:hover { color: var(--text); border-color: var(--text); }
.badge {
  display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 0.72rem; line-height: 18px; text-align: center;
}
@media (max-width: 480px) {
  .site-header { flex-wrap: wrap; gap: 10px; }
  .header-right { gap: 12px; width: 100%; justify-content: space-between; align-items: flex-start; }
  #nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 10px; }
}
html[lang=ml] h1, html[lang=ml] h2, html[lang=ml] .card-title { line-height: 1.45; }
html[lang=ml] .hero h1 { line-height: 1.35; font-size: clamp(1.7rem, 5vw, 2.6rem); }

/* Listing page extras */
.small-actions { display: flex; gap: 18px; flex-wrap: wrap; margin: 4px 0 16px; }
.link-btn {
  border: none; background: none; padding: 0; font: inherit; font-size: 0.88rem; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-btn:hover { color: var(--text); }
.report-form { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; margin-bottom: 16px; }
.report-form h3 { margin: 0; font-size: 1.1rem; }
.row-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.owner-actions p { width: 100%; margin: 0 0 4px; }

/* Form extras */
.checks { display: flex; gap: 10px 22px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=checkbox] { appearance: auto; width: auto; accent-color: var(--text); }

/* Sign in */
.login-btn { display: block; width: 100%; margin-top: 12px; }
.login-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Alerts */
.alerts { display: grid; gap: 12px; max-width: 640px; }
.alert { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.alert.unread { border-color: var(--accent); }
.alert p { margin: 6px 0; }
.alert-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 0.88rem; }

/* Chats */
.chat-list { display: grid; max-width: 680px; border-top: 1px solid var(--line); }
.chat-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.chat-row:hover { background: var(--surface); }
.chat-thumb {
  flex: none; width: 52px; height: 52px; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.chat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.chat-text { display: grid; min-width: 0; flex: 1; }
.chat-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-preview { font-size: 0.9rem; color: var(--muted); }
.chat-row.unread .chat-preview { color: var(--text); font-weight: 600; }
.chat-row.unread strong::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 8px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.chat-time { flex: none; font-size: 0.78rem; }
.chat { max-width: 680px; }
.chat-head h1 { margin-bottom: 2px; }
.chat-head a { font-size: 0.88rem; }
.messages {
  display: flex; flex-direction: column; gap: 8px; margin: 18px 0 10px; padding: 14px;
  max-height: 55vh; min-height: 160px; overflow-y: auto; background: var(--surface); border-radius: var(--radius);
}
.bubble {
  align-self: flex-start; max-width: 80%; padding: 9px 13px 6px; border-radius: 14px 14px 14px 4px;
  background: #fff; border: 1px solid var(--line); white-space: pre-line; overflow-wrap: anywhere;
}
.bubble.mine { align-self: flex-end; background: var(--text); color: var(--bg); border-color: var(--text); border-radius: 14px 14px 4px 14px; }
.bubble a { color: inherit; }
.bubble-time { display: block; font-size: 0.7rem; opacity: 0.6; margin-top: 3px; text-align: right; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; margin: 12px 0 10px; }
.chat-form textarea { flex: 1; resize: vertical; }
.chat .safety { border-top: none; padding-top: 0; }

/* Footer links */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.agree { margin: 0; }
.agree a { color: var(--text); }

/* Admin */
.admin-list { display: grid; gap: 14px; }
.admin-item { display: grid; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.admin-item .description { margin: 4px 0; }
.admin-item p { margin: 0; }
.admin-item .row-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* Terms, privacy and rules pages */
.legal { max-width: 720px; }
.legal h2 { font-size: 1.35rem; margin: 1.6em 0 0.4em; }
.legal li { margin-bottom: 0.35em; }
.legal .updated { color: var(--muted); font-size: 0.85rem; }
.legal .fill { background: #fff3cd; padding: 0 4px; border-radius: 3px; }
