:root {
  --nefa-blue: #0b5fff;
  --nefa-dark: #10213f;
  --bg: #f2f5fb;
  --card-bg: #ffffff;
  --text: #10213f;
  --muted: #6b7688;
  --error: #d92d20;
  --success: #12875a;
  --warn: #b54708;
}

* { 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);
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
}

.brand { position: relative; text-align: center; margin-bottom: 20px; }
.brand-logo-img { height: 40px; width: auto; }
.brand-sub { font-size: 14px; color: var(--muted); margin-top: 8px; padding: 0 70px; }

.support-btn {
  position: absolute;
  top: 0;
  right: 0;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #d9dee8;
  background: var(--card-bg);
  color: var(--nefa-blue);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.support-btn:hover { background: #eef4ff; }

.support-menu {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 30;
  width: 240px;
  background: var(--card-bg);
  border: 1px solid #d9dee8;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(16, 33, 63, 0.12);
  padding: 6px;
  text-align: left;
}

.support-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.support-option:hover { background: #eef4ff; }
.support-option svg { flex-shrink: 0; color: var(--nefa-blue); }

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 6px 24px rgba(16, 33, 63, 0.08);
}

.lead { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.5; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.req { color: var(--error); }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d9dee8;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
  font-family: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--nefa-blue); }
select:invalid { color: var(--muted); }

.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

button, .btn {
  padding: 12px 16px;
  background: var(--nefa-blue);
  color: white;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
button.full, .btn.full { width: 100%; margin-top: 22px; padding: 14px; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button:active:not(:disabled) { transform: translateY(1px); }
button.secondary, .btn.secondary { background: #eef1f6; color: var(--text); }
button.danger, .btn.danger { background: var(--error); }

.error {
  margin-top: 12px;
  color: var(--error);
  background: #fef1f0;
  border: 1px solid #fbd5d1;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.notice {
  margin-top: 12px;
  color: var(--warn);
  background: #fff6ed;
  border: 1px solid #fde3c4;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.success-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #e7f7ef;
  color: var(--success);
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}

#success-view h2, #status-view h2 { text-align: center; margin: 0 0 20px; }

.result-table, .spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.result-table td, .spec-table td { padding: 8px 0; border-bottom: 1px solid #eef1f6; }
.result-table td:first-child, .spec-table td:first-child { color: var(--muted); width: 45%; }
.result-table td.strong { font-weight: 700; color: var(--nefa-blue); }

.product-photo { width: 100%; border-radius: 12px; margin-bottom: 16px; }
.product-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.product-warranty-badge {
  display: inline-block;
  background: #eef4ff;
  color: var(--nefa-blue);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }

/* ==================== ADMIN ==================== */

.admin-shell { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.admin-header .brand-logo-img { height: 32px; }
.admin-user { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid #dde3ee;
  padding-bottom: 10px;
}
.admin-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.admin-nav a.active, .admin-nav a:hover { background: var(--nefa-blue); color: white; }

.admin-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(16, 33, 63, 0.06);
  margin-bottom: 20px;
}

.admin-card h2 { margin-top: 0; font-size: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f6;
  white-space: nowrap;
}
table.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.data-table tbody tr:hover { background: #f7f9fd; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.in_stock { background: #eef4ff; color: var(--nefa-blue); }
.badge.sold { background: #fff6ed; color: var(--warn); }
.badge.activated { background: #e7f7ef; color: var(--success); }
.badge.revoked { background: #fef1f0; color: var(--error); }

.spec-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.spec-row input { flex: 1; }
.spec-row button { padding: 8px 10px; }

.stat-tile { text-align: center; padding: 16px; background: #f7f9fd; border-radius: 12px; }
.stat-tile .num { font-size: 26px; font-weight: 800; color: var(--nefa-dark); }
.stat-tile .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

.login-wrap { max-width: 360px; margin: 60px auto; padding: 0 16px; }

.qr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.qr-tile { border: 1px dashed #c7cfdc; border-radius: 8px; padding: 10px; text-align: center; }
.qr-tile img { width: 100%; max-width: 160px; }
.qr-tile .tok { font-size: 12px; font-weight: 700; margin-top: 6px; letter-spacing: 1px; }
.qr-tile .pname { font-size: 11px; color: var(--muted); margin-top: 2px; }
.print-toolbar { margin-bottom: 16px; }
@media print {
  .print-toolbar, .admin-nav, .admin-header { display: none !important; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); }
}
