:root {
  --bg: #0D1117;
  --surface: #14141C;
  --gold: #D4A843;
  --orange: #FF8C00;
  --red: #DC3545;
  --green: #28A745;
  --text: #E8E8E8;
  --muted: #8E8E93;
  --border: #1E1E33;
  --rivet: #4A4A4D;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  box-shadow: 0 0 60px rgba(0,0,0,.5);
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(180deg, #14141C 0%, #101016 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-box {
  width: 36px; height: 36px;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  color: #0D1117;
  border: 2px solid #B8912E;
}
.logo-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .5px;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-name {
  font-size: 12px;
  color: var(--muted);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A843, #8B6914);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #0D1117;
  border: 2px solid var(--border);
}

/* ─── Donate Bar ─── */
.donate-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 12px 16px;
  background: linear-gradient(135deg, rgba(212,168,67,.06) 0%, rgba(255,165,0,.03) 100%);
  border: 1px solid rgba(212,168,67,.15);
  border-radius: 4px;
  position: relative;
}
.donate-bar::before,
.donate-bar::after {
  content: '';
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D);
}
.donate-bar::before { top: 4px; left: 4px; }
.donate-bar::after  { top: 4px; right: 4px; }
.donate-bar .d-bl { position: absolute; bottom: 4px; left: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }
.donate-bar .d-br { position: absolute; bottom: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }

.donate-bar .btc-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #F7931A, #E07B10);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.2);
}

.donate-bar .donate-info { flex: 1; min-width: 0; }
.donate-bar .donate-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-transform: uppercase;
}
.donate-bar .donate-address {
  font-size: 10px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.donate-bar .copy-btn {
  flex-shrink: 0;
  width: 30px; height: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.donate-bar .copy-btn:hover { background: #1E1E28; border-color: var(--gold); }
.donate-bar .copy-btn.copied { color: var(--green); border-color: var(--green); }

/* ─── Stats Row ─── */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 0 16px 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 8px 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-card.gold  { border-top: 2px solid var(--gold); }
.stat-card.orange { border-top: 2px solid var(--orange); }
.stat-card.red    { border-top: 2px solid var(--red); }

.stat-card .rivet-tl, .stat-card .rivet-tr,
.stat-card .rivet-bl, .stat-card .rivet-br {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D);
}
.stat-card .rivet-tl { top: 4px; left: 4px; }
.stat-card .rivet-tr { top: 4px; right: 4px; }
.stat-card .rivet-bl { bottom: 4px; left: 4px; }
.stat-card .rivet-br { bottom: 4px; right: 4px; }

.stat-number {
  font-size: 28px; font-weight: 900;
  line-height: 1;
}
.stat-card.gold  .stat-number { color: var(--gold); }
.stat-card.orange .stat-number { color: var(--orange); }
.stat-card.red    .stat-number { color: var(--red); }

.stat-icon {
  font-size: 18px;
  margin: 4px 0 2px;
  opacity: .7;
}

.stat-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.05);
  border-radius: 2px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .5s ease;
}
.gold-fill  { background: var(--gold); }
.orange-fill { background: var(--orange); }
.red-fill   { background: var(--red); }

/* ─── Section Header ─── */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
}
.section-header .arrow { color: var(--gold); font-size: 10px; }
.section-header h2 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ─── Project List ─── */
.project-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 24px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s;
  text-decoration: none;
  color: inherit;
}
.project-card:hover { border-color: var(--gold); }

.project-card::before { content: ''; position: absolute; top: 4px; left: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }
.project-card::after  { content: ''; position: absolute; top: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }
.project-card .r-bl    { position: absolute; bottom: 4px; left: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }
.project-card .r-br    { position: absolute; bottom: 4px; right: 4px; width: 5px; height: 5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D); }

.project-photo {
  width: 64px; height: 64px;
  border-radius: 6px;
  background: #1A1A24;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.project-info { flex: 1; min-width: 0; }
.project-name {
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-address {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.status-dot.red    { background: var(--red);    box-shadow: 0 0 6px var(--red); }
.status-dot.green  { background: var(--green);  box-shadow: 0 0 6px var(--green); }

.status-text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.status-text.orange { color: var(--orange); }
.status-text.red    { color: var(--red); }
.status-text.green  { color: var(--green); }

.progress-badge {
  margin-left: auto;
  font-weight: 800;
  font-size: 15px;
  color: var(--gold);
}

.chevron {
  color: var(--muted);
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Loading / Error ─── */
.loading-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 16px;
  color: var(--muted);
  font-size: 14px;
}
.error-icon { font-size: 48px; }
.retry-btn {
  background: var(--surface);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.retry-btn:hover { background: #1E1E28; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Login Form ─── */
.login-card {
  max-width: 360px;
  margin: 40px auto;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}
.login-card::before,
.login-card::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6B6B70, #4A4A4D);
}
.login-card::before { top: 6px; left: 6px; }
.login-card::after  { top: 6px; right: 6px; }

.login-icon { text-align: center; font-size: 40px; margin-bottom: 8px; }
.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
}

.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: var(--gold); }
.login-field input::placeholder { color: #555; }

.login-error {
  background: rgba(220,53,69,.1);
  border: 1px solid rgba(220,53,69,.3);
  color: var(--red);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--gold);
  color: #0D1117;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.login-btn:hover { background: #C49A2E; }
.login-btn:disabled { opacity: .5; cursor: not-allowed; }

.spinner-sm {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: #0D1117;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.logout-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.logout-link:hover { color: var(--red); }

/* ─── Responsive ─── */
@media (min-width: 768px) {
  .app { max-width: 720px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .app { max-width: 960px; }
}

/* ─── Org Switcher ─── */
.org-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 0 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.org-switcher .org-icon {
  font-size: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.org-switcher select {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B949E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.org-switcher select:focus {
  outline: none;
  border-color: var(--gold);
}

.org-switcher .org-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}
