:root {
  --brand: #0b6e4f;
  --brand-dark: #084d38;
  --accent: #0e7c66;
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #1a2b28;
  --muted: #667572;
  --border: #dbe4e1;
  --danger: #c0392b;
  --success: #1e8e3e;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

header.topbar {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
}

header.topbar .sub {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 15px;
  margin: 0 0 14px 0;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

input[type=text], input[type=tel], input[type=number], select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px;
  margin-bottom: 14px;
  background: #fbfdfc;
}

textarea { min-height: 70px; resize: vertical; }

.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

button {
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  width: 100%;
}
.btn-primary:active { background: var(--brand-dark); }

.btn-secondary {
  background: #eef4f2;
  color: var(--brand-dark);
  width: 100%;
  border: 1px solid var(--border);
}

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

.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row button { flex: 1; }

.capture-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 10px;
  border: 1px solid var(--border);
  display: none;
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.ok { background: #e5f6ea; color: var(--success); }
.status-pill.pending { background: #fdf3e6; color: #b26a00; }

#sigCanvas {
  width: 100%;
  height: 160px;
  background: #fbfdfc;
  border-radius: 10px;
  border: 1px solid var(--border);
  touch-action: none;
}

.gps-box {
  background: #f0f7f4;
  border: 1px dashed var(--brand);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  margin-top: 10px;
}

.helper-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 12px;
}

.hidden { display: none !important; }

.center { text-align: center; }

.success-icon {
  font-size: 48px;
  color: var(--success);
  text-align: center;
  margin-bottom: 10px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-weight: 600;
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
}

.error-box {
  background: #fdeceb;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
th { background: #f0f7f4; color: var(--brand-dark); position: sticky; top: 0; }
tr:hover { background: #fafdfc; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }

.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  background: #fff; border-radius: var(--radius); padding: 20px; max-width: 480px; width: 100%;
  max-height: 85vh; overflow-y: auto;
}
.modal img { max-width: 100%; border-radius: 10px; margin-bottom: 10px; }
.close-x { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
