*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #222;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 1rem 2rem;
  background: #1f2937;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.app-main {
  flex: 1;
  display: flex;
  gap: 1rem;
  padding: 1rem 2rem 2rem;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-left {
  width: 28%;
  min-width: 260px;
}

.panel-right {
  flex: 1;
}

.card {
  background: #fff;
  border-radius: 0.6rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

h2, h3 {
  margin-top: 0;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

label input,
label textarea,
label select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  margin-top: 0.25rem;
  border-radius: 0.35rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

button {
  margin-top: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-size: 0.9rem;
}

button:hover {
  background: #1d4ed8;
}

.patient-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 350px;
  overflow-y: auto;
}

.patient-list li {
  padding: 0.4rem 0.5rem;
  border-radius: 0.4rem;
  cursor: pointer;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.patient-list li:hover {
  background: #e5e7eb;
}

.patient-list li.active {
  background: #2563eb;
  color: #fff;
}

.placeholder {
  font-size: 1rem;
  color: #6b7280;
  padding: 2rem;
  text-align: center;
}

.hidden {
  display: none !important;
}

.patient-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.patient-header h2 {
  margin-bottom: 0.3rem;
}

.patient-header p {
  margin: 0;
  font-size: 0.9rem;
  color: #4b5563;
}

.patient-meta {
  font-size: 0.85rem;
  color: #6b7280;
}

.patient-notes {
  font-size: 0.9rem;
  color: #4b5563;
  max-width: 50%;
}

.layout-two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.small {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.4rem;
}

.acts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.acts-table th,
.acts-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.3rem 0.4rem;
  text-align: left;
}

.acts-table th {
  font-weight: 600;
  background: #f3f4f6;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.gender-label {
  font-size: 0.85rem;
  color: #4b5563;
}

/* Body image area */
.body-map-wrapper {
  border-radius: 0.6rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 0.5rem;
  margin-bottom: 0.4rem;
}

#body-container {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  cursor: crosshair;
}

#body-container img {
  width: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

#marker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.marker {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #2563eb;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#temp-marker {
  position: absolute;
  width: 10px;  /* Smaller size */
  height: 10px;  /* Smaller size */
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #dc2626; /* Red color */
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
    padding: 1rem;
  }

  .panel-left {
    width: 100%;
  }

  .layout-two-columns {
    grid-template-columns: 1fr;
  }

  .patient-header {
    flex-direction: column;
  }

  .patient-notes {
    max-width: 100%;
  }
}