/* BidSahi — brand navy sampled from resources/logo-bidsahi-v1.png (#1A355B). */
:root {
  --brand: #1a355b;
  --brand-600: #234473;
  --brand-50: #eef2f8;
  --brand-100: #dbe3ef;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #16213a;
  --muted: #5a6478;
  --line: #e1e6ee;
  --ok: #17734a;
  --ok-bg: #e5f4ec;
  --warn: #9a5b00;
  --warn-bg: #fff3dc;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --mark: #fff1b8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 33, 58, .06), 0 2px 8px rgba(16, 33, 58, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #8fb0e0;
    --brand-600: #a9c3ea;
    --brand-50: #172338;
    --brand-100: #22324d;
    --bg: #0d1422;
    --surface: #141d2e;
    --text: #e7ecf4;
    --muted: #9aa6ba;
    --line: #26324a;
    --ok: #5fd39b; --ok-bg: #12301f;
    --warn: #f3b552; --warn-bg: #33270f;
    --danger: #ff8a80; --danger-bg: #3a1714;
    --mark: #5a4a10;
    --shadow: none;
    color-scheme: dark;
  }
  .brand img { filter: brightness(0) invert(.85); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 var(--font); color: var(--text); background: var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: var(--brand); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-top: 20px; padding-bottom: 32px; outline: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px; z-index: 99; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.topbar-in { display: flex; align-items: center; gap: 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--brand); font-size: 1.3rem; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.topnav { display: none; margin-left: auto; gap: 4px; }
.topnav a { text-decoration: none; color: var(--text); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.topnav a:hover { background: var(--brand-50); }
.topnav a[aria-current="page"] { color: var(--brand); background: var(--brand-50); }
.install-btn { margin-left: auto; }
@media (min-width: 900px) { .topnav { display: flex; } .install-btn { margin-left: 0; } }

/* Bottom nav (mobile) */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: .7rem; color: var(--muted); text-decoration: none; }
.bottomnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav a[aria-current="page"] { color: var(--brand); font-weight: 600; }
@media (min-width: 900px) { .bottomnav { display: none; } }

.offline-bar { background: var(--warn-bg); color: var(--warn); text-align: center; padding: 6px; font-size: .875rem; }

/* Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--brand); color: #fff; white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .btn { color: #0d1422; } }
.btn:hover { background: var(--brand-600); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand-100); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-bg); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn-block { width: 100%; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  min-height: 44px; padding: 8px 12px; width: 100%;
}
input:focus, select:focus { border-color: var(--brand); outline: 2px solid var(--brand-100); }
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 20px; min-height: 20px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 12px; }

/* Hero */
.hero { background: var(--brand); color: #fff; border-radius: 16px; padding: 28px 20px; margin-bottom: 20px; }
@media (prefers-color-scheme: dark) { .hero { background: #1a355b; } }
.hero h1 { color: #fff; }
.hero p { color: #d7e0ee; margin: 0 0 16px; max-width: 640px; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { flex: 1; min-height: 50px; font-size: 1.05rem; border: 0; }
.searchbar .btn { min-height: 50px; }
.hero .btn { background: #fff; color: #1a355b; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: .9rem; color: #d7e0ee; }
.hero-stats b { color: #fff; }
@media (min-width: 700px) { .hero { padding: 44px 40px; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .875rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--brand); }
.chip .n { color: var(--muted); font-size: .8rem; }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.steps { display: grid; gap: 12px; }
@media (min-width: 700px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; margin-bottom: 8px; }
section { margin-bottom: 28px; }

/* Search layout */
.search-layout { display: grid; gap: 20px; }
@media (min-width: 900px) { .search-layout { grid-template-columns: 280px 1fr; align-items: start; } }
.filters { display: none; }
.filters.open { display: block; position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: auto; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); }
@media (min-width: 900px) { .filters, .filters.open { display: block; position: sticky; top: 72px; inset: auto; padding: 0; background: none; z-index: auto; } .filters-close, .filters-toggle { display: none !important; } }
.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.results-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.result { padding: 0; overflow: hidden; }
.result-top { padding: 14px 16px 10px; }
.result-title { font-weight: 700; font-size: 1rem; text-decoration: none; color: var(--text); display: block; word-break: break-word; }
.result-title:hover { color: var(--brand); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--brand-50); color: var(--brand); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.lots { border-top: 1px solid var(--line); }
.lot { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; display: flex; gap: 12px; }
.lot:last-child { border-bottom: 0; }
.lot-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; background: var(--brand-50); }
.lot-no { font-weight: 700; color: var(--brand); min-width: 44px; }
.lot-desc { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.money { font-weight: 600; white-space: nowrap; }
.result-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 16px; background: var(--brand-50); font-size: .8rem; color: var(--muted); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Auction detail */
.detail-head { display: grid; gap: 16px; }
@media (min-width: 900px) { .detail-head { grid-template-columns: 1fr 320px; align-items: start; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .925rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: .875rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--brand-50); white-space: nowrap; }
@media (max-width: 699px) {
  table.lots-table, table.lots-table tbody { display: block; width: 100%; }
  table.lots-table thead { display: none; }
  table.lots-table td { overflow-wrap: anywhere; }
  table.lots-table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.lots-table td { display: grid; grid-template-columns: 100px 1fr; border: 0; padding: 4px 12px; }
  table.lots-table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; }
  table.lots-table td[data-label="Item"] { display: block; }
  table.lots-table td[data-label="Item"]::before { display: none; }
  table.lots-table td[data-label="Lot"] { font-size: 1rem; }
}
.timeline { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line); }

/* Alerts */
.saved-search { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.saved-search .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.push-box { border-left: 4px solid var(--brand); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 60;
  background: #16213a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; max-width: calc(100% - 32px); box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* Footer */
.footer { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0; font-size: .85rem; color: var(--muted); }
.footer p { margin: 0 0 6px; }
.footer a { color: var(--muted); }
.status-line { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 4px; vertical-align: middle; }
.dot.stale { background: var(--warn); }
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.5em; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 20, 35, .5); z-index: 50; display: grid; place-items: end center; }
@media (min-width: 700px) { .modal-backdrop { place-items: center; } }
.modal { background: var(--surface); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
@media (min-width: 700px) { .modal { border-radius: 16px; } }
