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

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

:root {
  --bg:       #0a0a0a;
  --surface:  #111111;
  --border:   #1f1f1f;
  --muted:    #3f3f3f;
  --text:     #e8e8e8;
  --subtle:   #666666;
  --accent:   #e8e8e8;
  --green:    #4ade80;
  --red:      #f87171;
  --amber:    #fbbf24;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* ── Auth Card ── */
.auth-wrap {
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.brand svg { color: var(--text); }
.brand span { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }

.form-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.4rem;
}

.form-sub {
  color: var(--subtle);
  font-size: 0.85rem;
  margin-bottom: 1.75rem;
}

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--subtle);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus { border-color: var(--muted); }
select option { background: var(--surface); }
textarea { min-height: 88px; resize: vertical; }

.btn {
  width: 100%;
  padding: 0.7rem;
  border: none;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.25rem;
}

.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--subtle);
  border: 1px solid var(--border);
  margin-top: 0.6rem;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); opacity: 1; }

.btn-danger { background: transparent; color: var(--red); border: 1px solid #2a1a1a; }
.btn-danger:hover { background: #1a0a0a; opacity: 1; }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; width: auto; }

.toggle-link {
  display: block;
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: var(--subtle);
}
.toggle-link a { color: var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.msg-error   { color: var(--red);   font-size: 0.82rem; margin-bottom: 0.75rem; min-height: 1rem; display:flex; align-items:center; gap:0.35rem; }
.msg-success { color: var(--green); font-size: 0.82rem; margin-bottom: 0.75rem; min-height: 1rem; display:flex; align-items:center; gap:0.35rem; }

/* ── Dashboard Layout ── */
body.dash {
  display: block;
  align-items: unset;
  justify-content: unset;
  padding: 0;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar .brand { margin-bottom: 2rem; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  color: var(--subtle);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: color 0.15s, background 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--border); }
.nav-item.active { color: var(--text); background: var(--border); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer { padding-top: 1rem; border-top: 1px solid var(--border); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-info .uname { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .ubal  { font-size: 0.75rem; color: var(--green); }

/* Main content */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 960px;
}

.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header p  { color: var(--subtle); font-size: 0.85rem; margin-top: 0.2rem; }

/* ── Task List ── */
.task-list { display: flex; flex-direction: column; gap: 0.5rem; }

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 1rem;
  transition: border-color 0.15s;
}
.task-row:hover { border-color: var(--muted); }
.task-row.done  { opacity: 0.45; }

.task-info { flex: 1; min-width: 0; }
.task-info h3 { font-size: 0.9rem; font-weight: 600; }
.task-info p  { font-size: 0.8rem; color: var(--subtle); margin-top: 0.15rem; }

.task-meta { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.task-reward { font-size: 0.85rem; font-weight: 600; color: var(--green); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-green  { background: #0d2818; color: var(--green); }
.badge-muted  { background: var(--border); color: var(--subtle); }
.badge-amber  { background: #1f1500; color: var(--amber); }
.badge-red    { background: #1f0808; color: var(--red); }
.badge-purple { background: #150d1f; color: #c084fc; }

/* ── Withdraw Form ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 440px;
}

/* ── History List ── */
.history-list { display: flex; flex-direction: column; gap: 0.5rem; }

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 1rem;
}

.history-row .amount { font-weight: 700; font-size: 0.95rem; }
.history-row .meta   { font-size: 0.78rem; color: var(--subtle); margin-top: 0.15rem; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}
.stat-card .stat-val   { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.2rem; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--subtle); }

/* ── Admin Table ── */
.table-wrap { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  color: var(--subtle);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.admin-table tr:last-child td { border-bottom: none; }

/* ── Withdrawal Cards (admin) ── */
.w-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
}
.w-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.w-card-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

.btn-approve { background: transparent; color: var(--green); border: 1px solid #0d2818; }
.btn-approve:hover { background: #0d2818; opacity: 1; }
.btn-reject  { background: transparent; color: var(--red); border: 1px solid #1f0808; }
.btn-reject:hover  { background: #1f0808; opacity: 1; }

.task-row.highlight { border-color: var(--muted); }

.empty-state {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--subtle);
  font-size: 0.85rem;
}

/* Dashboard home */
.mobile-header { display: none; }
.balance-card {
  background: linear-gradient(115deg, #151515, #242424);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 2.25rem;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}
.balance-label { color: var(--subtle); font-size: 0.75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.balance-card strong { margin: .55rem 0; font-size: clamp(2.4rem, 6vw, 4.25rem); letter-spacing: -.06em; }
.balance-total { color: var(--subtle); font-size: .84rem; }
.bottom-nav { display: none; }
.survey-dialog { width: min(92vw, 560px); max-height: 88vh; overflow: auto; padding: 1.25rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.survey-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.survey-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.survey-dialog h2 { font-size: 1.15rem; }
.survey-kicker { color: var(--subtle); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .25rem; }
.survey-intro { color: var(--subtle); font-size: .8rem; line-height: 1.5; margin: 1rem 0; }
.dialog-close { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: transparent; font-size: 1.35rem; line-height: 1; }
.survey-question { display: block; margin: 0 0 1rem; }
.survey-question span { display: block; margin-bottom: .45rem; font-size: .84rem; font-weight: 600; line-height: 1.4; }
.survey-question textarea { min-height: 72px; }
.toast-region { position: fixed; z-index: 100; top: 1rem; right: 1rem; display: grid; gap: .65rem; width: min(360px, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; padding: .85rem .9rem; color: var(--text); background: #181818; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 16px 35px rgba(0,0,0,.35); font-size: .84rem; font-weight: 500; animation: toast-in .2s ease-out; pointer-events: auto; }
.toast-success svg { color: var(--green); }
.toast-error svg { color: var(--red); }
.toast button { border: 0; color: var(--subtle); background: transparent; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.toast-out { animation: toast-out .18s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }
.withdrawal-notice { margin-bottom: 1rem; padding: .75rem .85rem; color: var(--amber); background: #1f1500; border: 1px solid #3a2a00; border-radius: 8px; font-size: .78rem; line-height: 1.45; }
.withdrawal-notice.eligible { color: var(--green); background: #0d2818; border-color: #14532d; }

/* ── Payment Method Cards ── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--subtle);
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.method-card:hover { border-color: var(--muted); color: var(--text); }
.method-card.active { border-color: var(--text); color: var(--text); background: var(--surface); box-shadow: 0 0 0 1px var(--text); }
.submission-answers { margin-top: .65rem; color: var(--subtle); font-size: .78rem; }
.submission-answers summary { cursor: pointer; color: var(--text); }
.submission-answers ol { margin: .55rem 0 0 1.1rem; display: grid; gap: .35rem; line-height: 1.4; }

/* ── Responsive ── */
@media (max-width: 640px) {
  body.dash { background: var(--bg); }
  .sidebar { display: none; }
  .layout { display: block; }
  .main { margin-left: 0; padding: 1rem 1rem 6.5rem; max-width: none; }
  .mobile-header { display: flex; justify-content: space-between; align-items: center; height: 44px; margin-bottom: 1.35rem; }
  .mobile-brand { font-size: 1.15rem; font-weight: 700; letter-spacing: -.04em; }
  .more-button { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); }
  .balance-card { min-height: 190px; margin-bottom: 1.8rem; padding: 1.5rem; border-radius: 16px; }
  .page-header { margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.15rem; }
  .task-list { gap: .75rem; }
  .task-row { align-items: flex-start; flex-direction: column; padding: 1rem; border-radius: 14px; }
  .task-meta { width: 100%; justify-content: space-between; }
  .task-meta .btn { flex: 1; max-width: 155px; }
  .form-card { padding: 1.15rem; border-radius: 14px; }
  .bottom-nav { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom)); background: rgba(17, 17, 17, .96); border-top: 1px solid var(--border); backdrop-filter: blur(12px); }
  .bottom-nav-item { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .22rem; border: 0; color: var(--subtle); background: transparent; font: inherit; font-size: .65rem; font-weight: 600; }
  .bottom-nav-item.active { color: var(--text); }
  .bottom-nav-item.active svg { stroke-width: 2.7; }
  .history-row { padding: .9rem 1rem; }
}
