:root { color-scheme: light dark; }
/* บังคับซ่อนทุก element ที่มี attribute hidden */
[hidden] { display: none !important; }

body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; }
* { box-sizing: border-box; }
.wrap { max-width: 720px; margin: 0 auto; padding: 28px; }
.card { border: 1px solid #e5e7eb; border-radius: 16px; padding: 24px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.logo { height: 48px; width: auto; display: block; object-fit: contain; }
.title { font-size: 1.5rem; font-weight: 700; margin: 0 0 12px; }
.muted { color: #6b7280; font-size: 0.95rem; }

.row { display: grid; grid-template-columns: 1fr auto; gap: 14px; margin-top: 20px; }
input[type="text"] { font-size: 1rem; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 12px; width: 100%; }
button { padding: 12px 16px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 600; }
.btn { background: #111827; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn .icon { width: 18px; height: 18px; display: block; fill: currentColor; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.result { margin-top: 22px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.item { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; }
.label { font-size: 0.85rem; color: #6b7280; }
.value { font-size: 1.05rem; font-weight: 600; margin-top: 2px; }
.sn { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.badge { display: inline-block; padding: 6px 10px; font-size: .85rem; border-radius: 999px; background: #f3f4f6; }
.badge--ok { background: #10b981; color: #fff; }
.badge--expired { background: #ef4444; color: #fff; }

/* S/N line layout */
.item--sn { display:flex; justify-content: space-between; align-items: flex-start; gap:12px; flex-wrap:wrap; }
.item--sn .sn-block { min-width: 160px; flex:1 1 auto; }
.item--sn .badge { flex:0 0 auto; white-space: nowrap; }

.loading { display: flex; align-items: center; gap: 8px; color: #6b7280; margin-top: 16px; }
.spinner { width: 16px; height: 16px; border: 2px solid #e5e7eb; border-top-color: #111827; border-radius: 999px; animation: spin 1s linear infinite; }

.center { text-align: center; }
.fade { animation: fade .2s ease-in-out; }
@keyframes fade { from { opacity: .0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
@keyframes spin { to { transform: rotate(360deg);} }

/* ป้องกันปุ่มทับช่องกรอกบนหน้าจอเล็ก: สลับเป็นแนวตั้ง */
@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .item--sn { flex-direction: row; }
  .item--sn .badge { order: 2; }
  .item--sn .sn-block { order: 1; }
}

.footer { margin-top: 32px; font-size: .9rem; color: #6b7280; text-align: center; }

/* ===== รูปเครื่อง ===== */
.photo { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; }
.photo__img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 8px; background: #f9fafb; }
.photo__caption { font-size: 0.85rem; color: #6b7280; margin-top: 8px; }
