* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #f4f5f7; color: #1c1e21; font-size: 15px; line-height: 1.5;
}
a { color: #14634d; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  background: #14634d; color: #fff; padding: 0.6rem 1.2rem;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; }
.topbar nav a { color: #d8efe7; }
.topbar nav a:hover { color: #fff; text-decoration: none; }

main { max-width: 1100px; margin: 1.2rem auto; padding: 0 1rem; }
.card {
  background: #fff; border-radius: 10px; padding: 1.1rem 1.3rem; margin-bottom: 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
h2 { margin: 0 0 0.7rem; font-size: 1.15rem; }
.hint { color: #667; font-size: 0.85rem; }
.flash {
  background: #e3f4ec; border: 1px solid #9fd6bd; color: #14634d;
  border-radius: 8px; padding: 0.55rem 0.9rem; margin-bottom: 1rem;
}
.flash.error { background: #fdeaea; border-color: #efb3b3; color: #a12622; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; color: #667; }
th, td { padding: 0.45rem 0.6rem; border-bottom: 1px solid #eceef1; vertical-align: top; }
tr:last-child td { border-bottom: none; }
.nowrap { white-space: nowrap; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }

.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; background: #e8eaee; color: #444;
}
.badge.online { background: #d9f2e5; color: #14634d; }
.badge.reserved, .badge.event-reserved { background: #fdf1d6; color: #8a6410; }
.badge.offline, .badge.event-offline { background: #fdeaea; color: #a12622; }
.badge.paused { background: #e8eaee; color: #555; }
.badge.event-new { background: #d9f2e5; color: #14634d; }
.badge.event-price_drop { background: #d9ecfa; color: #155e94; }
.badge.event-price_rise { background: #fdf1d6; color: #8a6410; }
.badge.event-online_again { background: #e9e2f8; color: #5b3a9b; }
.badge.event-scraper_warning { background: #fdeaea; color: #a12622; }

.actions { white-space: nowrap; }
.actions form { display: inline; }
.actions button, .linklike {
  background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0.1rem 0.25rem;
}
.linklike { color: #d8efe7; }
.linklike:hover { color: #fff; }
.inline { display: inline; }

form.add-search { display: flex; gap: 0.5rem; flex-wrap: wrap; }
form.add-search input[name="url"] { flex: 1 1 380px; }
form.add-search input[name="name"] { flex: 0 1 180px; }
form.add-search input[name="interval_minutes"] { width: 5.5rem; }
input, select {
  padding: 0.45rem 0.6rem; border: 1px solid #ccd2d9; border-radius: 7px; font: inherit;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid #14634d33; border-color: #14634d; }
button[type="submit"] {
  background: #14634d; color: #fff; border: none; border-radius: 7px;
  padding: 0.5rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
}
button[type="submit"]:hover { background: #0f4f3d; }

.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li { padding: 0.35rem 0; border-bottom: 1px solid #eceef1; }
.event-list li:last-child { border-bottom: none; }
.event-time { color: #889; font-size: 0.8rem; margin-right: 0.4rem; }

.filter-row a { margin-right: 0.6rem; }
.filter-row a.active { font-weight: 700; text-decoration: underline; }

.ad-header { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.ad-image { width: 260px; max-width: 100%; border-radius: 10px; object-fit: cover; align-self: flex-start; }
.ad-price { font-size: 1.3rem; font-weight: 700; color: #14634d; margin: 0.2rem 0; }
table.kv td:first-child { color: #667; width: 10rem; }

.settings-form { max-width: 560px; }
.settings-form fieldset {
  border: 1px solid #dfe3e8; border-radius: 8px; margin: 0 0 1rem; padding: 0.8rem 1rem;
}
.settings-form legend { font-weight: 600; padding: 0 0.4rem; }
.settings-form label { display: block; margin: 0.5rem 0; }
.settings-form label input:not([type="checkbox"]), .settings-form select {
  display: block; width: 100%; margin-top: 0.2rem;
}
.settings-form .checkbox input { width: auto; display: inline; margin-right: 0.4rem; }

.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f4f5f7;
}
.login-card {
  background: #fff; border-radius: 12px; padding: 2rem 2.2rem; width: 340px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.login-card h1 { font-size: 1.2rem; margin: 0 0 1.2rem; text-align: center; }
.login-card label { display: block; margin: 0.7rem 0; }
.login-card input { width: 100%; margin-top: 0.25rem; }
.login-card button { width: 100%; margin-top: 1rem; }

@media (max-width: 700px) {
  .ads td:nth-child(5), .ads th:nth-child(5),
  .ads td:nth-child(6), .ads th:nth-child(6) { display: none; }
}
