:root {
  color-scheme: light;
  --navy: #1b2a4e; --navy-light: #2a3d6b;
  --blue: #2457d6; --blue-dark: #1b43a5; --blue-soft: #e8eeff;
  --amber: #f5a524; --amber-soft: #fff4dc;
  --green: #1f7a37; --green-soft: #e6f6ea;
  --danger: #c92a2a;
  --text: #1d2433; --muted: #667085; --border: #e3e7ef; --bg: #f4f6fb;
  --radius: 14px; --radius-small: 8px;
  --shadow: 0 1px 2px #1b2a4e0f, 0 4px 14px #1b2a4e12;
  --shadow-raised: 0 4px 10px #1b2a4e14, 0 16px 34px #1b2a4e1f;
}
* { box-sizing:border-box; }
body { margin:0; font-family:"Segoe UI", system-ui, -apple-system, Arial, Helvetica, sans-serif; color:var(--text); background:linear-gradient(180deg, #e9eefc 0, var(--bg) 360px) no-repeat, var(--bg); line-height:1.45; }
button, input, select, textarea { font:inherit; }
button { cursor:pointer; }
[hidden] { display:none !important; }
p { color:var(--muted); }
h1 { margin:0 0 4px; font-size:30px; letter-spacing:-.02em; }
h2 { font-size:20px; }
:focus-visible { outline:3px solid #9db6ff; outline-offset:2px; }

/* Header */
.site-header { position:sticky; top:0; z-index:4; min-height:64px; padding:8px 5vw; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 24px; background:var(--navy); box-shadow:0 2px 12px #1b2a4e40; }
.brand { display:flex; align-items:center; gap:10px; color:#fff; text-decoration:none; font-weight:800; font-size:19px; white-space:nowrap; }
.brand-mark { width:34px; height:34px; flex:none; }
nav { display:flex; align-self:stretch; min-height:44px; max-width:100%; overflow-x:auto; }
.nav-button { border:0; border-bottom:3px solid transparent; padding:0 16px; background:transparent; color:#c9d3ea; white-space:nowrap; transition:color .15s; }
.nav-button:hover { color:#fff; }
.nav-button.active { color:#fff; border-bottom-color:var(--amber); font-weight:700; }
.account-actions { display:flex; align-items:center; gap:10px; }
.account-name { color:#fff; font-weight:700; font-size:14px; border:0; background:transparent; }
.site-header .button.secondary { background:transparent; border-color:#ffffff55; color:#fff; }
.site-header .button.secondary:hover { background:#ffffff1a; }

/* Page layout */
.container { width:min(1120px, 92vw); margin:34px auto 70px; }
.verification-banner { display:flex; align-items:flex-start; gap:14px; margin-bottom:24px; padding:16px 18px; background:#f7f9ff; border:1px solid #cad8ff; border-left:4px solid var(--blue); border-radius:var(--radius); box-shadow:var(--shadow); }
.verification-icon { display:grid; place-items:center; flex:none; width:38px; height:38px; border-radius:10px; background:var(--blue-soft); color:var(--blue-dark); font-size:20px; line-height:1; }
.verification-banner h2 { margin:0 0 3px; color:var(--navy); font-size:17px; line-height:1.3; }
.verification-banner p { margin:0; color:var(--navy-light); font-size:14px; }
.page-heading { display:flex; align-items:center; gap:16px; margin-bottom:24px; }
.page-heading p { margin:0; }
.page-icon { display:grid; place-items:center; width:56px; height:56px; flex:none; font-size:28px; background:#fff; border-radius:16px; box-shadow:var(--shadow); }
.marketplace-actions, .form-actions { display:flex; gap:10px; justify-content:flex-end; }
.marketplace-actions { margin-bottom:16px; }
.section-title { font-size:18px; margin:0 0 12px; }

/* Buttons */
.button { border:1px solid transparent; border-radius:10px; padding:10px 18px; font-weight:700; transition:background .15s, transform .15s, box-shadow .15s; }
.button.primary { background:var(--blue); color:#fff; box-shadow:0 2px 6px #2457d640; }
.button.primary:hover { background:var(--blue-dark); transform:translateY(-1px); }
.button.secondary { background:#fff; border-color:var(--border); color:var(--text); }
.button.secondary:hover { border-color:#c4cbe0; background:#f8f9fd; }
.button.danger { background:var(--danger); color:#fff; }
.small-button { border:1px solid var(--border); background:#fff; border-radius:8px; padding:6px 12px; font-weight:600; font-size:14px; transition:background .15s; }
.small-button:hover { background:#f3f5fa; }
.small-button.danger-link { color:var(--danger); }
.icon-button { border:0; background:transparent; font-size:28px; line-height:1; color:var(--muted); }
.icon-button:hover { color:var(--text); }

/* Forms */
label { display:grid; gap:6px; font-size:14px; font-weight:700; }
input, select, textarea { width:100%; font-weight:400; border:1px solid #cfd5e2; border-radius:var(--radius-small); background:#fff; padding:10px 12px; color:var(--text); transition:border-color .15s, box-shadow .15s; }
textarea { resize:vertical; }
input:focus, select:focus, textarea:focus { outline:none; border-color:var(--blue); box-shadow:0 0 0 4px #2457d626; }
.required-mark { color:var(--danger); margin-left:3px; }
.required-note { margin:0; font-size:13px; }
.post-form { display:grid; gap:15px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.filters { display:grid; grid-template-columns:2fr 1fr 1fr; gap:14px; margin-bottom:24px; padding:16px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.photo-preview { display:flex; gap:8px; flex-wrap:wrap; }
.photo-preview span { display:grid; gap:4px; }
.preview-photo { width:80px; height:62px; object-fit:cover; border:1px solid var(--border); border-radius:6px; }

/* Badges */
.badges { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:999px; background:#eef1f6; color:#4d586b; font-size:12px; font-weight:600; white-space:nowrap; }
.badge.condition { background:#fff; border:1px solid var(--border); }
.category-furniture { background:#fff1e6; color:#a8460b; }
.category-appliances { background:#e7f5ff; color:#1864ab; }
.category-electronics { background:#f3f0ff; color:#5f3dc4; }
.category-clothing { background:#fff0f6; color:#a61e4d; }
.category-school-supplies { background:#fff9db; color:#8a6100; }
.category-other { background:#f1f3f5; color:#495057; }
.status-available, .status-open { background:var(--green-soft); color:var(--green); }
.status-sold, .status-closed { background:#eceef2; color:#6b7280; }
.verified { background:var(--green-soft); color:var(--green); }
.unverified { background:var(--amber-soft); color:#86590b; }

/* People */
.avatar { display:inline-grid; place-items:center; width:36px; height:36px; flex:none; border-radius:50%; color:#fff; font-size:13px; font-weight:800; letter-spacing:.02em; }
.person { display:flex; align-items:center; flex-wrap:wrap; gap:4px 10px; margin-top:12px; }
.person > div { display:grid; line-height:1.2; }
.person-name { font-weight:700; font-size:14px; }
.person-role { color:var(--muted); font-size:12px; }

/* Listing cards */
.card-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:20px; }
.item-card { display:flex; flex-direction:column; overflow:hidden; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); transition:transform .2s, box-shadow .2s; }
.item-card:hover { transform:translateY(-4px); box-shadow:var(--shadow-raised); }
.item-media { position:relative; overflow:hidden; background:#eceff3; }
.item-photo { width:100%; aspect-ratio:4/3; object-fit:cover; display:block; transition:transform .35s; }
.item-card:hover .item-photo { transform:scale(1.04); }
.price-tag { position:absolute; left:12px; bottom:12px; padding:5px 12px; border-radius:999px; background:#fff; color:var(--navy); font-weight:800; font-size:17px; box-shadow:0 2px 10px #1b2a4e33; }
.sold-ribbon { position:absolute; top:12px; right:12px; padding:4px 12px; border-radius:999px; background:var(--navy); color:#fff; font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.item-card.is-sold .item-photo { filter:grayscale(.85); opacity:.75; }
.item-body { display:flex; flex-direction:column; flex:1; padding:16px; }
.item-card h2 { font-size:18px; margin:0 0 2px; }
.description { margin:8px 0; color:#4a5366; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.location { margin:4px 0 0; color:var(--muted); font-size:14px; }
.card-button { margin-top:auto; width:100%; }
.item-body .person { margin-bottom:14px; }
.price { font-size:22px; font-weight:800; white-space:nowrap; color:var(--navy); }
.card-line { display:flex; justify-content:space-between; align-items:start; gap:10px; }
.meta { margin:5px 0; font-size:13px; color:var(--muted); }

/* Help cards */
.help-list, .post-list { display:grid; gap:14px; }
.help-card { display:grid; grid-template-columns:1fr 190px; overflow:hidden; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); transition:transform .2s, box-shadow .2s; }
.help-card.has-photo { grid-template-columns:minmax(0, 1fr) 220px 190px; }
.help-photo { align-self:center; width:200px; height:200px; object-fit:cover; border-radius:10px; }
.help-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-raised); }
.help-main { padding:18px 20px; }
.help-header { display:flex; align-items:center; gap:12px; }
.help-header h2 { margin:0 0 4px; font-size:19px; }
.type-icon { display:grid; place-items:center; width:46px; height:46px; flex:none; border-radius:12px; background:var(--blue-soft); font-size:22px; }
.route { list-style:none; margin:16px 0 10px; padding:0; }
.route li { position:relative; padding:0 0 12px 26px; color:var(--text); font-weight:600; }
.route li:last-child { padding-bottom:0; }
.route li::before { content:""; position:absolute; left:3px; top:5px; width:10px; height:10px; border-radius:50%; border:3px solid var(--blue); background:#fff; }
.route li:last-child::before { border-color:var(--amber); background:var(--amber); }
.route li:first-child::after { content:""; position:absolute; left:9px; top:21px; bottom:2px; border-left:2px dashed #b9c4e4; }
.route-label { display:block; color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; }
.help-details { margin:10px 0 0; color:#4a5366; }
.help-side { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; padding:18px; text-align:center; background:linear-gradient(160deg, var(--amber-soft), #fff8ea); border-left:1px solid var(--border); }
.offer { font-size:30px; font-weight:800; color:var(--navy); line-height:1.1; }
.offer-label { color:#86590b; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; }
.when { margin:8px 0 12px; font-size:14px; font-weight:600; }

/* My posts */
.my-posts-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.post-row { padding:14px; background:#fff; border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); }
.post-row h3 { margin:0 0 4px; font-size:16px; }
.post-row.with-thumb { display:grid; grid-template-columns:64px 1fr; gap:14px; align-items:start; }
.row-thumb { width:64px; height:64px; border-radius:10px; object-fit:cover; background:#eceff3; }
.row-thumb.type-icon { font-size:28px; }
.row-price { color:var(--navy); }
.post-actions { display:flex; gap:8px; margin-top:10px; flex-wrap:wrap; }
.summary { display:grid; grid-template-columns:repeat(3, 1fr); gap:14px; margin-bottom:26px; }
.summary-tile { display:flex; align-items:center; gap:14px; padding:16px 18px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.summary-icon { display:grid; place-items:center; width:46px; height:46px; border-radius:12px; background:var(--blue-soft); font-size:22px; }
.summary-tile strong { display:block; font-size:26px; line-height:1.1; }
.summary-tile span { color:var(--muted); font-size:13px; }
.empty-inline { padding:18px; text-align:center; background:#fff; border:1px dashed #c9d0de; border-radius:12px; }
.empty-inline p { margin:0 0 10px; }

/* Empty state */
.empty-state { text-align:center; padding:54px 20px; background:#fff; border:1px dashed #c9d0de; border-radius:var(--radius); }
.empty-state h2 { margin:10px 0 4px; }
.empty-state p { margin:0 0 18px; }
.empty-icon { display:inline-grid; place-items:center; width:84px; height:84px; border-radius:50%; background:var(--blue-soft); font-size:40px; }

/* Messages */
.messages-layout { display:grid; grid-template-columns:320px 1fr; gap:20px; align-items:start; }
.conversation-row { display:flex; align-items:center; gap:12px; width:100%; text-align:left; font:inherit; color:inherit; transition:border-color .15s, background .15s; }
.conversation-row:hover { background:#f8f9fd; }
.conversation-row.active { border-color:var(--blue); background:var(--blue-soft); }
.conversation-text { display:grid; min-width:0; }
.conversation-text .meta { margin:1px 0; }
.preview { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.conversation-panel { display:grid; gap:14px; padding:20px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.conversation-panel h2 { margin:0; }
.conversation-panel .person { margin-top:8px; }
.message-list { display:flex; flex-direction:column; gap:8px; max-height:380px; overflow:auto; padding:12px; background:#f7f8fb; border-radius:12px; }
.message { max-width:78%; padding:9px 13px; border-radius:16px 16px 16px 4px; background:#fff; border:1px solid var(--border); align-self:flex-start; overflow-wrap:anywhere; }
.message.mine { background:var(--blue); border-color:var(--blue); border-radius:16px 16px 4px 16px; align-self:flex-end; }
.message p { margin:0; color:var(--text); white-space:pre-wrap; }
.message .meta { margin-bottom:2px; font-size:12px; color:var(--muted); }
.message.mine p, .message.mine .meta { color:#fff; }
.message.mine .meta { opacity:.8; }
.message-form { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:end; }
.route-map-panel { margin:12px 0; }
.route-map-panel summary { cursor:pointer; font-weight:700; }
.route-map-panel p { margin:10px 0; }
.route-map-panel p:empty { display:none; }
.route-map { position:relative; isolation:isolate; z-index:0; width:100%; height:300px; border:1px solid var(--border); border-radius:8px; }
.route-location-label { font-weight:700; color:var(--navy); border:1px solid var(--border); border-radius:8px; padding:6px 10px; box-shadow:0 2px 8px #17203533; }

/* Profile */
.profile-form { max-width:580px; padding:22px; background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); }
.profile-header { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; padding-bottom:16px; border-bottom:1px solid var(--border); }
.profile-header .avatar { width:56px; height:56px; font-size:20px; }
.profile-header p { margin:0; }
.profile-link { display:flex; align-items:center; gap:10px; border:0; padding:0; background:transparent; text-align:left; color:inherit; }
.profile-link:hover .person-name { text-decoration:underline; }
.profile-link > span:last-child { display:grid; line-height:1.2; }
.conversation-open { flex:1; min-width:0; border:0; padding:0; background:transparent; text-align:left; color:inherit; }
[data-detail-id] { cursor:pointer; }
.avatar img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

/* Dialogs */
dialog { width:min(640px, 94vw); max-height:90vh; overflow:auto; border:0; border-radius:18px; padding:26px; box-shadow:0 24px 70px #17203566; }
dialog::backdrop { background:#1b2a4e99; backdrop-filter:blur(3px); }
.dialog-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.dialog-heading h2 { margin:0; font-size:24px; }
.detail-photos { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:8px; margin-bottom:14px; }
.detail-photos img { width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:10px; background:#eceff3; }
.detail-description { color:#41495a; white-space:pre-wrap; }
.seller-card { margin:16px 0; padding:14px 16px; background:#f8f9fd; border:1px solid var(--border); border-radius:12px; }
.seller-card .person { margin-top:0; }
.seller-card p { margin:8px 0 0; }
.confirm-overlay { position:fixed; inset:0; display:grid; place-items:center; background:#1b2a4e99; z-index:5; }
.confirm-box { width:min(420px, 92vw); background:#fff; padding:24px; border-radius:16px; box-shadow:0 24px 70px #17203566; }
.confirm-box h2 { margin-top:0; }

/* Toast */
.toast { position:fixed; right:20px; bottom:20px; z-index:6; max-width:360px; background:var(--navy); color:#fff; padding:12px 18px; border-radius:12px; box-shadow:var(--shadow-raised); transform:translateY(100px); opacity:0; transition:.2s; }
.toast.show { transform:translateY(0); opacity:1; }
.toast.error { top:20px; bottom:auto; background:#9c2424; transform:translateY(-100px); }
.toast.error.show { transform:translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition:none !important; }
  .item-card:hover, .help-card:hover, .button.primary:hover { transform:none; }
  .item-card:hover .item-photo { transform:none; }
}

@media (max-width:900px) {
  .card-grid { grid-template-columns:repeat(2, 1fr); }
}

@media (max-width:760px) {
  .site-header { padding:10px 4vw; }
  nav { order:3; width:100%; height:44px; }
  .nav-button { flex:1; padding:0 6px; }
  .page-icon { width:46px; height:46px; font-size:22px; }
  .filters, .card-grid, .my-posts-grid, .messages-layout, .form-row, .summary { grid-template-columns:1fr; }
  .help-card { grid-template-columns:1fr; }
  .help-card.has-photo { grid-template-columns:minmax(0, 1fr) minmax(110px, 35%); }
  .help-photo { width:calc(100% - 16px); height:auto; aspect-ratio:1; margin-right:16px; }
  .help-card.has-photo .help-side { grid-column:1 / -1; }
  .help-side { flex-direction:row; flex-wrap:wrap; justify-content:space-between; border-left:0; border-top:1px solid var(--border); }
  .when { margin:0; }
}
