/* ── PIN Lock Screen ────────────────────────────────────────────── */
#pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0d0f12;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .35s, visibility .35s;
}

#pin-overlay.unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pin-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 320px;
  padding: 0 20px;
}

.pin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #25d366;
  margin-bottom: 32px;
}

.pin-logo svg {
  width: 28px;
  height: 28px;
  color: #25d366;
  fill: #25d366;
}

.pin-label {
  font-size: .85rem;
  color: #8c9099;
  letter-spacing: .05em;
  margin-bottom: 24px;
}

/* Dots */
.pin-dots {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #2a2d33;
  background: transparent;
  transition: background .15s, border-color .15s, transform .15s;
}

.pin-dots span.filled {
  background: #25d366;
  border-color: #25d366;
  transform: scale(1.15);
}

.pin-dots span.error {
  background: #f05252;
  border-color: #f05252;
}

/* Error msg */
.pin-error {
  height: 20px;
  font-size: .78rem;
  color: #f05252;
  margin-bottom: 28px;
  text-align: center;
  transition: opacity .2s;
}

/* Keypad */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.pin-key {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #2a2d33;
  background: #141619;
  color: #e8eaed;
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover  { background: #1c1f24; border-color: #363a42; }
.pin-key:active { transform: scale(.92); background: #25d366; color: #000; border-color: #25d366; }

.pin-key--clear { color: #f05252; border-color: rgba(240,82,82,.25); font-size: .9rem; }
.pin-key--del   { color: #8c9099; font-size: 1rem; }

/* shake animation on wrong PIN */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

.pin-dots.shake { animation: shake .4s ease; }

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0f12;
  --surface:    #141619;
  --surface2:   #1c1f24;
  --border:     #2a2d33;
  --border2:    #363a42;
  --green:      #25d366;
  --green-dim:  #1a9448;
  --green-glow: rgba(37, 211, 102, 0.18);
  --red:        #f05252;
  --yellow:     #f5a623;
  --text:       #e8eaed;
  --text-dim:   #8c9099;
  --text-muted: #555b66;
  --accent:     #25d366;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 32px rgba(0,0,0,.45);
}

html { font-size: 16px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--green);
}

.logo svg {
  width: 26px;
  height: 26px;
  color: var(--green);
}

/* Status pill */
.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .02em;
  border: 1px solid transparent;
  transition: all .3s;
}

.pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.pill--init    { background: rgba(140,144,153,.12); border-color: rgba(140,144,153,.2); color: var(--text-dim); }
.pill--qr      { background: rgba(245,166,35,.12);  border-color: rgba(245,166,35,.25); color: var(--yellow); }
.pill--auth    { background: var(--green-glow);     border-color: rgba(37,211,102,.3);  color: var(--green); }
.pill--ready   { background: var(--green-glow);     border-color: rgba(37,211,102,.35); color: var(--green); }
.pill--ready .pill__dot { animation: pulse 2s infinite; }
.pill--fail    { background: rgba(240,82,82,.12);   border-color: rgba(240,82,82,.25);  color: var(--red); }
.pill--disc    { background: rgba(245,166,35,.12);  border-color: rgba(245,166,35,.25); color: var(--yellow); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

/* ── Main layout ────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
}

.panel {
  width: 100%;
  max-width: 560px;
}

.panel.hidden { display: none; }

/* ── Login Panel ────────────────────────────────────────────────── */
.panel__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-state { display: none; }
.login-state.active { display: block; }

.login-state h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  margin-top: 20px;
}

.muted {
  color: var(--text-dim);
  font-size: .9rem;
  line-height: 1.6;
}

.muted strong { color: var(--text); }
.muted.small  { font-size: .78rem; margin-top: 14px; color: var(--text-muted); }

.eyebrow {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 6px;
}

/* Spinner */
.spinner-wrap { display: flex; justify-content: center; margin-bottom: 4px; }

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border2);
  border-top-color: var(--text-dim);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner--green { border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Icon wrap */
.icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 auto 16px;
}
.icon-wrap--red    { background: rgba(240,82,82,.15);  color: var(--red); }
.icon-wrap--yellow { background: rgba(245,166,35,.15); color: var(--yellow); }

/* QR Code */
.qr-frame {
  position: relative;
  display: inline-block;
  margin: 28px auto 0;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(37,211,102,.3), 0 0 40px var(--green-glow);
}

.qr-frame img {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: 4px;
}

/* ── App Panel ──────────────────────────────────────────────────── */
.account-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-dim);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-info { flex: 1; min-width: 0; }

.account-name {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-number {
  font-size: .8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
}

.tab.active {
  background: var(--surface2);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.04); }

/* Tab content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Send form */
.send-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.field:last-child { margin-bottom: 0; }

