:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --border: #e3e2de;
  --text: #1d1d1b;
  --muted: #6b6a66;
  /* Brand palette (sharedeals.in logo): pink #EC0276 + navy #010A5E */
  --brand-pink: #ec0276;
  --brand-navy: #010a5e;
  --accent: var(--brand-pink);
  --accent-hover: #cc0266;
  --accent-text: var(--brand-pink);
  --accent-ink: #ffffff;
  --accent-soft: #fde6f0;
  --price: #1a7f37;
  --danger: #c92a2a;
  --danger-soft: #fff0f0;
  --up: var(--brand-pink);
  --down: var(--brand-navy);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 8px rgb(0 0 0 / 0.04);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1e1e1c;
    --surface-2: #272725;
    --border: #353532;
    --text: #ecebe7;
    --muted: #a3a29c;
    --accent: var(--brand-pink);
    --accent-hover: #ff1f8a;
    --accent-text: #ff5aa5;
    --accent-ink: #ffffff;
    --accent-soft: #3b1426;
    --price: #4ccf6d;
    --danger: #ff6b6b;
    --danger-soft: #3a1b1b;
    --up: var(--brand-pink);
    --down: #6b78e6;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { max-width: 1240px; margin: 0 auto; padding: 20px 16px 96px; outline: none; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.logo picture { display: flex; }
