:root {
  --bg-desktop: #0b101b;
  --surface-white: #ffffff;
  --surface-muted: #efefef;
  --accent-cyan: #00e5ff;
  --accent-cyan-hover: #00cde6;
  --gold: #f5b922;
  --text-dark: #111827;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.14);
  --shadow-pill: 0 8px 22px rgba(0, 0, 0, 0.18);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-sans);
  background: radial-gradient(circle at top, #131e36 0%, #070b14 100%);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

.app-viewport {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.phone-frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-white);
}

@media (min-width: 520px) {
  .app-viewport {
    padding: 24px;
    perspective: 1200px;
  }
  .phone-frame {
    min-height: 820px;
    max-height: 900px;
    border-radius: 34px;
    box-shadow:
      0 32px 80px rgba(0, 0, 0, 0.65),
      0 10px 25px rgba(0, 229, 255, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.14);
    transform: rotateX(1deg);
    transition: transform 0.25s ease;
  }
  .phone-frame:hover {
    transform: rotateX(0deg);
  }
}

.screen {
  position: relative;
  flex: 1;
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.22s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= SCREEN 1: LOGIN ================= */
.screen-login {
  background: #020918;
  color: #ffffff;
  align-items: center;
  justify-content: flex-start;
  padding: 72px 26px 32px;
  text-align: center;
}

.circuit-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, rgba(0, 140, 255, 0.14), rgba(2, 9, 24, 0.58));
  z-index: 1;
  pointer-events: none;
}

.login-content {
  position: relative;
  z-index: 2;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-title {
  font-size: 2.05rem;
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: 0.01em;
  text-shadow: 0 4px 20px rgba(0, 160, 255, 0.5);
  margin-bottom: 18px;
}

.login-subtitle {
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: lowercase;
  opacity: 0.96;
  margin-bottom: 34px;
  text-shadow: 0 2px 14px rgba(0, 160, 255, 0.45);
}

.login-card-3d {
  width: 100%;
  max-width: 310px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(6, 20, 48, 0.72);
  border: 1px solid rgba(103, 232, 249, 0.28);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

.login-input {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  border: 1.5px solid rgba(125, 211, 252, 0.35);
  background: rgba(255, 255, 255, 0.96);
  color: #111827;
  padding: 0 18px;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
}

.login-input:focus {
  border-color: #00e5ff;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.25);
}

.buy-id-btn {
  margin-top: 16px;
  width: 100%;
  max-width: 310px;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #22ecff 0%, #00b8d4 100%);
  color: #041322;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 #00869e, 0 14px 28px rgba(0, 229, 255, 0.3);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.buy-id-btn:hover {
  transform: translateY(-2px);
}

.buy-id-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #00869e, 0 6px 12px rgba(0, 229, 255, 0.22);
}

.google-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 290px;
  height: 70px;
  padding: 0 26px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #111827;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow:
    0 6px 0 #cbd5e1,
    0 16px 34px rgba(0, 166, 255, 0.36);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.google-login-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 0 #cbd5e1,
    0 20px 40px rgba(0, 180, 255, 0.48);
}

.google-login-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #cbd5e1,
    0 6px 14px rgba(0, 166, 255, 0.3);
}

#google-gsi-container {
  margin-top: 16px;
  min-height: 44px;
}

.login-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.72);
}

