:root {
  --bg: #16181d;
  --surface: #1f222a;
  --surface-hover: #272b35;
  --text: #e8e9ec;
  --text-dim: #9a9ea8;
  --accent: #5b8cff;
  --danger: #ff5b6e;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  padding: 1.25rem 1.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 { margin: 0; font-size: 1.3rem; }

.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 1rem;
  font-size: 0.9rem;
}

.topbar nav a:hover { color: var(--text); }

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(360px, 90vw);
  text-align: center;
}

.auth-card h1 { margin-top: 0; }
.auth-msg { color: var(--text-dim); }

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.auth-card input {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #3a3f4a;
  background: #11131a;
  color: var(--text);
  font-size: 1rem;
}

.account-list {
  padding: 0.5rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 560px;
  margin: 0 auto;
}

.empty-state { color: var(--text-dim); text-align: center; margin-top: 3rem; }

.account-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-info { min-width: 0; }
.account-issuer { font-size: 0.85rem; color: var(--text-dim); }
.account-name { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-right { display: flex; align-items: center; gap: 0.6rem; }

.account-code {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 7ch;
  text-align: right;
}

.btn-reveal, .btn-primary, .btn-secondary {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-reveal, .btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: transparent; color: var(--text-dim); border: 1px solid #3a3f4a; }

.btn-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
}
.btn-delete:hover { color: var(--danger); }

.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.8rem;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 90vw;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

.scan-box {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: min(360px, 90vw);
}
#scan-video { width: 100%; border-radius: 10px; background: #000; }
.scan-error { color: var(--danger); font-size: 0.9rem; text-align: center; }

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.admin-section h2 { font-size: 1.1rem; }
.admin-section .hint { color: var(--text-dim); font-size: 0.85rem; margin-top: -0.4rem; }

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 480px;
  margin-bottom: 1.5rem;
}
.stacked-form select,
.stacked-form input[type="text"] {
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #3a3f4a;
  background: #11131a;
  color: var(--text);
  font-size: 0.95rem;
}
.scan-row { display: flex; gap: 0.5rem; }
.scan-row input { flex: 1; }

.inline-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.inline-form input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #3a3f4a;
  background: #11131a;
  color: var(--text);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #2a2e38;
  font-size: 0.88rem;
}
.admin-table th { color: var(--text-dim); font-weight: 500; }