.logo img { height: 44px; width: auto; display: block; }
.logo .logo-mark { display: none; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.search::before { content: '⌕'; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 18px; }
.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav a, .nav button.linkish { text-decoration: none; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.nav a:hover, .nav a.active, .nav button.linkish:hover { color: var(--text); background: var(--surface-2); }
.nav a.btn-primary { color: var(--accent-ink); background: var(--accent); padding: 6px 12px; margin: 0 4px; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-weight: 800; font-size: 13px; text-transform: uppercase; flex: none; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  .nav .hide-sm { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 0; }
  .tabbar a .ico { font-size: 20px; line-height: 1.1; }
  .tabbar a.active { color: var(--accent-text); }
  .tabbar a.post .ico { background: var(--accent); color: var(--accent-ink); border-radius: 10px; width: 34px; height: 26px; display: grid; place-items: center; font-size: 18px; }
  .topbar-inner { gap: 10px; }
  .logo .logo-full { display: none; }
  .logo .logo-mark { display: flex; }
  .logo img { height: 36px; }
}

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.nav a.btn-primary:hover, .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.field textarea { min-height: 110px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 16px; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.notice.info { background: var(--surface-2); }

/* ---------- sections / cards ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 16px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.section-head .see-all { margin-left: auto; font-weight: 600; color: var(--accent-text); text-decoration: none; white-space: nowrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.chip { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.chip.active, .chip:hover { color: var(--text); border-color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); }

.row-scroller { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.row-scroller > * { scroll-snap-align: start; }
@media (min-width: 1100px) { .row-scroller { grid-auto-columns: calc((100% - 4 * 14px) / 5); } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .row-scroller { grid-auto-columns: 46%; gap: 10px; }
  .card-title { font-size: 14px; }
  .price { font-size: 16px; }
  .card-foot .age { display: none; }
  .page-head h1 { font-size: 22px; }
}

.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform 0.12s, box-shadow 0.12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / 0.08); }
.card-link { position: absolute; inset: 0; z-index: 1; }
.card-media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.card-media img[src^="/img/placeholder"] { object-fit: cover; }
.pill-off { position: absolute; top: 8px; left: 8px; background: var(--price); color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.pill-hot { position: absolute; top: 8px; right: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-store { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.card-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prices { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { color: var(--price); font-weight: 800; font-size: 18px; }
.was { color: var(--muted); text-decoration: line-through; font-size: 14px; }
.card-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.card-foot .age { margin-left: auto; }
.card.is-removed { opacity: 0.7; }
.removed-tag { position: absolute; inset: auto 8px 8px auto; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }

/* ---------- vote widget ---------- */
.vote { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 2px; }
.vote-btn { border: 0; background: none; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 13px; display: grid; place-items: center; }
.vote-btn:hover:not(:disabled) { background: var(--border); }
.vote-btn:disabled { cursor: not-allowed; opacity: 0.45; }
.vote-btn.up.on { color: #fff; background: var(--up); }
.vote-btn.down.on { color: #fff; background: var(--down); }
.vote-score { min-width: 28px; text-align: center; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.vote.lg { padding: 4px; }
.vote.lg .vote-btn { width: 40px; height: 40px; font-size: 17px; }
.vote.lg .vote-score { min-width: 44px; font-size: 20px; }

/* ---------- deal detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
@media (max-width: 820px) { .detail { grid-template-columns: 1fr; padding: 16px; gap: 18px; } }
.detail-media { background: var(--surface-2); border-radius: 12px; aspect-ratio: 1 / 1; overflow: hidden; position: relative; }
.detail-media img { width: 100%; height: 100%; object-fit: contain; }
.detail-media img[src^="/img/placeholder"] { object-fit: cover; }
.detail h1 { margin: 4px 0 10px; font-size: 26px; line-height: 1.25; letter-spacing: -0.015em; }
.detail .price { font-size: 32px; }
.detail .was { font-size: 18px; }
.off-badge { background: var(--price); color: #fff; padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 14px; }
.meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 700; text-decoration: none; color: var(--text); }
.badge.role-moderator { background: #e7f5ff; color: #1864ab; border-color: #a5d8ff; }
.badge.role-admin { background: #fff0f6; color: #a61e4d; border-color: #fcc2d7; }
.badge.status-suspended { background: #fff9db; color: #8a6d00; border-color: #ffe066; }
.badge.status-banned, .badge.status-removed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; align-items: center; }
.details-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 10px; padding: 14px 16px; margin: 0; }
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.banner.removed { background: var(--danger-soft); color: var(--danger); }

.comments { margin-top: 28px; max-width: 820px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment .linkish { margin-left: auto; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.comment-form textarea { width: 100%; min-height: 80px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); resize: vertical; }

/* ---------- submit ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); max-width: 760px; }
.narrow { max-width: 420px; margin: 24px auto; }
.submit-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
@media (max-width: 640px) { .submit-grid { grid-template-columns: 1fr; } .panel { padding: 16px; } }
.img-preview { aspect-ratio: 1 / 1; background: var(--surface-2); border-radius: 12px; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.url-chip { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; margin-bottom: 16px; font-size: 14px; overflow: hidden; }
.url-chip code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.discount-preview { font-weight: 700; color: var(--price); }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 0 0 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.sentinel { height: 1px; }
.load-more { display: flex; justify-content: center; margin: 24px 0; }

/* ---------- list (wishlist) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-color: var(--accent); }

/* ---------- admin ---------- */
.admin { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: start; }
.admin-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.admin-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; }
.admin-nav a.active, .admin-nav a:hover { background: var(--surface-2); color: var(--text); }
.admin-nav .count { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; }
.admin-mobile-note { display: none; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; }
  .admin-mobile-note { display: block; }
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td .cell-title { font-weight: 600; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; }
td.actions-cell { white-space: nowrap; text-align: right; }
td.actions-cell .btn + .btn { margin-left: 6px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 300px; }
.toolbar select.input { width: auto; }
.report-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.report-card .thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-2); }
.report-card .grow { flex: 1; min-width: 0; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.reasons .badge { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-weight: 600; }
.quote { background: var(--surface-2); border-left: 3px solid var(--border); padding: 6px 10px; border-radius: 4px; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- modal & toasts ---------- */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); }
.modal::backdrop { background: rgb(0 0 0 / 0.45); }
.modal form { padding: 22px; }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.radio-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.radio-list label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 500; }
.radio-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 760px) { .toasts { bottom: 84px; } }
.toast { background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 10px; font-weight: 600; box-shadow: 0 6px 20px rgb(0 0 0 / 0.2); animation: pop 0.18s ease-out; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- social sign-in ---------- */
.social-auth { display: grid; gap: 10px; margin-bottom: 4px; }
.btn-social { width: 100%; gap: 10px; padding: 10px 16px; font-weight: 600; }
.btn-social svg { width: 20px; height: 20px; flex: none; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn-google:hover { background: #f8f9fa; }
.btn-facebook { background: #1877f2; color: #fff; border-color: #1877f2; }
.btn-facebook:hover { background: #166fe5; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--muted); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- posting: same product already on the site ---------- */
.match-title { margin: 4px 0 6px; font-size: 20px; }
.matches { display: grid; gap: 12px; margin: 16px 0; }
.match-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; background: var(--surface); }
.match-card.high { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mini-deal { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mini-deal img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.mini-deal .grow { min-width: 0; }
.mini-title { font-weight: 600; text-decoration: none; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.match-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.badge.match-high { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.match-footer { border-top: 1px solid var(--border); padding-top: 14px; display: flex; justify-content: flex-end; }

/* ---------- account & legal pages ---------- */
.legal { max-width: 760px; margin: 0 auto; line-height: 1.65; }
.legal h2 { font-size: 18px; margin: 24px 0 8px; }
.legal li { margin: 4px 0; }
a.avatar { text-decoration: none; }
/* Inside the Android app the system shows its own back button and share sheet. */
.in-app .skip-link { display: none; }