label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: .01em;
}

.optional {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hint-inline {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 400;
}

input, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:focus, textarea:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 3px var(--green-glow);
}

.hint {
  font-size: .74rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}

.btn--primary {
  background: var(--green);
  color: #000;
  border-color: var(--green);
}

.btn--primary:hover { background: #20bf5a; border-color: #20bf5a; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,211,102,.3); }
.btn--primary:active { transform: none; box-shadow: none; }

.btn--danger  { background: var(--red); color: #fff; border-color: var(--red); }
.btn--danger:hover { opacity: .85; }

.btn--ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface2); color: var(--text); }

.btn--sm { padding: 8px 14px; font-size: .8rem; }
.btn--full { width: 100%; margin-top: 8px; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.hidden { display: none !important; }

/* Result box */
.result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  line-height: 1.5;
}

.result.success {
  background: rgba(37,211,102,.1);
  border: 1px solid rgba(37,211,102,.25);
  color: var(--green);
  display: block;
}

.result.error {
  background: rgba(240,82,82,.1);
  border: 1px solid rgba(240,82,82,.25);
  color: var(--red);
  display: block;
}

/* Activity log */
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.activity-log {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

.activity-log::-webkit-scrollbar { width: 6px; }
.activity-log::-webkit-scrollbar-track { background: transparent; }
.activity-log::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
  line-height: 1.5;
  animation: slideIn .25s ease;
}

.log-item:last-child { border-bottom: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.log-dot--green  { background: var(--green); }
.log-dot--red    { background: var(--red); }
.log-dot--yellow { background: var(--yellow); }
.log-dot--blue   { background: #60a5fa; }

.log-body { flex: 1; min-width: 0; }
.log-body .log-msg { color: var(--text); word-break: break-all; }
.log-body .log-time { color: var(--text-muted); font-size: .74rem; margin-top: 2px; }

.log-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}

/* Bulk results table */
.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-top: 4px;
}

.bulk-table th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.bulk-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  word-break: break-all;
}

.bulk-table tr:last-child td { border-bottom: none; }

/* ── API Keys tab ───────────────────────────────────────────────── */
.api-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.api-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.api-section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}

.api-section-sub {
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-top: 4px;
}

/* Key list */
.key-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.key-list-loading {
  color: var(--text-muted);
  font-size: .83rem;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  animation: slideIn .2s ease;
}

.key-item__info { flex: 1; min-width: 0; }

.key-item__label {
  font-weight: 500;
  font-size: .88rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.key-item__val {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: .78rem;
  color: var(--green);
  background: rgba(37,211,102,.07);
  border: 1px solid rgba(37,211,102,.15);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background .2s;
  user-select: all;
  word-break: break-all;
}

.key-item__val:hover { background: rgba(37,211,102,.13); }

.key-item__date {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.key-item__actions { display: flex; gap: 6px; flex-shrink: 0; }

.copy-key-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: .74rem;
  cursor: pointer;
  transition: all .2s;
}

.copy-key-btn:hover { background: var(--surface2); color: var(--text); }

.del-key-btn {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(240,82,82,.25);
  background: transparent;
  color: var(--red);
  font-size: .74rem;
  cursor: pointer;
  transition: all .2s;
  opacity: .7;
}

.del-key-btn:hover { opacity: 1; background: rgba(240,82,82,.1); }

/* Doc tabs */
.doc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.doc-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: .8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}

.doc-tab.active { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.doc-tab:hover:not(.active) { color: var(--text); }

.doc-block { display: none; }
.doc-block.active { display: block; }

.doc-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.code-block {
  background: #0a0c0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: 'Courier New', monospace;
  font-size: .76rem;
  color: #a8d8b0;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
}

.copy-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: .72rem;
  border-radius: 5px;
  cursor: pointer;
  transition: all .2s;
}

.copy-btn:hover { background: var(--surface2); color: var(--text); }
.copy-btn.copied { color: var(--green); border-color: rgba(37,211,102,.3); }

.ic {
  font-family: 'Courier New', monospace;
  font-size: .8em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text);
}

/* Endpoint table */
.ep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.ep-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: .74rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ep-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}

.ep-table tr:last-child td { border-bottom: none; }

.ep-table code {
  font-family: 'Courier New', monospace;
  font-size: .82em;
  color: var(--text-dim);
}

.method {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: .72rem;
  letter-spacing: .04em;
}

.method.post { background: rgba(37,211,102,.15); color: var(--green); }
.method.get  { background: rgba(96,165,250,.15); color: #60a5fa; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 14px 18px; }
  main   { padding: 24px 12px; }
  .panel__inner { padding: 32px 20px; }
  .send-form { padding: 20px 16px; }
}
