:root {
  --blue: #0877e8;
  --blue-dark: #055fbd;
  --ink: #111215;
  --muted: #6f7379;
  --line: #e2e3e5;
  --paper: #f7f7f5;
  --card: #fff;
  --green: #14945d;
  --orange: #ed7d20;
  --red: #d83939;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.site-header {
  position: sticky; top: 0; z-index: 20;
  height: 76px; padding: 0 clamp(20px, 4vw, 64px);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(247,247,245,.9); backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 27px; font-weight: 850; letter-spacing: -.04em; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }
.header-meta { display: flex; align-items: center; gap: 14px; }
.pulse { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(20,148,93,.1); }
.refresh-button {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 700; transition: border-color .2s, color .2s, transform .2s;
}
.refresh-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.refresh-button:disabled { opacity: .65; cursor: default; }
.refresh-icon { font-size: 17px; line-height: 1; display: inline-block; }
.refresh-button.running .refresh-icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.logout-button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; font-weight: 650; padding: 8px 4px; transition: color .2s;
}
.logout-button:hover { color: var(--red); }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 80px; }
.hero { padding: 52px 0 30px; max-width: 850px; }
.eyebrow { margin: 0 0 13px; text-transform: uppercase; letter-spacing: .15em; font-size: 11px; font-weight: 800; color: var(--blue); }
.price-guide { width: min(850px, 100%); margin: 0; }
.price-guide-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.price-guide-head span { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.price-guide-head small { color: var(--muted); font-size: 11px; }
.price-guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.price-guide-grid article { min-width: 0; padding: 17px 18px; border-right: 1px solid var(--line); }
.price-guide-grid article:last-child { border-right: 0; }
.price-guide-grid span, .price-guide-grid small { display: block; color: var(--muted); font-size: 11px; }
.price-guide-grid span { margin-bottom: 7px; font-weight: 700; color: #4b4f54; }
.price-guide-grid strong { display: block; margin-bottom: 4px; font-size: clamp(19px, 2.2vw, 27px); letter-spacing: -.04em; }
.guide-eur { display: block; margin: -1px 0 5px; color: var(--blue); font-size: 13px; font-style: normal; font-weight: 750; }
.price-guide-grid small b { color: var(--green); font-weight: 800; }


.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 70px; border: 1px solid var(--line); border-radius: 22px; background: #fff; overflow: hidden; }
.stats article { padding: 24px 26px; border-right: 1px solid var(--line); }
.stats article:last-child { border-right: 0; }
.stats strong { display: block; font-size: clamp(24px, 3vw, 37px); letter-spacing: -.045em; }
.stats span { color: var(--muted); font-size: 13px; }
.stats .stat-eur { display: block; min-height: 17px; color: var(--blue); font-size: 12px; font-weight: 750; }

.toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.chips { display: flex; gap: 9px; overflow-x: auto; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 15px; white-space: nowrap; cursor: pointer; font-size: 13px; font-weight: 650; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.select-wrap { display: grid; gap: 5px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.select-wrap select { border: 0; background: transparent; color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; outline: 0; }
.section-heading, .source-status > div:first-child { display: flex; align-items: flex-end; justify-content: space-between; margin: 38px 0 22px; }
h2 { margin: 0; font-size: 30px; letter-spacing: -.045em; }
.section-heading p:last-child { color: var(--muted); font-size: 13px; }

.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.listing-card { min-width: 0; background: var(--card); border: 1px solid #dedfe1; border-radius: 19px; overflow: hidden; transition: transform .22s, box-shadow .22s; }
.listing-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(18,27,39,.11); }
.listing-card.is-stale { opacity: .64; }
.image-wrap { position: relative; aspect-ratio: 4 / 3; background: #eceeed; overflow: hidden; }
.image-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .35s; }
.listing-card:hover img { transform: scale(1.025); }
.image-fallback { position: absolute; inset: 0; display: none; place-items: center; background: radial-gradient(circle at 35% 25%, #fff, #d9dcdf); }
.image-fallback span { display: grid; place-items: center; width: 90px; height: 90px; border-radius: 24px; background: #e9ebed; box-shadow: inset 0 0 0 1px #cfd2d5, 0 10px 25px rgba(0,0,0,.09); font-size: 34px; }
.deal-badge { position: absolute; left: 13px; top: 13px; padding: 7px 10px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .03em; background: rgba(17,18,21,.82); backdrop-filter: blur(8px); }
.deal-badge.good { background: var(--green); }
.deal-badge.urgent { background: var(--red); }
.card-body { padding: 17px; }
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.source-badge { color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .075em; }
.freshness { color: var(--muted); font-size: 11px; }
.card-body h3 { margin: 0; font-size: 17px; line-height: 1.28; letter-spacing: -.02em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px; }
.specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.specs span { padding: 6px 8px; border-radius: 8px; background: #f0f1f2; color: #4e5257; font-size: 11px; font-weight: 650; }
.deal-detail { display: grid; gap: 3px; margin-top: 11px; padding: 9px 11px; border-radius: 10px; background: #f7f8f9; }
.deal-diff { font-size: 12.5px; font-weight: 800; letter-spacing: -.01em; }
.deal-diff.down { color: var(--green); }
.deal-diff.up { color: var(--orange); }
.deal-diff.zero { color: var(--blue); }
.deal-ref { color: var(--muted); font-size: 11px; line-height: 1.35; }
.note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; min-height: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; padding-top: 15px; border-top: 1px solid #ececee; }
.price { font-size: 24px; letter-spacing: -.04em; }
.price .price-thb, .price .price-eur { display: block; }
.price .price-eur { margin-top: 3px; color: var(--blue); font-size: 13px; font-weight: 750; letter-spacing: 0; }
.location { color: var(--muted); font-size: 11px; text-align: right; }
.empty { grid-column: 1 / -1; padding: 70px 20px; text-align: center; border: 1px dashed #cfd1d3; border-radius: 20px; color: var(--muted); }

.source-status { margin-top: 80px; padding-top: 10px; border-top: 1px solid var(--line); }
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.health-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.health-card strong { display: block; margin-bottom: 4px; }
.health-card small { color: var(--muted); line-height: 1.35; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(20,148,93,.1); }
.status-dot.warn { background: var(--orange); box-shadow: 0 0 0 4px rgba(237,125,32,.1); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 4px rgba(216,57,57,.1); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 50; max-width: min(560px, calc(100vw - 32px));
  padding: 13px 20px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 650;
  box-shadow: 0 14px 38px rgba(18,27,39,.28); text-align: center;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); border-radius: 16px; }
.toast.info { background: var(--ink); }

/* ---------- Login-Seite ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; }
.auth-wrap { width: min(420px, calc(100% - 40px)); padding: 40px 0; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: clamp(30px, 6vw, 48px); box-shadow: 0 24px 60px rgba(20,35,55,.1);
}
.auth-brand { font-size: 24px; margin-bottom: 38px; }
.auth-card h1 { margin: 0 0 10px; font-size: 40px; letter-spacing: -.05em; }
.auth-copy { margin: 0 0 26px; color: var(--muted); font-size: 14.5px; }
.auth-error {
  margin: 0 0 20px; padding: 11px 14px; border-radius: 12px;
  background: #fdecec; border: 1px solid #f5c2c2; color: var(--red);
  font-size: 13.5px; font-weight: 650;
}
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.auth-form input {
  border: 1px solid #d9dadc; border-radius: 13px; padding: 13px 15px;
  font-size: 16px; outline: 0; transition: border-color .2s, box-shadow .2s;
}
.auth-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(8,119,232,.11); }
.auth-form button {
  margin-top: 8px; border: 0; border-radius: 13px; padding: 14px; cursor: pointer;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 750; transition: background .2s;
}
.auth-form button:hover { background: var(--blue); }

@media (max-width: 850px) {
  .listing-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats article:nth-child(2) { border-right: 0; }
  .stats article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .health-grid { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  main { width: min(100% - 28px, 1180px); }
  .site-header { padding: 0 15px; height: 66px; }
  .brand { font-size: 23px; }
  .brand-mark { width: 46px; height: 46px; }
  .pulse { display: none; }
  .refresh-label { display: none; }
  .refresh-button { padding: 9px 12px; }
  .logout-button { display: none; }
  .hero { padding-top: 34px; }
  .price-guide-grid { grid-template-columns: 1fr; }
  .price-guide-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .price-guide-grid article:last-child { border-bottom: 0; }
  .stats { margin-bottom: 50px; }
  .stats article { padding: 18px; }
  .toolbar { align-items: center; }
  .select-wrap { display: none; }
  .section-heading { align-items: flex-end; }
  .listing-grid { grid-template-columns: 1fr; }
  .image-wrap { aspect-ratio: 1.35 / 1; }
}
