* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: #172033; background: #eef4fb; }
button, input, select { font: inherit; }
.admin-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid #d8e0eb;
}
.app-title { font-weight: 900; font-size: 18px; }
.tenant-text { color: #64748b; font-size: 13px; }
.admin-header button, .filter-panel button, .status-editor button {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: #1264d8;
  color: white;
  font-weight: 800;
}
.filter-panel {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 160px 160px minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #d8e0eb;
}
.filter-panel label, .status-editor label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: #334155; }
.filter-panel input, .filter-panel select, .status-editor select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  background: white;
}
.admin-main {
  height: calc(100vh - 137px);
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1fr);
  gap: 12px;
  padding: 12px;
}
.map-card, .list-card { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 28px rgba(15, 23, 42, .08); }
#map { width: 100%; height: 100%; min-height: 360px; }
.list-card { display: grid; grid-template-rows: auto 1fr auto; }
.list-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #e2e8f0; }
.list-header h1 { font-size: 17px; margin: 0; }
.list-actions { display: flex; align-items: center; gap: 10px; }
#countText { color: #64748b; font-weight: 800; }
#csvDownloadButton {
  border: 1px solid #1264d8;
  border-radius: 999px;
  padding: 7px 11px;
  background: white;
  color: #1264d8;
  font-weight: 800;
  white-space: nowrap;
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; border-bottom: 1px solid #e2e8f0; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #eff6ff; }
.status-text { padding: 8px 12px; color: #64748b; font-size: 13px; border-top: 1px solid #e2e8f0; }
.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e0ecff;
  color: #124a9c;
  font-weight: 800;
  white-space: nowrap;
  font-size: 12px;
}
.map-focus-button {
  border: 1px solid #1264d8;
  border-radius: 999px;
  padding: 5px 10px;
  background: white;
  color: #1264d8;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.map-focus-button:hover { background: #eff6ff; }
.map-focus-button:focus-visible { outline: 3px solid rgba(18, 100, 216, .28); outline-offset: 2px; }
.map-focus-button:disabled { border-color: #cbd5e1; color: #94a3b8; background: #f8fafc; cursor: not-allowed; }
.admin-note-marker { background: transparent; border: none; }
.admin-note-marker span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px 999px 999px 4px;
  transform: rotate(-45deg);
  color: white;
  font-weight: 900;
  border: 3px solid white;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.admin-note-marker span b { transform: rotate(45deg); font-size: 13px; }
.admin-note-marker-new span { background: #f97316; }
.admin-note-marker-accepted span { background: #0891b2; }
.admin-note-marker-unconfirmed span { background: #64748b; }
.admin-note-marker-checked span { background: #1264d8; }
.admin-note-marker-contacted span { background: #7c3aed; }
.admin-note-marker-done span { background: #16a34a; }
.admin-note-marker.is-focused span { animation: marker-focus 600ms ease-in-out 2; }
@keyframes marker-focus {
  0%, 100% { transform: rotate(-45deg) scale(1); }
  50% { transform: rotate(-45deg) scale(1.35); }
}
.modal-backdrop { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, .45); }
.modal-backdrop.hidden { display: none; }
.modal { width: min(680px, 100%); max-height: min(86vh, 760px); overflow: auto; background: white; border-radius: 18px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.close-btn { border: none; background: #e2e8f0; color: #172033; width: 36px; height: 36px; border-radius: 999px; font-size: 20px; }
.detail-content { display: grid; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-grid div { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; display: grid; gap: 4px; }
.detail-grid strong { color: #64748b; font-size: 12px; }
.detail-content img { width: 100%; max-height: 420px; object-fit: contain; border-radius: 14px; background: #f1f5f9; }
.memo { white-space: pre-wrap; line-height: 1.65; padding: 12px; border-radius: 14px; background: #f8fafc; }
.status-editor { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
@media (max-width: 800px) {
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel button { grid-column: span 2; }
  .admin-main { height: auto; grid-template-columns: 1fr; }
  .map-card { height: 42vh; min-height: 320px; }
  .detail-grid, .status-editor { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .admin-header { height: auto; align-items: flex-start; }
  .list-header { align-items: flex-start; gap: 8px; }
  .list-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
  .filter-panel { grid-template-columns: 1fr; }
  .filter-panel button { grid-column: auto; }
  .admin-main { padding: 8px; }
  th, td { padding: 8px; font-size: 13px; }
}
