*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "SF Pro Text", "Inter", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at top, #233a5c 0%, #0e1f3a 60%, #07142a 100%) fixed;
  color: #e8edf6;
  min-height: 100vh;
  font-size: 14px;
}
button, input, select, textarea { font-family: inherit; cursor: pointer; }
input, select, textarea { cursor: text; }
.hidden { display: none !important; }
.tiny { font-size: 11px; opacity: 0.55; letter-spacing: 0.06em; }
code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: rgba(255,255,255,0.08);
  padding: 2px 8px; border-radius: 4px;
  font-size: 13px;
}

/* ===== top bar ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 28px; }
.brand-name { font-weight: 600; font-size: 17px; letter-spacing: 0.02em; }
.brand-tag { font-size: 11px; opacity: 0.55; letter-spacing: 0.1em; text-transform: uppercase; }

.auth { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth input {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 7px 12px; border-radius: 8px; font-size: 13px; min-width: 220px;
}
.auth input::placeholder { color: rgba(255,255,255,0.45); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #f5a623; }
.dot.connected { background: #4ade80; box-shadow: 0 0 12px rgba(74,222,128,0.6); }
.dot.error { background: #f87171; }
.status-text { font-size: 12px; opacity: 0.7; min-width: 60px; }

.btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 500;
}
.btn:hover { background: rgba(255,255,255,0.16); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #07140a;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(74,222,128,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(74,222,128,0.45); transform: translateY(-1px); }
.btn-primary:disabled { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); box-shadow: none; transform: none; }

main { max-width: 720px; margin: 32px auto; padding: 0 24px 64px; }

.card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 18px;
  backdrop-filter: blur(8px);
}
.card-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.card-header h3 { font-size: 14px; font-weight: 600; letter-spacing: 0.04em; }

/* ===== hero (latest UID) ===== */
.hero { text-align: center; padding: 36px 24px; }
.hero-label {
  font-size: 11px; letter-spacing: 0.16em; opacity: 0.55;
  text-transform: uppercase;
}
.hero-uid {
  font-size: 56px; font-weight: 700; letter-spacing: 0.04em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  margin: 12px 0 4px;
  background: linear-gradient(180deg, #fff 60%, #b6c8e6 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-meta { font-size: 13px; opacity: 0.6; margin-bottom: 22px; min-height: 18px; }
.hero-uid.fresh { animation: pulse 1.2s ease-out 1; }
@keyframes pulse {
  0%   { transform: scale(1.0);  filter: drop-shadow(0 0 0 transparent); }
  30%  { transform: scale(1.05); filter: drop-shadow(0 0 18px #4ade80); }
  100% { transform: scale(1.0);  filter: drop-shadow(0 0 0 transparent); }
}

/* ===== list ===== */
.recent-list { list-style: none; }
.recent-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.recent-list li:first-child { border-top: none; }
.recent-list .uid { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
.recent-list .meta { font-size: 11px; opacity: 0.6; }
.recent-list .right { display: flex; gap: 10px; align-items: center; }

/* ===== modal ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(7, 20, 42, 0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: #1a2742;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%; max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.link { background: none; border: none; color: #93c5fd; font-size: 13px; }

.row { margin-bottom: 14px; }
.row .lbl { display: inline-block; width: 64px; opacity: 0.55; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.uid-row code { font-size: 18px; padding: 4px 10px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: rgba(255,255,255,0.55);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-grid input,
.form-grid textarea,
select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 9px 12px; border-radius: 8px;
  color: #fff; font-size: 14px; font-family: inherit;
}
.form-grid input:focus,
.form-grid textarea:focus,
select:focus { outline: 2px solid #4ade80; border-color: transparent; }
.form-grid textarea { resize: vertical; min-height: 60px; }

.actions { display: flex; justify-content: flex-end; padding-top: 8px; }

/* ===== toast ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: rgba(34, 197, 94, 0.95);
  color: #07140a;
  padding: 12px 24px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
  z-index: 200;
  animation: slidein 0.3s ease;
}
.toast.hidden { display: none; }
.toast.error { background: rgba(248, 113, 113, 0.95); color: #2a0606; }
@keyframes slidein {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ===== responsive ===== */
@media (max-width: 540px) {
  .auth input { min-width: 140px; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-uid { font-size: 36px; }
}
