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

:root {
  --navy: #19376D;
  --gold: #DAA520;
  --light-blue: #E8EEFF;
  --gray-bg: #EAEAEA;
  --white: #FFFFFF;
  --text-dark: #333;
}

body {
  font-family: Arial, sans-serif;
  background: #f0f2f5;
  color: var(--text-dark);
  min-height: 100vh;
  padding-top: 56px;
}

/* Navigation */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--navy);
  color: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.nav-brand { font-weight: bold; font-size: 16px; letter-spacing: 1px; color: var(--gold); }
.nav-btn { background: none; border: none; color: var(--white); font-size: 24px; cursor: pointer; }

/* Side Menu */
.side-menu {
  position: fixed; top: 0; right: 0; bottom: 0; width: 260px; z-index: 200;
  background: var(--navy); color: var(--white);
  transform: translateX(100%); transition: transform 0.3s ease;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.side-menu.show { transform: translateX(0); }
.side-menu .menu-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.side-menu .menu-header h3 { color: var(--gold); }
.side-menu a { display: block; padding: 16px 20px; color: var(--white); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; font-size: 15px; }
.side-menu a:hover { background: rgba(255,255,255,0.1); }
.menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; }
.close-btn { background: none; border: none; color: var(--white); font-size: 28px; cursor: pointer; }

/* Views */
.view { display: none; padding: 16px; max-width: 600px; margin: 0 auto; }
.view.active { display: block; }

/* Cards */
.form-card {
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
.card-header {
  background: var(--navy);
  color: var(--gold);
  font-weight: bold;
  font-size: 18px;
  padding: 16px 20px;
  letter-spacing: 1px;
}
.section-header {
  background: var(--navy);
  color: var(--white);
  font-weight: bold;
  font-size: 14px;
  padding: 10px 20px;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Form Elements */
.form-section { padding: 16px 20px; }
.form-row { display: flex; gap: 12px; margin-bottom: 8px; }
.form-row > * { flex: 1; }
.form-group { margin-bottom: 12px; position: relative; }
.form-group label, .form-section > label {
  display: block;
  font-size: 11px;
  font-weight: bold;
  color: var(--navy);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input[type="text"], input[type="email"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  font-family: Arial, sans-serif;
  background: var(--light-blue);
  color: var(--navy);
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(25,55,109,0.15);
}
textarea { resize: vertical; }

.gps-btn {
  position: absolute; right: 4px; bottom: 4px;
  background: var(--navy); color: var(--white);
  border: none; border-radius: 4px;
  padding: 6px 10px; font-size: 12px; cursor: pointer;
}

/* Radio */
.radio-group { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.radio-group > label:first-child { font-size: 13px; font-weight: bold; color: var(--navy); }
.radio-label { display: flex; align-items: center; gap: 4px; font-size: 14px; cursor: pointer; }

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-slot {
  aspect-ratio: 4/3;
  background: var(--gray-bg);
  border: 2px dashed #bbb;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.photo-slot span { color: #999; font-size: 13px; }
.photo-slot img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
}
.photo-slot .remove-photo {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220,0,0,0.85); color: white;
  border: none; border-radius: 50%;
  width: 24px; height: 24px;
  font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}

/* Signature */
.signature-section canvas {
  border: 2px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  width: 100%;
  max-width: 400px;
  touch-action: none;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--navy);
  color: var(--gold);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
}
.btn-small {
  padding: 8px 14px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.form-actions { padding: 16px 20px; }

/* Lists */
.list { margin-top: 12px; }
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  background: var(--light-blue);
  border-radius: 8px;
  margin-bottom: 8px;
}
.list-item .item-info h4 { color: var(--navy); font-size: 15px; }
.list-item .item-info p { color: #666; font-size: 12px; margin-top: 2px; }
.list-item .item-actions { display: flex; gap: 8px; }
.list-item .item-actions button {
  background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px;
}

/* Contacts */
.contact-list { margin-bottom: 8px; }
.contact-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--light-blue);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}
.contact-item button { background: none; border: none; color: #c00; cursor: pointer; font-size: 16px; }

/* Recipients */
.recipient-list { margin-bottom: 8px; }
.recipient-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--light-blue);
  border-radius: 20px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  color: var(--navy);
}
.hint { font-size: 12px; color: #888; margin-top: 4px; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-content {
  background: var(--white);
  border-radius: 12px;
  width: 100%; max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { color: var(--navy); }
.modal-header .close-btn { color: var(--navy); }

/* Loading */
.loading {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(25,55,109,0.9);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--white);
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 480px) {
  .form-row { flex-direction: column; gap: 0; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .card-header { font-size: 16px; }
}
