@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&display=swap");

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0b0d12;
  --bg-surface: rgba(21, 26, 39, 0.92);
  --bg-surface-hover: rgba(29, 36, 54, 0.95);
  --input-bg: rgba(11, 13, 18, 0.5);
  --list-item-bg: rgba(21, 26, 39, 0.6);
  --body-gradient-from: #1a2233;
  --body-gradient-to: #0b0d12;
  --glow-1: rgba(247, 199, 119, 0.10);
  --glow-2: rgba(247, 199, 119, 0.05);
  --card-border: rgba(132, 149, 192, 0.12);
  --ghost-btn-bg: rgba(132, 149, 192, 0.1);
  --border-color: rgba(132, 149, 192, 0.15);
  --text-primary: #f8f4ef;
  --text-secondary: #a2b3d6;
  --text-muted: #6c7d9b;
  --primary: #f7c777;
  --primary-hover: #f9d596;
  --danger: #f87171;
  --info: #60a5fa;
  --shadow: 0 18px 40px rgba(7, 10, 18, 0.5);
  --radius: 16px;
  --ring: 0 0 0 1px var(--border-color);
  
  --bg: var(--bg-base);
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --accent: var(--primary);
  --accent-dark: var(--primary-hover);
  --surface: var(--bg-surface);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-base: #f3f0e8;
  --bg-surface: rgba(255, 255, 255, 0.94);
  --bg-surface-hover: rgba(248, 245, 238, 0.98);
  --input-bg: rgba(255, 255, 255, 0.92);
  --list-item-bg: rgba(255, 255, 255, 0.85);
  --body-gradient-from: #e8e4da;
  --body-gradient-to: #f3f0e8;
  --glow-1: rgba(247, 199, 119, 0.18);
  --glow-2: rgba(247, 199, 119, 0.08);
  --card-border: rgba(18, 18, 18, 0.08);
  --ghost-btn-bg: rgba(15, 18, 28, 0.05);
  --border-color: rgba(18, 18, 18, 0.1);
  --text-primary: #1a1d24;
  --text-secondary: #4b5568;
  --text-muted: #6b7280;
  --shadow: 0 18px 40px rgba(15, 18, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(circle at top left, var(--body-gradient-from), var(--body-gradient-to) 70%);
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.bg-glow {
  position: fixed;
  inset: -30% 0 auto 0;
  height: 50vh;
  background: radial-gradient(circle at 80% 0%, var(--glow-1), transparent 55%),
    radial-gradient(circle at 15% 30%, var(--glow-2), transparent 60%);
  filter: blur(12px);
  pointer-events: none;
  animation: floatGlow 16s ease-in-out infinite;
  z-index: -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-weight: 700;
  font-size: 16px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(247, 199, 119, 0.1);
  color: var(--accent);
  border: 1px solid rgba(247, 199, 119, 0.2);
  display: grid;
  place-items: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 10px 18px rgba(7, 10, 18, 0.2);
}

.brand-title {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: rgba(247, 199, 119, 0.1);
  border: 1px solid rgba(247, 199, 119, 0.2);
  border-radius: 999px;
  padding: 6px 10px;
}

.app {
  padding: 12px 20px 48px;
  max-width: 1080px;
  margin: 0 auto;
}

.view {
  animation: fadeSlide 0.4s ease;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
  backdrop-filter: blur(2px);
  animation: cardLift 0.5s ease both;
}

.grid {
  display: grid;
  gap: 16px;
}

#userActiveView .card,
#userEndView .card {
  margin-bottom: 16px;
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

h1, h2 {
  margin: 0 0 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
  margin: 0 0 16px;
}

.form {
  display: grid;
  gap: 12px;
}

.form.compact {
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, select {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--ink);
  box-shadow: var(--ring);
}

input[type="file"] {
  padding: 8px 10px;
  background: var(--input-bg);
  color: var(--text-secondary);
}

input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #1a1d24;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 12px;
  font-family: inherit;
  font-size: 13px;
  transition: opacity 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
  opacity: 0.9;
}

/* Hide number input arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

.btn {
  background: var(--accent);
  color: #1a1d24;
  border: none;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 18px rgba(247, 199, 119, 0.18);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(247, 199, 119, 0.22);
}

.btn.warn {
  background: var(--danger);
  box-shadow: 0 10px 18px rgba(248, 113, 113, 0.2);
}

.btn.ghost {
  background: var(--ghost-btn-bg);
  color: var(--ink);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

.theme-toggle-btn {
  min-width: 42px;
  padding: 10px 12px;
}

.theme-toggle-btn .theme-icon-moon {
  display: inline;
}

.theme-toggle-btn .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .theme-icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .theme-icon-sun {
  display: inline;
}

.status {
  font-weight: 600;
  margin-bottom: 12px;
}

.error {
  color: var(--danger);
  font-size: 13px;
}

.helper {
  font-size: 12px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  border-radius: 14px;
  background: var(--list-item-bg);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.list-item.stack {
  flex-direction: column;
  align-items: flex-start;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  background: rgba(96, 165, 250, 0.15);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--info);
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result {
  font-size: 14px;
  line-height: 1.6;
}

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

@keyframes floatGlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}

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

.account-balance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid rgba(18, 18, 18, 0.05);
}
@media (max-width: 600px) {
  .account-balance-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.proof-upload-status {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  min-height: 14px;
}

.proof-upload-status.is-uploading {
  color: var(--info);
}

.proof-upload-status.is-done {
  color: var(--accent);
}

.proof-upload-status.is-error {
  color: var(--danger);
}

.image-preview {
  margin-top: 8px;
}
.preview-item {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #d9d2c3;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.btn-remove-preview {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.btn-remove-preview:hover {
  background: rgba(198, 69, 44, 0.9);
}