.login-footer a {
  color: #67e8f9;
  text-decoration: none;
  font-weight: 600;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* ================= SCREEN 2: DASHBOARD ================= */
.screen-dashboard {
  background: #ffffff;
  padding: 16px 20px 28px;
  justify-content: space-between;
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dash-user-balance {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2.5px solid #e5c158;
  padding: 2px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.balance-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.55rem;
  font-weight: 800;
  color: #111111;
}

.icon-btn {
  border: none;
  background: #f3f4f6;
  color: #374151;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.icon-btn:hover {
  background: #e5e7eb;
}

.dash-illustration-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px;
}

.dash-illustration {
  width: 100%;
  max-width: 330px;
  height: auto;
}

.dash-welcome-chip {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 8px 14px 30px;
}

.tile-btn {
  border: none;
  border-radius: 28px;
  padding: 18px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile-personal {
  background: linear-gradient(180deg, #f5f5f5 0%, #e5e7eb 100%);
  color: #111111;
  box-shadow: 0 6px 0 #cbd5e1, 0 12px 24px rgba(0, 0, 0, 0.08);
}

.tile-keygen {
  background: linear-gradient(180deg, #22ecff 0%, #00cce6 100%);
  color: #111111;
  box-shadow: 0 6px 0 #009bb0, 0 12px 26px rgba(0, 229, 255, 0.32);
}

.tile-btn:hover {
  transform: translateY(-3px);
}

.tile-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.tile-label {
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ================= SCREEN 3: KEY GENERATE ================= */
.screen-keygen {
  position: relative;
  padding: 16px 18px 28px;
  justify-content: space-between;
  background: linear-gradient(180deg, #4b6149 0%, #2b3f36 48%, #162629 100%);
}

.forest-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.forest-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.keygen-content {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.keygen-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.keygen-left-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-back {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-pill);
  transition: transform 0.12s ease;
}

.pill-back:hover {
  transform: scale(1.05);
}

.pill-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: #111111;
  padding: 8px 18px 8px 12px;
  border-radius: 999px;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: var(--shadow-pill);
}

.pill-status {
  flex: 1;
  max-width: 235px;
  min-height: 62px;
  background: rgba(255, 255, 255, 0.96);
  color: #111111;
  border-radius: 999px;
  padding: 10px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: var(--shadow-pill);
}

.pill-status-label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1f2937;
}

.pill-status-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4b5563;
  word-break: break-word;
  margin-top: 2px;
}

.pill-status.is-error .pill-status-text {
  color: var(--danger);
}

.pill-status.is-success .pill-status-text {
  color: var(--success);
}

.keygen-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 22px 0;
}

.key-display-pill {
  position: relative;
  width: 100%;
  max-width: 295px;
  min-height: 76px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 999px;
  padding: 12px 58px 12px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-pill);
}

.key-display-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #111827;
  text-align: center;
  word-break: break-all;
  user-select: all;
}

.key-display-text.has-key {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.copy-key-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease;
}

.copy-key-btn:hover {
  background: #f3f4f6;
}

.plan-pill-btn {
  position: relative;
  width: 100%;
  max-width: 295px;
  height: 74px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #111827;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 0 #cbd5e1, 0 14px 26px rgba(0, 0, 0, 0.24);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.plan-pill-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #cbd5e1, 0 18px 30px rgba(0, 0, 0, 0.28);
}

.plan-pill-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #cbd5e1, 0 6px 12px rgba(0, 0, 0, 0.2);
}

.plan-pill-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.plan-cost-badge {
  position: absolute;
  right: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 4px 10px;
  border-radius: 999px;
}

.topup-pill-btn {
  width: 100%;
  max-width: 335px;
  height: 74px;
  margin: 0 auto;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #111827;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #cbd5e1, 0 14px 26px rgba(0, 0, 0, 0.24);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.topup-pill-btn:hover {
  transform: translateY(-2px);
}

.topup-pill-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #cbd5e1, 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* ================= MODALS ================= */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 28, 0.68);
  backdrop-filter: blur(4px);
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-sheet {
  width: 100%;
  max-height: 88%;
  background: #ffffff;
  border-radius: 26px 26px 0 0;
  padding: 20px 20px 26px;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(28px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #111827;
}

.modal-close {
  border: none;
  background: #f3f4f6;
  color: #374151;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.94rem;
  font-family: inherit;
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: #0284c7;
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: #0284c7;
  color: #ffffff;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  background: #0369a1;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.tabs.tabs-3 {
  grid-template-columns: repeat(3, 1fr);
}

.qr-box {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.qr-amount-badge {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
}

.qr-image-wrap {
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 0 #cbd5e1, 0 18px 34px rgba(15, 23, 42, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-image-wrap img {
  width: 196px;
  height: 196px;
  object-fit: contain;
}

.qr-status-line {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0369a1;
}

.qr-status-line.paid {
  color: var(--success);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 9px;
  border-radius: 9px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #4b5563;
  cursor: pointer;
}

.tab-btn.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.info-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.84rem;
  color: #334155;
  margin-bottom: 14px;
  line-height: 1.45;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
}

.profile-meta h3 {
  font-size: 1rem;
  font-weight: 800;
}

.profile-meta p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.section-heading {
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 14px 0 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 0.84rem;
}

.history-key {
  font-family: "Consolas", monospace;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
}

.history-sub {
  font-size: 0.74rem;
  color: #6b7280;
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-approved {
  background: #dcfce7;
  color: #166534;
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.mini-copy-btn {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.mini-copy-btn:hover {
  background: #e5e7eb;
}

.toast {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.94);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
