* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif;
  background: #f4f5f7;
  color: #1c1c1e;
  padding-bottom: 72px;
}
header {
  background: #2563eb;
  color: white;
  padding: 16px;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header a { color: white; text-decoration: none; font-size: 14px; }
main { padding: 12px; max-width: 640px; margin: 0 auto; }

.card {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card.low { border-left: 4px solid #dc2626; }
.card.ok { border-left: 4px solid #16a34a; }

.med-name { font-size: 17px; font-weight: 600; }
.med-strength { color: #6b7280; font-size: 14px; }
.days-left { font-size: 15px; margin-top: 6px; }
.days-left.low { color: #dc2626; font-weight: 600; }
.days-left.ok { color: #16a34a; }

.tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: #eef2ff; color: #3730a3;
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
}

.fab {
  position: fixed; bottom: 20px; right: 20px;
  background: #2563eb; color: white;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  text-decoration: none;
}

form { display: flex; flex-direction: column; gap: 12px; }
label { font-size: 14px; font-weight: 500; margin-bottom: 4px; display: block; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 16px;
}
.schedule-row { display: flex; gap: 8px; align-items: center; }
.schedule-row select { flex: 2; }
.schedule-row input { flex: 1; }
.schedule-row button { flex: 0; background: #fee2e2; color: #b91c1c; border: none; border-radius: 8px; padding: 10px; }

button.primary {
  background: #2563eb; color: white; border: none;
  padding: 12px; border-radius: 8px; font-size: 16px; font-weight: 600;
}
button.secondary {
  background: #e5e7eb; color: #1c1c1e; border: none;
  padding: 10px; border-radius: 8px; font-size: 14px;
}

.slot-page main { max-width: 480px; text-align: center; }
.slot-title { font-size: 22px; font-weight: 700; margin: 16px 0; }
.slot-list { text-align: left; }
.slot-item {
  display: flex; justify-content: space-between;
  padding: 10px 4px; border-bottom: 1px solid #e5e7eb;
  font-size: 16px;
}
.slot-item .amt { font-weight: 600; color: #2563eb; }

.qr-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.qr-cell {
  background: white; border-radius: 12px; padding: 12px;
  text-align: center; page-break-inside: avoid;
}
.qr-cell img { width: 100%; max-width: 160px; }
.qr-cell .label { font-size: 13px; font-weight: 600; margin-top: 6px; }

@media print {
  header, .fab { display: none; }
  body { background: white; padding: 0; }
  .qr-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
