:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #06111f;
  color: #f5f8fc;
  --tappa-blue: #35a5df;
  --tappa-blue-glow: rgba(53, 165, 223, 0.4);
  --tappa-gold: #ffc45c;
  --card-bg: rgba(8, 28, 48, 0.94);
  --card-border: rgba(117, 207, 255, 0.22);
  --input-bg: #0c2948;
  --input-border: #315a84;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #153c63 0%, #081b30 55%, #040c16 100%);
  color: #f5f8fc;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #75cfff;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: #bde7ff; }

.account-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 80px;
}

.account-shell > header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tappa-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.tappa-logo-link img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #9edfff;
}
.back-link:hover { color: #fff; }

.back-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #174268;
  color: #75cfff;
  font-size: 14px;
  transition: transform 0.15s ease;
}
.back-link:hover .back-arrow {
  transform: translateX(-3px);
  background: #35a5df;
  color: #071a2e;
}

.eyebrow {
  margin: 0;
  color: #75cfff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}

.header-desc {
  margin: 0;
  color: #b0cbe2;
  font-size: 0.95rem;
  max-width: 680px;
}

/* Status Card */
.status-card {
  padding: 12px 18px;
  margin: 18px 0 24px;
  border: 1px solid rgba(53, 165, 223, 0.35);
  border-radius: 14px;
  background: rgba(8, 28, 48, 0.85);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color: #b9d5e8;
  font-size: 0.9rem;
  font-weight: 600;
}
.status-card.online {
  border-color: rgba(61, 213, 152, 0.5);
  color: #52e3a8;
}
.status-card.error {
  border-color: rgba(255, 107, 107, 0.6);
  color: #ff9e9e;
}

/* Auth Section */
.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.auth-panel, .profile-card, .admin-console-card {
  padding: 24px;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.auth-panel h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  font-weight: 800;
}

label {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: #b9d5e8;
  font-size: 0.86rem;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--tappa-blue);
  box-shadow: 0 0 0 3px var(--tappa-blue-glow);
}

.password-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.password-wrap input {
  flex: 1;
  min-width: 0;
}

.toggle-password {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: #0f3358;
  color: #9edfff;
  cursor: pointer;
  font-size: 15px;
}
.toggle-password:hover {
  background: #174574;
  color: #fff;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--tappa-blue);
  color: #071a2e;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease;
}
button:hover:not(:disabled) {
  background: #52b7eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--tappa-blue-glow);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}
button.secondary {
  background: #19436c;
  color: #f5f8fc;
  border: 1px solid rgba(117, 207, 255, 0.25);
}
button.secondary:hover:not(:disabled) {
  background: #235485;
}

.forgot-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #75cfff;
}

/* Profile Section */
.profile-card {
  margin-top: 20px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.profile-avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #75cfff;
  background: #103357;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.profile-avatar-fallback {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #75cfff;
  background: #19486f;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 900;
}

.profile-avatar-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.avatar-upload-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid rgba(117, 207, 255, 0.4);
  border-radius: 999px;
  background: #13395f;
  color: #d8efff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.avatar-upload-button:hover {
  background: #1c4d7e;
  color: #fff;
}

.remove-photo-button {
  padding: 6px 14px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 999px;
  background: #3f1919;
  color: #ffb8b8;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-identity h2 {
  margin: 4px 0 8px;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
}

dl.profile-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 16px 0;
  padding: 16px;
  border-radius: 12px;
  background: #092038;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
