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

:root {
  --green: #2E8B57;
  --green-dark: #1B5E3A;
  --gold: #FFD700;
  --gold-dim: #B8960C;
  --bg: #0D1117;
  --bg-card: #161B22;
  --bg-input: #0D1117;
  --border: #30363D;
  --text: #E6EDF3;
  --text-dim: #8B949E;
  --red: #F85149;
  --success: #3FB950;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* NAV */
nav {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.coin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--green-dark);
  border-radius: 50%;
  font-weight: 900;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 0.15rem;
  padding: 0 0.5rem 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: rgba(46, 139, 87, 0.2);
}

.nav-link.active {
  color: var(--gold);
}

.btn-small {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.btn-small:hover {
  color: var(--red);
  border-color: var(--red);
}

@media (min-width: 600px) {
  nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
  }
  .nav-top { padding: 0; }
  .nav-links { padding: 0; }
}

/* MAIN */
#app {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.card-value .unit {
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* GRID */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .grid-2 { grid-template-columns: 1fr; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.78rem; }
}

/* FORMS */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

input, select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input:focus {
  border-color: var(--green);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.15);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--bg);
}

.btn-gold:hover {
  filter: brightness(1.1);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* TRANSACTIONS LIST */
.tx-list {
  list-style: none;
}

.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-info {
  display: flex;
  flex-direction: column;
}

.tx-type {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.tx-amount {
  font-weight: 600;
  font-size: 1.05rem;
}

.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--red); }

/* LOGIN PAGE */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 85vh;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--green-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 1rem;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 0 60px rgba(255, 215, 0, 0.5); }
}

.login-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.login-form {
  width: 100%;
  max-width: 400px;
}

.login-form input {
  text-align: center;
  font-family: monospace;
  font-size: 0.8rem;
}

.login-form .btn {
  margin-top: 0.75rem;
}

/* PRICE DISPLAY */
.price-big {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
}

.price-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* TABLE */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* QR CODE */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
}

.qr-container canvas, .qr-container img {
  border-radius: 12px;
  background: white;
  padding: 12px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 1000;
  transition: opacity 0.3s;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--red); color: var(--red); }

/* PAGE HEADER */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* SECTION SPACING */
.section {
  margin-bottom: 1.5rem;
}

/* STATS ROW */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 120px;
}

/* CHART PERIOD BUTTONS */
.chart-period-btns {
  display: flex;
  gap: 0.25rem;
}

.chart-period {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.chart-period.active {
  background: var(--green-dark);
  color: var(--gold);
  border-color: var(--green);
}
