html, body {
  touch-action: manipulation;
}

body {
  font-family: system-ui, -apple-system, Arial, sans-serif;
  margin: 0;
  padding: 16px;
  background: #f6f7fb;
  color: #111;
}
input, textarea, select {
  font-size: 16px;
}

/* HEADINGS */
h2 {
  margin: 16px 0 6px;
  font-size: 20px;
}

.subtext {
  margin: 0 0 12px;
  color: #666;
  font-size: 13px;
}

/* ===== ADD CUSTOMER CARD ===== */
#addCustomerForm {
  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 14px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

#addCustomerForm input {
  padding: 12px;
  font-size: 16px; /* IMPORTANT: prevents iOS zoom */
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  outline: none;
}

#addCustomerForm button {
  padding: 12px;
  font-size: 16px;
  border: none;
  border-radius: 10px;
  background: #2d6cdf;
  color: white;
  font-weight: 600;
}

/* ===== CUSTOMER LIST ===== */
#customerList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

/* ===== CUSTOMER CARD (KEY UPGRADE) ===== */
.row {
  background: white;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.05);

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Top line (name + ID) */
.row .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

/* Secondary info */
.row .meta {
  font-size: 13px;
  color: #666;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Actions */
.row .actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.row button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 14px;
}

.delete-btn {
  background: #ff3b3b;
  color: white;
}

.delete-btn:active {
  transform: scale(0.98);
}

/* FULL SCREEN OVERLAY */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 9999;
}

/* HIDE */
.hidden {
  display: none !important;
}

/* SPINNER */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid #2d6cdf;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* OVERLAY */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 9999;
}

/* HIDE */
.hidden {
  display: none !important;
}

/* MODAL CARD */
.modal-content {
  background: white;
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  padding: 16px;
}

/* HEADER */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header button {
  border: none;
  background: none;
  font-size: 18px;
}

/* BODY */
.modal-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ACTIONS */
.modal-actions {
  margin-top: 16px;
}

.modal-actions button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: #2d6cdf;
  color: white;
  font-weight: 600;
}
.note-section textarea {
  width: 95%;
  min-height: 70px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ddd;
  resize: none;
  font-size: 16px;
}

.note-section button {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: #2d6cdf;
  color: white;
  font-weight: 600;
}

#noteTimeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  background: #f6f7fb;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.tab {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #eee;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  background: #2d6cdf;
  color: white;
}

.tab-content.hidden {
  display: none;
}

.work-order-card {
  background: white;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: 0.15s ease;
}

.work-order-card:active {
  transform: scale(0.98);
}

.wo-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.wo-title {
  font-weight: 600;
  font-size: 15px;
}

.wo-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eee;
}

/* STATUS COLORS */
.status-1_scheduled { background: #dbeafe; color: #1e40af; }
.status-2_quoting { background: #fef3c7; color: #92400e; }
.status-3_approved { background: #dcfce7; color: #166534; }
.status-4_in_progress { background: #fee2e2; color: #991b1b; }
.status-5_completed { background: #e5e7eb; color: #374151; }
.status-6_invoiced { background: #ede9fe; color: #5b21b6; }

.wo-meta {
  margin-top: 8px;
  font-size: 13px;
  color: #666;
}