:root {
  color-scheme: light;
  --bg: #0f172a;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --border: #e5e7eb;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  background: #f8fafc;
  color: var(--text);
}

.page {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px 60px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  margin-bottom: 20px;
}

.form {
  display: grid;
  gap: 12px;
  max-width: 360px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: #e2e8f0;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn.secondary {
  background: #f1f5f9;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  cursor: pointer;
}

.modal-content {
  position: relative;
  z-index: 1001;
}

.modal-content.photo-fullscreen {
  width: 100vw;
  height: 100vh;
  background: #000;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100vw;
  max-height: 100vh;
}

#photoModalImg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
  z-index: 1002;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.error {
  color: var(--danger);
  margin-top: 12px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
}


.tag {
  display: inline-flex;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

/* Modal Styles */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  cursor: pointer;
}

.modal-content {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}

#photoModal .modal-content {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 0;
  border-radius: 0;
  background: #000;
}

.modal-content.report-details {
  max-width: 600px;
  width: 100%;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
  z-index: 1010;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

#photoModalImg {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  align-items: flex-end;
}

.xp-input-label {
  flex: 1;
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
}

.xp-input-label input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}

.xp-input-label input:focus {
  outline: none;
  border-color: var(--primary);
}

.report-detail-item {
  margin-bottom: 16px;
}

.report-detail-item strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-detail-item div {
  font-size: 14px;
}

.photo-thumbnail {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.photo-thumbnail:hover {
  color: #1e40af;
}

.photo-preview {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid var(--border);
}

.photo-preview:hover {
  transform: scale(1.1);
  border-color: var(--primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #1e40af;
}

.btn[data-loading="true"] {
  pointer-events: none;
  opacity: 0.6;
}

.btn.danger {
  background: var(--danger);
  color: white;
}

/* Security indicator */
.secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #dcfce7;
  color: #166534;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.secure-badge::before {
  content: "🔒";
}
