:root {
  --bg: #f5fbff;
  --card: #ffffff;
  --text: #0f1f2e;
  --muted: #6b7c93;
  --primary: #2ac3a2;
  --accent: #5ab0ff;
  --shadow: 0 8px 24px rgba(31, 43, 58, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, #eef7ff 0%, var(--bg) 100%);
  color: var(--text);
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: radial-gradient(1200px 1200px at 0% 0%, rgba(90,176,255,0.14) 0%, rgba(42,195,162,0.10) 100%), var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
}

.period {
  font-size: 14px;
  color: var(--muted);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(31,43,58,0.12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e8eef6;
}

.card-title {
  font-weight: 700;
  font-size: 18px;
}

.sparkline {
  width: 240px;
  height: 64px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 12px;
}

.metric {
  background: linear-gradient(180deg, #f8fdff 0%, #ffffff 100%);
  border: 1px solid #eef3f9;
  border-radius: 12px;
  padding: 12px;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text);
}

.wide {
  grid-column: 1 / -1;
}

.orders-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.orders th {
  text-align: left;
  padding: 12px 8px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid #f0f4f8;
  white-space: nowrap;
}

.orders td {
  padding: 12px 8px;
  border-bottom: 1px solid #f7f9fc;
  color: var(--text);
  white-space: nowrap;
}

.orders tr:last-child td {
  border-bottom: none;
}

.amount {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.pill.ok {
  background: #e6fcf5;
  color: #0ca678;
}

.pill.pending {
  background: #e7f5ff;
  color: #1c7ed6;
}

.pill.cancel {
  background: #f8f9fa;
  color: #868e96;
}

.pill.alert {
  background: #fff5f5;
  color: #fa5252;
}

.btn-refresh {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refresh:hover {
  background: #f1f3f5;
  color: var(--accent);
}

.btn-refresh:active {
  transform: scale(0.95);
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }
  .sparkline {
    width: 200px;
  }
}

@media (max-width: 740px) {
  .app {
    padding: 16px;
  }
  .dashboard {
    grid-template-columns: 1fr;
  }
  .sparkline {
    width: 180px;
  }
}
