:root {
  --bg: #f7f6f3;
  --card-bg: #ffffff;
  --text: #1c1b19;
  --muted: #6b6a67;
  --border: #e4e2dd;
  --accent: #2f6f4f;

  --cat-carpenter: #8a5a2b;
  --cat-electric: #b58900;
  --cat-painter: #4a6fa5;
  --cat-flooring: #7a5c8e;
  --cat-cushioning: #b5546b;
  --cat-misc: #6b6a67;

  --status-open: #c0392b;
  --status-progress: #d9a441;
  --status-fixed: #2f6f4f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --card-bg: #211f1c;
    --text: #ece9e4;
    --muted: #9a9893;
    --border: #34322d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

header {
  padding: 20px 16px 8px;
  max-width: 900px;
  margin: 0 auto;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.filters {
  max-width: 900px;
  margin: 16px auto 0;
  padding: 0 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
}

.summary {
  max-width: 900px;
  margin: 10px auto 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.issue-list {
  max-width: 900px;
  margin: 12px auto 40px;
  padding: 0 16px;
}

.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.room-section {
  margin-bottom: 24px;
}

.room-section h2 {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.issue-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.issue-card:hover {
  transform: translateY(-1px);
}

.issue-card .badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
}

.badge.cat-carpenter { background: var(--cat-carpenter); }
.badge.cat-electric { background: var(--cat-electric); }
.badge.cat-painter { background: var(--cat-painter); }
.badge.cat-flooring { background: var(--cat-flooring); }
.badge.cat-cushioning { background: var(--cat-cushioning); }
.badge.cat-misc { background: var(--cat-misc); }

.badge.status-open { background: var(--status-open); }
.badge.status-in-progress { background: var(--status-progress); }
.badge.status-fixed { background: var(--status-fixed); }

.issue-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.issue-card .room {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.issue-card .desc {
  color: var(--text);
  font-size: 0.88rem;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.issue-card .thumb-strip {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.issue-card .thumb-strip img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.empty-state {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 16px;
  text-align: center;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  overflow-y: auto;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card-bg);
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  padding: 22px;
  position: relative;
}

.modal .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
}

.modal h2 {
  margin: 0 0 8px;
  padding-right: 30px;
}

.modal .room {
  color: var(--muted);
  margin-bottom: 10px;
}

.modal .desc {
  margin: 14px 0;
  line-height: 1.5;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
}
