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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f5f3;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: #fff;
  border-bottom: 1px solid #e8e8e6;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #1a1a1a;
}

.logo span { color: #2d6a4f; }

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  font-size: 13px;
  color: #666;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-links a:hover { background: #f5f5f3; color: #1a1a1a; }
.nav-links a.active { color: #1a1a1a; font-weight: 500; background: #f5f5f3; }

.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { font-size: 13px; color: #666; }
.nav-logout { font-size: 13px; color: #666; text-decoration: none; }
.nav-logout:hover { color: #1a1a1a; }

.main { padding: 28px 24px; max-width: 1100px; margin: 0 auto; }

.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 20px; font-weight: 600; margin-bottom: 2px; }
.page-sub { font-size: 13px; color: #888; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 10px;
  padding: 16px;
}

.metric-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.metric-value { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }
.metric-value.green { color: #2d6a4f; }
.metric-value.red { color: #c0392b; }
.metric-sub { font-size: 12px; color: #aaa; margin-top: 3px; }

.two-col {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 10px;
  padding: 20px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  margin-bottom: 16px;
}

.card-footer {
  text-align: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f0f0ee;
}

.card-footer a {
  font-size: 13px;
  color: #2d6a4f;
  text-decoration: none;
}

.holding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0ee;
}

.holding-row:last-child { border-bottom: none; }
.holding-left { display: flex; align-items: center; gap: 10px; }

.ticker-badge {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #e8f4ee;
  color: #2d6a4f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.holding-name { font-size: 13px; font-weight: 500; }
.holding-sector { font-size: 11px; color: #aaa; }
.holding-right { text-align: right; }
.holding-value { font-size: 13px; font-weight: 500; }
.holding-pnl { font-size: 11px; margin-top: 1px; }
.holding-pnl.pos { color: #2d6a4f; }
.holding-pnl.neg { color: #c0392b; }
.pos { color: #2d6a4f; }
.neg { color: #c0392b; }

.sector-row { margin-bottom: 12px; }
.sector-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.sector-pct { color: #888; }

.progress-bar {
  height: 4px;
  background: #f0f0ee;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #2d6a4f;
  border-radius: 2px;
  transition: width 0.3s;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.trades-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #aaa;
  padding: 0 8px 10px 0;
  border-bottom: 1px solid #f0f0ee;
}

.trades-table td {
  padding: 10px 8px 10px 0;
  border-bottom: 1px solid #f0f0ee;
  vertical-align: middle;
}

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

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-buy { background: #e8f4ee; color: #2d6a4f; }
.badge-sell { background: #e8f4ee; color: #2d6a4f; }
.badge-exit { background: #fef3e2; color: #b7791f; }

.empty-state {
  text-align: center;
  color: #aaa;
  padding: 32px 0;
  font-size: 13px;
}

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f5f3;
}

.auth-card {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  padding: 36px;
  width: 360px;
}

.auth-logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.auth-logo span { color: #2d6a4f; }
.auth-sub { font-size: 13px; color: #888; margin-bottom: 24px; }

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #e8e8e6;
  border-radius: 8px;
  background: #fafafa;
  color: #1a1a1a;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus { border-color: #2d6a4f; background: #fff; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary:hover { background: #333; }
.auth-link { font-size: 12px; color: #888; text-align: center; margin-top: 16px; }
.auth-link a { color: #2d6a4f; text-decoration: none; }

.flash {
  background: #fef3e2;
  border: 1px solid #f6c270;
  color: #b7791f;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.action-link {
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}

.action-link.green { color: #2d6a4f; }
.action-link.red { color: #c0392b; }

@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 10px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 2px;
  }

  .nav-links a {
    white-space: nowrap;
    font-size: 12px;
    padding: 5px 10px;
  }

  .nav-right { margin-left: auto; }

  .main {
    padding: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-value {
    font-size: 20px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .trades-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .page-header h1 {
    font-size: 18px;
  }
}

@media (max-width: 400px) {
  .metrics {
    grid-template-columns: 1fr;
  }
}