/* Global & Variables */
:root {
  --brand: #1D499B;
  --danger: #b91c1c;
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 10px 25px rgba(2, 6, 23, .08);
  --radius: 14px;
}

html, body {
  margin: 0;
  height: 100%;
}

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

/* Layout */
.wrap {
  max-width: 1280px;
  margin: 28px auto;
  padding: 0 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Typography */
h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.3px;
}

.sub {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

.k {
  font-size: 12px;
  color: #334155;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .05em;
}

.v {
  margin-top: 6px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.mini {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

a:hover {
  text-decoration: underline;
}

/* Components */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 16px;
  margin-bottom: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--brand);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(2, 6, 23, .03);
  display: inline-block;
  text-decoration: none;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}

.btn.small {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

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

.btn.danger-solid {
  background-color: #dc2626;
  color: white;
  border: 0;
}

.btn:hover {
  filter: brightness(.98);
}

.btn:active {
  transform: translateY(1px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: 12px;
  color: #0f172a;
}

.alert {
  background: #fee2e2;
  color: var(--danger);
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(185, 28, 28, .25);
  font-weight: 900;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  font-size: 12px;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: .05em;
}

td {
  font-size: 14px;
}

.manifest-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.manifest-table th {
  background: #f8fafc;
}

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

.manifest-table td:last-child {
  text-align: right;
}

.manifest-scroll {
  margin-bottom: 14px;
  max-height: 240px;
  overflow-y: auto;
}

.manifest-table th {
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Forms */
.field {
  margin: 10px 0;
}

label {
  display: block;
  font-weight: 900;
  font-size: 12px;
  color: #334155;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

input:focus,
select:focus {
  border-color: rgba(29, 73, 155, .5);
  box-shadow: 0 0 0 3px rgba(29, 73, 155, .12);
}

.error-input {
  border-color: var(--danger);
  background: #fff5f5;
}

.error-text {
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  font-weight: 800;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal {
  width: min(920px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfdff;
}

.modal-title {
  font-weight: 900;
}

.x {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 900;
  color: #334155;
}

.modal-body {
  padding: 16px;
}

.hr-modal {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.modal-subtitle {
  font-weight: 900;
  margin: 14px 0 8px;
}

.modal-sm {
  width: 400px;
  max-width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #fbfdff;
}

/* Page-specific styles */

/* Login / Register Page */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-container h2 {
  margin-top: 0;
  color: #333;
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #666;
  font-weight: normal;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 1rem;
}

.auth-footer {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.login-container button {
  width: 100%;
  padding: 0.75rem;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.login-container button:hover {
  background-color: #0056b3;
}

.error-msg, .success-msg {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: none;
}

.error-msg {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

.success-msg {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

/* Map View */
.map-body {
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

#info {
  position: absolute;
  top: 12px;
  left: 12px;
  display: none;
  background: rgba(255, 255, 255, .92);
  border-radius: 10px;
  padding: 10px 12px;
  font: 13px/1.3 system-ui, Arial, sans-serif;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  z-index: 2;
  pointer-events: auto;
  max-width: min(90vw, 320px);
}

#info .value {
  font-weight: 700;
}

@media (max-width: 640px) {
  #info {
    top: 8px;
    left: 8px;
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Utilities */
.mr-auto { margin-right: auto; }
.text-center { text-align: center; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }

.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

.pt-12 { padding-top: 12px; }
.p-12 { padding: 12px; }

.border-top { border-top: 1px solid var(--border); }
.w-100 { width: 100%; }
.bold { font-weight: 900; }
.nowrap { white-space: nowrap; }
.text-13 { font-size: 13px; }

.map-container { position: relative; width: 100%; height: 360px; }
.map-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