dl.profile-details div {
  display: grid;
  gap: 4px;
}
dt {
  font-size: 0.75rem;
  color: #8db5d8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}
dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-badge-golden-crew {
  color: #fff0d0;
  border-color: #d4a743;
  background: linear-gradient(145deg, #594212, #291c06);
  box-shadow: 0 0 12px rgba(255, 204, 92, 0.35);
}
.role-badge-crew {
  color: #ffe6bd;
  border-color: #aa7d37;
  background: #332311;
}
.role-badge-merchant {
  color: #d4ffd8;
  border-color: #38a355;
  background: #113d1f;
  box-shadow: 0 0 10px rgba(56, 163, 85, 0.3);
}
.role-badge-merchant::before { content: "🛒 "; }
.role-badge-driver {
  color: #fff4d0;
  border-color: #d49a38;
  background: #3d2c11;
  box-shadow: 0 0 10px rgba(212, 154, 56, 0.3);
}
.role-badge-driver::before { content: "🚗 "; }
.role-badge-mod {
  color: #ded6ff;
  border-color: #7b69c4;
  background: #241940;
}
.role-badge-admin, .role-badge-sudo {
  color: #d1f4ff;
  border-color: #35a5df;
  background: #0e375d;
  box-shadow: 0 0 10px rgba(53, 165, 223, 0.3);
}
.role-badge-pending {
  color: #e5dcc7;
  border-color: #7e6f4f;
  background: #241d10;
}
.role-badge-pending::before { content: "⏳ "; }
.role-badge-member {
  color: #d9e9f6;
  border-color: #41678c;
  background: #112d4a;
}

.pending-notice {
  margin: 20px 0;
  padding: 18px 20px;
  border: 1px solid #c79532;
  border-radius: 14px;
  background: linear-gradient(155deg, #32230e, #181106);
}
.pending-notice h3 { margin: 0 0 6px; color: #ffc45c; }
.pending-notice p { margin: 0; color: #dfcb9f; font-size: 0.9rem; }

/* Tappa Friend Bump Section */
.tappa-friend-card {
  margin: 24px 0;
  padding: 22px;
  border: 1px solid rgba(53, 165, 223, 0.35);
  border-radius: 16px;
  background: linear-gradient(160deg, #0d3154, #081d34);
}

.friend-card-content {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
}

.tappa-qr-canvas {
  width: 140px;
  height: 140px;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.friend-card-info h3 { margin: 0 0 6px; font-size: 1.25rem; }
.friend-card-info p { margin: 0 0 14px; color: #b9d5e8; font-size: 0.9rem; }
.friend-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Social Links Form */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

/* Security Section */
.settings-section {
  margin-top: 24px;
  padding: 20px;
  border-radius: 14px;
  background: #09223c;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.settings-section h3 { margin: 0 0 12px; font-size: 1.2rem; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.setting-info strong { display: block; font-size: 0.95rem; }
.setting-info .hint { color: #8eb3d6; font-size: 0.82rem; }
.setting-current { display: block; margin-top: 4px; color: #75cfff; font-size: 0.85rem; font-weight: 700; }

/* Admin Consoles */
.admin-console-card {
  margin-top: 28px;
  border-color: rgba(255, 196, 92, 0.35);
  background: radial-gradient(circle at 10% 0%, rgba(41, 75, 115, 0.35), transparent 45%), #081a2e;
}
.admin-console-card > header {
  margin-bottom: 20px;
}
.admin-console-card h3 {
  margin: 2px 0 6px;
  font-size: 1.4rem;
  color: #fff;
}

.admin-wheel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
}
.admin-wheel-label {
  display: block;
  margin-bottom: 8px;
  color: #75cfff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-choice-wheel {
  display: flex;
  gap: 10px;
  min-height: 184px;
  padding: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: calc(50% - 74px);
  border: 1px solid #1c4a75;
  border-radius: 14px;
  background: #051322;
  scrollbar-color: #35a5df #0a1f33;
}
.admin-choice-wheel::-webkit-scrollbar { height: 8px; }
.admin-choice-wheel::-webkit-scrollbar-thumb { border-radius: 999px; background: #35a5df; }

.admin-wheel-card {
  position: relative;
  display: flex;
  flex: 0 0 150px;
  min-height: 150px;
  padding: 14px 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  scroll-snap-align: center;
  border: 1px solid #1c4d79;
  border-radius: 14px;
  background: linear-gradient(165deg, #0e2d4d, #061729);
  color: #cde4f7;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.admin-wheel-card:hover {
  transform: translateY(-2px);
  border-color: #75cfff;
  color: #fff;
}
.admin-wheel-card.is-selected {
  transform: scale(1.04);
  border-color: #75cfff;
  background: linear-gradient(165deg, #184878, #0b2440);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(117, 207, 255, 0.3), 0 10px 24px rgba(0, 0, 0, 0.5);
}

.admin-wheel-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #75cfff;
}

.admin-wheel-card strong {
  font-size: 0.82rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-wheel-card small {
  font-size: 0.72rem;
  color: #8fb8dc;
}

.admin-action-card .action-icon {
  font-size: 1.8rem;
  margin-bottom: 2px;
}

.admin-user-trash {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px dashed rgba(255, 107, 107, 0.4);
  border-radius: 11px;
  background: rgba(46, 12, 12, 0.4);
  color: #ffb4b4;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.admin-user-trash:hover, .admin-user-trash.is-drag-over {
  border-color: #ff6b6b;
  background: rgba(70, 18, 18, 0.7);
  color: #fff;
}

.admin-user-bag {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #1a4975;
  border-radius: 14px;
  background: #061626;
}
.admin-user-bag > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.admin-bag-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}
.admin-bag-items {
  display: flex;
  gap: 10px;
  min-height: 120px;
  padding: 10px;
  overflow-x: auto;
  border: 1px dashed #1c4c79;
  border-radius: 12px;
  background: #040e1a;
}
.admin-bag-prize {
  display: flex;
  flex: 0 0 120px;
  min-height: 100px;
  padding: 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid #205c92;
  border-radius: 11px;
  background: linear-gradient(155deg, #103861, #081d33);
  color: #e1f1ff;
  cursor: pointer;
  transition: transform 0.15s;
}
.admin-bag-prize:hover { transform: translateY(-2px); border-color: #75cfff; }

.admin-bag-trash {
  display: flex;
  min-height: 120px;
  padding: 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px dashed rgba(255, 107, 107, 0.4);
  border-radius: 12px;
  background: rgba(30, 8, 8, 0.5);
  color: #ffb4b4;
  text-align: center;
  cursor: pointer;
}
.admin-bag-trash:hover, .admin-bag-trash.is-drag-over {
  border-color: #ff6b6b;
  background: rgba(55, 12, 12, 0.8);
}

.admin-command-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(117, 207, 255, 0.3);
  border-radius: 14px;
  background: #092745;
  flex-wrap: wrap;
}
.admin-command-buttons {
  display: flex;
  gap: 8px;
}
.admin-command-status {
  min-height: 24px;
  margin: 12px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #9ecbee;
}
.admin-command-status.success { color: #52e3a8; }
.admin-command-status.error { color: #ff9e9e; }

/* Admin Prize & Giveaway Lists */
.admin-prize-list, .admin-giveaway-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.admin-prize-card, .admin-giveaway-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #1c4a75;
  border-radius: 12px;
  background: #09213a;
}
.admin-prize-card.is-archived, .admin-giveaway-card.is-archived {
  opacity: 0.6;
}

/* Print Sheets */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .account-shell > header, .status-card, .auth-grid, .profile-card, nav, .admin-wheel-grid,
  .admin-command-confirm, .admin-command-status, .admin-qr-controls, .admin-mail-controls, button {
    display: none !important;
  }
  .mail-label-sheet, .qr-print-sheet {
    display: grid !important;
    color: #000 !important;
    background: #fff !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .auth-grid { grid-template-columns: 1fr; }
  .admin-wheel-grid { grid-template-columns: 1fr; }
  .friend-card-content { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .admin-bag-body { grid-template-columns: 1fr; }
}

[hidden] { display: none !important; }
