:root {
  --bg: #eef1f4;
  --surface: #fff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d5dde5;
  --accent: #0b6e6e;
  --accent-soft: #e3f2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.06), 0 8px 24px rgba(26, 35, 50, 0.06);
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

.top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.45rem;
  flex-shrink: 0;
  display: block;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: 0.25rem;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.count {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.filters {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: end;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.filters label.check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  text-transform: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding-bottom: 0.35rem;
}

select, button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0.45rem 0.7rem;
  min-height: 2.25rem;
}

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

button:hover { filter: brightness(1.05); }

.error {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 1.25rem;
  color: #a11;
}

.grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.pager {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.pager-top { padding-top: 0.25rem; }
.pager-bottom { padding-bottom: 2.5rem; }

.pager[hidden] { display: none; }

.pager-btn {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
  min-width: 6.5rem;
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  filter: none;
}

.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  min-width: 4.5rem;
  text-align: center;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(26, 35, 50, 0.12);
}

.card-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #cfd8e0;
  overflow: hidden;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-photo-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 0.85rem;
}

.photo-pills {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  pointer-events: none;
}

.photo-pill,
.chip.status-available,
.chip.status-option,
.chip.status-rented,
.chip.energy {
  display: inline-block;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.photo-pill.status-available,
.chip.status-available {
  background: #1f8a4c;
  color: #fff;
}

.photo-pill.status-option,
.chip.status-option {
  background: #d97706;
  color: #fff;
}

.photo-pill.status-rented,
.chip.status-rented {
  background: #64748b;
  color: #fff;
}

.photo-pill.energy-a,
.chip.energy-a { background: #1b7a3d; color: #fff; }
.photo-pill.energy-b,
.chip.energy-b { background: #4caf50; color: #fff; }
.photo-pill.energy-c,
.chip.energy-c { background: #9ccc65; color: #1a2332; }
.photo-pill.energy-d,
.chip.energy-d { background: #fdd835; color: #1a2332; }
.photo-pill.energy-e,
.chip.energy-e { background: #ff9800; color: #1a2332; }
.photo-pill.energy-f,
.chip.energy-f { background: #f4511e; color: #fff; }
.photo-pill.energy-g,
.chip.energy-g { background: #c62828; color: #fff; }
.photo-pill.energy-unknown,
.chip.energy-unknown { background: #94a3b8; color: #fff; }

.card-body {
  padding: 0.85rem 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-price {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.card-price span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.card-address {
  margin: 0;
  font-weight: 600;
  font-size: 0.98rem;
}

.card-city {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-meta {
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.chip.muted {
  background: #eef1f4;
  color: var(--muted);
}

.card-foot {
  margin-top: auto;
  padding-top: 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.card-more {
  color: var(--accent);
  font-weight: 600;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.back-link:hover { color: var(--accent); }

.detail-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 0 2.5rem;
}

.slider {
  position: relative;
  background: #c5ced6;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.slider.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.slider-track {
  height: 100%;
}

.slide {
  display: none;
  height: 100%;
}

.slide.is-active {
  display: block;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  min-height: 0;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.slider-btn.prev { left: 0.65rem; }
.slider-btn.next { right: 0.65rem; }

.slider-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.7rem;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  border: none;
  padding: 0;
  min-height: 0;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.dot.is-active { background: #fff; }

.slider-count {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: rgba(26, 35, 50, 0.55);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.detail-info {
  padding: 1.15rem 1.25rem 0;
}

.detail-title {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.detail-sub {
  margin: 1.4rem 0 0.5rem;
  font-size: 1rem;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.cta:hover { filter: brightness(1.06); }

.muted { color: var(--muted); }

.log-filters { padding-bottom: 0.5rem; }

.log-wrap {
  max-width: 1200px;
  margin: 0 auto 2.5rem;
  padding: 0 1.25rem;
  overflow-x: auto;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.log-table th,
.log-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.log-table th {
  background: #f5f7f9;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}

.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr:hover td { background: #f8fafb; }

.log-time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
}

.log-kind {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.kind-created { background: #dcfce7; color: #166534; }
.kind-updated { background: #e0f2fe; color: #075985; }
.kind-details { background: #e3f2f2; color: #0b6e6e; }
.kind-unavailable { background: #f1f5f9; color: #475569; }
.kind-error { background: #fee2e2; color: #991b1b; }
.kind-blocked { background: #ffedd5; color: #9a3412; }

.log-detail {
  color: var(--muted);
  max-width: 28rem;
  word-break: break-word;
}

.log-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.log-open {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
}

.log-open:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.desc { max-width: 70em; color: var(--ink); }
.desc p { margin: 0.45em 0; }
.desc ul, .desc ol { margin: 0.45em 0; padding-left: 1.35em; }
.desc a { color: var(--accent); }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
    padding: 0 0.85rem 1rem;
  }
  .pager { padding-left: 0.85rem; padding-right: 0.85rem; gap: 0.65rem; }
  .pager-bottom { padding-bottom: 2rem; }
  .filters { padding: 0.85rem; }
  .top-inner { padding: 0.9rem 0.85rem; }
  .slider { aspect-ratio: 4 / 3; }
  .detail-info { padding: 1rem 0.85rem 0; }
  .cta { max-width: none; }
}
