:root {
  --green: #0e7c66; --green-d: #0a5c4c; --green-l: #e6f4f0;
  --accent: #ff7a1a; --accent-d: #e5630a;
  --ink: #1d2a2b; --muted: #66737a; --line: #e3e8ea; --bg: #f6f7f5; --card: #fff;
  --radius: 12px; --shadow: 0 1px 3px rgba(20,40,40,.08), 0 4px 14px rgba(20,40,40,.05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: .4em 0 .6em; letter-spacing: -.01em; }
h2, h3 { letter-spacing: -.01em; }
img { max-width: 100%; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.center { text-align: center; }

/* Topp */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; gap: 18px; height: 68px; }
.logo { display: flex; flex-shrink: 0; }
.search { flex: 1; display: flex; max-width: 560px; }
.search input { flex: 1; min-width: 0; height: 44px; border: 2px solid var(--line); border-right: 0; border-radius: 22px 0 0 22px; padding: 0 18px; font: inherit; background: var(--bg); }
.search input:focus { outline: none; border-color: var(--green); background: #fff; }
.search button { width: 54px; border: 0; border-radius: 0 22px 22px 0; background: var(--green); color: #fff; cursor: pointer; display: grid; place-items: center; }
.search button:hover { background: var(--green-d); }
.usernav { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.navlink { color: var(--ink); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .75rem; text-align: center; line-height: 20px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; }
.avatar.big { width: 48px; height: 48px; font-size: 1.3rem; flex-shrink: 0; }

/* Knappar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 22px; border: 2px solid var(--green); background: var(--green); color: #fff; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--green-d); border-color: var(--green-d); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn-ghost { background: #fff; color: var(--green); }
.btn-ghost:hover { background: var(--green-l); color: var(--green-d); }
.btn-danger { background: #fff; color: #c0392b; border-color: #f0c4bf; }
.btn-danger:hover { background: #fdecea; border-color: #c0392b; }
.btn-block { display: flex; width: 100%; margin-top: 10px; }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.btn:disabled { opacity: .6; cursor: wait; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; font-weight: 500; }
.flash-ok { background: var(--green-l); color: var(--green-d); }
.flash-info { background: #fff4e5; color: #8a4b00; }
.flash-err { background: #fdecea; color: #a12a1d; }

/* Startsida */
.hero { margin: 22px 0 8px; padding: 36px 32px; border-radius: 18px; background: linear-gradient(120deg, var(--green) 0%, #13997c 60%, #35b58f 100%); color: #fff; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,122,26,.9); opacity: .85; }
.hero h1 { margin: 0; font-size: 2.2rem; position: relative; z-index: 1; }
.hero p { margin: 6px 0 0; font-size: 1.1rem; opacity: .92; position: relative; z-index: 1; }
.sec { font-size: 1.25rem; margin: 30px 0 14px; }
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-align: center; font-size: .88rem; font-weight: 600; line-height: 1.25; transition: transform .12s; }
.cat:hover { transform: translateY(-2px); text-decoration: none; color: var(--green-d); }
.cat-icon { font-size: 1.9rem; line-height: 1; }
.allcat .cat-icon { font-size: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 16px; border-radius: 20px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: .92rem; font-weight: 500; }
.chip:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.chip-more { color: var(--green); font-weight: 700; }

/* Annonskort */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; transition: transform .12s; }
.card:hover { transform: translateY(-2px); text-decoration: none; }
.card-img { aspect-ratio: 4/3; background: #eef1f0; position: relative; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; font-size: 3rem; opacity: .5; }
.noimg.big { aspect-ratio: 4/3; font-size: 6rem; background: #eef1f0; border-radius: var(--radius); }
.card-body { padding: 10px 14px 14px; }
.card-meta { font-size: .78rem; color: var(--muted); }
.card-title { font-weight: 600; margin: 2px 0 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-price { font-weight: 800; font-size: 1.1rem; }
.tag { position: absolute; top: 10px; left: 10px; padding: 2px 10px; border-radius: 10px; font-size: .75rem; font-weight: 700; color: #fff; background: var(--green); }
.tag.inline { position: static; vertical-align: middle; font-size: .8rem; }
.tag-buy { background: #3a6fd8; }
.tag-free { background: var(--accent); }
.tag-sold { background: #444; left: auto; right: 10px; }
.tag-active { background: var(--green); }

/* Sök */
.crumbs { margin: 16px 0 4px; font-size: .9rem; color: var(--muted); }
.search-layout { display: grid; grid-template-columns: 260px 1fr; gap: 26px; align-items: start; }
.filters { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 18px 18px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; }
.filters h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 6px; }
.cat-list { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.cat-list li { margin: 3px 0; }
.cat-list a { color: var(--ink); }
.cat-list li.sub { padding-left: 14px; }
.cat-list a.active { color: var(--green); font-weight: 700; }
.results h1 .count { font-size: 1rem; font-weight: 500; color: var(--muted); margin-left: 6px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 26px 0; }

/* Formulär */
select, input:not([type=radio]):not([type=checkbox]):not([type=file]), textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-l); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .92rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.form h3 { margin: 10px 0 -4px; }
.form-page, .auth-box { max-width: 680px; margin: 0 auto 40px; background: #fff; padding: 10px 32px 32px; border-radius: 18px; box-shadow: var(--shadow); margin-top: 24px; }
.auth-box { max-width: 440px; }
.seg { display: flex; border: 0; padding: 0; margin: 0; gap: 8px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 10px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 700; }
.seg input:checked + span { border-color: var(--green); background: var(--green-l); color: var(--green-d); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--green-l); }
.drop { position: relative; border: 2px dashed #c6d3cf; border-radius: var(--radius); padding: 26px; text-align: center !important; align-items: center; cursor: pointer; color: var(--green-d); background: #fafcfb; }
.drop.over { border-color: var(--green); background: var(--green-l); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.previews, .img-edit { display: flex; flex-wrap: wrap; gap: 10px; }
.previews img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; }
.img-edit-item { width: 120px; display: flex; flex-direction: column; gap: 2px; }
.img-edit-item img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; }
.img-edit-item label { flex-direction: row !important; align-items: center; font-weight: 500 !important; gap: 4px !important; }
.hp { position: absolute; left: -9999px; }

/* Annonssida */
.ad-layout { display: grid; grid-template-columns: 1fr 340px; gap: 26px; align-items: start; margin-bottom: 40px; }
.gallery-main { background: #1d2a2b; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; aspect-ratio: 4/3; }
.gallery-main img { max-height: 100%; max-width: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery-thumbs button { padding: 0; border: 3px solid transparent; border-radius: 8px; background: none; cursor: pointer; flex-shrink: 0; }
.gallery-thumbs button.active { border-color: var(--green); }
.gallery-thumbs img { width: 84px; height: 63px; object-fit: cover; border-radius: 5px; display: block; }
.ad-text { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 24px; margin-top: 16px; }
.ad-text h1 { margin: .2em 0 .1em; }
.ad-meta { font-size: .87rem; color: var(--muted); }
.ad-price { font-size: 1.8rem; font-weight: 800; margin-bottom: 14px; }
.ad-body { white-space: normal; overflow-wrap: anywhere; }
.ad-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.box form { margin: 0; }
.seller { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.msg-form { display: flex; flex-direction: column; gap: 6px; margin-top: 12px !important; }
.msg-form label { font-weight: 600; font-size: .9rem; }
.tips { background: #fff8ef; box-shadow: none; border: 1px solid #ffe2c4; }

/* Listor & meddelanden */
.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list th, .list td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { font-size: .8rem; text-transform: uppercase; color: var(--muted); }
.thumbcell { width: 84px; }
.thumbcell img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; display: block; }
.convs { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.conv { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); }
.conv:hover { background: var(--bg); text-decoration: none; }
.conv.unread { background: #fff8ef; }
.conv-img { width: 64px; height: 48px; border-radius: 6px; overflow: hidden; background: #eef1f0; flex-shrink: 0; }
.conv-img img { width: 100%; height: 100%; object-fit: cover; }
.conv-text { flex: 1; min-width: 0; }
.conv-when { text-align: right; white-space: nowrap; }
.thread { max-width: 760px; margin: 0 auto 40px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.thread-head { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.thread-head img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.bubbles { padding: 18px; display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; background: var(--bg); }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.bubble .when { display: block; font-size: .72rem; opacity: .7; margin-top: 3px; }
.bubble.mine { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.reply { display: flex; gap: 10px; padding: 14px 18px; align-items: flex-end; }

/* Alla kategorier */
.allcats { columns: 3 300px; column-gap: 24px; margin-bottom: 40px; }
.allcat { break-inside: avoid; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 20px 14px; margin-bottom: 20px; }
.allcat h2 { font-size: 1.08rem; }
.allcat h2 a { color: var(--ink); }
.allcat ul { list-style: none; padding: 0; margin: 0; }
.allcat li { padding: 3px 0; font-size: .93rem; display: flex; justify-content: space-between; }
.allcat li a { color: var(--ink); }
.allcat li a:hover { color: var(--green); }
.count { color: var(--muted); font-size: .82rem; font-weight: 400; }

.empty { text-align: center; padding: 50px 20px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.prose { max-width: 720px; margin: 0 auto 40px; background: #fff; padding: 10px 32px 26px; border-radius: 18px; box-shadow: var(--shadow); margin-top: 24px; }
.foot { margin-top: 50px; padding: 30px 0; background: #fff; border-top: 1px solid var(--line); text-align: center; font-size: .92rem; }
.foot p { margin: 6px 0; }

/* Mobil */
@media (max-width: 900px) {
  .search-layout, .ad-layout { grid-template-columns: 1fr; }
  .filters, .ad-side { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .top-row { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .usernav { gap: 10px; }
  .usernav .m-hide { display: none; }
  .usernav .navlink { font-size: .85rem; }
  .usernav .btn { padding: 8px 12px; font-size: .9rem; }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .catgrid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .cat { padding: 12px 6px; font-size: .78rem; }
  .form-page, .auth-box, .prose { padding: 6px 18px 22px; }
  .list .hide-m { display: none; }
}

/* --- Fynda hos Robban --- */
.hero-robban { display: grid; grid-template-columns: 1fr 300px; gap: 30px; align-items: center; padding: 34px 36px; }
.hero-robban::after { right: auto; left: -70px; top: auto; bottom: -90px; opacity: .5; }
.hero-robban h1 { font-size: 2.8rem; }
.hero-robban sup { font-size: 1.2rem; color: #ffd2b0; }
.hero-text { position: relative; z-index: 1; }
.hero-text .lead { font-size: 1.15rem; }
.hero-text p { max-width: 620px; }
.hero-text .fine { font-size: .82rem; opacity: .8; margin-bottom: 18px; }
.hero-text .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.hero-text .btn-ghost:hover { background: rgba(255,255,255,.15); }
.hero-photo { position: relative; z-index: 1; display: block; transform: rotate(3deg); transition: transform .2s; }
.hero-photo:hover { transform: rotate(-2deg) scale(1.03); }
.hero-photo img { display: block; width: 100%; border-radius: 6px; border: 8px solid #fff; border-bottom-width: 34px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; text-align: center; }
.stat b { display: block; font-size: 2rem; color: var(--accent); line-height: 1.1; }
.stat span { font-size: .85rem; color: var(--muted); }
.quote { margin: 26px auto 0; max-width: 760px; text-align: center; font-size: 1.35rem; font-style: italic; color: var(--green-d); }
.quote cite { font-size: 1rem; font-style: normal; color: var(--muted); white-space: nowrap; }
.cat .count { font-size: .75rem; }
.robban-page { max-width: 1000px; margin: 24px auto 40px; background: #fff; padding: 10px 36px 30px; border-radius: 18px; box-shadow: var(--shadow); }
.robban-page .lead { font-size: 1.15rem; }
.robban-gallery { columns: 3 240px; column-gap: 20px; }
.robban-gallery figure { break-inside: avoid; margin: 0 0 22px; background: #fff; padding: 10px 10px 14px; border-radius: 4px; box-shadow: 0 3px 14px rgba(20,40,40,.15); }
.robban-gallery figure:nth-child(odd) { transform: rotate(-1.2deg); }
.robban-gallery figure:nth-child(even) { transform: rotate(1deg); }
.robban-gallery img { width: 100%; display: block; border-radius: 2px; }
.robban-gallery figcaption { font-size: .9rem; margin-top: 8px; }
.robban-gallery figcaption strong { display: block; font-size: 1rem; }
.quotes { columns: 2 280px; font-style: italic; color: var(--green-d); }
.quotes li { margin-bottom: 6px; break-inside: avoid; }
.err-img { width: 160px; border-radius: 10px; transform: rotate(-3deg); }
@media (max-width: 860px) {
  .hero-robban { grid-template-columns: 1fr; padding: 24px 20px; }
  .hero-robban h1 { font-size: 2.1rem; }
  .hero-photo { max-width: 240px; margin: 0 auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .robban-page { padding: 6px 18px 22px; }
}
@media (max-width: 720px) {
  .logo img { width: 170px; height: auto; }
}
