* { box-sizing: border-box; }
body {
  font-family: "Sarabun", "Segoe UI", sans-serif;
  margin: 0;
  background: #f4f5f7;
  color: #1f2430;
}
.center-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
  text-align: center;
  padding: 16px;
}
.hidden { display: none !important; }

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #1f6f4a;
  color: white;
}
.badge {
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  font-size: 0.8em;
}
.link-btn {
  background: none;
  border: none;
  color: white;
  text-decoration: underline;
  cursor: pointer;
}

#create-section { padding: 16px; }
.primary-btn {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  background: #1f6f4a;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

section h2 {
  padding: 0 16px;
  font-size: 1.1em;
}

#records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}
.record-card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.record-card h3 { margin: 0 0 6px; font-size: 1em; }
.record-card .meta { color: #666; font-size: 0.85em; margin-bottom: 8px; }
.record-card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.record-card button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #1f6f4a;
  color: white;
  cursor: pointer;
}
.record-card input[type="text"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 12px;
}
.modal-content {
  background: white;
  border-radius: 10px;
  padding: 20px;
  width: 100%;
  max-width: 520px;
}
#record-form { display: flex; flex-direction: column; gap: 14px; }
#record-form > label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; }
#record-form fieldset { border: 1px solid #ddd; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
#record-form fieldset label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
}
#record-form fieldset label input[type="text"],
#record-form fieldset label input[type="number"] {
  flex: 1;
  min-width: 0;
}
#record-form input[type="text"],
#record-form input[type="date"],
#record-form input[type="number"],
#record-form textarea {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-actions button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
#cancel-form-btn { background: #eee; }
#save-draft-btn { background: #1f6f4a; color: white; }

@media (max-width: 480px) {
  header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
