* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

header h1 { font-size: 1.25rem; font-weight: 600; }

nav { display: flex; gap: 0.5rem; }

.tab {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #ccc;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.tab.active { background: rgba(255,255,255,0.15); color: #fff; border-color: #fff; }

main { padding: 1rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Map */
#map-container { display: flex; gap: 1rem; height: calc(100vh - 120px); }
#map { flex: 1; border-radius: 8px; overflow: hidden; }

#map-controls {
  width: 280px;
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.control-group { display: flex; flex-direction: column; gap: 0.25rem; }
.control-group label { font-size: 0.8rem; font-weight: 600; color: #666; }
.control-group input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

#submit-aoi {
  background: #2d6a4f;
  color: #fff;
  border: none;
  padding: 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
#submit-aoi:disabled { background: #aaa; cursor: not-allowed; }
#submit-aoi:not(:disabled):hover { background: #1b4332; }

#map-status { font-size: 0.85rem; color: #666; min-height: 2rem; }

/* Groups list */
#groups-list { max-width: 900px; }

.group-card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.15s;
}
.group-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

.group-name { font-weight: 600; }
.group-meta { font-size: 0.8rem; color: #888; }

.status-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
}
.status-resolving { background: #fff3cd; color: #856404; }
.status-downloading { background: #cce5ff; color: #004085; }
.status-ready { background: #d4edda; color: #155724; }
.status-partial { background: #f8d7da; color: #721c24; }
.status-failed { background: #f8d7da; color: #721c24; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }

.modal-content {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
}

#modal-info { margin: 0.75rem 0; font-size: 0.9rem; color: #555; }

.tile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}
.tile-row:last-child { border-bottom: none; }

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin-top: 0.75rem;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: #2d6a4f;
  border-radius: 3px;
  transition: width 0.3s;
}

.loading { color: #999; padding: 2rem; text-align: center; }
.error { color: #c00; padding: 1rem; }

/* Shared buttons */
.control-group select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

#board-controls { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
#board-controls button, #submit-job-btn {
  background: #2d6a4f; color: #fff; border: none; padding: 0.5rem 1rem;
  border-radius: 4px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
#board-controls button:hover, #submit-job-btn:hover { background: #1b4332; }

/* Kanban board */
.board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  min-height: calc(100vh - 160px);
  align-items: flex-start;
}

.board-column {
  background: #e8e8e8;
  border-radius: 8px;
  min-width: 240px;
  max-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.board-column-header {
  padding: 0.6rem 0.75rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #444;
  border-bottom: 2px solid #d0d0d0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.board-column-body {
  padding: 0.5rem;
  min-height: 60px;
  flex: 1;
}

.job-card {
  background: #fff;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  cursor: grab;
  font-size: 0.85rem;
}
.job-card:active { cursor: grabbing; }
.job-card.drag-over { border: 2px dashed #2d6a4f; }

.job-card-name { font-weight: 600; margin-bottom: 0.2rem; }
.job-card-meta { font-size: 0.75rem; color: #888; }

.board-column.drag-over { background: #d4edda; }

/* Monitor */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 1200px;
}

.monitor-card {
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.monitor-card h3 { font-size: 1rem; margin-bottom: 0.5rem; }

.monitor-status {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.monitor-status.online { background: #28a745; }
.monitor-status.offline { background: #dc3545; }

.monitor-metrics { font-size: 0.8rem; color: #666; margin-top: 0.5rem; }

/* Audit */
.audit-table {
  width: 100%;
  max-width: 1100px;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.audit-table th, .audit-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.audit-table th { background: #f0f0f0; font-weight: 600; }
.audit-table tr:hover { background: #f9f9f9; }

/* Status badge additions */
.status-unassigned { background: #e2e3e5; color: #383d41; }
.status-assigned { background: #cce5ff; color: #004085; }
.status-claimed { background: #d1ecf1; color: #0c5460; }
.status-processing { background: #fff3cd; color: #856404; }
.status-uploading { background: #d4edda; color: #155724; }
.status-complete { background: #d4edda; color: #155724; }
.status-done { background: #d4edda; color: #155724; }
